@aastar/sdk 0.20.5 → 0.20.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/BaseClient-BjbYP0cf.d.ts +88 -0
  2. package/dist/UserClient-AIIHB54I.js +6 -0
  3. package/dist/{UserClient-UYIHF6UJ.js.map → UserClient-AIIHB54I.js.map} +1 -1
  4. package/dist/account.d.ts +48 -1
  5. package/dist/account.js +3 -3
  6. package/dist/admin.d.ts +62 -1
  7. package/dist/admin.js +3 -3
  8. package/dist/airaccount.d.ts +4 -2
  9. package/dist/airaccount.js +2 -2
  10. package/dist/channel-CkRRbzT8.d.ts +77 -0
  11. package/dist/channel.d.ts +64 -1
  12. package/dist/channel.js +3 -3
  13. package/dist/{chunk-FBDMID2J.js → chunk-4EZD7LPE.js} +30 -24
  14. package/dist/chunk-4EZD7LPE.js.map +1 -0
  15. package/dist/{chunk-TIH7D4FQ.js → chunk-6QYXGMCR.js} +513 -322
  16. package/dist/chunk-6QYXGMCR.js.map +1 -0
  17. package/dist/{chunk-6UHVUGDT.js → chunk-7ARJ3OSU.js} +29 -21
  18. package/dist/chunk-7ARJ3OSU.js.map +1 -0
  19. package/dist/{chunk-VYU6P7HB.js → chunk-BN5WY5GM.js} +16 -14
  20. package/dist/chunk-BN5WY5GM.js.map +1 -0
  21. package/dist/{chunk-ZFIKBDBT.js → chunk-FJ7XECC5.js} +4 -4
  22. package/dist/chunk-FJ7XECC5.js.map +1 -0
  23. package/dist/{chunk-NRH56SAJ.js → chunk-G3UJC4EL.js} +6 -7
  24. package/dist/chunk-G3UJC4EL.js.map +1 -0
  25. package/dist/{chunk-QJT4IOIS.js → chunk-KDH3UPKD.js} +10 -13
  26. package/dist/chunk-KDH3UPKD.js.map +1 -0
  27. package/dist/{chunk-ZGOEADCO.js → chunk-LXWIPTPX.js} +5 -5
  28. package/dist/chunk-LXWIPTPX.js.map +1 -0
  29. package/dist/{chunk-I3VRFZA4.js → chunk-MVEWJIPY.js} +124 -110
  30. package/dist/chunk-MVEWJIPY.js.map +1 -0
  31. package/dist/{chunk-FIS3RUGL.js → chunk-PAABYXS6.js} +33 -40
  32. package/dist/chunk-PAABYXS6.js.map +1 -0
  33. package/dist/{chunk-HNTLDUL7.js → chunk-PKCHRXFR.js} +8 -12
  34. package/dist/chunk-PKCHRXFR.js.map +1 -0
  35. package/dist/{chunk-42KVVOOU.js → chunk-TENYCMJ3.js} +31 -31
  36. package/dist/chunk-TENYCMJ3.js.map +1 -0
  37. package/dist/{chunk-WPSWFZKF.js → chunk-UIFMIVDK.js} +1033 -937
  38. package/dist/chunk-UIFMIVDK.js.map +1 -0
  39. package/dist/{chunk-4KRQXOTI.js → chunk-X3AMH53O.js} +248 -195
  40. package/dist/chunk-X3AMH53O.js.map +1 -0
  41. package/dist/{contract-addresses-ADEWLDHE.js → contract-addresses-N3TOL2WL.js} +3 -3
  42. package/dist/{contract-addresses-ADEWLDHE.js.map → contract-addresses-N3TOL2WL.js.map} +1 -1
  43. package/dist/core.d.ts +6930 -13
  44. package/dist/core.js +2 -2
  45. package/dist/dapp.d.ts +127 -1
  46. package/dist/dapp.js +12 -13
  47. package/dist/dapp.js.map +1 -1
  48. package/dist/doc-types-471vSmPO.d.ts +16 -0
  49. package/dist/enduser.d.ts +261 -1
  50. package/dist/enduser.js +4 -4
  51. package/dist/identity.d.ts +81 -1
  52. package/dist/identity.js +3 -3
  53. package/dist/index-B6SfEQxo.d.ts +47 -0
  54. package/dist/index.d.ts +59 -15
  55. package/dist/index.js +18 -18
  56. package/dist/index.js.map +1 -1
  57. package/dist/kms.d.ts +3054 -2
  58. package/dist/kms.js +2 -2
  59. package/dist/operator.d.ts +164 -1
  60. package/dist/operator.js +3 -3
  61. package/dist/paymaster.d.ts +312 -1
  62. package/dist/paymaster.js +3 -3
  63. package/dist/{index.node-KIKM4EG6.js → src-L5SI5WNB.js} +4 -4
  64. package/dist/src-L5SI5WNB.js.map +1 -0
  65. package/dist/{dist-GVWCRI4F.js → src-X5MIV3EB.js} +5 -5
  66. package/dist/src-X5MIV3EB.js.map +1 -0
  67. package/dist/tier-router-DeeVg69O.d.ts +370 -0
  68. package/dist/tokens.d.ts +64 -1
  69. package/dist/tokens.js +3 -3
  70. package/dist/x402.d.ts +373 -1
  71. package/dist/x402.js +3 -3
  72. package/package.json +1 -2
  73. package/dist/UserClient-UYIHF6UJ.js +0 -6
  74. package/dist/chunk-42KVVOOU.js.map +0 -1
  75. package/dist/chunk-4KRQXOTI.js.map +0 -1
  76. package/dist/chunk-6UHVUGDT.js.map +0 -1
  77. package/dist/chunk-FBDMID2J.js.map +0 -1
  78. package/dist/chunk-FIS3RUGL.js.map +0 -1
  79. package/dist/chunk-HNTLDUL7.js.map +0 -1
  80. package/dist/chunk-I3VRFZA4.js.map +0 -1
  81. package/dist/chunk-NRH56SAJ.js.map +0 -1
  82. package/dist/chunk-QJT4IOIS.js.map +0 -1
  83. package/dist/chunk-TIH7D4FQ.js.map +0 -1
  84. package/dist/chunk-VYU6P7HB.js.map +0 -1
  85. package/dist/chunk-WPSWFZKF.js.map +0 -1
  86. package/dist/chunk-ZFIKBDBT.js.map +0 -1
  87. package/dist/chunk-ZGOEADCO.js.map +0 -1
  88. package/dist/dist-GVWCRI4F.js.map +0 -1
  89. package/dist/index.node-KIKM4EG6.js.map +0 -1
@@ -0,0 +1,88 @@
1
+ import { Address, Account } from 'viem';
2
+ import { W as WalletClient, P as PublicClient } from './doc-types-471vSmPO.js';
3
+
4
+ /**
5
+ * Base configuration for all L2 Business Clients
6
+ */
7
+ interface ClientConfig {
8
+ /**
9
+ * Viem WalletClient for write operations.
10
+ * Must have an account attached.
11
+ */
12
+ client: WalletClient;
13
+ /**
14
+ * Optional PublicClient for read operations.
15
+ * If not provided, one will be derived from the WalletClient or created internally if possible (but usually explicit is better).
16
+ * Currently L1 actions use PublicClient | WalletClient, so WalletClient is enough for both if it has a provider.
17
+ * However, explicitly accepting PublicClient encourages separation.
18
+ */
19
+ publicClient?: PublicClient;
20
+ /**
21
+ * Registry contract address.
22
+ * Essential for looking up other contracts if not provided explicitly.
23
+ */
24
+ registryAddress?: Address;
25
+ /**
26
+ * GToken contract address.
27
+ * Required for operations involving token approvals and transfers.
28
+ */
29
+ gTokenAddress?: Address;
30
+ /**
31
+ * GTokenStaking contract address.
32
+ * Required for role registration that involves staking.
33
+ */
34
+ gTokenStakingAddress?: Address;
35
+ /**
36
+ * PaymasterFactory contract address.
37
+ * Required for deploying new PaymasterV4 instances.
38
+ */
39
+ paymasterFactoryAddress?: Address;
40
+ xpntsFactoryAddress?: Address;
41
+ ethUsdPriceFeedAddress?: Address;
42
+ entryPointAddress?: Address;
43
+ }
44
+ /**
45
+ * Common options for transaction methods
46
+ */
47
+ interface TransactionOptions {
48
+ /**
49
+ * Override the account to use for the transaction.
50
+ * If not provided, uses the account from the WalletClient.
51
+ */
52
+ account?: Account | Address;
53
+ /**
54
+ * Optional value to send with the transaction (in wei)
55
+ */
56
+ value?: bigint;
57
+ }
58
+ /**
59
+ * Generic result wrapper for business operations
60
+ * Currently just returns the type directly, but can be expanded for metadata.
61
+ */
62
+ type BusinessResult<T> = Promise<T>;
63
+
64
+ declare abstract class BaseClient {
65
+ client: WalletClient;
66
+ publicClient?: PublicClient;
67
+ protected registryAddress?: Address;
68
+ protected gTokenAddress?: Address;
69
+ protected gTokenStakingAddress?: Address;
70
+ protected paymasterFactoryAddress?: Address;
71
+ protected entryPointAddress?: Address;
72
+ constructor(config: ClientConfig);
73
+ /**
74
+ * Get the account address of the connected wallet
75
+ */
76
+ getAddress(): Address;
77
+ /**
78
+ * Helper to ensure public client exists or fallback to wallet client (if it supports read)
79
+ */
80
+ getStartPublicClient(): PublicClient | WalletClient;
81
+ protected requireRegistry(): Address;
82
+ protected requireGToken(): Address;
83
+ protected requireGTokenStaking(): Address;
84
+ protected requirePaymasterFactory(): Address;
85
+ protected requireEntryPoint(): Address;
86
+ }
87
+
88
+ export { type BusinessResult as B, type ClientConfig as C, type TransactionOptions as T, BaseClient as a };
@@ -0,0 +1,6 @@
1
+ export { UserClient } from './chunk-PAABYXS6.js';
2
+ import './chunk-6QYXGMCR.js';
3
+ import './chunk-G3UJC4EL.js';
4
+ import './chunk-PZ5AY32C.js';
5
+ //# sourceMappingURL=UserClient-AIIHB54I.js.map
6
+ //# sourceMappingURL=UserClient-AIIHB54I.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"UserClient-UYIHF6UJ.js"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"UserClient-AIIHB54I.js"}
package/dist/account.d.ts CHANGED
@@ -1 +1,48 @@
1
- export * from '@aastar/account';
1
+ import { WalletClient, Address, Hex, Hash, Chain, Transport, LocalAccount } from 'viem';
2
+
3
+ type EOAWalletClient = WalletClient & {
4
+ sendTransaction: (args: {
5
+ to: Address;
6
+ value?: bigint;
7
+ data?: Hex;
8
+ }) => Promise<Hash>;
9
+ getAddress: () => Address;
10
+ };
11
+ declare const createEOAWalletClient: (privateKey: Hex, chain: Chain, transport?: Transport) => EOAWalletClient;
12
+
13
+ type SimpleSmartAccount = LocalAccount & {
14
+ signUserOperation: (userOp: any) => Promise<Hex>;
15
+ getInitCode: () => Promise<Hex>;
16
+ getDummySignature: () => Promise<Hex>;
17
+ entryPoint: Address;
18
+ };
19
+ declare function toSimpleSmartAccount(parameters: {
20
+ client: any;
21
+ owner: LocalAccount;
22
+ factoryAddress: Address;
23
+ entryPoint: {
24
+ address: Address;
25
+ version: '0.6' | '0.7';
26
+ };
27
+ salt?: bigint;
28
+ index?: bigint;
29
+ }): Promise<SimpleSmartAccount>;
30
+
31
+ /**
32
+ * Common Pack Logic for v0.7 UserOperations
33
+ */
34
+ declare function packUserOpLimits(high: bigint, low: bigint): Hex;
35
+ /**
36
+ * Local implementation of EntryPoint v0.7 getUserOpHash
37
+ */
38
+ declare function getUserOpHash(op: any, ep: Address, chainId: number): Hex;
39
+ /**
40
+ * UserOperation Client for handling high-level flows
41
+ */
42
+ declare class UserOpClient {
43
+ static estimateGas(bundler: any, op: any, entryPoint: Address): Promise<any>;
44
+ static sendUserOp(bundler: any, op: any, entryPoint: Address): Promise<any>;
45
+ static getReceipt(bundler: any, hash: Hex): Promise<any>;
46
+ }
47
+
48
+ export { type EOAWalletClient, type SimpleSmartAccount, UserOpClient, createEOAWalletClient, getUserOpHash, packUserOpLimits, toSimpleSmartAccount };
package/dist/account.js CHANGED
@@ -1,6 +1,6 @@
1
- export { UserOpClient, createEOAWalletClient, getUserOpHash, packUserOpLimits, toSimpleSmartAccount } from './chunk-FBDMID2J.js';
2
- import './chunk-TIH7D4FQ.js';
3
- import './chunk-NRH56SAJ.js';
1
+ export { UserOpClient, createEOAWalletClient, getUserOpHash, packUserOpLimits, toSimpleSmartAccount } from './chunk-4EZD7LPE.js';
2
+ import './chunk-6QYXGMCR.js';
3
+ import './chunk-G3UJC4EL.js';
4
4
  import './chunk-PZ5AY32C.js';
5
5
  //# sourceMappingURL=account.js.map
6
6
  //# sourceMappingURL=account.js.map
package/dist/admin.d.ts CHANGED
@@ -1 +1,62 @@
1
- export * from '@aastar/admin';
1
+ import { Address, Hash, Hex } from 'viem';
2
+ import { a as BaseClient, C as ClientConfig, T as TransactionOptions } from './BaseClient-BjbYP0cf.js';
3
+ import './doc-types-471vSmPO.js';
4
+
5
+ interface ProtocolParams {
6
+ minStake: bigint;
7
+ treasury: Address;
8
+ entryPoint: Address;
9
+ superPaymaster: Address;
10
+ }
11
+ /**
12
+ * ProtocolGovernance - L3 Pattern
13
+ *
14
+ * Responsibilities:
15
+ * 1. Global Protocol Parameter Management (Registry, EntryPoint)
16
+ * 2. High-level Governance Operations (DAO Transfer, Upgrades)
17
+ * 3. SuperPaymaster & Module Approval
18
+ */
19
+ declare class ProtocolGovernance extends BaseClient {
20
+ registryAddress: Address;
21
+ entryPointAddress: Address;
22
+ constructor(config: ClientConfig & {
23
+ registryAddress: Address;
24
+ entryPointAddress: Address;
25
+ });
26
+ /**
27
+ * Update the Global Treasury Address where protocol fees are collected
28
+ */
29
+ setTreasury(treasury: Address, options?: TransactionOptions): Promise<Hash>;
30
+ /**
31
+ * Update the supported EntryPoint address
32
+ */
33
+ updateEntryPoint(entryPoint: Address, options?: TransactionOptions): Promise<Hash>;
34
+ /**
35
+ * Approve a new SuperPaymaster contract address
36
+ */
37
+ setSuperPaymaster(paymaster: Address, options?: TransactionOptions): Promise<Hash>;
38
+ /**
39
+ * Set the Staking contract address
40
+ */
41
+ setStaking(staking: Address, options?: TransactionOptions): Promise<Hash>;
42
+ /**
43
+ * Configure a Role's parameters (Admin only).
44
+ * Reads the current on-chain config first, then merges the provided overrides
45
+ * and writes back the full struct via configureRole.
46
+ */
47
+ configureRole(params: {
48
+ roleId: Hex;
49
+ minStake?: bigint;
50
+ ticketPrice?: bigint;
51
+ exitFeePercent?: bigint;
52
+ minExitFee?: bigint;
53
+ }, options?: TransactionOptions): Promise<Hash>;
54
+ /**
55
+ * Transfer Protocol Ownership to a DAO (Multisig/Timelock)
56
+ * This is the final step of "Protocol Admin" lifecycle.
57
+ */
58
+ transferToDAO(daoAddress: Address, options?: TransactionOptions): Promise<Hash>;
59
+ getProtocolParams(): Promise<ProtocolParams>;
60
+ }
61
+
62
+ export { ProtocolGovernance, type ProtocolParams };
package/dist/admin.js CHANGED
@@ -1,6 +1,6 @@
1
- export { ProtocolGovernance } from './chunk-ZFIKBDBT.js';
2
- import './chunk-TIH7D4FQ.js';
3
- import './chunk-NRH56SAJ.js';
1
+ export { ProtocolGovernance } from './chunk-FJ7XECC5.js';
2
+ import './chunk-6QYXGMCR.js';
3
+ import './chunk-G3UJC4EL.js';
4
4
  import './chunk-PZ5AY32C.js';
5
5
  //# sourceMappingURL=admin.js.map
6
6
  //# sourceMappingURL=admin.js.map
@@ -1,2 +1,4 @@
1
- export * from '@aastar/airaccount/server';
2
- export * from '@aastar/airaccount';
1
+ export { ACCOUNT_ABI, AGENT_SESSION_KEY_VALIDATOR_ABI, AIRACCOUNT_ABI, AIRACCOUNT_ADDRESSES, AIRACCOUNT_FACTORY_ABI, AIR_ACCOUNT_COMPOSITE_VALIDATOR_ABI, AIR_ACCOUNT_DELEGATE_ABI, AIR_ACCOUNT_DELEGATE_ADDRESS, ALG_ID, AccountManager, AccountRecord, ActiveRecovery, AgentRegistryService, AgentReputationSummary, AgentSessionConfig, AgentSessionInfo, AirAccountServerClient, AirAccountVersion, BLSSignatureService, BeginCeremonyResponse, BindERC8004AgentWalletParams, BlsConfigRecord, BuildCredentialOptions, CALLDATA_PARSER_REGISTRY_ABI, ConsoleLogger, CreateAgentAccountParams, CreateP256SessionKeyRequest, CreateP256SessionKeyResponse, DEFAULT_CREDENTIAL_ID, DEFAULT_KMS_ENDPOINT, DEFAULT_ORIGIN, DEFAULT_RP_ID, DelegateInitParams, DvtPendingConfirmationError, EIP7702Authorization, EIP7702DelegateService, ENTRYPOINT_ABI_V6, ENTRYPOINT_ABI_V7_V8, ENTRYPOINT_ADDRESSES, ERC20_ABI, ERC8004Service, ERC8004_ADDRESSES, EXECUTE_BATCH_SELECTOR, EXECUTE_SELECTOR, EXECUTE_USER_OP_SELECTOR, EntryPointConfig, EntryPointVersion, EntryPointVersionConfig, EstimateGasParams, EthereumProvider, ExecuteTransferParams, FACTORY_ABI_V6, FACTORY_ABI_V7_V8, FORCE_EXIT_MODULE_ABI, ForceExitService, GLOBAL_GUARD_ABI, GrantP256SessionParams, GrantSessionParams, GuardChecker, GuardState, GuardStateReader, ILogger, ISignerAdapter, IStorageAdapter, InstallModuleParams, KmsAgentService, KmsAttestationManifestResponse, KmsAttestationProofResponse, KmsAttestationResponse, KmsBeginAuthenticationRequest, KmsBeginAuthenticationResponse, KmsBeginGrantSessionAuthRequest, KmsBeginGrantSessionAuthResponse, KmsBeginRegistrationRequest, KmsBeginRegistrationResponse, KmsChangePasskeyResponse, KmsCompleteRegistrationRequest, KmsCompleteRegistrationResponse, KmsCreateAgentKeyRequest, KmsCreateAgentKeyResponse, KmsCreateKeyRequest, KmsCreateKeyResponse, KmsDeleteKeyResponse, KmsDeriveAddressResponse, KmsDescribeKeyResponse, KmsEip712Domain, KmsEip712FieldValue, KmsEip712TypeDef, KmsEthereumTransaction, KmsGetPublicKeyResponse, KmsHealthResponse, KmsHttpClient, KmsHttpClientOptions, KmsKeyStatusResponse, KmsListKeysResponse, KmsManager, KmsMonitorService, KmsPaymentAuth, KmsPaymentSignatureResponse, KmsPaymentSigner, KmsPurgeKeyResponse, KmsQueueStatusResponse, KmsRefreshAgentCredentialRequest, KmsRefreshAgentCredentialResponse, KmsRevokeAgentCredentialRequest, KmsRevokeAgentCredentialResponse, KmsRollbackCounterResponse, KmsSessionService, KmsSignAgentRequest, KmsSignAgentResponse, KmsSignGTokenAuthorizationRequest, KmsSignGrantSessionRequest, KmsSignGrantSessionResponse, KmsSignHashResponse, KmsSignMicropaymentVoucherRequest, KmsSignP256GrantSessionRequest, KmsSignRequest, KmsSignResponse, KmsSignTypedDataRequest, KmsSignTypedDataResponse, KmsSignX402PaymentRequest, KmsSigner, KmsStatsResponse, KmsVersionResponse, L2Type, L2_TYPE, LegacyPasskeyAssertion, LocalWalletSigner, MAX_GUARDIANS, MODULE_TYPE, MemoryStorage, MintAgentIdentityParams, ModuleManager, ModuleTypeId, OapdConfig, P256PasskeySigner, PasskeyAssertionContext, PasskeyCeremonySigner, PaymasterManager, PaymasterPriceStalenessError, PaymasterRecord, PendingExit, PendingWeightChange, QueryAgentReputationParams, RECOVERY_THRESHOLD, RECOVERY_TIMELOCK_SECONDS, RecoveryService, RevokeP256SessionKeyRequest, RevokeP256SessionKeyResponse, RunCeremonyOptions, SESSION_KEY_VALIDATOR_ABI, ServerConfig, SessionInfo, SessionKeyService, SetAgentWalletParams, SignP256UserOpRequest, SignP256UserOpResponse, SilentLogger, SubmitAgentReputationParams, TIER_GUARD_HOOK_ABI, TokenBalance, TokenGuardState, TokenInfo, TokenService, TransferManager, TransferRecord, TransferResult, UninstallModuleParams, VALIDATOR_ABI, WEIGHT_CHANGE_EXPIRY_SECONDS, WEIGHT_CHANGE_THRESHOLD, WEIGHT_CHANGE_TIMELOCK_SECONDS, WalletManager, WebAuthnAssertion, WebAuthnAuthenticationCredential, WeightConfig, WeightedSignatureService, YAAAServerClient, base64UrlDecode, base64UrlEncode, beginAuthenticationChallenge, beginGrantSessionChallenge, buildAuthenticationCredential, buildAuthenticatorData, buildClientDataJSON, buildInstallModuleHash, buildUninstallModuleHash, computeOapdSalt, erc8004AddressesForChain, getOapdAddress, getOapdAddressWithChainId, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, validateConfig, wrapExecuteUserOp } from './kms.js';
2
+ export { A as ALG_BLS, a as ALG_CUMULATIVE_T2, b as ALG_CUMULATIVE_T3, c as ALG_ECDSA, d as ALG_P256, e as AirAccountClient, f as AirAccountConfig, g as AlgId, B as BLSConfig, h as BLSManager, i as BLSNode, j as BLSSignatureData, k as BeginAuthenticationResponse, l as BeginRegistrationResponse, m as BeginTransactionVerificationResponse, C as CryptoUtil, n as CumulativeT2SignatureData, o as CumulativeT3SignatureData, D as DEFAULT_PASSKEY_ROUTES, E as ERC4337Utils, G as GasEstimate, p as GuardStatus, P as PackedUserOperation, q as PasskeyAuthenticationParams, r as PasskeyInfo, s as PasskeyManager, t as PasskeyRegistrationParams, u as PasskeyRoutes, v as PreCheckResult, T as TierConfig, w as TierLevel, x as TransactionVerificationParams, U as UserOpBuilder, y as UserOperation, Y as YAAAClient, z as YAAAConfig, F as algIdForTier, H as resolveTier } from './tier-router-DeeVg69O.js';
3
+ import 'axios';
4
+ import 'viem';
@@ -1,5 +1,5 @@
1
- export { ACCOUNT_ABI, AGENT_SESSION_KEY_VALIDATOR_ABI, AIRACCOUNT_ABI, AIRACCOUNT_ADDRESSES, AIRACCOUNT_FACTORY_ABI, AIR_ACCOUNT_COMPOSITE_VALIDATOR_ABI, AIR_ACCOUNT_DELEGATE_ABI, AIR_ACCOUNT_DELEGATE_ADDRESS, ALG_ID, AccountManager, AgentRegistryService, BLSSignatureService, CALLDATA_PARSER_REGISTRY_ABI, ConsoleLogger, DEFAULT_CREDENTIAL_ID, DEFAULT_KMS_ENDPOINT, DEFAULT_ORIGIN, DEFAULT_RP_ID, DvtPendingConfirmationError, EIP7702DelegateService, ENTRYPOINT_ABI_V6, ENTRYPOINT_ABI_V7_V8, ENTRYPOINT_ADDRESSES, ERC20_ABI, ERC8004Service, ERC8004_ADDRESSES, EXECUTE_BATCH_SELECTOR, EXECUTE_SELECTOR, EXECUTE_USER_OP_SELECTOR, EntryPointVersion, EthereumProvider, FACTORY_ABI_V6, FACTORY_ABI_V7_V8, FORCE_EXIT_MODULE_ABI, ForceExitService, GLOBAL_GUARD_ABI, GuardChecker, GuardStateReader, KmsAgentService, KmsHttpClient, KmsManager, KmsMonitorService, KmsPaymentSigner, KmsSessionService, KmsSigner, L2_TYPE, LocalWalletSigner, MAX_GUARDIANS, MODULE_TYPE, MemoryStorage, ModuleManager, P256PasskeySigner, PaymasterManager, PaymasterPriceStalenessError, RECOVERY_THRESHOLD, RECOVERY_TIMELOCK_SECONDS, RecoveryService, SESSION_KEY_VALIDATOR_ABI, SessionKeyService, SilentLogger, TIER_GUARD_HOOK_ABI, TokenService, TransferManager, VALIDATOR_ABI, WEIGHT_CHANGE_EXPIRY_SECONDS, WEIGHT_CHANGE_THRESHOLD, WEIGHT_CHANGE_TIMELOCK_SECONDS, WalletManager, WeightedSignatureService, YAAAServerClient, base64UrlDecode, base64UrlEncode, beginAuthenticationChallenge, beginGrantSessionChallenge, buildAuthenticationCredential, buildAuthenticatorData, buildClientDataJSON, buildInstallModuleHash, buildUninstallModuleHash, computeOapdSalt, erc8004AddressesForChain, getOapdAddress, getOapdAddressWithChainId, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, validateConfig, wrapExecuteUserOp } from './chunk-WPSWFZKF.js';
2
- export { BLSManager, CryptoUtil, ERC4337Utils, PasskeyManager, UserOpBuilder, YAAAClient } from './chunk-4KRQXOTI.js';
1
+ export { ACCOUNT_ABI, AGENT_SESSION_KEY_VALIDATOR_ABI, AIRACCOUNT_ABI, AIRACCOUNT_ADDRESSES, AIRACCOUNT_FACTORY_ABI, AIR_ACCOUNT_COMPOSITE_VALIDATOR_ABI, AIR_ACCOUNT_DELEGATE_ABI, AIR_ACCOUNT_DELEGATE_ADDRESS, ALG_ID, AccountManager, AgentRegistryService, AirAccountServerClient, BLSSignatureService, CALLDATA_PARSER_REGISTRY_ABI, ConsoleLogger, DEFAULT_CREDENTIAL_ID, DEFAULT_KMS_ENDPOINT, DEFAULT_ORIGIN, DEFAULT_RP_ID, DvtPendingConfirmationError, EIP7702DelegateService, ENTRYPOINT_ABI_V6, ENTRYPOINT_ABI_V7_V8, ENTRYPOINT_ADDRESSES, ERC20_ABI, ERC8004Service, ERC8004_ADDRESSES, EXECUTE_BATCH_SELECTOR, EXECUTE_SELECTOR, EXECUTE_USER_OP_SELECTOR, EntryPointVersion, EthereumProvider, FACTORY_ABI_V6, FACTORY_ABI_V7_V8, FORCE_EXIT_MODULE_ABI, ForceExitService, GLOBAL_GUARD_ABI, GuardChecker, GuardStateReader, KmsAgentService, KmsHttpClient, KmsManager, KmsMonitorService, KmsPaymentSigner, KmsSessionService, KmsSigner, L2_TYPE, LocalWalletSigner, MAX_GUARDIANS, MODULE_TYPE, MemoryStorage, ModuleManager, P256PasskeySigner, PaymasterManager, PaymasterPriceStalenessError, RECOVERY_THRESHOLD, RECOVERY_TIMELOCK_SECONDS, RecoveryService, SESSION_KEY_VALIDATOR_ABI, SessionKeyService, SilentLogger, TIER_GUARD_HOOK_ABI, TokenService, TransferManager, VALIDATOR_ABI, WEIGHT_CHANGE_EXPIRY_SECONDS, WEIGHT_CHANGE_THRESHOLD, WEIGHT_CHANGE_TIMELOCK_SECONDS, WalletManager, WeightedSignatureService, YAAAServerClient, base64UrlDecode, base64UrlEncode, beginAuthenticationChallenge, beginGrantSessionChallenge, buildAuthenticationCredential, buildAuthenticatorData, buildClientDataJSON, buildInstallModuleHash, buildUninstallModuleHash, computeOapdSalt, erc8004AddressesForChain, getOapdAddress, getOapdAddressWithChainId, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, validateConfig, wrapExecuteUserOp } from './chunk-UIFMIVDK.js';
2
+ export { ALG_BLS, ALG_CUMULATIVE_T2, ALG_CUMULATIVE_T3, ALG_ECDSA, ALG_P256, AirAccountClient, BLSManager, CryptoUtil, DEFAULT_PASSKEY_ROUTES, ERC4337Utils, PasskeyManager, UserOpBuilder, YAAAClient, algIdForTier, resolveTier } from './chunk-X3AMH53O.js';
3
3
  import './chunk-PZ5AY32C.js';
4
4
  //# sourceMappingURL=airaccount.js.map
5
5
  //# sourceMappingURL=airaccount.js.map
@@ -0,0 +1,77 @@
1
+ import { Address, Hex, Account, Hash, PublicClient, WalletClient } from 'viem';
2
+
3
+ type ChannelState = {
4
+ payer: Address;
5
+ payee: Address;
6
+ token: Address;
7
+ authorizedSigner: Address;
8
+ deposit: bigint;
9
+ settled: bigint;
10
+ closeRequestedAt: bigint;
11
+ finalized: boolean;
12
+ };
13
+ type ChannelActions = {
14
+ openChannel: (args: {
15
+ payee: Address;
16
+ token: Address;
17
+ deposit: bigint;
18
+ salt: Hex;
19
+ authorizedSigner: Address;
20
+ account?: Account | Address;
21
+ }) => Promise<Hash>;
22
+ settleChannel: (args: {
23
+ channelId: Hex;
24
+ cumulativeAmount: bigint;
25
+ signature: Hex;
26
+ account?: Account | Address;
27
+ }) => Promise<Hash>;
28
+ closeChannel: (args: {
29
+ channelId: Hex;
30
+ cumulativeAmount: bigint;
31
+ signature: Hex;
32
+ account?: Account | Address;
33
+ }) => Promise<Hash>;
34
+ topUpChannel: (args: {
35
+ channelId: Hex;
36
+ amount: bigint;
37
+ account?: Account | Address;
38
+ }) => Promise<Hash>;
39
+ requestCloseChannel: (args: {
40
+ channelId: Hex;
41
+ account?: Account | Address;
42
+ }) => Promise<Hash>;
43
+ withdrawChannel: (args: {
44
+ channelId: Hex;
45
+ account?: Account | Address;
46
+ }) => Promise<Hash>;
47
+ getChannel: (args: {
48
+ channelId: Hex;
49
+ }) => Promise<ChannelState>;
50
+ /**
51
+ * @deprecated The deployed MicroPaymentChannel ABI no longer exposes a `CLOSE_TIMEOUT`
52
+ * constant — it was replaced by the configurable {@link closeTimeout} getter plus the
53
+ * {@link MIN_CLOSE_TIMEOUT}/{@link MAX_CLOSE_TIMEOUT} bounds. This wrapper now delegates
54
+ * to the on-chain `closeTimeout()` getter so it no longer reverts; use {@link closeTimeout}.
55
+ */
56
+ CLOSE_TIMEOUT: () => Promise<bigint>;
57
+ /** Current configurable close-timeout (seconds, view). ABI: closeTimeout() -> uint64. */
58
+ closeTimeout: () => Promise<bigint>;
59
+ /** Set the configurable close-timeout window (owner-gated). ABI: setCloseTimeout(uint64 _timeout). */
60
+ setCloseTimeout: (args: {
61
+ timeout: bigint;
62
+ account?: Account | Address;
63
+ }) => Promise<Hash>;
64
+ /** Whether a given channelId has already been closed (view). ABI: closedChannels(bytes32) -> bool. */
65
+ closedChannels: (args: {
66
+ channelId: Hex;
67
+ }) => Promise<boolean>;
68
+ /** Upper bound for {@link setCloseTimeout} (view). ABI: MAX_CLOSE_TIMEOUT() -> uint64. */
69
+ MAX_CLOSE_TIMEOUT: () => Promise<bigint>;
70
+ /** Lower bound for {@link setCloseTimeout} (view). ABI: MIN_CLOSE_TIMEOUT() -> uint64. */
71
+ MIN_CLOSE_TIMEOUT: () => Promise<bigint>;
72
+ VOUCHER_TYPEHASH: () => Promise<Hex>;
73
+ version: () => Promise<string>;
74
+ };
75
+ declare const channelActions: (address: Address) => (client: PublicClient | WalletClient) => ChannelActions;
76
+
77
+ export { type ChannelState as C, type ChannelActions as a, channelActions as c };
package/dist/channel.d.ts CHANGED
@@ -1 +1,64 @@
1
- export * from '@aastar/channel';
1
+ import { Hex, PublicClient, WalletClient, Address, Hash } from 'viem';
2
+ import { C as ChannelState } from './channel-CkRRbzT8.js';
3
+
4
+ type VoucherParams = {
5
+ channelId: Hex;
6
+ cumulativeAmount: bigint;
7
+ };
8
+ type SignedVoucher = VoucherParams & {
9
+ signature: Hex;
10
+ };
11
+ type ChannelConfig = {
12
+ payee: `0x${string}`;
13
+ token: `0x${string}`;
14
+ deposit: bigint;
15
+ salt: Hex;
16
+ authorizedSigner: `0x${string}`;
17
+ };
18
+
19
+ type ChannelClientConfig = {
20
+ publicClient: PublicClient;
21
+ walletClient: WalletClient;
22
+ channelAddress: Address;
23
+ chainId: number;
24
+ };
25
+ declare class ChannelClient {
26
+ private readonly readActions;
27
+ private readonly writeActions;
28
+ private readonly config;
29
+ constructor(config: ChannelClientConfig);
30
+ openChannel(channelConfig: ChannelConfig): Promise<Hash>;
31
+ signVoucherOffline(channelId: Hex, cumulativeAmount: bigint): Promise<SignedVoucher>;
32
+ settleChannel(voucher: SignedVoucher): Promise<Hash>;
33
+ closeChannel(voucher: SignedVoucher): Promise<Hash>;
34
+ topUpChannel(channelId: Hex, amount: bigint): Promise<Hash>;
35
+ requestClose(channelId: Hex): Promise<Hash>;
36
+ withdraw(channelId: Hex): Promise<Hash>;
37
+ getChannelState(channelId: Hex): Promise<ChannelState>;
38
+ getCloseTimeout(): Promise<bigint>;
39
+ getVersion(): Promise<string>;
40
+ }
41
+
42
+ declare const VOUCHER_TYPES: {
43
+ readonly Voucher: readonly [{
44
+ readonly name: "channelId";
45
+ readonly type: "bytes32";
46
+ }, {
47
+ readonly name: "cumulativeAmount";
48
+ readonly type: "uint128";
49
+ }];
50
+ };
51
+ declare function getVoucherDomain(chainId: number, verifyingContract: Address): {
52
+ name: string;
53
+ version: string;
54
+ chainId: number;
55
+ verifyingContract: `0x${string}`;
56
+ };
57
+ declare function signVoucher(walletClient: WalletClient, params: {
58
+ channelId: Hex;
59
+ cumulativeAmount: bigint;
60
+ chainId: number;
61
+ verifyingContract: Address;
62
+ }): Promise<Hex>;
63
+
64
+ export { ChannelClient, type ChannelClientConfig, type ChannelConfig, ChannelState, type SignedVoucher, VOUCHER_TYPES, type VoucherParams, getVoucherDomain, signVoucher };
package/dist/channel.js CHANGED
@@ -1,6 +1,6 @@
1
- export { ChannelClient, VOUCHER_TYPES, getVoucherDomain, signVoucher } from './chunk-ZGOEADCO.js';
2
- import './chunk-TIH7D4FQ.js';
3
- import './chunk-NRH56SAJ.js';
1
+ export { ChannelClient, VOUCHER_TYPES, getVoucherDomain, signVoucher } from './chunk-LXWIPTPX.js';
2
+ import './chunk-6QYXGMCR.js';
3
+ import './chunk-G3UJC4EL.js';
4
4
  import './chunk-PZ5AY32C.js';
5
5
  //# sourceMappingURL=channel.js.map
6
6
  //# sourceMappingURL=channel.js.map
@@ -1,4 +1,4 @@
1
- import { SimpleAccountFactoryABI } from './chunk-TIH7D4FQ.js';
1
+ import { SimpleAccountFactoryABI } from './chunk-6QYXGMCR.js';
2
2
  import { http, createWalletClient, encodeAbiParameters, keccak256, encodeFunctionData, concatHex } from 'viem';
3
3
  import { privateKeyToAccount } from 'viem/accounts';
4
4
 
@@ -24,26 +24,32 @@ function packUserOpLimits(high, low) {
24
24
  return `0x${(high << 128n | low).toString(16).padStart(64, "0")}`;
25
25
  }
26
26
  function getUserOpHash(op, ep, chainId) {
27
- const packed = encodeAbiParameters([
28
- { type: "address" },
29
- { type: "uint256" },
30
- { type: "bytes32" },
31
- { type: "bytes32" },
32
- { type: "bytes32" },
33
- { type: "uint256" },
34
- { type: "bytes32" },
35
- { type: "bytes32" }
36
- ], [
37
- op.sender,
38
- BigInt(op.nonce),
39
- keccak256(op.initCode && op.initCode !== "0x" ? op.initCode : "0x"),
40
- keccak256(op.callData),
41
- op.accountGasLimits,
42
- BigInt(op.preVerificationGas),
43
- op.gasFees,
44
- keccak256(op.paymasterAndData)
45
- ]);
46
- const enc = encodeAbiParameters([{ type: "bytes32" }, { type: "address" }, { type: "uint256" }], [keccak256(packed), ep, BigInt(chainId)]);
27
+ const packed = encodeAbiParameters(
28
+ [
29
+ { type: "address" },
30
+ { type: "uint256" },
31
+ { type: "bytes32" },
32
+ { type: "bytes32" },
33
+ { type: "bytes32" },
34
+ { type: "uint256" },
35
+ { type: "bytes32" },
36
+ { type: "bytes32" }
37
+ ],
38
+ [
39
+ op.sender,
40
+ BigInt(op.nonce),
41
+ keccak256(op.initCode && op.initCode !== "0x" ? op.initCode : "0x"),
42
+ keccak256(op.callData),
43
+ op.accountGasLimits,
44
+ BigInt(op.preVerificationGas),
45
+ op.gasFees,
46
+ keccak256(op.paymasterAndData)
47
+ ]
48
+ );
49
+ const enc = encodeAbiParameters(
50
+ [{ type: "bytes32" }, { type: "address" }, { type: "uint256" }],
51
+ [keccak256(packed), ep, BigInt(chainId)]
52
+ );
47
53
  return keccak256(enc);
48
54
  }
49
55
  var UserOpClient = class {
@@ -67,7 +73,7 @@ var UserOpClient = class {
67
73
  }
68
74
  };
69
75
 
70
- // ../account/dist/accounts/simple.js
76
+ // ../account/src/accounts/simple.ts
71
77
  async function toSimpleSmartAccount(parameters) {
72
78
  const { client, owner, factoryAddress, entryPoint, index = 0n, salt = 0n } = parameters;
73
79
  const factoryData = encodeFunctionData({
@@ -112,5 +118,5 @@ async function toSimpleSmartAccount(parameters) {
112
118
  }
113
119
 
114
120
  export { UserOpClient, createEOAWalletClient, getUserOpHash, packUserOpLimits, toSimpleSmartAccount };
115
- //# sourceMappingURL=chunk-FBDMID2J.js.map
116
- //# sourceMappingURL=chunk-FBDMID2J.js.map
121
+ //# sourceMappingURL=chunk-4EZD7LPE.js.map
122
+ //# sourceMappingURL=chunk-4EZD7LPE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../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IAEA,MAAM,kBAAkB,MAAA,EAA2B;AAC/C,MAAA,MAAM,OAAA,GAAU,MAAA,CAAO,KAAA,EAAO,EAAA,IAAM,KAAA;AACpC,MAAA,MAAM,IAAA,GAAO,aAAA,CAAc,MAAA,EAAQ,UAAA,CAAW,SAAS,OAAO,CAAA;AAC9D,MAAA,OAAO,KAAA,CAAM,YAAY,EAAE,OAAA,EAAS,EAAE,GAAA,EAAK,IAAA,IAAQ,CAAA;AAAA,IACvD,CAAA;AAAA,IAEA,MAAM,WAAA,GAAc;AAChB,MAAA,OAAO,QAAA;AAAA,IACX,CAAA;AAAA,IAEA,MAAM,iBAAA,GAAoB;AACtB,MAAA,OAAO,8IAAA;AAAA,IACX;AAAA,GAEJ;AACJ","file":"chunk-4EZD7LPE.js","sourcesContent":["import { type WalletClient, type PublicClient, type Address, type Chain, type Transport, type Hash, type Hex, createWalletClient, http } from 'viem';\nimport { privateKeyToAccount } from 'viem/accounts';\n\nexport type EOAWalletClient = WalletClient & {\n sendTransaction: (args: { to: Address, value?: bigint, data?: Hex }) => Promise<Hash>;\n getAddress: () => Address;\n};\n\nexport const createEOAWalletClient = (\n privateKey: Hex, \n chain: Chain, \n transport: Transport = http()\n): EOAWalletClient => {\n const account = privateKeyToAccount(privateKey);\n const client = createWalletClient({\n account,\n chain,\n transport\n });\n\n return Object.assign(client, {\n async sendTransaction(args: { to: Address, value?: bigint, data?: Hex }) {\n return client.sendTransaction({\n ...args,\n account,\n chain\n });\n },\n getAddress: () => account.address\n }) as EOAWalletClient;\n};\n","import { type Hex, type Address, encodeAbiParameters, keccak256 } from 'viem';\n\nexport * from './eoa.js';\nexport * from './accounts/simple.js';\n\n/**\n * Common Pack Logic for v0.7 UserOperations\n */\nexport function packUserOpLimits(high: bigint, low: bigint): Hex {\n return `0x${((high << 128n) | low).toString(16).padStart(64, '0')}` as Hex;\n}\n\n/**\n * Local implementation of EntryPoint v0.7 getUserOpHash\n */\nexport function getUserOpHash(op: any, ep: Address, chainId: number): Hex {\n const packed = encodeAbiParameters(\n [\n { type: 'address' }, { type: 'uint256' }, { type: 'bytes32' }, { type: 'bytes32' },\n { type: 'bytes32' }, { type: 'uint256' }, { type: 'bytes32' }, { type: 'bytes32' }\n ],\n [\n op.sender, BigInt(op.nonce), \n keccak256(op.initCode && op.initCode !== \"0x\" ? op.initCode : '0x'), \n keccak256(op.callData),\n op.accountGasLimits, BigInt(op.preVerificationGas), op.gasFees,\n keccak256(op.paymasterAndData)\n ]\n );\n const enc = encodeAbiParameters(\n [{ type: 'bytes32' }, { type: 'address' }, { type: 'uint256' }],\n [keccak256(packed), ep, BigInt(chainId)]\n );\n return keccak256(enc);\n}\n\n/**\n * UserOperation Client for handling high-level flows\n */\nexport class UserOpClient {\n static async estimateGas(bundler: any, op: any, entryPoint: Address) {\n return bundler.request({\n method: 'eth_estimateUserOperationGas',\n params: [op, entryPoint]\n });\n }\n\n static async sendUserOp(bundler: any, op: any, entryPoint: Address) {\n return bundler.request({\n method: 'eth_sendUserOperation',\n params: [op, entryPoint]\n });\n }\n\n static async getReceipt(bundler: any, hash: Hex) {\n return bundler.request({\n method: 'eth_getUserOperationReceipt',\n params: [hash]\n });\n }\n}\n","import { \n type Address, \n type Hex, \n type LocalAccount, \n type SignableMessage, \n type TypedDataDefinition,\n type Hash,\n concatHex, \n encodeFunctionData, \n keccak256,\n} from 'viem';\nimport { SimpleAccountFactoryABI, type PublicClient } from '@aastar/core';\nimport { getUserOpHash } from '../index.js';\n\nexport type SimpleSmartAccount = LocalAccount & {\n signUserOperation: (userOp: any) => Promise<Hex>;\n getInitCode: () => Promise<Hex>;\n getDummySignature: () => Promise<Hex>;\n entryPoint: Address;\n};\n\nexport async function toSimpleSmartAccount(parameters: {\n client: any;\n owner: LocalAccount;\n factoryAddress: Address;\n entryPoint: { address: Address; version: '0.6' | '0.7' };\n salt?: bigint;\n index?: bigint;\n}): Promise<SimpleSmartAccount> {\n const { client, owner, factoryAddress, entryPoint, index = 0n, salt = 0n } = parameters;\n \n // Calculate initCode\n const factoryData = encodeFunctionData({\n abi: SimpleAccountFactoryABI,\n functionName: 'createAccount',\n args: [owner.address, salt]\n });\n const initCode = concatHex([factoryAddress, factoryData]);\n\n // Calculate counterfactual address\n const address = await client.readContract({\n address: factoryAddress,\n abi: SimpleAccountFactoryABI,\n functionName: 'getAddress',\n args: [owner.address, salt]\n });\n\n return {\n address,\n publicKey: owner.address,\n source: 'custom', \n type: 'local',\n entryPoint: entryPoint.address,\n \n async signMessage({ message }: { message: SignableMessage }): Promise<Hex> {\n // validating signature for smart account usually involves EIP-1271, \n // but here we just sign with owner for SimpleAccount which validates owner sig\n return owner.signMessage({ message });\n },\n\n async signTypedData(typedData: TypedDataDefinition): Promise<Hex> {\n return owner.signTypedData(typedData);\n },\n\n async signTransaction(transaction: any): Promise<Hex> {\n throw new Error('Smart Accounts cannot sign transactions directly. Use UserOperations.');\n },\n \n async signUserOperation(userOp: any): Promise<Hex> {\n const chainId = client.chain?.id || 31337; // Default to local anvil if not found\n const hash = getUserOpHash(userOp, entryPoint.address, chainId);\n return owner.signMessage({ message: { raw: hash } });\n },\n \n async getInitCode() {\n return initCode;\n },\n\n async getDummySignature() {\n return '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff';\n }\n\n } as any as SimpleSmartAccount;\n}\n"]}