zksync-sso 0.0.0-beta.9 → 0.2.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/_cjs/abi/{Factory.js → AAFactory.js} +112 -63
- package/dist/_cjs/abi/AAFactory.js.map +1 -0
- package/dist/_cjs/abi/GuardianRecoveryValidator.js +818 -0
- package/dist/_cjs/abi/GuardianRecoveryValidator.js.map +1 -0
- package/dist/_cjs/abi/{SessionKeyModule.js → SessionKeyValidator.js} +251 -90
- package/dist/_cjs/abi/SessionKeyValidator.js.map +1 -0
- package/dist/_cjs/abi/SsoAccount.js +1288 -0
- package/dist/_cjs/abi/SsoAccount.js.map +1 -0
- package/dist/_cjs/abi/WebAuthValidator.js +361 -0
- package/dist/_cjs/abi/WebAuthValidator.js.map +1 -0
- package/dist/_cjs/abi/index.js +11 -5
- package/dist/_cjs/abi/index.js.map +1 -1
- package/dist/_cjs/client/ecdsa/account.js +38 -0
- package/dist/_cjs/client/ecdsa/account.js.map +1 -0
- package/dist/_cjs/client/ecdsa/actions/account.js +83 -0
- package/dist/_cjs/client/ecdsa/actions/account.js.map +1 -0
- package/dist/_cjs/client/ecdsa/client.js +35 -0
- package/dist/_cjs/client/ecdsa/client.js.map +1 -0
- package/dist/_cjs/client/ecdsa/decorators/ecdsa.js +22 -0
- package/dist/_cjs/client/ecdsa/decorators/ecdsa.js.map +1 -0
- package/dist/_cjs/client/ecdsa/decorators/wallet.js +53 -0
- package/dist/_cjs/client/ecdsa/decorators/wallet.js.map +1 -0
- package/dist/_cjs/client/ecdsa/index.js +23 -0
- package/dist/_cjs/client/ecdsa/index.js.map +1 -0
- package/dist/_cjs/client/ecdsa/types.js +63 -0
- package/dist/_cjs/client/ecdsa/types.js.map +1 -0
- package/dist/_cjs/client/index.js +81 -4
- package/dist/_cjs/client/index.js.map +1 -1
- package/dist/_cjs/client/passkey/account.js +5 -5
- package/dist/_cjs/client/passkey/account.js.map +1 -1
- package/dist/_cjs/client/passkey/actions/account.js +58 -32
- package/dist/_cjs/client/passkey/actions/account.js.map +1 -1
- package/dist/_cjs/client/passkey/actions/passkey.js +36 -13
- package/dist/_cjs/client/passkey/actions/passkey.js.map +1 -1
- package/dist/_cjs/client/passkey/client.js +4 -1
- package/dist/_cjs/client/passkey/client.js.map +1 -1
- package/dist/_cjs/client/passkey/decorators/passkey.js +19 -0
- package/dist/_cjs/client/passkey/decorators/passkey.js.map +1 -1
- package/dist/_cjs/client/passkey/decorators/wallet.js +7 -0
- package/dist/_cjs/client/passkey/decorators/wallet.js.map +1 -1
- package/dist/_cjs/client/recovery/account.js +46 -0
- package/dist/_cjs/client/recovery/account.js.map +1 -0
- package/dist/_cjs/client/recovery/actions/recovery.js +114 -0
- package/dist/_cjs/client/recovery/actions/recovery.js.map +1 -0
- package/dist/_cjs/client/recovery/actions/sendEip712Transaction.js +45 -0
- package/dist/_cjs/client/recovery/actions/sendEip712Transaction.js.map +1 -0
- package/dist/_cjs/client/recovery/client.js +49 -0
- package/dist/_cjs/client/recovery/client.js.map +1 -0
- package/dist/_cjs/client/recovery/decorators/publicActionsRewrite.js +33 -0
- package/dist/_cjs/client/recovery/decorators/publicActionsRewrite.js.map +1 -0
- package/dist/_cjs/client/recovery/decorators/recovery.js +15 -0
- package/dist/_cjs/client/recovery/decorators/recovery.js.map +1 -0
- package/dist/_cjs/client/recovery/decorators/wallet.js +46 -0
- package/dist/_cjs/client/recovery/decorators/wallet.js.map +1 -0
- package/dist/_cjs/client/recovery/index.js +19 -0
- package/dist/_cjs/client/recovery/index.js.map +1 -0
- package/dist/_cjs/client/session/actions/session.js +3 -3
- package/dist/_cjs/client/session/actions/session.js.map +1 -1
- package/dist/_cjs/client/session/decorators/wallet.js +7 -0
- package/dist/_cjs/client/session/decorators/wallet.js.map +1 -1
- package/dist/_cjs/client/utils/getEip712Domain.js +1 -1
- package/dist/_cjs/client/utils/getEip712Domain.js.map +1 -1
- package/dist/_cjs/client-auth-server/Signer.js +1 -0
- package/dist/_cjs/client-auth-server/Signer.js.map +1 -1
- package/dist/_cjs/client-auth-server/WalletProvider.js +1 -0
- package/dist/_cjs/client-auth-server/WalletProvider.js.map +1 -1
- package/dist/_cjs/connector/index.js +1 -0
- package/dist/_cjs/connector/index.js.map +1 -1
- package/dist/_cjs/utils/encoding.js +6 -3
- package/dist/_cjs/utils/encoding.js.map +1 -1
- package/dist/_cjs/utils/passkey.js +4 -2
- package/dist/_cjs/utils/passkey.js.map +1 -1
- package/dist/_esm/abi/{Factory.js → AAFactory.js} +111 -62
- package/dist/_esm/abi/AAFactory.js.map +1 -0
- package/dist/_esm/abi/GuardianRecoveryValidator.js +815 -0
- package/dist/_esm/abi/GuardianRecoveryValidator.js.map +1 -0
- package/dist/_esm/abi/{SessionKeyModule.js → SessionKeyValidator.js} +250 -89
- package/dist/_esm/abi/SessionKeyValidator.js.map +1 -0
- package/dist/_esm/abi/SsoAccount.js +1285 -0
- package/dist/_esm/abi/SsoAccount.js.map +1 -0
- package/dist/_esm/abi/WebAuthValidator.js +358 -0
- package/dist/_esm/abi/WebAuthValidator.js.map +1 -0
- package/dist/_esm/abi/index.js +5 -2
- package/dist/_esm/abi/index.js.map +1 -1
- package/dist/_esm/client/ecdsa/account.js +35 -0
- package/dist/_esm/client/ecdsa/account.js.map +1 -0
- package/dist/_esm/client/ecdsa/actions/account.js +81 -0
- package/dist/_esm/client/ecdsa/actions/account.js.map +1 -0
- package/dist/_esm/client/ecdsa/client.js +32 -0
- package/dist/_esm/client/ecdsa/client.js.map +1 -0
- package/dist/_esm/client/ecdsa/decorators/ecdsa.js +19 -0
- package/dist/_esm/client/ecdsa/decorators/ecdsa.js.map +1 -0
- package/dist/_esm/client/ecdsa/decorators/wallet.js +54 -0
- package/dist/_esm/client/ecdsa/decorators/wallet.js.map +1 -0
- package/dist/_esm/client/ecdsa/index.js +7 -0
- package/dist/_esm/client/ecdsa/index.js.map +1 -0
- package/dist/_esm/client/ecdsa/types.js +61 -0
- package/dist/_esm/client/ecdsa/types.js.map +1 -0
- package/dist/_esm/client/index.js +76 -1
- package/dist/_esm/client/index.js.map +1 -1
- package/dist/_esm/client/passkey/account.js +5 -5
- package/dist/_esm/client/passkey/account.js.map +1 -1
- package/dist/_esm/client/passkey/actions/account.js +58 -33
- package/dist/_esm/client/passkey/actions/account.js.map +1 -1
- package/dist/_esm/client/passkey/actions/passkey.js +39 -18
- package/dist/_esm/client/passkey/actions/passkey.js.map +1 -1
- package/dist/_esm/client/passkey/client.js +4 -1
- package/dist/_esm/client/passkey/client.js.map +1 -1
- package/dist/_esm/client/passkey/decorators/passkey.js +19 -0
- package/dist/_esm/client/passkey/decorators/passkey.js.map +1 -1
- package/dist/_esm/client/passkey/decorators/wallet.js +8 -1
- package/dist/_esm/client/passkey/decorators/wallet.js.map +1 -1
- package/dist/_esm/client/recovery/account.js +43 -0
- package/dist/_esm/client/recovery/account.js.map +1 -0
- package/dist/_esm/client/recovery/actions/recovery.js +111 -0
- package/dist/_esm/client/recovery/actions/recovery.js.map +1 -0
- package/dist/_esm/client/recovery/actions/sendEip712Transaction.js +93 -0
- package/dist/_esm/client/recovery/actions/sendEip712Transaction.js.map +1 -0
- package/dist/_esm/client/recovery/client.js +45 -0
- package/dist/_esm/client/recovery/client.js.map +1 -0
- package/dist/_esm/client/recovery/decorators/publicActionsRewrite.js +31 -0
- package/dist/_esm/client/recovery/decorators/publicActionsRewrite.js.map +1 -0
- package/dist/_esm/client/recovery/decorators/recovery.js +13 -0
- package/dist/_esm/client/recovery/decorators/recovery.js.map +1 -0
- package/dist/_esm/client/recovery/decorators/wallet.js +45 -0
- package/dist/_esm/client/recovery/decorators/wallet.js.map +1 -0
- package/dist/_esm/client/recovery/index.js +3 -0
- package/dist/_esm/client/recovery/index.js.map +1 -0
- package/dist/_esm/client/session/actions/session.js +3 -3
- package/dist/_esm/client/session/actions/session.js.map +1 -1
- package/dist/_esm/client/session/decorators/wallet.js +8 -130
- package/dist/_esm/client/session/decorators/wallet.js.map +1 -1
- package/dist/_esm/client/utils/getEip712Domain.js +1 -1
- package/dist/_esm/client/utils/getEip712Domain.js.map +1 -1
- package/dist/_esm/client-auth-server/Signer.js +1 -0
- package/dist/_esm/client-auth-server/Signer.js.map +1 -1
- package/dist/_esm/client-auth-server/WalletProvider.js +1 -0
- package/dist/_esm/client-auth-server/WalletProvider.js.map +1 -1
- package/dist/_esm/connector/index.js +1 -0
- package/dist/_esm/connector/index.js.map +1 -1
- package/dist/_esm/utils/encoding.js +7 -4
- package/dist/_esm/utils/encoding.js.map +1 -1
- package/dist/_esm/utils/passkey.js +5 -3
- package/dist/_esm/utils/passkey.js.map +1 -1
- package/dist/_types/abi/{Factory.d.ts → AAFactory.d.ts} +95 -58
- package/dist/_types/abi/AAFactory.d.ts.map +1 -0
- package/dist/_types/abi/GuardianRecoveryValidator.d.ts +630 -0
- package/dist/_types/abi/GuardianRecoveryValidator.d.ts.map +1 -0
- package/dist/_types/abi/{SessionKeyModule.d.ts → SessionKeyValidator.d.ts} +193 -75
- package/dist/_types/abi/{SessionKeyModule.d.ts.map → SessionKeyValidator.d.ts.map} +1 -1
- package/dist/_types/abi/SsoAccount.d.ts +992 -0
- package/dist/_types/abi/SsoAccount.d.ts.map +1 -0
- package/dist/_types/abi/WebAuthValidator.d.ts +277 -0
- package/dist/_types/abi/WebAuthValidator.d.ts.map +1 -0
- package/dist/_types/abi/index.d.ts +5 -2
- package/dist/_types/abi/index.d.ts.map +1 -1
- package/dist/_types/client/ecdsa/account.d.ts +14 -0
- package/dist/_types/client/ecdsa/account.d.ts.map +1 -0
- package/dist/_types/client/ecdsa/actions/account.d.ts +38 -0
- package/dist/_types/client/ecdsa/actions/account.d.ts.map +1 -0
- package/dist/_types/client/ecdsa/client.d.ts +25 -0
- package/dist/_types/client/ecdsa/client.d.ts.map +1 -0
- package/dist/_types/client/ecdsa/decorators/ecdsa.d.ts +16 -0
- package/dist/_types/client/ecdsa/decorators/ecdsa.d.ts.map +1 -0
- package/dist/_types/client/ecdsa/decorators/wallet.d.ts +5 -0
- package/dist/_types/client/ecdsa/decorators/wallet.d.ts.map +1 -0
- package/dist/_types/client/ecdsa/index.d.ts +7 -0
- package/dist/_types/client/ecdsa/index.d.ts.map +1 -0
- package/dist/_types/client/ecdsa/types.d.ts +10 -0
- package/dist/_types/client/ecdsa/types.d.ts.map +1 -0
- package/dist/_types/client/index.d.ts +30 -1
- package/dist/_types/client/index.d.ts.map +1 -1
- package/dist/_types/client/passkey/account.d.ts +7 -3
- package/dist/_types/client/passkey/account.d.ts.map +1 -1
- package/dist/_types/client/passkey/actions/account.d.ts +10 -1
- package/dist/_types/client/passkey/actions/account.d.ts.map +1 -1
- package/dist/_types/client/passkey/actions/passkey.d.ts +14 -6
- package/dist/_types/client/passkey/actions/passkey.d.ts.map +1 -1
- package/dist/_types/client/passkey/client.d.ts +1 -0
- package/dist/_types/client/passkey/client.d.ts.map +1 -1
- package/dist/_types/client/passkey/decorators/passkey.d.ts +4 -0
- package/dist/_types/client/passkey/decorators/passkey.d.ts.map +1 -1
- package/dist/_types/client/passkey/decorators/wallet.d.ts.map +1 -1
- package/dist/_types/client/recovery/account.d.ts +14 -0
- package/dist/_types/client/recovery/account.d.ts.map +1 -0
- package/dist/_types/client/recovery/actions/recovery.d.ts +50 -0
- package/dist/_types/client/recovery/actions/recovery.d.ts.map +1 -0
- package/dist/_types/client/recovery/actions/sendEip712Transaction.d.ts +60 -0
- package/dist/_types/client/recovery/actions/sendEip712Transaction.d.ts.map +1 -0
- package/dist/_types/client/recovery/client.d.ts +23 -0
- package/dist/_types/client/recovery/client.d.ts.map +1 -0
- package/dist/_types/client/recovery/decorators/publicActionsRewrite.d.ts +4 -0
- package/dist/_types/client/recovery/decorators/publicActionsRewrite.d.ts.map +1 -0
- package/dist/_types/client/recovery/decorators/recovery.d.ts +8 -0
- package/dist/_types/client/recovery/decorators/recovery.d.ts.map +1 -0
- package/dist/_types/client/recovery/decorators/wallet.d.ts +5 -0
- package/dist/_types/client/recovery/decorators/wallet.d.ts.map +1 -0
- package/dist/_types/client/recovery/index.d.ts +3 -0
- package/dist/_types/client/recovery/index.d.ts.map +1 -0
- package/dist/_types/client/session/decorators/wallet.d.ts.map +1 -1
- package/dist/_types/client-auth-server/Signer.d.ts +3851 -1028
- package/dist/_types/client-auth-server/Signer.d.ts.map +1 -1
- package/dist/_types/client-auth-server/WalletProvider.d.ts +3851 -1028
- package/dist/_types/client-auth-server/WalletProvider.d.ts.map +1 -1
- package/dist/_types/client-auth-server/interface.d.ts +1 -0
- package/dist/_types/client-auth-server/interface.d.ts.map +1 -1
- package/dist/_types/connector/index.d.ts.map +1 -1
- package/dist/_types/utils/encoding.d.ts +1 -0
- package/dist/_types/utils/encoding.d.ts.map +1 -1
- package/dist/_types/utils/passkey.d.ts +2 -2
- package/dist/_types/utils/passkey.d.ts.map +1 -1
- package/package.json +14 -5
- package/src/abi/{Factory.ts → AAFactory.ts} +110 -61
- package/src/abi/GuardianRecoveryValidator.ts +814 -0
- package/src/abi/{SessionKeyModule.ts → SessionKeyValidator.ts} +249 -88
- package/src/abi/SsoAccount.ts +1284 -0
- package/src/abi/WebAuthValidator.ts +357 -0
- package/src/abi/index.ts +5 -2
- package/src/client/ecdsa/account.ts +56 -0
- package/src/client/ecdsa/actions/account.ts +145 -0
- package/src/client/ecdsa/client.ts +90 -0
- package/src/client/ecdsa/decorators/ecdsa.ts +32 -0
- package/src/client/ecdsa/decorators/wallet.ts +80 -0
- package/src/client/ecdsa/index.ts +6 -0
- package/src/client/ecdsa/types.ts +108 -0
- package/src/client/index.ts +121 -1
- package/src/client/passkey/account.ts +19 -9
- package/src/client/passkey/actions/account.ts +72 -34
- package/src/client/passkey/actions/passkey.ts +60 -24
- package/src/client/passkey/client.ts +9 -1
- package/src/client/passkey/decorators/passkey.ts +26 -0
- package/src/client/passkey/decorators/wallet.ts +9 -2
- package/src/client/recovery/account.ts +61 -0
- package/src/client/recovery/actions/recovery.ts +176 -0
- package/src/client/recovery/actions/sendEip712Transaction.ts +149 -0
- package/src/client/recovery/client.ts +102 -0
- package/src/client/recovery/decorators/publicActionsRewrite.ts +38 -0
- package/src/client/recovery/decorators/recovery.ts +22 -0
- package/src/client/recovery/decorators/wallet.ts +59 -0
- package/src/client/recovery/index.ts +2 -0
- package/src/client/session/actions/session.ts +3 -3
- package/src/client/session/decorators/wallet.ts +12 -133
- package/src/client/utils/getEip712Domain.ts +1 -1
- package/src/client-auth-server/Signer.ts +2 -1
- package/src/client-auth-server/WalletProvider.ts +1 -0
- package/src/client-auth-server/interface.ts +1 -0
- package/src/connector/index.ts +1 -0
- package/src/utils/encoding.ts +8 -5
- package/src/utils/passkey.ts +6 -3
- package/dist/_cjs/abi/Factory.js.map +0 -1
- package/dist/_cjs/abi/SessionKeyModule.js.map +0 -1
- package/dist/_esm/abi/Factory.js.map +0 -1
- package/dist/_esm/abi/SessionKeyModule.js.map +0 -1
- package/dist/_types/abi/Factory.d.ts.map +0 -1
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
export const WebAuthValidatorAbi = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [],
|
|
4
|
+
name: "ACCOUNT_EXISTS",
|
|
5
|
+
type: "error",
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
inputs: [],
|
|
9
|
+
name: "BAD_CREDENTIAL_ID_LENGTH",
|
|
10
|
+
type: "error",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
inputs: [],
|
|
14
|
+
name: "BAD_DOMAIN_LENGTH",
|
|
15
|
+
type: "error",
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
inputs: [],
|
|
19
|
+
name: "EMPTY_KEY",
|
|
20
|
+
type: "error",
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
inputs: [],
|
|
24
|
+
name: "KEY_EXISTS",
|
|
25
|
+
type: "error",
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
inputs: [
|
|
29
|
+
{
|
|
30
|
+
internalType: "address",
|
|
31
|
+
name: "account",
|
|
32
|
+
type: "address",
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
name: "NOT_KEY_OWNER",
|
|
36
|
+
type: "error",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
anonymous: false,
|
|
40
|
+
inputs: [
|
|
41
|
+
{
|
|
42
|
+
indexed: true,
|
|
43
|
+
internalType: "address",
|
|
44
|
+
name: "keyOwner",
|
|
45
|
+
type: "address",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
indexed: false,
|
|
49
|
+
internalType: "string",
|
|
50
|
+
name: "originDomain",
|
|
51
|
+
type: "string",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
indexed: false,
|
|
55
|
+
internalType: "bytes",
|
|
56
|
+
name: "credentialId",
|
|
57
|
+
type: "bytes",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
name: "PasskeyCreated",
|
|
61
|
+
type: "event",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
anonymous: false,
|
|
65
|
+
inputs: [
|
|
66
|
+
{
|
|
67
|
+
indexed: true,
|
|
68
|
+
internalType: "address",
|
|
69
|
+
name: "keyOwner",
|
|
70
|
+
type: "address",
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
indexed: false,
|
|
74
|
+
internalType: "string",
|
|
75
|
+
name: "originDomain",
|
|
76
|
+
type: "string",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
indexed: false,
|
|
80
|
+
internalType: "bytes",
|
|
81
|
+
name: "credentialId",
|
|
82
|
+
type: "bytes",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
name: "PasskeyRemoved",
|
|
86
|
+
type: "event",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
inputs: [
|
|
90
|
+
{
|
|
91
|
+
internalType: "bytes",
|
|
92
|
+
name: "credentialId",
|
|
93
|
+
type: "bytes",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
internalType: "bytes32[2]",
|
|
97
|
+
name: "rawPublicKey",
|
|
98
|
+
type: "bytes32[2]",
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
internalType: "string",
|
|
102
|
+
name: "originDomain",
|
|
103
|
+
type: "string",
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
name: "addValidationKey",
|
|
107
|
+
outputs: [],
|
|
108
|
+
stateMutability: "nonpayable",
|
|
109
|
+
type: "function",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
inputs: [
|
|
113
|
+
{
|
|
114
|
+
internalType: "string",
|
|
115
|
+
name: "originDomain",
|
|
116
|
+
type: "string",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
internalType: "bytes",
|
|
120
|
+
name: "credentialId",
|
|
121
|
+
type: "bytes",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
internalType: "address",
|
|
125
|
+
name: "accountAddress",
|
|
126
|
+
type: "address",
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
name: "getAccountKey",
|
|
130
|
+
outputs: [
|
|
131
|
+
{
|
|
132
|
+
internalType: "bytes32[2]",
|
|
133
|
+
name: "",
|
|
134
|
+
type: "bytes32[2]",
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
stateMutability: "view",
|
|
138
|
+
type: "function",
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
inputs: [
|
|
142
|
+
{
|
|
143
|
+
internalType: "bytes",
|
|
144
|
+
name: "data",
|
|
145
|
+
type: "bytes",
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
name: "onInstall",
|
|
149
|
+
outputs: [],
|
|
150
|
+
stateMutability: "nonpayable",
|
|
151
|
+
type: "function",
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
inputs: [
|
|
155
|
+
{
|
|
156
|
+
internalType: "bytes",
|
|
157
|
+
name: "data",
|
|
158
|
+
type: "bytes",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
name: "onUninstall",
|
|
162
|
+
outputs: [],
|
|
163
|
+
stateMutability: "nonpayable",
|
|
164
|
+
type: "function",
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
inputs: [
|
|
168
|
+
{
|
|
169
|
+
internalType: "string",
|
|
170
|
+
name: "originDomain",
|
|
171
|
+
type: "string",
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
internalType: "bytes",
|
|
175
|
+
name: "credentialId",
|
|
176
|
+
type: "bytes",
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
name: "registeredAddress",
|
|
180
|
+
outputs: [
|
|
181
|
+
{
|
|
182
|
+
internalType: "address",
|
|
183
|
+
name: "accountAddress",
|
|
184
|
+
type: "address",
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
stateMutability: "view",
|
|
188
|
+
type: "function",
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
inputs: [
|
|
192
|
+
{
|
|
193
|
+
internalType: "bytes",
|
|
194
|
+
name: "credentialId",
|
|
195
|
+
type: "bytes",
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
internalType: "string",
|
|
199
|
+
name: "domain",
|
|
200
|
+
type: "string",
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
name: "removeValidationKey",
|
|
204
|
+
outputs: [],
|
|
205
|
+
stateMutability: "nonpayable",
|
|
206
|
+
type: "function",
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
inputs: [
|
|
210
|
+
{
|
|
211
|
+
internalType: "bytes4",
|
|
212
|
+
name: "interfaceId",
|
|
213
|
+
type: "bytes4",
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
name: "supportsInterface",
|
|
217
|
+
outputs: [
|
|
218
|
+
{
|
|
219
|
+
internalType: "bool",
|
|
220
|
+
name: "",
|
|
221
|
+
type: "bool",
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
stateMutability: "pure",
|
|
225
|
+
type: "function",
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
inputs: [
|
|
229
|
+
{
|
|
230
|
+
internalType: "bytes32",
|
|
231
|
+
name: "signedHash",
|
|
232
|
+
type: "bytes32",
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
internalType: "bytes",
|
|
236
|
+
name: "signature",
|
|
237
|
+
type: "bytes",
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
name: "validateSignature",
|
|
241
|
+
outputs: [
|
|
242
|
+
{
|
|
243
|
+
internalType: "bool",
|
|
244
|
+
name: "",
|
|
245
|
+
type: "bool",
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
stateMutability: "view",
|
|
249
|
+
type: "function",
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
inputs: [
|
|
253
|
+
{
|
|
254
|
+
internalType: "bytes32",
|
|
255
|
+
name: "signedHash",
|
|
256
|
+
type: "bytes32",
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
components: [
|
|
260
|
+
{
|
|
261
|
+
internalType: "uint256",
|
|
262
|
+
name: "txType",
|
|
263
|
+
type: "uint256",
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
internalType: "uint256",
|
|
267
|
+
name: "from",
|
|
268
|
+
type: "uint256",
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
internalType: "uint256",
|
|
272
|
+
name: "to",
|
|
273
|
+
type: "uint256",
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
internalType: "uint256",
|
|
277
|
+
name: "gasLimit",
|
|
278
|
+
type: "uint256",
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
internalType: "uint256",
|
|
282
|
+
name: "gasPerPubdataByteLimit",
|
|
283
|
+
type: "uint256",
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
internalType: "uint256",
|
|
287
|
+
name: "maxFeePerGas",
|
|
288
|
+
type: "uint256",
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
internalType: "uint256",
|
|
292
|
+
name: "maxPriorityFeePerGas",
|
|
293
|
+
type: "uint256",
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
internalType: "uint256",
|
|
297
|
+
name: "paymaster",
|
|
298
|
+
type: "uint256",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
internalType: "uint256",
|
|
302
|
+
name: "nonce",
|
|
303
|
+
type: "uint256",
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
internalType: "uint256",
|
|
307
|
+
name: "value",
|
|
308
|
+
type: "uint256",
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
internalType: "uint256[4]",
|
|
312
|
+
name: "reserved",
|
|
313
|
+
type: "uint256[4]",
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
internalType: "bytes",
|
|
317
|
+
name: "data",
|
|
318
|
+
type: "bytes",
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
internalType: "bytes",
|
|
322
|
+
name: "signature",
|
|
323
|
+
type: "bytes",
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
internalType: "bytes32[]",
|
|
327
|
+
name: "factoryDeps",
|
|
328
|
+
type: "bytes32[]",
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
internalType: "bytes",
|
|
332
|
+
name: "paymasterInput",
|
|
333
|
+
type: "bytes",
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
internalType: "bytes",
|
|
337
|
+
name: "reservedDynamic",
|
|
338
|
+
type: "bytes",
|
|
339
|
+
},
|
|
340
|
+
],
|
|
341
|
+
internalType: "struct Transaction",
|
|
342
|
+
name: "transaction",
|
|
343
|
+
type: "tuple",
|
|
344
|
+
},
|
|
345
|
+
],
|
|
346
|
+
name: "validateTransaction",
|
|
347
|
+
outputs: [
|
|
348
|
+
{
|
|
349
|
+
internalType: "bool",
|
|
350
|
+
name: "",
|
|
351
|
+
type: "bool",
|
|
352
|
+
},
|
|
353
|
+
],
|
|
354
|
+
stateMutability: "view",
|
|
355
|
+
type: "function",
|
|
356
|
+
},
|
|
357
|
+
] as const;
|
package/src/abi/index.ts
CHANGED
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { AAFactoryAbi } from "./AAFactory.js";
|
|
2
|
+
export { GuardianRecoveryValidatorAbi } from "./GuardianRecoveryValidator.js";
|
|
3
|
+
export { SessionKeyValidatorAbi } from "./SessionKeyValidator.js";
|
|
4
|
+
export { SsoAccountAbi } from "./SsoAccount.js";
|
|
5
|
+
export { WebAuthValidatorAbi } from "./WebAuthValidator.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Address } from "abitype";
|
|
2
|
+
import type { CustomSource, LocalAccount } from "viem";
|
|
3
|
+
import { toAccount } from "viem/accounts";
|
|
4
|
+
import { serializeTransaction, type ZksyncTransactionSerializableEIP712 } from "viem/zksync";
|
|
5
|
+
|
|
6
|
+
import { getEip712Domain } from "../utils/getEip712Domain.js";
|
|
7
|
+
import { type Signer, toOwner } from "./types.js";
|
|
8
|
+
|
|
9
|
+
export type ToEcdsaAccountParameters = {
|
|
10
|
+
/** Address of the deployed SSO Wallet */
|
|
11
|
+
address: Address;
|
|
12
|
+
/** Owner of the EOA */
|
|
13
|
+
owner: Signer;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type EcdsaAccount = LocalAccount<"ssoEcdsaAccount"> & {
|
|
17
|
+
sign: NonNullable<CustomSource["sign"]>;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export async function toEcdsaAccount(
|
|
21
|
+
parameters: ToEcdsaAccountParameters,
|
|
22
|
+
): Promise<EcdsaAccount> {
|
|
23
|
+
const { address, owner } = parameters;
|
|
24
|
+
|
|
25
|
+
const localOwner = await toOwner({ owner, address });
|
|
26
|
+
|
|
27
|
+
const account = toAccount({
|
|
28
|
+
address,
|
|
29
|
+
async signMessage({ message }) {
|
|
30
|
+
return localOwner.signMessage({ message });
|
|
31
|
+
},
|
|
32
|
+
async signTransaction(transaction) {
|
|
33
|
+
const signableTransaction = {
|
|
34
|
+
...transaction,
|
|
35
|
+
from: this.address!,
|
|
36
|
+
type: "eip712",
|
|
37
|
+
} as ZksyncTransactionSerializableEIP712;
|
|
38
|
+
|
|
39
|
+
const eip712DomainAndMessage = getEip712Domain(signableTransaction);
|
|
40
|
+
const signature = await localOwner.signTypedData(eip712DomainAndMessage);
|
|
41
|
+
|
|
42
|
+
return serializeTransaction({
|
|
43
|
+
...signableTransaction,
|
|
44
|
+
customSignature: signature,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
async signTypedData(typedData) {
|
|
48
|
+
return localOwner.signTypedData(typedData);
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
...account,
|
|
54
|
+
source: "ssoEcdsaAccount",
|
|
55
|
+
} as EcdsaAccount;
|
|
56
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import type { Account, Address, Chain, Client, Hash, Hex, Prettify, TransactionReceipt, Transport } from "viem";
|
|
2
|
+
import { concat, encodePacked, getAddress, keccak256, parseEventLogs, toHex } from "viem";
|
|
3
|
+
import { readContract, waitForTransactionReceipt, writeContract } from "viem/actions";
|
|
4
|
+
import { getGeneralPaymasterInput } from "viem/zksync";
|
|
5
|
+
|
|
6
|
+
import { AAFactoryAbi } from "../../../abi/AAFactory.js";
|
|
7
|
+
import { type CustomPaymasterHandler } from "../../../paymaster/index.js";
|
|
8
|
+
import { encodeModuleData, encodeSession } from "../../../utils/encoding.js";
|
|
9
|
+
import { noThrow } from "../../../utils/helpers.js";
|
|
10
|
+
import type { SessionConfig } from "../../../utils/session.js";
|
|
11
|
+
|
|
12
|
+
export type DeployAccountArgs = {
|
|
13
|
+
owner: Address; // Wallet owner
|
|
14
|
+
contracts: {
|
|
15
|
+
accountFactory: Address;
|
|
16
|
+
session: Address;
|
|
17
|
+
};
|
|
18
|
+
initialSession?: SessionConfig;
|
|
19
|
+
salt?: Uint8Array; // Random 32 bytes
|
|
20
|
+
prefix?: string; // vendor prefix
|
|
21
|
+
onTransactionSent?: (hash: Hash) => void;
|
|
22
|
+
paymasterHandler?: CustomPaymasterHandler;
|
|
23
|
+
paymaster?: {
|
|
24
|
+
address: Address;
|
|
25
|
+
paymasterInput?: Hex;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type DeployAccountReturnType = {
|
|
30
|
+
address: Address;
|
|
31
|
+
transactionReceipt: TransactionReceipt;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type FetchAccountArgs = {
|
|
35
|
+
prefix?: string; // vendor prefix
|
|
36
|
+
owner: Address; // Wallet owner
|
|
37
|
+
contracts: {
|
|
38
|
+
accountFactory: Address;
|
|
39
|
+
session: Address;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type FetchAccountReturnType = {
|
|
44
|
+
address: Address;
|
|
45
|
+
owner: Address;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const NULL_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
49
|
+
|
|
50
|
+
export const deployAccount = async <
|
|
51
|
+
transport extends Transport,
|
|
52
|
+
chain extends Chain,
|
|
53
|
+
account extends Account,
|
|
54
|
+
>(
|
|
55
|
+
client: Client<transport, chain, account>, // Account deployer (any viem client)
|
|
56
|
+
args: Prettify<DeployAccountArgs>,
|
|
57
|
+
): Promise<DeployAccountReturnType> => {
|
|
58
|
+
if (!args.salt) {
|
|
59
|
+
args.salt = crypto.getRandomValues(new Uint8Array(32));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (args.prefix && args.prefix.length > 12) throw new Error("prefix must not be longer than 12");
|
|
63
|
+
|
|
64
|
+
const uniqueId = concat([toHex(args.prefix || "", { size: 12 }), args.owner]);
|
|
65
|
+
|
|
66
|
+
const encodedSessionKeyModuleData = encodeModuleData({
|
|
67
|
+
address: args.contracts.session,
|
|
68
|
+
parameters: args.initialSession ? encodeSession(args.initialSession) : "0x",
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
let deployProxyArgs = {
|
|
72
|
+
account: client.account!,
|
|
73
|
+
chain: client.chain!,
|
|
74
|
+
address: args.contracts.accountFactory,
|
|
75
|
+
abi: AAFactoryAbi,
|
|
76
|
+
functionName: "deployProxySsoAccount",
|
|
77
|
+
args: [
|
|
78
|
+
uniqueId,
|
|
79
|
+
[encodedSessionKeyModuleData],
|
|
80
|
+
[args.owner],
|
|
81
|
+
],
|
|
82
|
+
} as any;
|
|
83
|
+
|
|
84
|
+
if (args.paymaster) {
|
|
85
|
+
deployProxyArgs = {
|
|
86
|
+
...deployProxyArgs,
|
|
87
|
+
paymaster: args.paymaster.address,
|
|
88
|
+
paymasterInput: args.paymaster.paymasterInput ?? getGeneralPaymasterInput({ innerInput: "0x" }),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const transactionHash = await writeContract(client, deployProxyArgs);
|
|
93
|
+
if (args.onTransactionSent) {
|
|
94
|
+
noThrow(() => args.onTransactionSent?.(transactionHash));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const transactionReceipt = await waitForTransactionReceipt(client, { hash: transactionHash });
|
|
98
|
+
if (transactionReceipt.status !== "success") throw new Error("Account deployment transaction reverted");
|
|
99
|
+
|
|
100
|
+
const accountCreatedEvent = parseEventLogs({ abi: AAFactoryAbi, logs: transactionReceipt.logs })
|
|
101
|
+
.find((log) => log && log.eventName === "AccountCreated");
|
|
102
|
+
|
|
103
|
+
if (!accountCreatedEvent) {
|
|
104
|
+
throw new Error("No contract address in transaction receipt");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const { accountAddress } = accountCreatedEvent.args;
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
address: getAddress(accountAddress),
|
|
111
|
+
transactionReceipt: transactionReceipt,
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const fetchAccount = async <
|
|
116
|
+
transport extends Transport,
|
|
117
|
+
chain extends Chain,
|
|
118
|
+
account extends Account,
|
|
119
|
+
>(
|
|
120
|
+
client: Client<transport, chain, account>, // Account deployer (any viem client)
|
|
121
|
+
args: Prettify<FetchAccountArgs>,
|
|
122
|
+
): Promise<FetchAccountReturnType> => {
|
|
123
|
+
if (!args.contracts.accountFactory) throw new Error("Account factory address is not set");
|
|
124
|
+
|
|
125
|
+
if (args.prefix && args.prefix.length > 12) throw new Error("prefix must not be longer than 12");
|
|
126
|
+
|
|
127
|
+
const uniqueId = concat([toHex(args.prefix || "", { size: 12 }), args.owner]);
|
|
128
|
+
const accountId = keccak256(encodePacked(["bytes32", "address"], [uniqueId, client.account.address]));
|
|
129
|
+
|
|
130
|
+
if (!accountId) throw new Error("No account ID provided");
|
|
131
|
+
|
|
132
|
+
const accountAddress = await readContract(client, {
|
|
133
|
+
abi: AAFactoryAbi,
|
|
134
|
+
address: args.contracts.accountFactory,
|
|
135
|
+
functionName: "accountMappings",
|
|
136
|
+
args: [accountId],
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (!accountAddress || accountAddress == NULL_ADDRESS) throw new Error(`No account found for ID: ${accountId}`);
|
|
140
|
+
|
|
141
|
+
return {
|
|
142
|
+
address: accountAddress,
|
|
143
|
+
owner: args.owner,
|
|
144
|
+
};
|
|
145
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { type Account, type Address, type Chain, type Client, createClient, getAddress, type Prettify, type PublicActions, publicActions, type PublicRpcSchema, type RpcSchema, type Transport, type WalletActions, walletActions, type WalletClientConfig, type WalletRpcSchema } from "viem";
|
|
2
|
+
import { eip712WalletActions } from "viem/zksync";
|
|
3
|
+
|
|
4
|
+
import type { CustomPaymasterHandler } from "../../paymaster/index.js";
|
|
5
|
+
import { toEcdsaAccount } from "./account.js";
|
|
6
|
+
import { type ZksyncSsoEcdsaActions, zksyncSsoEcdsaActions } from "./decorators/ecdsa.js";
|
|
7
|
+
import { zksyncSsoEcdsaWalletActions } from "./decorators/wallet.js";
|
|
8
|
+
import type { Signer } from "./types.js";
|
|
9
|
+
|
|
10
|
+
export async function createZksyncEcdsaClient<
|
|
11
|
+
transport extends Transport,
|
|
12
|
+
chain extends Chain,
|
|
13
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
|
14
|
+
>(_parameters: ZksyncSsoEcdsaClientConfig<transport, chain, rpcSchema>): Promise<ZksyncSsoEcdsaClient<transport, chain, rpcSchema>> {
|
|
15
|
+
type WalletClientParameters = typeof _parameters;
|
|
16
|
+
const parameters: WalletClientParameters & {
|
|
17
|
+
key: NonNullable<WalletClientParameters["key"]>;
|
|
18
|
+
name: NonNullable<WalletClientParameters["name"]>;
|
|
19
|
+
} = {
|
|
20
|
+
..._parameters,
|
|
21
|
+
address: getAddress(_parameters.address),
|
|
22
|
+
key: _parameters.key || "zksync-sso-ecdsa-wallet",
|
|
23
|
+
name: _parameters.name || "ZKsync SSO ECDSA Client",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const account = await toEcdsaAccount({
|
|
27
|
+
address: parameters.address,
|
|
28
|
+
owner: parameters.owner,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const client = createClient<transport, chain, Account, rpcSchema>({
|
|
32
|
+
...parameters,
|
|
33
|
+
account,
|
|
34
|
+
type: "walletClient",
|
|
35
|
+
})
|
|
36
|
+
.extend(() => ({
|
|
37
|
+
contracts: parameters.contracts,
|
|
38
|
+
}))
|
|
39
|
+
.extend(publicActions)
|
|
40
|
+
.extend(walletActions)
|
|
41
|
+
.extend(eip712WalletActions())
|
|
42
|
+
.extend(zksyncSsoEcdsaActions)
|
|
43
|
+
.extend(zksyncSsoEcdsaWalletActions);
|
|
44
|
+
return client;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type EcdsaRequiredContracts = {
|
|
48
|
+
session: Address; // Session, spend limit, etc.
|
|
49
|
+
accountFactory?: Address; // For account creation
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type ZksyncSsoEcdsaData = {
|
|
53
|
+
contracts: EcdsaRequiredContracts;
|
|
54
|
+
paymasterHandler?: CustomPaymasterHandler;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type ClientWithZksyncSsoEcdsaData<
|
|
58
|
+
transport extends Transport = Transport,
|
|
59
|
+
chain extends Chain = Chain,
|
|
60
|
+
> = Client<transport, chain, Account> & ZksyncSsoEcdsaData;
|
|
61
|
+
|
|
62
|
+
export type ZksyncSsoEcdsaClient<
|
|
63
|
+
transport extends Transport = Transport,
|
|
64
|
+
chain extends Chain = Chain,
|
|
65
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
|
66
|
+
account extends Account = Account,
|
|
67
|
+
> = Prettify<
|
|
68
|
+
Client<
|
|
69
|
+
transport,
|
|
70
|
+
chain,
|
|
71
|
+
account,
|
|
72
|
+
rpcSchema extends RpcSchema
|
|
73
|
+
? [...PublicRpcSchema, ...WalletRpcSchema, ...rpcSchema]
|
|
74
|
+
: [...PublicRpcSchema, ...WalletRpcSchema],
|
|
75
|
+
PublicActions<transport, chain, account> & WalletActions<chain, account> & ZksyncSsoEcdsaActions
|
|
76
|
+
> & ZksyncSsoEcdsaData
|
|
77
|
+
>;
|
|
78
|
+
|
|
79
|
+
export interface ZksyncSsoEcdsaClientConfig<
|
|
80
|
+
transport extends Transport = Transport,
|
|
81
|
+
chain extends Chain = Chain,
|
|
82
|
+
rpcSchema extends RpcSchema | undefined = undefined,
|
|
83
|
+
> extends Omit<WalletClientConfig<transport, chain, Account, rpcSchema>, "account"> {
|
|
84
|
+
chain: NonNullable<chain>;
|
|
85
|
+
address: Address;
|
|
86
|
+
owner: Signer;
|
|
87
|
+
contracts: EcdsaRequiredContracts;
|
|
88
|
+
key?: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Chain, type Transport } from "viem";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createSession, type CreateSessionArgs, type CreateSessionReturnType,
|
|
5
|
+
revokeSession, type RevokeSessionArgs, type RevokeSessionReturnType,
|
|
6
|
+
} from "../../session/actions/session.js";
|
|
7
|
+
import type { ClientWithZksyncSsoEcdsaData } from "../client.js";
|
|
8
|
+
|
|
9
|
+
export type ZksyncSsoEcdsaActions = {
|
|
10
|
+
createSession: (args: Omit<CreateSessionArgs, "contracts">) => Promise<CreateSessionReturnType>;
|
|
11
|
+
revokeSession: (args: Omit<RevokeSessionArgs, "contracts">) => Promise<RevokeSessionReturnType>;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export const zksyncSsoEcdsaActions = <
|
|
15
|
+
transport extends Transport = Transport,
|
|
16
|
+
chain extends Chain = Chain,
|
|
17
|
+
>(client: ClientWithZksyncSsoEcdsaData<transport, chain>) => {
|
|
18
|
+
return {
|
|
19
|
+
createSession: async (args: Omit<CreateSessionArgs, "contracts">) => {
|
|
20
|
+
return await createSession(client, {
|
|
21
|
+
...args,
|
|
22
|
+
contracts: client.contracts,
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
revokeSession: async (args: Omit<RevokeSessionArgs, "contracts">) => {
|
|
26
|
+
return await revokeSession(client, {
|
|
27
|
+
...args,
|
|
28
|
+
contracts: client.contracts,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
};
|