@aastar/sdk 0.24.0 → 0.24.1

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.
@@ -1111,7 +1111,7 @@ var AccountManager = class {
1111
1111
  );
1112
1112
  if (chunkMOJJ7QF6_cjs.needsValidatorRouter(config.approvedAlgIds)) {
1113
1113
  this.logger.log(
1114
- `[AccountManager] account ${accountAddress} approved a router-delegated algorithm (approvedAlgIds=[${config.approvedAlgIds.join(", ")}]); call ensureValidatorRouter(userId) AFTER the account is deployed to wire setValidator(router) \u2014 required for those algIds to validate.`
1114
+ `[AccountManager] account ${accountAddress} approved a router-delegated algorithm (approvedAlgIds=[${config.approvedAlgIds.join(", ")}]); use deployAndWireValidator(userId, { walletClient }) to deploy + setValidator(router) in one call (or ensureValidatorRouter(userId) after a manual deploy) \u2014 required for those algIds to validate.`
1115
1115
  );
1116
1116
  }
1117
1117
  return account;
@@ -1185,6 +1185,54 @@ var AccountManager = class {
1185
1185
  );
1186
1186
  return { set: true, tx, router };
1187
1187
  }
1188
+ /**
1189
+ * Gap B (complete auto-wiring): deploy a router-delegated account AND set its validator router in
1190
+ * ONE call, so a BLS / cumulative / session-key account is immediately functional — no separate
1191
+ * manual `ensureValidatorRouter` step. The factory's lazy first-UserOp deploy cannot bootstrap such
1192
+ * an account (its own algorithm can't validate until the router is wired), so this performs an
1193
+ * explicit `factory.createAccount(owner, salt, config)` deploy (if the account has no code yet),
1194
+ * waits for it, then wires `setValidator(router)`. Both txs go through the caller-supplied owner/
1195
+ * deployer `WalletClient` (this manager holds no transaction signer). For inline algIds (ECDSA/P256/
1196
+ * COMBINED_T1) the validator step is a documented no-op.
1197
+ *
1198
+ * @returns `{ deployTx?, validator }` — `deployTx` is undefined if the account was already deployed.
1199
+ */
1200
+ async deployAndWireValidator(userId, opts) {
1201
+ const account = await this.storage.findAccountByUserId(userId);
1202
+ if (!account) throw new Error("Account not found");
1203
+ const walletClient = opts.walletClient;
1204
+ if (!walletClient || !walletClient.account) {
1205
+ throw new Error("deployAndWireValidator: a walletClient (deployer/owner) is required");
1206
+ }
1207
+ let deployTx;
1208
+ let code = "0x";
1209
+ try {
1210
+ code = await this.ethereum.getProvider().getCode({ address: account.address }) ?? "0x";
1211
+ } catch {
1212
+ }
1213
+ if (!code || code === "0x") {
1214
+ const config = initConfigFromRecord(account);
1215
+ deployTx = await chunkMOJJ7QF6_cjs.airAccountFactoryActions(account.factoryAddress)(walletClient).createAccount({
1216
+ owner: account.signerAddress,
1217
+ salt: BigInt(account.salt),
1218
+ config,
1219
+ account: walletClient.account
1220
+ });
1221
+ await this.ethereum.getProvider().waitForTransactionReceipt({ hash: deployTx });
1222
+ account.deployed = true;
1223
+ account.deploymentTxHash = deployTx;
1224
+ await this.storage.saveAccount(account);
1225
+ this.logger.log(`[AccountManager] deployed account ${account.address} (tx ${deployTx})`);
1226
+ }
1227
+ const validator = await this.ensureValidatorRouter(userId, {
1228
+ walletClient,
1229
+ router: opts.router
1230
+ });
1231
+ if (validator.set && validator.tx) {
1232
+ await this.ethereum.getProvider().waitForTransactionReceipt({ hash: validator.tx });
1233
+ }
1234
+ return { deployTx, validator };
1235
+ }
1188
1236
  };
1189
1237
  var EXECUTE_USER_OP_SELECTOR = chunkXQROKLZI_cjs.selectorFromId(
1190
1238
  "executeUserOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes),bytes32)"
@@ -5047,5 +5095,5 @@ exports.serializeGuardianSpecs = serializeGuardianSpecs;
5047
5095
  exports.toGuardianSpecs = toGuardianSpecs;
5048
5096
  exports.validateConfig = validateConfig;
5049
5097
  exports.wrapExecuteUserOp = wrapExecuteUserOp;
5050
- //# sourceMappingURL=chunk-Y5U7URNZ.cjs.map
5051
- //# sourceMappingURL=chunk-Y5U7URNZ.cjs.map
5098
+ //# sourceMappingURL=chunk-VEAYV52I.cjs.map
5099
+ //# sourceMappingURL=chunk-VEAYV52I.cjs.map