@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.
- package/dist/BaseClient-BjbYP0cf.d.ts +88 -0
- package/dist/UserClient-AIIHB54I.js +6 -0
- package/dist/{UserClient-UYIHF6UJ.js.map → UserClient-AIIHB54I.js.map} +1 -1
- package/dist/account.d.ts +48 -1
- package/dist/account.js +3 -3
- package/dist/admin.d.ts +62 -1
- package/dist/admin.js +3 -3
- package/dist/airaccount.d.ts +4 -2
- package/dist/airaccount.js +2 -2
- package/dist/channel-CkRRbzT8.d.ts +77 -0
- package/dist/channel.d.ts +64 -1
- package/dist/channel.js +3 -3
- package/dist/{chunk-FBDMID2J.js → chunk-4EZD7LPE.js} +30 -24
- package/dist/chunk-4EZD7LPE.js.map +1 -0
- package/dist/{chunk-TIH7D4FQ.js → chunk-6QYXGMCR.js} +513 -322
- package/dist/chunk-6QYXGMCR.js.map +1 -0
- package/dist/{chunk-6UHVUGDT.js → chunk-7ARJ3OSU.js} +29 -21
- package/dist/chunk-7ARJ3OSU.js.map +1 -0
- package/dist/{chunk-VYU6P7HB.js → chunk-BN5WY5GM.js} +16 -14
- package/dist/chunk-BN5WY5GM.js.map +1 -0
- package/dist/{chunk-ZFIKBDBT.js → chunk-FJ7XECC5.js} +4 -4
- package/dist/chunk-FJ7XECC5.js.map +1 -0
- package/dist/{chunk-NRH56SAJ.js → chunk-G3UJC4EL.js} +6 -7
- package/dist/chunk-G3UJC4EL.js.map +1 -0
- package/dist/{chunk-QJT4IOIS.js → chunk-KDH3UPKD.js} +10 -13
- package/dist/chunk-KDH3UPKD.js.map +1 -0
- package/dist/{chunk-ZGOEADCO.js → chunk-LXWIPTPX.js} +5 -5
- package/dist/chunk-LXWIPTPX.js.map +1 -0
- package/dist/{chunk-I3VRFZA4.js → chunk-MVEWJIPY.js} +124 -110
- package/dist/chunk-MVEWJIPY.js.map +1 -0
- package/dist/{chunk-FIS3RUGL.js → chunk-PAABYXS6.js} +33 -40
- package/dist/chunk-PAABYXS6.js.map +1 -0
- package/dist/{chunk-HNTLDUL7.js → chunk-PKCHRXFR.js} +8 -12
- package/dist/chunk-PKCHRXFR.js.map +1 -0
- package/dist/{chunk-42KVVOOU.js → chunk-TENYCMJ3.js} +31 -31
- package/dist/chunk-TENYCMJ3.js.map +1 -0
- package/dist/{chunk-WPSWFZKF.js → chunk-UIFMIVDK.js} +1033 -937
- package/dist/chunk-UIFMIVDK.js.map +1 -0
- package/dist/{chunk-4KRQXOTI.js → chunk-X3AMH53O.js} +248 -195
- package/dist/chunk-X3AMH53O.js.map +1 -0
- package/dist/{contract-addresses-ADEWLDHE.js → contract-addresses-N3TOL2WL.js} +3 -3
- package/dist/{contract-addresses-ADEWLDHE.js.map → contract-addresses-N3TOL2WL.js.map} +1 -1
- package/dist/core.d.ts +6930 -13
- package/dist/core.js +2 -2
- package/dist/dapp.d.ts +127 -1
- package/dist/dapp.js +12 -13
- package/dist/dapp.js.map +1 -1
- package/dist/doc-types-471vSmPO.d.ts +16 -0
- package/dist/enduser.d.ts +261 -1
- package/dist/enduser.js +4 -4
- package/dist/identity.d.ts +81 -1
- package/dist/identity.js +3 -3
- package/dist/index-B6SfEQxo.d.ts +47 -0
- package/dist/index.d.ts +59 -15
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/kms.d.ts +3054 -2
- package/dist/kms.js +2 -2
- package/dist/operator.d.ts +164 -1
- package/dist/operator.js +3 -3
- package/dist/paymaster.d.ts +312 -1
- package/dist/paymaster.js +3 -3
- package/dist/{index.node-KIKM4EG6.js → src-L5SI5WNB.js} +4 -4
- package/dist/src-L5SI5WNB.js.map +1 -0
- package/dist/{dist-GVWCRI4F.js → src-X5MIV3EB.js} +5 -5
- package/dist/src-X5MIV3EB.js.map +1 -0
- package/dist/tier-router-DeeVg69O.d.ts +370 -0
- package/dist/tokens.d.ts +64 -1
- package/dist/tokens.js +3 -3
- package/dist/x402.d.ts +373 -1
- package/dist/x402.js +3 -3
- package/package.json +1 -2
- package/dist/UserClient-UYIHF6UJ.js +0 -6
- package/dist/chunk-42KVVOOU.js.map +0 -1
- package/dist/chunk-4KRQXOTI.js.map +0 -1
- package/dist/chunk-6UHVUGDT.js.map +0 -1
- package/dist/chunk-FBDMID2J.js.map +0 -1
- package/dist/chunk-FIS3RUGL.js.map +0 -1
- package/dist/chunk-HNTLDUL7.js.map +0 -1
- package/dist/chunk-I3VRFZA4.js.map +0 -1
- package/dist/chunk-NRH56SAJ.js.map +0 -1
- package/dist/chunk-QJT4IOIS.js.map +0 -1
- package/dist/chunk-TIH7D4FQ.js.map +0 -1
- package/dist/chunk-VYU6P7HB.js.map +0 -1
- package/dist/chunk-WPSWFZKF.js.map +0 -1
- package/dist/chunk-ZFIKBDBT.js.map +0 -1
- package/dist/chunk-ZGOEADCO.js.map +0 -1
- package/dist/dist-GVWCRI4F.js.map +0 -1
- package/dist/index.node-KIKM4EG6.js.map +0 -1
|
@@ -1,26 +1,102 @@
|
|
|
1
1
|
import { __export } from './chunk-PZ5AY32C.js';
|
|
2
2
|
import axios2 from 'axios';
|
|
3
3
|
import { startRegistration, startAuthentication } from '@simplewebauthn/browser';
|
|
4
|
-
import {
|
|
4
|
+
import { parseAbiParameters, encodeAbiParameters, keccak256 as keccak256$1, encodePacked, hexToBytes as hexToBytes$1, bytesToHex as bytesToHex$1, numberToHex, stringToBytes } from 'viem';
|
|
5
5
|
import * as crypto from 'crypto';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
var DEFAULT_PASSKEY_ROUTES = {
|
|
8
|
+
registerBegin: "/auth/passkey/register/begin",
|
|
9
|
+
registerComplete: "/auth/passkey/register/complete",
|
|
10
|
+
loginBegin: "/auth/passkey/login/begin",
|
|
11
|
+
loginComplete: "/auth/passkey/login/complete",
|
|
12
|
+
deviceBegin: "/auth/device/passkey/begin",
|
|
13
|
+
deviceComplete: "/auth/device/passkey/complete",
|
|
14
|
+
transactionVerifyBegin: "/auth/transaction/verify/begin"
|
|
15
|
+
};
|
|
16
|
+
var PasskeyManager = class {
|
|
17
|
+
api;
|
|
18
|
+
routes;
|
|
19
|
+
constructor(baseURL, tokenProvider, routes) {
|
|
20
|
+
this.routes = { ...DEFAULT_PASSKEY_ROUTES, ...routes };
|
|
21
|
+
this.api = axios2.create({
|
|
22
|
+
baseURL,
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": "application/json"
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (tokenProvider) {
|
|
28
|
+
this.api.interceptors.request.use((config) => {
|
|
29
|
+
const token = tokenProvider();
|
|
30
|
+
if (token) {
|
|
31
|
+
config.headers.Authorization = `Bearer ${token}`;
|
|
32
|
+
}
|
|
33
|
+
return config;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Complete Passkey Registration Flow
|
|
39
|
+
*/
|
|
40
|
+
async register(params) {
|
|
41
|
+
const beginResponse = await this.api.post(
|
|
42
|
+
this.routes.registerBegin,
|
|
43
|
+
params
|
|
44
|
+
);
|
|
45
|
+
const credential = await startRegistration(beginResponse.data);
|
|
46
|
+
const completeResponse = await this.api.post(this.routes.registerComplete, {
|
|
47
|
+
email: params.email,
|
|
48
|
+
username: params.username,
|
|
49
|
+
password: params.password,
|
|
50
|
+
credential
|
|
51
|
+
});
|
|
52
|
+
return completeResponse.data;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Complete Passkey Login/Authentication Flow
|
|
56
|
+
*/
|
|
57
|
+
async authenticate(params) {
|
|
58
|
+
const beginResponse = await this.api.post(
|
|
59
|
+
this.routes.loginBegin,
|
|
60
|
+
params
|
|
61
|
+
);
|
|
62
|
+
const credential = await startAuthentication(beginResponse.data);
|
|
63
|
+
const completeResponse = await this.api.post(this.routes.loginComplete, { credential });
|
|
64
|
+
return completeResponse.data;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Verify a transaction (Sign UserOpHash) with Passkey
|
|
68
|
+
* Returns the verification credential needed for the transaction
|
|
69
|
+
*/
|
|
70
|
+
async verifyTransaction(params) {
|
|
71
|
+
const beginResponse = await this.api.post(
|
|
72
|
+
this.routes.transactionVerifyBegin,
|
|
73
|
+
{ transaction: params }
|
|
74
|
+
);
|
|
75
|
+
const { userOpHash, ...authOptions } = beginResponse.data;
|
|
76
|
+
const credential = await startAuthentication(authOptions);
|
|
77
|
+
return {
|
|
78
|
+
credential,
|
|
79
|
+
userOpHash
|
|
80
|
+
// Return pre-calculated hash to ensure consistency
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Add a new device (Passkey) to existing account
|
|
85
|
+
*/
|
|
86
|
+
async addDevice(params) {
|
|
87
|
+
const beginResponse = await this.api.post(
|
|
88
|
+
this.routes.deviceBegin,
|
|
89
|
+
params
|
|
90
|
+
);
|
|
91
|
+
const credential = await startRegistration(beginResponse.data);
|
|
92
|
+
const completeResponse = await this.api.post(this.routes.deviceComplete, {
|
|
93
|
+
email: params.email,
|
|
94
|
+
password: params.password,
|
|
95
|
+
credential
|
|
96
|
+
});
|
|
97
|
+
return completeResponse.data.passkey;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
24
100
|
|
|
25
101
|
// ../../node_modules/.pnpm/@noble+hashes@2.0.1/node_modules/@noble/hashes/utils.js
|
|
26
102
|
function isBytes(a) {
|
|
@@ -3954,88 +4030,93 @@ function mapToG2(scalars) {
|
|
|
3954
4030
|
const { x, y } = G2_SWU(Fp2.fromBigTuple(scalars));
|
|
3955
4031
|
return isogenyMapG2(x, y);
|
|
3956
4032
|
}
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4033
|
+
|
|
4034
|
+
// ../airaccount/src/migration/viem/bls-packing.ts
|
|
4035
|
+
var BLS_DST = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
|
|
4036
|
+
function packSignature(data) {
|
|
4037
|
+
if (!data.nodeIds || !data.aaSignature || !data.messagePointSignature) {
|
|
4038
|
+
throw new Error("Missing required signature components");
|
|
4039
|
+
}
|
|
4040
|
+
const nodeIdsLength = encodePacked(["uint256"], [BigInt(data.nodeIds.length)]);
|
|
4041
|
+
const nodeIdsBytes = encodePacked(
|
|
4042
|
+
Array(data.nodeIds.length).fill("bytes32"),
|
|
4043
|
+
data.nodeIds
|
|
4044
|
+
);
|
|
4045
|
+
return encodePacked(
|
|
4046
|
+
["bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
|
|
4047
|
+
[
|
|
4048
|
+
nodeIdsLength,
|
|
4049
|
+
nodeIdsBytes,
|
|
4050
|
+
data.signature,
|
|
4051
|
+
data.messagePoint,
|
|
4052
|
+
data.aaSignature,
|
|
4053
|
+
data.messagePointSignature
|
|
4054
|
+
]
|
|
4055
|
+
);
|
|
4056
|
+
}
|
|
4057
|
+
function packCumulativeT2Signature(data) {
|
|
4058
|
+
const nodeIdsLength = encodePacked(["uint256"], [BigInt(data.nodeIds.length)]);
|
|
4059
|
+
const nodeIdsBytes = encodePacked(
|
|
4060
|
+
Array(data.nodeIds.length).fill("bytes32"),
|
|
4061
|
+
data.nodeIds
|
|
4062
|
+
);
|
|
4063
|
+
return encodePacked(
|
|
4064
|
+
["bytes1", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
|
|
4065
|
+
[
|
|
4066
|
+
"0x04",
|
|
4067
|
+
data.p256Signature,
|
|
4068
|
+
nodeIdsLength,
|
|
4069
|
+
nodeIdsBytes,
|
|
4070
|
+
data.blsSignature,
|
|
4071
|
+
data.messagePoint,
|
|
4072
|
+
data.messagePointSignature
|
|
4073
|
+
]
|
|
4074
|
+
);
|
|
4075
|
+
}
|
|
4076
|
+
function packCumulativeT3Signature(data) {
|
|
4077
|
+
const nodeIdsLength = encodePacked(["uint256"], [BigInt(data.nodeIds.length)]);
|
|
4078
|
+
const nodeIdsBytes = encodePacked(
|
|
4079
|
+
Array(data.nodeIds.length).fill("bytes32"),
|
|
4080
|
+
data.nodeIds
|
|
4081
|
+
);
|
|
4082
|
+
return encodePacked(
|
|
4083
|
+
["bytes1", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
|
|
4084
|
+
[
|
|
4085
|
+
"0x05",
|
|
4086
|
+
data.p256Signature,
|
|
4087
|
+
nodeIdsLength,
|
|
4088
|
+
nodeIdsBytes,
|
|
4089
|
+
data.blsSignature,
|
|
4090
|
+
data.messagePoint,
|
|
4091
|
+
data.messagePointSignature,
|
|
4092
|
+
data.guardianSignature
|
|
4093
|
+
]
|
|
4094
|
+
);
|
|
4095
|
+
}
|
|
4096
|
+
function encodeG2Point(point) {
|
|
4097
|
+
const result = new Uint8Array(256);
|
|
4098
|
+
const affine = point.toAffine();
|
|
4099
|
+
const x0Bytes = hexToBytes$1(numberToHex(affine.x.c0, { size: 48 }));
|
|
4100
|
+
const x1Bytes = hexToBytes$1(numberToHex(affine.x.c1, { size: 48 }));
|
|
4101
|
+
const y0Bytes = hexToBytes$1(numberToHex(affine.y.c0, { size: 48 }));
|
|
4102
|
+
const y1Bytes = hexToBytes$1(numberToHex(affine.y.c1, { size: 48 }));
|
|
4103
|
+
result.set(x0Bytes, 16);
|
|
4104
|
+
result.set(x1Bytes, 80);
|
|
4105
|
+
result.set(y0Bytes, 144);
|
|
4106
|
+
result.set(y1Bytes, 208);
|
|
4107
|
+
return result;
|
|
4108
|
+
}
|
|
4109
|
+
async function hashToCurve(messageBytes) {
|
|
4110
|
+
return bls12_381.G2.hashToCurve(messageBytes, { DST: BLS_DST });
|
|
4111
|
+
}
|
|
4112
|
+
async function generateMessagePoint(message) {
|
|
4113
|
+
const messageBytes = typeof message === "string" ? hexToBytes$1(message) : message;
|
|
4114
|
+
const messagePointBLS = await hashToCurve(messageBytes);
|
|
4115
|
+
const messageG2EIP = encodeG2Point(messagePointBLS);
|
|
4116
|
+
return bytesToHex$1(messageG2EIP);
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
// ../airaccount/src/core/bls/bls.manager.ts
|
|
4039
4120
|
var BLSManager = class {
|
|
4040
4121
|
config;
|
|
4041
4122
|
constructor(config) {
|
|
@@ -4075,59 +4156,13 @@ var BLSManager = class {
|
|
|
4075
4156
|
* Format: [nodeIdsLength][nodeIds...][blsSignature][messagePoint][aaSignature][messagePointSignature]
|
|
4076
4157
|
*/
|
|
4077
4158
|
packSignature(data) {
|
|
4078
|
-
|
|
4079
|
-
throw new Error("Missing required signature components");
|
|
4080
|
-
}
|
|
4081
|
-
const nodeIdsLength = ethers.solidityPacked(["uint256"], [data.nodeIds.length]);
|
|
4082
|
-
const nodeIdsBytes = ethers.solidityPacked(
|
|
4083
|
-
Array(data.nodeIds.length).fill("bytes32"),
|
|
4084
|
-
data.nodeIds
|
|
4085
|
-
);
|
|
4086
|
-
return ethers.solidityPacked(
|
|
4087
|
-
["bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
|
|
4088
|
-
[
|
|
4089
|
-
nodeIdsLength,
|
|
4090
|
-
nodeIdsBytes,
|
|
4091
|
-
data.signature,
|
|
4092
|
-
data.messagePoint,
|
|
4093
|
-
data.aaSignature,
|
|
4094
|
-
data.messagePointSignature
|
|
4095
|
-
]
|
|
4096
|
-
);
|
|
4159
|
+
return packSignature(data);
|
|
4097
4160
|
}
|
|
4098
4161
|
/**
|
|
4099
4162
|
* Calculate the MessagePoint G2 point for a given message (UserOpHash)
|
|
4100
4163
|
*/
|
|
4101
4164
|
async generateMessagePoint(message) {
|
|
4102
|
-
|
|
4103
|
-
const DST = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_";
|
|
4104
|
-
const messagePointBLS = await bls12_381.G2.hashToCurve(messageBytes, { DST });
|
|
4105
|
-
const messageG2EIP = this.encodeG2Point(messagePointBLS);
|
|
4106
|
-
return "0x" + Buffer.from(messageG2EIP).toString("hex");
|
|
4107
|
-
}
|
|
4108
|
-
/**
|
|
4109
|
-
* Encode G2 Point to bytes for EIP-2537 format
|
|
4110
|
-
*/
|
|
4111
|
-
encodeG2Point(point) {
|
|
4112
|
-
const result = new Uint8Array(256);
|
|
4113
|
-
const affine = point.toAffine();
|
|
4114
|
-
const x0Bytes = this.hexToBytes(affine.x.c0.toString(16).padStart(96, "0"));
|
|
4115
|
-
const x1Bytes = this.hexToBytes(affine.x.c1.toString(16).padStart(96, "0"));
|
|
4116
|
-
const y0Bytes = this.hexToBytes(affine.y.c0.toString(16).padStart(96, "0"));
|
|
4117
|
-
const y1Bytes = this.hexToBytes(affine.y.c1.toString(16).padStart(96, "0"));
|
|
4118
|
-
result.set(x0Bytes, 16);
|
|
4119
|
-
result.set(x1Bytes, 80);
|
|
4120
|
-
result.set(y0Bytes, 144);
|
|
4121
|
-
result.set(y1Bytes, 208);
|
|
4122
|
-
return result;
|
|
4123
|
-
}
|
|
4124
|
-
hexToBytes(hex) {
|
|
4125
|
-
if (hex.startsWith("0x")) hex = hex.slice(2);
|
|
4126
|
-
const bytes = new Uint8Array(hex.length / 2);
|
|
4127
|
-
for (let i = 0; i < hex.length; i += 2) {
|
|
4128
|
-
bytes[i / 2] = parseInt(hex.substr(i, 2), 16);
|
|
4129
|
-
}
|
|
4130
|
-
return bytes;
|
|
4165
|
+
return generateMessagePoint(message);
|
|
4131
4166
|
}
|
|
4132
4167
|
/**
|
|
4133
4168
|
* Pack cumulative Tier 2 signature (algId 0x04): P256 + BLS.
|
|
@@ -4139,23 +4174,7 @@ var BLSManager = class {
|
|
|
4139
4174
|
* [messagePointECDSA (65)]
|
|
4140
4175
|
*/
|
|
4141
4176
|
packCumulativeT2Signature(data) {
|
|
4142
|
-
|
|
4143
|
-
const nodeIdsBytes = ethers.solidityPacked(
|
|
4144
|
-
Array(data.nodeIds.length).fill("bytes32"),
|
|
4145
|
-
data.nodeIds
|
|
4146
|
-
);
|
|
4147
|
-
return ethers.solidityPacked(
|
|
4148
|
-
["bytes1", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
|
|
4149
|
-
[
|
|
4150
|
-
"0x04",
|
|
4151
|
-
data.p256Signature,
|
|
4152
|
-
nodeIdsLength,
|
|
4153
|
-
nodeIdsBytes,
|
|
4154
|
-
data.blsSignature,
|
|
4155
|
-
data.messagePoint,
|
|
4156
|
-
data.messagePointSignature
|
|
4157
|
-
]
|
|
4158
|
-
);
|
|
4177
|
+
return packCumulativeT2Signature(data);
|
|
4159
4178
|
}
|
|
4160
4179
|
/**
|
|
4161
4180
|
* Pack cumulative Tier 3 signature (algId 0x05): P256 + BLS + Guardian.
|
|
@@ -4167,24 +4186,7 @@ var BLSManager = class {
|
|
|
4167
4186
|
* [messagePointECDSA (65)] [guardianECDSA (65)]
|
|
4168
4187
|
*/
|
|
4169
4188
|
packCumulativeT3Signature(data) {
|
|
4170
|
-
|
|
4171
|
-
const nodeIdsBytes = ethers.solidityPacked(
|
|
4172
|
-
Array(data.nodeIds.length).fill("bytes32"),
|
|
4173
|
-
data.nodeIds
|
|
4174
|
-
);
|
|
4175
|
-
return ethers.solidityPacked(
|
|
4176
|
-
["bytes1", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes", "bytes"],
|
|
4177
|
-
[
|
|
4178
|
-
"0x05",
|
|
4179
|
-
data.p256Signature,
|
|
4180
|
-
nodeIdsLength,
|
|
4181
|
-
nodeIdsBytes,
|
|
4182
|
-
data.blsSignature,
|
|
4183
|
-
data.messagePoint,
|
|
4184
|
-
data.messagePointSignature,
|
|
4185
|
-
data.guardianSignature
|
|
4186
|
-
]
|
|
4187
|
-
);
|
|
4189
|
+
return packCumulativeT3Signature(data);
|
|
4188
4190
|
}
|
|
4189
4191
|
/**
|
|
4190
4192
|
* Request signature from a single node
|
|
@@ -4211,15 +4213,22 @@ var BLSManager = class {
|
|
|
4211
4213
|
return sig.startsWith("0x") ? sig : `0x${sig}`;
|
|
4212
4214
|
}
|
|
4213
4215
|
};
|
|
4214
|
-
|
|
4216
|
+
|
|
4217
|
+
// ../airaccount/src/client.ts
|
|
4218
|
+
var AirAccountClient = class {
|
|
4215
4219
|
constructor(config) {
|
|
4216
4220
|
this.config = config;
|
|
4217
|
-
this.passkey = new PasskeyManager(
|
|
4221
|
+
this.passkey = new PasskeyManager(
|
|
4222
|
+
config.apiURL,
|
|
4223
|
+
config.tokenProvider,
|
|
4224
|
+
config.passkeyRoutes
|
|
4225
|
+
);
|
|
4218
4226
|
this.bls = new BLSManager(config.bls);
|
|
4219
4227
|
}
|
|
4220
4228
|
passkey;
|
|
4221
4229
|
bls;
|
|
4222
4230
|
};
|
|
4231
|
+
var YAAAClient = AirAccountClient;
|
|
4223
4232
|
var CryptoUtil = class _CryptoUtil {
|
|
4224
4233
|
static ALGORITHM = "aes-256-gcm";
|
|
4225
4234
|
static KEY_LENGTH = 32;
|
|
@@ -4261,6 +4270,8 @@ var CryptoUtil = class _CryptoUtil {
|
|
|
4261
4270
|
return crypto.randomBytes(32).toString("hex");
|
|
4262
4271
|
}
|
|
4263
4272
|
};
|
|
4273
|
+
|
|
4274
|
+
// ../airaccount/src/core/erc4337/utils.ts
|
|
4264
4275
|
var ERC4337Utils = class _ERC4337Utils {
|
|
4265
4276
|
static packAccountGasLimits(verificationGasLimit, callGasLimit) {
|
|
4266
4277
|
const vgl = BigInt(verificationGasLimit);
|
|
@@ -4322,6 +4333,24 @@ var ERC4337Utils = class _ERC4337Utils {
|
|
|
4322
4333
|
};
|
|
4323
4334
|
}
|
|
4324
4335
|
};
|
|
4336
|
+
function encodeAbiParams(types, values) {
|
|
4337
|
+
const params = parseAbiParameters(types.join(", "));
|
|
4338
|
+
return encodeAbiParameters(params, values);
|
|
4339
|
+
}
|
|
4340
|
+
function solidityPacked(types, values) {
|
|
4341
|
+
return encodePacked(types, values);
|
|
4342
|
+
}
|
|
4343
|
+
function id(value) {
|
|
4344
|
+
return keccak256$1(stringToBytes(value));
|
|
4345
|
+
}
|
|
4346
|
+
function keccak256(data) {
|
|
4347
|
+
return keccak256$1(data);
|
|
4348
|
+
}
|
|
4349
|
+
function selectorFromId(signature) {
|
|
4350
|
+
return id(signature).slice(0, 10);
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4353
|
+
// ../airaccount/src/core/erc4337/userop.builder.ts
|
|
4325
4354
|
var UserOpBuilder = class _UserOpBuilder {
|
|
4326
4355
|
// Basic defaults
|
|
4327
4356
|
static DEFAULT_VERIFICATION_GAS_LIMIT = 100000n;
|
|
@@ -4358,33 +4387,37 @@ var UserOpBuilder = class _UserOpBuilder {
|
|
|
4358
4387
|
* Hash the UserOperation for signing (ERC-4337 v0.7)
|
|
4359
4388
|
*/
|
|
4360
4389
|
getUserOpHash(userOp, entryPoint, chainId) {
|
|
4361
|
-
const encoded =
|
|
4390
|
+
const encoded = encodeAbiParams(
|
|
4362
4391
|
["address", "uint256", "bytes32", "bytes32", "bytes32", "uint256", "bytes32", "bytes32"],
|
|
4363
4392
|
[
|
|
4364
4393
|
userOp.sender,
|
|
4365
4394
|
userOp.nonce,
|
|
4366
|
-
|
|
4367
|
-
|
|
4395
|
+
keccak256(userOp.initCode),
|
|
4396
|
+
keccak256(userOp.callData),
|
|
4368
4397
|
userOp.accountGasLimits,
|
|
4369
4398
|
userOp.preVerificationGas,
|
|
4370
4399
|
userOp.gasFees,
|
|
4371
|
-
|
|
4400
|
+
keccak256(userOp.paymasterAndData)
|
|
4372
4401
|
]
|
|
4373
4402
|
);
|
|
4374
|
-
return
|
|
4375
|
-
|
|
4403
|
+
return keccak256(
|
|
4404
|
+
encodeAbiParams(
|
|
4376
4405
|
["bytes32", "address", "uint256"],
|
|
4377
|
-
[
|
|
4406
|
+
[keccak256(encoded), entryPoint, BigInt(chainId)]
|
|
4378
4407
|
)
|
|
4379
4408
|
);
|
|
4380
4409
|
}
|
|
4381
4410
|
// Legacy v0.6 hashing support could be added here if needed
|
|
4382
4411
|
};
|
|
4412
|
+
|
|
4413
|
+
// ../airaccount/src/core/tier/types.ts
|
|
4383
4414
|
var ALG_BLS = 1;
|
|
4384
4415
|
var ALG_ECDSA = 2;
|
|
4385
4416
|
var ALG_P256 = 3;
|
|
4386
4417
|
var ALG_CUMULATIVE_T2 = 4;
|
|
4387
4418
|
var ALG_CUMULATIVE_T3 = 5;
|
|
4419
|
+
|
|
4420
|
+
// ../airaccount/src/core/tier/tier-router.ts
|
|
4388
4421
|
function resolveTier(value, config) {
|
|
4389
4422
|
if (config.tier1Limit === 0n && config.tier2Limit === 0n) return 1;
|
|
4390
4423
|
if (config.tier1Limit > 0n && value <= config.tier1Limit) return 1;
|
|
@@ -4401,6 +4434,26 @@ function algIdForTier(tier) {
|
|
|
4401
4434
|
return ALG_CUMULATIVE_T3;
|
|
4402
4435
|
}
|
|
4403
4436
|
}
|
|
4437
|
+
|
|
4438
|
+
// ../airaccount/src/index.ts
|
|
4439
|
+
var src_exports = {};
|
|
4440
|
+
__export(src_exports, {
|
|
4441
|
+
ALG_BLS: () => ALG_BLS,
|
|
4442
|
+
ALG_CUMULATIVE_T2: () => ALG_CUMULATIVE_T2,
|
|
4443
|
+
ALG_CUMULATIVE_T3: () => ALG_CUMULATIVE_T3,
|
|
4444
|
+
ALG_ECDSA: () => ALG_ECDSA,
|
|
4445
|
+
ALG_P256: () => ALG_P256,
|
|
4446
|
+
AirAccountClient: () => AirAccountClient,
|
|
4447
|
+
BLSManager: () => BLSManager,
|
|
4448
|
+
CryptoUtil: () => CryptoUtil,
|
|
4449
|
+
DEFAULT_PASSKEY_ROUTES: () => DEFAULT_PASSKEY_ROUTES,
|
|
4450
|
+
ERC4337Utils: () => ERC4337Utils,
|
|
4451
|
+
PasskeyManager: () => PasskeyManager,
|
|
4452
|
+
UserOpBuilder: () => UserOpBuilder,
|
|
4453
|
+
YAAAClient: () => YAAAClient,
|
|
4454
|
+
algIdForTier: () => algIdForTier,
|
|
4455
|
+
resolveTier: () => resolveTier
|
|
4456
|
+
});
|
|
4404
4457
|
/*! Bundled license information:
|
|
4405
4458
|
|
|
4406
4459
|
@noble/hashes/utils.js:
|
|
@@ -4416,6 +4469,6 @@ function algIdForTier(tier) {
|
|
|
4416
4469
|
(*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
4417
4470
|
*/
|
|
4418
4471
|
|
|
4419
|
-
export { BLSManager, CryptoUtil, ERC4337Utils, PasskeyManager, UserOpBuilder, YAAAClient,
|
|
4420
|
-
//# sourceMappingURL=chunk-
|
|
4421
|
-
//# sourceMappingURL=chunk-
|
|
4472
|
+
export { ALG_BLS, ALG_CUMULATIVE_T2, ALG_CUMULATIVE_T3, ALG_ECDSA, ALG_P256, AirAccountClient, BLSManager, CryptoUtil, DEFAULT_PASSKEY_ROUTES, ERC4337Utils, PasskeyManager, UserOpBuilder, YAAAClient, algIdForTier, ecdsa, encodeAbiParams, keccak256, resolveTier, selectorFromId, sha256, solidityPacked, src_exports, weierstrass };
|
|
4473
|
+
//# sourceMappingURL=chunk-X3AMH53O.js.map
|
|
4474
|
+
//# sourceMappingURL=chunk-X3AMH53O.js.map
|