@crossmint/client-sdk-smart-wallet 0.1.2 → 0.1.4
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/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +254 -119
- package/dist/index.d.ts +254 -119
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -13
- package/src/SmartWalletSDK.test.ts +12 -13
- package/src/SmartWalletSDK.ts +33 -26
- package/src/api/APIErrorService.ts +10 -7
- package/src/api/BaseCrossmintService.ts +3 -4
- package/src/api/CrossmintWalletService.test.ts +9 -9
- package/src/api/CrossmintWalletService.ts +39 -16
- package/src/blockchain/chains.ts +25 -2
- package/src/blockchain/transfer.ts +1 -1
- package/src/blockchain/wallets/EVMSmartWallet.ts +49 -42
- package/src/blockchain/wallets/account/config.ts +60 -0
- package/src/blockchain/wallets/account/creator.ts +36 -0
- package/src/blockchain/wallets/account/eoa.ts +50 -0
- package/src/blockchain/wallets/{passkey.ts → account/passkey.ts} +32 -32
- package/src/blockchain/wallets/account/signer.ts +44 -0
- package/src/blockchain/wallets/account/strategy.ts +5 -0
- package/src/blockchain/wallets/clientDecorator.ts +6 -6
- package/src/blockchain/wallets/paymaster.ts +12 -15
- package/src/blockchain/wallets/service.ts +38 -143
- package/src/error/index.ts +25 -117
- package/src/error/processor.ts +5 -6
- package/src/index.ts +16 -12
- package/src/services/logging/ConsoleProvider.ts +3 -12
- package/src/services/logging/DatadogProvider.ts +1 -1
- package/src/types/internal.ts +41 -20
- package/src/types/{Config.ts → params.ts} +0 -5
- package/src/types/schema.ts +63 -0
- package/src/types/service.ts +31 -0
- package/src/utils/api.ts +39 -0
- package/src/utils/constants.ts +2 -0
- package/src/utils/log.ts +1 -109
- package/src/utils/signer.ts +14 -16
- package/src/blockchain/wallets/eoa.ts +0 -49
- package/src/types/API.ts +0 -40
- package/src/utils/log.test.ts +0 -76
- /package/src/types/{Tokens.ts → token.ts} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { ObjectValues } from '@crossmint/common-sdk-base';
|
|
2
2
|
export { EVMBlockchainIncludingTestnet as Chain, blockchainToChainId } from '@crossmint/common-sdk-base';
|
|
3
|
-
import { LocalAccount, EIP1193Provider, HttpTransport, Chain,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { LocalAccount, EIP1193Provider, HttpTransport, Chain, PublicClient } from 'viem';
|
|
4
|
+
import { SmartAccountClient, UserOperation } from 'permissionless';
|
|
5
|
+
import { EntryPoint, GetEntryPointVersion } from 'permissionless/types/entrypoint';
|
|
6
|
+
import { CrossmintSDKError, SmartWalletErrorCode } from '@crossmint/client-sdk-base';
|
|
7
|
+
export { CrossmintSDKError, CrossmintServiceError, JWTDecryptionError, JWTExpiredError, JWTIdentifierError, JWTInvalidError, NotAuthorizedError, SmartWalletErrorCode, TransferError } from '@crossmint/client-sdk-base';
|
|
8
|
+
import { z } from 'zod';
|
|
6
9
|
import { SmartAccount } from 'permissionless/accounts';
|
|
7
|
-
import {
|
|
10
|
+
import { PasskeyValidatorContractVersion } from '@zerodev/passkey-validator';
|
|
8
11
|
|
|
9
12
|
declare const SmartWalletChain: {
|
|
10
13
|
readonly BASE: "base";
|
|
11
14
|
readonly POLYGON: "polygon";
|
|
15
|
+
readonly OPTIMISM: "optimism";
|
|
16
|
+
readonly ARBITRUM: "arbitrum";
|
|
12
17
|
readonly BASE_SEPOLIA: "base-sepolia";
|
|
13
18
|
readonly POLYGON_AMOY: "polygon-amoy";
|
|
19
|
+
readonly OPTIMISM_SEPOLIA: "optimism-sepolia";
|
|
20
|
+
readonly ARBITRUM_SEPOLIA: "arbitrum-sepolia";
|
|
14
21
|
};
|
|
15
22
|
type SmartWalletChain = ObjectValues<typeof SmartWalletChain>;
|
|
16
23
|
|
|
24
|
+
declare const SUPPORTED_KERNEL_VERSIONS: readonly ["0.3.1", "0.3.0", "0.2.4"];
|
|
25
|
+
declare const SUPPORTED_ENTRYPOINT_VERSIONS: readonly ["v0.6", "v0.7"];
|
|
26
|
+
|
|
17
27
|
type SmartWalletSDKInitParams = {
|
|
18
28
|
clientApiKey: string;
|
|
19
29
|
};
|
|
@@ -40,21 +50,231 @@ interface WalletParams {
|
|
|
40
50
|
signer: EOASigner | PasskeySigner;
|
|
41
51
|
}
|
|
42
52
|
|
|
43
|
-
declare const SUPPORTED_KERNEL_VERSIONS: readonly ["0.3.1", "0.3.0", "0.2.4"];
|
|
44
53
|
type SupportedKernelVersion = (typeof SUPPORTED_KERNEL_VERSIONS)[number];
|
|
45
|
-
declare const SUPPORTED_ENTRYPOINT_VERSIONS: readonly ["v0.6", "v0.7"];
|
|
46
54
|
type SupportedEntryPointVersion = (typeof SUPPORTED_ENTRYPOINT_VERSIONS)[number];
|
|
47
|
-
type
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
55
|
+
type SmartWalletClient = SmartAccountClient<EntryPoint, HttpTransport, Chain, SmartAccount<EntryPoint>>;
|
|
56
|
+
|
|
57
|
+
declare const EOASignerDataSchema: z.ZodObject<{
|
|
58
|
+
eoaAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
59
|
+
type: z.ZodLiteral<"eoa">;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
type: "eoa";
|
|
62
|
+
eoaAddress: `0x${string}`;
|
|
63
|
+
}, {
|
|
64
|
+
type: "eoa";
|
|
65
|
+
eoaAddress: `0x${string}`;
|
|
66
|
+
}>;
|
|
67
|
+
declare const PasskeySignerDataSchema: z.ZodObject<{
|
|
68
|
+
entryPoint: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
69
|
+
validatorAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
70
|
+
pubKeyX: z.ZodString;
|
|
71
|
+
pubKeyY: z.ZodString;
|
|
72
|
+
authenticatorIdHash: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
73
|
+
authenticatorId: z.ZodString;
|
|
74
|
+
passkeyName: z.ZodString;
|
|
75
|
+
validatorContractVersion: z.ZodNativeEnum<typeof PasskeyValidatorContractVersion>;
|
|
76
|
+
domain: z.ZodString;
|
|
77
|
+
type: z.ZodLiteral<"passkeys">;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
type: "passkeys";
|
|
80
|
+
entryPoint: `0x${string}`;
|
|
81
|
+
domain: string;
|
|
82
|
+
validatorAddress: `0x${string}`;
|
|
51
83
|
pubKeyX: string;
|
|
52
84
|
pubKeyY: string;
|
|
53
|
-
authenticatorIdHash:
|
|
85
|
+
authenticatorIdHash: `0x${string}`;
|
|
54
86
|
authenticatorId: string;
|
|
55
|
-
|
|
56
|
-
|
|
87
|
+
passkeyName: string;
|
|
88
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
89
|
+
}, {
|
|
90
|
+
type: "passkeys";
|
|
91
|
+
entryPoint: `0x${string}`;
|
|
92
|
+
domain: string;
|
|
93
|
+
validatorAddress: `0x${string}`;
|
|
94
|
+
pubKeyX: string;
|
|
95
|
+
pubKeyY: string;
|
|
96
|
+
authenticatorIdHash: `0x${string}`;
|
|
97
|
+
authenticatorId: string;
|
|
98
|
+
passkeyName: string;
|
|
99
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
100
|
+
}>;
|
|
101
|
+
declare const SignerDataSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
102
|
+
entryPoint: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
103
|
+
validatorAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
104
|
+
pubKeyX: z.ZodString;
|
|
105
|
+
pubKeyY: z.ZodString;
|
|
106
|
+
authenticatorIdHash: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
107
|
+
authenticatorId: z.ZodString;
|
|
108
|
+
passkeyName: z.ZodString;
|
|
109
|
+
validatorContractVersion: z.ZodNativeEnum<typeof PasskeyValidatorContractVersion>;
|
|
110
|
+
domain: z.ZodString;
|
|
111
|
+
type: z.ZodLiteral<"passkeys">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
type: "passkeys";
|
|
114
|
+
entryPoint: `0x${string}`;
|
|
115
|
+
domain: string;
|
|
116
|
+
validatorAddress: `0x${string}`;
|
|
117
|
+
pubKeyX: string;
|
|
118
|
+
pubKeyY: string;
|
|
119
|
+
authenticatorIdHash: `0x${string}`;
|
|
120
|
+
authenticatorId: string;
|
|
121
|
+
passkeyName: string;
|
|
122
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
123
|
+
}, {
|
|
124
|
+
type: "passkeys";
|
|
125
|
+
entryPoint: `0x${string}`;
|
|
126
|
+
domain: string;
|
|
127
|
+
validatorAddress: `0x${string}`;
|
|
128
|
+
pubKeyX: string;
|
|
129
|
+
pubKeyY: string;
|
|
130
|
+
authenticatorIdHash: `0x${string}`;
|
|
131
|
+
authenticatorId: string;
|
|
132
|
+
passkeyName: string;
|
|
133
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
134
|
+
}>, z.ZodObject<{
|
|
135
|
+
eoaAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
136
|
+
type: z.ZodLiteral<"eoa">;
|
|
137
|
+
}, "strip", z.ZodTypeAny, {
|
|
138
|
+
type: "eoa";
|
|
139
|
+
eoaAddress: `0x${string}`;
|
|
140
|
+
}, {
|
|
141
|
+
type: "eoa";
|
|
142
|
+
eoaAddress: `0x${string}`;
|
|
143
|
+
}>]>;
|
|
144
|
+
declare const SmartWalletConfigSchema: z.ZodObject<{
|
|
145
|
+
kernelVersion: z.ZodEnum<["0.3.1", "0.3.0", "0.2.4"]>;
|
|
146
|
+
entryPointVersion: z.ZodEnum<["v0.6", "v0.7"]>;
|
|
147
|
+
userId: z.ZodString;
|
|
148
|
+
signers: z.ZodArray<z.ZodObject<{
|
|
149
|
+
signerData: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
150
|
+
entryPoint: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
151
|
+
validatorAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
152
|
+
pubKeyX: z.ZodString;
|
|
153
|
+
pubKeyY: z.ZodString;
|
|
154
|
+
authenticatorIdHash: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
155
|
+
authenticatorId: z.ZodString;
|
|
156
|
+
passkeyName: z.ZodString;
|
|
157
|
+
validatorContractVersion: z.ZodNativeEnum<typeof PasskeyValidatorContractVersion>;
|
|
158
|
+
domain: z.ZodString;
|
|
159
|
+
type: z.ZodLiteral<"passkeys">;
|
|
160
|
+
}, "strip", z.ZodTypeAny, {
|
|
161
|
+
type: "passkeys";
|
|
162
|
+
entryPoint: `0x${string}`;
|
|
163
|
+
domain: string;
|
|
164
|
+
validatorAddress: `0x${string}`;
|
|
165
|
+
pubKeyX: string;
|
|
166
|
+
pubKeyY: string;
|
|
167
|
+
authenticatorIdHash: `0x${string}`;
|
|
168
|
+
authenticatorId: string;
|
|
169
|
+
passkeyName: string;
|
|
170
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
171
|
+
}, {
|
|
172
|
+
type: "passkeys";
|
|
173
|
+
entryPoint: `0x${string}`;
|
|
174
|
+
domain: string;
|
|
175
|
+
validatorAddress: `0x${string}`;
|
|
176
|
+
pubKeyX: string;
|
|
177
|
+
pubKeyY: string;
|
|
178
|
+
authenticatorIdHash: `0x${string}`;
|
|
179
|
+
authenticatorId: string;
|
|
180
|
+
passkeyName: string;
|
|
181
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
182
|
+
}>, z.ZodObject<{
|
|
183
|
+
eoaAddress: z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>;
|
|
184
|
+
type: z.ZodLiteral<"eoa">;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
type: "eoa";
|
|
187
|
+
eoaAddress: `0x${string}`;
|
|
188
|
+
}, {
|
|
189
|
+
type: "eoa";
|
|
190
|
+
eoaAddress: `0x${string}`;
|
|
191
|
+
}>]>;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
signerData: {
|
|
194
|
+
type: "eoa";
|
|
195
|
+
eoaAddress: `0x${string}`;
|
|
196
|
+
} | {
|
|
197
|
+
type: "passkeys";
|
|
198
|
+
entryPoint: `0x${string}`;
|
|
199
|
+
domain: string;
|
|
200
|
+
validatorAddress: `0x${string}`;
|
|
201
|
+
pubKeyX: string;
|
|
202
|
+
pubKeyY: string;
|
|
203
|
+
authenticatorIdHash: `0x${string}`;
|
|
204
|
+
authenticatorId: string;
|
|
205
|
+
passkeyName: string;
|
|
206
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
207
|
+
};
|
|
208
|
+
}, {
|
|
209
|
+
signerData: {
|
|
210
|
+
type: "eoa";
|
|
211
|
+
eoaAddress: `0x${string}`;
|
|
212
|
+
} | {
|
|
213
|
+
type: "passkeys";
|
|
214
|
+
entryPoint: `0x${string}`;
|
|
215
|
+
domain: string;
|
|
216
|
+
validatorAddress: `0x${string}`;
|
|
217
|
+
pubKeyX: string;
|
|
218
|
+
pubKeyY: string;
|
|
219
|
+
authenticatorIdHash: `0x${string}`;
|
|
220
|
+
authenticatorId: string;
|
|
221
|
+
passkeyName: string;
|
|
222
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
223
|
+
};
|
|
224
|
+
}>, "many">;
|
|
225
|
+
smartContractWalletAddress: z.ZodOptional<z.ZodType<`0x${string}`, z.ZodTypeDef, `0x${string}`>>;
|
|
226
|
+
}, "strip", z.ZodTypeAny, {
|
|
227
|
+
kernelVersion: "0.3.1" | "0.3.0" | "0.2.4";
|
|
228
|
+
entryPointVersion: "v0.6" | "v0.7";
|
|
229
|
+
userId: string;
|
|
230
|
+
signers: {
|
|
231
|
+
signerData: {
|
|
232
|
+
type: "eoa";
|
|
233
|
+
eoaAddress: `0x${string}`;
|
|
234
|
+
} | {
|
|
235
|
+
type: "passkeys";
|
|
236
|
+
entryPoint: `0x${string}`;
|
|
237
|
+
domain: string;
|
|
238
|
+
validatorAddress: `0x${string}`;
|
|
239
|
+
pubKeyX: string;
|
|
240
|
+
pubKeyY: string;
|
|
241
|
+
authenticatorIdHash: `0x${string}`;
|
|
242
|
+
authenticatorId: string;
|
|
243
|
+
passkeyName: string;
|
|
244
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
245
|
+
};
|
|
246
|
+
}[];
|
|
247
|
+
smartContractWalletAddress?: `0x${string}` | undefined;
|
|
248
|
+
}, {
|
|
249
|
+
kernelVersion: "0.3.1" | "0.3.0" | "0.2.4";
|
|
250
|
+
entryPointVersion: "v0.6" | "v0.7";
|
|
251
|
+
userId: string;
|
|
252
|
+
signers: {
|
|
253
|
+
signerData: {
|
|
254
|
+
type: "eoa";
|
|
255
|
+
eoaAddress: `0x${string}`;
|
|
256
|
+
} | {
|
|
257
|
+
type: "passkeys";
|
|
258
|
+
entryPoint: `0x${string}`;
|
|
259
|
+
domain: string;
|
|
260
|
+
validatorAddress: `0x${string}`;
|
|
261
|
+
pubKeyX: string;
|
|
262
|
+
pubKeyY: string;
|
|
263
|
+
authenticatorIdHash: `0x${string}`;
|
|
264
|
+
authenticatorId: string;
|
|
265
|
+
passkeyName: string;
|
|
266
|
+
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
267
|
+
};
|
|
268
|
+
}[];
|
|
269
|
+
smartContractWalletAddress?: `0x${string}` | undefined;
|
|
270
|
+
}>;
|
|
57
271
|
|
|
272
|
+
type EOASignerData = z.infer<typeof EOASignerDataSchema>;
|
|
273
|
+
type PasskeySignerData = z.infer<typeof PasskeySignerDataSchema>;
|
|
274
|
+
type SmartWalletConfig = z.infer<typeof SmartWalletConfigSchema>;
|
|
275
|
+
type SignerData = z.infer<typeof SignerDataSchema>;
|
|
276
|
+
type PasskeyDisplay = Pick<PasskeySignerData, "type" | "passkeyName" | "pubKeyX" | "pubKeyY">;
|
|
277
|
+
type SignerDisplay = EOASignerData | PasskeyDisplay;
|
|
58
278
|
type StoreSmartWalletParams = {
|
|
59
279
|
type: string;
|
|
60
280
|
smartContractWalletAddress: string;
|
|
@@ -66,139 +286,59 @@ type StoreSmartWalletParams = {
|
|
|
66
286
|
entryPointVersion: SupportedEntryPointVersion;
|
|
67
287
|
kernelVersion: SupportedKernelVersion;
|
|
68
288
|
};
|
|
69
|
-
type SignerData = EOASignerData | PasskeySignerData;
|
|
70
|
-
interface EOASignerData {
|
|
71
|
-
eoaAddress: string;
|
|
72
|
-
type: "eoa";
|
|
73
|
-
}
|
|
74
|
-
type PasskeySignerData = PasskeyValidatorSerializedData & {
|
|
75
|
-
passkeyName: string;
|
|
76
|
-
validatorContractVersion: PasskeyValidatorContractVersion;
|
|
77
|
-
domain: string;
|
|
78
|
-
type: "passkeys";
|
|
79
|
-
};
|
|
80
|
-
type PasskeyDisplay = Pick<PasskeySignerData, "type" | "passkeyName" | "pubKeyX" | "pubKeyY">;
|
|
81
|
-
type SignerDisplay = EOASignerData | PasskeyDisplay;
|
|
82
289
|
|
|
83
|
-
declare class
|
|
84
|
-
private extraInfo;
|
|
85
|
-
private logIdempotencyKey;
|
|
86
|
-
constructor(className: string, extraInfo?: {}, logIdempotencyKey?: string);
|
|
87
|
-
private logInput;
|
|
88
|
-
private logOutput;
|
|
89
|
-
private logError;
|
|
90
|
-
protected logPerformance<T>(name: string, cb: () => Promise<T>): Promise<T>;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
declare const SmartWalletErrors: {
|
|
94
|
-
readonly NOT_AUTHORIZED: "smart-wallet:not-authorized";
|
|
95
|
-
readonly TRANSFER: "smart-wallet:transfer.error";
|
|
96
|
-
readonly CROSSMINT_SERVICE: "smart-wallet:crossmint-service.error";
|
|
97
|
-
readonly ERROR_JWT_EXPIRED: "smart-wallet:not-authorized.jwt-expired";
|
|
98
|
-
readonly ERROR_JWT_INVALID: "smart-wallet:not-authorized.jwt-invalid";
|
|
99
|
-
readonly ERROR_JWT_DECRYPTION: "smart-wallet:not-authorized.jwt-decryption";
|
|
100
|
-
readonly ERROR_JWT_IDENTIFIER: "smart-wallet:not-authorized.jwt-identifier";
|
|
101
|
-
readonly ERROR_USER_WALLET_ALREADY_CREATED: "smart-wallet:user-wallet-already-created.error";
|
|
102
|
-
readonly ERROR_OUT_OF_CREDITS: "smart-wallet:out-of-credits.error";
|
|
103
|
-
readonly ERROR_WALLET_CONFIG: "smart-wallet:wallet-config.error";
|
|
104
|
-
readonly ERROR_ADMIN_MISMATCH: "smart-wallet:wallet-config.admin-mismatch";
|
|
105
|
-
readonly ERROR_PASSKEY_MISMATCH: "smart-wallet:wallet-config.passkey-mismatch";
|
|
106
|
-
readonly ERROR_PASSKEY_PROMPT: "smart-wallet:passkey.prompt";
|
|
107
|
-
readonly ERROR_PASSKEY_INCOMPATIBLE_AUTHENTICATOR: "smart-wallet.passkey.incompatible-authenticator";
|
|
108
|
-
readonly ERROR_PASSKEY_REGISTRATION: "smart-wallet:passkey.registration";
|
|
109
|
-
readonly ERROR_ADMIN_SIGNER_ALREADY_USED: "smart-wallet:wallet-config.admin-signer-already-used";
|
|
110
|
-
readonly ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED: "smart-wallet:wallet-config.non-custodial-wallets-not-enabled";
|
|
111
|
-
readonly UNCATEGORIZED: "smart-wallet:uncategorized";
|
|
112
|
-
};
|
|
113
|
-
type SmartWalletErrorCode = (typeof SmartWalletErrors)[keyof typeof SmartWalletErrors];
|
|
114
|
-
declare class SmartWalletSDKError extends Error {
|
|
115
|
-
readonly code: SmartWalletErrorCode;
|
|
116
|
-
readonly details?: string;
|
|
290
|
+
declare class SmartWalletError extends CrossmintSDKError {
|
|
117
291
|
constructor(message: string, details?: string, code?: SmartWalletErrorCode);
|
|
118
292
|
}
|
|
119
|
-
declare class
|
|
120
|
-
constructor(message: string);
|
|
121
|
-
}
|
|
122
|
-
declare class CrossmintServiceError extends SmartWalletSDKError {
|
|
123
|
-
status?: number;
|
|
124
|
-
constructor(message: string, status?: number);
|
|
125
|
-
}
|
|
126
|
-
declare class AdminMismatchError extends SmartWalletSDKError {
|
|
293
|
+
declare class AdminMismatchError extends SmartWalletError {
|
|
127
294
|
readonly required: SignerDisplay;
|
|
128
295
|
readonly used?: SignerDisplay;
|
|
129
296
|
constructor(message: string, required: SignerDisplay, used?: SignerDisplay);
|
|
130
297
|
}
|
|
131
|
-
declare class PasskeyMismatchError extends
|
|
298
|
+
declare class PasskeyMismatchError extends SmartWalletError {
|
|
132
299
|
readonly required: PasskeyDisplay;
|
|
133
300
|
readonly used?: PasskeyDisplay;
|
|
134
301
|
constructor(message: string, required: PasskeyDisplay, used?: PasskeyDisplay);
|
|
135
302
|
}
|
|
136
|
-
declare class
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
declare class JWTExpiredError extends NotAuthorizedError {
|
|
140
|
-
readonly code: "smart-wallet:not-authorized.jwt-expired";
|
|
141
|
-
/**
|
|
142
|
-
* The expiry time of the JWT as an ISO 8601 timestamp.
|
|
143
|
-
*/
|
|
144
|
-
readonly expiredAt: string;
|
|
145
|
-
constructor(expiredAt: Date);
|
|
146
|
-
}
|
|
147
|
-
declare class JWTInvalidError extends NotAuthorizedError {
|
|
148
|
-
readonly code: "smart-wallet:not-authorized.jwt-invalid";
|
|
149
|
-
constructor();
|
|
150
|
-
}
|
|
151
|
-
declare class JWTDecryptionError extends NotAuthorizedError {
|
|
152
|
-
readonly code: "smart-wallet:not-authorized.jwt-decryption";
|
|
153
|
-
constructor();
|
|
154
|
-
}
|
|
155
|
-
declare class JWTIdentifierError extends NotAuthorizedError {
|
|
156
|
-
readonly code: "smart-wallet:not-authorized.jwt-identifier";
|
|
157
|
-
readonly identifierKey: string;
|
|
158
|
-
constructor(identifierKey: string);
|
|
159
|
-
}
|
|
160
|
-
declare class UserWalletAlreadyCreatedError extends SmartWalletSDKError {
|
|
161
|
-
readonly code: "smart-wallet:user-wallet-already-created.error";
|
|
303
|
+
declare class UserWalletAlreadyCreatedError extends SmartWalletError {
|
|
304
|
+
readonly code: "smart-wallet:user-wallet-already-created";
|
|
162
305
|
constructor(userId: string);
|
|
163
306
|
}
|
|
164
|
-
declare class PasskeyPromptError extends
|
|
307
|
+
declare class PasskeyPromptError extends SmartWalletError {
|
|
165
308
|
passkeyName: string;
|
|
166
309
|
constructor(passkeyName: string);
|
|
167
310
|
}
|
|
168
|
-
declare class PasskeyRegistrationError extends
|
|
311
|
+
declare class PasskeyRegistrationError extends SmartWalletError {
|
|
169
312
|
passkeyName: string;
|
|
170
313
|
constructor(passkeyName: string);
|
|
171
314
|
}
|
|
172
|
-
declare class PasskeyIncompatibleAuthenticatorError extends
|
|
315
|
+
declare class PasskeyIncompatibleAuthenticatorError extends SmartWalletError {
|
|
173
316
|
passkeyName: string;
|
|
174
317
|
constructor(passkeyName: string);
|
|
175
318
|
}
|
|
176
|
-
declare class
|
|
177
|
-
constructor(message?: string);
|
|
178
|
-
}
|
|
179
|
-
declare class ConfigError extends SmartWalletSDKError {
|
|
319
|
+
declare class ConfigError extends SmartWalletError {
|
|
180
320
|
constructor(message: string);
|
|
181
321
|
}
|
|
182
322
|
declare class AdminAlreadyUsedError extends ConfigError {
|
|
183
|
-
readonly code: "smart-wallet:
|
|
323
|
+
readonly code: "smart-wallet:config.admin-signer-already-used";
|
|
184
324
|
constructor();
|
|
185
325
|
}
|
|
186
|
-
declare class
|
|
187
|
-
readonly code: "smart-wallet:
|
|
326
|
+
declare class SmartWalletsNotEnabledError extends ConfigError {
|
|
327
|
+
readonly code: "smart-wallet:not-enabled";
|
|
188
328
|
constructor();
|
|
189
329
|
}
|
|
190
330
|
|
|
191
331
|
type CrossmintAPIErrorCodes = "ERROR_JWT_INVALID" | "ERROR_JWT_DECRYPTION" | "ERROR_JWT_IDENTIFIER" | "ERROR_JWT_EXPIRED" | "ERROR_USER_WALLET_ALREADY_CREATED" | "ERROR_ADMIN_SIGNER_ALREADY_USED" | "ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED";
|
|
192
332
|
declare class APIErrorService {
|
|
193
333
|
private errors;
|
|
194
|
-
constructor(errors?:
|
|
334
|
+
constructor(errors?: Record<CrossmintAPIErrorCodes, (apiResponse: any) => SmartWalletError>);
|
|
195
335
|
throwErrorFromResponse({ response, onServerErrorMessage, }: {
|
|
196
336
|
response: Response;
|
|
197
337
|
onServerErrorMessage: string;
|
|
198
338
|
}): Promise<void>;
|
|
199
339
|
}
|
|
200
340
|
|
|
201
|
-
declare abstract class BaseCrossmintService
|
|
341
|
+
declare abstract class BaseCrossmintService {
|
|
202
342
|
crossmintAPIHeaders: Record<string, string>;
|
|
203
343
|
protected crossmintBaseUrl: string;
|
|
204
344
|
protected apiErrorService: APIErrorService;
|
|
@@ -212,16 +352,11 @@ declare abstract class BaseCrossmintService extends LoggerWrapper {
|
|
|
212
352
|
}
|
|
213
353
|
|
|
214
354
|
declare class CrossmintWalletService extends BaseCrossmintService {
|
|
215
|
-
idempotentCreateSmartWallet(user: UserParams, input: StoreSmartWalletParams): Promise<
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
entryPointVersion: string;
|
|
219
|
-
userId: string;
|
|
220
|
-
signers: {
|
|
221
|
-
signerData: SignerData;
|
|
222
|
-
}[];
|
|
223
|
-
smartContractWalletAddress?: string;
|
|
355
|
+
idempotentCreateSmartWallet(user: UserParams, input: StoreSmartWalletParams): Promise<void>;
|
|
356
|
+
sponsorUserOperation<E extends EntryPoint>(user: UserParams, userOp: UserOperation<GetEntryPointVersion<E>>, entryPoint: E, chain: SmartWalletChain): Promise<{
|
|
357
|
+
sponsorUserOpParams: UserOperation<GetEntryPointVersion<E>>;
|
|
224
358
|
}>;
|
|
359
|
+
getSmartWalletConfig(user: UserParams, chain: SmartWalletChain): Promise<SmartWalletConfig>;
|
|
225
360
|
fetchNFTs(address: string, chain: SmartWalletChain): Promise<any>;
|
|
226
361
|
getPasskeyServerUrl(): string;
|
|
227
362
|
}
|
|
@@ -258,7 +393,7 @@ type TransferType = ERC20TransferType | SFTTransferType | NFTTransferType;
|
|
|
258
393
|
* Smart wallet interface for EVM chains enhanced with Crossmint capabilities.
|
|
259
394
|
* Core functionality is exposed via [viem](https://viem.sh/) clients within the `client` property of the class.
|
|
260
395
|
*/
|
|
261
|
-
declare class EVMSmartWallet
|
|
396
|
+
declare class EVMSmartWallet {
|
|
262
397
|
private readonly crossmintService;
|
|
263
398
|
private readonly accountClient;
|
|
264
399
|
readonly chain: SmartWalletChain;
|
|
@@ -290,7 +425,7 @@ declare class EVMSmartWallet extends LoggerWrapper {
|
|
|
290
425
|
nfts(): Promise<any>;
|
|
291
426
|
}
|
|
292
427
|
|
|
293
|
-
declare class SmartWalletSDK
|
|
428
|
+
declare class SmartWalletSDK {
|
|
294
429
|
private readonly smartWalletService;
|
|
295
430
|
private readonly errorProcessor;
|
|
296
431
|
private constructor();
|
|
@@ -311,4 +446,4 @@ declare class SmartWalletSDK extends LoggerWrapper {
|
|
|
311
446
|
getOrCreateWallet(user: UserParams, chain: SmartWalletChain, walletParams?: WalletParams): Promise<EVMSmartWallet>;
|
|
312
447
|
}
|
|
313
448
|
|
|
314
|
-
export { AdminAlreadyUsedError, AdminMismatchError, ConfigError,
|
|
449
|
+
export { AdminAlreadyUsedError, AdminMismatchError, ConfigError, type EOASigner, type ERC20TransferType, EVMSmartWallet, type NFTTransferType, PasskeyIncompatibleAuthenticatorError, PasskeyMismatchError, PasskeyPromptError, PasskeyRegistrationError, type PasskeySigner, type SFTTransferType, SmartWalletError, SmartWalletSDK, type SmartWalletSDKInitParams, SmartWalletsNotEnabledError, type TransferType, type UserParams, UserWalletAlreadyCreatedError, type ViemAccount, type WalletParams };
|