@aastar/sdk 0.20.5 → 0.20.6

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 (89) hide show
  1. package/dist/BaseClient-BjbYP0cf.d.ts +88 -0
  2. package/dist/UserClient-AIIHB54I.js +6 -0
  3. package/dist/{UserClient-UYIHF6UJ.js.map → UserClient-AIIHB54I.js.map} +1 -1
  4. package/dist/account.d.ts +48 -1
  5. package/dist/account.js +3 -3
  6. package/dist/admin.d.ts +62 -1
  7. package/dist/admin.js +3 -3
  8. package/dist/airaccount.d.ts +4 -2
  9. package/dist/airaccount.js +2 -2
  10. package/dist/channel-CkRRbzT8.d.ts +77 -0
  11. package/dist/channel.d.ts +64 -1
  12. package/dist/channel.js +3 -3
  13. package/dist/{chunk-FBDMID2J.js → chunk-4EZD7LPE.js} +30 -24
  14. package/dist/chunk-4EZD7LPE.js.map +1 -0
  15. package/dist/{chunk-TIH7D4FQ.js → chunk-6QYXGMCR.js} +513 -322
  16. package/dist/chunk-6QYXGMCR.js.map +1 -0
  17. package/dist/{chunk-6UHVUGDT.js → chunk-7ARJ3OSU.js} +29 -21
  18. package/dist/chunk-7ARJ3OSU.js.map +1 -0
  19. package/dist/{chunk-VYU6P7HB.js → chunk-BN5WY5GM.js} +16 -14
  20. package/dist/chunk-BN5WY5GM.js.map +1 -0
  21. package/dist/{chunk-ZFIKBDBT.js → chunk-FJ7XECC5.js} +4 -4
  22. package/dist/chunk-FJ7XECC5.js.map +1 -0
  23. package/dist/{chunk-4KRQXOTI.js → chunk-FUU7RIIA.js} +113 -102
  24. package/dist/chunk-FUU7RIIA.js.map +1 -0
  25. package/dist/{chunk-NRH56SAJ.js → chunk-G3UJC4EL.js} +6 -7
  26. package/dist/chunk-G3UJC4EL.js.map +1 -0
  27. package/dist/{chunk-QJT4IOIS.js → chunk-KDH3UPKD.js} +10 -13
  28. package/dist/chunk-KDH3UPKD.js.map +1 -0
  29. package/dist/{chunk-WPSWFZKF.js → chunk-KISL64KW.js} +69 -323
  30. package/dist/chunk-KISL64KW.js.map +1 -0
  31. package/dist/{chunk-ZGOEADCO.js → chunk-LXWIPTPX.js} +5 -5
  32. package/dist/chunk-LXWIPTPX.js.map +1 -0
  33. package/dist/{chunk-I3VRFZA4.js → chunk-MVEWJIPY.js} +124 -110
  34. package/dist/chunk-MVEWJIPY.js.map +1 -0
  35. package/dist/{chunk-FIS3RUGL.js → chunk-PAABYXS6.js} +33 -40
  36. package/dist/chunk-PAABYXS6.js.map +1 -0
  37. package/dist/{chunk-HNTLDUL7.js → chunk-PKCHRXFR.js} +8 -12
  38. package/dist/chunk-PKCHRXFR.js.map +1 -0
  39. package/dist/{chunk-42KVVOOU.js → chunk-TENYCMJ3.js} +31 -31
  40. package/dist/chunk-TENYCMJ3.js.map +1 -0
  41. package/dist/{contract-addresses-ADEWLDHE.js → contract-addresses-N3TOL2WL.js} +3 -3
  42. package/dist/{contract-addresses-ADEWLDHE.js.map → contract-addresses-N3TOL2WL.js.map} +1 -1
  43. package/dist/core.d.ts +6930 -13
  44. package/dist/core.js +2 -2
  45. package/dist/dapp.d.ts +127 -1
  46. package/dist/dapp.js +12 -13
  47. package/dist/dapp.js.map +1 -1
  48. package/dist/doc-types-471vSmPO.d.ts +16 -0
  49. package/dist/enduser.d.ts +261 -1
  50. package/dist/enduser.js +4 -4
  51. package/dist/identity.d.ts +81 -1
  52. package/dist/identity.js +3 -3
  53. package/dist/index-B6SfEQxo.d.ts +47 -0
  54. package/dist/index.d.ts +55 -15
  55. package/dist/index.js +18 -18
  56. package/dist/index.js.map +1 -1
  57. package/dist/kms.d.ts +2986 -2
  58. package/dist/kms.js +2 -2
  59. package/dist/operator.d.ts +164 -1
  60. package/dist/operator.js +3 -3
  61. package/dist/paymaster.d.ts +312 -1
  62. package/dist/paymaster.js +3 -3
  63. package/dist/{index.node-KIKM4EG6.js → src-L5SI5WNB.js} +4 -4
  64. package/dist/src-L5SI5WNB.js.map +1 -0
  65. package/dist/{dist-GVWCRI4F.js → src-X5MIV3EB.js} +5 -5
  66. package/dist/src-X5MIV3EB.js.map +1 -0
  67. package/dist/tier-router-DLiMxs0h.d.ts +321 -0
  68. package/dist/tokens.d.ts +64 -1
  69. package/dist/tokens.js +3 -3
  70. package/dist/x402.d.ts +373 -1
  71. package/dist/x402.js +3 -3
  72. package/package.json +1 -1
  73. package/dist/UserClient-UYIHF6UJ.js +0 -6
  74. package/dist/chunk-42KVVOOU.js.map +0 -1
  75. package/dist/chunk-4KRQXOTI.js.map +0 -1
  76. package/dist/chunk-6UHVUGDT.js.map +0 -1
  77. package/dist/chunk-FBDMID2J.js.map +0 -1
  78. package/dist/chunk-FIS3RUGL.js.map +0 -1
  79. package/dist/chunk-HNTLDUL7.js.map +0 -1
  80. package/dist/chunk-I3VRFZA4.js.map +0 -1
  81. package/dist/chunk-NRH56SAJ.js.map +0 -1
  82. package/dist/chunk-QJT4IOIS.js.map +0 -1
  83. package/dist/chunk-TIH7D4FQ.js.map +0 -1
  84. package/dist/chunk-VYU6P7HB.js.map +0 -1
  85. package/dist/chunk-WPSWFZKF.js.map +0 -1
  86. package/dist/chunk-ZFIKBDBT.js.map +0 -1
  87. package/dist/chunk-ZGOEADCO.js.map +0 -1
  88. package/dist/dist-GVWCRI4F.js.map +0 -1
  89. package/dist/index.node-KIKM4EG6.js.map +0 -1
@@ -0,0 +1,321 @@
1
+ interface PasskeyRegistrationParams {
2
+ email: string;
3
+ username: string;
4
+ password?: string;
5
+ }
6
+ interface PasskeyAuthenticationParams {
7
+ email?: string;
8
+ }
9
+ interface TransactionVerificationParams {
10
+ to: string;
11
+ value?: string;
12
+ data?: string;
13
+ }
14
+ interface PasskeyInfo {
15
+ credentialId: string;
16
+ publicKey: string;
17
+ counter: number;
18
+ deviceType: string;
19
+ createdAt: string;
20
+ }
21
+ interface BeginRegistrationResponse {
22
+ challenge: string;
23
+ rp: {
24
+ name: string;
25
+ id: string;
26
+ };
27
+ user: {
28
+ id: string;
29
+ name: string;
30
+ displayName: string;
31
+ };
32
+ pubKeyCredParams: any[];
33
+ timeout?: number;
34
+ authenticatorSelection?: any;
35
+ attestation?: string;
36
+ }
37
+ interface BeginAuthenticationResponse {
38
+ challenge: string;
39
+ timeout?: number;
40
+ rpId?: string;
41
+ allowCredentials?: any[];
42
+ userVerification?: string;
43
+ }
44
+ interface BeginTransactionVerificationResponse extends BeginAuthenticationResponse {
45
+ userOpHash: string;
46
+ }
47
+
48
+ declare class PasskeyManager {
49
+ private api;
50
+ constructor(baseURL: string, tokenProvider?: () => string | null);
51
+ /**
52
+ * Complete Passkey Registration Flow
53
+ */
54
+ register(params: PasskeyRegistrationParams): Promise<{
55
+ user: any;
56
+ token: string;
57
+ passkey: PasskeyInfo;
58
+ }>;
59
+ /**
60
+ * Complete Passkey Login/Authentication Flow
61
+ */
62
+ authenticate(params?: PasskeyAuthenticationParams): Promise<{
63
+ user: any;
64
+ token: string;
65
+ }>;
66
+ /**
67
+ * Verify a transaction (Sign UserOpHash) with Passkey
68
+ * Returns the verification credential needed for the transaction
69
+ */
70
+ verifyTransaction(params: TransactionVerificationParams): Promise<any>;
71
+ /**
72
+ * Add a new device (Passkey) to existing account
73
+ */
74
+ addDevice(params: {
75
+ email: string;
76
+ password?: string;
77
+ }): Promise<PasskeyInfo>;
78
+ }
79
+
80
+ interface BLSNode {
81
+ index?: number;
82
+ nodeId: string;
83
+ nodeName: string;
84
+ apiEndpoint: string;
85
+ status: "active" | "inactive";
86
+ publicKey?: string;
87
+ lastSeen?: Date;
88
+ }
89
+ interface BLSSignatureData {
90
+ nodeIds: string[];
91
+ signatures?: string[];
92
+ publicKeys?: string[];
93
+ signature: string;
94
+ messagePoint: string;
95
+ aaAddress: string;
96
+ aaSignature: string;
97
+ messagePointSignature: string;
98
+ aggregatedSignature?: string;
99
+ }
100
+ interface BLSConfig {
101
+ seedNodes: string[];
102
+ discoveryTimeout?: number;
103
+ }
104
+ /**
105
+ * Data for cumulative Tier 2 signature (algId 0x04): P256 + BLS.
106
+ */
107
+ interface CumulativeT2SignatureData {
108
+ p256Signature: string;
109
+ nodeIds: string[];
110
+ blsSignature: string;
111
+ messagePoint: string;
112
+ messagePointSignature: string;
113
+ }
114
+ /**
115
+ * Data for cumulative Tier 3 signature (algId 0x05): P256 + BLS + Guardian.
116
+ */
117
+ interface CumulativeT3SignatureData extends CumulativeT2SignatureData {
118
+ guardianSignature: string;
119
+ }
120
+
121
+ declare class BLSManager {
122
+ private config;
123
+ constructor(config: BLSConfig);
124
+ /**
125
+ * Discover available BLS nodes from seed nodes (Gossip network)
126
+ */
127
+ getAvailableNodes(): Promise<BLSNode[]>;
128
+ /**
129
+ * Helper to pack the full signature for ERC-4337 UserOp
130
+ * Format: [nodeIdsLength][nodeIds...][blsSignature][messagePoint][aaSignature][messagePointSignature]
131
+ */
132
+ packSignature(data: BLSSignatureData): string;
133
+ /**
134
+ * Calculate the MessagePoint G2 point for a given message (UserOpHash)
135
+ */
136
+ generateMessagePoint(message: string | Uint8Array): Promise<string>;
137
+ /**
138
+ * Encode G2 Point to bytes for EIP-2537 format
139
+ */
140
+ private encodeG2Point;
141
+ private hexToBytes;
142
+ /**
143
+ * Pack cumulative Tier 2 signature (algId 0x04): P256 + BLS.
144
+ *
145
+ * Format:
146
+ * [algId=0x04 (1)] [P256 r (32)] [P256 s (32)]
147
+ * [nodeIdsLength (32)] [nodeIds (N×32)]
148
+ * [blsAggregateSig (256)] [messagePoint (256)]
149
+ * [messagePointECDSA (65)]
150
+ */
151
+ packCumulativeT2Signature(data: CumulativeT2SignatureData): string;
152
+ /**
153
+ * Pack cumulative Tier 3 signature (algId 0x05): P256 + BLS + Guardian.
154
+ *
155
+ * Format:
156
+ * [algId=0x05 (1)] [P256 r (32)] [P256 s (32)]
157
+ * [nodeIdsLength (32)] [nodeIds (N×32)]
158
+ * [blsAggregateSig (256)] [messagePoint (256)]
159
+ * [messagePointECDSA (65)] [guardianECDSA (65)]
160
+ */
161
+ packCumulativeT3Signature(data: CumulativeT3SignatureData): string;
162
+ /**
163
+ * Request signature from a single node
164
+ */
165
+ requestNodeSignature(node: BLSNode, message: string): Promise<{
166
+ signature: string;
167
+ publicKey: string;
168
+ }>;
169
+ /**
170
+ * Request aggregation from a node
171
+ */
172
+ aggregateSignatures(node: BLSNode, signatures: string[]): Promise<string>;
173
+ }
174
+
175
+ interface YAAAConfig {
176
+ /** Backend API URL (e.g., https://api.yetanotheraa.com) */
177
+ apiURL: string;
178
+ /** Function to get the current auth token (JWT) */
179
+ tokenProvider?: () => string | null;
180
+ /** BLS Configuration */
181
+ bls: BLSConfig;
182
+ }
183
+ declare class YAAAClient {
184
+ private config;
185
+ readonly passkey: PasskeyManager;
186
+ readonly bls: BLSManager;
187
+ constructor(config: YAAAConfig);
188
+ }
189
+
190
+ declare class CryptoUtil {
191
+ private static readonly ALGORITHM;
192
+ private static readonly KEY_LENGTH;
193
+ private static readonly IV_LENGTH;
194
+ private static readonly TAG_LENGTH;
195
+ static encrypt(text: string, secretKey: string): string;
196
+ static decrypt(encryptedData: string, secretKey: string): string;
197
+ static generateSecretKey(): string;
198
+ }
199
+
200
+ interface UserOperation {
201
+ sender: string;
202
+ nonce: bigint | string;
203
+ initCode: string;
204
+ callData: string;
205
+ callGasLimit: bigint | string;
206
+ verificationGasLimit: bigint | string;
207
+ preVerificationGas: bigint | string;
208
+ maxFeePerGas: bigint | string;
209
+ maxPriorityFeePerGas: bigint | string;
210
+ paymasterAndData: string;
211
+ signature: string;
212
+ }
213
+ interface PackedUserOperation {
214
+ sender: string;
215
+ nonce: bigint | string;
216
+ initCode: string;
217
+ callData: string;
218
+ accountGasLimits: string;
219
+ preVerificationGas: bigint | string;
220
+ gasFees: string;
221
+ paymasterAndData: string;
222
+ signature: string;
223
+ }
224
+ interface GasEstimate {
225
+ callGasLimit: string;
226
+ verificationGasLimit: string;
227
+ preVerificationGas: string;
228
+ }
229
+
230
+ declare class ERC4337Utils {
231
+ static packAccountGasLimits(verificationGasLimit: bigint | string, callGasLimit: bigint | string): string;
232
+ static unpackAccountGasLimits(accountGasLimits: string): {
233
+ verificationGasLimit: bigint;
234
+ callGasLimit: bigint;
235
+ };
236
+ static packGasFees(maxPriorityFeePerGas: bigint | string, maxFeePerGas: bigint | string): string;
237
+ static unpackGasFees(gasFees: string): {
238
+ maxPriorityFeePerGas: bigint;
239
+ maxFeePerGas: bigint;
240
+ };
241
+ static packUserOperation(userOp: any): PackedUserOperation;
242
+ static unpackUserOperation(packedOp: PackedUserOperation): any;
243
+ }
244
+
245
+ declare class UserOpBuilder {
246
+ private static DEFAULT_VERIFICATION_GAS_LIMIT;
247
+ private static DEFAULT_PRE_VERIFICATION_GAS;
248
+ private static DEFAULT_MAX_FEE_PER_GAS;
249
+ private static DEFAULT_MAX_PRIORITY_FEE_PER_GAS;
250
+ constructor();
251
+ /**
252
+ * Build specific parts of a UserOperation
253
+ * Note: Full construction often requires chain interaction (nonce, gas price),
254
+ * which typically happens in the application layer or via a Provider wrapper.
255
+ * This builder focuses on formatting and structure.
256
+ */
257
+ buildUserOp(params: {
258
+ sender: string;
259
+ callData: string;
260
+ nonce?: bigint;
261
+ initCode?: string;
262
+ callGasLimit?: bigint;
263
+ verificationGasLimit?: bigint;
264
+ preVerificationGas?: bigint;
265
+ maxFeePerGas?: bigint;
266
+ maxPriorityFeePerGas?: bigint;
267
+ paymasterAndData?: string;
268
+ signature?: string;
269
+ }): Promise<UserOperation>;
270
+ /**
271
+ * Hash the UserOperation for signing (ERC-4337 v0.7)
272
+ */
273
+ getUserOpHash(userOp: PackedUserOperation, entryPoint: string, chainId: number): string;
274
+ }
275
+
276
+ declare const ALG_BLS = 1;
277
+ declare const ALG_ECDSA = 2;
278
+ declare const ALG_P256 = 3;
279
+ declare const ALG_CUMULATIVE_T2 = 4;
280
+ declare const ALG_CUMULATIVE_T3 = 5;
281
+ type AlgId = typeof ALG_BLS | typeof ALG_ECDSA | typeof ALG_P256 | typeof ALG_CUMULATIVE_T2 | typeof ALG_CUMULATIVE_T3;
282
+ type TierLevel = 1 | 2 | 3;
283
+ interface TierConfig {
284
+ /** Max value for Tier 1 (single ECDSA/Passkey). 0 = no enforcement. */
285
+ tier1Limit: bigint;
286
+ /** Max value for Tier 2 (P256 + BLS). 0 = no enforcement. */
287
+ tier2Limit: bigint;
288
+ }
289
+ interface GuardStatus {
290
+ hasGuard: boolean;
291
+ guardAddress: string;
292
+ dailyLimit: bigint;
293
+ dailyRemaining: bigint;
294
+ }
295
+ interface PreCheckResult {
296
+ ok: boolean;
297
+ errors: string[];
298
+ tier: TierLevel;
299
+ algId: AlgId;
300
+ }
301
+
302
+ /**
303
+ * Determine the required tier for a given transaction value.
304
+ *
305
+ * - Tier 1: value <= tier1Limit — single ECDSA or P256 passkey
306
+ * - Tier 2: tier1Limit < value <= tier2Limit — P256 + BLS aggregate
307
+ * - Tier 3: value > tier2Limit — P256 + BLS + Guardian ECDSA
308
+ *
309
+ * If both limits are 0 (no enforcement), always returns Tier 1.
310
+ */
311
+ declare function resolveTier(value: bigint, config: TierConfig): TierLevel;
312
+ /**
313
+ * Get the algorithm ID to use for a given tier.
314
+ *
315
+ * - Tier 1: ALG_ECDSA (0x02) — raw 65-byte ECDSA, no prefix needed
316
+ * - Tier 2: ALG_CUMULATIVE_T2 (0x04) — P256 + BLS
317
+ * - Tier 3: ALG_CUMULATIVE_T3 (0x05) — P256 + BLS + Guardian
318
+ */
319
+ declare function algIdForTier(tier: TierLevel): AlgId;
320
+
321
+ export { ALG_BLS as A, type BLSConfig as B, CryptoUtil as C, ERC4337Utils as E, type GasEstimate as G, type PackedUserOperation as P, type TierConfig as T, UserOpBuilder as U, YAAAClient as Y, ALG_CUMULATIVE_T2 as a, ALG_CUMULATIVE_T3 as b, ALG_ECDSA as c, ALG_P256 as d, type AlgId as e, BLSManager as f, type BLSNode as g, type BLSSignatureData as h, type BeginAuthenticationResponse as i, type BeginRegistrationResponse as j, type BeginTransactionVerificationResponse as k, type CumulativeT2SignatureData as l, type CumulativeT3SignatureData as m, type GuardStatus as n, type PasskeyAuthenticationParams as o, type PasskeyInfo as p, PasskeyManager as q, type PasskeyRegistrationParams as r, type PreCheckResult as s, type TierLevel as t, type TransactionVerificationParams as u, type UserOperation as v, type YAAAConfig as w, algIdForTier as x, resolveTier as y };
package/dist/tokens.d.ts CHANGED
@@ -1 +1,64 @@
1
- export * from '@aastar/tokens';
1
+ import { Address, Hash } from 'viem';
2
+ import { P as PublicClient, W as WalletClient } from './doc-types-471vSmPO.js';
3
+
4
+ declare class FinanceClient {
5
+ private publicClient;
6
+ private walletClient;
7
+ /**
8
+ * Initialize FinanceClient
9
+ * @param publicClient The public client for queries
10
+ * @param walletClient The wallet client for transactions
11
+ */
12
+ constructor(publicClient: PublicClient, walletClient: WalletClient);
13
+ /** @deprecated Use instance methods instead */
14
+ static depositToPaymaster(wallet: WalletClient, paymaster: Address, amount: bigint): Promise<`0x${string}`>;
15
+ /** @deprecated Use instance methods instead */
16
+ static depositViaTransferAndCall(wallet: WalletClient, token: Address, paymaster: Address, amount: bigint): Promise<`0x${string}`>;
17
+ /** @deprecated Use instance methods instead */
18
+ static stakeGToken(wallet: WalletClient, stakingAddr: Address, amount: bigint): Promise<`0x${string}`>;
19
+ /** @deprecated Use instance methods instead */
20
+ static withdrawProtocolRevenue(wallet: WalletClient, paymaster: Address, to: Address, amount: bigint): Promise<`0x${string}`>;
21
+ /** @deprecated Use instance methods instead */
22
+ static depositToEntryPoint(wallet: WalletClient, entryPoint: Address, paymaster: Address, amount: bigint): Promise<`0x${string}`>;
23
+ /** @deprecated Use instance methods instead */
24
+ static getEntryPointBalance(client: any, entryPoint: Address, account: Address): Promise<bigint>;
25
+ /** @deprecated Use instance methods instead */
26
+ static operatorDeposit(wallet: WalletClient, paymaster: Address, amount: bigint): Promise<`0x${string}`>;
27
+ /** @deprecated Use instance methods instead */
28
+ static operatorNotifyDeposit(wallet: WalletClient, paymaster: Address, amount: bigint): Promise<`0x${string}`>;
29
+ /**
30
+ * Get GToken balance
31
+ */
32
+ getGTokenBalance(address: Address): Promise<bigint>;
33
+ /**
34
+ * Get aPNTs balance
35
+ */
36
+ getAPNTsBalance(address: Address): Promise<bigint>;
37
+ /**
38
+ * One-step stake: Approve (if needed) + Stake
39
+ *
40
+ * @param amount Amount of GToken to stake
41
+ * @returns Transaction hash of the stake action
42
+ */
43
+ approveAndStake(amount: bigint): Promise<Hash>;
44
+ /**
45
+ * Get circulating supply (total - locked)
46
+ */
47
+ getCirculatingSupply(): Promise<{
48
+ total: bigint;
49
+ locked: bigint;
50
+ circulating: bigint;
51
+ }>;
52
+ /**
53
+ * Get comprehensive tokenomics data
54
+ */
55
+ getTokenomicsOverview(): Promise<{
56
+ totalSupply: bigint;
57
+ totalStaked: bigint;
58
+ totalBurned: bigint;
59
+ circulatingSupply: bigint;
60
+ stakingRatio: number;
61
+ }>;
62
+ }
63
+
64
+ export { FinanceClient };
package/dist/tokens.js CHANGED
@@ -1,6 +1,6 @@
1
- export { FinanceClient } from './chunk-QJT4IOIS.js';
2
- import './chunk-TIH7D4FQ.js';
3
- import './chunk-NRH56SAJ.js';
1
+ export { FinanceClient } from './chunk-KDH3UPKD.js';
2
+ import './chunk-6QYXGMCR.js';
3
+ import './chunk-G3UJC4EL.js';
4
4
  import './chunk-PZ5AY32C.js';
5
5
  //# sourceMappingURL=tokens.js.map
6
6
  //# sourceMappingURL=tokens.js.map