@shelby-protocol/sdk 0.0.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +17 -10
- package/dist/browser/index.mjs +89 -28
- package/dist/{chunk-XWAPNLU6.mjs → chunk-2WEX3K7C.mjs} +6 -4
- package/dist/chunk-4MG4XGY4.mjs +91 -0
- package/dist/{chunk-SEXQTDX6.mjs → chunk-4ZOFT75Q.mjs} +16 -2
- package/dist/{chunk-BTHSKDJR.mjs → chunk-7PN65RDX.mjs} +44 -10
- package/dist/chunk-AABBONAF.mjs +34 -0
- package/dist/{chunk-ZPW742E7.mjs → chunk-AUQDI5BS.mjs} +17 -2
- package/dist/{chunk-HFGEQP5N.mjs → chunk-CGYJLKBU.mjs} +4 -4
- package/dist/chunk-CQ6QPIZK.mjs +37 -0
- package/dist/{chunk-VRLIOKWG.mjs → chunk-D6GQHO6G.mjs} +5 -1
- package/dist/chunk-E5QCRTBU.mjs +493 -0
- package/dist/chunk-HPPMI7DC.mjs +56 -0
- package/dist/chunk-IE6LYVIA.mjs +26 -0
- package/dist/{chunk-67F5YZ25.mjs → chunk-JTXYKO3U.mjs} +10 -0
- package/dist/{chunk-WJKSPJSS.mjs → chunk-KJ24NKPH.mjs} +46 -0
- package/dist/{chunk-WBFEX7OM.mjs → chunk-MV6FNYAU.mjs} +31 -7
- package/dist/{chunk-PZF2VTGP.mjs → chunk-NHWWORCH.mjs} +3 -1
- package/dist/{chunk-NLPIHQ7K.mjs → chunk-OGKZ575S.mjs} +6 -19
- package/dist/{chunk-5I3MBJGN.mjs → chunk-PJVWGMVI.mjs} +164 -35
- package/dist/{chunk-7UVMDCCR.mjs → chunk-SRV4YWFH.mjs} +232 -47
- package/dist/chunk-W37FZSMA.mjs +83 -0
- package/dist/chunk-WTICJPDB.mjs +0 -0
- package/dist/chunk-Z4FZ7W6L.mjs +39 -0
- package/dist/{chunk-QFWQ7FIC.mjs → chunk-ZEDD2MPU.mjs} +1 -1
- package/dist/{clay-codes-pdZFxI_B.d.ts → clay-codes-DHP-bYcP.d.ts} +6 -2
- package/dist/core/blobs.d.ts +2 -0
- package/dist/core/chunk.d.ts +10 -1
- package/dist/core/chunk.mjs +2 -2
- package/dist/core/clients/ShelbyBlobClient.d.ts +165 -12
- package/dist/core/clients/ShelbyBlobClient.mjs +13 -11
- package/dist/core/clients/ShelbyClient.d.ts +21 -4
- package/dist/core/clients/ShelbyClient.mjs +17 -14
- package/dist/core/clients/ShelbyClientConfig.d.ts +7 -2
- package/dist/{node → core}/clients/ShelbyMetadataClient.d.ts +3 -3
- package/dist/core/clients/ShelbyMetadataClient.mjs +9 -0
- package/dist/core/clients/ShelbyMicropaymentChannelClient.d.ts +349 -0
- package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +16 -0
- package/dist/core/clients/ShelbyPlacementGroupClient.d.ts +73 -0
- package/dist/core/clients/ShelbyPlacementGroupClient.mjs +11 -0
- package/dist/core/clients/ShelbyRPCClient.d.ts +30 -4
- package/dist/core/clients/ShelbyRPCClient.mjs +8 -8
- package/dist/core/clients/index.d.ts +11 -5
- package/dist/core/clients/index.mjs +35 -15
- package/dist/core/clients/utils.d.ts +54 -0
- package/dist/core/clients/utils.mjs +1 -1
- package/dist/core/commitments.d.ts +6 -2
- package/dist/core/commitments.mjs +5 -3
- package/dist/core/constants.d.ts +18 -3
- package/dist/core/constants.mjs +5 -1
- package/dist/core/erasure/clay-codes.d.ts +1 -1
- package/dist/core/erasure/clay-codes.mjs +5 -5
- package/dist/core/erasure/constants.d.ts +15 -3
- package/dist/core/erasure/constants.mjs +3 -1
- package/dist/core/erasure/default.d.ts +5 -2
- package/dist/core/erasure/default.mjs +12 -6
- package/dist/core/erasure/index.d.ts +3 -3
- package/dist/core/erasure/index.mjs +15 -7
- package/dist/core/erasure/provider.d.ts +1 -1
- package/dist/core/erasure/reed-solomon.d.ts +1 -1
- package/dist/core/erasure/reed-solomon.mjs +1 -1
- package/dist/core/erasure/utils.d.ts +1 -1
- package/dist/core/errors.d.ts +58 -0
- package/dist/core/errors.mjs +15 -0
- package/dist/core/index.d.ts +17 -10
- package/dist/core/index.mjs +89 -28
- package/dist/core/layout.d.ts +5 -16
- package/dist/core/layout.mjs +3 -9
- package/dist/core/networks.d.ts +1 -1
- package/dist/core/networks.mjs +1 -1
- package/dist/core/operations/generated/sdk.d.ts +207 -17
- package/dist/core/operations/generated/sdk.mjs +7 -1
- package/dist/core/operations/index.d.ts +9 -3
- package/dist/core/operations/index.mjs +10 -4
- package/dist/core/rpc-responses.d.ts +69 -0
- package/dist/core/rpc-responses.mjs +15 -0
- package/dist/core/types/blobs.d.ts +8 -4
- package/dist/core/types/encodings.d.ts +1 -1
- package/dist/core/types/index.d.ts +4 -2
- package/dist/core/types/index.mjs +12 -2
- package/dist/core/types/payments.d.ts +94 -0
- package/dist/core/types/payments.mjs +9 -0
- package/dist/core/types/placement_groups.d.ts +30 -1
- package/dist/core/types/placement_groups.mjs +1 -0
- package/dist/core/types/storage_providers.d.ts +32 -2
- package/dist/node/clients/ShelbyNodeClient.d.ts +9 -6
- package/dist/node/clients/ShelbyNodeClient.mjs +18 -15
- package/dist/node/clients/index.d.ts +7 -6
- package/dist/node/clients/index.mjs +19 -17
- package/dist/node/index.d.ts +17 -11
- package/dist/node/index.mjs +91 -34
- package/package.json +3 -2
- package/dist/chunk-CPNZAQVY.mjs +0 -29
- package/dist/chunk-GY5DCVVL.mjs +0 -86
- package/dist/chunk-RBFWGDMY.mjs +0 -30
- package/dist/node/clients/ShelbyMetadataClient.mjs +0 -9
- /package/dist/{chunk-DJJD2AXO.mjs → chunk-AD2G3QYD.mjs} +0 -0
- /package/dist/{chunk-MWDW4ROU.mjs → chunk-EM67QTMR.mjs} +0 -0
- /package/dist/{chunk-RNXGC54D.mjs → chunk-QQ57OGQ2.mjs} +0 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { Aptos, AccountAddress, Account, InputGenerateTransactionOptions, PendingTransactionResponse, InputGenerateTransactionPayloadData } from '@aptos-labs/ts-sdk';
|
|
2
|
+
import { ShelbyIndexerClient } from '../operations/index.js';
|
|
3
|
+
import { SenderBuiltMicropayment, ChannelInfo } from '../types/payments.js';
|
|
4
|
+
import { ShelbyClientConfig } from './ShelbyClientConfig.js';
|
|
5
|
+
import 'graphql-request';
|
|
6
|
+
import '../operations/generated/sdk.js';
|
|
7
|
+
import 'graphql';
|
|
8
|
+
import '../networks.js';
|
|
9
|
+
|
|
10
|
+
declare class ShelbyMicropaymentChannelClient {
|
|
11
|
+
readonly aptos: Aptos;
|
|
12
|
+
readonly deployer: AccountAddress;
|
|
13
|
+
readonly indexer: ShelbyIndexerClient;
|
|
14
|
+
/**
|
|
15
|
+
* The ShelbyMicropaymentChannelClient is used to interact with the Micropayment contract on the Aptos blockchain. This
|
|
16
|
+
* includes functions for the full lifecycle of micropayment channels: creation, withdrawals, expiration extensions, etc.
|
|
17
|
+
*
|
|
18
|
+
* @param config - The client configuration object.
|
|
19
|
+
* @param config.network - The Shelby network to use.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* const client = new ShelbyMicropaymentChannelClient({
|
|
24
|
+
* aptos: {
|
|
25
|
+
* network: Network.SHELBYNET,
|
|
26
|
+
* clientConfig: {
|
|
27
|
+
* API_KEY: "AG-***",
|
|
28
|
+
* },
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
constructor(config: ShelbyClientConfig);
|
|
34
|
+
/**
|
|
35
|
+
* Calls initialize function so caller can thereafter create micropayment channels.
|
|
36
|
+
*
|
|
37
|
+
* @param params.sender - The account that will be sending funds to various receivers in micropayment channels.
|
|
38
|
+
* @param params.options - Optional transaction building options.
|
|
39
|
+
*
|
|
40
|
+
* @returns An object containing the pending transaction.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
*
|
|
45
|
+
* const { transaction } = await client.initializePaymentChannels({
|
|
46
|
+
* sender: sender,
|
|
47
|
+
* });
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
initializePaymentChannels(params: {
|
|
51
|
+
sender: Account;
|
|
52
|
+
options?: InputGenerateTransactionOptions;
|
|
53
|
+
}): Promise<{
|
|
54
|
+
transaction: PendingTransactionResponse;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Creates a micropayment channel to start a channel bweteen a sender and a receiver for a specific asset.
|
|
58
|
+
*
|
|
59
|
+
* @param params.deployer - Optional deployer account address. Defaults to SHELBY_DEPLOYER.
|
|
60
|
+
* @param params.sender - The account that will be sending funds.
|
|
61
|
+
* @param params.receiver - The account that will be receiving funds.
|
|
62
|
+
* @param params.expirationMicros - The expiration of the micropayment channel.
|
|
63
|
+
* @param params.depositAmount - The amount of the asset locked to the channel.
|
|
64
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
65
|
+
* @param params.options - Optional transaction building options.
|
|
66
|
+
*
|
|
67
|
+
* @returns An object containing the pending transaction.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
*
|
|
72
|
+
* const { transaction } = await client.createChannel({
|
|
73
|
+
* sender: sender,
|
|
74
|
+
* receiver: receiver,
|
|
75
|
+
* expirationMicros: Date.now() * 1000 + 86400_000_000, // 1 day from now in microseconds
|
|
76
|
+
* depositAmount: 0.001,
|
|
77
|
+
* fungibleAssetAddress: fungibleAssetAddress,
|
|
78
|
+
* });
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
createChannel(params: {
|
|
82
|
+
sender: Account;
|
|
83
|
+
receiver: AccountAddress;
|
|
84
|
+
expirationMicros: number;
|
|
85
|
+
depositAmount: number;
|
|
86
|
+
fungibleAssetAddress: AccountAddress;
|
|
87
|
+
options?: InputGenerateTransactionOptions;
|
|
88
|
+
}): Promise<{
|
|
89
|
+
transaction: PendingTransactionResponse;
|
|
90
|
+
}>;
|
|
91
|
+
/**
|
|
92
|
+
* Creates a micropayment channel creation payload to start a channel between a sender and a receiver for a specific asset.
|
|
93
|
+
* This is a static helper method for constructing the Move function call payload.
|
|
94
|
+
*
|
|
95
|
+
* @param params.deployer - Optional deployer account address. Defaults to MICROPAYMENTS_DEPLOYER.
|
|
96
|
+
* @param params.sender - The account that will be sending funds.
|
|
97
|
+
* @param params.receiver - The account that will be receiving funds.
|
|
98
|
+
* @param params.expirationMicros - The expiration of the micropayment channel.
|
|
99
|
+
* @param params.depositAmount - The amount of the asset locked to the channel.
|
|
100
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
101
|
+
*
|
|
102
|
+
* @returns An Aptos transaction payload data object for the create_channel Move function.
|
|
103
|
+
*/
|
|
104
|
+
static makeCreateMicropaymentChannelPayload(params: {
|
|
105
|
+
deployer?: AccountAddress;
|
|
106
|
+
receiver: AccountAddress;
|
|
107
|
+
expirationMicros: number;
|
|
108
|
+
depositAmount: number;
|
|
109
|
+
fungibleAssetAddress: AccountAddress;
|
|
110
|
+
}): InputGenerateTransactionPayloadData;
|
|
111
|
+
/**
|
|
112
|
+
* Withdraws funds from a micropayment channel as the sender.
|
|
113
|
+
*
|
|
114
|
+
* @param params.sender - The account that is withdrawing funds.
|
|
115
|
+
* @param params.receiver - The account the channel is configured to send funds to.
|
|
116
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
117
|
+
* @param params.options - Optional transaction generation options.
|
|
118
|
+
*
|
|
119
|
+
* @returns An object containing the pending transaction.
|
|
120
|
+
*
|
|
121
|
+
* @example
|
|
122
|
+
* ```typescript
|
|
123
|
+
* const { transaction } = await client.senderWithdraw({
|
|
124
|
+
* sender: sender,
|
|
125
|
+
* receiver: receiver,
|
|
126
|
+
* fungibleAssetAddress: fungibleAssetAddress,
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
senderWithdraw(params: {
|
|
131
|
+
sender: Account;
|
|
132
|
+
receiver: AccountAddress;
|
|
133
|
+
fungibleAssetAddress: AccountAddress;
|
|
134
|
+
options?: InputGenerateTransactionOptions;
|
|
135
|
+
}): Promise<{
|
|
136
|
+
transaction: PendingTransactionResponse;
|
|
137
|
+
}>;
|
|
138
|
+
/**
|
|
139
|
+
* Creates a static payload for the sender_withdraw Move function.
|
|
140
|
+
* This is a helper method for constructing the transaction payload without signing.
|
|
141
|
+
*
|
|
142
|
+
* @param params.deployer - Optional deployer account address. Defaults to MICROPAYMENTS_DEPLOYER.
|
|
143
|
+
* @param params.receiver - The account address of the receiver.
|
|
144
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
145
|
+
*
|
|
146
|
+
* @returns An Aptos transaction payload data object for the sender_withdraw Move function.
|
|
147
|
+
*/
|
|
148
|
+
static createSenderWithdrawPayload(params: {
|
|
149
|
+
deployer?: AccountAddress;
|
|
150
|
+
receiver: AccountAddress;
|
|
151
|
+
fungibleAssetAddress: AccountAddress;
|
|
152
|
+
}): InputGenerateTransactionPayloadData;
|
|
153
|
+
/**
|
|
154
|
+
* Creates a micropayment that can be sent to a receiver.
|
|
155
|
+
*
|
|
156
|
+
* @param params.sender - The account address of the sender.
|
|
157
|
+
* @param params.receiver - The account that is withdrawing funds.
|
|
158
|
+
* @param params.amount - The amount to withdraw into the receiver's account.
|
|
159
|
+
* @param params.paymentChannelId - The id of the payment channel.
|
|
160
|
+
* @param params.sequenceNumber - The sequence number of the micropayment. These must be increasing to be able to store on chain.
|
|
161
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
162
|
+
* @param params.options - Optional transaction generation options.
|
|
163
|
+
*
|
|
164
|
+
* @returns An object containing the pending transaction and signature.
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const senderBuiltMicropayment = await client.createMicropayment({
|
|
169
|
+
* sender: senderAddress,
|
|
170
|
+
* receiver: receiver,
|
|
171
|
+
* amount: 1,
|
|
172
|
+
* paymentChannelId: channelIdFromLookup,
|
|
173
|
+
* sequenceNumber: localSequenceNumber,
|
|
174
|
+
* fungibleAssetAddress: fungibleAssetAddress,
|
|
175
|
+
* });
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
createMicropayment(params: {
|
|
179
|
+
sender: Account;
|
|
180
|
+
receiver: AccountAddress;
|
|
181
|
+
amount: number;
|
|
182
|
+
paymentChannelId: number;
|
|
183
|
+
sequenceNumber: number;
|
|
184
|
+
fungibleAssetAddress: AccountAddress;
|
|
185
|
+
options?: InputGenerateTransactionOptions;
|
|
186
|
+
}): Promise<SenderBuiltMicropayment>;
|
|
187
|
+
/**
|
|
188
|
+
* Creates a static payload for the receiver_withdraw Move function. This is what
|
|
189
|
+
* constitutes a miropaymet.
|
|
190
|
+
* This is a helper method for constructing the transaction payload without signing.
|
|
191
|
+
*
|
|
192
|
+
* @param params.deployer - Optional deployer account address. Defaults to MICROPAYMENTS_DEPLOYER.
|
|
193
|
+
* @param params.amount - The amount of the fungible asset's smallest increment to send.
|
|
194
|
+
* @param params.paymentChannelId - The payment channel id.
|
|
195
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
196
|
+
*
|
|
197
|
+
* @returns An Aptos transaction payload data object for the sender_withdraw Move function.
|
|
198
|
+
*/
|
|
199
|
+
static createMicropaymentTransactionPayload(params: {
|
|
200
|
+
deployer?: AccountAddress;
|
|
201
|
+
amount: number;
|
|
202
|
+
paymentChannelId: number;
|
|
203
|
+
sequenceNumber: number;
|
|
204
|
+
fungibleAssetAddress: AccountAddress;
|
|
205
|
+
}): InputGenerateTransactionPayloadData;
|
|
206
|
+
/**
|
|
207
|
+
* Withdraws funds from a micropayment channel as the receiver. The receiver
|
|
208
|
+
* does this by signing and submitting a signed transaction the sender sent it.
|
|
209
|
+
*
|
|
210
|
+
* @param params.receiver - The receiver withdrawing funds.
|
|
211
|
+
* @param params.receiverSignature - The fee-paying transaction signature.
|
|
212
|
+
* @param params.micropayment - The fee-paying transaction signature.
|
|
213
|
+
* @param params.options - Optional transaction generation options.
|
|
214
|
+
*
|
|
215
|
+
* @returns An object containing the pending transaction.
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```typescript
|
|
219
|
+
* const { transaction } = await client.receiverWithdraw({
|
|
220
|
+
* receiver: receiver,
|
|
221
|
+
* micropayment,
|
|
222
|
+
* senderSignature,
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
receiverWithdraw(params: {
|
|
227
|
+
receiver: Account;
|
|
228
|
+
micropayment: SenderBuiltMicropayment;
|
|
229
|
+
options?: InputGenerateTransactionOptions;
|
|
230
|
+
}): Promise<{
|
|
231
|
+
transaction: PendingTransactionResponse;
|
|
232
|
+
}>;
|
|
233
|
+
/**
|
|
234
|
+
* Extends the expiration time of a micropayment channel.
|
|
235
|
+
*
|
|
236
|
+
* @param params.sender - The owner of the account.
|
|
237
|
+
* @param params.receiver - The account address of the receiver.
|
|
238
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
239
|
+
* @param params.newExpirationMicros - The new expiration time in microseconds.
|
|
240
|
+
* @param params.options - Optional transaction generation options.
|
|
241
|
+
*
|
|
242
|
+
* @returns An object containing the pending transaction.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* const { transaction } = await client.extendExpirationTime({
|
|
247
|
+
* sender: sender,
|
|
248
|
+
* receiver: receiverAddress,
|
|
249
|
+
* fungibleAssetAddress: fungibleAssetAddress,
|
|
250
|
+
* newExpirationMicros: Date.now() * 1000 + 172800_000_000, // 2 days from now
|
|
251
|
+
* });
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
extendExpirationTime(params: {
|
|
255
|
+
sender: Account;
|
|
256
|
+
receiver: AccountAddress;
|
|
257
|
+
fungibleAssetAddress: AccountAddress;
|
|
258
|
+
newExpirationMicros: number;
|
|
259
|
+
options?: InputGenerateTransactionOptions;
|
|
260
|
+
}): Promise<{
|
|
261
|
+
transaction: PendingTransactionResponse;
|
|
262
|
+
}>;
|
|
263
|
+
/**
|
|
264
|
+
* Creates a payload to extend the expiration time on a micropayment channel.
|
|
265
|
+
* This is a static helper method for constructing the Move function call payload.
|
|
266
|
+
*
|
|
267
|
+
* @param params.deployer - Optional deployer account address. Defaults to MICROPAYMENTS_DEPLOYER.
|
|
268
|
+
* @param params.receiver - The account that will be receiving funds.
|
|
269
|
+
* @param params.expirationMicros - The new expiration of the micropayment channel.
|
|
270
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
271
|
+
*
|
|
272
|
+
* @returns An Aptos transaction payload data object for the extend_expiration_time Move function.
|
|
273
|
+
*/
|
|
274
|
+
static makeExtendExpirationTimePayload(params: {
|
|
275
|
+
deployer?: AccountAddress;
|
|
276
|
+
receiver: AccountAddress;
|
|
277
|
+
fungibleAssetAddress: AccountAddress;
|
|
278
|
+
newExpirationMicros: number;
|
|
279
|
+
}): InputGenerateTransactionPayloadData;
|
|
280
|
+
/**
|
|
281
|
+
* Increases the deposit amount locked in a micropayment channel.
|
|
282
|
+
*
|
|
283
|
+
* @param params.sender - The account that is increasing the deposit.
|
|
284
|
+
* @param params.receiver - The account address of the receiver.
|
|
285
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
286
|
+
* @param params.additionalAmount - The additional amount to deposit.
|
|
287
|
+
* @param params.options - Optional transaction generation options.
|
|
288
|
+
*
|
|
289
|
+
* @returns An object containing the pending transaction.
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* const { transaction } = await client.increaseDepositAmount({
|
|
294
|
+
* sender: sender,
|
|
295
|
+
* receiver: receiverAddress,
|
|
296
|
+
* fungibleAssetAddress: fungibleAssetAddress,
|
|
297
|
+
* additionalAmount: 500,
|
|
298
|
+
* });
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
increaseDepositAmount(params: {
|
|
302
|
+
sender: Account;
|
|
303
|
+
receiver: AccountAddress;
|
|
304
|
+
fungibleAssetAddress: AccountAddress;
|
|
305
|
+
additionalAmount: number;
|
|
306
|
+
options?: InputGenerateTransactionOptions;
|
|
307
|
+
}): Promise<{
|
|
308
|
+
transaction: PendingTransactionResponse;
|
|
309
|
+
}>;
|
|
310
|
+
/**
|
|
311
|
+
* Creates a payload to increase the deposit amount on a micropayment channel.
|
|
312
|
+
* This is a static helper method for constructing the Move function call payload.
|
|
313
|
+
*
|
|
314
|
+
* @param params.deployer - Optional deployer account address. Defaults to MICROPAYMENTS_DEPLOYER.
|
|
315
|
+
* @param params.receiver - The account that will be receiving funds.
|
|
316
|
+
* @param params.fungibleAssetAddress - The account address of the fungible asset.
|
|
317
|
+
* @param params.additionalAmount - The amount of the fungible asset to add to the channel's balance.
|
|
318
|
+
*
|
|
319
|
+
* @returns An Aptos transaction payload data object for the extend_expiration_time Move function.
|
|
320
|
+
*/
|
|
321
|
+
static makeIncreaseDepositAmountPayload(params: {
|
|
322
|
+
deployer?: AccountAddress;
|
|
323
|
+
receiver: AccountAddress;
|
|
324
|
+
fungibleAssetAddress: AccountAddress;
|
|
325
|
+
additionalAmount: number;
|
|
326
|
+
}): InputGenerateTransactionPayloadData;
|
|
327
|
+
/**
|
|
328
|
+
* Retrieves the vector of channels owned by the sender, optionally
|
|
329
|
+
* filtered by the receiver.
|
|
330
|
+
*
|
|
331
|
+
* @param params.sender - The account namespace owning the micropayment channels.
|
|
332
|
+
* @param params.receiver? - An optional receiver account address.
|
|
333
|
+
* @returns A vector of ChannelInfo objects.
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```typescript
|
|
337
|
+
* const channelInfoVec = await client.getChannelInfo({
|
|
338
|
+
* sender: AccountAddress.fromString("0x1"),
|
|
339
|
+
* receiver: AccountAddress.fromSTring("0x2"),
|
|
340
|
+
* });
|
|
341
|
+
* ```
|
|
342
|
+
*/
|
|
343
|
+
getChannelInfo(params: {
|
|
344
|
+
sender: AccountAddress;
|
|
345
|
+
receiver?: AccountAddress;
|
|
346
|
+
}): Promise<ChannelInfo[]>;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export { ShelbyMicropaymentChannelClient };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShelbyMicropaymentChannelClient
|
|
3
|
+
} from "../../chunk-E5QCRTBU.mjs";
|
|
4
|
+
import "../../chunk-QQ57OGQ2.mjs";
|
|
5
|
+
import "../../chunk-ZHXCVRZX.mjs";
|
|
6
|
+
import "../../chunk-AD2G3QYD.mjs";
|
|
7
|
+
import "../../chunk-MQUVYMNQ.mjs";
|
|
8
|
+
import "../../chunk-4MG4XGY4.mjs";
|
|
9
|
+
import "../../chunk-CGYJLKBU.mjs";
|
|
10
|
+
import "../../chunk-KJ24NKPH.mjs";
|
|
11
|
+
import "../../chunk-AABBONAF.mjs";
|
|
12
|
+
import "../../chunk-4ZOFT75Q.mjs";
|
|
13
|
+
import "../../chunk-7P6ASYW6.mjs";
|
|
14
|
+
export {
|
|
15
|
+
ShelbyMicropaymentChannelClient
|
|
16
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { PlacementGroupSlot } from '../types/placement_groups.js';
|
|
2
|
+
import { ShelbyIndexerClient } from '../operations/index.js';
|
|
3
|
+
import { Placement_Group_Slots_Bool_Exp, Placement_Group_Slots_Order_By } from '../operations/generated/sdk.js';
|
|
4
|
+
import { ShelbyClientConfig } from './ShelbyClientConfig.js';
|
|
5
|
+
import '@aptos-labs/ts-sdk';
|
|
6
|
+
import 'graphql-request';
|
|
7
|
+
import 'graphql';
|
|
8
|
+
import '../networks.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Client for interacting with placement groups on the Shelby network.
|
|
12
|
+
*
|
|
13
|
+
* This client provides methods to query placement group slots from the indexer.
|
|
14
|
+
*/
|
|
15
|
+
declare class ShelbyPlacementGroupClient {
|
|
16
|
+
readonly indexer: ShelbyIndexerClient;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new ShelbyPlacementGroupClient.
|
|
19
|
+
*
|
|
20
|
+
* @param config - The client configuration object.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const pgClient = new ShelbyPlacementGroupClient({
|
|
25
|
+
* network: Network.SHELBYNET,
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
constructor(config: ShelbyClientConfig);
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves placement group slots from the indexer.
|
|
32
|
+
*
|
|
33
|
+
* @param params.where (optional) - The where clause to filter slots by.
|
|
34
|
+
* @param params.pagination (optional) - The pagination options.
|
|
35
|
+
* @param params.orderBy (optional) - The order by clause to sort slots by.
|
|
36
|
+
* @returns The placement group slots that match the filter.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* // Get all active slots
|
|
41
|
+
* const slots = await client.getPlacementGroupSlots({
|
|
42
|
+
* where: { status: { _eq: "active" } },
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
getPlacementGroupSlots(params: {
|
|
47
|
+
where?: Placement_Group_Slots_Bool_Exp;
|
|
48
|
+
pagination?: {
|
|
49
|
+
limit?: number;
|
|
50
|
+
offset?: number;
|
|
51
|
+
};
|
|
52
|
+
orderBy?: Placement_Group_Slots_Order_By;
|
|
53
|
+
}): Promise<PlacementGroupSlot[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Retrieves the total count of placement group slots from the indexer.
|
|
56
|
+
*
|
|
57
|
+
* @param params.where (optional) - The where clause to filter slots by.
|
|
58
|
+
* @returns The count of placement group slots that match the filter.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* // Get count of active slots
|
|
63
|
+
* const count = await client.getPlacementGroupSlotsCount({
|
|
64
|
+
* where: { status: { _eq: "active" } },
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
getPlacementGroupSlotsCount(params: {
|
|
69
|
+
where?: Placement_Group_Slots_Bool_Exp;
|
|
70
|
+
}): Promise<number>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { ShelbyPlacementGroupClient };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ShelbyPlacementGroupClient
|
|
3
|
+
} from "../../chunk-W37FZSMA.mjs";
|
|
4
|
+
import "../../chunk-CGYJLKBU.mjs";
|
|
5
|
+
import "../../chunk-KJ24NKPH.mjs";
|
|
6
|
+
import "../../chunk-AABBONAF.mjs";
|
|
7
|
+
import "../../chunk-4ZOFT75Q.mjs";
|
|
8
|
+
import "../../chunk-7P6ASYW6.mjs";
|
|
9
|
+
export {
|
|
10
|
+
ShelbyPlacementGroupClient
|
|
11
|
+
};
|
|
@@ -2,13 +2,25 @@ import { AccountAddressInput } from '@aptos-labs/ts-sdk';
|
|
|
2
2
|
import { ShelbyBlob } from '../blobs.js';
|
|
3
3
|
import { BlobName } from '../layout.js';
|
|
4
4
|
import { ShelbyIndexerClient } from '../operations/index.js';
|
|
5
|
+
import { SenderBuiltMicropayment } from '../types/payments.js';
|
|
5
6
|
import { ShelbyRPCConfig, ShelbyClientConfig } from './ShelbyClientConfig.js';
|
|
6
7
|
import 'zod';
|
|
8
|
+
import '../../clay-codes-DHP-bYcP.js';
|
|
9
|
+
import '@shelby-protocol/clay-codes';
|
|
7
10
|
import 'graphql-request';
|
|
8
11
|
import '../operations/generated/sdk.js';
|
|
9
12
|
import 'graphql';
|
|
10
13
|
import '../networks.js';
|
|
11
14
|
|
|
15
|
+
type BlobDataSource = Uint8Array | ReadableStream<Uint8Array>;
|
|
16
|
+
type PutBlobProgress = {
|
|
17
|
+
phase: "uploading" | "finalizing";
|
|
18
|
+
partIdx: number;
|
|
19
|
+
totalParts: number;
|
|
20
|
+
partBytes: number;
|
|
21
|
+
uploadedBytes: number;
|
|
22
|
+
totalBytes: number;
|
|
23
|
+
};
|
|
12
24
|
declare class ShelbyRPCClient {
|
|
13
25
|
#private;
|
|
14
26
|
readonly baseUrl: string;
|
|
@@ -38,7 +50,8 @@ declare class ShelbyRPCClient {
|
|
|
38
50
|
*
|
|
39
51
|
* @param params.account - The account that owns the blob.
|
|
40
52
|
* @param params.blobName - The name/path of the blob (e.g. "folder/file.txt").
|
|
41
|
-
* @param params.blobData - The raw blob data as a Uint8Array.
|
|
53
|
+
* @param params.blobData - The raw blob data as a Uint8Array or ReadableStream.
|
|
54
|
+
* @param params.totalBytes - Total byte length. Required for streams; optional for Uint8Array.
|
|
42
55
|
*
|
|
43
56
|
* @example
|
|
44
57
|
* ```typescript
|
|
@@ -47,14 +60,17 @@ declare class ShelbyRPCClient {
|
|
|
47
60
|
* await client.putBlob({
|
|
48
61
|
* account: AccountAddress.from("0x1"),
|
|
49
62
|
* blobName: "greetings/hello.txt",
|
|
50
|
-
* blobData
|
|
63
|
+
* blobData,
|
|
51
64
|
* });
|
|
52
65
|
* ```
|
|
53
66
|
*/
|
|
54
67
|
putBlob(params: {
|
|
55
68
|
account: AccountAddressInput;
|
|
56
69
|
blobName: BlobName;
|
|
57
|
-
blobData:
|
|
70
|
+
blobData: BlobDataSource;
|
|
71
|
+
/** Required when blobData is a ReadableStream. Inferred from .length for Uint8Array. */
|
|
72
|
+
totalBytes?: number;
|
|
73
|
+
onProgress?: (progress: PutBlobProgress) => void;
|
|
58
74
|
}): Promise<void>;
|
|
59
75
|
/**
|
|
60
76
|
* Downloads a blob from the Shelby RPC node.
|
|
@@ -65,10 +81,12 @@ declare class ShelbyRPCClient {
|
|
|
65
81
|
* @param params.range - Optional byte range for partial downloads.
|
|
66
82
|
* @param params.range.start - Starting byte position (inclusive).
|
|
67
83
|
* @param params.range.end - Ending byte position (inclusive, optional).
|
|
84
|
+
* @param params.micropayment - Optional micropayment to attach to the request.
|
|
68
85
|
*
|
|
69
86
|
* @returns A ShelbyBlob object containing the account, name, readable stream, and content length.
|
|
70
87
|
*
|
|
71
88
|
* @throws Error if the download fails or content length doesn't match.
|
|
89
|
+
* @throws StaleChannelStateError if the micropayment is stale (server has newer state).
|
|
72
90
|
*
|
|
73
91
|
* @example
|
|
74
92
|
* ```typescript
|
|
@@ -84,6 +102,13 @@ declare class ShelbyRPCClient {
|
|
|
84
102
|
* blobName: "large-file.bin",
|
|
85
103
|
* range: { start: 100, end: 199 }
|
|
86
104
|
* });
|
|
105
|
+
*
|
|
106
|
+
* // Download with micropayment
|
|
107
|
+
* const blob = await client.getBlob({
|
|
108
|
+
* account: AccountAddress.from("0x1"),
|
|
109
|
+
* blobName: "documents/report.pdf",
|
|
110
|
+
* micropayment: senderBuiltMicropayment
|
|
111
|
+
* });
|
|
87
112
|
* ```
|
|
88
113
|
*/
|
|
89
114
|
getBlob(params: {
|
|
@@ -93,7 +118,8 @@ declare class ShelbyRPCClient {
|
|
|
93
118
|
start: number;
|
|
94
119
|
end?: number;
|
|
95
120
|
};
|
|
121
|
+
micropayment?: SenderBuiltMicropayment;
|
|
96
122
|
}): Promise<ShelbyBlob>;
|
|
97
123
|
}
|
|
98
124
|
|
|
99
|
-
export { ShelbyRPCClient };
|
|
125
|
+
export { type BlobDataSource, type PutBlobProgress, ShelbyRPCClient };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShelbyRPCClient
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-PJVWGMVI.mjs";
|
|
4
|
+
import "../../chunk-4MG4XGY4.mjs";
|
|
5
|
+
import "../../chunk-CGYJLKBU.mjs";
|
|
6
|
+
import "../../chunk-KJ24NKPH.mjs";
|
|
7
|
+
import "../../chunk-AABBONAF.mjs";
|
|
7
8
|
import "../../chunk-I6NG5GNL.mjs";
|
|
8
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-IE6LYVIA.mjs";
|
|
9
10
|
import "../../chunk-4JZO2D7T.mjs";
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-SEXQTDX6.mjs";
|
|
11
|
+
import "../../chunk-4ZOFT75Q.mjs";
|
|
12
|
+
import "../../chunk-Z4FZ7W6L.mjs";
|
|
13
13
|
import "../../chunk-7P6ASYW6.mjs";
|
|
14
14
|
export {
|
|
15
15
|
ShelbyRPCClient
|
|
@@ -1,16 +1,22 @@
|
|
|
1
|
-
export { ShelbyBlobClient } from './ShelbyBlobClient.js';
|
|
1
|
+
export { AckTransactionOptions, BuildOptions, MissingTransactionSubmitterError, ShelbyBlobClient, UsdSponsorOptions, WriteBlobCommitmentsOptions } from './ShelbyBlobClient.js';
|
|
2
2
|
export { ShelbyClient, UploadOptions } from './ShelbyClient.js';
|
|
3
3
|
export { ShelbyClientConfig, ShelbyIndexerConfig, ShelbyRPCConfig } from './ShelbyClientConfig.js';
|
|
4
|
-
export {
|
|
4
|
+
export { ShelbyMetadataClient } from './ShelbyMetadataClient.js';
|
|
5
|
+
export { ShelbyMicropaymentChannelClient } from './ShelbyMicropaymentChannelClient.js';
|
|
6
|
+
export { ShelbyPlacementGroupClient } from './ShelbyPlacementGroupClient.js';
|
|
7
|
+
export { BlobDataSource, PutBlobProgress, ShelbyRPCClient } from './ShelbyRPCClient.js';
|
|
5
8
|
import '@aptos-labs/ts-sdk';
|
|
6
9
|
import '../layout.js';
|
|
7
10
|
import 'zod';
|
|
8
|
-
import '
|
|
9
|
-
import '../../clay-codes-pdZFxI_B.js';
|
|
11
|
+
import '../../clay-codes-DHP-bYcP.js';
|
|
10
12
|
import '@shelby-protocol/clay-codes';
|
|
13
|
+
import '../types/blobs.js';
|
|
11
14
|
import '../operations/index.js';
|
|
12
15
|
import 'graphql-request';
|
|
13
16
|
import '../operations/generated/sdk.js';
|
|
14
17
|
import 'graphql';
|
|
15
|
-
import '../networks.js';
|
|
16
18
|
import '../blobs.js';
|
|
19
|
+
import '../networks.js';
|
|
20
|
+
import '../types/storage_providers.js';
|
|
21
|
+
import '../types/payments.js';
|
|
22
|
+
import '../types/placement_groups.js';
|
|
@@ -1,32 +1,52 @@
|
|
|
1
|
-
import "../../chunk-
|
|
1
|
+
import "../../chunk-WTICJPDB.mjs";
|
|
2
2
|
import {
|
|
3
3
|
ShelbyClient
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-7PN65RDX.mjs";
|
|
5
5
|
import {
|
|
6
|
+
MissingTransactionSubmitterError,
|
|
6
7
|
ShelbyBlobClient
|
|
7
|
-
} from "../../chunk-
|
|
8
|
+
} from "../../chunk-SRV4YWFH.mjs";
|
|
8
9
|
import "../../chunk-XNEIWM4O.mjs";
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-HPPMI7DC.mjs";
|
|
11
|
+
import "../../chunk-OGKZ575S.mjs";
|
|
12
|
+
import "../../chunk-NHWWORCH.mjs";
|
|
12
13
|
import "../../chunk-Z7RFCADT.mjs";
|
|
14
|
+
import {
|
|
15
|
+
ShelbyMetadataClient
|
|
16
|
+
} from "../../chunk-MV6FNYAU.mjs";
|
|
17
|
+
import {
|
|
18
|
+
ShelbyMicropaymentChannelClient
|
|
19
|
+
} from "../../chunk-E5QCRTBU.mjs";
|
|
20
|
+
import "../../chunk-QQ57OGQ2.mjs";
|
|
21
|
+
import "../../chunk-ZHXCVRZX.mjs";
|
|
22
|
+
import "../../chunk-AD2G3QYD.mjs";
|
|
23
|
+
import "../../chunk-MQUVYMNQ.mjs";
|
|
24
|
+
import {
|
|
25
|
+
ShelbyPlacementGroupClient
|
|
26
|
+
} from "../../chunk-W37FZSMA.mjs";
|
|
13
27
|
import {
|
|
14
28
|
ShelbyRPCClient
|
|
15
|
-
} from "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
17
|
-
import "../../chunk-
|
|
18
|
-
import "../../chunk-
|
|
29
|
+
} from "../../chunk-PJVWGMVI.mjs";
|
|
30
|
+
import "../../chunk-4MG4XGY4.mjs";
|
|
31
|
+
import "../../chunk-CGYJLKBU.mjs";
|
|
32
|
+
import "../../chunk-KJ24NKPH.mjs";
|
|
33
|
+
import "../../chunk-AABBONAF.mjs";
|
|
19
34
|
import "../../chunk-I6NG5GNL.mjs";
|
|
20
|
-
import "../../chunk-
|
|
35
|
+
import "../../chunk-IE6LYVIA.mjs";
|
|
21
36
|
import "../../chunk-OTBLZL2S.mjs";
|
|
22
|
-
import "../../chunk-
|
|
37
|
+
import "../../chunk-2WEX3K7C.mjs";
|
|
23
38
|
import "../../chunk-4JZO2D7T.mjs";
|
|
24
|
-
import "../../chunk-
|
|
25
|
-
import "../../chunk-
|
|
26
|
-
import "../../chunk-
|
|
39
|
+
import "../../chunk-JTXYKO3U.mjs";
|
|
40
|
+
import "../../chunk-AUQDI5BS.mjs";
|
|
41
|
+
import "../../chunk-4ZOFT75Q.mjs";
|
|
42
|
+
import "../../chunk-Z4FZ7W6L.mjs";
|
|
27
43
|
import "../../chunk-7P6ASYW6.mjs";
|
|
28
44
|
export {
|
|
45
|
+
MissingTransactionSubmitterError,
|
|
29
46
|
ShelbyBlobClient,
|
|
30
47
|
ShelbyClient,
|
|
48
|
+
ShelbyMetadataClient,
|
|
49
|
+
ShelbyMicropaymentChannelClient,
|
|
50
|
+
ShelbyPlacementGroupClient,
|
|
31
51
|
ShelbyRPCClient
|
|
32
52
|
};
|