@aastar/sdk 0.20.8 → 0.21.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.
Files changed (144) hide show
  1. package/dist/BaseClient-CkBhQ1ou.d.cts +88 -0
  2. package/dist/UserClient-BDGP37PK.js +6 -0
  3. package/dist/{UserClient-AIIHB54I.js.map → UserClient-BDGP37PK.js.map} +1 -1
  4. package/dist/UserClient-FOAOBLGK.cjs +15 -0
  5. package/dist/UserClient-FOAOBLGK.cjs.map +1 -0
  6. package/dist/account.cjs +31 -0
  7. package/dist/account.cjs.map +1 -0
  8. package/dist/account.d.cts +48 -0
  9. package/dist/account.js +3 -3
  10. package/dist/admin.cjs +15 -0
  11. package/dist/admin.cjs.map +1 -0
  12. package/dist/admin.d.cts +62 -0
  13. package/dist/admin.js +3 -3
  14. package/dist/airaccount.cjs +452 -0
  15. package/dist/airaccount.cjs.map +1 -0
  16. package/dist/airaccount.d.cts +4 -0
  17. package/dist/airaccount.js +3 -3
  18. package/dist/channel-CkRRbzT8.d.cts +77 -0
  19. package/dist/channel.cjs +27 -0
  20. package/dist/channel.cjs.map +1 -0
  21. package/dist/channel.d.cts +64 -0
  22. package/dist/channel.js +3 -3
  23. package/dist/chunk-3HZEIFBW.cjs +118 -0
  24. package/dist/chunk-3HZEIFBW.cjs.map +1 -0
  25. package/dist/{chunk-7ARJ3OSU.js → chunk-57XLR2NT.js} +3 -3
  26. package/dist/{chunk-7ARJ3OSU.js.map → chunk-57XLR2NT.js.map} +1 -1
  27. package/dist/chunk-5JFYTJOE.cjs +448 -0
  28. package/dist/chunk-5JFYTJOE.cjs.map +1 -0
  29. package/dist/{chunk-KDH3UPKD.js → chunk-5NKU5NT5.js} +8 -8
  30. package/dist/{chunk-KDH3UPKD.js.map → chunk-5NKU5NT5.js.map} +1 -1
  31. package/dist/chunk-63JM67L7.cjs +435 -0
  32. package/dist/chunk-63JM67L7.cjs.map +1 -0
  33. package/dist/{chunk-IC3G6YM2.js → chunk-6OWZOTE7.js} +113 -9
  34. package/dist/chunk-6OWZOTE7.js.map +1 -0
  35. package/dist/chunk-CIEYY3A6.cjs +43259 -0
  36. package/dist/chunk-CIEYY3A6.cjs.map +1 -0
  37. package/dist/chunk-DEUBKZH5.cjs +421 -0
  38. package/dist/chunk-DEUBKZH5.cjs.map +1 -0
  39. package/dist/{chunk-TENYCMJ3.js → chunk-DF4WVR2H.js} +9 -9
  40. package/dist/{chunk-TENYCMJ3.js.map → chunk-DF4WVR2H.js.map} +1 -1
  41. package/dist/{chunk-BN5WY5GM.js → chunk-DQBKE4ND.js} +4 -4
  42. package/dist/{chunk-BN5WY5GM.js.map → chunk-DQBKE4ND.js.map} +1 -1
  43. package/dist/{chunk-4EZD7LPE.js → chunk-E4CQFW75.js} +3 -3
  44. package/dist/{chunk-4EZD7LPE.js.map → chunk-E4CQFW75.js.map} +1 -1
  45. package/dist/{chunk-LXWIPTPX.js → chunk-ENSMYCU6.js} +3 -3
  46. package/dist/{chunk-LXWIPTPX.js.map → chunk-ENSMYCU6.js.map} +1 -1
  47. package/dist/{chunk-FJ7XECC5.js → chunk-EY2AJTGV.js} +3 -3
  48. package/dist/{chunk-FJ7XECC5.js.map → chunk-EY2AJTGV.js.map} +1 -1
  49. package/dist/chunk-GAMSWXWI.cjs +1168 -0
  50. package/dist/chunk-GAMSWXWI.cjs.map +1 -0
  51. package/dist/chunk-IJN776TA.cjs +585 -0
  52. package/dist/chunk-IJN776TA.cjs.map +1 -0
  53. package/dist/{chunk-PKCHRXFR.js → chunk-KZERVPUR.js} +3 -3
  54. package/dist/{chunk-PKCHRXFR.js.map → chunk-KZERVPUR.js.map} +1 -1
  55. package/dist/{chunk-6QYXGMCR.js → chunk-M5WFKETT.js} +833 -47
  56. package/dist/chunk-M5WFKETT.js.map +1 -0
  57. package/dist/chunk-M7HXR7G5.cjs +128 -0
  58. package/dist/chunk-M7HXR7G5.cjs.map +1 -0
  59. package/dist/{chunk-PAABYXS6.js → chunk-MCALA6WM.js} +6 -6
  60. package/dist/{chunk-PAABYXS6.js.map → chunk-MCALA6WM.js.map} +1 -1
  61. package/dist/chunk-MXJEULSE.cjs +396 -0
  62. package/dist/chunk-MXJEULSE.cjs.map +1 -0
  63. package/dist/chunk-OVNOSAL3.cjs +4797 -0
  64. package/dist/chunk-OVNOSAL3.cjs.map +1 -0
  65. package/dist/chunk-Q7SFCCGT.cjs +11 -0
  66. package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
  67. package/dist/{chunk-MVEWJIPY.js → chunk-RXPSL33E.js} +3 -3
  68. package/dist/{chunk-MVEWJIPY.js.map → chunk-RXPSL33E.js.map} +1 -1
  69. package/dist/{chunk-G3UJC4EL.js → chunk-UCLK6LTB.js} +39 -36
  70. package/dist/chunk-UCLK6LTB.js.map +1 -0
  71. package/dist/chunk-WR4OZUXR.cjs +115 -0
  72. package/dist/chunk-WR4OZUXR.cjs.map +1 -0
  73. package/dist/chunk-XQROKLZI.cjs +4521 -0
  74. package/dist/chunk-XQROKLZI.cjs.map +1 -0
  75. package/dist/chunk-Y4EJX7UA.cjs +228 -0
  76. package/dist/chunk-Y4EJX7UA.cjs.map +1 -0
  77. package/dist/chunk-Z4GZ6DQA.cjs +108 -0
  78. package/dist/chunk-Z4GZ6DQA.cjs.map +1 -0
  79. package/dist/contract-addresses-RABD77VP.cjs +49 -0
  80. package/dist/contract-addresses-RABD77VP.cjs.map +1 -0
  81. package/dist/{contract-addresses-N3TOL2WL.js → contract-addresses-TVXSRQ7I.js} +3 -3
  82. package/dist/{contract-addresses-N3TOL2WL.js.map → contract-addresses-TVXSRQ7I.js.map} +1 -1
  83. package/dist/core.cjs +898 -0
  84. package/dist/core.cjs.map +1 -0
  85. package/dist/core.d.cts +7048 -0
  86. package/dist/core.d.ts +130 -12
  87. package/dist/core.js +2 -2
  88. package/dist/dapp.cjs +289 -0
  89. package/dist/dapp.cjs.map +1 -0
  90. package/dist/dapp.d.cts +127 -0
  91. package/dist/dapp.js +3 -3
  92. package/dist/doc-types-471vSmPO.d.cts +16 -0
  93. package/dist/enduser.cjs +24 -0
  94. package/dist/enduser.cjs.map +1 -0
  95. package/dist/enduser.d.cts +261 -0
  96. package/dist/enduser.js +4 -4
  97. package/dist/identity.cjs +23 -0
  98. package/dist/identity.cjs.map +1 -0
  99. package/dist/identity.d.cts +81 -0
  100. package/dist/identity.js +3 -3
  101. package/dist/index-B6SfEQxo.d.cts +47 -0
  102. package/dist/index.cjs +2818 -0
  103. package/dist/index.cjs.map +1 -0
  104. package/dist/index.d.cts +656 -0
  105. package/dist/index.d.ts +1 -1
  106. package/dist/index.js +17 -17
  107. package/dist/kms.cjs +452 -0
  108. package/dist/kms.cjs.map +1 -0
  109. package/dist/kms.d.cts +3104 -0
  110. package/dist/kms.d.ts +62 -12
  111. package/dist/kms.js +3 -3
  112. package/dist/lib-FE4GR7TO.cjs +1865 -0
  113. package/dist/lib-FE4GR7TO.cjs.map +1 -0
  114. package/dist/operator.cjs +27 -0
  115. package/dist/operator.cjs.map +1 -0
  116. package/dist/operator.d.cts +164 -0
  117. package/dist/operator.js +3 -3
  118. package/dist/paymaster.cjs +63 -0
  119. package/dist/paymaster.cjs.map +1 -0
  120. package/dist/paymaster.d.cts +312 -0
  121. package/dist/paymaster.js +3 -3
  122. package/dist/src-CUHI6G6W.cjs +898 -0
  123. package/dist/src-CUHI6G6W.cjs.map +1 -0
  124. package/dist/src-KHCWIS4Q.cjs +63 -0
  125. package/dist/src-KHCWIS4Q.cjs.map +1 -0
  126. package/dist/{src-X5MIV3EB.js → src-RSN4U2T2.js} +5 -5
  127. package/dist/src-RSN4U2T2.js.map +1 -0
  128. package/dist/{src-L5SI5WNB.js → src-XCV6BTSV.js} +4 -4
  129. package/dist/{src-X5MIV3EB.js.map → src-XCV6BTSV.js.map} +1 -1
  130. package/dist/tier-router-DeeVg69O.d.cts +370 -0
  131. package/dist/tokens.cjs +15 -0
  132. package/dist/tokens.cjs.map +1 -0
  133. package/dist/tokens.d.cts +64 -0
  134. package/dist/tokens.js +3 -3
  135. package/dist/x402.cjs +103 -0
  136. package/dist/x402.cjs.map +1 -0
  137. package/dist/x402.d.cts +373 -0
  138. package/dist/x402.js +3 -3
  139. package/package.json +116 -32
  140. package/dist/UserClient-AIIHB54I.js +0 -6
  141. package/dist/chunk-6QYXGMCR.js.map +0 -1
  142. package/dist/chunk-G3UJC4EL.js.map +0 -1
  143. package/dist/chunk-IC3G6YM2.js.map +0 -1
  144. package/dist/src-L5SI5WNB.js.map +0 -1
@@ -0,0 +1,228 @@
1
+ 'use strict';
2
+
3
+ var chunkCIEYY3A6_cjs = require('./chunk-CIEYY3A6.cjs');
4
+ var viem = require('viem');
5
+
6
+ var STAKING_ABI = viem.parseAbi([
7
+ "function stake(uint256)",
8
+ "function withdraw(uint256)"
9
+ ]);
10
+ var ERC20_ABI = viem.parseAbi([
11
+ "function balanceOf(address) view returns (uint256)",
12
+ "function totalSupply() view returns (uint256)",
13
+ "function approve(address,uint256) returns (bool)",
14
+ "function transfer(address,uint256) returns (bool)"
15
+ ]);
16
+ var FinanceClient = class _FinanceClient {
17
+ /**
18
+ * Initialize FinanceClient
19
+ * @param publicClient The public client for queries
20
+ * @param walletClient The wallet client for transactions
21
+ */
22
+ constructor(publicClient, walletClient) {
23
+ this.publicClient = publicClient;
24
+ this.walletClient = walletClient;
25
+ }
26
+ // ========== Existing static methods (preserved for backward compatibility) ==========
27
+ /** @deprecated Use instance methods instead */
28
+ static async depositToPaymaster(wallet, paymaster, amount) {
29
+ return wallet.writeContract({
30
+ address: paymaster,
31
+ abi: chunkCIEYY3A6_cjs.SuperPaymasterABI,
32
+ functionName: "deposit",
33
+ args: [amount],
34
+ chain: wallet.chain
35
+ });
36
+ }
37
+ /** @deprecated Use instance methods instead */
38
+ static async depositViaTransferAndCall(wallet, token, paymaster, amount) {
39
+ const ERC1363_ABI = [{
40
+ name: "transferAndCall",
41
+ type: "function",
42
+ stateMutability: "nonpayable",
43
+ inputs: [{ type: "address", name: "to" }, { type: "uint256", name: "value" }],
44
+ outputs: [{ type: "bool" }]
45
+ }];
46
+ return wallet.writeContract({
47
+ address: token,
48
+ abi: ERC1363_ABI,
49
+ functionName: "transferAndCall",
50
+ args: [paymaster, amount],
51
+ chain: wallet.chain
52
+ });
53
+ }
54
+ /** @deprecated Use instance methods instead */
55
+ static async stakeGToken(wallet, stakingAddr, amount) {
56
+ return wallet.writeContract({
57
+ address: stakingAddr,
58
+ abi: STAKING_ABI,
59
+ functionName: "stake",
60
+ args: [amount],
61
+ chain: wallet.chain
62
+ });
63
+ }
64
+ /** @deprecated Use instance methods instead */
65
+ static async withdrawProtocolRevenue(wallet, paymaster, to, amount) {
66
+ return wallet.writeContract({
67
+ address: paymaster,
68
+ abi: chunkCIEYY3A6_cjs.SuperPaymasterABI,
69
+ functionName: "withdrawProtocolRevenue",
70
+ args: [to, amount],
71
+ chain: wallet.chain
72
+ });
73
+ }
74
+ /** @deprecated Use instance methods instead */
75
+ static async depositToEntryPoint(wallet, entryPoint, paymaster, amount) {
76
+ return wallet.writeContract({
77
+ address: entryPoint,
78
+ abi: viem.parseAbi(["function depositTo(address) payable"]),
79
+ functionName: "depositTo",
80
+ args: [paymaster],
81
+ value: amount,
82
+ chain: wallet.chain
83
+ });
84
+ }
85
+ /** @deprecated Use instance methods instead */
86
+ static async getEntryPointBalance(client, entryPoint, account) {
87
+ return client.readContract({
88
+ address: entryPoint,
89
+ abi: viem.parseAbi(["function balanceOf(address) view returns (uint256)"]),
90
+ functionName: "balanceOf",
91
+ args: [account]
92
+ });
93
+ }
94
+ /** @deprecated Use instance methods instead */
95
+ static async operatorDeposit(wallet, paymaster, amount) {
96
+ return wallet.writeContract({
97
+ address: paymaster,
98
+ abi: chunkCIEYY3A6_cjs.SuperPaymasterABI,
99
+ functionName: "deposit",
100
+ args: [amount],
101
+ chain: wallet.chain
102
+ });
103
+ }
104
+ /** @deprecated Use instance methods instead */
105
+ static async operatorNotifyDeposit(wallet, paymaster, amount) {
106
+ return wallet.writeContract({
107
+ address: paymaster,
108
+ abi: chunkCIEYY3A6_cjs.SuperPaymasterABI,
109
+ functionName: "notifyDeposit",
110
+ args: [amount],
111
+ chain: wallet.chain
112
+ });
113
+ }
114
+ // ========== New instance methods (business primitives) ==========
115
+ /**
116
+ * Get GToken balance
117
+ */
118
+ async getGTokenBalance(address) {
119
+ const { CORE_ADDRESSES } = await import('./src-CUHI6G6W.cjs');
120
+ return this.publicClient.readContract({
121
+ address: CORE_ADDRESSES.gToken,
122
+ abi: ERC20_ABI,
123
+ functionName: "balanceOf",
124
+ args: [address]
125
+ });
126
+ }
127
+ /**
128
+ * Get aPNTs balance
129
+ */
130
+ async getAPNTsBalance(address) {
131
+ const { CORE_ADDRESSES } = await import('./src-CUHI6G6W.cjs');
132
+ return this.publicClient.readContract({
133
+ address: CORE_ADDRESSES.aPNTs,
134
+ abi: ERC20_ABI,
135
+ functionName: "balanceOf",
136
+ args: [address]
137
+ });
138
+ }
139
+ /**
140
+ * One-step stake: Approve (if needed) + Stake
141
+ *
142
+ * @param amount Amount of GToken to stake
143
+ * @returns Transaction hash of the stake action
144
+ */
145
+ async approveAndStake(amount) {
146
+ const account = this.walletClient.account;
147
+ if (!account) throw new Error("Account required");
148
+ const { CORE_ADDRESSES } = await import('./src-CUHI6G6W.cjs');
149
+ const gTokenAddress = CORE_ADDRESSES.gToken;
150
+ const stakingAddress = CORE_ADDRESSES.gTokenStaking;
151
+ const allowance = await this.publicClient.readContract({
152
+ address: gTokenAddress,
153
+ abi: viem.parseAbi(["function allowance(address owner, address spender) view returns (uint256)"]),
154
+ functionName: "allowance",
155
+ args: [account.address, stakingAddress]
156
+ });
157
+ if (allowance < amount) {
158
+ console.log(`[FinanceClient] Approving ${viem.formatEther(amount)} GToken...`);
159
+ const approveTx = await this.walletClient.writeContract({
160
+ address: gTokenAddress,
161
+ abi: viem.parseAbi(["function approve(address spender, uint256 amount) returns (bool)"]),
162
+ functionName: "approve",
163
+ args: [stakingAddress, amount],
164
+ chain: this.walletClient.chain,
165
+ account
166
+ });
167
+ await this.publicClient.waitForTransactionReceipt({ hash: approveTx });
168
+ console.log(`[FinanceClient] Approved.`);
169
+ }
170
+ console.log(`[FinanceClient] Staking...`);
171
+ return _FinanceClient.stakeGToken(this.walletClient, stakingAddress, amount);
172
+ }
173
+ /**
174
+ * Get circulating supply (total - locked)
175
+ */
176
+ async getCirculatingSupply() {
177
+ const { CORE_ADDRESSES } = await import('./src-CUHI6G6W.cjs');
178
+ const gTokenAddress = CORE_ADDRESSES.gToken;
179
+ const total = await this.publicClient.readContract({
180
+ address: gTokenAddress,
181
+ abi: ERC20_ABI,
182
+ functionName: "totalSupply"
183
+ });
184
+ const locked = 0n;
185
+ return {
186
+ total,
187
+ locked,
188
+ circulating: total - locked
189
+ };
190
+ }
191
+ /**
192
+ * Get comprehensive tokenomics data
193
+ */
194
+ async getTokenomicsOverview() {
195
+ const { CORE_ADDRESSES } = await import('./src-CUHI6G6W.cjs');
196
+ const [totalSupply, totalStaked, blackholeBalance] = await Promise.all([
197
+ this.publicClient.readContract({
198
+ address: CORE_ADDRESSES.gToken,
199
+ abi: viem.parseAbi(["function totalSupply() view returns (uint256)"]),
200
+ functionName: "totalSupply"
201
+ }),
202
+ this.publicClient.readContract({
203
+ address: CORE_ADDRESSES.gTokenStaking,
204
+ abi: viem.parseAbi(["function totalStaked() view returns (uint256)"]),
205
+ functionName: "totalStaked"
206
+ }),
207
+ this.publicClient.readContract({
208
+ address: CORE_ADDRESSES.gToken,
209
+ abi: viem.parseAbi(["function balanceOf(address) view returns (uint256)"]),
210
+ functionName: "balanceOf",
211
+ args: ["0x000000000000000000000000000000000000dEaD"]
212
+ })
213
+ ]);
214
+ const circulating = totalSupply - totalStaked - blackholeBalance;
215
+ const ratio = Number(viem.formatEther(totalStaked)) / Number(viem.formatEther(totalSupply)) * 100;
216
+ return {
217
+ totalSupply,
218
+ totalStaked,
219
+ totalBurned: blackholeBalance,
220
+ circulatingSupply: circulating,
221
+ stakingRatio: ratio
222
+ };
223
+ }
224
+ };
225
+
226
+ exports.FinanceClient = FinanceClient;
227
+ //# sourceMappingURL=chunk-Y4EJX7UA.cjs.map
228
+ //# sourceMappingURL=chunk-Y4EJX7UA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../tokens/src/index.ts"],"names":["parseAbi","SuperPaymasterABI","formatEther"],"mappings":";;;;;AAGA,IAAM,cAAcA,aAAA,CAAS;AAAA,EACzB,yBAAA;AAAA,EACA;AACJ,CAAC,CAAA;AAED,IAAM,YAAYA,aAAA,CAAS;AAAA,EACvB,oDAAA;AAAA,EACA,+CAAA;AAAA,EACA,kDAAA;AAAA,EACA;AACJ,CAAC,CAAA;AAEM,IAAM,aAAA,GAAN,MAAM,cAAA,CAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMvB,WAAA,CACY,cACA,YAAA,EACV;AAFU,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AACA,IAAA,IAAA,CAAA,YAAA,GAAA,YAAA;AAAA,EACT;AAAA;AAAA;AAAA,EAKH,aAAa,kBAAA,CAAmB,MAAA,EAAsB,SAAA,EAAoB,MAAA,EAAgB;AACtF,IAAA,OAAO,OAAO,aAAA,CAAc;AAAA,MACxB,OAAA,EAAS,SAAA;AAAA,MACT,GAAA,EAAKC,mCAAA;AAAA,MACL,YAAA,EAAc,SAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAM,CAAA;AAAA,MACb,OAAO,MAAA,CAAO;AAAA,KACV,CAAA;AAAA,EACZ;AAAA;AAAA,EAGA,aAAa,yBAAA,CAA0B,MAAA,EAAsB,KAAA,EAAgB,WAAoB,MAAA,EAAgB;AAC7G,IAAA,MAAM,cAAc,CAAC;AAAA,MACjB,IAAA,EAAM,iBAAA;AAAA,MACN,IAAA,EAAM,UAAA;AAAA,MACN,eAAA,EAAiB,YAAA;AAAA,MACjB,MAAA,EAAQ,CAAC,EAAE,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,I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AAI,MAAM,OAAO,oBAAc,CAAA;AAEtD,IAAA,MAAM,CAAC,WAAA,EAAa,WAAA,EAAa,gBAAgB,CAAA,GAAI,MAAM,QAAQ,GAAA,CAAI;AAAA,MACnE,IAAA,CAAK,aAAa,YAAA,CAAa;AAAA,QAC3B,SAAS,cAAA,CAAe,MAAA;AAAA,QACxB,GAAA,EAAKA,aAAA,CAAS,CAAC,+CAA+C,CAAC,CAAA;AAAA,QAC/D,YAAA,EAAc;AAAA,OACjB,CAAA;AAAA,MACD,IAAA,CAAK,aAAa,YAAA,CAAa;AAAA,QAC3B,SAAS,cAAA,CAAe,aAAA;AAAA,QACxB,GAAA,EAAKA,aAAA,CAAS,CAAC,+CAA+C,CAAC,CAAA;AAAA,QAC/D,YAAA,EAAc;AAAA,OACjB,CAAA;AAAA,MACD,IAAA,CAAK,aAAa,YAAA,CAAa;AAAA,QAC3B,SAAS,cAAA,CAAe,MAAA;AAAA,QACxB,GAAA,EAAKA,aAAA,CAAS,CAAC,oDAAoD,CAAC,CAAA;AAAA,QACpE,YAAA,EAAc,WAAA;AAAA,QACd,IAAA,EAAM,CAAC,4CAA4C;AAAA,OACtD;AAAA,KACJ,CAAA;AAED,IAAA,MAAM,WAAA,GAAc,cAAc,WAAA,GAAc,gBAAA;AAChD,IAAA,MAAM,KAAA,GAAQ,MAAA,CAAOE,gBAAA,CAAY,WAAW,CAAC,IAAI,MAAA,CAAOA,gBAAA,CAAY,WAAW,CAAC,CAAA,GAAI,GAAA;AAEpF,IAAA,OAAO;AAAA,MACH,WAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA,EAAa,gBAAA;AAAA,MACb,iBAAA,EAAmB,WAAA;AAAA,MACnB,YAAA,EAAc;AAAA,KAClB;AAAA,EACJ;AACJ","file":"chunk-Y4EJX7UA.cjs","sourcesContent":["import { type Address, parseAbi, type Hash, formatEther } from 'viem';\nimport { SuperPaymasterABI as SUPERPAYMASTER_ABI, CONTRACTS, type PublicClient, type WalletClient } from '@aastar/core';\n\nconst STAKING_ABI = parseAbi([\n 'function stake(uint256)',\n 'function withdraw(uint256)'\n]);\n\nconst ERC20_ABI = parseAbi([\n 'function balanceOf(address) view returns (uint256)',\n 'function totalSupply() view returns (uint256)',\n 'function approve(address,uint256) returns (bool)',\n 'function transfer(address,uint256) returns (bool)'\n]);\n\nexport class FinanceClient {\n /**\n * Initialize FinanceClient\n * @param publicClient The public client for queries\n * @param walletClient The wallet client for transactions\n */\n constructor(\n private publicClient: PublicClient,\n private walletClient: WalletClient\n ) {}\n\n // ========== Existing static methods (preserved for backward compatibility) ==========\n \n /** @deprecated Use instance methods instead */\n static async depositToPaymaster(wallet: WalletClient, paymaster: Address, amount: bigint) {\n return wallet.writeContract({\n address: paymaster,\n abi: SUPERPAYMASTER_ABI,\n functionName: 'deposit',\n args: [amount],\n chain: wallet.chain\n } as any);\n }\n\n /** @deprecated Use instance methods instead */\n static async depositViaTransferAndCall(wallet: WalletClient, token: Address, paymaster: Address, amount: bigint) {\n const ERC1363_ABI = [{\n name: 'transferAndCall',\n type: 'function',\n stateMutability: 'nonpayable',\n inputs: [{ type: 'address', name: 'to' }, { type: 'uint256', name: 'value' }],\n outputs: [{ type: 'bool' }]\n }] as const;\n\n return wallet.writeContract({\n address: token,\n abi: ERC1363_ABI,\n functionName: 'transferAndCall',\n args: [paymaster, amount],\n chain: wallet.chain\n } as any);\n }\n\n /** @deprecated Use instance methods instead */\n static async stakeGToken(wallet: WalletClient, stakingAddr: Address, amount: bigint) {\n return wallet.writeContract({\n address: stakingAddr,\n abi: STAKING_ABI,\n functionName: 'stake',\n args: [amount],\n chain: wallet.chain\n } as any);\n }\n\n /** @deprecated Use instance methods instead */\n static async withdrawProtocolRevenue(wallet: WalletClient, paymaster: Address, to: Address, amount: bigint) {\n return wallet.writeContract({\n address: paymaster,\n abi: SUPERPAYMASTER_ABI,\n functionName: 'withdrawProtocolRevenue',\n args: [to, amount],\n chain: wallet.chain\n } as any);\n }\n\n /** @deprecated Use instance methods instead */\n static async depositToEntryPoint(wallet: WalletClient, entryPoint: Address, paymaster: Address, amount: bigint) {\n return wallet.writeContract({\n address: entryPoint,\n abi: parseAbi(['function depositTo(address) payable']),\n functionName: 'depositTo',\n args: [paymaster],\n value: amount,\n chain: wallet.chain\n } as any);\n }\n\n /** @deprecated Use instance methods instead */\n static async getEntryPointBalance(client: any, entryPoint: Address, account: Address): Promise<bigint> {\n return client.readContract({\n address: entryPoint,\n abi: parseAbi(['function balanceOf(address) view returns (uint256)']),\n functionName: 'balanceOf',\n args: [account]\n });\n }\n\n /** @deprecated Use instance methods instead */\n static async operatorDeposit(wallet: WalletClient, paymaster: Address, amount: bigint) {\n return wallet.writeContract({\n address: paymaster,\n abi: SUPERPAYMASTER_ABI,\n functionName: 'deposit',\n args: [amount],\n chain: wallet.chain\n } as any);\n }\n\n /** @deprecated Use instance methods instead */\n static async operatorNotifyDeposit(wallet: WalletClient, paymaster: Address, amount: bigint) {\n return wallet.writeContract({\n address: paymaster,\n abi: SUPERPAYMASTER_ABI,\n functionName: 'notifyDeposit',\n args: [amount],\n chain: wallet.chain\n } as any);\n }\n\n // ========== New instance methods (business primitives) ==========\n\n /**\n * Get GToken balance\n */\n async getGTokenBalance(address: Address): Promise<bigint> {\n const { CORE_ADDRESSES } = await import('@aastar/core');\n return this.publicClient.readContract({\n address: CORE_ADDRESSES.gToken,\n abi: ERC20_ABI,\n functionName: 'balanceOf',\n args: [address]\n }) as Promise<bigint>;\n }\n\n /**\n * Get aPNTs balance\n */\n async getAPNTsBalance(address: Address): Promise<bigint> {\n const { CORE_ADDRESSES } = await import('@aastar/core');\n return this.publicClient.readContract({\n address: CORE_ADDRESSES.aPNTs,\n abi: ERC20_ABI,\n functionName: 'balanceOf',\n args: [address]\n }) as Promise<bigint>;\n }\n\n /**\n * One-step stake: Approve (if needed) + Stake\n * \n * @param amount Amount of GToken to stake\n * @returns Transaction hash of the stake action\n */\n async approveAndStake(amount: bigint): Promise<Hash> {\n const account = this.walletClient.account;\n if (!account) throw new Error(\"Account required\");\n\n const { CORE_ADDRESSES } = await import('@aastar/core');\n const gTokenAddress = CORE_ADDRESSES.gToken;\n const stakingAddress = CORE_ADDRESSES.gTokenStaking;\n \n // 1. Check Allowance\n const allowance = await this.publicClient.readContract({\n address: gTokenAddress,\n abi: parseAbi(['function allowance(address owner, address spender) view returns (uint256)']),\n functionName: 'allowance',\n args: [account.address, stakingAddress]\n }); // as bigint\n\n if ((allowance as bigint) < amount) {\n console.log(`[FinanceClient] Approving ${formatEther(amount)} GToken...`);\n const approveTx = await this.walletClient.writeContract({\n address: gTokenAddress,\n abi: parseAbi(['function approve(address spender, uint256 amount) returns (bool)']),\n functionName: 'approve',\n args: [stakingAddress, amount],\n chain: this.walletClient.chain,\n account\n });\n await this.publicClient.waitForTransactionReceipt({ hash: approveTx });\n console.log(`[FinanceClient] Approved.`);\n }\n\n // 2. Stake\n console.log(`[FinanceClient] Staking...`);\n return FinanceClient.stakeGToken(this.walletClient, stakingAddress, amount);\n }\n\n /**\n * Get circulating supply (total - locked)\n */\n async getCirculatingSupply(): Promise<{\n total: bigint;\n locked: bigint;\n circulating: bigint;\n }> {\n const { CORE_ADDRESSES } = await import('@aastar/core');\n const gTokenAddress = CORE_ADDRESSES.gToken;\n\n const total = await this.publicClient.readContract({\n address: gTokenAddress,\n abi: ERC20_ABI,\n functionName: 'totalSupply'\n }) as bigint;\n\n // In a real scenario, we might query GTokenStaking's totalStaked\n const locked = 0n;\n\n return {\n total,\n locked,\n circulating: total - locked\n };\n }\n\n /**\n * Get comprehensive tokenomics data\n */\n async getTokenomicsOverview(): Promise<{\n totalSupply: bigint;\n totalStaked: bigint;\n totalBurned: bigint;\n circulatingSupply: bigint;\n stakingRatio: number;\n }> {\n const { CORE_ADDRESSES } = await import('@aastar/core');\n \n const [totalSupply, totalStaked, blackholeBalance] = await Promise.all([\n this.publicClient.readContract({\n address: CORE_ADDRESSES.gToken,\n abi: parseAbi(['function totalSupply() view returns (uint256)']),\n functionName: 'totalSupply'\n }) as Promise<bigint>,\n this.publicClient.readContract({\n address: CORE_ADDRESSES.gTokenStaking,\n abi: parseAbi(['function totalStaked() view returns (uint256)']),\n functionName: 'totalStaked'\n }) as Promise<bigint>,\n this.publicClient.readContract({\n address: CORE_ADDRESSES.gToken,\n abi: parseAbi(['function balanceOf(address) view returns (uint256)']),\n functionName: 'balanceOf',\n args: ['0x000000000000000000000000000000000000dEaD']\n }) as Promise<bigint>\n ]);\n\n const circulating = totalSupply - totalStaked - blackholeBalance;\n const ratio = Number(formatEther(totalStaked)) / Number(formatEther(totalSupply)) * 100;\n\n return {\n totalSupply,\n totalStaked,\n totalBurned: blackholeBalance,\n circulatingSupply: circulating,\n stakingRatio: ratio\n };\n }\n}\n"]}
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ var chunkCIEYY3A6_cjs = require('./chunk-CIEYY3A6.cjs');
4
+
5
+ // ../admin/src/ProtocolGovernance.ts
6
+ var ProtocolGovernance = class extends chunkCIEYY3A6_cjs.BaseClient {
7
+ registryAddress;
8
+ entryPointAddress;
9
+ constructor(config) {
10
+ super(config);
11
+ this.registryAddress = config.registryAddress;
12
+ this.entryPointAddress = config.entryPointAddress;
13
+ }
14
+ // ===========================================
15
+ // 1. Global Parameter Management
16
+ // ===========================================
17
+ /**
18
+ * Update the Global Treasury Address where protocol fees are collected
19
+ */
20
+ async setTreasury(treasury, options) {
21
+ throw new Error("Method not mapped to RegistryABI v1. Please verify contract capabilities.");
22
+ }
23
+ /**
24
+ * Update the supported EntryPoint address
25
+ */
26
+ async updateEntryPoint(entryPoint, options) {
27
+ throw new Error("Method not mapped to RegistryABI v1.");
28
+ }
29
+ // ===========================================
30
+ // 2. Role & Module Governance
31
+ // ===========================================
32
+ /**
33
+ * Approve a new SuperPaymaster contract address
34
+ */
35
+ async setSuperPaymaster(paymaster, options) {
36
+ const registry = chunkCIEYY3A6_cjs.registryActions(this.registryAddress);
37
+ return await registry(this.client).setSuperPaymaster({
38
+ paymaster,
39
+ account: options?.account
40
+ });
41
+ }
42
+ /**
43
+ * Set the Staking contract address
44
+ */
45
+ async setStaking(staking, options) {
46
+ const registry = chunkCIEYY3A6_cjs.registryActions(this.registryAddress);
47
+ return await registry(this.client).setStaking({
48
+ staking,
49
+ account: options?.account
50
+ });
51
+ }
52
+ /**
53
+ * Configure a Role's parameters (Admin only).
54
+ * Reads the current on-chain config first, then merges the provided overrides
55
+ * and writes back the full struct via configureRole.
56
+ */
57
+ async configureRole(params, options) {
58
+ const registry = chunkCIEYY3A6_cjs.registryActions(this.registryAddress)(this.client);
59
+ const current = await registry.getRoleConfig({ roleId: params.roleId });
60
+ return await registry.configureRole({
61
+ roleId: params.roleId,
62
+ config: {
63
+ ...current,
64
+ ...params.minStake !== void 0 && { minStake: params.minStake },
65
+ ...params.ticketPrice !== void 0 && { ticketPrice: params.ticketPrice },
66
+ ...params.exitFeePercent !== void 0 && { exitFeePercent: params.exitFeePercent },
67
+ ...params.minExitFee !== void 0 && { minExitFee: params.minExitFee }
68
+ },
69
+ account: options?.account
70
+ });
71
+ }
72
+ // ===========================================
73
+ // 3. Transfer to DAO (Exit/Upgrade)
74
+ // ===========================================
75
+ /**
76
+ * Transfer Protocol Ownership to a DAO (Multisig/Timelock)
77
+ * This is the final step of "Protocol Admin" lifecycle.
78
+ */
79
+ async transferToDAO(daoAddress, options) {
80
+ const registry = chunkCIEYY3A6_cjs.registryActions(this.registryAddress);
81
+ return await registry(this.client).transferOwnership({
82
+ newOwner: daoAddress,
83
+ account: options?.account
84
+ });
85
+ }
86
+ // ===========================================
87
+ // 4. Query Capabilities
88
+ // ===========================================
89
+ async getProtocolParams() {
90
+ const registry = chunkCIEYY3A6_cjs.registryActions(this.registryAddress)(this.client);
91
+ const [sp, staking] = await Promise.all([
92
+ registry.SUPER_PAYMASTER(),
93
+ registry.GTOKEN_STAKING()
94
+ ]);
95
+ return {
96
+ minStake: 0n,
97
+ // Global default not directly exposed, usually per role
98
+ treasury: await registry.owner(),
99
+ // Approximation for now
100
+ entryPoint: this.entryPointAddress,
101
+ superPaymaster: sp
102
+ };
103
+ }
104
+ };
105
+
106
+ exports.ProtocolGovernance = ProtocolGovernance;
107
+ //# sourceMappingURL=chunk-Z4GZ6DQA.cjs.map
108
+ //# sourceMappingURL=chunk-Z4GZ6DQA.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../admin/src/ProtocolGovernance.ts"],"names":["BaseClient","registryActions"],"mappings":";;;;;AAmBO,IAAM,kBAAA,GAAN,cAAiCA,4BAAA,CAAW;AAAA,EACxC,eAAA;AAAA,EACA,iBAAA;AAAA,EAEP,YAAY,MAAA,EAGT;AACC,IAAA,KAAA,CAAM,MAAM,CAAA;AACZ,IAAA,IAAA,CAAK,kBAAkB,MAAA,CAAO,eAAA;AAC9B,IAAA,IAAA,CAAK,oBAAoB,MAAA,CAAO,iBAAA;AAAA,EACpC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,WAAA,CAAY,QAAA,EAAmB,OAAA,EAA6C;AAW9E,IAAA,MAAM,IAAI,MAAM,2EAA2E,CAAA;AAAA,EAC/F;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,gBAAA,CAAiB,UAAA,EAAqB,OAAA,EAA6C;AAIrF,IAAA,MAAM,IAAI,MAAM,sCAAsC,CAAA;AAAA,EAC1D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,iBAAA,CAAkB,SAAA,EAAoB,OAAA,EAA6C;AACrF,IAAA,MAAM,QAAA,GAAWC,iCAAA,CAAgB,IAAA,CAAK,eAAe,CAAA;AACrD,IAAA,OAAO,MAAM,QAAA,CAAS,IAAA,CAAK,MAAM,EAAE,iBAAA,CAAkB;AAAA,MACjD,SAAA;AAAA,MACA,SAAS,OAAA,EAAS;AAAA,KACrB,CAAA;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAAA,CAAW,OAAA,EAAkB,OAAA,EAA6C;A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CAAS,IAAA,CAAK,MAAM,EAAE,iBAAA,CAAkB;AAAA,MACjD,QAAA,EAAU,UAAA;AAAA,MACV,SAAS,OAAA,EAAS;AAAA,KACrB,CAAA;AAAA,EACL;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,iBAAA,GAA6C;AAC/C,IAAA,MAAM,WAAWA,iCAAA,CAAgB,IAAA,CAAK,eAAe,CAAA,CAAE,KAAK,MAAM,CAAA;AAGlE,IAAA,MAAM,CAAC,EAAA,EAAI,OAAO,CAAA,GAAI,MAAM,QAAQ,GAAA,CAAI;AAAA,MACpC,SAAS,eAAA,EAAgB;AAAA,MACzB,SAAS,cAAA;AAAe,KAC3B,CAAA;AAED,IAAA,OAAO;AAAA,MACH,QAAA,EAAU,EAAA;AAAA;AAAA,MACV,QAAA,EAAU,MAAM,QAAA,CAAS,KAAA,EAAM;AAAA;AAAA,MAC/B,YAAY,IAAA,CAAK,iBAAA;AAAA,MACjB,cAAA,EAAgB;AAAA,KACpB;AAAA,EACJ;AACJ","file":"chunk-Z4GZ6DQA.cjs","sourcesContent":["import { type Address, type Hash, type Hex } from 'viem';\nimport { BaseClient, type ClientConfig, type TransactionOptions } from '@aastar/core';\nimport { registryActions, entryPointActions } from '@aastar/core'; // L2/L1 Actions\n\nexport interface ProtocolParams {\n minStake: bigint;\n treasury: Address;\n entryPoint: Address;\n superPaymaster: Address;\n}\n\n/**\n * ProtocolGovernance - L3 Pattern\n * \n * Responsibilities:\n * 1. Global Protocol Parameter Management (Registry, EntryPoint)\n * 2. High-level Governance Operations (DAO Transfer, Upgrades)\n * 3. SuperPaymaster & Module Approval\n */\nexport class ProtocolGovernance extends BaseClient {\n public registryAddress: Address;\n public entryPointAddress: Address;\n\n constructor(config: ClientConfig & { \n registryAddress: Address; \n entryPointAddress: Address \n }) {\n super(config);\n this.registryAddress = config.registryAddress;\n this.entryPointAddress = config.entryPointAddress;\n }\n\n // ===========================================\n // 1. Global Parameter Management\n // ===========================================\n\n /**\n * Update the Global Treasury Address where protocol fees are collected\n */\n async setTreasury(treasury: Address, options?: TransactionOptions): Promise<Hash> {\n // Note: Registry might not have direct setTreasury if it relies on SuperPaymaster's config.\n // Assuming Registry has ownership pointers or config pointers.\n // If Logic resides in SuperPaymaster, we would use superPaymasterActions.\n // Based on provided ABI/Actions, Registry manages Role Configs mainly.\n // Let's assume we are updating a System Role or similar global config if available,\n // OR adhering to what registryActions provides.\n \n // Checking registryActions... it has 'transferOwnership' but maybe not direct 'setTreasury' depending on version.\n // If strictly following ABI, we might need to update a specific Role Parameter (e.g. AOA/Super config).\n \n throw new Error(\"Method not mapped to RegistryABI v1. Please verify contract capabilities.\");\n }\n\n /**\n * Update the supported EntryPoint address\n */\n async updateEntryPoint(entryPoint: Address, options?: TransactionOptions): Promise<Hash> {\n // Placeholder: Real implementation depends on if Registry stores EntryPoint\n // registryActions typically provides getters. Setters usually restricted to Owner.\n // If action not available, throw standard error.\n throw new Error(\"Method not mapped to RegistryABI v1.\");\n }\n\n // ===========================================\n // 2. Role & Module Governance\n // ===========================================\n\n /**\n * Approve a new SuperPaymaster contract address\n */\n async setSuperPaymaster(paymaster: Address, options?: TransactionOptions): Promise<Hash> {\n const registry = registryActions(this.registryAddress);\n return await registry(this.client).setSuperPaymaster({\n paymaster,\n account: options?.account\n });\n }\n\n /**\n * Set the Staking contract address\n */\n async setStaking(staking: Address, options?: TransactionOptions): Promise<Hash> {\n const registry = registryActions(this.registryAddress);\n return await registry(this.client).setStaking({\n staking,\n account: options?.account\n });\n }\n\n /**\n * Configure a Role's parameters (Admin only).\n * Reads the current on-chain config first, then merges the provided overrides\n * and writes back the full struct via configureRole.\n */\n async configureRole(params: {\n roleId: Hex;\n minStake?: bigint;\n ticketPrice?: bigint;\n exitFeePercent?: bigint;\n minExitFee?: bigint;\n }, options?: TransactionOptions): Promise<Hash> {\n const registry = registryActions(this.registryAddress)(this.client);\n const current = await registry.getRoleConfig({ roleId: params.roleId });\n return await (registry as any).configureRole({\n roleId: params.roleId,\n config: {\n ...current,\n ...(params.minStake !== undefined && { minStake: params.minStake }),\n ...(params.ticketPrice !== undefined && { ticketPrice: params.ticketPrice }),\n ...(params.exitFeePercent !== undefined && { exitFeePercent: params.exitFeePercent }),\n ...(params.minExitFee !== undefined && { minExitFee: params.minExitFee }),\n },\n account: options?.account,\n });\n }\n\n // ===========================================\n // 3. Transfer to DAO (Exit/Upgrade)\n // ===========================================\n\n /**\n * Transfer Protocol Ownership to a DAO (Multisig/Timelock)\n * This is the final step of \"Protocol Admin\" lifecycle.\n */\n async transferToDAO(daoAddress: Address, options?: TransactionOptions): Promise<Hash> {\n const registry = registryActions(this.registryAddress);\n return await registry(this.client).transferOwnership({\n newOwner: daoAddress,\n account: options?.account\n });\n }\n\n // ===========================================\n // 4. Query Capabilities\n // ===========================================\n\n async getProtocolParams(): Promise<ProtocolParams> {\n const registry = registryActions(this.registryAddress)(this.client); // Read-only via Client\n \n // Parallel fetch\n const [sp, staking] = await Promise.all([\n registry.SUPER_PAYMASTER(),\n registry.GTOKEN_STAKING()\n ]);\n\n return {\n minStake: 0n, // Global default not directly exposed, usually per role\n treasury: await registry.owner(), // Approximation for now\n entryPoint: this.entryPointAddress,\n superPaymaster: sp\n };\n }\n}\n"]}
@@ -0,0 +1,49 @@
1
+ 'use strict';
2
+
3
+ var chunkMXJEULSE_cjs = require('./chunk-MXJEULSE.cjs');
4
+ require('./chunk-Q7SFCCGT.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "ALL_ADDRESSES", {
9
+ enumerable: true,
10
+ get: function () { return chunkMXJEULSE_cjs.ALL_ADDRESSES; }
11
+ });
12
+ Object.defineProperty(exports, "COMMUNITY_OWNERS", {
13
+ enumerable: true,
14
+ get: function () { return chunkMXJEULSE_cjs.COMMUNITY_OWNERS; }
15
+ });
16
+ Object.defineProperty(exports, "CORE_ADDRESSES", {
17
+ enumerable: true,
18
+ get: function () { return chunkMXJEULSE_cjs.CORE_ADDRESSES; }
19
+ });
20
+ Object.defineProperty(exports, "MONITORING_ADDRESSES", {
21
+ enumerable: true,
22
+ get: function () { return chunkMXJEULSE_cjs.MONITORING_ADDRESSES; }
23
+ });
24
+ Object.defineProperty(exports, "OFFICIAL_ADDRESSES", {
25
+ enumerable: true,
26
+ get: function () { return chunkMXJEULSE_cjs.OFFICIAL_ADDRESSES; }
27
+ });
28
+ Object.defineProperty(exports, "PAYMASTER_ADDRESSES", {
29
+ enumerable: true,
30
+ get: function () { return chunkMXJEULSE_cjs.PAYMASTER_ADDRESSES; }
31
+ });
32
+ Object.defineProperty(exports, "TEST_ACCOUNT_ADDRESSES", {
33
+ enumerable: true,
34
+ get: function () { return chunkMXJEULSE_cjs.TEST_ACCOUNT_ADDRESSES; }
35
+ });
36
+ Object.defineProperty(exports, "TEST_COMMUNITIES", {
37
+ enumerable: true,
38
+ get: function () { return chunkMXJEULSE_cjs.TEST_COMMUNITIES; }
39
+ });
40
+ Object.defineProperty(exports, "TEST_TOKEN_ADDRESSES", {
41
+ enumerable: true,
42
+ get: function () { return chunkMXJEULSE_cjs.TEST_TOKEN_ADDRESSES; }
43
+ });
44
+ Object.defineProperty(exports, "TOKEN_ADDRESSES", {
45
+ enumerable: true,
46
+ get: function () { return chunkMXJEULSE_cjs.TOKEN_ADDRESSES; }
47
+ });
48
+ //# sourceMappingURL=contract-addresses-RABD77VP.cjs.map
49
+ //# sourceMappingURL=contract-addresses-RABD77VP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"contract-addresses-RABD77VP.cjs"}
@@ -1,4 +1,4 @@
1
- export { ALL_ADDRESSES, COMMUNITY_OWNERS, CORE_ADDRESSES, MONITORING_ADDRESSES, OFFICIAL_ADDRESSES, PAYMASTER_ADDRESSES, TEST_ACCOUNT_ADDRESSES, TEST_COMMUNITIES, TEST_TOKEN_ADDRESSES, TOKEN_ADDRESSES } from './chunk-G3UJC4EL.js';
1
+ export { ALL_ADDRESSES, COMMUNITY_OWNERS, CORE_ADDRESSES, MONITORING_ADDRESSES, OFFICIAL_ADDRESSES, PAYMASTER_ADDRESSES, TEST_ACCOUNT_ADDRESSES, TEST_COMMUNITIES, TEST_TOKEN_ADDRESSES, TOKEN_ADDRESSES } from './chunk-UCLK6LTB.js';
2
2
  import './chunk-PZ5AY32C.js';
3
- //# sourceMappingURL=contract-addresses-N3TOL2WL.js.map
4
- //# sourceMappingURL=contract-addresses-N3TOL2WL.js.map
3
+ //# sourceMappingURL=contract-addresses-TVXSRQ7I.js.map
4
+ //# sourceMappingURL=contract-addresses-TVXSRQ7I.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"contract-addresses-N3TOL2WL.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"contract-addresses-TVXSRQ7I.js"}