zksync-sso 0.0.0-beta.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.
- package/.gitignore +5 -0
- package/.lintstagedrc.js +5 -0
- package/.npmignore +10 -0
- package/README.md +3 -0
- package/dist/_cjs/abi/Factory.js +197 -0
- package/dist/_cjs/abi/Factory.js.map +1 -0
- package/dist/_cjs/abi/SessionKeyModule.js +1104 -0
- package/dist/_cjs/abi/SessionKeyModule.js.map +1 -0
- package/dist/_cjs/client/actions/account.js +140 -0
- package/dist/_cjs/client/actions/account.js.map +1 -0
- package/dist/_cjs/client/actions/index.js +19 -0
- package/dist/_cjs/client/actions/index.js.map +1 -0
- package/dist/_cjs/client/actions/passkey.js +122 -0
- package/dist/_cjs/client/actions/passkey.js.map +1 -0
- package/dist/_cjs/client/actions/session.js +40 -0
- package/dist/_cjs/client/actions/session.js.map +1 -0
- package/dist/_cjs/client/clients/passkey.js +46 -0
- package/dist/_cjs/client/clients/passkey.js.map +1 -0
- package/dist/_cjs/client/clients/session.js +48 -0
- package/dist/_cjs/client/clients/session.js.map +1 -0
- package/dist/_cjs/client/decorators/index.js +19 -0
- package/dist/_cjs/client/decorators/index.js.map +1 -0
- package/dist/_cjs/client/decorators/passkey.js +15 -0
- package/dist/_cjs/client/decorators/passkey.js.map +1 -0
- package/dist/_cjs/client/decorators/session.js +7 -0
- package/dist/_cjs/client/decorators/session.js.map +1 -0
- package/dist/_cjs/client/decorators/session_wallet.js +32 -0
- package/dist/_cjs/client/decorators/session_wallet.js.map +1 -0
- package/dist/_cjs/client/index.js +22 -0
- package/dist/_cjs/client/index.js.map +1 -0
- package/dist/_cjs/client/passkey.js +20 -0
- package/dist/_cjs/client/passkey.js.map +1 -0
- package/dist/_cjs/client/smart-account.js +45 -0
- package/dist/_cjs/client/smart-account.js.map +1 -0
- package/dist/_cjs/client/utils/assertEip712Transaction.js +44 -0
- package/dist/_cjs/client/utils/assertEip712Transaction.js.map +1 -0
- package/dist/_cjs/client/utils/getEip712Domain.js +57 -0
- package/dist/_cjs/client/utils/getEip712Domain.js.map +1 -0
- package/dist/_cjs/client/utils/isEip712Transaction.js +16 -0
- package/dist/_cjs/client/utils/isEip712Transaction.js.map +1 -0
- package/dist/_cjs/client-auth-server/Signer.js +264 -0
- package/dist/_cjs/client-auth-server/Signer.js.map +1 -0
- package/dist/_cjs/client-auth-server/WalletProvider.js +107 -0
- package/dist/_cjs/client-auth-server/WalletProvider.js.map +1 -0
- package/dist/_cjs/client-auth-server/index.js +20 -0
- package/dist/_cjs/client-auth-server/index.js.map +1 -0
- package/dist/_cjs/client-auth-server/interface.js +3 -0
- package/dist/_cjs/client-auth-server/interface.js.map +1 -0
- package/dist/_cjs/client-auth-server/rpc.js +3 -0
- package/dist/_cjs/client-auth-server/rpc.js.map +1 -0
- package/dist/_cjs/client-auth-server/session.js +90 -0
- package/dist/_cjs/client-auth-server/session.js.map +1 -0
- package/dist/_cjs/communicator/PopupCommunicator.js +138 -0
- package/dist/_cjs/communicator/PopupCommunicator.js.map +1 -0
- package/dist/_cjs/communicator/index.js +6 -0
- package/dist/_cjs/communicator/index.js.map +1 -0
- package/dist/_cjs/communicator/interface.js +3 -0
- package/dist/_cjs/communicator/interface.js.map +1 -0
- package/dist/_cjs/connector/index.js +148 -0
- package/dist/_cjs/connector/index.js.map +1 -0
- package/dist/_cjs/errors/constants.js +97 -0
- package/dist/_cjs/errors/constants.js.map +1 -0
- package/dist/_cjs/errors/errors.js +122 -0
- package/dist/_cjs/errors/errors.js.map +1 -0
- package/dist/_cjs/errors/index.js +10 -0
- package/dist/_cjs/errors/index.js.map +1 -0
- package/dist/_cjs/errors/serialize.js +63 -0
- package/dist/_cjs/errors/serialize.js.map +1 -0
- package/dist/_cjs/errors/utils.js +95 -0
- package/dist/_cjs/errors/utils.js.map +1 -0
- package/dist/_cjs/index.js +6 -0
- package/dist/_cjs/index.js.map +1 -0
- package/dist/_cjs/package.json +1 -0
- package/dist/_cjs/utils/encoding.js +32 -0
- package/dist/_cjs/utils/encoding.js.map +1 -0
- package/dist/_cjs/utils/helpers.js +43 -0
- package/dist/_cjs/utils/helpers.js.map +1 -0
- package/dist/_cjs/utils/index.js +20 -0
- package/dist/_cjs/utils/index.js.map +1 -0
- package/dist/_cjs/utils/passkey.js +243 -0
- package/dist/_cjs/utils/passkey.js.map +1 -0
- package/dist/_cjs/utils/session.js +30 -0
- package/dist/_cjs/utils/session.js.map +1 -0
- package/dist/_cjs/utils/storage.js +93 -0
- package/dist/_cjs/utils/storage.js.map +1 -0
- package/dist/_cjs/version.js +5 -0
- package/dist/_cjs/version.js.map +1 -0
- package/dist/_esm/abi/Factory.js +194 -0
- package/dist/_esm/abi/Factory.js.map +1 -0
- package/dist/_esm/abi/SessionKeyModule.js +1101 -0
- package/dist/_esm/abi/SessionKeyModule.js.map +1 -0
- package/dist/_esm/client/actions/account.js +137 -0
- package/dist/_esm/client/actions/account.js.map +1 -0
- package/dist/_esm/client/actions/index.js +3 -0
- package/dist/_esm/client/actions/index.js.map +1 -0
- package/dist/_esm/client/actions/passkey.js +121 -0
- package/dist/_esm/client/actions/passkey.js.map +1 -0
- package/dist/_esm/client/actions/session.js +36 -0
- package/dist/_esm/client/actions/session.js.map +1 -0
- package/dist/_esm/client/clients/passkey.js +43 -0
- package/dist/_esm/client/clients/passkey.js.map +1 -0
- package/dist/_esm/client/clients/session.js +45 -0
- package/dist/_esm/client/clients/session.js.map +1 -0
- package/dist/_esm/client/decorators/index.js +3 -0
- package/dist/_esm/client/decorators/index.js.map +1 -0
- package/dist/_esm/client/decorators/passkey.js +13 -0
- package/dist/_esm/client/decorators/passkey.js.map +1 -0
- package/dist/_esm/client/decorators/session.js +5 -0
- package/dist/_esm/client/decorators/session.js.map +1 -0
- package/dist/_esm/client/decorators/session_wallet.js +171 -0
- package/dist/_esm/client/decorators/session_wallet.js.map +1 -0
- package/dist/_esm/client/index.js +3 -0
- package/dist/_esm/client/index.js.map +1 -0
- package/dist/_esm/client/passkey.js +4 -0
- package/dist/_esm/client/passkey.js.map +1 -0
- package/dist/_esm/client/smart-account.js +46 -0
- package/dist/_esm/client/smart-account.js.map +1 -0
- package/dist/_esm/client/utils/assertEip712Transaction.js +39 -0
- package/dist/_esm/client/utils/assertEip712Transaction.js.map +1 -0
- package/dist/_esm/client/utils/getEip712Domain.js +57 -0
- package/dist/_esm/client/utils/getEip712Domain.js.map +1 -0
- package/dist/_esm/client/utils/isEip712Transaction.js +13 -0
- package/dist/_esm/client/utils/isEip712Transaction.js.map +1 -0
- package/dist/_esm/client-auth-server/Signer.js +262 -0
- package/dist/_esm/client-auth-server/Signer.js.map +1 -0
- package/dist/_esm/client-auth-server/WalletProvider.js +104 -0
- package/dist/_esm/client-auth-server/WalletProvider.js.map +1 -0
- package/dist/_esm/client-auth-server/index.js +4 -0
- package/dist/_esm/client-auth-server/index.js.map +1 -0
- package/dist/_esm/client-auth-server/interface.js +2 -0
- package/dist/_esm/client-auth-server/interface.js.map +1 -0
- package/dist/_esm/client-auth-server/rpc.js +2 -0
- package/dist/_esm/client-auth-server/rpc.js.map +1 -0
- package/dist/_esm/client-auth-server/session.js +91 -0
- package/dist/_esm/client-auth-server/session.js.map +1 -0
- package/dist/_esm/communicator/PopupCommunicator.js +136 -0
- package/dist/_esm/communicator/PopupCommunicator.js.map +1 -0
- package/dist/_esm/communicator/index.js +2 -0
- package/dist/_esm/communicator/index.js.map +1 -0
- package/dist/_esm/communicator/interface.js +2 -0
- package/dist/_esm/communicator/interface.js.map +1 -0
- package/dist/_esm/connector/index.js +146 -0
- package/dist/_esm/connector/index.js.map +1 -0
- package/dist/_esm/errors/constants.js +94 -0
- package/dist/_esm/errors/constants.js.map +1 -0
- package/dist/_esm/errors/errors.js +124 -0
- package/dist/_esm/errors/errors.js.map +1 -0
- package/dist/_esm/errors/index.js +4 -0
- package/dist/_esm/errors/index.js.map +1 -0
- package/dist/_esm/errors/serialize.js +69 -0
- package/dist/_esm/errors/serialize.js.map +1 -0
- package/dist/_esm/errors/utils.js +101 -0
- package/dist/_esm/errors/utils.js.map +1 -0
- package/dist/_esm/index.js +2 -0
- package/dist/_esm/index.js.map +1 -0
- package/dist/_esm/package.json +1 -0
- package/dist/_esm/utils/encoding.js +26 -0
- package/dist/_esm/utils/encoding.js.map +1 -0
- package/dist/_esm/utils/helpers.js +40 -0
- package/dist/_esm/utils/helpers.js.map +1 -0
- package/dist/_esm/utils/index.js +4 -0
- package/dist/_esm/utils/index.js.map +1 -0
- package/dist/_esm/utils/passkey.js +294 -0
- package/dist/_esm/utils/passkey.js.map +1 -0
- package/dist/_esm/utils/session.js +31 -0
- package/dist/_esm/utils/session.js.map +1 -0
- package/dist/_esm/utils/storage.js +89 -0
- package/dist/_esm/utils/storage.js.map +1 -0
- package/dist/_esm/version.js +2 -0
- package/dist/_esm/version.js.map +1 -0
- package/dist/_types/abi/Factory.d.ts +149 -0
- package/dist/_types/abi/Factory.d.ts.map +1 -0
- package/dist/_types/abi/SessionKeyModule.d.ts +846 -0
- package/dist/_types/abi/SessionKeyModule.d.ts.map +1 -0
- package/dist/_types/client/actions/account.d.ts +38 -0
- package/dist/_types/client/actions/account.d.ts.map +1 -0
- package/dist/_types/client/actions/index.d.ts +3 -0
- package/dist/_types/client/actions/index.d.ts.map +1 -0
- package/dist/_types/client/actions/passkey.d.ts +45 -0
- package/dist/_types/client/actions/passkey.d.ts.map +1 -0
- package/dist/_types/client/actions/session.d.ts +14 -0
- package/dist/_types/client/actions/session.d.ts.map +1 -0
- package/dist/_types/client/clients/passkey.d.ts +32 -0
- package/dist/_types/client/clients/passkey.d.ts.map +1 -0
- package/dist/_types/client/clients/session.d.ts +26 -0
- package/dist/_types/client/clients/session.d.ts.map +1 -0
- package/dist/_types/client/decorators/index.d.ts +3 -0
- package/dist/_types/client/decorators/index.d.ts.map +1 -0
- package/dist/_types/client/decorators/passkey.d.ts +8 -0
- package/dist/_types/client/decorators/passkey.d.ts.map +1 -0
- package/dist/_types/client/decorators/session.d.ts +5 -0
- package/dist/_types/client/decorators/session.d.ts.map +1 -0
- package/dist/_types/client/decorators/session_wallet.d.ts +5 -0
- package/dist/_types/client/decorators/session_wallet.d.ts.map +1 -0
- package/dist/_types/client/index.d.ts +3 -0
- package/dist/_types/client/index.d.ts.map +1 -0
- package/dist/_types/client/passkey.d.ts +4 -0
- package/dist/_types/client/passkey.d.ts.map +1 -0
- package/dist/_types/client/smart-account.d.ts +24 -0
- package/dist/_types/client/smart-account.d.ts.map +1 -0
- package/dist/_types/client/utils/assertEip712Transaction.d.ts +11 -0
- package/dist/_types/client/utils/assertEip712Transaction.d.ts.map +1 -0
- package/dist/_types/client/utils/getEip712Domain.d.ts +3 -0
- package/dist/_types/client/utils/getEip712Domain.d.ts.map +1 -0
- package/dist/_types/client/utils/isEip712Transaction.d.ts +4 -0
- package/dist/_types/client/utils/isEip712Transaction.d.ts.map +1 -0
- package/dist/_types/client-auth-server/Signer.d.ts +52 -0
- package/dist/_types/client-auth-server/Signer.d.ts.map +1 -0
- package/dist/_types/client-auth-server/WalletProvider.d.ts +27 -0
- package/dist/_types/client-auth-server/WalletProvider.d.ts.map +1 -0
- package/dist/_types/client-auth-server/index.d.ts +4 -0
- package/dist/_types/client-auth-server/index.d.ts.map +1 -0
- package/dist/_types/client-auth-server/interface.d.ts +34 -0
- package/dist/_types/client-auth-server/interface.d.ts.map +1 -0
- package/dist/_types/client-auth-server/rpc.d.ts +55 -0
- package/dist/_types/client-auth-server/rpc.d.ts.map +1 -0
- package/dist/_types/client-auth-server/session.d.ts +45 -0
- package/dist/_types/client-auth-server/session.d.ts.map +1 -0
- package/dist/_types/communicator/PopupCommunicator.d.ts +20 -0
- package/dist/_types/communicator/PopupCommunicator.d.ts.map +1 -0
- package/dist/_types/communicator/index.d.ts +3 -0
- package/dist/_types/communicator/index.d.ts.map +1 -0
- package/dist/_types/communicator/interface.d.ts +16 -0
- package/dist/_types/communicator/interface.d.ts.map +1 -0
- package/dist/_types/connector/index.d.ts +8 -0
- package/dist/_types/connector/index.d.ts.map +1 -0
- package/dist/_types/errors/constants.d.ts +96 -0
- package/dist/_types/errors/constants.d.ts.map +1 -0
- package/dist/_types/errors/errors.d.ts +48 -0
- package/dist/_types/errors/errors.d.ts.map +1 -0
- package/dist/_types/errors/index.d.ts +5 -0
- package/dist/_types/errors/index.d.ts.map +1 -0
- package/dist/_types/errors/serialize.d.ts +13 -0
- package/dist/_types/errors/serialize.d.ts.map +1 -0
- package/dist/_types/errors/utils.d.ts +30 -0
- package/dist/_types/errors/utils.d.ts.map +1 -0
- package/dist/_types/index.d.ts +4 -0
- package/dist/_types/index.d.ts.map +1 -0
- package/dist/_types/utils/encoding.d.ts +12 -0
- package/dist/_types/utils/encoding.d.ts.map +1 -0
- package/dist/_types/utils/helpers.d.ts +4 -0
- package/dist/_types/utils/helpers.d.ts.map +1 -0
- package/dist/_types/utils/index.d.ts +4 -0
- package/dist/_types/utils/index.d.ts.map +1 -0
- package/dist/_types/utils/passkey.d.ts +47 -0
- package/dist/_types/utils/passkey.d.ts.map +1 -0
- package/dist/_types/utils/session.d.ts +95 -0
- package/dist/_types/utils/session.d.ts.map +1 -0
- package/dist/_types/utils/storage.d.ts +30 -0
- package/dist/_types/utils/storage.d.ts.map +1 -0
- package/dist/_types/version.d.ts +2 -0
- package/dist/_types/version.d.ts.map +1 -0
- package/eslint.config.js +6 -0
- package/package.json +144 -0
- package/prepare-package.mjs +39 -0
- package/project.json +67 -0
- package/src/abi/Factory.ts +193 -0
- package/src/abi/SessionKeyModule.ts +1100 -0
- package/src/client/actions/account.ts +198 -0
- package/src/client/actions/index.ts +2 -0
- package/src/client/actions/passkey.ts +165 -0
- package/src/client/actions/session.ts +118 -0
- package/src/client/clients/passkey.ts +107 -0
- package/src/client/clients/session.ts +105 -0
- package/src/client/decorators/index.ts +2 -0
- package/src/client/decorators/passkey.ts +22 -0
- package/src/client/decorators/session.ts +17 -0
- package/src/client/decorators/session_wallet.ts +184 -0
- package/src/client/index.ts +2 -0
- package/src/client/passkey.ts +3 -0
- package/src/client/smart-account.ts +68 -0
- package/src/client/utils/assertEip712Transaction.ts +49 -0
- package/src/client/utils/getEip712Domain.ts +84 -0
- package/src/client/utils/isEip712Transaction.ts +18 -0
- package/src/client-auth-server/Signer.ts +260 -0
- package/src/client-auth-server/WalletProvider.ts +114 -0
- package/src/client-auth-server/index.ts +3 -0
- package/src/client-auth-server/interface.ts +39 -0
- package/src/client-auth-server/rpc.ts +69 -0
- package/src/client-auth-server/session.ts +139 -0
- package/src/communicator/PopupCommunicator.ts +111 -0
- package/src/communicator/index.ts +2 -0
- package/src/communicator/interface.ts +15 -0
- package/src/connector/index.ts +171 -0
- package/src/errors/constants.ts +119 -0
- package/src/errors/errors.ts +168 -0
- package/src/errors/index.ts +4 -0
- package/src/errors/serialize.ts +91 -0
- package/src/errors/utils.ts +152 -0
- package/src/index.ts +3 -0
- package/src/types/index.d.ts +9 -0
- package/src/utils/encoding.ts +36 -0
- package/src/utils/helpers.ts +43 -0
- package/src/utils/index.ts +3 -0
- package/src/utils/passkey.ts +344 -0
- package/src/utils/session.ts +103 -0
- package/src/utils/storage.ts +87 -0
- package/src/version.ts +1 -0
- package/tsconfig.base.json +44 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { ECDSASigValue } from "@peculiar/asn1-ecc";
|
|
2
|
+
import { AsnParser } from "@peculiar/asn1-schema";
|
|
3
|
+
import { bigintToBuf, bufToBigint } from "bigint-conversion";
|
|
4
|
+
import { Buffer } from "buffer";
|
|
5
|
+
import { encodeAbiParameters, toHex } from "viem";
|
|
6
|
+
var COSEKEYS;
|
|
7
|
+
(function (COSEKEYS) {
|
|
8
|
+
COSEKEYS[COSEKEYS["kty"] = 1] = "kty";
|
|
9
|
+
COSEKEYS[COSEKEYS["alg"] = 3] = "alg";
|
|
10
|
+
COSEKEYS[COSEKEYS["crv"] = -1] = "crv";
|
|
11
|
+
COSEKEYS[COSEKEYS["x"] = -2] = "x";
|
|
12
|
+
COSEKEYS[COSEKEYS["y"] = -3] = "y";
|
|
13
|
+
})(COSEKEYS || (COSEKEYS = {}));
|
|
14
|
+
// Encode an integer in CBOR format
|
|
15
|
+
function encodeInt(int) {
|
|
16
|
+
if (int >= 0 && int <= 23) {
|
|
17
|
+
// Small positive integer (0–23)
|
|
18
|
+
return Buffer.from([int]);
|
|
19
|
+
}
|
|
20
|
+
else if (int >= 24 && int <= 255) {
|
|
21
|
+
// 1-byte positive integer
|
|
22
|
+
return Buffer.from([0x18, int]);
|
|
23
|
+
}
|
|
24
|
+
else if (int >= 256 && int <= 65535) {
|
|
25
|
+
// 2-byte positive integer
|
|
26
|
+
const buf = Buffer.alloc(3);
|
|
27
|
+
buf[0] = 0x19;
|
|
28
|
+
buf.writeUInt16BE(int, 1);
|
|
29
|
+
return buf;
|
|
30
|
+
}
|
|
31
|
+
else if (int < 0 && int >= -24) {
|
|
32
|
+
// Small negative integer (-1 to -24)
|
|
33
|
+
return Buffer.from([0x20 - (int + 1)]);
|
|
34
|
+
}
|
|
35
|
+
else if (int < -24 && int >= -256) {
|
|
36
|
+
// 1-byte negative integer
|
|
37
|
+
return Buffer.from([0x38, -int - 1]);
|
|
38
|
+
}
|
|
39
|
+
else if (int < -256 && int >= -65536) {
|
|
40
|
+
// 2-byte negative integer
|
|
41
|
+
const buf = Buffer.alloc(3);
|
|
42
|
+
buf[0] = 0x39;
|
|
43
|
+
buf.writeUInt16BE(-int - 1, 1);
|
|
44
|
+
return buf;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
throw new Error("Unsupported integer range");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
// Encode a byte array in CBOR format
|
|
51
|
+
function encodeBytes(bytes) {
|
|
52
|
+
if (bytes.length <= 23) {
|
|
53
|
+
return Buffer.concat([Buffer.from([0x40 + bytes.length]), bytes]); // Byte array with small length
|
|
54
|
+
}
|
|
55
|
+
else if (bytes.length < 256) {
|
|
56
|
+
return Buffer.concat([Buffer.from([0x58, bytes.length]), bytes]); // Byte array with 1-byte length prefix
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw new Error("Unsupported byte array length");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Encode a map in CBOR format
|
|
63
|
+
function encodeMap(map) {
|
|
64
|
+
const encodedItems = [];
|
|
65
|
+
// CBOR map header, assuming the map size fits within small integer encoding
|
|
66
|
+
const mapHeader = 0xA0 | map.size;
|
|
67
|
+
encodedItems.push(Buffer.from([mapHeader]));
|
|
68
|
+
map.forEach((value, key) => {
|
|
69
|
+
// Encode the key
|
|
70
|
+
encodedItems.push(encodeInt(key));
|
|
71
|
+
// Encode the value based on its type (Buffer or number)
|
|
72
|
+
if (Buffer.isBuffer(value)) {
|
|
73
|
+
encodedItems.push(encodeBytes(value));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
encodedItems.push(encodeInt(value));
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
return Buffer.concat(encodedItems);
|
|
80
|
+
}
|
|
81
|
+
function decodeMap(buffer) {
|
|
82
|
+
const map = new Map();
|
|
83
|
+
let offset = 1; // Start after the map header
|
|
84
|
+
const mapHeader = buffer[0];
|
|
85
|
+
const mapSize = mapHeader & 0x1F; // Number of pairs
|
|
86
|
+
for (let i = 0; i < mapSize; i++) {
|
|
87
|
+
const [key, keyLength] = decodeInt(buffer, offset);
|
|
88
|
+
offset += keyLength;
|
|
89
|
+
const [value, valueLength] = decodeValue(buffer, offset);
|
|
90
|
+
offset += valueLength;
|
|
91
|
+
map.set(key, value);
|
|
92
|
+
}
|
|
93
|
+
return map;
|
|
94
|
+
}
|
|
95
|
+
function decodeInt(buffer, offset) {
|
|
96
|
+
const intByte = buffer[offset];
|
|
97
|
+
if (intByte < 24) {
|
|
98
|
+
// Small positive integer (0–23)
|
|
99
|
+
return [intByte, 1];
|
|
100
|
+
}
|
|
101
|
+
else if (intByte === 0x18) {
|
|
102
|
+
// 1-byte unsigned integer
|
|
103
|
+
return [buffer[offset + 1], 2];
|
|
104
|
+
}
|
|
105
|
+
else if (intByte === 0x19) {
|
|
106
|
+
// 2-byte unsigned integer
|
|
107
|
+
return [buffer.readUInt16BE(offset + 1), 3];
|
|
108
|
+
}
|
|
109
|
+
else if (intByte >= 0x20 && intByte <= 0x37) {
|
|
110
|
+
// Small negative integer (-1 to -24)
|
|
111
|
+
return [-(intByte - 0x20) - 1, 1];
|
|
112
|
+
}
|
|
113
|
+
else if (intByte === 0x38) {
|
|
114
|
+
// 1-byte negative integer
|
|
115
|
+
return [-1 - buffer[offset + 1], 2];
|
|
116
|
+
}
|
|
117
|
+
else if (intByte === 0x39) {
|
|
118
|
+
// 2-byte negative integer
|
|
119
|
+
return [-1 - buffer.readUInt16BE(offset + 1), 3];
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
throw new Error("Unsupported integer format");
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
function decodeBytes(buffer, offset) {
|
|
126
|
+
const lengthByte = buffer[offset];
|
|
127
|
+
if (lengthByte >= 0x40 && lengthByte <= 0x57) {
|
|
128
|
+
const length = lengthByte - 0x40;
|
|
129
|
+
return [buffer.slice(offset + 1, offset + 1 + length), length + 1];
|
|
130
|
+
}
|
|
131
|
+
else if (lengthByte === 0x58) { // Byte array with 1-byte length prefix
|
|
132
|
+
const length = buffer[offset + 1];
|
|
133
|
+
return [buffer.slice(offset + 2, offset + 2 + length), length + 2];
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
throw new Error("Unsupported byte format");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function decodeValue(buffer, offset) {
|
|
140
|
+
const type = buffer[offset];
|
|
141
|
+
if (type >= 0x40 && type <= 0x5F) { // Byte array
|
|
142
|
+
return decodeBytes(buffer, offset);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return decodeInt(buffer, offset);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
export const getPublicKeyBytesFromPasskeySignature = (publicPasskey) => {
|
|
149
|
+
const cosePublicKey = decodeMap(Buffer.from(publicPasskey)); // Decodes CBOR-encoded COSE key
|
|
150
|
+
const x = cosePublicKey.get(COSEKEYS.x);
|
|
151
|
+
const y = cosePublicKey.get(COSEKEYS.y);
|
|
152
|
+
return [Buffer.from(x), Buffer.from(y)];
|
|
153
|
+
};
|
|
154
|
+
export const getPasskeySignatureFromPublicKeyBytes = (coordinates) => {
|
|
155
|
+
const [xHex, yHex] = coordinates;
|
|
156
|
+
const x = Buffer.from(xHex.slice(2), "hex");
|
|
157
|
+
const y = Buffer.from(yHex.slice(2), "hex");
|
|
158
|
+
const cosePublicKey = new Map();
|
|
159
|
+
cosePublicKey.set(COSEKEYS.kty, 2); // Type 2 for EC keys
|
|
160
|
+
cosePublicKey.set(COSEKEYS.alg, -7); // -7 for ES256 algorithm
|
|
161
|
+
cosePublicKey.set(COSEKEYS.crv, 1); // Curve ID (1 for P-256)
|
|
162
|
+
cosePublicKey.set(COSEKEYS.x, x);
|
|
163
|
+
cosePublicKey.set(COSEKEYS.y, y);
|
|
164
|
+
const encodedPublicKey = encodeMap(cosePublicKey);
|
|
165
|
+
return new Uint8Array(encodedPublicKey);
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Return 2 32byte words for the R & S for the EC2 signature, 0 l-trimmed
|
|
169
|
+
* @param signature
|
|
170
|
+
* @returns r & s bytes sequentially
|
|
171
|
+
*/
|
|
172
|
+
export function unwrapEC2Signature(signature) {
|
|
173
|
+
const parsedSignature = AsnParser.parse(signature, ECDSASigValue);
|
|
174
|
+
let rBytes = new Uint8Array(parsedSignature.r);
|
|
175
|
+
let sBytes = new Uint8Array(parsedSignature.s);
|
|
176
|
+
if (shouldRemoveLeadingZero(rBytes)) {
|
|
177
|
+
rBytes = rBytes.slice(1);
|
|
178
|
+
}
|
|
179
|
+
if (shouldRemoveLeadingZero(sBytes)) {
|
|
180
|
+
sBytes = sBytes.slice(1);
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
r: rBytes,
|
|
184
|
+
s: normalizeS(sBytes),
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Normalizes the 's' value of an ECDSA signature to prevent signature malleability.
|
|
189
|
+
*
|
|
190
|
+
* @param {Uint8Array} sBuf - The 's' value of the signature as a Uint8Array.
|
|
191
|
+
* @returns {Uint8Array} The normalized 's' value as a Uint8Array.
|
|
192
|
+
*
|
|
193
|
+
* @description
|
|
194
|
+
* This function implements the process of normalizing the 's' value in an ECDSA signature.
|
|
195
|
+
* It ensures that the 's' value is always in the lower half of the curve's order,
|
|
196
|
+
* which helps prevent signature malleability attacks.
|
|
197
|
+
*
|
|
198
|
+
* The function uses the curve order 'n' for secp256k1:
|
|
199
|
+
* n = 0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551
|
|
200
|
+
*
|
|
201
|
+
* If 's' is greater than half of 'n', it is subtracted from 'n' to get the lower value.
|
|
202
|
+
*/
|
|
203
|
+
export function normalizeS(sBuf) {
|
|
204
|
+
const n = BigInt("0xFFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551");
|
|
205
|
+
const halfN = n / BigInt(2);
|
|
206
|
+
const sNumber = bufToBigint(sBuf);
|
|
207
|
+
if (sNumber / halfN) {
|
|
208
|
+
return new Uint8Array(bigintToBuf(n - sNumber));
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
return sBuf;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Determine if the DER-specific `00` byte at the start of an ECDSA signature byte sequence
|
|
216
|
+
* should be removed based on the following logic:
|
|
217
|
+
*
|
|
218
|
+
* "If the leading byte is 0x0, and the the high order bit on the second byte is not set to 0,
|
|
219
|
+
* then remove the leading 0x0 byte"
|
|
220
|
+
*/
|
|
221
|
+
function shouldRemoveLeadingZero(bytes) {
|
|
222
|
+
return bytes[0] === 0x0 && (bytes[1] & (1 << 7)) !== 0;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Decode from a Base64URL-encoded string to an ArrayBuffer. Best used when converting a
|
|
226
|
+
* credential ID from a JSON string to an ArrayBuffer, like in allowCredentials or
|
|
227
|
+
* excludeCredentials.
|
|
228
|
+
*
|
|
229
|
+
* @param buffer Value to decode from base64
|
|
230
|
+
* @param to (optional) The decoding to use, in case it's desirable to decode from base64 instead
|
|
231
|
+
*/
|
|
232
|
+
export function base64UrlToUint8Array(base64urlString, isUrl = true) {
|
|
233
|
+
const _buffer = toArrayBuffer(base64urlString, isUrl);
|
|
234
|
+
return new Uint8Array(_buffer);
|
|
235
|
+
}
|
|
236
|
+
function toArrayBuffer(data, isUrl) {
|
|
237
|
+
const
|
|
238
|
+
// Regular base64 characters
|
|
239
|
+
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
|
|
240
|
+
// Base64url characters
|
|
241
|
+
charsUrl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_", genLookup = (target) => {
|
|
242
|
+
const lookupTemp = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
243
|
+
const len = chars.length;
|
|
244
|
+
for (let i = 0; i < len; i++) {
|
|
245
|
+
lookupTemp[target.charCodeAt(i)] = i;
|
|
246
|
+
}
|
|
247
|
+
return lookupTemp;
|
|
248
|
+
},
|
|
249
|
+
// Use a lookup table to find the index.
|
|
250
|
+
lookup = genLookup(chars), lookupUrl = genLookup(charsUrl);
|
|
251
|
+
const len = data.length;
|
|
252
|
+
let bufferLength = data.length * 0.75, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
|
253
|
+
if (data[data.length - 1] === "=") {
|
|
254
|
+
bufferLength--;
|
|
255
|
+
if (data[data.length - 2] === "=") {
|
|
256
|
+
bufferLength--;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer), target = isUrl ? lookupUrl : lookup;
|
|
260
|
+
for (i = 0; i < len; i += 4) {
|
|
261
|
+
encoded1 = target[data.charCodeAt(i)];
|
|
262
|
+
encoded2 = target[data.charCodeAt(i + 1)];
|
|
263
|
+
encoded3 = target[data.charCodeAt(i + 2)];
|
|
264
|
+
encoded4 = target[data.charCodeAt(i + 3)];
|
|
265
|
+
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
|
266
|
+
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
|
267
|
+
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
|
268
|
+
}
|
|
269
|
+
return arraybuffer;
|
|
270
|
+
}
|
|
271
|
+
;
|
|
272
|
+
export function passkeyHashSignatureResponseFormat(passkeyResponse, contracts) {
|
|
273
|
+
const signature = unwrapEC2Signature(base64UrlToUint8Array(passkeyResponse.signature));
|
|
274
|
+
const fatSignature = encodeAbiParameters([
|
|
275
|
+
{ type: "bytes" }, // authData
|
|
276
|
+
{ type: "bytes" }, // clientDataJson
|
|
277
|
+
{ type: "bytes32[2]" }, // signature (two elements)
|
|
278
|
+
], [
|
|
279
|
+
toHex(base64UrlToUint8Array(passkeyResponse.authenticatorData)),
|
|
280
|
+
toHex(base64UrlToUint8Array(passkeyResponse.clientDataJSON)),
|
|
281
|
+
[toHex(signature.r), toHex(signature.s)],
|
|
282
|
+
]);
|
|
283
|
+
const fullFormattedSig = encodeAbiParameters([
|
|
284
|
+
{ type: "bytes" }, // fat signature
|
|
285
|
+
{ type: "address" }, // validator address
|
|
286
|
+
{ type: "bytes[]" }, // validator data
|
|
287
|
+
], [
|
|
288
|
+
fatSignature,
|
|
289
|
+
contracts.passkey,
|
|
290
|
+
["0x"], // FIXME: this is assuming there are no other hooks
|
|
291
|
+
]);
|
|
292
|
+
return fullFormattedSig;
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{
|
|
4
|
+
LimitType[LimitType["Unlimited"] = 0] = "Unlimited";
|
|
5
|
+
LimitType[LimitType["Lifetime"] = 1] = "Lifetime";
|
|
6
|
+
LimitType[LimitType["Allowance"] = 2] = "Allowance";
|
|
7
|
+
})(LimitType || (LimitType = {}));
|
|
8
|
+
export const LimitUnlimited = {
|
|
9
|
+
limitType: LimitType.Unlimited,
|
|
10
|
+
limit: 0n,
|
|
11
|
+
period: 0n,
|
|
12
|
+
};
|
|
13
|
+
export const LimitZero = {
|
|
14
|
+
limitType: LimitType.Lifetime,
|
|
15
|
+
limit: 0n,
|
|
16
|
+
period: 0n,
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Common logic operators to used combine multiple constraints
|
|
20
|
+
*/
|
|
21
|
+
export var ConstraintCondition;
|
|
22
|
+
(function (ConstraintCondition) {
|
|
23
|
+
ConstraintCondition[ConstraintCondition["Unconstrained"] = 0] = "Unconstrained";
|
|
24
|
+
ConstraintCondition[ConstraintCondition["Equal"] = 1] = "Equal";
|
|
25
|
+
ConstraintCondition[ConstraintCondition["Greater"] = 2] = "Greater";
|
|
26
|
+
ConstraintCondition[ConstraintCondition["Less"] = 3] = "Less";
|
|
27
|
+
ConstraintCondition[ConstraintCondition["GreaterEqual"] = 4] = "GreaterEqual";
|
|
28
|
+
ConstraintCondition[ConstraintCondition["LessEqual"] = 5] = "LessEqual";
|
|
29
|
+
ConstraintCondition[ConstraintCondition["NotEqual"] = 6] = "NotEqual";
|
|
30
|
+
})(ConstraintCondition || (ConstraintCondition = {}));
|
|
31
|
+
//# sourceMappingURL=session.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../../src/utils/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,MAAM,MAAM,CAAC;AAE/C,MAAM,CAAN,IAAY,SAIX;AAJD,WAAY,SAAS;IACnB,mDAAa,CAAA;IACb,iDAAY,CAAA;IACZ,mDAAa,CAAA;AACf,CAAC,EAJW,SAAS,KAAT,SAAS,QAIpB;AAcD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,SAAS,EAAE,SAAS,CAAC,SAAS;IAC9B,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC,QAAQ;IAC7B,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,mBAQX;AARD,WAAY,mBAAmB;IAC7B,+EAAiB,CAAA;IACjB,+DAAS,CAAA;IACT,mEAAW,CAAA;IACX,6DAAQ,CAAA;IACR,6EAAgB,CAAA;IAChB,uEAAa,CAAA;IACb,qEAAY,CAAA;AACd,CAAC,EARW,mBAAmB,KAAnB,mBAAmB,QAQ9B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
const StorageSerializers = {
|
|
2
|
+
object: {
|
|
3
|
+
read: (v) => {
|
|
4
|
+
try {
|
|
5
|
+
return JSON.parse(v);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
throw new Error("Failed to parse JSON");
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
write: (v) => JSON.stringify(v),
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
export class StorageItem {
|
|
15
|
+
constructor(key, defaultValue, options = {}) {
|
|
16
|
+
Object.defineProperty(this, "key", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
configurable: true,
|
|
19
|
+
writable: true,
|
|
20
|
+
value: void 0
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(this, "defaultValue", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(this, "storage", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: void 0
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(this, "serializer", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: void 0
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(this, "onChangeCallback", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
configurable: true,
|
|
43
|
+
writable: true,
|
|
44
|
+
value: void 0
|
|
45
|
+
});
|
|
46
|
+
this.key = key;
|
|
47
|
+
this.defaultValue = defaultValue;
|
|
48
|
+
this.storage = options.storage || localStorage;
|
|
49
|
+
this.serializer = options.serializer || StorageSerializers.object;
|
|
50
|
+
if (options.onChange) {
|
|
51
|
+
this.onChangeCallback = options.onChange;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
get() {
|
|
55
|
+
const storedValue = this.storage.getItem(this.key);
|
|
56
|
+
if (storedValue !== null) {
|
|
57
|
+
try {
|
|
58
|
+
return this.serializer.read(storedValue);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return this.defaultValue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return this.defaultValue;
|
|
65
|
+
}
|
|
66
|
+
set(value) {
|
|
67
|
+
const oldValue = this.get();
|
|
68
|
+
const serializedValue = this.serializer.write(value);
|
|
69
|
+
this.storage.setItem(this.key, serializedValue);
|
|
70
|
+
this.notifyChange(value, oldValue);
|
|
71
|
+
}
|
|
72
|
+
remove() {
|
|
73
|
+
const oldValue = this.get();
|
|
74
|
+
this.storage.removeItem(this.key);
|
|
75
|
+
this.notifyChange(this.defaultValue, oldValue);
|
|
76
|
+
}
|
|
77
|
+
notifyChange(newValue, oldValue) {
|
|
78
|
+
if (this.onChangeCallback) {
|
|
79
|
+
this.onChangeCallback(newValue, oldValue);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
Object.defineProperty(StorageItem, "scopedStorageKey", {
|
|
84
|
+
enumerable: true,
|
|
85
|
+
configurable: true,
|
|
86
|
+
writable: true,
|
|
87
|
+
value: (key) => `ZKAccount::${key}`
|
|
88
|
+
});
|
|
89
|
+
//# sourceMappingURL=storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/utils/storage.ts"],"names":[],"mappings":"AAWA,MAAM,kBAAkB,GAAG;IACzB,MAAM,EAAE;QACN,IAAI,EAAE,CAAI,CAAS,EAAK,EAAE;YACxB,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAM,CAAC;YAC5B,CAAC;YAAC,MAAM,CAAC;gBACP,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;QACD,KAAK,EAAE,CAAI,CAAI,EAAU,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;KAC9C;CACF,CAAC;AAUF,MAAM,OAAO,WAAW;IAOtB,YACE,GAAW,EACX,YAAe,EACf,UAAiC,EAAE;QATrC;;;;;WAAY;QACZ;;;;;WAAgB;QAChB;;;;;WAAqB;QACrB;;;;;WAA0B;QAClB;;;;;WAAqC;QAO3C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,YAAY,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,kBAAkB,CAAC,MAAM,CAAC;QAElE,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC3C,CAAC;IACH,CAAC;IAID,GAAG;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,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 @@
|
|
|
1
|
+
export declare const FactoryAbi: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "bytes32";
|
|
4
|
+
readonly name: "_beaconProxyBytecodeHash";
|
|
5
|
+
readonly type: "bytes32";
|
|
6
|
+
}, {
|
|
7
|
+
readonly internalType: "address";
|
|
8
|
+
readonly name: "implementation";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}];
|
|
11
|
+
readonly stateMutability: "nonpayable";
|
|
12
|
+
readonly type: "constructor";
|
|
13
|
+
}, {
|
|
14
|
+
readonly anonymous: false;
|
|
15
|
+
readonly inputs: readonly [{
|
|
16
|
+
readonly indexed: true;
|
|
17
|
+
readonly internalType: "address";
|
|
18
|
+
readonly name: "previousOwner";
|
|
19
|
+
readonly type: "address";
|
|
20
|
+
}, {
|
|
21
|
+
readonly indexed: true;
|
|
22
|
+
readonly internalType: "address";
|
|
23
|
+
readonly name: "newOwner";
|
|
24
|
+
readonly type: "address";
|
|
25
|
+
}];
|
|
26
|
+
readonly name: "OwnershipTransferred";
|
|
27
|
+
readonly type: "event";
|
|
28
|
+
}, {
|
|
29
|
+
readonly anonymous: false;
|
|
30
|
+
readonly inputs: readonly [{
|
|
31
|
+
readonly indexed: true;
|
|
32
|
+
readonly internalType: "address";
|
|
33
|
+
readonly name: "implementation";
|
|
34
|
+
readonly type: "address";
|
|
35
|
+
}];
|
|
36
|
+
readonly name: "Upgraded";
|
|
37
|
+
readonly type: "event";
|
|
38
|
+
}, {
|
|
39
|
+
readonly inputs: readonly [{
|
|
40
|
+
readonly internalType: "string";
|
|
41
|
+
readonly name: "";
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
}];
|
|
44
|
+
readonly name: "accountMappings";
|
|
45
|
+
readonly outputs: readonly [{
|
|
46
|
+
readonly internalType: "address";
|
|
47
|
+
readonly name: "";
|
|
48
|
+
readonly type: "address";
|
|
49
|
+
}];
|
|
50
|
+
readonly stateMutability: "view";
|
|
51
|
+
readonly type: "function";
|
|
52
|
+
}, {
|
|
53
|
+
readonly inputs: readonly [{
|
|
54
|
+
readonly internalType: "bytes32";
|
|
55
|
+
readonly name: "uniqueAccountId";
|
|
56
|
+
readonly type: "bytes32";
|
|
57
|
+
}];
|
|
58
|
+
readonly name: "addNewUniqueId";
|
|
59
|
+
readonly outputs: readonly [];
|
|
60
|
+
readonly stateMutability: "nonpayable";
|
|
61
|
+
readonly type: "function";
|
|
62
|
+
}, {
|
|
63
|
+
readonly inputs: readonly [];
|
|
64
|
+
readonly name: "beaconProxyBytecodeHash";
|
|
65
|
+
readonly outputs: readonly [{
|
|
66
|
+
readonly internalType: "bytes32";
|
|
67
|
+
readonly name: "";
|
|
68
|
+
readonly type: "bytes32";
|
|
69
|
+
}];
|
|
70
|
+
readonly stateMutability: "view";
|
|
71
|
+
readonly type: "function";
|
|
72
|
+
}, {
|
|
73
|
+
readonly inputs: readonly [{
|
|
74
|
+
readonly internalType: "bytes32";
|
|
75
|
+
readonly name: "salt";
|
|
76
|
+
readonly type: "bytes32";
|
|
77
|
+
}, {
|
|
78
|
+
readonly internalType: "string";
|
|
79
|
+
readonly name: "uniqueAccountId";
|
|
80
|
+
readonly type: "string";
|
|
81
|
+
}, {
|
|
82
|
+
readonly internalType: "bytes[]";
|
|
83
|
+
readonly name: "initialValidators";
|
|
84
|
+
readonly type: "bytes[]";
|
|
85
|
+
}, {
|
|
86
|
+
readonly internalType: "bytes[]";
|
|
87
|
+
readonly name: "initialModules";
|
|
88
|
+
readonly type: "bytes[]";
|
|
89
|
+
}, {
|
|
90
|
+
readonly internalType: "address[]";
|
|
91
|
+
readonly name: "initialK1Owners";
|
|
92
|
+
readonly type: "address[]";
|
|
93
|
+
}];
|
|
94
|
+
readonly name: "deployProxy7579Account";
|
|
95
|
+
readonly outputs: readonly [{
|
|
96
|
+
readonly internalType: "address";
|
|
97
|
+
readonly name: "accountAddress";
|
|
98
|
+
readonly type: "address";
|
|
99
|
+
}];
|
|
100
|
+
readonly stateMutability: "nonpayable";
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
}, {
|
|
103
|
+
readonly inputs: readonly [];
|
|
104
|
+
readonly name: "implementation";
|
|
105
|
+
readonly outputs: readonly [{
|
|
106
|
+
readonly internalType: "address";
|
|
107
|
+
readonly name: "";
|
|
108
|
+
readonly type: "address";
|
|
109
|
+
}];
|
|
110
|
+
readonly stateMutability: "view";
|
|
111
|
+
readonly type: "function";
|
|
112
|
+
}, {
|
|
113
|
+
readonly inputs: readonly [];
|
|
114
|
+
readonly name: "owner";
|
|
115
|
+
readonly outputs: readonly [{
|
|
116
|
+
readonly internalType: "address";
|
|
117
|
+
readonly name: "";
|
|
118
|
+
readonly type: "address";
|
|
119
|
+
}];
|
|
120
|
+
readonly stateMutability: "view";
|
|
121
|
+
readonly type: "function";
|
|
122
|
+
}, {
|
|
123
|
+
readonly inputs: readonly [];
|
|
124
|
+
readonly name: "renounceOwnership";
|
|
125
|
+
readonly outputs: readonly [];
|
|
126
|
+
readonly stateMutability: "nonpayable";
|
|
127
|
+
readonly type: "function";
|
|
128
|
+
}, {
|
|
129
|
+
readonly inputs: readonly [{
|
|
130
|
+
readonly internalType: "address";
|
|
131
|
+
readonly name: "newOwner";
|
|
132
|
+
readonly type: "address";
|
|
133
|
+
}];
|
|
134
|
+
readonly name: "transferOwnership";
|
|
135
|
+
readonly outputs: readonly [];
|
|
136
|
+
readonly stateMutability: "nonpayable";
|
|
137
|
+
readonly type: "function";
|
|
138
|
+
}, {
|
|
139
|
+
readonly inputs: readonly [{
|
|
140
|
+
readonly internalType: "address";
|
|
141
|
+
readonly name: "newImplementation";
|
|
142
|
+
readonly type: "address";
|
|
143
|
+
}];
|
|
144
|
+
readonly name: "upgradeTo";
|
|
145
|
+
readonly outputs: readonly [];
|
|
146
|
+
readonly stateMutability: "nonpayable";
|
|
147
|
+
readonly type: "function";
|
|
148
|
+
}];
|
|
149
|
+
//# sourceMappingURL=Factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Factory.d.ts","sourceRoot":"","sources":["../../../src/abi/Factory.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgMb,CAAC"}
|