@aastar/sdk 0.20.5 → 0.20.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/BaseClient-BjbYP0cf.d.ts +88 -0
  2. package/dist/UserClient-AIIHB54I.js +6 -0
  3. package/dist/{UserClient-UYIHF6UJ.js.map → UserClient-AIIHB54I.js.map} +1 -1
  4. package/dist/account.d.ts +48 -1
  5. package/dist/account.js +3 -3
  6. package/dist/admin.d.ts +62 -1
  7. package/dist/admin.js +3 -3
  8. package/dist/airaccount.d.ts +4 -2
  9. package/dist/airaccount.js +2 -2
  10. package/dist/channel-CkRRbzT8.d.ts +77 -0
  11. package/dist/channel.d.ts +64 -1
  12. package/dist/channel.js +3 -3
  13. package/dist/{chunk-FBDMID2J.js → chunk-4EZD7LPE.js} +30 -24
  14. package/dist/chunk-4EZD7LPE.js.map +1 -0
  15. package/dist/{chunk-TIH7D4FQ.js → chunk-6QYXGMCR.js} +513 -322
  16. package/dist/chunk-6QYXGMCR.js.map +1 -0
  17. package/dist/{chunk-6UHVUGDT.js → chunk-7ARJ3OSU.js} +29 -21
  18. package/dist/chunk-7ARJ3OSU.js.map +1 -0
  19. package/dist/{chunk-VYU6P7HB.js → chunk-BN5WY5GM.js} +16 -14
  20. package/dist/chunk-BN5WY5GM.js.map +1 -0
  21. package/dist/{chunk-ZFIKBDBT.js → chunk-FJ7XECC5.js} +4 -4
  22. package/dist/chunk-FJ7XECC5.js.map +1 -0
  23. package/dist/{chunk-4KRQXOTI.js → chunk-FUU7RIIA.js} +113 -102
  24. package/dist/chunk-FUU7RIIA.js.map +1 -0
  25. package/dist/{chunk-NRH56SAJ.js → chunk-G3UJC4EL.js} +6 -7
  26. package/dist/chunk-G3UJC4EL.js.map +1 -0
  27. package/dist/{chunk-QJT4IOIS.js → chunk-KDH3UPKD.js} +10 -13
  28. package/dist/chunk-KDH3UPKD.js.map +1 -0
  29. package/dist/{chunk-WPSWFZKF.js → chunk-KISL64KW.js} +69 -323
  30. package/dist/chunk-KISL64KW.js.map +1 -0
  31. package/dist/{chunk-ZGOEADCO.js → chunk-LXWIPTPX.js} +5 -5
  32. package/dist/chunk-LXWIPTPX.js.map +1 -0
  33. package/dist/{chunk-I3VRFZA4.js → chunk-MVEWJIPY.js} +124 -110
  34. package/dist/chunk-MVEWJIPY.js.map +1 -0
  35. package/dist/{chunk-FIS3RUGL.js → chunk-PAABYXS6.js} +33 -40
  36. package/dist/chunk-PAABYXS6.js.map +1 -0
  37. package/dist/{chunk-HNTLDUL7.js → chunk-PKCHRXFR.js} +8 -12
  38. package/dist/chunk-PKCHRXFR.js.map +1 -0
  39. package/dist/{chunk-42KVVOOU.js → chunk-TENYCMJ3.js} +31 -31
  40. package/dist/chunk-TENYCMJ3.js.map +1 -0
  41. package/dist/{contract-addresses-ADEWLDHE.js → contract-addresses-N3TOL2WL.js} +3 -3
  42. package/dist/{contract-addresses-ADEWLDHE.js.map → contract-addresses-N3TOL2WL.js.map} +1 -1
  43. package/dist/core.d.ts +6930 -13
  44. package/dist/core.js +2 -2
  45. package/dist/dapp.d.ts +127 -1
  46. package/dist/dapp.js +12 -13
  47. package/dist/dapp.js.map +1 -1
  48. package/dist/doc-types-471vSmPO.d.ts +16 -0
  49. package/dist/enduser.d.ts +261 -1
  50. package/dist/enduser.js +4 -4
  51. package/dist/identity.d.ts +81 -1
  52. package/dist/identity.js +3 -3
  53. package/dist/index-B6SfEQxo.d.ts +47 -0
  54. package/dist/index.d.ts +55 -15
  55. package/dist/index.js +18 -18
  56. package/dist/index.js.map +1 -1
  57. package/dist/kms.d.ts +2986 -2
  58. package/dist/kms.js +2 -2
  59. package/dist/operator.d.ts +164 -1
  60. package/dist/operator.js +3 -3
  61. package/dist/paymaster.d.ts +312 -1
  62. package/dist/paymaster.js +3 -3
  63. package/dist/{index.node-KIKM4EG6.js → src-L5SI5WNB.js} +4 -4
  64. package/dist/src-L5SI5WNB.js.map +1 -0
  65. package/dist/{dist-GVWCRI4F.js → src-X5MIV3EB.js} +5 -5
  66. package/dist/src-X5MIV3EB.js.map +1 -0
  67. package/dist/tier-router-DLiMxs0h.d.ts +321 -0
  68. package/dist/tokens.d.ts +64 -1
  69. package/dist/tokens.js +3 -3
  70. package/dist/x402.d.ts +373 -1
  71. package/dist/x402.js +3 -3
  72. package/package.json +1 -1
  73. package/dist/UserClient-UYIHF6UJ.js +0 -6
  74. package/dist/chunk-42KVVOOU.js.map +0 -1
  75. package/dist/chunk-4KRQXOTI.js.map +0 -1
  76. package/dist/chunk-6UHVUGDT.js.map +0 -1
  77. package/dist/chunk-FBDMID2J.js.map +0 -1
  78. package/dist/chunk-FIS3RUGL.js.map +0 -1
  79. package/dist/chunk-HNTLDUL7.js.map +0 -1
  80. package/dist/chunk-I3VRFZA4.js.map +0 -1
  81. package/dist/chunk-NRH56SAJ.js.map +0 -1
  82. package/dist/chunk-QJT4IOIS.js.map +0 -1
  83. package/dist/chunk-TIH7D4FQ.js.map +0 -1
  84. package/dist/chunk-VYU6P7HB.js.map +0 -1
  85. package/dist/chunk-WPSWFZKF.js.map +0 -1
  86. package/dist/chunk-ZFIKBDBT.js.map +0 -1
  87. package/dist/chunk-ZGOEADCO.js.map +0 -1
  88. package/dist/dist-GVWCRI4F.js.map +0 -1
  89. package/dist/index.node-KIKM4EG6.js.map +0 -1
@@ -1,22 +1,9 @@
1
- import { ecdsa, bls12_381, weierstrass, sha256 } from './chunk-4KRQXOTI.js';
1
+ import { ERC4337Utils, BLSManager, resolveTier, algIdForTier, ecdsa, ALG_CUMULATIVE_T3, ALG_CUMULATIVE_T2, ALG_P256, ALG_ECDSA, ALG_BLS, weierstrass, sha256 } from './chunk-FUU7RIIA.js';
2
2
  import { ethers } from 'ethers';
3
3
  import axios from 'axios';
4
4
  import { createHash } from 'crypto';
5
5
 
6
- // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/nist.js
7
- var p256_CURVE = /* @__PURE__ */ (() => ({
8
- p: BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),
9
- n: BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),
10
- h: BigInt(1),
11
- a: BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),
12
- b: BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),
13
- Gx: BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),
14
- Gy: BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")
15
- }))();
16
- var p256_Point = /* @__PURE__ */ weierstrass(p256_CURVE);
17
- var p256 = /* @__PURE__ */ ecdsa(p256_Point, sha256);
18
-
19
- // ../airaccount/dist/server/index.js
6
+ // ../airaccount/src/server/constants/entrypoint.ts
20
7
  var EntryPointVersion = /* @__PURE__ */ ((EntryPointVersion2) => {
21
8
  EntryPointVersion2["V0_6"] = "0.6";
22
9
  EntryPointVersion2["V0_7"] = "0.7";
@@ -24,26 +11,17 @@ var EntryPointVersion = /* @__PURE__ */ ((EntryPointVersion2) => {
24
11
  return EntryPointVersion2;
25
12
  })(EntryPointVersion || {});
26
13
  var ENTRYPOINT_ADDRESSES = {
27
- [
28
- "0.6"
29
- /* V0_6 */
30
- ]: {
14
+ ["0.6" /* V0_6 */]: {
31
15
  sepolia: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
32
16
  mainnet: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
33
17
  optimism: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
34
18
  },
35
- [
36
- "0.7"
37
- /* V0_7 */
38
- ]: {
19
+ ["0.7" /* V0_7 */]: {
39
20
  sepolia: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
40
21
  mainnet: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
41
22
  optimism: "0x0000000071727De22E5E9d8BAf0edAc6f37da032"
42
23
  },
43
- [
44
- "0.8"
45
- /* V0_8 */
46
- ]: {
24
+ ["0.8" /* V0_8 */]: {
47
25
  sepolia: "0x0576a174D229E3cFA37253523E645A78A0C91B57",
48
26
  mainnet: "0x0576a174D229E3cFA37253523E645A78A0C91B57",
49
27
  optimism: "0x0576a174D229E3cFA37253523E645A78A0C91B57"
@@ -386,13 +364,12 @@ var AIR_ACCOUNT_DELEGATE_ABI = [
386
364
  "event RescueExecuted(address indexed eoa, address rescueTo, uint256 ethAmount)",
387
365
  "event RescueCancelled(address indexed eoa)"
388
366
  ];
367
+
368
+ // ../airaccount/src/server/config.ts
389
369
  function sepoliaV07Config(version = "M7") {
390
370
  const factoryAddress = version === "M5" ? AIRACCOUNT_ADDRESSES.sepolia.factoryM5 : version === "M7r6" ? AIRACCOUNT_ADDRESSES.sepolia.factoryM7r6 : AIRACCOUNT_ADDRESSES.sepolia.factory;
391
371
  return {
392
- entryPointAddress: ENTRYPOINT_ADDRESSES[
393
- "0.7"
394
- /* V0_7 */
395
- ].sepolia,
372
+ entryPointAddress: ENTRYPOINT_ADDRESSES["0.7" /* V0_7 */].sepolia,
396
373
  factoryAddress,
397
374
  validatorAddress: AIRACCOUNT_ADDRESSES.sepolia.validatorRouter
398
375
  };
@@ -431,6 +408,8 @@ function validateConfig(config) {
431
408
  throw new Error("ServerConfig: signer adapter is required");
432
409
  }
433
410
  }
411
+
412
+ // ../airaccount/src/server/interfaces/logger.ts
434
413
  var ConsoleLogger = class {
435
414
  constructor(prefix = "[YAAA]") {
436
415
  this.prefix = prefix;
@@ -478,18 +457,9 @@ var EthereumProvider = class {
478
457
  // ── Config helpers ──────────────────────────────────────────────
479
458
  getVersionConfig(version) {
480
459
  const map = {
481
- [
482
- "0.6"
483
- /* V0_6 */
484
- ]: this.config.entryPoints.v06,
485
- [
486
- "0.7"
487
- /* V0_7 */
488
- ]: this.config.entryPoints.v07,
489
- [
490
- "0.8"
491
- /* V0_8 */
492
- ]: this.config.entryPoints.v08
460
+ ["0.6" /* V0_6 */]: this.config.entryPoints.v06,
461
+ ["0.7" /* V0_7 */]: this.config.entryPoints.v07,
462
+ ["0.8" /* V0_8 */]: this.config.entryPoints.v08
493
463
  };
494
464
  const versionConfig = map[version];
495
465
  if (!versionConfig) {
@@ -508,22 +478,22 @@ var EthereumProvider = class {
508
478
  }
509
479
  getDefaultVersion() {
510
480
  const v = this.config.defaultVersion;
511
- if (v === "0.7") return "0.7";
512
- if (v === "0.8") return "0.8";
513
- return "0.6";
481
+ if (v === "0.7") return "0.7" /* V0_7 */;
482
+ if (v === "0.8") return "0.8" /* V0_8 */;
483
+ return "0.6" /* V0_6 */;
514
484
  }
515
485
  // ── Contract factories ──────────────────────────────────────────
516
- getFactoryContract(version = "0.6") {
486
+ getFactoryContract(version = "0.6" /* V0_6 */) {
517
487
  const address = this.getFactoryAddress(version);
518
- const abi = version === "0.6" ? FACTORY_ABI_V6 : AIRACCOUNT_FACTORY_ABI;
488
+ const abi = version === "0.6" /* V0_6 */ ? FACTORY_ABI_V6 : AIRACCOUNT_FACTORY_ABI;
519
489
  return new ethers.Contract(address, abi, this.provider);
520
490
  }
521
- getEntryPointContract(version = "0.6") {
491
+ getEntryPointContract(version = "0.6" /* V0_6 */) {
522
492
  const address = this.getEntryPointAddress(version);
523
- const abi = version === "0.6" ? ENTRYPOINT_ABI_V6 : ENTRYPOINT_ABI_V7_V8;
493
+ const abi = version === "0.6" /* V0_6 */ ? ENTRYPOINT_ABI_V6 : ENTRYPOINT_ABI_V7_V8;
524
494
  return new ethers.Contract(address, abi, this.provider);
525
495
  }
526
- getValidatorContract(version = "0.6") {
496
+ getValidatorContract(version = "0.6" /* V0_6 */) {
527
497
  const address = this.getValidatorAddress(version);
528
498
  return new ethers.Contract(address, VALIDATOR_ABI, this.provider);
529
499
  }
@@ -550,13 +520,13 @@ var EthereumProvider = class {
550
520
  const balance = await this.provider.getBalance(address);
551
521
  return ethers.formatEther(balance);
552
522
  }
553
- async getNonce(accountAddress, key = 0, version = "0.6") {
523
+ async getNonce(accountAddress, key = 0, version = "0.6" /* V0_6 */) {
554
524
  const entryPoint = this.getEntryPointContract(version);
555
525
  return await entryPoint.getNonce(accountAddress, key);
556
526
  }
557
- async getUserOpHash(userOp, version = "0.6") {
527
+ async getUserOpHash(userOp, version = "0.6" /* V0_6 */) {
558
528
  const entryPoint = this.getEntryPointContract(version);
559
- if (version === "0.6") {
529
+ if (version === "0.6" /* V0_6 */) {
560
530
  const op = userOp;
561
531
  const userOpArray = [
562
532
  op.sender,
@@ -590,7 +560,7 @@ var EthereumProvider = class {
590
560
  }
591
561
  }
592
562
  // ── Bundler RPC ─────────────────────────────────────────────────
593
- async estimateUserOperationGas(userOp, version = "0.6") {
563
+ async estimateUserOperationGas(userOp, version = "0.6" /* V0_6 */) {
594
564
  try {
595
565
  return await this.bundlerProvider.send("eth_estimateUserOperationGas", [
596
566
  userOp,
@@ -605,7 +575,7 @@ var EthereumProvider = class {
605
575
  };
606
576
  }
607
577
  }
608
- async sendUserOperation(userOp, version = "0.6") {
578
+ async sendUserOperation(userOp, version = "0.6" /* V0_6 */) {
609
579
  return await this.bundlerProvider.send("eth_sendUserOperation", [
610
580
  userOp,
611
581
  this.getEntryPointAddress(version)
@@ -820,7 +790,7 @@ var AccountManager = class {
820
790
  throw new Error("Guardian accounts require dailyLimit > 0 (on-chain enforcement)");
821
791
  }
822
792
  const version = params.entryPointVersion ?? this.ethereum.getDefaultVersion();
823
- if (version === "0.6") {
793
+ if (version === "0.6" /* V0_6 */) {
824
794
  throw new Error(
825
795
  "createAccountWithGuardians requires EntryPoint v0.7 or v0.8; v0.6 factory does not support getAddressWithDefaults"
826
796
  );
@@ -1153,67 +1123,8 @@ var PaymasterManager = class {
1153
1123
  }
1154
1124
  }
1155
1125
  };
1156
- var ERC4337Utils = class _ERC4337Utils {
1157
- static packAccountGasLimits(verificationGasLimit, callGasLimit) {
1158
- const vgl = BigInt(verificationGasLimit);
1159
- const cgl = BigInt(callGasLimit);
1160
- const packed = vgl << 128n | cgl;
1161
- return "0x" + packed.toString(16).padStart(64, "0");
1162
- }
1163
- static unpackAccountGasLimits(accountGasLimits) {
1164
- const packed = BigInt(accountGasLimits);
1165
- return {
1166
- verificationGasLimit: packed >> 128n,
1167
- callGasLimit: packed & (1n << 128n) - 1n
1168
- };
1169
- }
1170
- static packGasFees(maxPriorityFeePerGas, maxFeePerGas) {
1171
- const priority = BigInt(maxPriorityFeePerGas);
1172
- const max = BigInt(maxFeePerGas);
1173
- const packed = priority << 128n | max;
1174
- return "0x" + packed.toString(16).padStart(64, "0");
1175
- }
1176
- static unpackGasFees(gasFees) {
1177
- const packed = BigInt(gasFees);
1178
- return {
1179
- maxPriorityFeePerGas: packed >> 128n,
1180
- maxFeePerGas: packed & (1n << 128n) - 1n
1181
- };
1182
- }
1183
- static packUserOperation(userOp) {
1184
- return {
1185
- sender: userOp.sender,
1186
- nonce: userOp.nonce,
1187
- initCode: userOp.initCode || "0x",
1188
- callData: userOp.callData,
1189
- accountGasLimits: _ERC4337Utils.packAccountGasLimits(
1190
- userOp.verificationGasLimit,
1191
- userOp.callGasLimit
1192
- ),
1193
- preVerificationGas: userOp.preVerificationGas,
1194
- gasFees: _ERC4337Utils.packGasFees(userOp.maxPriorityFeePerGas, userOp.maxFeePerGas),
1195
- paymasterAndData: userOp.paymasterAndData || "0x",
1196
- signature: userOp.signature || "0x"
1197
- };
1198
- }
1199
- static unpackUserOperation(packedOp) {
1200
- const gasLimits = _ERC4337Utils.unpackAccountGasLimits(packedOp.accountGasLimits);
1201
- const gasFees = _ERC4337Utils.unpackGasFees(packedOp.gasFees);
1202
- return {
1203
- sender: packedOp.sender,
1204
- nonce: packedOp.nonce,
1205
- initCode: packedOp.initCode,
1206
- callData: packedOp.callData,
1207
- callGasLimit: "0x" + gasLimits.callGasLimit.toString(16),
1208
- verificationGasLimit: "0x" + gasLimits.verificationGasLimit.toString(16),
1209
- preVerificationGas: packedOp.preVerificationGas,
1210
- maxFeePerGas: "0x" + gasFees.maxFeePerGas.toString(16),
1211
- maxPriorityFeePerGas: "0x" + gasFees.maxPriorityFeePerGas.toString(16),
1212
- paymasterAndData: packedOp.paymasterAndData,
1213
- signature: packedOp.signature
1214
- };
1215
- }
1216
- };
1126
+
1127
+ // ../airaccount/src/server/services/transfer-manager.ts
1217
1128
  async function detectSignatureStrategy(provider, accountAddress) {
1218
1129
  try {
1219
1130
  const accountCode = await provider.getCode(accountAddress);
@@ -1293,7 +1204,7 @@ var TransferManager = class {
1293
1204
  const assertionCtx = params.passkeyAssertion ? { assertion: params.passkeyAssertion } : void 0;
1294
1205
  let useECDSA = false;
1295
1206
  let isCompositeValidator = false;
1296
- if (version === "0.7" || version === "0.8") {
1207
+ if (version === "0.7" /* V0_7 */ || version === "0.8" /* V0_8 */) {
1297
1208
  const provider = this.ethereum.getProvider();
1298
1209
  ({ useECDSA, isCompositeValidator } = await detectSignatureStrategy(
1299
1210
  provider,
@@ -1486,7 +1397,7 @@ var TransferManager = class {
1486
1397
  };
1487
1398
  }
1488
1399
  // ── Private helpers ─────────────────────────────────────────────
1489
- async buildUserOperation(userId, sender, to, amount, data, usePaymaster, paymasterAddress, _paymasterData, tokenAddress, version = "0.6", paymasterTokenAddress, wrapExecuteUserOpFlag = false) {
1400
+ async buildUserOperation(userId, sender, to, amount, data, usePaymaster, paymasterAddress, _paymasterData, tokenAddress, version = "0.6" /* V0_6 */, paymasterTokenAddress, wrapExecuteUserOpFlag = false) {
1490
1401
  const accountContract = this.ethereum.getAccountContract(sender);
1491
1402
  const nonce = await this.ethereum.getNonce(sender, 0, version);
1492
1403
  const provider = this.ethereum.getProvider();
@@ -1500,7 +1411,7 @@ var TransferManager = class {
1500
1411
  const factory = this.ethereum.getFactoryContract(version);
1501
1412
  const factoryAddress = await factory.getAddress();
1502
1413
  let deployCalldata;
1503
- if (version === "0.7" || version === "0.8") {
1414
+ if (version === "0.7" /* V0_7 */ || version === "0.8" /* V0_8 */) {
1504
1415
  const storedDailyLimit = account.dailyLimit ? BigInt(account.dailyLimit) : 0n;
1505
1416
  if (account.guardian1 && account.guardian2 && account.guardian1Sig && account.guardian2Sig) {
1506
1417
  const sig1 = account.guardian1Sig.startsWith("0x") ? account.guardian1Sig : `0x${account.guardian1Sig}`;
@@ -1573,7 +1484,7 @@ var TransferManager = class {
1573
1484
  callData = wrapExecuteUserOp(callData);
1574
1485
  }
1575
1486
  const gasPrices = await this.ethereum.getUserOperationGasPrice();
1576
- const isV07 = version === "0.7" || version === "0.8";
1487
+ const isV07 = version === "0.7" /* V0_7 */ || version === "0.8" /* V0_8 */;
1577
1488
  let baseUserOp;
1578
1489
  if (isV07) {
1579
1490
  let factory;
@@ -1670,13 +1581,13 @@ var TransferManager = class {
1670
1581
  paymasterAndData,
1671
1582
  signature: "0x"
1672
1583
  };
1673
- if (version === "0.7" || version === "0.8") {
1584
+ if (version === "0.7" /* V0_7 */ || version === "0.8" /* V0_8 */) {
1674
1585
  return ERC4337Utils.packUserOperation(standardUserOp);
1675
1586
  }
1676
1587
  return standardUserOp;
1677
1588
  }
1678
- formatUserOpForBundler(userOp, version = "0.6") {
1679
- if (version === "0.7" || version === "0.8") {
1589
+ formatUserOpForBundler(userOp, version = "0.6" /* V0_6 */) {
1590
+ if (version === "0.7" /* V0_7 */ || version === "0.8" /* V0_8 */) {
1680
1591
  const packedOp = userOp;
1681
1592
  const gasLimits = ERC4337Utils.unpackAccountGasLimits(packedOp.accountGasLimits);
1682
1593
  const gasFees = ERC4337Utils.unpackGasFees(packedOp.gasFees);
@@ -1743,181 +1654,6 @@ var TransferManager = class {
1743
1654
  };
1744
1655
  }
1745
1656
  };
1746
- var BLSManager = class {
1747
- config;
1748
- constructor(config) {
1749
- this.config = config;
1750
- }
1751
- /**
1752
- * Discover available BLS nodes from seed nodes (Gossip network)
1753
- */
1754
- async getAvailableNodes() {
1755
- const { seedNodes, discoveryTimeout = 5e3 } = this.config;
1756
- for (const seedEndpoint of seedNodes) {
1757
- try {
1758
- const response = await axios.get(`${seedEndpoint}/gossip/peers`, {
1759
- timeout: discoveryTimeout
1760
- });
1761
- const peers = response.data.peers || [];
1762
- const activeNodes = peers.filter((p) => p.status === "active" && p.apiEndpoint && p.publicKey).map((p, index) => ({
1763
- index: index + 1,
1764
- // 1-based index likely expected by contract if using bitmap
1765
- nodeId: p.nodeId,
1766
- nodeName: p.nodeName,
1767
- apiEndpoint: p.apiEndpoint,
1768
- status: "active",
1769
- publicKey: p.publicKey
1770
- }));
1771
- if (activeNodes.length > 0) {
1772
- return activeNodes;
1773
- }
1774
- } catch {
1775
- continue;
1776
- }
1777
- }
1778
- return [];
1779
- }
1780
- /**
1781
- * Helper to pack the full signature for ERC-4337 UserOp
1782
- * Format: [nodeIdsLength][nodeIds...][blsSignature][messagePoint][aaSignature][messagePointSignature]
1783
- */
1784
- packSignature(data) {
1785
- if (!data.nodeIds || !data.aaSignature || !data.messagePointSignature) {
1786
- throw new Error("Missing required signature components");
1787
- }
1788
- const nodeIdsLength = ethers.solidityPacked(["uint256"], [data.nodeIds.length]);
1789
- const nodeIdsBytes = ethers.solidityPacked(
1790
- Array(data.nodeIds.length).fill("bytes32"),
1791
- data.nodeIds
1792
- );
1793
- return ethers.solidityPacked(
1794
- ["bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
1795
- [
1796
- nodeIdsLength,
1797
- nodeIdsBytes,
1798
- data.signature,
1799
- data.messagePoint,
1800
- data.aaSignature,
1801
- data.messagePointSignature
1802
- ]
1803
- );
1804
- }
1805
- /**
1806
- * Calculate the MessagePoint G2 point for a given message (UserOpHash)
1807
- */
1808
- async generateMessagePoint(message) {
1809
- const messageBytes = typeof message === "string" ? ethers.getBytes(message) : message;
1810
- const DST = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
1811
- const messagePointBLS = await bls12_381.G2.hashToCurve(messageBytes, { DST });
1812
- const messageG2EIP = this.encodeG2Point(messagePointBLS);
1813
- return "0x" + Buffer.from(messageG2EIP).toString("hex");
1814
- }
1815
- /**
1816
- * Encode G2 Point to bytes for EIP-2537 format
1817
- */
1818
- encodeG2Point(point) {
1819
- const result = new Uint8Array(256);
1820
- const affine = point.toAffine();
1821
- const x0Bytes = this.hexToBytes(affine.x.c0.toString(16).padStart(96, "0"));
1822
- const x1Bytes = this.hexToBytes(affine.x.c1.toString(16).padStart(96, "0"));
1823
- const y0Bytes = this.hexToBytes(affine.y.c0.toString(16).padStart(96, "0"));
1824
- const y1Bytes = this.hexToBytes(affine.y.c1.toString(16).padStart(96, "0"));
1825
- result.set(x0Bytes, 16);
1826
- result.set(x1Bytes, 80);
1827
- result.set(y0Bytes, 144);
1828
- result.set(y1Bytes, 208);
1829
- return result;
1830
- }
1831
- hexToBytes(hex) {
1832
- if (hex.startsWith("0x")) hex = hex.slice(2);
1833
- const bytes = new Uint8Array(hex.length / 2);
1834
- for (let i = 0; i < hex.length; i += 2) {
1835
- bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
1836
- }
1837
- return bytes;
1838
- }
1839
- /**
1840
- * Pack cumulative Tier 2 signature (algId 0x04): P256 + BLS.
1841
- *
1842
- * Format:
1843
- * [algId=0x04 (1)] [P256 r (32)] [P256 s (32)]
1844
- * [nodeIdsLength (32)] [nodeIds (N×32)]
1845
- * [blsAggregateSig (256)] [messagePoint (256)]
1846
- * [messagePointECDSA (65)]
1847
- */
1848
- packCumulativeT2Signature(data) {
1849
- const nodeIdsLength = ethers.solidityPacked(["uint256"], [data.nodeIds.length]);
1850
- const nodeIdsBytes = ethers.solidityPacked(
1851
- Array(data.nodeIds.length).fill("bytes32"),
1852
- data.nodeIds
1853
- );
1854
- return ethers.solidityPacked(
1855
- ["bytes1", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
1856
- [
1857
- "0x04",
1858
- data.p256Signature,
1859
- nodeIdsLength,
1860
- nodeIdsBytes,
1861
- data.blsSignature,
1862
- data.messagePoint,
1863
- data.messagePointSignature
1864
- ]
1865
- );
1866
- }
1867
- /**
1868
- * Pack cumulative Tier 3 signature (algId 0x05): P256 + BLS + Guardian.
1869
- *
1870
- * Format:
1871
- * [algId=0x05 (1)] [P256 r (32)] [P256 s (32)]
1872
- * [nodeIdsLength (32)] [nodeIds (N×32)]
1873
- * [blsAggregateSig (256)] [messagePoint (256)]
1874
- * [messagePointECDSA (65)] [guardianECDSA (65)]
1875
- */
1876
- packCumulativeT3Signature(data) {
1877
- const nodeIdsLength = ethers.solidityPacked(["uint256"], [data.nodeIds.length]);
1878
- const nodeIdsBytes = ethers.solidityPacked(
1879
- Array(data.nodeIds.length).fill("bytes32"),
1880
- data.nodeIds
1881
- );
1882
- return ethers.solidityPacked(
1883
- ["bytes1", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
1884
- [
1885
- "0x05",
1886
- data.p256Signature,
1887
- nodeIdsLength,
1888
- nodeIdsBytes,
1889
- data.blsSignature,
1890
- data.messagePoint,
1891
- data.messagePointSignature,
1892
- data.guardianSignature
1893
- ]
1894
- );
1895
- }
1896
- /**
1897
- * Request signature from a single node
1898
- */
1899
- async requestNodeSignature(node, message) {
1900
- const response = await axios.post(`${node.apiEndpoint}/signature/sign`, {
1901
- message
1902
- });
1903
- const signatureEIP = response.data.signature;
1904
- const signature = response.data.signatureCompact || signatureEIP;
1905
- return {
1906
- signature: signature.startsWith("0x") ? signature : `0x${signature}`,
1907
- publicKey: response.data.publicKey
1908
- };
1909
- }
1910
- /**
1911
- * Request aggregation from a node
1912
- */
1913
- async aggregateSignatures(node, signatures) {
1914
- const response = await axios.post(`${node.apiEndpoint}/signature/aggregate`, {
1915
- signatures
1916
- });
1917
- const sig = response.data.signature;
1918
- return sig.startsWith("0x") ? sig : `0x${sig}`;
1919
- }
1920
- };
1921
1657
  var DvtPendingConfirmationError = class extends Error {
1922
1658
  constructor(userOpHash, nodeEndpoint) {
1923
1659
  super(
@@ -2157,6 +1893,8 @@ var TokenService = class {
2157
1893
  }
2158
1894
  }
2159
1895
  };
1896
+
1897
+ // ../airaccount/src/server/services/wallet-manager.ts
2160
1898
  var WalletManager = class {
2161
1899
  constructor(signer) {
2162
1900
  this.signer = signer;
@@ -2171,6 +1909,8 @@ var WalletManager = class {
2171
1909
  return this.signer.ensureSigner(userId);
2172
1910
  }
2173
1911
  };
1912
+
1913
+ // ../airaccount/src/server/server-client.ts
2174
1914
  var YAAAServerClient = class {
2175
1915
  ethereum;
2176
1916
  accounts;
@@ -2678,27 +2418,6 @@ async function isOapdDeployed(provider, config) {
2678
2418
  const code = await provider.getCode(address);
2679
2419
  return code !== "0x";
2680
2420
  }
2681
- var ALG_BLS = 1;
2682
- var ALG_ECDSA = 2;
2683
- var ALG_P256 = 3;
2684
- var ALG_CUMULATIVE_T2 = 4;
2685
- var ALG_CUMULATIVE_T3 = 5;
2686
- function resolveTier(value, config) {
2687
- if (config.tier1Limit === 0n && config.tier2Limit === 0n) return 1;
2688
- if (config.tier1Limit > 0n && value <= config.tier1Limit) return 1;
2689
- if (config.tier2Limit > 0n && value <= config.tier2Limit) return 2;
2690
- return 3;
2691
- }
2692
- function algIdForTier(tier) {
2693
- switch (tier) {
2694
- case 1:
2695
- return ALG_ECDSA;
2696
- case 2:
2697
- return ALG_CUMULATIVE_T2;
2698
- case 3:
2699
- return ALG_CUMULATIVE_T3;
2700
- }
2701
- }
2702
2421
  var ALG_NAMES = {
2703
2422
  [ALG_BLS]: "BLS (0x01)",
2704
2423
  [ALG_ECDSA]: "ECDSA (0x02)",
@@ -3647,6 +3366,21 @@ var KmsHttpClient = class {
3647
3366
  });
3648
3367
  }
3649
3368
  };
3369
+
3370
+ // ../../node_modules/.pnpm/@noble+curves@2.0.1/node_modules/@noble/curves/nist.js
3371
+ var p256_CURVE = /* @__PURE__ */ (() => ({
3372
+ p: BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),
3373
+ n: BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),
3374
+ h: BigInt(1),
3375
+ a: BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),
3376
+ b: BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),
3377
+ Gx: BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),
3378
+ Gy: BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")
3379
+ }))();
3380
+ var p256_Point = /* @__PURE__ */ weierstrass(p256_CURVE);
3381
+ var p256 = /* @__PURE__ */ ecdsa(p256_Point, sha256);
3382
+
3383
+ // ../airaccount/src/server/services/webauthn-ceremony.ts
3650
3384
  var DEFAULT_RP_ID = "aastar.io";
3651
3385
  var DEFAULT_ORIGIN = "https://aastar.io";
3652
3386
  var DEFAULT_CREDENTIAL_ID = "dGVzdC1jcmVkZW50aWFs";
@@ -3761,6 +3495,8 @@ function runGrantSessionCeremony(http, keyId, signer, options) {
3761
3495
  ...options
3762
3496
  });
3763
3497
  }
3498
+
3499
+ // ../airaccount/src/server/services/kms-signer.ts
3764
3500
  var KmsManager = class {
3765
3501
  client;
3766
3502
  logger;
@@ -4116,6 +3852,8 @@ var KmsSigner = class _KmsSigner extends ethers.AbstractSigner {
4116
3852
  );
4117
3853
  }
4118
3854
  };
3855
+
3856
+ // ../airaccount/src/server/services/kms-agent-service.ts
4119
3857
  var KmsAgentService = class {
4120
3858
  constructor(http) {
4121
3859
  this.http = http;
@@ -4205,6 +3943,8 @@ var KmsAgentService = class {
4205
3943
  return this.revokeAgentCredential({ ...params, webAuthnAssertion });
4206
3944
  }
4207
3945
  };
3946
+
3947
+ // ../airaccount/src/server/services/kms-session-service.ts
4208
3948
  var KmsSessionService = class {
4209
3949
  constructor(http) {
4210
3950
  this.http = http;
@@ -4280,6 +4020,8 @@ var KmsSessionService = class {
4280
4020
  return this.revokeP256SessionKey({ ...params, webAuthnAssertion });
4281
4021
  }
4282
4022
  };
4023
+
4024
+ // ../airaccount/src/server/services/kms-payment-signer.ts
4283
4025
  var KmsPaymentSigner = class {
4284
4026
  constructor(http) {
4285
4027
  this.http = http;
@@ -4321,6 +4063,8 @@ var KmsPaymentSigner = class {
4321
4063
  return this.signWithAuth("/kms/SignX402Payment", { ...params }, auth);
4322
4064
  }
4323
4065
  };
4066
+
4067
+ // ../airaccount/src/server/services/kms-monitor-service.ts
4324
4068
  var KmsMonitorService = class {
4325
4069
  constructor(http) {
4326
4070
  this.http = http;
@@ -4400,6 +4144,8 @@ var KmsMonitorService = class {
4400
4144
  return this.http.postWithBearer("/admin/purge-key", params, adminToken);
4401
4145
  }
4402
4146
  };
4147
+
4148
+ // ../airaccount/src/server/adapters/memory-storage.ts
4403
4149
  var MemoryStorage = class {
4404
4150
  accounts = [];
4405
4151
  transfers = [];
@@ -4495,5 +4241,5 @@ var LocalWalletSigner = class {
4495
4241
  */
4496
4242
 
4497
4243
  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 };
4498
- //# sourceMappingURL=chunk-WPSWFZKF.js.map
4499
- //# sourceMappingURL=chunk-WPSWFZKF.js.map
4244
+ //# sourceMappingURL=chunk-KISL64KW.js.map
4245
+ //# sourceMappingURL=chunk-KISL64KW.js.map