@aastar/sdk 0.20.7 → 0.20.9

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 (94) hide show
  1. package/dist/BaseClient-CkBhQ1ou.d.cts +88 -0
  2. package/dist/UserClient-2J6XMTNV.cjs +15 -0
  3. package/dist/UserClient-2J6XMTNV.cjs.map +1 -0
  4. package/dist/account.cjs +31 -0
  5. package/dist/account.cjs.map +1 -0
  6. package/dist/account.d.cts +48 -0
  7. package/dist/admin.cjs +15 -0
  8. package/dist/admin.cjs.map +1 -0
  9. package/dist/admin.d.cts +62 -0
  10. package/dist/airaccount.cjs +452 -0
  11. package/dist/airaccount.cjs.map +1 -0
  12. package/dist/airaccount.d.cts +4 -0
  13. package/dist/airaccount.js +3 -1
  14. package/dist/channel-CkRRbzT8.d.cts +77 -0
  15. package/dist/channel.cjs +27 -0
  16. package/dist/channel.cjs.map +1 -0
  17. package/dist/channel.d.cts +64 -0
  18. package/dist/chunk-2RCJBWPO.cjs +1168 -0
  19. package/dist/chunk-2RCJBWPO.cjs.map +1 -0
  20. package/dist/chunk-FTJD2DWE.cjs +42472 -0
  21. package/dist/chunk-FTJD2DWE.cjs.map +1 -0
  22. package/dist/chunk-GRDC6ZRA.cjs +118 -0
  23. package/dist/chunk-GRDC6ZRA.cjs.map +1 -0
  24. package/dist/chunk-GX7NROST.cjs +421 -0
  25. package/dist/chunk-GX7NROST.cjs.map +1 -0
  26. package/dist/chunk-HSVQIFIK.cjs +128 -0
  27. package/dist/chunk-HSVQIFIK.cjs.map +1 -0
  28. package/dist/{chunk-UIFMIVDK.js → chunk-IC3G6YM2.js} +24 -26
  29. package/dist/chunk-IC3G6YM2.js.map +1 -0
  30. package/dist/chunk-JTWY2XEG.cjs +115 -0
  31. package/dist/chunk-JTWY2XEG.cjs.map +1 -0
  32. package/dist/chunk-MRREGCWN.cjs +585 -0
  33. package/dist/chunk-MRREGCWN.cjs.map +1 -0
  34. package/dist/chunk-NT26BDGN.cjs +228 -0
  35. package/dist/chunk-NT26BDGN.cjs.map +1 -0
  36. package/dist/chunk-Q7SFCCGT.cjs +11 -0
  37. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  38. package/dist/chunk-QLF7N6H7.cjs +448 -0
  39. package/dist/chunk-QLF7N6H7.cjs.map +1 -0
  40. package/dist/chunk-RNHSA3LO.cjs +108 -0
  41. package/dist/chunk-RNHSA3LO.cjs.map +1 -0
  42. package/dist/chunk-S5IKOOUR.cjs +393 -0
  43. package/dist/chunk-S5IKOOUR.cjs.map +1 -0
  44. package/dist/chunk-TFLZETWB.cjs +4693 -0
  45. package/dist/chunk-TFLZETWB.cjs.map +1 -0
  46. package/dist/chunk-WQREDGUF.cjs +435 -0
  47. package/dist/chunk-WQREDGUF.cjs.map +1 -0
  48. package/dist/chunk-XQROKLZI.cjs +4521 -0
  49. package/dist/chunk-XQROKLZI.cjs.map +1 -0
  50. package/dist/contract-addresses-TANQ5DLX.cjs +49 -0
  51. package/dist/contract-addresses-TANQ5DLX.cjs.map +1 -0
  52. package/dist/core.cjs +894 -0
  53. package/dist/core.cjs.map +1 -0
  54. package/dist/core.d.cts +6930 -0
  55. package/dist/dapp.cjs +289 -0
  56. package/dist/dapp.cjs.map +1 -0
  57. package/dist/dapp.d.cts +127 -0
  58. package/dist/doc-types-471vSmPO.d.cts +16 -0
  59. package/dist/enduser.cjs +24 -0
  60. package/dist/enduser.cjs.map +1 -0
  61. package/dist/enduser.d.cts +261 -0
  62. package/dist/identity.cjs +23 -0
  63. package/dist/identity.cjs.map +1 -0
  64. package/dist/identity.d.cts +81 -0
  65. package/dist/index-B6SfEQxo.d.cts +47 -0
  66. package/dist/index.cjs +2814 -0
  67. package/dist/index.cjs.map +1 -0
  68. package/dist/index.d.cts +656 -0
  69. package/dist/kms.cjs +452 -0
  70. package/dist/kms.cjs.map +1 -0
  71. package/dist/kms.d.cts +3054 -0
  72. package/dist/kms.d.ts +13 -13
  73. package/dist/kms.js +3 -1
  74. package/dist/lib-FE4GR7TO.cjs +1865 -0
  75. package/dist/lib-FE4GR7TO.cjs.map +1 -0
  76. package/dist/operator.cjs +27 -0
  77. package/dist/operator.cjs.map +1 -0
  78. package/dist/operator.d.cts +164 -0
  79. package/dist/paymaster.cjs +63 -0
  80. package/dist/paymaster.cjs.map +1 -0
  81. package/dist/paymaster.d.cts +312 -0
  82. package/dist/src-ENPA7D2S.cjs +63 -0
  83. package/dist/src-ENPA7D2S.cjs.map +1 -0
  84. package/dist/src-TQKEO2I4.cjs +894 -0
  85. package/dist/src-TQKEO2I4.cjs.map +1 -0
  86. package/dist/tier-router-DeeVg69O.d.cts +370 -0
  87. package/dist/tokens.cjs +15 -0
  88. package/dist/tokens.cjs.map +1 -0
  89. package/dist/tokens.d.cts +64 -0
  90. package/dist/x402.cjs +103 -0
  91. package/dist/x402.cjs.map +1 -0
  92. package/dist/x402.d.cts +373 -0
  93. package/package.json +32 -32
  94. package/dist/chunk-UIFMIVDK.js.map +0 -1
@@ -0,0 +1,261 @@
1
+ import { Address, Hash, Hex } from 'viem';
2
+ import { C as ClientConfig, a as BaseClient, T as TransactionOptions } from './BaseClient-CkBhQ1ou.cjs';
3
+ import './doc-types-471vSmPO.cjs';
4
+
5
+ interface UserClientConfig extends ClientConfig {
6
+ accountAddress: Address;
7
+ sbtAddress?: Address;
8
+ entryPointAddress?: Address;
9
+ superPaymasterAddress?: Address;
10
+ gTokenStakingAddress?: Address;
11
+ registryAddress?: Address;
12
+ gTokenAddress?: Address;
13
+ bundlerClient?: any;
14
+ }
15
+ declare class UserClient extends BaseClient {
16
+ accountAddress: Address;
17
+ sbtAddress?: Address;
18
+ entryPointAddress?: Address;
19
+ gTokenStakingAddress?: Address;
20
+ registryAddress?: Address;
21
+ gTokenAddress?: Address;
22
+ bundlerClient?: any;
23
+ constructor(config: UserClientConfig);
24
+ /**
25
+ * Deploy a new Smart Account (Supports multiple factory types)
26
+ * Static helper to facilitate onboarding before instantiating the UserClient.
27
+ *
28
+ * @param client - WalletClient to sign the deployment transaction
29
+ * @param params - Deployment parameters
30
+ * @returns Object containing the deployed account address and transaction hash
31
+ */
32
+ static deployAccount(client: any, params: {
33
+ owner: Address;
34
+ salt?: bigint;
35
+ factoryAddress?: Address;
36
+ publicClient?: any;
37
+ accountType?: 'simple' | 'kernel' | 'safe' | string;
38
+ customAbi?: any;
39
+ }): Promise<{
40
+ accountAddress: Address;
41
+ hash: Hash;
42
+ }>;
43
+ /**
44
+ * Get the nonce of the account from EntryPoint (more reliable for 4337)
45
+ */
46
+ getNonce(key?: bigint): Promise<bigint>;
47
+ /**
48
+ * Get the owner of the AA account
49
+ */
50
+ getOwner(): Promise<Address>;
51
+ /**
52
+ * Execute a transaction from the AA account
53
+ */
54
+ execute(target: Address, value: bigint, data: Hex, options?: TransactionOptions): Promise<Hash>;
55
+ /**
56
+ * Execute a batch of transactions
57
+ */
58
+ executeBatch(targets: Address[], values: bigint[], datas: Hex[], options?: TransactionOptions): Promise<Hash>;
59
+ /**
60
+ * Get user's SBT balance
61
+ */
62
+ getSBTBalance(): Promise<bigint>;
63
+ mintSBT(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
64
+ transferToken(token: Address, to: Address, amount: bigint, options?: TransactionOptions): Promise<Hash>;
65
+ /**
66
+ * Get Token Balance
67
+ */
68
+ getTokenBalance(token: Address): Promise<bigint>;
69
+ stakeForRole(roleId: Hex, amount: bigint, options?: TransactionOptions): Promise<Hash>;
70
+ unstakeFromRole(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
71
+ /**
72
+ * Get staked balance for a specific role
73
+ */
74
+ getStakedBalance(roleId: Hex): Promise<bigint>;
75
+ exitRole(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
76
+ leaveCommunity(community: Address, options?: TransactionOptions): Promise<Hash>;
77
+ /**
78
+ * Register as EndUser (One-click: Approve + Register)
79
+ * Handles GToken approval to Staking contract and Role registration.
80
+ */
81
+ registerAsEndUser(communityAddress: Address, stakeAmount: bigint, options?: TransactionOptions): Promise<Hash>;
82
+ /**
83
+ * Execute a transaction with Gasless Sponsorship
84
+ */
85
+ executeGasless(params: {
86
+ target: Address;
87
+ value: bigint;
88
+ data: Hex;
89
+ paymaster: Address;
90
+ paymasterType: 'V4' | 'Super';
91
+ operator?: Address;
92
+ maxRate?: bigint;
93
+ }, options?: TransactionOptions): Promise<Hash>;
94
+ }
95
+
96
+ interface CommunityClientConfig extends ClientConfig {
97
+ sbtAddress?: Address;
98
+ factoryAddress?: Address;
99
+ reputationAddress?: Address;
100
+ }
101
+ interface CreateCommunityParams {
102
+ name: string;
103
+ tokenSymbol: string;
104
+ ensName?: string;
105
+ description?: string;
106
+ }
107
+ interface CommunityInfo {
108
+ address: Address;
109
+ }
110
+ /**
111
+ * Client for Community Managers (`ROLE_COMMUNITY`)
112
+ */
113
+ declare class CommunityClient extends BaseClient {
114
+ sbtAddress?: Address;
115
+ factoryAddress?: Address;
116
+ reputationAddress?: Address;
117
+ constructor(config: CommunityClientConfig);
118
+ /**
119
+ * Create a new Community Token (xPNTs) and register it.
120
+ * Note: In the current architecture, creating a community often involves:
121
+ * 1. Registering the ROLE_COMMUNITY on Registry (if not exists) -> usually manual or self-register
122
+ * 2. Deploying a Token (xPNTs) via Factory
123
+ * 3. Linking the Token to the Community in Registry
124
+ */
125
+ createCommunityToken(params: CreateCommunityParams, options?: TransactionOptions): Promise<Hash>;
126
+ /**
127
+ * Get Community Details (Decodes Role Metadata)
128
+ * @param communityAddress - The address of the community manager (defaults to self)
129
+ */
130
+ getCommunityInfo(communityAddress?: Address): Promise<{
131
+ name: string;
132
+ ensName: string;
133
+ website: string;
134
+ description: string;
135
+ logoURI: string;
136
+ stakeAmount: bigint;
137
+ }>;
138
+ /**
139
+ * Register self as a Community Manager.
140
+ * This method handles all necessary steps:
141
+ * 1. Checks and approves GToken to GTokenStaking
142
+ * 2. Encodes CommunityRoleData with provided parameters
143
+ * 3. Calls registerRoleSelf on Registry
144
+ *
145
+ * @param params Community registration parameters
146
+ * @param options Transaction options
147
+ * @returns Transaction hash
148
+ */
149
+ registerAsCommunity(params: {
150
+ name: string;
151
+ ensName?: string;
152
+ website?: string;
153
+ description?: string;
154
+ logoURI?: string;
155
+ stakeAmount?: bigint;
156
+ }, options?: TransactionOptions): Promise<Hash>;
157
+ /**
158
+ * One-click Setup: Register Community + Deploy Token
159
+ * Orchestrates the complete community initialization flow.
160
+ */
161
+ setupCommunity(params: {
162
+ name: string;
163
+ tokenName: string;
164
+ tokenSymbol: string;
165
+ description?: string;
166
+ logoURI?: string;
167
+ website?: string;
168
+ stakeAmount?: bigint;
169
+ }, options?: TransactionOptions): Promise<{
170
+ tokenAddress: Address;
171
+ hashes: Hash[];
172
+ }>;
173
+ /**
174
+ * Airdrop SBTs to users to make them members
175
+ */
176
+ airdropSBT(users: Address[], roleId: bigint, options?: TransactionOptions): Promise<Hash>;
177
+ setReputationRule(ruleId: bigint, ruleConfig: any, options?: TransactionOptions): Promise<Hash>;
178
+ /**
179
+ * Revoke membership (Burn SBT)
180
+ */
181
+ revokeMembership(userAddr: Address, options?: TransactionOptions): Promise<Hash>;
182
+ /**
183
+ * Transfer ownership of the Community Token
184
+ */
185
+ transferCommunityTokenOwnership(tokenAddress: Address, newOwner: Address, options?: TransactionOptions): Promise<Hash>;
186
+ }
187
+
188
+ interface GaslessConfig {
189
+ paymasterUrl: string;
190
+ policy?: 'CREDIT' | 'TOKEN' | 'SPONSORED';
191
+ }
192
+ interface UserLifecycleConfig extends ClientConfig {
193
+ accountAddress: Address;
194
+ registryAddress: Address;
195
+ sbtAddress: Address;
196
+ gTokenAddress: Address;
197
+ gTokenStakingAddress: Address;
198
+ entryPointAddress: Address;
199
+ gasless?: GaslessConfig;
200
+ }
201
+ interface OnboardResult {
202
+ success: boolean;
203
+ sbtId?: bigint;
204
+ txHash?: Hash;
205
+ }
206
+ interface ReputationData {
207
+ score: bigint;
208
+ level: bigint;
209
+ creditLimit: bigint;
210
+ }
211
+ /**
212
+ * UserLifecycle - L3 Pattern
213
+ *
214
+ * Responsibilities:
215
+ * 1. Managing the complete lifecycle of an End User (Onboard -> Operate -> Exit)
216
+ * 2. Providing a unified interface for Gasless operations
217
+ * 3. Abstracting underlying contract interactions via L2 Actions
218
+ */
219
+ declare class UserLifecycle extends BaseClient {
220
+ accountAddress: Address;
221
+ registryAddress: Address;
222
+ sbtAddress: Address;
223
+ gTokenAddress: Address;
224
+ gTokenStakingAddress: Address;
225
+ entryPointAddress: Address;
226
+ gaslessConfig?: GaslessConfig;
227
+ config: UserLifecycleConfig;
228
+ constructor(config: UserLifecycleConfig);
229
+ /**
230
+ * Check if user is eligible to join a community
231
+ * @param community Address of the community
232
+ */
233
+ checkEligibility(community: Address): Promise<boolean>;
234
+ /**
235
+ * One-click Onboarding: Approve -> Stake -> Register -> Mint SBT
236
+ * @param community Address of the community to join
237
+ * @param stakeAmount Amount of GToken to stake (default 0.4 GT)
238
+ */
239
+ onboard(community: Address, stakeAmount?: bigint): Promise<OnboardResult>;
240
+ /**
241
+ * Enable or update Gasless configuration
242
+ */
243
+ enableGasless(config: GaslessConfig): Promise<void>;
244
+ /**
245
+ * Execute a transaction effectively using Gasless configuration if available
246
+ */
247
+ executeGaslessTx(params: {
248
+ target: Address;
249
+ value: bigint;
250
+ data: Hex;
251
+ operator?: Address;
252
+ }): Promise<Hash>;
253
+ claimSBT(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
254
+ getMyReputation(): Promise<ReputationData>;
255
+ getCreditLimit(): Promise<bigint>;
256
+ leaveCommunity(community: Address, options?: TransactionOptions): Promise<Hash>;
257
+ exitRole(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
258
+ unstakeAll(roleId: Hex, options?: TransactionOptions): Promise<Hash>;
259
+ }
260
+
261
+ export { CommunityClient, type CommunityClientConfig, type CommunityInfo, type CreateCommunityParams, type GaslessConfig, type OnboardResult, type ReputationData, UserClient, type UserClientConfig, UserLifecycle, type UserLifecycleConfig };
@@ -0,0 +1,23 @@
1
+ 'use strict';
2
+
3
+ var chunkJTWY2XEG_cjs = require('./chunk-JTWY2XEG.cjs');
4
+ require('./chunk-FTJD2DWE.cjs');
5
+ require('./chunk-S5IKOOUR.cjs');
6
+ require('./chunk-Q7SFCCGT.cjs');
7
+
8
+
9
+
10
+ Object.defineProperty(exports, "ReputationClient", {
11
+ enumerable: true,
12
+ get: function () { return chunkJTWY2XEG_cjs.ReputationClient; }
13
+ });
14
+ Object.defineProperty(exports, "checkMySBT", {
15
+ enumerable: true,
16
+ get: function () { return chunkJTWY2XEG_cjs.checkMySBT; }
17
+ });
18
+ Object.defineProperty(exports, "getMySBTId", {
19
+ enumerable: true,
20
+ get: function () { return chunkJTWY2XEG_cjs.getMySBTId; }
21
+ });
22
+ //# sourceMappingURL=identity.cjs.map
23
+ //# sourceMappingURL=identity.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"identity.cjs"}
@@ -0,0 +1,81 @@
1
+ import { Address, Hash } from 'viem';
2
+ import { P as PublicClient, W as WalletClient } from './doc-types-471vSmPO.cjs';
3
+
4
+ /**
5
+ * Check if user holds MySBT token (identity verification).
6
+ *
7
+ * Does NOT swallow read errors: `balanceOf` returns 0 for a non-holder, so any
8
+ * thrown error is an RPC/transport/contract failure — masking it as
9
+ * `{ hasSBT: false }` would turn a transient RPC blip into a false "no SBT" and
10
+ * wrongly fail eligibility checks. The error propagates so the caller can retry
11
+ * or surface "couldn't determine" rather than "no SBT".
12
+ */
13
+ declare function checkMySBT(client: any, sbtAddress: Address, user: Address): Promise<{
14
+ hasSBT: boolean;
15
+ balance: bigint;
16
+ }>;
17
+ /**
18
+ * Fetch MySBT token ID for a specific user.
19
+ * MySBT exposes `getUserSBT(address) -> uint256` (alias of the `userToSBT`
20
+ * mapping), which returns the user's tokenId or 0 when they hold no SBT.
21
+ *
22
+ * Returns the tokenId, or `null` ONLY for the genuine "no SBT" sentinel (id == 0).
23
+ * Read errors are NOT swallowed (see {@link checkMySBT}): a transient RPC failure
24
+ * must not be reported as "no SBT" (a false negative for eligibility). The error
25
+ * propagates to the caller.
26
+ */
27
+ declare function getMySBTId(client: any, sbtAddress: Address, user: Address): Promise<bigint | null>;
28
+
29
+ declare class ReputationClient {
30
+ private client;
31
+ private reputationAddress;
32
+ /** @internal */
33
+ private walletClient?;
34
+ /**
35
+ * Initialize ReputationClient
36
+ * @param client The public client for queries
37
+ * @param reputationAddress The address of the reputation system contract
38
+ * @param walletClient Optional wallet client for write operations
39
+ */
40
+ constructor(client: PublicClient, reputationAddress: Address, walletClient?: WalletClient);
41
+ /**
42
+ * Compute reputation score for a user
43
+ */
44
+ computeScore(user: Address, communities: Address[], ruleIds: `0x${string}`[][], activities: bigint[][]): Promise<bigint>;
45
+ /**
46
+ * Get global reputation score for a user
47
+ * @param user User address
48
+ * @returns Reputation score
49
+ */
50
+ getGlobalReputation(user: Address): Promise<number>;
51
+ /**
52
+ * Get credit limit based on reputation
53
+ * @param user User address
54
+ * @returns Credit limit in wei (Mock logic closely tied to Reputation)
55
+ */
56
+ getCreditLimit(user: Address): Promise<bigint>;
57
+ /**
58
+ * Get reputation score breakdown
59
+ * @param user User address
60
+ * @returns Detailed reputation breakdown (Mock implementation awaiting contract V4)
61
+ */
62
+ getReputationBreakdown(user: Address): Promise<{
63
+ baseScore: number;
64
+ stakingBonus: number;
65
+ activityBonus: number;
66
+ penaltyDeduction: number;
67
+ total: number;
68
+ }>;
69
+ /**
70
+ * Submit reputation proof (off-chain data to on-chain)
71
+ * @param params Proof parameters
72
+ * @returns Transaction hash
73
+ */
74
+ submitReputationProof(params: {
75
+ proofType: 'github' | 'twitter' | 'on-chain-activity';
76
+ proofData: string;
77
+ signature: Hash;
78
+ }): Promise<Hash>;
79
+ }
80
+
81
+ export { ReputationClient, checkMySBT, getMySBTId };
@@ -0,0 +1,47 @@
1
+ import { Address } from 'viem';
2
+
3
+ type PaymasterConfig = {
4
+ paymasterAddress: Address;
5
+ operator: Address;
6
+ maxRate?: bigint;
7
+ verificationGasLimit?: bigint;
8
+ postOpGasLimit?: bigint;
9
+ };
10
+ /**
11
+ * Constructs the middleware for SuperPaymaster.
12
+ * Returns the `paymasterAndData` hex string.
13
+ */
14
+ declare function getSuperPaymasterMiddleware(config: PaymasterConfig): {
15
+ sponsorUserOperation: (args: {
16
+ userOperation: any;
17
+ }) => Promise<{
18
+ paymasterAndData: `0x${string}`;
19
+ verificationGasLimit: bigint;
20
+ preVerificationGas: any;
21
+ }>;
22
+ };
23
+ /**
24
+ * Enhanced eligibility check for SuperPaymaster V3.
25
+ * Validates that user has sufficient credit with the given operator.
26
+ */
27
+ declare function checkEligibility(client: any, paymaster: Address, user: Address, operator: Address): Promise<{
28
+ eligible: boolean;
29
+ credit?: bigint;
30
+ token?: Address;
31
+ }>;
32
+ /**
33
+ * Admin Client for SuperPaymaster V3
34
+ */
35
+ declare class SuperPaymasterAdminClient {
36
+ private client;
37
+ private paymasterAddress;
38
+ constructor(client: any, paymasterAddress: Address);
39
+ getOperator(operator: Address): Promise<any>;
40
+ static configureOperator(wallet: any, paymaster: Address, token: Address, treasury: Address): Promise<any>;
41
+ static setOperatorPaused(wallet: any, paymaster: Address, operator: Address, paused: boolean): Promise<any>;
42
+ static updateReputation(wallet: any, paymaster: Address, operator: Address, score: bigint): Promise<any>;
43
+ static setAPNTsToken(wallet: any, paymaster: Address, token: Address): Promise<any>;
44
+ static setXPNTsFactory(wallet: any, paymaster: Address, factory: Address): Promise<any>;
45
+ }
46
+
47
+ export { type PaymasterConfig as P, SuperPaymasterAdminClient as S, checkEligibility as c, getSuperPaymasterMiddleware as g };