-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathIPythClient.cs
More file actions
180 lines (159 loc) · 10.1 KB
/
IPythClient.cs
File metadata and controls
180 lines (159 loc) · 10.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
using Solnet.Programs.Models;
using Solnet.Pyth.Models;
using Solnet.Rpc;
using Solnet.Rpc.Core.Sockets;
using Solnet.Rpc.Types;
using Solnet.Wallet;
using System;
using System.Collections.Generic;
using System.Net.WebSockets;
using System.Threading.Tasks;
namespace Solnet.Pyth
{
/// <summary>
/// Specifies functionality for the Pyth Client.
/// </summary>
public interface IPythClient
{
/// <summary>
/// The websocket connection state.
/// </summary>
WebSocketState State { get; }
/// <summary>
/// The <see cref="IRpcClient"/> instance.
/// </summary>
IRpcClient RpcClient { get; }
/// <summary>
/// The <see cref="IStreamingRpcClient"/> instance.
/// </summary>
IStreamingRpcClient StreamingRpcClient { get; }
/// <summary>
/// The statistics of the current websocket connection.
/// </summary>
IConnectionStatistics ConnectionStatistics { get; }
/// <summary>
/// The cluster the client is connected to.
/// </summary>
Uri NodeAddress { get; }
/// <summary>
/// Connect to the <see cref="StreamingRpcClient"/> for data streaming. This is an asynchronous operation.
/// </summary>
/// <returns>A task which may connect to the Rpc.</returns>
Task ConnectAsync();
/// <summary>
/// Disconnects from the <see cref="StreamingRpcClient"/> for data streaming. This is an asynchronous operation.
/// </summary>
/// <returns>A task which may connect to the Rpc.</returns>
Task DisconnectAsync();
/// <summary>
/// Gets the given <see cref="MappingAccount"/>. This is an asynchronous operation.
/// </summary>
/// <param name="account">The <see cref="MappingAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="MappingAccount"/>s or null in case an error occurred.</returns>
Task<AccountResultWrapper<MappingAccount>> GetMappingAccountAsync(string account,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets the given <see cref="ProductAccount"/>.
/// </summary>
/// <param name="account">The <see cref="ProductAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="ProductAccount"/>s.</returns>
AccountResultWrapper<MappingAccount> GetMappingAccount(string account,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets the given <see cref="ProductAccount"/>. This is an asynchronous operation.
/// </summary>
/// <param name="account">The <see cref="ProductAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="ProductAccount"/>s or null in case an error occurred.</returns>
Task<AccountResultWrapper<ProductAccount>> GetProductAccountAsync(string account,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets the given <see cref="ProductAccount"/>.
/// </summary>
/// <param name="account">The <see cref="ProductAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="ProductAccount"/>s.</returns>
AccountResultWrapper<ProductAccount> GetProductAccount(string account,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets a list of <see cref="ProductAccount"/>s from the given <see cref="MappingAccount"/>. This is an asynchronous operation.
/// </summary>
/// <param name="mappingAccount">The <see cref="ProductAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="ProductAccount"/>s or null in case an error occurred.</returns>
Task<MultipleAccountsResultWrapper<List<ProductAccount>>> GetProductAccountsAsync(MappingAccount mappingAccount,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets a list of <see cref="ProductAccount"/>s from the given <see cref="MappingAccount"/>.
/// </summary>
/// <param name="mappingAccount">The <see cref="ProductAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="ProductAccount"/>s.</returns>
MultipleAccountsResultWrapper<List<ProductAccount>> GetProductAccounts(MappingAccount mappingAccount,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets the given <see cref="PriceDataAccount"/>. This is an asynchronous operation.
/// </summary>
/// <param name="account">The <see cref="PriceDataAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="PriceDataAccount"/>s or null in case an error occurred.</returns>
Task<AccountResultWrapper<PriceDataAccount>> GetPriceDataAccountAsync(string account,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets the given <see cref="PriceDataAccount"/>.
/// </summary>
/// <param name="account">The <see cref="PriceDataAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="PriceDataAccount"/>s.</returns>
AccountResultWrapper<PriceDataAccount> GetPriceDataAccount(string account,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets a list of <see cref="PriceDataAccount"/>s from the given list of <see cref="ProductAccount"/>.
/// This is an asynchronous operation.
/// </summary>
/// <param name="productAccounts">The <see cref="PriceDataAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="PriceDataAccount"/>s or null in case an error occurred.</returns>
Task<MultipleAccountsResultWrapper<List<PriceDataAccount>>> GetPriceDataAccountsAsync(
IEnumerable<ProductAccount> productAccounts,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Gets a list of <see cref="PriceDataAccount"/>s from the given list of <see cref="ProductAccount"/>.
/// </summary>
/// <param name="productAccounts">The <see cref="PriceDataAccount"/> <see cref="PublicKey"/>.</param>
/// <param name="commitment">The confirmation commitment parameter for the RPC call.</param>
/// <returns>The list of <see cref="PriceDataAccount"/>s.</returns>
MultipleAccountsResultWrapper<List<PriceDataAccount>> GetPriceDataAccounts(IEnumerable<ProductAccount> productAccounts,
Commitment commitment = Commitment.Finalized);
/// <summary>
/// Subscribe to a live feed of a <see cref="PriceDataAccount"/>, the given action is called on every notification received. This is an asynchronous operation.
/// </summary>
/// <param name="action">An action which receives the <see cref="Subscription"/>, the decoded <see cref="PriceDataAccount"/> and the corresponding block slot.</param>
/// <param name="priceAccountAddress">The <see cref="PublicKey"/> of the <see cref="PriceDataAccount"/>.</param>
/// <param name="commitment">The commitment parameter for the Rpc Client.</param>
/// <returns>The <see cref="Subscription"/> object containing the account's <see cref="PublicKey"/> and the <see cref="SubscriptionState"/>.</returns>
Task<Subscription> SubscribePriceDataAccountAsync(Action<Subscription, PriceDataAccount, ulong> action,
string priceAccountAddress, Commitment commitment = Commitment.Finalized);
/// <summary>
/// Subscribe to a live feed of a <see cref="PriceDataAccount"/>, the given action is called on every notification received.
/// </summary>
/// <param name="action">An action which receives the <see cref="Subscription"/>, the decoded <see cref="PriceDataAccount"/> and the corresponding block slot.</param>
/// <param name="priceAccountAddress">The <see cref="PublicKey"/> of the <see cref="PriceDataAccount"/>.</param>
/// <param name="commitment">The commitment parameter for the Rpc Client.</param>
/// <returns>The <see cref="Subscription"/> object containing the account's <see cref="PublicKey"/> and the <see cref="SubscriptionState"/>.</returns>
Subscription SubscribePriceDataAccount(Action<Subscription, PriceDataAccount, ulong> action,
string priceAccountAddress, Commitment commitment = Commitment.Finalized);
/// <summary>
/// Unsubscribe to a live feed of a <see cref="PriceDataAccount"/>. This is an asynchronous operation.
/// </summary>
/// <param name="priceAccountAddress">The <see cref="PublicKey"/> of the <see cref="PriceDataAccount"/>.</param>
Task UnsubscribePriceDataAccountAsync(string priceAccountAddress);
/// <summary>
/// Unsubscribe to a live feed of a <see cref="PriceDataAccount"/>.
/// </summary>
/// <param name="priceAccountAddress">The <see cref="PublicKey"/> of the <see cref="PriceDataAccount"/>.</param>
void UnsubscribePriceDataAccount(string priceAccountAddress);
}
}