@shelby-protocol/sdk 0.2.0 → 0.2.1

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.
Files changed (40) hide show
  1. package/dist/browser/index.d.ts +1 -1
  2. package/dist/browser/index.mjs +31 -29
  3. package/dist/{chunk-ZEDD2MPU.mjs → chunk-33BZ7KYA.mjs} +1 -1
  4. package/dist/chunk-3NRBHSMQ.mjs +12 -0
  5. package/dist/{chunk-7PN65RDX.mjs → chunk-5CES6RPZ.mjs} +11 -9
  6. package/dist/{chunk-MV6FNYAU.mjs → chunk-7O77OM4T.mjs} +98 -19
  7. package/dist/{chunk-2WEX3K7C.mjs → chunk-BXEVML7N.mjs} +1 -1
  8. package/dist/{chunk-PJVWGMVI.mjs → chunk-EFR6H3RT.mjs} +7 -7
  9. package/dist/{chunk-SRV4YWFH.mjs → chunk-IBAUPQOF.mjs} +11 -12
  10. package/dist/chunk-KTVNKLBT.mjs +207 -0
  11. package/dist/{chunk-E5QCRTBU.mjs → chunk-OQNP5QXH.mjs} +85 -73
  12. package/dist/{chunk-4JZO2D7T.mjs → chunk-UEZNZBJO.mjs} +9 -2
  13. package/dist/core/blobs.mjs +2 -1
  14. package/dist/core/clients/ShelbyBlobClient.mjs +5 -5
  15. package/dist/core/clients/ShelbyClient.d.ts +1 -1
  16. package/dist/core/clients/ShelbyClient.mjs +10 -10
  17. package/dist/core/clients/ShelbyMetadataClient.d.ts +56 -5
  18. package/dist/core/clients/ShelbyMetadataClient.mjs +2 -1
  19. package/dist/core/clients/ShelbyMicropaymentChannelClient.d.ts +39 -34
  20. package/dist/core/clients/ShelbyMicropaymentChannelClient.mjs +4 -3
  21. package/dist/core/clients/ShelbyRPCClient.mjs +4 -4
  22. package/dist/core/clients/index.mjs +17 -17
  23. package/dist/core/commitments.mjs +2 -2
  24. package/dist/core/erasure/index.mjs +3 -3
  25. package/dist/core/index.d.ts +1 -1
  26. package/dist/core/index.mjs +31 -29
  27. package/dist/core/types/index.mjs +3 -2
  28. package/dist/core/types/payments.d.ts +82 -9
  29. package/dist/core/types/payments.mjs +2 -1
  30. package/dist/core/types/placement_groups.d.ts +2 -2
  31. package/dist/core/types/storage_providers.d.ts +2 -2
  32. package/dist/core/utils.d.ts +3 -2
  33. package/dist/core/utils.mjs +3 -1
  34. package/dist/node/clients/ShelbyNodeClient.mjs +11 -11
  35. package/dist/node/clients/index.mjs +11 -11
  36. package/dist/node/index.d.ts +1 -1
  37. package/dist/node/index.mjs +35 -33
  38. package/package.json +1 -1
  39. package/dist/chunk-4MG4XGY4.mjs +0 -91
  40. package/dist/chunk-OTBLZL2S.mjs +0 -9
@@ -84,6 +84,7 @@ declare class ShelbyMicropaymentChannelClient {
84
84
  expirationMicros: number;
85
85
  depositAmount: number;
86
86
  fungibleAssetAddress: AccountAddress;
87
+ publicKey?: Uint8Array;
87
88
  options?: InputGenerateTransactionOptions;
88
89
  }): Promise<{
89
90
  transaction: PendingTransactionResponse;
@@ -98,6 +99,7 @@ declare class ShelbyMicropaymentChannelClient {
98
99
  * @param params.expirationMicros - The expiration of the micropayment channel.
99
100
  * @param params.depositAmount - The amount of the asset locked to the channel.
100
101
  * @param params.fungibleAssetAddress - The account address of the fungible asset.
102
+ * @param params.publicKey - The Ed25519 public key bytes for the channel.
101
103
  *
102
104
  * @returns An Aptos transaction payload data object for the create_channel Move function.
103
105
  */
@@ -107,6 +109,7 @@ declare class ShelbyMicropaymentChannelClient {
107
109
  expirationMicros: number;
108
110
  depositAmount: number;
109
111
  fungibleAssetAddress: AccountAddress;
112
+ publicKey: Uint8Array;
110
113
  }): InputGenerateTransactionPayloadData;
111
114
  /**
112
115
  * Withdraws funds from a micropayment channel as the sender.
@@ -152,64 +155,67 @@ declare class ShelbyMicropaymentChannelClient {
152
155
  }): InputGenerateTransactionPayloadData;
153
156
  /**
154
157
  * Creates a micropayment that can be sent to a receiver.
158
+ * The sender signs a WithdrawApproval message that authorizes the receiver
159
+ * to withdraw funds from the micropayment channel.
155
160
  *
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.sender - The account that owns the payment channel and signs the approval.
162
+ * @param params.receiver - The account address that will receive funds.
161
163
  * @param params.fungibleAssetAddress - The account address of the fungible asset.
162
- * @param params.options - Optional transaction generation options.
164
+ * @param params.amount - The cumulative amount to authorize (not incremental).
165
+ * @param params.paymentChannelId - The id of the payment channel.
166
+ * @param params.sequenceNumber - The sequence number of the micropayment. Must be >= channel's next_withdrawn_sequence_number.
163
167
  *
164
- * @returns An object containing the pending transaction and signature.
168
+ * @returns A SenderBuiltMicropayment containing the signed approval.
165
169
  *
166
170
  * @example
167
171
  * ```typescript
168
- * const senderBuiltMicropayment = await client.createMicropayment({
169
- * sender: senderAddress,
170
- * receiver: receiver,
171
- * amount: 1,
172
- * paymentChannelId: channelIdFromLookup,
173
- * sequenceNumber: localSequenceNumber,
172
+ * const senderBuiltMicropayment = client.createMicropayment({
173
+ * sender: senderAccount,
174
+ * receiver: receiverAddress,
174
175
  * fungibleAssetAddress: fungibleAssetAddress,
176
+ * amount: 100,
177
+ * paymentChannelId: channelId,
178
+ * sequenceNumber: 1,
175
179
  * });
176
180
  * ```
177
181
  */
178
182
  createMicropayment(params: {
179
183
  sender: Account;
180
184
  receiver: AccountAddress;
185
+ fungibleAssetAddress: AccountAddress;
181
186
  amount: number;
182
187
  paymentChannelId: number;
183
188
  sequenceNumber: number;
184
- fungibleAssetAddress: AccountAddress;
185
- options?: InputGenerateTransactionOptions;
186
- }): Promise<SenderBuiltMicropayment>;
189
+ }): SenderBuiltMicropayment;
187
190
  /**
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
+ * Creates a static payload for the receiver_withdraw Move function.
192
+ * This is a helper method for constructing the transaction payload.
191
193
  *
192
194
  * @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.sender - The sender's account address.
195
196
  * @param params.fungibleAssetAddress - The account address of the fungible asset.
197
+ * @param params.amount - The cumulative amount authorized to withdraw.
198
+ * @param params.paymentChannelId - The payment channel id.
199
+ * @param params.sequenceNumber - The sequence number for this withdrawal.
200
+ * @param params.signature - The Ed25519 signature bytes.
196
201
  *
197
- * @returns An Aptos transaction payload data object for the sender_withdraw Move function.
202
+ * @returns An Aptos transaction payload data object for the receiver_withdraw Move function.
198
203
  */
199
204
  static createMicropaymentTransactionPayload(params: {
200
205
  deployer?: AccountAddress;
201
- amount: number;
202
- paymentChannelId: number;
203
- sequenceNumber: number;
206
+ sender: AccountAddress;
204
207
  fungibleAssetAddress: AccountAddress;
208
+ amount: number | bigint;
209
+ paymentChannelId: number | bigint;
210
+ sequenceNumber: number | bigint;
211
+ signature: Uint8Array;
205
212
  }): InputGenerateTransactionPayloadData;
206
213
  /**
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.
214
+ * Withdraws funds from a micropayment channel as the receiver.
215
+ * The receiver submits the sender's signed approval to claim funds.
209
216
  *
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.
217
+ * @param params.receiver - The receiver account that will sign and submit the transaction.
218
+ * @param params.micropayment - The sender's signed micropayment approval.
213
219
  * @param params.options - Optional transaction generation options.
214
220
  *
215
221
  * @returns An object containing the pending transaction.
@@ -217,9 +223,8 @@ declare class ShelbyMicropaymentChannelClient {
217
223
  * @example
218
224
  * ```typescript
219
225
  * const { transaction } = await client.receiverWithdraw({
220
- * receiver: receiver,
221
- * micropayment,
222
- * senderSignature,
226
+ * receiver: receiverAccount,
227
+ * micropayment: senderBuiltMicropayment,
223
228
  * });
224
229
  * ```
225
230
  */
@@ -336,7 +341,7 @@ declare class ShelbyMicropaymentChannelClient {
336
341
  * ```typescript
337
342
  * const channelInfoVec = await client.getChannelInfo({
338
343
  * sender: AccountAddress.fromString("0x1"),
339
- * receiver: AccountAddress.fromSTring("0x2"),
344
+ * receiver: AccountAddress.fromString("0x2"),
340
345
  * });
341
346
  * ```
342
347
  */
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  ShelbyMicropaymentChannelClient
3
- } from "../../chunk-E5QCRTBU.mjs";
3
+ } from "../../chunk-OQNP5QXH.mjs";
4
4
  import "../../chunk-QQ57OGQ2.mjs";
5
+ import "../../chunk-MQUVYMNQ.mjs";
5
6
  import "../../chunk-ZHXCVRZX.mjs";
6
7
  import "../../chunk-AD2G3QYD.mjs";
7
- import "../../chunk-MQUVYMNQ.mjs";
8
- import "../../chunk-4MG4XGY4.mjs";
8
+ import "../../chunk-KTVNKLBT.mjs";
9
9
  import "../../chunk-CGYJLKBU.mjs";
10
10
  import "../../chunk-KJ24NKPH.mjs";
11
11
  import "../../chunk-AABBONAF.mjs";
12
+ import "../../chunk-UEZNZBJO.mjs";
12
13
  import "../../chunk-4ZOFT75Q.mjs";
13
14
  import "../../chunk-7P6ASYW6.mjs";
14
15
  export {
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  ShelbyRPCClient
3
- } from "../../chunk-PJVWGMVI.mjs";
4
- import "../../chunk-4MG4XGY4.mjs";
3
+ } from "../../chunk-EFR6H3RT.mjs";
4
+ import "../../chunk-KTVNKLBT.mjs";
5
5
  import "../../chunk-CGYJLKBU.mjs";
6
6
  import "../../chunk-KJ24NKPH.mjs";
7
7
  import "../../chunk-AABBONAF.mjs";
8
+ import "../../chunk-Z4FZ7W6L.mjs";
8
9
  import "../../chunk-I6NG5GNL.mjs";
9
10
  import "../../chunk-IE6LYVIA.mjs";
10
- import "../../chunk-4JZO2D7T.mjs";
11
+ import "../../chunk-UEZNZBJO.mjs";
11
12
  import "../../chunk-4ZOFT75Q.mjs";
12
- import "../../chunk-Z4FZ7W6L.mjs";
13
13
  import "../../chunk-7P6ASYW6.mjs";
14
14
  export {
15
15
  ShelbyRPCClient
@@ -1,45 +1,45 @@
1
1
  import "../../chunk-WTICJPDB.mjs";
2
+ import {
3
+ ShelbyPlacementGroupClient
4
+ } from "../../chunk-W37FZSMA.mjs";
2
5
  import {
3
6
  ShelbyClient
4
- } from "../../chunk-7PN65RDX.mjs";
7
+ } from "../../chunk-5CES6RPZ.mjs";
8
+ import {
9
+ ShelbyRPCClient
10
+ } from "../../chunk-EFR6H3RT.mjs";
5
11
  import {
6
12
  MissingTransactionSubmitterError,
7
13
  ShelbyBlobClient
8
- } from "../../chunk-SRV4YWFH.mjs";
14
+ } from "../../chunk-IBAUPQOF.mjs";
9
15
  import "../../chunk-XNEIWM4O.mjs";
16
+ import "../../chunk-NHWWORCH.mjs";
10
17
  import "../../chunk-HPPMI7DC.mjs";
11
18
  import "../../chunk-OGKZ575S.mjs";
12
- import "../../chunk-NHWWORCH.mjs";
13
19
  import "../../chunk-Z7RFCADT.mjs";
14
20
  import {
15
21
  ShelbyMetadataClient
16
- } from "../../chunk-MV6FNYAU.mjs";
22
+ } from "../../chunk-7O77OM4T.mjs";
17
23
  import {
18
24
  ShelbyMicropaymentChannelClient
19
- } from "../../chunk-E5QCRTBU.mjs";
25
+ } from "../../chunk-OQNP5QXH.mjs";
20
26
  import "../../chunk-QQ57OGQ2.mjs";
27
+ import "../../chunk-MQUVYMNQ.mjs";
21
28
  import "../../chunk-ZHXCVRZX.mjs";
22
29
  import "../../chunk-AD2G3QYD.mjs";
23
- import "../../chunk-MQUVYMNQ.mjs";
24
- import {
25
- ShelbyPlacementGroupClient
26
- } from "../../chunk-W37FZSMA.mjs";
27
- import {
28
- ShelbyRPCClient
29
- } from "../../chunk-PJVWGMVI.mjs";
30
- import "../../chunk-4MG4XGY4.mjs";
30
+ import "../../chunk-KTVNKLBT.mjs";
31
31
  import "../../chunk-CGYJLKBU.mjs";
32
32
  import "../../chunk-KJ24NKPH.mjs";
33
33
  import "../../chunk-AABBONAF.mjs";
34
+ import "../../chunk-Z4FZ7W6L.mjs";
34
35
  import "../../chunk-I6NG5GNL.mjs";
35
36
  import "../../chunk-IE6LYVIA.mjs";
36
- import "../../chunk-OTBLZL2S.mjs";
37
- import "../../chunk-2WEX3K7C.mjs";
38
- import "../../chunk-4JZO2D7T.mjs";
37
+ import "../../chunk-3NRBHSMQ.mjs";
38
+ import "../../chunk-BXEVML7N.mjs";
39
+ import "../../chunk-UEZNZBJO.mjs";
39
40
  import "../../chunk-JTXYKO3U.mjs";
40
41
  import "../../chunk-AUQDI5BS.mjs";
41
42
  import "../../chunk-4ZOFT75Q.mjs";
42
- import "../../chunk-Z4FZ7W6L.mjs";
43
43
  import "../../chunk-7P6ASYW6.mjs";
44
44
  export {
45
45
  MissingTransactionSubmitterError,
@@ -5,8 +5,8 @@ import {
5
5
  expectedTotalChunksets,
6
6
  generateCommitments,
7
7
  generateMerkleRoot
8
- } from "../chunk-2WEX3K7C.mjs";
9
- import "../chunk-4JZO2D7T.mjs";
8
+ } from "../chunk-BXEVML7N.mjs";
9
+ import "../chunk-UEZNZBJO.mjs";
10
10
  import "../chunk-JTXYKO3U.mjs";
11
11
  import "../chunk-AUQDI5BS.mjs";
12
12
  import "../chunk-7P6ASYW6.mjs";
@@ -1,4 +1,7 @@
1
1
  import "../../chunk-XNEIWM4O.mjs";
2
+ import {
3
+ ReedSolomonErasureCodingProvider
4
+ } from "../../chunk-NHWWORCH.mjs";
2
5
  import {
3
6
  createDefaultErasureCodingProvider,
4
7
  defaultErasureCodingConfig,
@@ -8,9 +11,6 @@ import {
8
11
  import {
9
12
  ClayErasureCodingProvider
10
13
  } from "../../chunk-OGKZ575S.mjs";
11
- import {
12
- ReedSolomonErasureCodingProvider
13
- } from "../../chunk-NHWWORCH.mjs";
14
14
  import "../../chunk-JTXYKO3U.mjs";
15
15
  import {
16
16
  DEFAULT_ERASURE_D,
@@ -23,7 +23,7 @@ export { BlobActivity, BlobActivityType, BlobEncoding, BlobMetadata, ClayEncodin
23
23
  export { ChannelInfo, SenderBuiltMicropayment, StaleChannelStateError } from './types/payments.js';
24
24
  export { PlacementGroupInfo, PlacementGroupSlot, PlacementGroupSlotStatus } from './types/placement_groups.js';
25
25
  export { ActiveStateDetails, FrozenStateDetails, StorageProviderInfo, StorageProviderStateDetails, WaitlistedStateDetails } from './types/storage_providers.js';
26
- export { buildRequestUrl, concatHashes, getBlobNameSuffix, readInChunks, zeroPadBytes } from './utils.js';
26
+ export { buildRequestUrl, concatHashes, getBlobNameSuffix, normalizeAddress, readInChunks, zeroPadBytes } from './utils.js';
27
27
  export { Bigint_Comparison_Exp, Blob_Activities, Blob_Activities_Aggregate, Blob_Activities_Aggregate_Fields, Blob_Activities_Aggregate_FieldsCountArgs, Blob_Activities_Avg_Fields, Blob_Activities_Bool_Exp, Blob_Activities_Max_Fields, Blob_Activities_Min_Fields, Blob_Activities_Order_By, Blob_Activities_Select_Column, Blob_Activities_Stddev_Fields, Blob_Activities_Stddev_Pop_Fields, Blob_Activities_Stddev_Samp_Fields, Blob_Activities_Stream_Cursor_Input, Blob_Activities_Stream_Cursor_Value_Input, Blob_Activities_Sum_Fields, Blob_Activities_Var_Pop_Fields, Blob_Activities_Var_Samp_Fields, Blob_Activities_Variance_Fields, Blobs, BlobsPlacement_Group_SlotsArgs, BlobsPlacement_Group_Slots_AggregateArgs, Blobs_Aggregate, Blobs_Aggregate_Fields, Blobs_Aggregate_FieldsCountArgs, Blobs_Avg_Fields, Blobs_Bool_Exp, Blobs_Max_Fields, Blobs_Min_Fields, Blobs_Order_By, Blobs_Select_Column, Blobs_Stddev_Fields, Blobs_Stddev_Pop_Fields, Blobs_Stddev_Samp_Fields, Blobs_Stream_Cursor_Input, Blobs_Stream_Cursor_Value_Input, Blobs_Sum_Fields, Blobs_Var_Pop_Fields, Blobs_Var_Samp_Fields, Blobs_Variance_Fields, Cursor_Ordering, Exact, GetBlobActivitiesCountDocument, GetBlobActivitiesCountQuery, GetBlobActivitiesCountQueryVariables, GetBlobActivitiesDocument, GetBlobActivitiesQuery, GetBlobActivitiesQueryVariables, GetBlobsCountDocument, GetBlobsCountQuery, GetBlobsCountQueryVariables, GetBlobsDocument, GetBlobsQuery, GetBlobsQueryVariables, GetPlacementGroupSlotsCountDocument, GetPlacementGroupSlotsCountQuery, GetPlacementGroupSlotsCountQueryVariables, GetPlacementGroupSlotsDocument, GetPlacementGroupSlotsQuery, GetPlacementGroupSlotsQueryVariables, GetProcessorStatusDocument, GetProcessorStatusQuery, GetProcessorStatusQueryVariables, Incremental, InputMaybe, Int_Comparison_Exp, MakeEmpty, MakeMaybe, MakeOptional, Maybe, Numeric_Comparison_Exp, Order_By, Placement_Group_Slots, Placement_Group_Slots_Aggregate, Placement_Group_Slots_Aggregate_Bool_Exp, Placement_Group_Slots_Aggregate_Bool_Exp_Count, Placement_Group_Slots_Aggregate_Fields, Placement_Group_Slots_Aggregate_FieldsCountArgs, Placement_Group_Slots_Aggregate_Order_By, Placement_Group_Slots_Avg_Fields, Placement_Group_Slots_Avg_Order_By, Placement_Group_Slots_Bool_Exp, Placement_Group_Slots_Max_Fields, Placement_Group_Slots_Max_Order_By, Placement_Group_Slots_Min_Fields, Placement_Group_Slots_Min_Order_By, Placement_Group_Slots_Order_By, Placement_Group_Slots_Select_Column, Placement_Group_Slots_Stddev_Fields, Placement_Group_Slots_Stddev_Order_By, Placement_Group_Slots_Stddev_Pop_Fields, Placement_Group_Slots_Stddev_Pop_Order_By, Placement_Group_Slots_Stddev_Samp_Fields, Placement_Group_Slots_Stddev_Samp_Order_By, Placement_Group_Slots_Stream_Cursor_Input, Placement_Group_Slots_Stream_Cursor_Value_Input, Placement_Group_Slots_Sum_Fields, Placement_Group_Slots_Sum_Order_By, Placement_Group_Slots_Var_Pop_Fields, Placement_Group_Slots_Var_Pop_Order_By, Placement_Group_Slots_Var_Samp_Fields, Placement_Group_Slots_Var_Samp_Order_By, Placement_Group_Slots_Variance_Fields, Placement_Group_Slots_Variance_Order_By, Processor_Status, Processor_Status_Bool_Exp, Processor_Status_Order_By, Processor_Status_Select_Column, Processor_Status_Stream_Cursor_Input, Processor_Status_Stream_Cursor_Value_Input, Query_Root, Query_RootBlob_ActivitiesArgs, Query_RootBlob_Activities_AggregateArgs, Query_RootBlob_Activities_By_PkArgs, Query_RootBlobsArgs, Query_RootBlobs_AggregateArgs, Query_RootBlobs_By_PkArgs, Query_RootPlacement_Group_SlotsArgs, Query_RootPlacement_Group_Slots_AggregateArgs, Query_RootPlacement_Group_Slots_By_PkArgs, Query_RootProcessor_StatusArgs, Scalars, Sdk, SdkFunctionWrapper, String_Comparison_Exp, Subscription_Root, Subscription_RootBlob_ActivitiesArgs, Subscription_RootBlob_Activities_AggregateArgs, Subscription_RootBlob_Activities_By_PkArgs, Subscription_RootBlob_Activities_StreamArgs, Subscription_RootBlobsArgs, Subscription_RootBlobs_AggregateArgs, Subscription_RootBlobs_By_PkArgs, Subscription_RootBlobs_StreamArgs, Subscription_RootPlacement_Group_SlotsArgs, Subscription_RootPlacement_Group_Slots_AggregateArgs, Subscription_RootPlacement_Group_Slots_By_PkArgs, Subscription_RootPlacement_Group_Slots_StreamArgs, Subscription_RootProcessor_StatusArgs, Subscription_RootProcessor_Status_StreamArgs, Timestamp_Comparison_Exp, getSdk } from './operations/generated/sdk.js';
28
28
  import '@aptos-labs/ts-sdk';
29
29
  import 'zod';
@@ -1,13 +1,22 @@
1
1
  import "../chunk-EM67QTMR.mjs";
2
2
  import "../chunk-WTICJPDB.mjs";
3
+ import {
4
+ ShelbyPlacementGroupClient
5
+ } from "../chunk-W37FZSMA.mjs";
3
6
  import {
4
7
  ShelbyClient
5
- } from "../chunk-7PN65RDX.mjs";
8
+ } from "../chunk-5CES6RPZ.mjs";
9
+ import {
10
+ ShelbyRPCClient
11
+ } from "../chunk-EFR6H3RT.mjs";
6
12
  import {
7
13
  MissingTransactionSubmitterError,
8
14
  ShelbyBlobClient
9
- } from "../chunk-SRV4YWFH.mjs";
15
+ } from "../chunk-IBAUPQOF.mjs";
10
16
  import "../chunk-XNEIWM4O.mjs";
17
+ import {
18
+ ReedSolomonErasureCodingProvider
19
+ } from "../chunk-NHWWORCH.mjs";
11
20
  import {
12
21
  createDefaultErasureCodingProvider,
13
22
  defaultErasureCodingConfig,
@@ -17,30 +26,21 @@ import {
17
26
  import {
18
27
  ClayErasureCodingProvider
19
28
  } from "../chunk-OGKZ575S.mjs";
20
- import {
21
- ReedSolomonErasureCodingProvider
22
- } from "../chunk-NHWWORCH.mjs";
23
29
  import "../chunk-Z7RFCADT.mjs";
24
30
  import {
25
31
  ShelbyMetadataClient
26
- } from "../chunk-MV6FNYAU.mjs";
32
+ } from "../chunk-7O77OM4T.mjs";
27
33
  import {
28
34
  ShelbyMicropaymentChannelClient
29
- } from "../chunk-E5QCRTBU.mjs";
35
+ } from "../chunk-OQNP5QXH.mjs";
30
36
  import "../chunk-QQ57OGQ2.mjs";
37
+ import "../chunk-MQUVYMNQ.mjs";
31
38
  import "../chunk-ZHXCVRZX.mjs";
32
39
  import "../chunk-AD2G3QYD.mjs";
33
- import "../chunk-MQUVYMNQ.mjs";
34
- import {
35
- ShelbyPlacementGroupClient
36
- } from "../chunk-W37FZSMA.mjs";
37
- import {
38
- ShelbyRPCClient
39
- } from "../chunk-PJVWGMVI.mjs";
40
40
  import {
41
41
  SenderBuiltMicropayment,
42
42
  StaleChannelStateError
43
- } from "../chunk-4MG4XGY4.mjs";
43
+ } from "../chunk-KTVNKLBT.mjs";
44
44
  import {
45
45
  createShelbyIndexerClient,
46
46
  getShelbyIndexerClient
@@ -62,6 +62,17 @@ import {
62
62
  getSdk
63
63
  } from "../chunk-KJ24NKPH.mjs";
64
64
  import "../chunk-AABBONAF.mjs";
65
+ import {
66
+ ShelbyErrorCodes,
67
+ isAccessDeniedError,
68
+ isBlobAlreadyExistsError,
69
+ isBlobExpiredError,
70
+ isBlobNotFoundError
71
+ } from "../chunk-CQ6QPIZK.mjs";
72
+ import {
73
+ BlobNameSchema,
74
+ ChunkKey
75
+ } from "../chunk-Z4FZ7W6L.mjs";
65
76
  import {
66
77
  isShelbyNetwork,
67
78
  shelbyNetworks
@@ -85,7 +96,7 @@ import {
85
96
  } from "../chunk-C6RQ3AEU.mjs";
86
97
  import {
87
98
  createBlobKey
88
- } from "../chunk-OTBLZL2S.mjs";
99
+ } from "../chunk-3NRBHSMQ.mjs";
89
100
  import {
90
101
  BlobCommitmentsSchema,
91
102
  COMMITMENT_SCHEMA_VERSION,
@@ -93,14 +104,15 @@ import {
93
104
  expectedTotalChunksets,
94
105
  generateCommitments,
95
106
  generateMerkleRoot
96
- } from "../chunk-2WEX3K7C.mjs";
107
+ } from "../chunk-BXEVML7N.mjs";
97
108
  import {
98
109
  buildRequestUrl,
99
110
  concatHashes,
100
111
  getBlobNameSuffix,
112
+ normalizeAddress,
101
113
  readInChunks,
102
114
  zeroPadBytes
103
- } from "../chunk-4JZO2D7T.mjs";
115
+ } from "../chunk-UEZNZBJO.mjs";
104
116
  import {
105
117
  CHUNK_SIZE_PARAMS,
106
118
  ChunkSizeScheme,
@@ -132,17 +144,6 @@ import {
132
144
  TOKEN_DEPLOYER,
133
145
  TOKEN_OBJECT_ADDRESS
134
146
  } from "../chunk-4ZOFT75Q.mjs";
135
- import {
136
- ShelbyErrorCodes,
137
- isAccessDeniedError,
138
- isBlobAlreadyExistsError,
139
- isBlobExpiredError,
140
- isBlobNotFoundError
141
- } from "../chunk-CQ6QPIZK.mjs";
142
- import {
143
- BlobNameSchema,
144
- ChunkKey
145
- } from "../chunk-Z4FZ7W6L.mjs";
146
147
  import "../chunk-7P6ASYW6.mjs";
147
148
  export {
148
149
  BlobCommitmentsSchema,
@@ -229,6 +230,7 @@ export {
229
230
  isBlobExpiredError,
230
231
  isBlobNotFoundError,
231
232
  isShelbyNetwork,
233
+ normalizeAddress,
232
234
  readInChunks,
233
235
  shelbyNetworks,
234
236
  zeroPadBytes
@@ -1,11 +1,12 @@
1
1
  import "../../chunk-QQ57OGQ2.mjs";
2
+ import "../../chunk-MQUVYMNQ.mjs";
2
3
  import "../../chunk-ZHXCVRZX.mjs";
3
4
  import "../../chunk-AD2G3QYD.mjs";
4
- import "../../chunk-MQUVYMNQ.mjs";
5
5
  import {
6
6
  SenderBuiltMicropayment,
7
7
  StaleChannelStateError
8
- } from "../../chunk-4MG4XGY4.mjs";
8
+ } from "../../chunk-KTVNKLBT.mjs";
9
+ import "../../chunk-4ZOFT75Q.mjs";
9
10
  import "../../chunk-7P6ASYW6.mjs";
10
11
  export {
11
12
  SenderBuiltMicropayment,
@@ -1,4 +1,4 @@
1
- import { Serializable, MultiAgentTransaction, AccountAuthenticator, Serializer, Hex, AccountAddress } from '@aptos-labs/ts-sdk';
1
+ import { Serializable, AccountAddress, Serializer, Hex } from '@aptos-labs/ts-sdk';
2
2
 
3
3
  /**
4
4
  * Error thrown when a micropayment is stale (sequence number or amount is behind
@@ -24,19 +24,88 @@ declare class StaleChannelStateError extends Error {
24
24
  static fromBase64(base64: string, message?: string): StaleChannelStateError;
25
25
  }
26
26
  /**
27
- * A handy container for the things that constitute a half-built micropayment. It
28
- * still needs to be signed and submitted by the receiver.
27
+ * A micropayment approval signed by the sender. The receiver can submit this
28
+ * to withdraw funds from the micropayment channel.
29
+ *
30
+ * This matches the Move struct WithdrawApproval:
31
+ * struct WithdrawApproval {
32
+ * sender: address,
33
+ * receiver: address,
34
+ * metadata: Object<Metadata>, // represented as an address
35
+ * amount: u64,
36
+ * payment_channel_id: u64,
37
+ * sequence_number: u64
38
+ * }
39
+ *
40
+ * The signature is over a SignedMessage<WithdrawApproval> which includes TypeInfo
41
+ * for domain separation (used with signature_verify_strict_t).
29
42
  */
30
43
  declare class SenderBuiltMicropayment implements Serializable {
31
44
  /**
32
- * The actual micropayment transaction. It is built with the receiver address as fee payer and also requires a signature from the receiver to submit.
45
+ * The sender's address (owner of the payment channel).
46
+ */
47
+ readonly sender: AccountAddress;
48
+ /**
49
+ * The receiver's address (beneficiary of the withdrawal).
50
+ */
51
+ readonly receiver: AccountAddress;
52
+ /**
53
+ * The unique ID of the payment channel.
54
+ */
55
+ readonly paymentChannelId: bigint;
56
+ /**
57
+ * The cumulative amount the receiver is authorized to withdraw.
58
+ */
59
+ readonly amount: bigint;
60
+ /**
61
+ * The fungible asset metadata address.
62
+ */
63
+ readonly fungibleAssetAddress: AccountAddress;
64
+ /**
65
+ * Monotonically increasing sequence number for replay protection.
66
+ */
67
+ readonly sequenceNumber: bigint;
68
+ /**
69
+ * The sender's Ed25519 public key (32 bytes).
70
+ * Used by the receiver to verify the signature before submitting.
33
71
  */
34
- readonly micropayment: MultiAgentTransaction;
72
+ readonly publicKey: Uint8Array;
35
73
  /**
36
- * The sender's signature.
74
+ * The Ed25519 signature of the SignedMessage<WithdrawApproval> struct.
75
+ * The SignedMessage includes TypeInfo for domain separation.
37
76
  */
38
- readonly senderSignature: AccountAuthenticator;
39
- constructor(micropayment: MultiAgentTransaction, senderSignature: AccountAuthenticator);
77
+ readonly signature: Uint8Array;
78
+ /**
79
+ * The deployer address of the micropayments module.
80
+ * This is needed to reconstruct the TypeInfo for signature verification.
81
+ */
82
+ readonly deployer: AccountAddress;
83
+ constructor(sender: AccountAddress, receiver: AccountAddress, paymentChannelId: bigint, amount: bigint, fungibleAssetAddress: AccountAddress, sequenceNumber: bigint, publicKey: Uint8Array, signature: Uint8Array, deployer: AccountAddress);
84
+ /**
85
+ * Creates the BCS-serialized message that was signed.
86
+ * This is a SignedMessage<WithdrawApproval> which includes:
87
+ * 1. TypeInfo (module_address, module_name, struct_name)
88
+ * 2. WithdrawApproval struct fields
89
+ *
90
+ * This format is used with signature_verify_strict_t for domain separation.
91
+ */
92
+ getSignedMessage(): Uint8Array;
93
+ /**
94
+ * Static helper to build the SignedMessage<WithdrawApproval> bytes from raw parameters.
95
+ * This can be used to create the message for signing without constructing the full object.
96
+ *
97
+ * @param params - The withdrawal approval parameters.
98
+ * @returns The BCS-serialized SignedMessage<WithdrawApproval> bytes.
99
+ */
100
+ static buildSignedMessage(params: {
101
+ deployer: AccountAddress;
102
+ sender: AccountAddress;
103
+ receiver: AccountAddress;
104
+ fungibleAssetAddress: AccountAddress;
105
+ amount: bigint | number;
106
+ paymentChannelId: bigint | number;
107
+ sequenceNumber: bigint | number;
108
+ }): Uint8Array;
40
109
  serialize(serializer: Serializer): void;
41
110
  bcsToBytes(): Uint8Array;
42
111
  bcsToHex(): Hex;
@@ -50,7 +119,7 @@ declare class SenderBuiltMicropayment implements Serializable {
50
119
  static deserialize(bytes: Uint8Array | string): SenderBuiltMicropayment;
51
120
  }
52
121
  /**
53
- * The information associtated with a micropayment channel.
122
+ * The information associated with a micropayment channel.
54
123
  */
55
124
  interface ChannelInfo {
56
125
  /**
@@ -89,6 +158,10 @@ interface ChannelInfo {
89
158
  * The amount already withdrawn by the receiver.
90
159
  */
91
160
  receiverWithdrawnAmount: number;
161
+ /**
162
+ * The Ed25519 public key used to verify withdrawal signatures.
163
+ */
164
+ publicKey: Uint8Array;
92
165
  }
93
166
 
94
167
  export { type ChannelInfo, SenderBuiltMicropayment, StaleChannelStateError };
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  SenderBuiltMicropayment,
3
3
  StaleChannelStateError
4
- } from "../../chunk-4MG4XGY4.mjs";
4
+ } from "../../chunk-KTVNKLBT.mjs";
5
+ import "../../chunk-4ZOFT75Q.mjs";
5
6
  import "../../chunk-7P6ASYW6.mjs";
6
7
  export {
7
8
  SenderBuiltMicropayment,
@@ -14,7 +14,7 @@ interface PlacementGroupInfo {
14
14
  /**
15
15
  * The status of a placement group slot.
16
16
  */
17
- type PlacementGroupSlotStatus = "joining" | "active" | "left";
17
+ type PlacementGroupSlotStatus = "joining" | "active" | "vacated";
18
18
  /**
19
19
  * A placement group slot representing an assignment of a storage provider to a placement group.
20
20
  */
@@ -32,7 +32,7 @@ interface PlacementGroupSlot {
32
32
  */
33
33
  storageProvider: string;
34
34
  /**
35
- * The status of this slot (joining, active, or left).
35
+ * The status of this slot (joining, active, or vacated).
36
36
  */
37
37
  status: PlacementGroupSlotStatus;
38
38
  /**
@@ -49,9 +49,9 @@ interface StorageProviderInfo {
49
49
  */
50
50
  blsPublicKey: Uint8Array;
51
51
  /**
52
- * The failure domain of the storage provider.
52
+ * The availability zone of the storage provider.
53
53
  */
54
- failureDomain: string;
54
+ availabilityZone: string;
55
55
  /**
56
56
  * The state details of the storage provider (Active, Waitlisted, or Frozen).
57
57
  */
@@ -1,4 +1,4 @@
1
- import { HexInput, Hex } from '@aptos-labs/ts-sdk';
1
+ import { HexInput, Hex, AccountAddressInput, AccountAddress } from '@aptos-labs/ts-sdk';
2
2
 
3
3
  type ByteStream = ReadableStream<Uint8Array>;
4
4
  type ChunkSource = ByteStream | ArrayBufferView;
@@ -45,5 +45,6 @@ declare function buildRequestUrl(path: string, baseUrl: string): URL;
45
45
  * @returns The blob name suffix.
46
46
  */
47
47
  declare function getBlobNameSuffix(blobName: string): string;
48
+ declare function normalizeAddress(address: AccountAddressInput): AccountAddress;
48
49
 
49
- export { buildRequestUrl, concatHashes, getBlobNameSuffix, readInChunks, zeroPadBytes };
50
+ export { buildRequestUrl, concatHashes, getBlobNameSuffix, normalizeAddress, readInChunks, zeroPadBytes };
@@ -2,14 +2,16 @@ import {
2
2
  buildRequestUrl,
3
3
  concatHashes,
4
4
  getBlobNameSuffix,
5
+ normalizeAddress,
5
6
  readInChunks,
6
7
  zeroPadBytes
7
- } from "../chunk-4JZO2D7T.mjs";
8
+ } from "../chunk-UEZNZBJO.mjs";
8
9
  import "../chunk-7P6ASYW6.mjs";
9
10
  export {
10
11
  buildRequestUrl,
11
12
  concatHashes,
12
13
  getBlobNameSuffix,
14
+ normalizeAddress,
13
15
  readInChunks,
14
16
  zeroPadBytes
15
17
  };