@aastar/sdk 0.22.0 → 0.24.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 (108) hide show
  1. package/dist/UserClient-KYDCMAIU.js +6 -0
  2. package/dist/{UserClient-Y65JLJ23.js.map → UserClient-KYDCMAIU.js.map} +1 -1
  3. package/dist/UserClient-S6LS3CB6.cjs +15 -0
  4. package/dist/{UserClient-AJOGJXOC.cjs.map → UserClient-S6LS3CB6.cjs.map} +1 -1
  5. package/dist/account.cjs +7 -7
  6. package/dist/account.js +2 -2
  7. package/dist/admin.cjs +3 -3
  8. package/dist/admin.js +2 -2
  9. package/dist/airaccount.cjs +117 -97
  10. package/dist/airaccount.d.cts +2 -1
  11. package/dist/airaccount.d.ts +2 -1
  12. package/dist/airaccount.js +2 -2
  13. package/dist/channel.cjs +6 -6
  14. package/dist/channel.js +2 -2
  15. package/dist/{chunk-RF3MSLRW.cjs → chunk-5PH5CSM7.cjs} +16 -16
  16. package/dist/{chunk-RF3MSLRW.cjs.map → chunk-5PH5CSM7.cjs.map} +1 -1
  17. package/dist/{chunk-LKSQASFZ.js → chunk-654GQ7G7.js} +3 -3
  18. package/dist/{chunk-LKSQASFZ.js.map → chunk-654GQ7G7.js.map} +1 -1
  19. package/dist/{chunk-3OIVYXUG.cjs → chunk-72JZKARR.cjs} +6 -6
  20. package/dist/{chunk-3OIVYXUG.cjs.map → chunk-72JZKARR.cjs.map} +1 -1
  21. package/dist/{chunk-JCK7VAZF.js → chunk-7RVONA2R.js} +8 -8
  22. package/dist/{chunk-JCK7VAZF.js.map → chunk-7RVONA2R.js.map} +1 -1
  23. package/dist/{chunk-MG72SGVS.cjs → chunk-A4ICWCHR.cjs} +5 -5
  24. package/dist/{chunk-MG72SGVS.cjs.map → chunk-A4ICWCHR.cjs.map} +1 -1
  25. package/dist/{chunk-6ISQM3SF.cjs → chunk-BOVDJSMK.cjs} +26 -26
  26. package/dist/{chunk-6ISQM3SF.cjs.map → chunk-BOVDJSMK.cjs.map} +1 -1
  27. package/dist/{chunk-2TS6T2WY.js → chunk-BYVG7MO7.js} +35 -4
  28. package/dist/chunk-BYVG7MO7.js.map +1 -0
  29. package/dist/{chunk-7RNOKMAJ.cjs → chunk-D667CUUS.cjs} +9 -9
  30. package/dist/{chunk-7RNOKMAJ.cjs.map → chunk-D667CUUS.cjs.map} +1 -1
  31. package/dist/{chunk-XZDMKHKG.js → chunk-DAMWXGKD.js} +3 -3
  32. package/dist/{chunk-XZDMKHKG.js.map → chunk-DAMWXGKD.js.map} +1 -1
  33. package/dist/{chunk-BLA57KBS.cjs → chunk-GDH4DSVM.cjs} +12 -12
  34. package/dist/{chunk-BLA57KBS.cjs.map → chunk-GDH4DSVM.cjs.map} +1 -1
  35. package/dist/{chunk-FZLBMUPN.cjs → chunk-HNJBQR5U.cjs} +5 -5
  36. package/dist/{chunk-FZLBMUPN.cjs.map → chunk-HNJBQR5U.cjs.map} +1 -1
  37. package/dist/{chunk-VUNNHEND.js → chunk-JMW5AHLC.js} +9 -9
  38. package/dist/{chunk-VUNNHEND.js.map → chunk-JMW5AHLC.js.map} +1 -1
  39. package/dist/{chunk-SNVHOCU6.js → chunk-LDARLWS3.js} +3 -3
  40. package/dist/{chunk-SNVHOCU6.js.map → chunk-LDARLWS3.js.map} +1 -1
  41. package/dist/{chunk-TS5CXRNI.cjs → chunk-MOJJ7QF6.cjs} +40 -3
  42. package/dist/{chunk-TS5CXRNI.cjs.map → chunk-MOJJ7QF6.cjs.map} +1 -1
  43. package/dist/{chunk-BBZAD5G2.cjs → chunk-NVYVTCHJ.cjs} +11 -11
  44. package/dist/{chunk-BBZAD5G2.cjs.map → chunk-NVYVTCHJ.cjs.map} +1 -1
  45. package/dist/{chunk-MQMTICTP.js → chunk-PNBK2CLK.js} +3 -3
  46. package/dist/{chunk-MQMTICTP.js.map → chunk-PNBK2CLK.js.map} +1 -1
  47. package/dist/{chunk-T2GF4S3E.js → chunk-PXQDAFXD.js} +6 -6
  48. package/dist/{chunk-T2GF4S3E.js.map → chunk-PXQDAFXD.js.map} +1 -1
  49. package/dist/{chunk-XTF6MNIK.js → chunk-RZ2M2RVP.js} +3 -3
  50. package/dist/{chunk-XTF6MNIK.js.map → chunk-RZ2M2RVP.js.map} +1 -1
  51. package/dist/{chunk-7HO4IUHZ.cjs → chunk-VHY6R2PI.cjs} +32 -32
  52. package/dist/{chunk-7HO4IUHZ.cjs.map → chunk-VHY6R2PI.cjs.map} +1 -1
  53. package/dist/{chunk-R3N7L7RE.js → chunk-WC25H5VG.js} +4 -4
  54. package/dist/{chunk-R3N7L7RE.js.map → chunk-WC25H5VG.js.map} +1 -1
  55. package/dist/{chunk-UUT246S2.js → chunk-WVJ4LQVB.js} +3 -3
  56. package/dist/{chunk-UUT246S2.js.map → chunk-WVJ4LQVB.js.map} +1 -1
  57. package/dist/{chunk-DOVGH7HB.cjs → chunk-WVOJV4Q5.cjs} +4 -4
  58. package/dist/{chunk-DOVGH7HB.cjs.map → chunk-WVOJV4Q5.cjs.map} +1 -1
  59. package/dist/{chunk-OVNOSAL3.cjs → chunk-Y5U7URNZ.cjs} +260 -6
  60. package/dist/chunk-Y5U7URNZ.cjs.map +1 -0
  61. package/dist/{chunk-6OWZOTE7.js → chunk-YUFQIYLR.js} +258 -9
  62. package/dist/chunk-YUFQIYLR.js.map +1 -0
  63. package/dist/core.cjs +226 -202
  64. package/dist/core.d.cts +100 -513
  65. package/dist/core.d.ts +100 -513
  66. package/dist/core.js +1 -1
  67. package/dist/dapp.cjs +5 -5
  68. package/dist/dapp.js +2 -2
  69. package/dist/enduser.cjs +6 -6
  70. package/dist/enduser.js +3 -3
  71. package/dist/identity.cjs +5 -5
  72. package/dist/identity.js +2 -2
  73. package/dist/index.cjs +327 -303
  74. package/dist/index.d.cts +4 -2
  75. package/dist/index.d.ts +4 -2
  76. package/dist/index.js +15 -15
  77. package/dist/initConfig-D8jgrcDb.d.cts +518 -0
  78. package/dist/initConfig-D8jgrcDb.d.ts +518 -0
  79. package/dist/kms.cjs +117 -97
  80. package/dist/kms.d.cts +223 -3
  81. package/dist/kms.d.ts +223 -3
  82. package/dist/kms.js +2 -2
  83. package/dist/operator.cjs +6 -6
  84. package/dist/operator.js +2 -2
  85. package/dist/paymaster.cjs +15 -15
  86. package/dist/paymaster.js +2 -2
  87. package/dist/src-5URXSFKD.js +5 -0
  88. package/dist/src-5URXSFKD.js.map +1 -0
  89. package/dist/{src-WGYHZSLY.cjs → src-72GWEAPA.cjs} +17 -17
  90. package/dist/src-72GWEAPA.cjs.map +1 -0
  91. package/dist/{src-UQ4RDCJG.cjs → src-N72HAQXS.cjs} +228 -204
  92. package/dist/src-N72HAQXS.cjs.map +1 -0
  93. package/dist/{src-MDGW57S5.js → src-UNS5B7FX.js} +4 -4
  94. package/dist/{src-UQ4RDCJG.cjs.map → src-UNS5B7FX.js.map} +1 -1
  95. package/dist/tokens.cjs +3 -3
  96. package/dist/tokens.js +2 -2
  97. package/dist/x402.cjs +25 -25
  98. package/dist/x402.js +2 -2
  99. package/package.json +1 -1
  100. package/dist/UserClient-AJOGJXOC.cjs +0 -15
  101. package/dist/UserClient-Y65JLJ23.js +0 -6
  102. package/dist/chunk-2TS6T2WY.js.map +0 -1
  103. package/dist/chunk-6OWZOTE7.js.map +0 -1
  104. package/dist/chunk-OVNOSAL3.cjs.map +0 -1
  105. package/dist/src-MDGW57S5.js.map +0 -1
  106. package/dist/src-SCR3OCME.js +0 -5
  107. package/dist/src-SCR3OCME.js.map +0 -1
  108. package/dist/src-WGYHZSLY.cjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../channel/src/voucher.ts","../../channel/src/ChannelClient.ts"],"names":[],"mappings":";;;AAEO,IAAM,aAAA,GAAgB;AAAA,EACzB,OAAA,EAAS;AAAA,IACL,EAAE,IAAA,EAAM,WAAA,EAAa,IAAA,EAAM,SAAA,EAAU;AAAA,IACrC,EAAE,IAAA,EAAM,kBAAA,EAAoB,IAAA,EAAM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AA,MAClC,SAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA,EAAS,IAAA,CAAK,MAAA,CAAO,YAAA,CAAa;AAAA,KACrC,CAAA;AAAA,EACL;AAAA,EAEA,MAAM,aAAa,SAAA,EAA+B;AAC9C,IAAA,OAAO,IAAA,CAAK,aAAa,mBAAA,CAAoB;AAAA,MACzC,SAAA;AAAA,MACA,OAAA,EAAS,IAAA,CAAK,MAAA,CAAO,YAAA,CAAa;AAAA,KACrC,CAAA;AAAA,EACL;AAAA,EAEA,MAAM,SAAS,SAAA,EAA+B;AAC1C,IAAA,OAAO,IAAA,CAAK,aAAa,eAAA,CAAgB;AAAA,MACrC,SAAA;AAAA,MACA,OAAA,EAAS,IAAA,CAAK,MAAA,CAAO,YAAA,CAAa;AAAA,KACrC,CAAA;AAAA,EACL;AAAA,EAEA,MAAM,gBAAgB,SAAA,EAAuC;AACzD,IAAA,OAAO,IAAA,CAAK,WAAA,CAAY,UAAA,CAAW,EAAE,WAAW,CAAA;AAAA,EACpD;AAAA,EAEA,MAAM,eAAA,GAAmC;AACrC,IAAA,OAAO,IAAA,CAAK,YAAY,aAAA,EAAc;AAAA,EAC1C;AAAA,EAEA,MAAM,UAAA,GAA8B;AAChC,IAAA,OAAO,IAAA,CAAK,YAAY,OAAA,EAAQ;AAAA,EACpC;AACJ","file":"chunk-MQMTICTP.js","sourcesContent":["import { type Address, type Hex, type WalletClient } from 'viem';\n\nexport const VOUCHER_TYPES = {\n Voucher: [\n { name: 'channelId', type: 'bytes32' },\n { name: 'cumulativeAmount', type: 'uint128' },\n ],\n} as const;\n\nexport function getVoucherDomain(chainId: number, verifyingContract: Address) {\n return {\n name: 'MicroPaymentChannel',\n version: '1.0.0',\n chainId,\n verifyingContract,\n };\n}\n\nexport async function signVoucher(\n walletClient: WalletClient,\n params: {\n channelId: Hex;\n cumulativeAmount: bigint;\n chainId: number;\n verifyingContract: Address;\n }\n): Promise<Hex> {\n const domain = getVoucherDomain(params.chainId, params.verifyingContract);\n\n const account = walletClient.account;\n if (!account) {\n throw new Error('WalletClient must have an account');\n }\n\n return walletClient.signTypedData({\n account,\n domain,\n types: VOUCHER_TYPES,\n primaryType: 'Voucher',\n message: {\n channelId: params.channelId,\n cumulativeAmount: params.cumulativeAmount,\n },\n });\n}\n","import { type Address, type Hex, type Hash, type PublicClient, type WalletClient } from 'viem';\nimport { channelActions, type ChannelState } from '@aastar/core';\nimport type { SignedVoucher, ChannelConfig } from './types.js';\nimport { signVoucher } from './voucher.js';\n\nexport type ChannelClientConfig = {\n publicClient: PublicClient;\n walletClient: WalletClient;\n channelAddress: Address;\n chainId: number;\n};\n\nexport class ChannelClient {\n private readonly readActions;\n private readonly writeActions;\n private readonly config: ChannelClientConfig;\n\n constructor(config: ChannelClientConfig) {\n this.config = config;\n // Separate clients: publicClient for reads (no account required),\n // walletClient for writes. Unlike X402Client which is always write-first,\n // ChannelClient exposes read-heavy helpers (getChannel, verifyVoucher) that\n // callers may invoke without a wallet configured.\n this.readActions = channelActions(config.channelAddress)(config.publicClient);\n this.writeActions = channelActions(config.channelAddress)(config.walletClient);\n }\n\n async openChannel(channelConfig: ChannelConfig): Promise<Hash> {\n return this.writeActions.openChannel({\n payee: channelConfig.payee,\n token: channelConfig.token,\n deposit: channelConfig.deposit,\n salt: channelConfig.salt,\n authorizedSigner: channelConfig.authorizedSigner,\n account: this.config.walletClient.account!,\n });\n }\n\n async signVoucherOffline(channelId: Hex, cumulativeAmount: bigint): Promise<SignedVoucher> {\n const signature = await signVoucher(this.config.walletClient, {\n channelId,\n cumulativeAmount,\n chainId: this.config.chainId,\n verifyingContract: this.config.channelAddress,\n });\n\n return { channelId, cumulativeAmount, signature };\n }\n\n async settleChannel(voucher: SignedVoucher): Promise<Hash> {\n return this.writeActions.settleChannel({\n channelId: voucher.channelId,\n cumulativeAmount: voucher.cumulativeAmount,\n signature: voucher.signature,\n account: this.config.walletClient.account!,\n });\n }\n\n async closeChannel(voucher: SignedVoucher): Promise<Hash> {\n return this.writeActions.closeChannel({\n channelId: voucher.channelId,\n cumulativeAmount: voucher.cumulativeAmount,\n signature: voucher.signature,\n account: this.config.walletClient.account!,\n });\n }\n\n async topUpChannel(channelId: Hex, amount: bigint): Promise<Hash> {\n return this.writeActions.topUpChannel({\n channelId,\n amount,\n account: this.config.walletClient.account!,\n });\n }\n\n async requestClose(channelId: Hex): Promise<Hash> {\n return this.writeActions.requestCloseChannel({\n channelId,\n account: this.config.walletClient.account!,\n });\n }\n\n async withdraw(channelId: Hex): Promise<Hash> {\n return this.writeActions.withdrawChannel({\n channelId,\n account: this.config.walletClient.account!,\n });\n }\n\n async getChannelState(channelId: Hex): Promise<ChannelState> {\n return this.readActions.getChannel({ channelId });\n }\n\n async getCloseTimeout(): Promise<bigint> {\n return this.readActions.CLOSE_TIMEOUT();\n }\n\n async getVersion(): Promise<string> {\n return this.readActions.version();\n }\n}\n"]}
1
+ {"version":3,"sources":["../../channel/src/voucher.ts","../../channel/src/ChannelClient.ts"],"names":[],"mappings":";;;AAEO,IAAM,aAAA,GAAgB;AAAA,EACzB,OAAA,EAAS;AAAA,IACL,EAAE,IAAA,EAAM,WAAA,EAAa,IAAA,EAAM,SAAA,EAAU;AAAA,IACrC,EAAE,IAAA,EAAM,kBAAA,EAAoB,IAAA,EAAM,SAAA;AAAU;AAEpD;AAEO,SAAS,gBAAA,CAAiB,SAAiB,iBAAA,EAA4B;AAC1E,EAAA,OAAO;AAAA,IACH,IAAA,EAAM,qBAAA;AAAA,IACN,OAAA,EAAS,OAAA;AAAA,IACT,OAAA;AAAA,IACA;AAAA,GACJ;AACJ;AAEA,eAAsB,WAAA,CAClB,cACA,MAAA,EAMY;AACZ,EAAA,MAAM,MAAA,GAAS,gBAAA,CAAiB,MAAA,CAAO,OAAA,EAAS,OAAO,iBAAiB,CAAA;AAExE,EAAA,MAAM,UAAU,YAAA,CAAa,OAAA;AAC7B,EAAA,IAAI,CAAC,OAAA,EAAS;AACV,IAAA,MAAM,IAAI,MAAM,mCAA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,EAAS,IAAA,CAAK,MAAA,CAAO,YAAA,CAAa;AAAA,KACrC,CAAA;AAAA,EACL;AAAA,EAEA,MAAM,gBAAgB,SAAA,EAAuC;AACzD,IAAA,OAAO,IAAA,CAAK,WAAA,CAAY,UAAA,CAAW,EAAE,WAAW,CAAA;AAAA,EACpD;AAAA,EAEA,MAAM,eAAA,GAAmC;AACrC,IAAA,OAAO,IAAA,CAAK,YAAY,aAAA,EAAc;AAAA,EAC1C;AAAA,EAEA,MAAM,UAAA,GAA8B;AAChC,IAAA,OAAO,IAAA,CAAK,YAAY,OAAA,EAAQ;AAAA,EACpC;AACJ","file":"chunk-PNBK2CLK.js","sourcesContent":["import { type Address, type Hex, type WalletClient } from 'viem';\n\nexport const VOUCHER_TYPES = {\n Voucher: [\n { name: 'channelId', type: 'bytes32' },\n { name: 'cumulativeAmount', type: 'uint128' },\n ],\n} as const;\n\nexport function getVoucherDomain(chainId: number, verifyingContract: Address) {\n return {\n name: 'MicroPaymentChannel',\n version: '1.0.0',\n chainId,\n verifyingContract,\n };\n}\n\nexport async function signVoucher(\n walletClient: WalletClient,\n params: {\n channelId: Hex;\n cumulativeAmount: bigint;\n chainId: number;\n verifyingContract: Address;\n }\n): Promise<Hex> {\n const domain = getVoucherDomain(params.chainId, params.verifyingContract);\n\n const account = walletClient.account;\n if (!account) {\n throw new Error('WalletClient must have an account');\n }\n\n return walletClient.signTypedData({\n account,\n domain,\n types: VOUCHER_TYPES,\n primaryType: 'Voucher',\n message: {\n channelId: params.channelId,\n cumulativeAmount: params.cumulativeAmount,\n },\n });\n}\n","import { type Address, type Hex, type Hash, type PublicClient, type WalletClient } from 'viem';\nimport { channelActions, type ChannelState } from '@aastar/core';\nimport type { SignedVoucher, ChannelConfig } from './types.js';\nimport { signVoucher } from './voucher.js';\n\nexport type ChannelClientConfig = {\n publicClient: PublicClient;\n walletClient: WalletClient;\n channelAddress: Address;\n chainId: number;\n};\n\nexport class ChannelClient {\n private readonly readActions;\n private readonly writeActions;\n private readonly config: ChannelClientConfig;\n\n constructor(config: ChannelClientConfig) {\n this.config = config;\n // Separate clients: publicClient for reads (no account required),\n // walletClient for writes. Unlike X402Client which is always write-first,\n // ChannelClient exposes read-heavy helpers (getChannel, verifyVoucher) that\n // callers may invoke without a wallet configured.\n this.readActions = channelActions(config.channelAddress)(config.publicClient);\n this.writeActions = channelActions(config.channelAddress)(config.walletClient);\n }\n\n async openChannel(channelConfig: ChannelConfig): Promise<Hash> {\n return this.writeActions.openChannel({\n payee: channelConfig.payee,\n token: channelConfig.token,\n deposit: channelConfig.deposit,\n salt: channelConfig.salt,\n authorizedSigner: channelConfig.authorizedSigner,\n account: this.config.walletClient.account!,\n });\n }\n\n async signVoucherOffline(channelId: Hex, cumulativeAmount: bigint): Promise<SignedVoucher> {\n const signature = await signVoucher(this.config.walletClient, {\n channelId,\n cumulativeAmount,\n chainId: this.config.chainId,\n verifyingContract: this.config.channelAddress,\n });\n\n return { channelId, cumulativeAmount, signature };\n }\n\n async settleChannel(voucher: SignedVoucher): Promise<Hash> {\n return this.writeActions.settleChannel({\n channelId: voucher.channelId,\n cumulativeAmount: voucher.cumulativeAmount,\n signature: voucher.signature,\n account: this.config.walletClient.account!,\n });\n }\n\n async closeChannel(voucher: SignedVoucher): Promise<Hash> {\n return this.writeActions.closeChannel({\n channelId: voucher.channelId,\n cumulativeAmount: voucher.cumulativeAmount,\n signature: voucher.signature,\n account: this.config.walletClient.account!,\n });\n }\n\n async topUpChannel(channelId: Hex, amount: bigint): Promise<Hash> {\n return this.writeActions.topUpChannel({\n channelId,\n amount,\n account: this.config.walletClient.account!,\n });\n }\n\n async requestClose(channelId: Hex): Promise<Hash> {\n return this.writeActions.requestCloseChannel({\n channelId,\n account: this.config.walletClient.account!,\n });\n }\n\n async withdraw(channelId: Hex): Promise<Hash> {\n return this.writeActions.withdrawChannel({\n channelId,\n account: this.config.walletClient.account!,\n });\n }\n\n async getChannelState(channelId: Hex): Promise<ChannelState> {\n return this.readActions.getChannel({ channelId });\n }\n\n async getCloseTimeout(): Promise<bigint> {\n return this.readActions.CLOSE_TIMEOUT();\n }\n\n async getVersion(): Promise<string> {\n return this.readActions.version();\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { BaseClient, entryPointActions, accountActions, sbtActions, tokenActions, stakingActions, registryActions } from './chunk-2TS6T2WY.js';
1
+ import { BaseClient, entryPointActions, accountActions, sbtActions, tokenActions, stakingActions, registryActions } from './chunk-BYVG7MO7.js';
2
2
  import { encodeFunctionData } from 'viem';
3
3
  import { bundlerActions } from 'viem/account-abstraction';
4
4
 
@@ -29,7 +29,7 @@ var UserClient = class extends BaseClient {
29
29
  * @returns Object containing the deployed account address and transaction hash
30
30
  */
31
31
  static async deployAccount(client, params) {
32
- const { accountFactoryActions, SimpleAccountFactoryABI } = await import('./src-SCR3OCME.js');
32
+ const { accountFactoryActions, SimpleAccountFactoryABI } = await import('./src-5URXSFKD.js');
33
33
  let abi = params.customAbi || (SimpleAccountFactoryABI?.abi || SimpleAccountFactoryABI);
34
34
  const factoryAddr = params.factoryAddress || "0x9406Cc6185a346906296840746125a0E44976454";
35
35
  const salt = params.salt || 0n;
@@ -356,13 +356,13 @@ var UserClient = class extends BaseClient {
356
356
  functionName: "execute",
357
357
  args: [params.target, params.value, params.data]
358
358
  });
359
- const { PaymasterClient: SDKPaymasterClient } = await import('./src-MDGW57S5.js');
359
+ const { PaymasterClient: SDKPaymasterClient } = await import('./src-UNS5B7FX.js');
360
360
  let verificationGasLimit;
361
361
  let paymasterVerificationGasLimit;
362
362
  let paymasterPostOpGasLimit;
363
363
  let autoEstimate = true;
364
364
  if (params.paymasterType === "Super") {
365
- const { tuneGasLimit } = await import('./src-MDGW57S5.js');
365
+ const { tuneGasLimit } = await import('./src-UNS5B7FX.js');
366
366
  const est = await SDKPaymasterClient.estimateUserOperationGas(
367
367
  this.client,
368
368
  this.client,
@@ -415,5 +415,5 @@ var UserClient = class extends BaseClient {
415
415
  };
416
416
 
417
417
  export { UserClient };
418
- //# sourceMappingURL=chunk-T2GF4S3E.js.map
419
- //# sourceMappingURL=chunk-T2GF4S3E.js.map
418
+ //# sourceMappingURL=chunk-PXQDAFXD.js.map
419
+ //# sourceMappingURL=chunk-PXQDAFXD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../enduser/src/UserClient.ts"],"names":["encodeFunctionData"],"mappings":";;;;AAgBO,IAAM,UAAA,GAAN,cAAyB,UAAA,CAAW;AAAA,EAChC,cAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,oBAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EAEP,YAAY,MAAA,EAA0B;AAClC,IAAA,KAAA,CAAM,MAAM,CAAA;AACZ,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,aAAA;AAC5B,IAAA,IAAA,CAAK,iBAAiB,MAAA,CAAO,cAAA;AAC7B,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,oBAAoB,MAAA,CAAO,iBAAA;AAChC,IAAA,IAAA,CAAK,uBAAuB,MAAA,CAAO,oBAAA;AACnC,IAAA,IAAA,CAAK,kBAAkB,MAAA,CAAO,eAAA;AAC9B,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,aAAA;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,aAAa,aAAA,CACT,MAAA,EACA,MAAA,EAQgD;AAChD,IAAA,MAAM,EAAE,qBAAA,EAAuB,uBAAA,EAAwB,GAAI,MAAM,OAAO,mBAAc,CAAA;AAGtF,IAAA,IAAI,GAAA,GAAM,MAAA,CAAO,SAAA,KAAc,uBAAA,EAAyB,GAAA,IAAO,uBAAA,CAAA;AAK/D,IAAA,MAAM,WAAA,GAAc,OAAO,cAAA,IAAkB,4CAAA;AAC7C,IAAA,MAAM,IAAA,GAAO,OAAO,IAAA,IAAQ,EAAA;AAG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oBAAA,GAAuB,UAAA;AAIlD,QAAA,MAAM,WAAA,GAAc,IAAI,uBAAA,GAA0B,OAAA;AAClD,QAAA,uBAAA,GAA0B,WAAA,GAAc,UAAW,WAAA,GAAc,OAAA;AAEjE,QAAA,YAAA,GAAe,KAAA;AAAA,MACnB;AAEA,MAAA,MAAM,MAAA,GAAS,MAAM,kBAAA,CAAmB,0BAAA;AAAA,QACpC,IAAA,CAAK,MAAA;AAAA,QACL,IAAA,CAAK,MAAA;AAAA;AAAA,QACL,IAAA,CAAK,cAAA;AAAA,QACL,EAAA;AAAA,QACA,MAAA,CAAO,SAAA;AAAA,QACP,MAAA,CAAO,MAAA;AAAA;AAAA,QACP,KAAK,aAAA,EAAe,SAAA,EAAW,OAAQ,IAAA,CAAK,MAAA,CAAO,UAAkB,GAAA,IAAO,EAAA;AAAA,QAC5E,QAAA;AAAA,QACA;AAAA,UACI,UAAU,MAAA,CAAO,QAAA;AAAA,UACjB,YAAA;AAAA,UACA,oBAAA;AAAA,UACA,6BAAA;AAAA,UACA;AAAA;AACJ,OACJ;AAEA,MAAA,OAAO,MAAA;AAAA,IACX,SAAS,KAAA,EAAY;AACjB,MAAA,OAAA,CAAQ,KAAA,CAAM,iCAAA,EAA8B,KAAA,CAAM,OAAO,CAAA;AACzD,MAAA,MAAM,KAAA;AAAA,IACV;AAAA,EACJ;AACJ","file":"chunk-T2GF4S3E.js","sourcesContent":["import { type Address, type Hash, type Hex, concat, pad, toHex, encodeFunctionData } from 'viem';\nimport { BaseClient, type ClientConfig, type TransactionOptions } from '@aastar/core';\nimport { accountActions, sbtActions, tokenActions, entryPointActions, stakingActions, registryActions, paymasterActions, superPaymasterActions } from '@aastar/core';\nimport { bundlerActions, type UserOperation, getUserOperationHash } from 'viem/account-abstraction';\n\nexport interface UserClientConfig extends ClientConfig {\n accountAddress: Address; // The AA account address\n sbtAddress?: Address;\n entryPointAddress?: Address;\n superPaymasterAddress?: Address; // For sponsorship queries\n gTokenStakingAddress?: Address; // For staking/investing\n registryAddress?: Address; // For role management\n gTokenAddress?: Address; // For fee payment approval\n bundlerClient?: any;\n}\n\nexport class UserClient extends BaseClient {\n public accountAddress: Address;\n public sbtAddress?: Address;\n public entryPointAddress?: Address;\n public gTokenStakingAddress?: Address;\n public registryAddress?: Address;\n public gTokenAddress?: Address;\n public bundlerClient?: any;\n\n constructor(config: UserClientConfig) {\n super(config);\n this.bundlerClient = config.bundlerClient;\n this.accountAddress = config.accountAddress;\n this.sbtAddress = config.sbtAddress;\n this.entryPointAddress = config.entryPointAddress;\n this.gTokenStakingAddress = config.gTokenStakingAddress;\n this.registryAddress = config.registryAddress;\n this.gTokenAddress = config.gTokenAddress;\n }\n\n /**\n * Deploy a new Smart Account (Supports multiple factory types)\n * Static helper to facilitate onboarding before instantiating the UserClient.\n * \n * @param client - WalletClient to sign the deployment transaction\n * @param params - Deployment parameters\n * @returns Object containing the deployed account address and transaction hash\n */\n static async deployAccount(\n client: any, \n params: {\n owner: Address;\n salt?: bigint;\n factoryAddress?: Address;\n publicClient?: any;\n accountType?: 'simple' | 'kernel' | 'safe' | string;\n customAbi?: any;\n }\n ): Promise<{ accountAddress: Address; hash: Hash }> {\n const { accountFactoryActions, SimpleAccountFactoryABI } = await import('@aastar/core');\n \n // 1. Determine Factory ABI (Ensure it's the raw ABI array)\n let abi = params.customAbi || (SimpleAccountFactoryABI?.abi || SimpleAccountFactoryABI);\n \n // In the future, we can add more built-in ABIs here based on accountType\n // if (params.accountType === 'kernel') abi = KernelFactoryABI;\n \n const factoryAddr = params.factoryAddress || '0x9406Cc6185a346906296840746125a0E44976454'; // Default v0.7 Factory\n const salt = params.salt || 0n;\n \n // Use publicClient for reading if provided, otherwise fallback to client (which might be a Full Client)\n const readClient = params.publicClient || client;\n \n // Use the generic actions with the selected ABI\n const factoryRead = accountFactoryActions(factoryAddr, abi)(readClient);\n const factoryWrite = accountFactoryActions(factoryAddr, abi)(client);\n \n // 1. Predict Address\n const accountAddress = await factoryRead.getAddress({\n owner: params.owner,\n salt\n });\n\n // 2. Deploy\n try {\n const hash = await factoryWrite.createAccount({\n owner: params.owner,\n salt,\n account: client.account\n });\n return { accountAddress, hash };\n } catch (error: any) {\n const messageParts = [\n error?.shortMessage,\n error?.message,\n error?.details,\n error?.cause?.shortMessage,\n error?.cause?.message,\n error?.cause?.details,\n error?.cause?.cause?.shortMessage,\n error?.cause?.cause?.message\n ].filter(Boolean);\n const message = messageParts.join(' ');\n if (message.includes('gas required exceeds allowance') || message.includes('intrinsic gas too low')) {\n const data = encodeFunctionData({\n abi,\n functionName: 'createAccount',\n args: [params.owner, salt]\n });\n const hash = await client.sendTransaction({\n to: factoryAddr,\n data,\n gas: 2_000_000n,\n account: client.account\n });\n return { accountAddress, hash };\n }\n throw error;\n }\n }\n\n // ========================================\n // 1. 账户基本操作 (基于 L1 simpleAccountActions)\n // ========================================\n\n /**\n * Get the nonce of the account from EntryPoint (more reliable for 4337)\n */\n async getNonce(key: bigint = 0n): Promise<bigint> {\n try {\n if (!this.entryPointAddress) {\n throw new Error('EntryPoint address required for this client');\n }\n const entryPoint = entryPointActions(this.entryPointAddress);\n return await entryPoint(this.getStartPublicClient()).getNonce({\n sender: this.accountAddress,\n key\n });\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Get the owner of the AA account\n */\n async getOwner(): Promise<Address> {\n try {\n const account = accountActions(this.accountAddress);\n return await account(this.getStartPublicClient()).owner();\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Execute a transaction from the AA account\n */\n async execute(target: Address, value: bigint, data: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n const account = accountActions(this.accountAddress);\n \n // Use standard AA execute\n return await account(this.client).execute({\n dest: target,\n value,\n func: data,\n account: options?.account\n });\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Execute a batch of transactions\n */\n async executeBatch(targets: Address[], values: bigint[], datas: Hex[], options?: TransactionOptions): Promise<Hash> {\n try {\n const account = accountActions(this.accountAddress);\n \n return await account(this.client).executeBatch({\n dest: targets,\n value: values,\n func: datas,\n account: options?.account\n });\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // identity 与 SBT (基于 L1 sbtActions)\n // ========================================\n\n /**\n * Get user's SBT balance\n */\n async getSBTBalance(): Promise<bigint> {\n try {\n if (!this.sbtAddress) throw new Error('SBT address required for this client');\n const sbt = sbtActions(this.sbtAddress);\n \n return await sbt(this.getStartPublicClient()).balanceOf({\n owner: this.accountAddress\n });\n } catch (error) {\n throw error;\n }\n }\n\n async mintSBT(roleId: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.sbtAddress) throw new Error('SBT address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'mintForRole', type: 'function', inputs: [{ name: 'user', type: 'address' }, { name: 'roleId', type: 'bytes32' }, { name: 'roleData', type: 'bytes' }], outputs: [{ type: 'uint256' }] }],\n functionName: 'mintForRole',\n args: [this.accountAddress, roleId, '0x']\n });\n\n return await this.execute(this.sbtAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 3. 资产管理 (基于 L1 tokenActions)\n // ========================================\n\n async transferToken(token: Address, to: Address, amount: bigint, options?: TransactionOptions): Promise<Hash> {\n try {\n const { encodeFunctionData } = await import('viem');\n const data = encodeFunctionData({\n abi: [{ name: 'transfer', type: 'function', inputs: [{ name: 'to', type: 'address' }, { name: 'amount', type: 'uint256' }], outputs: [{ type: 'bool' }] }],\n functionName: 'transfer',\n args: [to, amount]\n });\n\n return await this.execute(token, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Get Token Balance\n */\n async getTokenBalance(token: Address): Promise<bigint> {\n try {\n const tokens = tokenActions()(this.getStartPublicClient());\n \n return await tokens.balanceOf({\n token,\n account: this.accountAddress\n });\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 4. 委托与质押 (Delegation & Staking)\n // ========================================\n\n async stakeForRole(roleId: Hex, amount: bigint, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'lockStake', type: 'function', inputs: [{ name: 'user', type: 'address' }, { name: 'roleId', type: 'bytes32' }, { name: 'stakeAmount', type: 'uint256' }, { name: 'entryBurn', type: 'uint256' }, { name: 'payer', type: 'address' }], outputs: [] }],\n functionName: 'lockStake',\n args: [this.accountAddress, roleId, amount, 0n, this.accountAddress]\n });\n\n return await this.execute(this.gTokenStakingAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n async unstakeFromRole(roleId: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'unlockAndTransfer', type: 'function', inputs: [{ name: 'user', type: 'address' }, { name: 'roleId', type: 'bytes32' }], outputs: [{ name: 'netAmount', type: 'uint256' }] }],\n functionName: 'unlockAndTransfer',\n args: [this.accountAddress, roleId]\n });\n\n return await this.execute(this.gTokenStakingAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Get staked balance for a specific role\n */\n async getStakedBalance(roleId: Hex): Promise<bigint> {\n try {\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n const staking = stakingActions(this.gTokenStakingAddress);\n \n return await staking(this.getStartPublicClient()).getLockedStake({\n user: this.accountAddress,\n roleId\n });\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 5. 生命周期管理 (Lifecycle)\n // ========================================\n\n async exitRole(roleId: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.registryAddress) throw new Error('Registry address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'exitRole', type: 'function', inputs: [{ name: 'roleId', type: 'bytes32' }], outputs: [] }],\n functionName: 'exitRole',\n args: [roleId]\n });\n\n return await this.execute(this.registryAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n async leaveCommunity(community: Address, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.sbtAddress) throw new Error('SBT address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'leaveCommunity', type: 'function', inputs: [{ name: 'comm', type: 'address' }], outputs: [] }],\n functionName: 'leaveCommunity',\n args: [community]\n });\n\n return await this.execute(this.sbtAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Register as EndUser (One-click: Approve + Register)\n * Handles GToken approval to Staking contract and Role registration.\n */\n async registerAsEndUser(communityAddress: Address, stakeAmount: bigint, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.registryAddress) throw new Error('Registry address required for this client');\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n if (!this.gTokenAddress) throw new Error('GToken address required for this client');\n\n const { encodeAbiParameters, keccak256, toBytes, parseEther } = await import('viem');\n const ROLE_ENDUSER = keccak256(toBytes(\"ENDUSER\"));\n // Correct mapping for Registry Actions\n const registry = registryActions(this.registryAddress);\n const publicClient = this.getStartPublicClient();\n const tokens = tokenActions()(publicClient);\n\n // 1. Check Allowance\n const allowance = await tokens.allowance({\n token: this.gTokenAddress,\n owner: this.accountAddress,\n spender: this.gTokenStakingAddress\n });\n console.log(` 🔍 Debug Allowance: Account=${this.accountAddress}, Allowance=${allowance}, Needed=${stakeAmount}`);\n \n const txs: { target: Address, value: bigint, data: Hex }[] = [];\n\n if (allowance < stakeAmount) {\n const approveData = encodeFunctionData({\n abi: [{name:'approve', type:'function', inputs:[{type:'address'},{type:'uint256'}], outputs:[{type:'bool'}], stateMutability:'nonpayable'}],\n functionName: 'approve',\n args: [this.gTokenStakingAddress, parseEther('1000')]\n });\n txs.push({ target: this.gTokenAddress, value: 0n, data: approveData });\n }\n\n // 2. Construct Register Call\n // struct EndUserRoleData { address account; address community; string avatarURI; string ensName; uint256 stakeAmount; }\n const roleData = encodeAbiParameters(\n [\n { type: 'address', name: 'account' },\n { type: 'address', name: 'community' },\n { type: 'string', name: 'avatarURI' },\n { type: 'string', name: 'ensName' },\n { type: 'uint256', name: 'stakeAmount' }\n ],\n [\n this.accountAddress,\n communityAddress,\n '',\n '',\n stakeAmount\n ]\n );\n\n const registerData = encodeFunctionData({\n abi: [{ name: 'registerRoleSelf', type: 'function', inputs: [{type:'bytes32'}, {type:'bytes'}], outputs: [{type:'uint256'}], stateMutability: 'nonpayable' }],\n functionName: 'registerRoleSelf',\n args: [ROLE_ENDUSER, roleData]\n });\n \n txs.push({ target: this.registryAddress, value: 0n, data: registerData });\n \n console.log(` 🔍 Debug Onboard: Community=${communityAddress}, AA=${this.accountAddress}, Stake=${stakeAmount}`);\n console.log(` 🔍 Debug Batch: Txs=${txs.length}, Targets=${txs.map(t => t.target)}`);\n\n // 3. Execute separately for stability (Batch execution has issues on current AA deployment)\n const hashes: Hash[] = [];\n for (const tx of txs) {\n const h = await this.execute(tx.target, tx.value, tx.data, options);\n hashes.push(h);\n // Wait for each tx to ensure sequential state updates (approve -> register)\n await (this.getStartPublicClient() as any).waitForTransactionReceipt({ hash: h });\n }\n return hashes[hashes.length - 1];\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 6. Gasless Execution (Advanced)\n // ========================================\n\n /**\n * Execute a transaction with Gasless Sponsorship\n */\n async executeGasless(params: {\n target: Address;\n value: bigint;\n data: Hex;\n paymaster: Address;\n paymasterType: 'V4' | 'Super';\n operator?: Address; // Added for SuperPaymaster\n maxRate?: bigint; // Added for SuperPaymaster\n }, options?: TransactionOptions): Promise<Hash> {\n try {\n const client = this.bundlerClient ? this.bundlerClient.extend(bundlerActions) : (this.client as any).extend(bundlerActions);\n \n const ep = this.requireEntryPoint();\n \n // 1. Prepare Call Data\n const callData = encodeFunctionData({\n abi: [{ name: 'execute', type: 'function', inputs: [{ name: 'dest', type: 'address' }, { name: 'value', type: 'uint256' }, { name: 'func', type: 'bytes' }], outputs: [] }],\n functionName: 'execute',\n args: [params.target, params.value, params.data]\n });\n\n // 3. Delegate to PaymasterClient for v0.7 Gasless Submission\n // This ensures we follow the exact same logic as successful demo scripts\n // We dynamic import to avoid circular dependencies if any\n const { PaymasterClient: SDKPaymasterClient } = await import('@aastar/paymaster');\n \n let verificationGasLimit: bigint | undefined;\n let paymasterVerificationGasLimit: bigint | undefined;\n let paymasterPostOpGasLimit: bigint | undefined;\n let autoEstimate = true;\n\n if (params.paymasterType === 'Super') {\n // Apply Smart Buffer Strategy via PaymasterUtils (Same as SuperPaymasterClient)\n const { tuneGasLimit } = await import('@aastar/paymaster');\n \n const est = await SDKPaymasterClient.estimateUserOperationGas(\n this.client,\n this.client, \n this.accountAddress,\n ep,\n params.paymaster,\n params.target, // placeholder\n this.bundlerClient?.transport?.url || (this.client.transport as any).url || '', \n callData,\n {\n operator: params.operator,\n factory: undefined,\n factoryData: undefined\n }\n );\n \n // Matches SuperPaymasterClient Logic exactly:\n const bundlerEstimate = est.paymasterVerificationGasLimit || 100000n;\n // Nominal 60k, Efficiency 0.45\n paymasterVerificationGasLimit = tuneGasLimit(bundlerEstimate, 60_000n, 0.45);\n \n // Safety Pad for VGL (Moderate, not 1M)\n const SAFETY_PAD = 80000n;\n verificationGasLimit = est.verificationGasLimit + SAFETY_PAD;\n \n // SuperPaymaster postOp calls burnFromWithOpHash (~40k gas) + storage writes.\n // Add 100k buffer; floor at 200k to prevent OOG. Pure BigInt to avoid Number precision loss.\n const _postOpBase = est.paymasterPostOpGasLimit + 100_000n;\n paymasterPostOpGasLimit = _postOpBase > 200_000n ? _postOpBase : 200_000n;\n \n autoEstimate = false; // logic handled\n }\n\n const txHash = await SDKPaymasterClient.submitGaslessUserOperation(\n this.client,\n this.client, // WalletClient acts as signer\n this.accountAddress,\n ep,\n params.paymaster,\n params.target, // placeholder for token if V4\n this.bundlerClient?.transport?.url || (this.client.transport as any).url || '', \n callData,\n {\n operator: params.operator,\n autoEstimate, \n verificationGasLimit,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit\n }\n );\n\n return txHash;\n } catch (error: any) {\n console.error(\" ❌ executeGasless Error:\", error.message);\n throw error;\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../../enduser/src/UserClient.ts"],"names":["encodeFunctionData"],"mappings":";;;;AAgBO,IAAM,UAAA,GAAN,cAAyB,UAAA,CAAW;AAAA,EAChC,cAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,oBAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,aAAA;AAAA,EAEP,YAAY,MAAA,EAA0B;AAClC,IAAA,KAAA,CAAM,MAAM,CAAA;AACZ,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,aAAA;AAC5B,IAAA,IAAA,CAAK,iBAAiB,MAAA,CAAO,cAAA;AAC7B,IAAA,IAAA,CAAK,aAAa,MAAA,CAAO,UAAA;AACzB,IAAA,IAAA,CAAK,oBAAoB,MAAA,CAAO,iBAAA;AAChC,IAAA,IAAA,CAAK,uBAAuB,MAAA,CAAO,oBAAA;AACnC,IAAA,IAAA,CAAK,kBAAkB,MAAA,CAAO,eAAA;AAC9B,IAAA,IAAA,CAAK,gBAAgB,MAAA,CAAO,aAAA;AAAA,EAChC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,aAAa,aAAA,CACT,MAAA,EACA,MAAA,EAQgD;AAChD,IAAA,MAAM,EAAE,qBAAA,EAAuB,uBAAA,EAAwB,GAAI,MAAM,OAAO,mBAAc,CAAA;AAGtF,IAAA,IAAI,GAAA,GAAM,MAAA,CAAO,SAAA,KAAc,uBAAA,EAAyB,GAAA,IAAO,uBAAA,CAAA;AAK/D,IAAA,MAAM,WAAA,GAAc,OAAO,cAAA,IAAkB,4CAAA;AAC7C,IAAA,MAAM,IAAA,GAAO,OAAO,IAAA,IAAQ,EAA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IAAI,oBAAA,GAAuB,UAAA;AAIlD,QAAA,MAAM,WAAA,GAAc,IAAI,uBAAA,GAA0B,OAAA;AAClD,QAAA,uBAAA,GAA0B,WAAA,GAAc,UAAW,WAAA,GAAc,OAAA;AAEjE,QAAA,YAAA,GAAe,KAAA;AAAA,MACnB;AAEA,MAAA,MAAM,MAAA,GAAS,MAAM,kBAAA,CAAmB,0BAAA;AAAA,QACpC,IAAA,CAAK,MAAA;AAAA,QACL,IAAA,CAAK,MAAA;AAAA;AAAA,QACL,IAAA,CAAK,cAAA;AAAA,QACL,EAAA;AAAA,QACA,MAAA,CAAO,SAAA;AAAA,QACP,MAAA,CAAO,MAAA;AAAA;AAAA,QACP,KAAK,aAAA,EAAe,SAAA,EAAW,OAAQ,IAAA,CAAK,MAAA,CAAO,UAAkB,GAAA,IAAO,EAAA;AAAA,QAC5E,QAAA;AAAA,QACA;AAAA,UACI,UAAU,MAAA,CAAO,QAAA;AAAA,UACjB,YAAA;AAAA,UACA,oBAAA;AAAA,UACA,6BAAA;AAAA,UACA;AAAA;AACJ,OACJ;AAEA,MAAA,OAAO,MAAA;AAAA,IACX,SAAS,KAAA,EAAY;AACjB,MAAA,OAAA,CAAQ,KAAA,CAAM,iCAAA,EAA8B,KAAA,CAAM,OAAO,CAAA;AACzD,MAAA,MAAM,KAAA;AAAA,IACV;AAAA,EACJ;AACJ","file":"chunk-PXQDAFXD.js","sourcesContent":["import { type Address, type Hash, type Hex, concat, pad, toHex, encodeFunctionData } from 'viem';\nimport { BaseClient, type ClientConfig, type TransactionOptions } from '@aastar/core';\nimport { accountActions, sbtActions, tokenActions, entryPointActions, stakingActions, registryActions, paymasterActions, superPaymasterActions } from '@aastar/core';\nimport { bundlerActions, type UserOperation, getUserOperationHash } from 'viem/account-abstraction';\n\nexport interface UserClientConfig extends ClientConfig {\n accountAddress: Address; // The AA account address\n sbtAddress?: Address;\n entryPointAddress?: Address;\n superPaymasterAddress?: Address; // For sponsorship queries\n gTokenStakingAddress?: Address; // For staking/investing\n registryAddress?: Address; // For role management\n gTokenAddress?: Address; // For fee payment approval\n bundlerClient?: any;\n}\n\nexport class UserClient extends BaseClient {\n public accountAddress: Address;\n public sbtAddress?: Address;\n public entryPointAddress?: Address;\n public gTokenStakingAddress?: Address;\n public registryAddress?: Address;\n public gTokenAddress?: Address;\n public bundlerClient?: any;\n\n constructor(config: UserClientConfig) {\n super(config);\n this.bundlerClient = config.bundlerClient;\n this.accountAddress = config.accountAddress;\n this.sbtAddress = config.sbtAddress;\n this.entryPointAddress = config.entryPointAddress;\n this.gTokenStakingAddress = config.gTokenStakingAddress;\n this.registryAddress = config.registryAddress;\n this.gTokenAddress = config.gTokenAddress;\n }\n\n /**\n * Deploy a new Smart Account (Supports multiple factory types)\n * Static helper to facilitate onboarding before instantiating the UserClient.\n * \n * @param client - WalletClient to sign the deployment transaction\n * @param params - Deployment parameters\n * @returns Object containing the deployed account address and transaction hash\n */\n static async deployAccount(\n client: any, \n params: {\n owner: Address;\n salt?: bigint;\n factoryAddress?: Address;\n publicClient?: any;\n accountType?: 'simple' | 'kernel' | 'safe' | string;\n customAbi?: any;\n }\n ): Promise<{ accountAddress: Address; hash: Hash }> {\n const { accountFactoryActions, SimpleAccountFactoryABI } = await import('@aastar/core');\n \n // 1. Determine Factory ABI (Ensure it's the raw ABI array)\n let abi = params.customAbi || (SimpleAccountFactoryABI?.abi || SimpleAccountFactoryABI);\n \n // In the future, we can add more built-in ABIs here based on accountType\n // if (params.accountType === 'kernel') abi = KernelFactoryABI;\n \n const factoryAddr = params.factoryAddress || '0x9406Cc6185a346906296840746125a0E44976454'; // Default v0.7 Factory\n const salt = params.salt || 0n;\n \n // Use publicClient for reading if provided, otherwise fallback to client (which might be a Full Client)\n const readClient = params.publicClient || client;\n \n // Use the generic actions with the selected ABI\n const factoryRead = accountFactoryActions(factoryAddr, abi)(readClient);\n const factoryWrite = accountFactoryActions(factoryAddr, abi)(client);\n \n // 1. Predict Address\n const accountAddress = await factoryRead.getAddress({\n owner: params.owner,\n salt\n });\n\n // 2. Deploy\n try {\n const hash = await factoryWrite.createAccount({\n owner: params.owner,\n salt,\n account: client.account\n });\n return { accountAddress, hash };\n } catch (error: any) {\n const messageParts = [\n error?.shortMessage,\n error?.message,\n error?.details,\n error?.cause?.shortMessage,\n error?.cause?.message,\n error?.cause?.details,\n error?.cause?.cause?.shortMessage,\n error?.cause?.cause?.message\n ].filter(Boolean);\n const message = messageParts.join(' ');\n if (message.includes('gas required exceeds allowance') || message.includes('intrinsic gas too low')) {\n const data = encodeFunctionData({\n abi,\n functionName: 'createAccount',\n args: [params.owner, salt]\n });\n const hash = await client.sendTransaction({\n to: factoryAddr,\n data,\n gas: 2_000_000n,\n account: client.account\n });\n return { accountAddress, hash };\n }\n throw error;\n }\n }\n\n // ========================================\n // 1. 账户基本操作 (基于 L1 simpleAccountActions)\n // ========================================\n\n /**\n * Get the nonce of the account from EntryPoint (more reliable for 4337)\n */\n async getNonce(key: bigint = 0n): Promise<bigint> {\n try {\n if (!this.entryPointAddress) {\n throw new Error('EntryPoint address required for this client');\n }\n const entryPoint = entryPointActions(this.entryPointAddress);\n return await entryPoint(this.getStartPublicClient()).getNonce({\n sender: this.accountAddress,\n key\n });\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Get the owner of the AA account\n */\n async getOwner(): Promise<Address> {\n try {\n const account = accountActions(this.accountAddress);\n return await account(this.getStartPublicClient()).owner();\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Execute a transaction from the AA account\n */\n async execute(target: Address, value: bigint, data: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n const account = accountActions(this.accountAddress);\n \n // Use standard AA execute\n return await account(this.client).execute({\n dest: target,\n value,\n func: data,\n account: options?.account\n });\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Execute a batch of transactions\n */\n async executeBatch(targets: Address[], values: bigint[], datas: Hex[], options?: TransactionOptions): Promise<Hash> {\n try {\n const account = accountActions(this.accountAddress);\n \n return await account(this.client).executeBatch({\n dest: targets,\n value: values,\n func: datas,\n account: options?.account\n });\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // identity 与 SBT (基于 L1 sbtActions)\n // ========================================\n\n /**\n * Get user's SBT balance\n */\n async getSBTBalance(): Promise<bigint> {\n try {\n if (!this.sbtAddress) throw new Error('SBT address required for this client');\n const sbt = sbtActions(this.sbtAddress);\n \n return await sbt(this.getStartPublicClient()).balanceOf({\n owner: this.accountAddress\n });\n } catch (error) {\n throw error;\n }\n }\n\n async mintSBT(roleId: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.sbtAddress) throw new Error('SBT address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'mintForRole', type: 'function', inputs: [{ name: 'user', type: 'address' }, { name: 'roleId', type: 'bytes32' }, { name: 'roleData', type: 'bytes' }], outputs: [{ type: 'uint256' }] }],\n functionName: 'mintForRole',\n args: [this.accountAddress, roleId, '0x']\n });\n\n return await this.execute(this.sbtAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 3. 资产管理 (基于 L1 tokenActions)\n // ========================================\n\n async transferToken(token: Address, to: Address, amount: bigint, options?: TransactionOptions): Promise<Hash> {\n try {\n const { encodeFunctionData } = await import('viem');\n const data = encodeFunctionData({\n abi: [{ name: 'transfer', type: 'function', inputs: [{ name: 'to', type: 'address' }, { name: 'amount', type: 'uint256' }], outputs: [{ type: 'bool' }] }],\n functionName: 'transfer',\n args: [to, amount]\n });\n\n return await this.execute(token, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Get Token Balance\n */\n async getTokenBalance(token: Address): Promise<bigint> {\n try {\n const tokens = tokenActions()(this.getStartPublicClient());\n \n return await tokens.balanceOf({\n token,\n account: this.accountAddress\n });\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 4. 委托与质押 (Delegation & Staking)\n // ========================================\n\n async stakeForRole(roleId: Hex, amount: bigint, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'lockStake', type: 'function', inputs: [{ name: 'user', type: 'address' }, { name: 'roleId', type: 'bytes32' }, { name: 'stakeAmount', type: 'uint256' }, { name: 'entryBurn', type: 'uint256' }, { name: 'payer', type: 'address' }], outputs: [] }],\n functionName: 'lockStake',\n args: [this.accountAddress, roleId, amount, 0n, this.accountAddress]\n });\n\n return await this.execute(this.gTokenStakingAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n async unstakeFromRole(roleId: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'unlockAndTransfer', type: 'function', inputs: [{ name: 'user', type: 'address' }, { name: 'roleId', type: 'bytes32' }], outputs: [{ name: 'netAmount', type: 'uint256' }] }],\n functionName: 'unlockAndTransfer',\n args: [this.accountAddress, roleId]\n });\n\n return await this.execute(this.gTokenStakingAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Get staked balance for a specific role\n */\n async getStakedBalance(roleId: Hex): Promise<bigint> {\n try {\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n const staking = stakingActions(this.gTokenStakingAddress);\n \n return await staking(this.getStartPublicClient()).getLockedStake({\n user: this.accountAddress,\n roleId\n });\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 5. 生命周期管理 (Lifecycle)\n // ========================================\n\n async exitRole(roleId: Hex, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.registryAddress) throw new Error('Registry address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'exitRole', type: 'function', inputs: [{ name: 'roleId', type: 'bytes32' }], outputs: [] }],\n functionName: 'exitRole',\n args: [roleId]\n });\n\n return await this.execute(this.registryAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n async leaveCommunity(community: Address, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.sbtAddress) throw new Error('SBT address required for this client');\n const { encodeFunctionData } = await import('viem');\n \n const data = encodeFunctionData({\n abi: [{ name: 'leaveCommunity', type: 'function', inputs: [{ name: 'comm', type: 'address' }], outputs: [] }],\n functionName: 'leaveCommunity',\n args: [community]\n });\n\n return await this.execute(this.sbtAddress, 0n, data, options);\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Register as EndUser (One-click: Approve + Register)\n * Handles GToken approval to Staking contract and Role registration.\n */\n async registerAsEndUser(communityAddress: Address, stakeAmount: bigint, options?: TransactionOptions): Promise<Hash> {\n try {\n if (!this.registryAddress) throw new Error('Registry address required for this client');\n if (!this.gTokenStakingAddress) throw new Error('GTokenStaking address required for this client');\n if (!this.gTokenAddress) throw new Error('GToken address required for this client');\n\n const { encodeAbiParameters, keccak256, toBytes, parseEther } = await import('viem');\n const ROLE_ENDUSER = keccak256(toBytes(\"ENDUSER\"));\n // Correct mapping for Registry Actions\n const registry = registryActions(this.registryAddress);\n const publicClient = this.getStartPublicClient();\n const tokens = tokenActions()(publicClient);\n\n // 1. Check Allowance\n const allowance = await tokens.allowance({\n token: this.gTokenAddress,\n owner: this.accountAddress,\n spender: this.gTokenStakingAddress\n });\n console.log(` 🔍 Debug Allowance: Account=${this.accountAddress}, Allowance=${allowance}, Needed=${stakeAmount}`);\n \n const txs: { target: Address, value: bigint, data: Hex }[] = [];\n\n if (allowance < stakeAmount) {\n const approveData = encodeFunctionData({\n abi: [{name:'approve', type:'function', inputs:[{type:'address'},{type:'uint256'}], outputs:[{type:'bool'}], stateMutability:'nonpayable'}],\n functionName: 'approve',\n args: [this.gTokenStakingAddress, parseEther('1000')]\n });\n txs.push({ target: this.gTokenAddress, value: 0n, data: approveData });\n }\n\n // 2. Construct Register Call\n // struct EndUserRoleData { address account; address community; string avatarURI; string ensName; uint256 stakeAmount; }\n const roleData = encodeAbiParameters(\n [\n { type: 'address', name: 'account' },\n { type: 'address', name: 'community' },\n { type: 'string', name: 'avatarURI' },\n { type: 'string', name: 'ensName' },\n { type: 'uint256', name: 'stakeAmount' }\n ],\n [\n this.accountAddress,\n communityAddress,\n '',\n '',\n stakeAmount\n ]\n );\n\n const registerData = encodeFunctionData({\n abi: [{ name: 'registerRoleSelf', type: 'function', inputs: [{type:'bytes32'}, {type:'bytes'}], outputs: [{type:'uint256'}], stateMutability: 'nonpayable' }],\n functionName: 'registerRoleSelf',\n args: [ROLE_ENDUSER, roleData]\n });\n \n txs.push({ target: this.registryAddress, value: 0n, data: registerData });\n \n console.log(` 🔍 Debug Onboard: Community=${communityAddress}, AA=${this.accountAddress}, Stake=${stakeAmount}`);\n console.log(` 🔍 Debug Batch: Txs=${txs.length}, Targets=${txs.map(t => t.target)}`);\n\n // 3. Execute separately for stability (Batch execution has issues on current AA deployment)\n const hashes: Hash[] = [];\n for (const tx of txs) {\n const h = await this.execute(tx.target, tx.value, tx.data, options);\n hashes.push(h);\n // Wait for each tx to ensure sequential state updates (approve -> register)\n await (this.getStartPublicClient() as any).waitForTransactionReceipt({ hash: h });\n }\n return hashes[hashes.length - 1];\n } catch (error) {\n throw error;\n }\n }\n\n // ========================================\n // 6. Gasless Execution (Advanced)\n // ========================================\n\n /**\n * Execute a transaction with Gasless Sponsorship\n */\n async executeGasless(params: {\n target: Address;\n value: bigint;\n data: Hex;\n paymaster: Address;\n paymasterType: 'V4' | 'Super';\n operator?: Address; // Added for SuperPaymaster\n maxRate?: bigint; // Added for SuperPaymaster\n }, options?: TransactionOptions): Promise<Hash> {\n try {\n const client = this.bundlerClient ? this.bundlerClient.extend(bundlerActions) : (this.client as any).extend(bundlerActions);\n \n const ep = this.requireEntryPoint();\n \n // 1. Prepare Call Data\n const callData = encodeFunctionData({\n abi: [{ name: 'execute', type: 'function', inputs: [{ name: 'dest', type: 'address' }, { name: 'value', type: 'uint256' }, { name: 'func', type: 'bytes' }], outputs: [] }],\n functionName: 'execute',\n args: [params.target, params.value, params.data]\n });\n\n // 3. Delegate to PaymasterClient for v0.7 Gasless Submission\n // This ensures we follow the exact same logic as successful demo scripts\n // We dynamic import to avoid circular dependencies if any\n const { PaymasterClient: SDKPaymasterClient } = await import('@aastar/paymaster');\n \n let verificationGasLimit: bigint | undefined;\n let paymasterVerificationGasLimit: bigint | undefined;\n let paymasterPostOpGasLimit: bigint | undefined;\n let autoEstimate = true;\n\n if (params.paymasterType === 'Super') {\n // Apply Smart Buffer Strategy via PaymasterUtils (Same as SuperPaymasterClient)\n const { tuneGasLimit } = await import('@aastar/paymaster');\n \n const est = await SDKPaymasterClient.estimateUserOperationGas(\n this.client,\n this.client, \n this.accountAddress,\n ep,\n params.paymaster,\n params.target, // placeholder\n this.bundlerClient?.transport?.url || (this.client.transport as any).url || '', \n callData,\n {\n operator: params.operator,\n factory: undefined,\n factoryData: undefined\n }\n );\n \n // Matches SuperPaymasterClient Logic exactly:\n const bundlerEstimate = est.paymasterVerificationGasLimit || 100000n;\n // Nominal 60k, Efficiency 0.45\n paymasterVerificationGasLimit = tuneGasLimit(bundlerEstimate, 60_000n, 0.45);\n \n // Safety Pad for VGL (Moderate, not 1M)\n const SAFETY_PAD = 80000n;\n verificationGasLimit = est.verificationGasLimit + SAFETY_PAD;\n \n // SuperPaymaster postOp calls burnFromWithOpHash (~40k gas) + storage writes.\n // Add 100k buffer; floor at 200k to prevent OOG. Pure BigInt to avoid Number precision loss.\n const _postOpBase = est.paymasterPostOpGasLimit + 100_000n;\n paymasterPostOpGasLimit = _postOpBase > 200_000n ? _postOpBase : 200_000n;\n \n autoEstimate = false; // logic handled\n }\n\n const txHash = await SDKPaymasterClient.submitGaslessUserOperation(\n this.client,\n this.client, // WalletClient acts as signer\n this.accountAddress,\n ep,\n params.paymaster,\n params.target, // placeholder for token if V4\n this.bundlerClient?.transport?.url || (this.client.transport as any).url || '', \n callData,\n {\n operator: params.operator,\n autoEstimate, \n verificationGasLimit,\n paymasterVerificationGasLimit,\n paymasterPostOpGasLimit\n }\n );\n\n return txHash;\n } catch (error: any) {\n console.error(\" ❌ executeGasless Error:\", error.message);\n throw error;\n }\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { MySBTABI, ReputationSystemABI } from './chunk-2TS6T2WY.js';
1
+ import { MySBTABI, ReputationSystemABI } from './chunk-BYVG7MO7.js';
2
2
  import { parseAbi } from 'viem';
3
3
 
4
4
  // ../identity/src/mysbt.ts
@@ -107,5 +107,5 @@ var ReputationClient = class {
107
107
  };
108
108
 
109
109
  export { ReputationClient, checkMySBT, getMySBTId };
110
- //# sourceMappingURL=chunk-XTF6MNIK.js.map
111
- //# sourceMappingURL=chunk-XTF6MNIK.js.map
110
+ //# sourceMappingURL=chunk-RZ2M2RVP.js.map
111
+ //# sourceMappingURL=chunk-RZ2M2RVP.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../identity/src/mysbt.ts","../../identity/src/index.ts"],"names":[],"mappings":";;;;AAaA,eAAsB,UAAA,CAClB,MAAA,EACA,UAAA,EACA,IAAA,EAC6C;AAC7C,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACtC,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,QAAA;AAAA,IACL,YAAA,EAAc,WAAA;AAAA,IACd,IAAA,EAAM,CAAC,IAAI;AAAA,GACd,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,OAAA,GAAU,EAAA,EAAI,OAAA,EAAQ;AAC3C;AAYA,eAAsB,UAAA,CAClB,MAAA,EACA,UAAA,EACA,IAAA,EACsB;AACtB,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACtC,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,QAAA;AAAA,IACL,YAAA,EAAc,YAAA;AAAA,IACd,IAA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esContent":["\nimport { type Address, type PublicClient } from 'viem';\nimport { MySBTABI } from '@aastar/core';\n\n/**\n * Check if user holds MySBT token (identity verification).\n *\n * Does NOT swallow read errors: `balanceOf` returns 0 for a non-holder, so any\n * thrown error is an RPC/transport/contract failure — masking it as\n * `{ hasSBT: false }` would turn a transient RPC blip into a false \"no SBT\" and\n * wrongly fail eligibility checks. The error propagates so the caller can retry\n * or surface \"couldn't determine\" rather than \"no SBT\".\n */\nexport async function checkMySBT(\n client: any,\n sbtAddress: Address,\n user: Address\n): Promise<{ hasSBT: boolean; balance: bigint }> {\n const balance = await client.readContract({\n address: sbtAddress,\n abi: MySBTABI,\n functionName: 'balanceOf',\n args: [user]\n }) as bigint;\n\n return { hasSBT: balance > 0n, balance };\n}\n\n/**\n * Fetch MySBT token ID for a specific user.\n * MySBT exposes `getUserSBT(address) -> uint256` (alias of the `userToSBT`\n * mapping), which returns the user's tokenId or 0 when they hold no SBT.\n *\n * Returns the tokenId, or `null` ONLY for the genuine \"no SBT\" sentinel (id == 0).\n * Read errors are NOT swallowed (see {@link checkMySBT}): a transient RPC failure\n * must not be reported as \"no SBT\" (a false negative for eligibility). The error\n * propagates to the caller.\n */\nexport async function getMySBTId(\n client: any,\n sbtAddress: Address,\n user: Address\n): Promise<bigint | null> {\n const tokenId = await client.readContract({\n address: sbtAddress,\n abi: MySBTABI,\n functionName: 'getUserSBT',\n args: [user]\n }) as bigint;\n\n // tokenId 0 is the contract's sentinel for \"no SBT\" (ids start at 1).\n return tokenId > 0n ? tokenId : null;\n}\n","\nexport * from './mysbt.js';\n\nimport { createAAStarPublicClient, ReputationSystemABI, type PublicClient, type WalletClient } from '@aastar/core';\nimport { type Address, type Hash, parseAbi } from 'viem';\n\nexport class ReputationClient {\n /** @internal */\n private walletClient?: WalletClient;\n\n /**\n * Initialize ReputationClient\n * @param client The public client for queries\n * @param reputationAddress The address of the reputation system contract\n * @param walletClient Optional wallet client for write operations\n */\n constructor(\n private client: PublicClient, \n private reputationAddress: Address,\n walletClient?: WalletClient\n ) {\n this.walletClient = walletClient;\n }\n\n /**\n * Compute reputation score for a user\n */\n async computeScore(user: Address, communities: Address[], ruleIds: `0x${string}`[][], activities: bigint[][]): Promise<bigint> {\n return this.client.readContract({\n address: this.reputationAddress,\n abi: ReputationSystemABI as any,\n functionName: 'computeScore',\n args: [user, communities, ruleIds, activities]\n }) as Promise<bigint>;\n }\n\n /**\n * Get global reputation score for a user\n * @param user User address\n * @returns Reputation score\n */\n async getGlobalReputation(user: Address): Promise<number> {\n // Try to read score, if fails (e.g. invalid contract), return 0\n try {\n const score = await this.computeScore(user, [], [], []);\n return Number(score);\n } catch (e) {\n console.warn('Failed to read reputation from contract, defaulting to 0');\n return 0;\n }\n }\n\n /**\n * Get credit limit based on reputation\n * @param user User address\n * @returns Credit limit in wei (Mock logic closely tied to Reputation)\n */\n async getCreditLimit(user: Address): Promise<bigint> {\n const reputation = await this.getGlobalReputation(user);\n \n // Dynamic Credit Limit Logic:\n // Base: 0\n // Score > 50: +0.01 ETH\n // Score > 100: +0.05 ETH\n let limit = 0n;\n if (reputation > 50) limit += 10000000000000000n; // 0.01 ETH\n if (reputation > 100) limit += 40000000000000000n; // +0.04 -> 0.05 ETH\n\n return limit;\n }\n\n /**\n * Get reputation score breakdown\n * @param user User address\n * @returns Detailed reputation breakdown (Mock implementation awaiting contract V4)\n */\n async getReputationBreakdown(user: Address): Promise<{\n baseScore: number;\n stakingBonus: number;\n activityBonus: number;\n penaltyDeduction: number;\n total: number;\n }> {\n const total = await this.getGlobalReputation(user);\n \n // Heuristic breakdown\n return {\n baseScore: Math.floor(total * 0.5),\n stakingBonus: Math.floor(total * 0.3),\n activityBonus: Math.floor(total * 0.2),\n penaltyDeduction: 0,\n total\n };\n }\n\n /**\n * Submit reputation proof (off-chain data to on-chain)\n * @param params Proof parameters\n * @returns Transaction hash\n */\n async submitReputationProof(params: {\n proofType: 'github' | 'twitter' | 'on-chain-activity';\n proofData: string;\n signature: Hash;\n }): Promise<Hash> {\n if (!this.walletClient || !this.walletClient.account) {\n throw new Error(\"Wallet client required to submit proofs\");\n }\n\n // Using a generic 'submitProof' signature for now\n // In reality this would target the ReputationOracle or similar\n return this.walletClient.writeContract({\n address: this.reputationAddress,\n abi: parseAbi(['function submitProof(string,bytes32)']),\n functionName: 'submitProof',\n args: [params.proofData, params.signature],\n chain: this.walletClient.chain,\n account: this.walletClient.account\n });\n }\n}\n"]}
1
+ {"version":3,"sources":["../../identity/src/mysbt.ts","../../identity/src/index.ts"],"names":[],"mappings":";;;;AAaA,eAAsB,UAAA,CAClB,MAAA,EACA,UAAA,EACA,IAAA,EAC6C;AAC7C,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACtC,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,QAAA;AAAA,IACL,YAAA,EAAc,WAAA;AAAA,IACd,IAAA,EAAM,CAAC,IAAI;AAAA,GACd,CAAA;AAED,EAAA,OAAO,EAAE,MAAA,EAAQ,OAAA,GAAU,EAAA,EAAI,OAAA,EAAQ;AAC3C;AAYA,eAAsB,UAAA,CAClB,MAAA,EACA,UAAA,EACA,IAAA,EACsB;AACtB,EAAA,MAAM,OAAA,GAAU,MAAM,MAAA,CAAO,YAAA,CAAa;AAAA,IACtC,OAAA,EAAS,UAAA;AAAA,IACT,GAAA,EAAK,QAAA;AAAA,IACL,YAAA,EAAc,YAAA;AAAA,IACd,IAAA,EAAM,CAAC,IAAI;AAAA,GACd,CAAA;AAGD,EAAA,OAAO,OAAA,GAAU,KAAK,OAAA,GAAU,IAAA;AACpC;AC9CO,IAAM,mBAAN,MAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU1B,WAAA,CACY,MAAA,EACA,iBAAA,EACR,YAAA,EACF;AAHU,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,iBAAA,GAAA,iBAAA;AAGR,IAAA,IAAA,CAAK,YAAA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;AAAA,MACH,SAAA,EAAW,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,GAAG,CAAA;AAAA,MACjC,YAAA,EAAc,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,GAAG,CAAA;AAAA,MACpC,aAAA,EAAe,IAAA,CAAK,KAAA,CAAM,KAAA,GAAQ,GAAG,CAAA;AAAA,MACrC,gBAAA,EAAkB,CAAA;AAAA,MAClB;AAAA,KACJ;AAAA,EACJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,sBAAsB,MAAA,EAIV;AACd,IAAA,IAAI,CAAC,IAAA,CAAK,YAAA,IAAgB,CAAC,IAAA,CAAK,aAAa,OAAA,EAAS;AAClD,MAAA,MAAM,IAAI,MAAM,yCAAyC,CAAA;AAAA,IAC7D;AAIA,IAAA,OAAO,IAAA,CAAK,aAAa,aAAA,CAAc;AAAA,MACnC,SAAS,IAAA,CAAK,iBAAA;AAAA,MACd,GAAA,EAAK,QAAA,CAAS,CAAC,sCAAsC,CAAC,CAAA;AAAA,MACtD,YAAA,EAAc,aAAA;AAAA,MACd,IAAA,EAAM,CAAC,MAAA,CAAO,SAAA,EAAW,OAAO,SAAS,CAAA;AAAA,MACzC,KAAA,EAAO,KAAK,YAAA,CAAa,KAAA;AAAA,MACzB,OAAA,EAAS,KAAK,YAAA,CAAa;AAAA,KAC9B,CAAA;AAAA,EACL;AACJ","file":"chunk-RZ2M2RVP.js","sourcesContent":["\nimport { type Address, type PublicClient } from 'viem';\nimport { MySBTABI } from '@aastar/core';\n\n/**\n * Check if user holds MySBT token (identity verification).\n *\n * Does NOT swallow read errors: `balanceOf` returns 0 for a non-holder, so any\n * thrown error is an RPC/transport/contract failure — masking it as\n * `{ hasSBT: false }` would turn a transient RPC blip into a false \"no SBT\" and\n * wrongly fail eligibility checks. The error propagates so the caller can retry\n * or surface \"couldn't determine\" rather than \"no SBT\".\n */\nexport async function checkMySBT(\n client: any,\n sbtAddress: Address,\n user: Address\n): Promise<{ hasSBT: boolean; balance: bigint }> {\n const balance = await client.readContract({\n address: sbtAddress,\n abi: MySBTABI,\n functionName: 'balanceOf',\n args: [user]\n }) as bigint;\n\n return { hasSBT: balance > 0n, balance };\n}\n\n/**\n * Fetch MySBT token ID for a specific user.\n * MySBT exposes `getUserSBT(address) -> uint256` (alias of the `userToSBT`\n * mapping), which returns the user's tokenId or 0 when they hold no SBT.\n *\n * Returns the tokenId, or `null` ONLY for the genuine \"no SBT\" sentinel (id == 0).\n * Read errors are NOT swallowed (see {@link checkMySBT}): a transient RPC failure\n * must not be reported as \"no SBT\" (a false negative for eligibility). The error\n * propagates to the caller.\n */\nexport async function getMySBTId(\n client: any,\n sbtAddress: Address,\n user: Address\n): Promise<bigint | null> {\n const tokenId = await client.readContract({\n address: sbtAddress,\n abi: MySBTABI,\n functionName: 'getUserSBT',\n args: [user]\n }) as bigint;\n\n // tokenId 0 is the contract's sentinel for \"no SBT\" (ids start at 1).\n return tokenId > 0n ? tokenId : null;\n}\n","\nexport * from './mysbt.js';\n\nimport { createAAStarPublicClient, ReputationSystemABI, type PublicClient, type WalletClient } from '@aastar/core';\nimport { type Address, type Hash, parseAbi } from 'viem';\n\nexport class ReputationClient {\n /** @internal */\n private walletClient?: WalletClient;\n\n /**\n * Initialize ReputationClient\n * @param client The public client for queries\n * @param reputationAddress The address of the reputation system contract\n * @param walletClient Optional wallet client for write operations\n */\n constructor(\n private client: PublicClient, \n private reputationAddress: Address,\n walletClient?: WalletClient\n ) {\n this.walletClient = walletClient;\n }\n\n /**\n * Compute reputation score for a user\n */\n async computeScore(user: Address, communities: Address[], ruleIds: `0x${string}`[][], activities: bigint[][]): Promise<bigint> {\n return this.client.readContract({\n address: this.reputationAddress,\n abi: ReputationSystemABI as any,\n functionName: 'computeScore',\n args: [user, communities, ruleIds, activities]\n }) as Promise<bigint>;\n }\n\n /**\n * Get global reputation score for a user\n * @param user User address\n * @returns Reputation score\n */\n async getGlobalReputation(user: Address): Promise<number> {\n // Try to read score, if fails (e.g. invalid contract), return 0\n try {\n const score = await this.computeScore(user, [], [], []);\n return Number(score);\n } catch (e) {\n console.warn('Failed to read reputation from contract, defaulting to 0');\n return 0;\n }\n }\n\n /**\n * Get credit limit based on reputation\n * @param user User address\n * @returns Credit limit in wei (Mock logic closely tied to Reputation)\n */\n async getCreditLimit(user: Address): Promise<bigint> {\n const reputation = await this.getGlobalReputation(user);\n \n // Dynamic Credit Limit Logic:\n // Base: 0\n // Score > 50: +0.01 ETH\n // Score > 100: +0.05 ETH\n let limit = 0n;\n if (reputation > 50) limit += 10000000000000000n; // 0.01 ETH\n if (reputation > 100) limit += 40000000000000000n; // +0.04 -> 0.05 ETH\n\n return limit;\n }\n\n /**\n * Get reputation score breakdown\n * @param user User address\n * @returns Detailed reputation breakdown (Mock implementation awaiting contract V4)\n */\n async getReputationBreakdown(user: Address): Promise<{\n baseScore: number;\n stakingBonus: number;\n activityBonus: number;\n penaltyDeduction: number;\n total: number;\n }> {\n const total = await this.getGlobalReputation(user);\n \n // Heuristic breakdown\n return {\n baseScore: Math.floor(total * 0.5),\n stakingBonus: Math.floor(total * 0.3),\n activityBonus: Math.floor(total * 0.2),\n penaltyDeduction: 0,\n total\n };\n }\n\n /**\n * Submit reputation proof (off-chain data to on-chain)\n * @param params Proof parameters\n * @returns Transaction hash\n */\n async submitReputationProof(params: {\n proofType: 'github' | 'twitter' | 'on-chain-activity';\n proofData: string;\n signature: Hash;\n }): Promise<Hash> {\n if (!this.walletClient || !this.walletClient.account) {\n throw new Error(\"Wallet client required to submit proofs\");\n }\n\n // Using a generic 'submitProof' signature for now\n // In reality this would target the ReputationOracle or similar\n return this.walletClient.writeContract({\n address: this.reputationAddress,\n abi: parseAbi(['function submitProof(string,bytes32)']),\n functionName: 'submitProof',\n args: [params.proofData, params.signature],\n chain: this.walletClient.chain,\n account: this.walletClient.account\n });\n }\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var chunkTS5CXRNI_cjs = require('./chunk-TS5CXRNI.cjs');
3
+ var chunkMOJJ7QF6_cjs = require('./chunk-MOJJ7QF6.cjs');
4
4
  var viem = require('viem');
5
5
 
6
- var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
6
+ var PaymasterOperatorClient = class extends chunkMOJJ7QF6_cjs.BaseClient {
7
7
  superPaymasterAddress;
8
8
  tokenAddress;
9
9
  ethUsdPriceFeed;
@@ -35,8 +35,8 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
35
35
  const registryAddr = this.requireRegistry();
36
36
  const gTokenAddr = this.requireGToken();
37
37
  const gTokenStakingAddr = this.requireGTokenStaking();
38
- const registry = chunkTS5CXRNI_cjs.registryActions(registryAddr);
39
- const gToken = chunkTS5CXRNI_cjs.tokenActions();
38
+ const registry = chunkMOJJ7QF6_cjs.registryActions(registryAddr);
39
+ const gToken = chunkMOJJ7QF6_cjs.tokenActions();
40
40
  const publicClient = this.getStartPublicClient();
41
41
  const ROLE_COMMUNITY = await registry(publicClient).ROLE_COMMUNITY();
42
42
  const hasCommunity = await registry(publicClient).hasRole({
@@ -106,9 +106,9 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
106
106
  const gTokenAddr = this.requireGToken();
107
107
  const gTokenStakingAddr = this.requireGTokenStaking();
108
108
  const factoryAddr = this.requirePaymasterFactory();
109
- const registry = chunkTS5CXRNI_cjs.registryActions(registryAddr);
110
- const gToken = chunkTS5CXRNI_cjs.tokenActions();
111
- const factory = chunkTS5CXRNI_cjs.paymasterFactoryActions(factoryAddr);
109
+ const registry = chunkMOJJ7QF6_cjs.registryActions(registryAddr);
110
+ const gToken = chunkMOJJ7QF6_cjs.tokenActions();
111
+ const factory = chunkMOJJ7QF6_cjs.paymasterFactoryActions(factoryAddr);
112
112
  const publicClient = this.getStartPublicClient();
113
113
  const account = options?.account || this.client.account || this.getAddress();
114
114
  const accountAddr = typeof account === "string" ? account : account.address;
@@ -135,7 +135,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
135
135
  });
136
136
  const { encodeFunctionData } = await import('viem');
137
137
  const initData = encodeFunctionData({
138
- abi: chunkTS5CXRNI_cjs.PaymasterABI,
138
+ abi: chunkMOJJ7QF6_cjs.PaymasterABI,
139
139
  functionName: "initialize",
140
140
  args: [
141
141
  this.requireEntryPoint(),
@@ -215,10 +215,10 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
215
215
  */
216
216
  async depositCollateral(amount, options) {
217
217
  try {
218
- const pm = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
218
+ const pm = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
219
219
  const publicClient = this.getStartPublicClient();
220
220
  const depositToken = await pm(publicClient).APNTS_TOKEN();
221
- const token = chunkTS5CXRNI_cjs.tokenActions();
221
+ const token = chunkMOJJ7QF6_cjs.tokenActions();
222
222
  const allowance = await token(publicClient).allowance({
223
223
  token: depositToken,
224
224
  owner: this.getAddress(),
@@ -248,7 +248,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
248
248
  */
249
249
  async configureOperator(xPNTsToken, treasury, options) {
250
250
  try {
251
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
251
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
252
252
  const publicClient = this.getStartPublicClient();
253
253
  const currentConfig = await sp(publicClient).operators({ operator: this.getAddress() });
254
254
  const currentToken = currentConfig.xPNTsToken;
@@ -264,7 +264,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
264
264
  }
265
265
  async withdrawCollateral(to, amount, options) {
266
266
  try {
267
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
267
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
268
268
  return await sp(this.client).withdrawTo({
269
269
  to,
270
270
  amount,
@@ -276,7 +276,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
276
276
  }
277
277
  async isOperator(operator) {
278
278
  try {
279
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
279
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
280
280
  const config = await sp(this.getStartPublicClient()).operators({ operator });
281
281
  return config.isConfigured;
282
282
  } catch (error) {
@@ -286,7 +286,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
286
286
  async getOperatorDetails(operator) {
287
287
  try {
288
288
  const target = operator || this.getAddress();
289
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
289
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
290
290
  return await sp(this.getStartPublicClient()).operators({ operator: target });
291
291
  } catch (error) {
292
292
  throw error;
@@ -294,7 +294,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
294
294
  }
295
295
  async initiateExit(options) {
296
296
  try {
297
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
297
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
298
298
  return await sp(this.client).unlockStake({
299
299
  account: options?.account
300
300
  });
@@ -304,7 +304,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
304
304
  }
305
305
  async withdrawStake(to, options) {
306
306
  try {
307
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
307
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
308
308
  return await sp(this.client).withdrawStake({
309
309
  to,
310
310
  account: options?.account
@@ -318,7 +318,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
318
318
  // ========================================
319
319
  async addGasToken(token, price, options) {
320
320
  try {
321
- const pm = chunkTS5CXRNI_cjs.paymasterActions(this.superPaymasterAddress);
321
+ const pm = chunkMOJJ7QF6_cjs.paymasterActions(this.superPaymasterAddress);
322
322
  return await pm(this.client).setTokenPrice({
323
323
  token,
324
324
  price,
@@ -330,7 +330,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
330
330
  }
331
331
  async getTokenPrice(token) {
332
332
  try {
333
- const pm = chunkTS5CXRNI_cjs.paymasterActions(this.superPaymasterAddress);
333
+ const pm = chunkMOJJ7QF6_cjs.paymasterActions(this.superPaymasterAddress);
334
334
  return await pm(this.getStartPublicClient()).tokenPrices({ token });
335
335
  } catch (error) {
336
336
  throw error;
@@ -338,7 +338,7 @@ var PaymasterOperatorClient = class extends chunkTS5CXRNI_cjs.BaseClient {
338
338
  }
339
339
  async setupPaymasterDeposit(params, options) {
340
340
  try {
341
- const pm = chunkTS5CXRNI_cjs.paymasterActions(params.paymaster);
341
+ const pm = chunkMOJJ7QF6_cjs.paymasterActions(params.paymaster);
342
342
  return await pm(this.client).depositFor({
343
343
  user: params.user,
344
344
  token: params.token,
@@ -363,7 +363,7 @@ var ProposalState = /* @__PURE__ */ ((ProposalState2) => {
363
363
  ProposalState2[ProposalState2["Executed"] = 7] = "Executed";
364
364
  return ProposalState2;
365
365
  })(ProposalState || {});
366
- var ProtocolClient = class extends chunkTS5CXRNI_cjs.BaseClient {
366
+ var ProtocolClient = class extends chunkMOJJ7QF6_cjs.BaseClient {
367
367
  dvtValidatorAddress;
368
368
  blsAggregatorAddress;
369
369
  superPaymasterAddress;
@@ -381,7 +381,7 @@ var ProtocolClient = class extends chunkTS5CXRNI_cjs.BaseClient {
381
381
  */
382
382
  async createProposal(target, calldata, description, options) {
383
383
  try {
384
- const dvt = chunkTS5CXRNI_cjs.dvtActions(this.dvtValidatorAddress)(this.client);
384
+ const dvt = chunkMOJJ7QF6_cjs.dvtActions(this.dvtValidatorAddress)(this.client);
385
385
  return await dvt.createSlashProposal({
386
386
  operator: target,
387
387
  level: 1,
@@ -395,7 +395,7 @@ var ProtocolClient = class extends chunkTS5CXRNI_cjs.BaseClient {
395
395
  }
396
396
  async signProposal(proposalId, signature = "0x", options) {
397
397
  try {
398
- const dvt = chunkTS5CXRNI_cjs.dvtActions(this.dvtValidatorAddress)(this.client);
398
+ const dvt = chunkMOJJ7QF6_cjs.dvtActions(this.dvtValidatorAddress)(this.client);
399
399
  return await dvt.signSlashProposal({
400
400
  proposalId,
401
401
  signature,
@@ -411,7 +411,7 @@ var ProtocolClient = class extends chunkTS5CXRNI_cjs.BaseClient {
411
411
  async executeWithProof(proposalId, signatures, options) {
412
412
  try {
413
413
  const proof = "0x";
414
- const dvt = chunkTS5CXRNI_cjs.dvtActions(this.dvtValidatorAddress)(this.client);
414
+ const dvt = chunkMOJJ7QF6_cjs.dvtActions(this.dvtValidatorAddress)(this.client);
415
415
  return await dvt.executeSlashWithProof({
416
416
  proposalId,
417
417
  repUsers: [],
@@ -433,7 +433,7 @@ var ProtocolClient = class extends chunkTS5CXRNI_cjs.BaseClient {
433
433
  if (!this.blsAggregatorAddress) {
434
434
  throw new Error("BLS Aggregator address required for this client");
435
435
  }
436
- const agg = chunkTS5CXRNI_cjs.aggregatorActions(this.blsAggregatorAddress)(this.client);
436
+ const agg = chunkMOJJ7QF6_cjs.aggregatorActions(this.blsAggregatorAddress)(this.client);
437
437
  return await agg.registerBLSPublicKey({
438
438
  validator: this.getAddress(),
439
439
  publicKey,
@@ -451,7 +451,7 @@ var ProtocolClient = class extends chunkTS5CXRNI_cjs.BaseClient {
451
451
  if (!this.superPaymasterAddress) {
452
452
  throw new Error("SuperPaymaster address required for this client");
453
453
  }
454
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
454
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
455
455
  return await sp(this.client).setProtocolFee({
456
456
  newFeeBPS: bps,
457
457
  account: options?.account
@@ -465,7 +465,7 @@ var ProtocolClient = class extends chunkTS5CXRNI_cjs.BaseClient {
465
465
  if (!this.superPaymasterAddress) {
466
466
  throw new Error("SuperPaymaster address required for this client");
467
467
  }
468
- const sp = chunkTS5CXRNI_cjs.superPaymasterActions(this.superPaymasterAddress);
468
+ const sp = chunkMOJJ7QF6_cjs.superPaymasterActions(this.superPaymasterAddress);
469
469
  return await sp(this.client).setTreasury({
470
470
  treasury,
471
471
  account: options?.account
@@ -511,7 +511,7 @@ var OperatorLifecycle = class extends PaymasterOperatorClient {
511
511
  depositAmount: params.depositAmount
512
512
  }, options);
513
513
  hashes.push(h);
514
- const factory = await import('./src-UQ4RDCJG.cjs').then((m) => m.xPNTsFactoryActions(this.xpntsFactory)(this.getStartPublicClient()));
514
+ const factory = await import('./src-N72HAQXS.cjs').then((m) => m.xPNTsFactoryActions(this.xpntsFactory)(this.getStartPublicClient()));
515
515
  const token = await factory.getTokenAddress({ community: this.getAddress() });
516
516
  if (token && token !== "0x0000000000000000000000000000000000000000") {
517
517
  const hConfig = await this.configureOperator(
@@ -559,8 +559,8 @@ var OperatorLifecycle = class extends PaymasterOperatorClient {
559
559
  hashes.push(hCol);
560
560
  }
561
561
  const client = this.getStartPublicClient();
562
- const registry = chunkTS5CXRNI_cjs.registryActions(this.registryAddress);
563
- const registryWriter = chunkTS5CXRNI_cjs.registryActions(this.registryAddress)(this.client);
562
+ const registry = chunkMOJJ7QF6_cjs.registryActions(this.registryAddress);
563
+ const registryWriter = chunkMOJJ7QF6_cjs.registryActions(this.registryAddress)(this.client);
564
564
  const ROLE_PAYMASTER_SUPER = await registry(client).ROLE_PAYMASTER_SUPER();
565
565
  const hasRole = await registry(client).hasRole({ user: this.getAddress(), roleId: ROLE_PAYMASTER_SUPER });
566
566
  if (hasRole) {
@@ -572,7 +572,7 @@ var OperatorLifecycle = class extends PaymasterOperatorClient {
572
572
  // Helper: Get GToken Balance
573
573
  async getTokenBalance() {
574
574
  if (!this.tokenAddress) return 0n;
575
- const token = chunkTS5CXRNI_cjs.tokenActions()(this.getStartPublicClient());
575
+ const token = chunkMOJJ7QF6_cjs.tokenActions()(this.getStartPublicClient());
576
576
  return await token.balanceOf({ token: this.tokenAddress, account: this.getAddress() });
577
577
  }
578
578
  };
@@ -581,5 +581,5 @@ exports.OperatorLifecycle = OperatorLifecycle;
581
581
  exports.PaymasterOperatorClient = PaymasterOperatorClient;
582
582
  exports.ProposalState = ProposalState;
583
583
  exports.ProtocolClient = ProtocolClient;
584
- //# sourceMappingURL=chunk-7HO4IUHZ.cjs.map
585
- //# sourceMappingURL=chunk-7HO4IUHZ.cjs.map
584
+ //# sourceMappingURL=chunk-VHY6R2PI.cjs.map
585
+ //# sourceMappingURL=chunk-VHY6R2PI.cjs.map