@aastar/sdk 0.23.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.
- package/dist/UserClient-KYDCMAIU.js +6 -0
- package/dist/{UserClient-XTHQ2AP3.js.map → UserClient-KYDCMAIU.js.map} +1 -1
- package/dist/UserClient-S6LS3CB6.cjs +15 -0
- package/dist/{UserClient-J3JPDIG7.cjs.map → UserClient-S6LS3CB6.cjs.map} +1 -1
- package/dist/account.cjs +7 -7
- package/dist/account.js +2 -2
- package/dist/admin.cjs +3 -3
- package/dist/admin.js +2 -2
- package/dist/airaccount.cjs +102 -102
- package/dist/airaccount.js +2 -2
- package/dist/channel.cjs +6 -6
- package/dist/channel.js +2 -2
- package/dist/{chunk-CGKPULZX.cjs → chunk-5PH5CSM7.cjs} +16 -16
- package/dist/{chunk-CGKPULZX.cjs.map → chunk-5PH5CSM7.cjs.map} +1 -1
- package/dist/{chunk-EZC7Q3SG.js → chunk-654GQ7G7.js} +3 -3
- package/dist/{chunk-EZC7Q3SG.js.map → chunk-654GQ7G7.js.map} +1 -1
- package/dist/{chunk-W4ENVPZH.cjs → chunk-72JZKARR.cjs} +6 -6
- package/dist/{chunk-W4ENVPZH.cjs.map → chunk-72JZKARR.cjs.map} +1 -1
- package/dist/{chunk-H5EQBNC6.js → chunk-7RVONA2R.js} +8 -8
- package/dist/{chunk-H5EQBNC6.js.map → chunk-7RVONA2R.js.map} +1 -1
- package/dist/{chunk-2GZMRCQW.cjs → chunk-A4ICWCHR.cjs} +5 -5
- package/dist/{chunk-2GZMRCQW.cjs.map → chunk-A4ICWCHR.cjs.map} +1 -1
- package/dist/{chunk-6PJAHZZ2.cjs → chunk-BOVDJSMK.cjs} +26 -26
- package/dist/{chunk-6PJAHZZ2.cjs.map → chunk-BOVDJSMK.cjs.map} +1 -1
- package/dist/{chunk-5G5SB6CP.js → chunk-BYVG7MO7.js} +34 -3
- package/dist/chunk-BYVG7MO7.js.map +1 -0
- package/dist/{chunk-E37CPC2U.cjs → chunk-D667CUUS.cjs} +9 -9
- package/dist/{chunk-E37CPC2U.cjs.map → chunk-D667CUUS.cjs.map} +1 -1
- package/dist/{chunk-PFMCPSS4.js → chunk-DAMWXGKD.js} +3 -3
- package/dist/{chunk-PFMCPSS4.js.map → chunk-DAMWXGKD.js.map} +1 -1
- package/dist/{chunk-XFJSY5LG.cjs → chunk-GDH4DSVM.cjs} +12 -12
- package/dist/{chunk-XFJSY5LG.cjs.map → chunk-GDH4DSVM.cjs.map} +1 -1
- package/dist/{chunk-UULR2KA6.cjs → chunk-HNJBQR5U.cjs} +5 -5
- package/dist/{chunk-UULR2KA6.cjs.map → chunk-HNJBQR5U.cjs.map} +1 -1
- package/dist/{chunk-2DDWYKF2.js → chunk-JMW5AHLC.js} +9 -9
- package/dist/{chunk-2DDWYKF2.js.map → chunk-JMW5AHLC.js.map} +1 -1
- package/dist/{chunk-D23CZFOM.js → chunk-LDARLWS3.js} +3 -3
- package/dist/{chunk-D23CZFOM.js.map → chunk-LDARLWS3.js.map} +1 -1
- package/dist/{chunk-MFBTMF5U.cjs → chunk-MOJJ7QF6.cjs} +39 -2
- package/dist/{chunk-MFBTMF5U.cjs.map → chunk-MOJJ7QF6.cjs.map} +1 -1
- package/dist/{chunk-6I22EW6V.cjs → chunk-NVYVTCHJ.cjs} +11 -11
- package/dist/{chunk-6I22EW6V.cjs.map → chunk-NVYVTCHJ.cjs.map} +1 -1
- package/dist/{chunk-SXLWFZFX.js → chunk-PNBK2CLK.js} +3 -3
- package/dist/{chunk-SXLWFZFX.js.map → chunk-PNBK2CLK.js.map} +1 -1
- package/dist/{chunk-2UDF62XV.js → chunk-PXQDAFXD.js} +6 -6
- package/dist/{chunk-2UDF62XV.js.map → chunk-PXQDAFXD.js.map} +1 -1
- package/dist/{chunk-2WBSYPUY.js → chunk-RZ2M2RVP.js} +3 -3
- package/dist/{chunk-2WBSYPUY.js.map → chunk-RZ2M2RVP.js.map} +1 -1
- package/dist/{chunk-PKYWLTIJ.cjs → chunk-VHY6R2PI.cjs} +32 -32
- package/dist/{chunk-PKYWLTIJ.cjs.map → chunk-VHY6R2PI.cjs.map} +1 -1
- package/dist/{chunk-UMTCWOQV.js → chunk-WC25H5VG.js} +4 -4
- package/dist/{chunk-UMTCWOQV.js.map → chunk-WC25H5VG.js.map} +1 -1
- package/dist/{chunk-TM2LH4ZE.js → chunk-WVJ4LQVB.js} +3 -3
- package/dist/{chunk-TM2LH4ZE.js.map → chunk-WVJ4LQVB.js.map} +1 -1
- package/dist/{chunk-UQMMEDHO.cjs → chunk-WVOJV4Q5.cjs} +4 -4
- package/dist/{chunk-UQMMEDHO.cjs.map → chunk-WVOJV4Q5.cjs.map} +1 -1
- package/dist/{chunk-LAZA3JD7.cjs → chunk-Y5U7URNZ.cjs} +83 -5
- package/dist/chunk-Y5U7URNZ.cjs.map +1 -0
- package/dist/{chunk-V65JXHM6.js → chunk-YUFQIYLR.js} +83 -5
- package/dist/chunk-YUFQIYLR.js.map +1 -0
- package/dist/core.cjs +226 -202
- package/dist/core.d.cts +101 -1
- package/dist/core.d.ts +101 -1
- package/dist/core.js +1 -1
- package/dist/dapp.cjs +5 -5
- package/dist/dapp.js +2 -2
- package/dist/enduser.cjs +6 -6
- package/dist/enduser.js +3 -3
- package/dist/identity.cjs +5 -5
- package/dist/identity.js +2 -2
- package/dist/index.cjs +327 -303
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -15
- package/dist/kms.cjs +102 -102
- package/dist/kms.d.cts +41 -1
- package/dist/kms.d.ts +41 -1
- package/dist/kms.js +2 -2
- package/dist/operator.cjs +6 -6
- package/dist/operator.js +2 -2
- package/dist/paymaster.cjs +15 -15
- package/dist/paymaster.js +2 -2
- package/dist/src-5URXSFKD.js +5 -0
- package/dist/src-5URXSFKD.js.map +1 -0
- package/dist/{src-HECKBVR2.cjs → src-72GWEAPA.cjs} +17 -17
- package/dist/src-72GWEAPA.cjs.map +1 -0
- package/dist/{src-4Q2WFLO2.cjs → src-N72HAQXS.cjs} +228 -204
- package/dist/src-N72HAQXS.cjs.map +1 -0
- package/dist/{src-KLP4Q2Y3.js → src-UNS5B7FX.js} +4 -4
- package/dist/src-UNS5B7FX.js.map +1 -0
- package/dist/tokens.cjs +3 -3
- package/dist/tokens.js +2 -2
- package/dist/x402.cjs +25 -25
- package/dist/x402.js +2 -2
- package/package.json +1 -1
- package/dist/UserClient-J3JPDIG7.cjs +0 -15
- package/dist/UserClient-XTHQ2AP3.js +0 -6
- package/dist/chunk-5G5SB6CP.js.map +0 -1
- package/dist/chunk-LAZA3JD7.cjs.map +0 -1
- package/dist/chunk-V65JXHM6.js.map +0 -1
- package/dist/src-2P72LYVT.js +0 -5
- package/dist/src-2P72LYVT.js.map +0 -1
- package/dist/src-4Q2WFLO2.cjs.map +0 -1
- package/dist/src-HECKBVR2.cjs.map +0 -1
- package/dist/src-KLP4Q2Y3.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { selectorFromId, keccak256, solidityPacked, ERC4337Utils, BLSManager, resolveTier, algIdForTier, encodeAbiParams, ecdsa, ALG_CUMULATIVE_T3, ALG_CUMULATIVE_T2, ALG_P256, ALG_ECDSA, ALG_BLS, weierstrass, sha256 } from './chunk-X3AMH53O.js';
|
|
2
|
-
import { buildInitConfig } from './chunk-
|
|
3
|
-
import { CANONICAL_ADDRESSES } from './chunk-UCLK6LTB.js';
|
|
4
|
-
import { parseAbi, createPublicClient, http, getContract, formatEther, parseUnits, parseEther, encodeFunctionData, concat, numberToHex,
|
|
2
|
+
import { buildInitConfig, needsValidatorRouter, airAccountActions } from './chunk-BYVG7MO7.js';
|
|
3
|
+
import { CANONICAL_ADDRESSES, getCanonicalAddresses } from './chunk-UCLK6LTB.js';
|
|
4
|
+
import { parseAbi, createPublicClient, http, getContract, formatEther, parseUnits, parseEther, encodeFunctionData, zeroAddress, concat, numberToHex, hexToBytes, formatUnits, encodeAbiParameters, keccak256 as keccak256$1, hashMessage as hashMessage$1, toRlp, concatHex, recoverAddress as recoverAddress$1 } from 'viem';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { createHash } from 'crypto';
|
|
7
7
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
@@ -465,6 +465,10 @@ var EthereumProvider = class {
|
|
|
465
465
|
getBundlerProvider() {
|
|
466
466
|
return this.bundlerProvider;
|
|
467
467
|
}
|
|
468
|
+
/** EVM chain id from the validated ServerConfig (deterministic — no RPC round-trip). */
|
|
469
|
+
getChainId() {
|
|
470
|
+
return this.config.chainId;
|
|
471
|
+
}
|
|
468
472
|
/**
|
|
469
473
|
* Raw bundler JSON-RPC call. The bundler exposes non-standard methods
|
|
470
474
|
* (eth_sendUserOperation, pimlico_getUserOperationGasPrice, ...) that are not in
|
|
@@ -1099,8 +1103,82 @@ var AccountManager = class {
|
|
|
1099
1103
|
this.logger.log(
|
|
1100
1104
|
`[AccountManager] account created with ${params.p256Guardians.length} P-256 guardian(s): ${accountAddress}`
|
|
1101
1105
|
);
|
|
1106
|
+
if (needsValidatorRouter(config.approvedAlgIds)) {
|
|
1107
|
+
this.logger.log(
|
|
1108
|
+
`[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.`
|
|
1109
|
+
);
|
|
1110
|
+
}
|
|
1102
1111
|
return account;
|
|
1103
1112
|
}
|
|
1113
|
+
/**
|
|
1114
|
+
* Gap B — wire the validator router for an account that approved a ROUTER-DELEGATED signature
|
|
1115
|
+
* algorithm (BLS 0x01, cumulative T2 0x04, T3 0x05, weighted 0x07, session 0x08, ...). Such an
|
|
1116
|
+
* account's `_validateTripleSignature` / `_callBLSValidator` return `1` (FAIL) while
|
|
1117
|
+
* `validator() == address(0)`, so the algorithm is non-functional until the owner calls
|
|
1118
|
+
* `setValidator(router)` (onlyOwner, SET-ONCE). Inline algIds (ECDSA 0x02, P256 0x03, COMBINED_T1
|
|
1119
|
+
* 0x06) need no router and are a no-op here.
|
|
1120
|
+
*
|
|
1121
|
+
* MUST be called AFTER the account is deployed (setValidator is onlyOwner and needs code) — the
|
|
1122
|
+
* lazy/counterfactual deploy path cannot setValidator at predict-time. Idempotent: re-running after
|
|
1123
|
+
* the validator is set is a no-op (`reason: 'validator already set'`).
|
|
1124
|
+
*
|
|
1125
|
+
* On-chain access matches the rest of this package: reads via the EthereumProvider's PublicClient
|
|
1126
|
+
* (`getAccountContract(...).read.validator()` and `getProvider().getCode()`); the state-changing
|
|
1127
|
+
* `setValidator` is sent through a caller-supplied `WalletClient` whose account is the owner —
|
|
1128
|
+
* the same convention used by `PaymasterManager.updatePrice` / `ForceExitService` (this manager's
|
|
1129
|
+
* narrow `ISignerAdapter` only EIP-191 personal-signs and cannot send transactions).
|
|
1130
|
+
*
|
|
1131
|
+
* @param userId the account owner's user id (storage key)
|
|
1132
|
+
* @param opts.router override the router address (defaults to the chain's canonical
|
|
1133
|
+
* `aaStarValidator`); pass to target a non-canonical router
|
|
1134
|
+
* @param opts.walletClient viem WalletClient signing as the account OWNER — REQUIRED to send the tx
|
|
1135
|
+
*/
|
|
1136
|
+
async ensureValidatorRouter(userId, opts) {
|
|
1137
|
+
const account = await this.storage.findAccountByUserId(userId);
|
|
1138
|
+
if (!account) throw new Error("Account not found");
|
|
1139
|
+
const approvedAlgIds = account.approvedAlgIds;
|
|
1140
|
+
if (!approvedAlgIds || approvedAlgIds.length === 0) {
|
|
1141
|
+
return { set: false, reason: "no approvedAlgIds / not router-delegated" };
|
|
1142
|
+
}
|
|
1143
|
+
if (!needsValidatorRouter(approvedAlgIds)) {
|
|
1144
|
+
return { set: false, reason: "no router-delegated algorithm" };
|
|
1145
|
+
}
|
|
1146
|
+
const chainId = this.ethereum.getChainId();
|
|
1147
|
+
const canonicalRouter = getCanonicalAddresses(chainId)?.aaStarValidator;
|
|
1148
|
+
const router = opts?.router ?? canonicalRouter;
|
|
1149
|
+
if (!router || router.toLowerCase() === zeroAddress) {
|
|
1150
|
+
return { set: false, reason: `no canonical validator router for chain ${chainId}` };
|
|
1151
|
+
}
|
|
1152
|
+
let deployed = false;
|
|
1153
|
+
try {
|
|
1154
|
+
const code = await this.ethereum.getProvider().getCode({ address: account.address });
|
|
1155
|
+
deployed = !!code && code !== "0x";
|
|
1156
|
+
} catch {
|
|
1157
|
+
}
|
|
1158
|
+
if (!deployed) {
|
|
1159
|
+
return { set: false, reason: "account not deployed yet \u2014 call after deploy" };
|
|
1160
|
+
}
|
|
1161
|
+
const current = await this.ethereum.getAccountContract(account.address).read.validator([]);
|
|
1162
|
+
if (current && current.toLowerCase() !== zeroAddress) {
|
|
1163
|
+
return { set: false, reason: "validator already set" };
|
|
1164
|
+
}
|
|
1165
|
+
const walletClient = opts?.walletClient;
|
|
1166
|
+
if (!walletClient || !walletClient.account) {
|
|
1167
|
+
return {
|
|
1168
|
+
set: false,
|
|
1169
|
+
reason: "walletClient (account owner) required to send setValidator",
|
|
1170
|
+
router
|
|
1171
|
+
};
|
|
1172
|
+
}
|
|
1173
|
+
const tx = await airAccountActions(account.address)(walletClient).setValidator({
|
|
1174
|
+
validator: router,
|
|
1175
|
+
account: walletClient.account
|
|
1176
|
+
});
|
|
1177
|
+
this.logger.log(
|
|
1178
|
+
`[AccountManager] setValidator(${router}) sent for account ${account.address} (tx ${tx})`
|
|
1179
|
+
);
|
|
1180
|
+
return { set: true, tx, router };
|
|
1181
|
+
}
|
|
1104
1182
|
};
|
|
1105
1183
|
var EXECUTE_USER_OP_SELECTOR = selectorFromId(
|
|
1106
1184
|
"executeUserOp((address,uint256,bytes,bytes,bytes32,uint256,bytes32,bytes,bytes),bytes32)"
|
|
@@ -4864,5 +4942,5 @@ var LocalWalletSigner = class {
|
|
|
4864
4942
|
*/
|
|
4865
4943
|
|
|
4866
4944
|
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, buildFullInitConfig, buildInstallModuleHash, buildUninstallModuleHash, computeOapdSalt, erc8004AddressesForChain, getOapdAddress, getOapdAddressWithChainId, initConfigFromRecord, initConfigToTuple, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, serializeGuardianSpecs, toGuardianSpecs, validateConfig, wrapExecuteUserOp };
|
|
4867
|
-
//# sourceMappingURL=chunk-
|
|
4868
|
-
//# sourceMappingURL=chunk-
|
|
4945
|
+
//# sourceMappingURL=chunk-YUFQIYLR.js.map
|
|
4946
|
+
//# sourceMappingURL=chunk-YUFQIYLR.js.map
|