@crossmint/client-sdk-smart-wallet 0.1.19 → 0.1.21
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/SmartWalletSDK.cjs +1 -0
- package/dist/SmartWalletSDK.d.cts +47 -0
- package/dist/SmartWalletSDK.d.ts +47 -0
- package/dist/SmartWalletSDK.js +1 -0
- package/dist/api/CrossmintWalletService.cjs +1 -0
- package/dist/api/CrossmintWalletService.d.cts +31 -0
- package/dist/api/CrossmintWalletService.d.ts +31 -0
- package/dist/api/CrossmintWalletService.js +1 -0
- package/dist/blockchain/chains.cjs +1 -0
- package/dist/blockchain/chains.d.cts +36 -0
- package/dist/blockchain/chains.d.ts +36 -0
- package/dist/blockchain/chains.js +1 -0
- package/dist/blockchain/rpc.cjs +1 -0
- package/dist/blockchain/rpc.d.cts +9 -0
- package/dist/blockchain/rpc.d.ts +9 -0
- package/dist/blockchain/rpc.js +1 -0
- package/dist/blockchain/transfer.cjs +1 -0
- package/dist/blockchain/transfer.d.cts +23 -0
- package/dist/blockchain/transfer.d.ts +23 -0
- package/dist/blockchain/transfer.js +1 -0
- package/dist/blockchain/wallets/EVMSmartWallet.cjs +1 -0
- package/dist/blockchain/wallets/EVMSmartWallet.d.cts +102 -0
- package/dist/blockchain/wallets/EVMSmartWallet.d.ts +102 -0
- package/dist/blockchain/wallets/EVMSmartWallet.js +1 -0
- package/dist/blockchain/wallets/SendTransactionService.cjs +1 -0
- package/dist/blockchain/wallets/SendTransactionService.d.cts +84 -0
- package/dist/blockchain/wallets/SendTransactionService.d.ts +84 -0
- package/dist/blockchain/wallets/SendTransactionService.js +1 -0
- package/dist/blockchain/wallets/account/cache.cjs +1 -0
- package/dist/blockchain/wallets/account/cache.d.cts +25 -0
- package/dist/blockchain/wallets/account/cache.d.ts +25 -0
- package/dist/blockchain/wallets/account/cache.js +1 -0
- package/dist/blockchain/wallets/account/config.cjs +1 -0
- package/dist/blockchain/wallets/account/config.d.cts +47 -0
- package/dist/blockchain/wallets/account/config.d.ts +47 -0
- package/dist/blockchain/wallets/account/config.js +1 -0
- package/dist/blockchain/wallets/account/creator.cjs +1 -0
- package/dist/blockchain/wallets/account/creator.d.cts +26 -0
- package/dist/blockchain/wallets/account/creator.d.ts +26 -0
- package/dist/blockchain/wallets/account/creator.js +1 -0
- package/dist/blockchain/wallets/account/eoa.cjs +1 -0
- package/dist/blockchain/wallets/account/eoa.d.cts +21 -0
- package/dist/blockchain/wallets/account/eoa.d.ts +21 -0
- package/dist/blockchain/wallets/account/eoa.js +1 -0
- package/dist/blockchain/wallets/account/passkey.cjs +1 -0
- package/dist/blockchain/wallets/account/passkey.d.cts +29 -0
- package/dist/blockchain/wallets/account/passkey.d.ts +29 -0
- package/dist/blockchain/wallets/account/passkey.js +1 -0
- package/dist/blockchain/wallets/account/signer.cjs +1 -0
- package/dist/blockchain/wallets/account/signer.d.cts +14 -0
- package/dist/blockchain/wallets/account/signer.d.ts +14 -0
- package/dist/blockchain/wallets/account/signer.js +1 -0
- package/dist/blockchain/wallets/account/strategy.cjs +1 -0
- package/dist/blockchain/wallets/account/strategy.d.cts +20 -0
- package/dist/blockchain/wallets/account/strategy.d.ts +20 -0
- package/dist/blockchain/wallets/account/strategy.js +0 -0
- package/dist/blockchain/wallets/clientDecorator.cjs +1 -0
- package/dist/blockchain/wallets/clientDecorator.d.cts +38 -0
- package/dist/blockchain/wallets/clientDecorator.d.ts +38 -0
- package/dist/blockchain/wallets/clientDecorator.js +1 -0
- package/dist/blockchain/wallets/index.cjs +1 -0
- package/dist/blockchain/wallets/index.d.cts +20 -0
- package/dist/blockchain/wallets/index.d.ts +20 -0
- package/dist/blockchain/wallets/index.js +1 -0
- package/dist/blockchain/wallets/paymaster.cjs +1 -0
- package/dist/blockchain/wallets/paymaster.d.cts +29 -0
- package/dist/blockchain/wallets/paymaster.d.ts +29 -0
- package/dist/blockchain/wallets/paymaster.js +1 -0
- package/dist/blockchain/wallets/service.cjs +1 -0
- package/dist/blockchain/wallets/service.d.cts +41 -0
- package/dist/blockchain/wallets/service.d.ts +41 -0
- package/dist/blockchain/wallets/service.js +1 -0
- package/dist/chunk-27US7ZBX.js +1 -0
- package/dist/chunk-2GS5TXEY.cjs +1 -0
- package/dist/chunk-2R6HK64N.cjs +1 -0
- package/dist/chunk-3F6P4HUZ.js +1 -0
- package/dist/chunk-4SPA557P.js +0 -0
- package/dist/chunk-5M3MSPHK.cjs +1 -0
- package/dist/chunk-6DE5YEO5.cjs +1 -0
- package/dist/chunk-7AVDZZGD.cjs +1 -0
- package/dist/chunk-7FXFOOQU.cjs +1 -0
- package/dist/chunk-7JAT6GQU.js +1 -0
- package/dist/chunk-ATQ4WGCW.js +1 -0
- package/dist/chunk-B3LJJZXD.cjs +2 -0
- package/dist/chunk-BJZQA5VC.js +1 -0
- package/dist/chunk-BXXREMNR.cjs +1 -0
- package/dist/chunk-C3VZY7VJ.js +1 -0
- package/dist/chunk-CPYNP4XI.js +1 -0
- package/dist/chunk-CUTQYF3F.js +1 -0
- package/dist/chunk-D4NDUT36.js +1 -0
- package/dist/chunk-DIDKPOO2.cjs +1 -0
- package/dist/chunk-ETVJGLNY.js +1 -0
- package/dist/chunk-FHNNZVNU.js +1 -0
- package/dist/chunk-FIJ3CBJ4.js +3 -0
- package/dist/chunk-G57LROTD.js +1 -0
- package/dist/chunk-GB35YMN4.cjs +1 -0
- package/dist/chunk-H4CMXNVK.js +1 -0
- package/dist/chunk-IQTGPM2U.cjs +1 -0
- package/dist/chunk-KYPTGHC6.cjs +1 -0
- package/dist/chunk-LMVY4C4Y.js +1 -0
- package/dist/chunk-M4K3IZTT.cjs +1 -0
- package/dist/chunk-NLGILHJS.js +1 -0
- package/dist/chunk-O2ACORII.cjs +1 -0
- package/dist/chunk-OCJYX5QF.cjs +1 -0
- package/dist/chunk-ODAUWGUU.cjs +1 -0
- package/dist/chunk-PBUJXVQT.js +1 -0
- package/dist/chunk-PLRQBDYS.cjs +1 -0
- package/dist/chunk-PPTSNCSQ.cjs +1 -0
- package/dist/chunk-PZ6Q22YJ.js +1 -0
- package/dist/chunk-Q44P7MO7.cjs +1 -0
- package/dist/chunk-QVB3HE6Q.js +2 -0
- package/dist/chunk-S2XBSAGM.js +1 -0
- package/dist/chunk-SCXFZMLR.cjs +1 -0
- package/dist/chunk-STH2LE35.cjs +1 -0
- package/dist/chunk-SWWOVT47.cjs +1 -0
- package/dist/chunk-TZG6MROQ.js +1 -0
- package/dist/chunk-UG47CBKR.js +1 -0
- package/dist/chunk-UPURFW46.js +1 -0
- package/dist/chunk-WDM7PN4O.js +1 -0
- package/dist/chunk-WJ6XJMRD.cjs +1 -0
- package/dist/chunk-WTPE2I2Q.cjs +1 -0
- package/dist/chunk-XHSA4YTO.cjs +3 -0
- package/dist/chunk-XJGFG3RT.cjs +1 -0
- package/dist/chunk-XP6ESWVJ.js +1 -0
- package/dist/chunk-XQ2K2K23.cjs +1 -0
- package/dist/chunk-YBHSEZMB.js +1 -0
- package/dist/chunk-YZQJV2KA.cjs +1 -0
- package/dist/chunk-Z22H3MJS.js +1 -0
- package/dist/error/index.cjs +1 -0
- package/dist/error/index.d.cts +58 -0
- package/dist/error/index.d.ts +58 -0
- package/dist/error/index.js +1 -0
- package/dist/error/processor.cjs +1 -0
- package/dist/error/processor.d.cts +25 -0
- package/dist/error/processor.d.ts +25 -0
- package/dist/error/processor.js +1 -0
- package/dist/index.cjs +1 -5
- package/dist/index.d.cts +20 -559
- package/dist/index.d.ts +20 -559
- package/dist/index.js +1 -5
- package/dist/service-DqYCir8s.d.ts +103 -0
- package/dist/service-Ir-Qho-9.d.cts +103 -0
- package/dist/services/index.cjs +1 -0
- package/dist/services/index.d.cts +2 -0
- package/dist/services/index.d.ts +2 -0
- package/dist/services/index.js +1 -0
- package/dist/services/logger.cjs +1 -0
- package/dist/services/logger.d.cts +6 -0
- package/dist/services/logger.d.ts +6 -0
- package/dist/services/logger.js +1 -0
- package/dist/types/internal.cjs +1 -0
- package/dist/types/internal.d.cts +14 -0
- package/dist/types/internal.d.ts +14 -0
- package/dist/types/internal.js +1 -0
- package/dist/types/params.cjs +1 -0
- package/dist/types/params.d.cts +33 -0
- package/dist/types/params.d.ts +33 -0
- package/dist/types/params.js +0 -0
- package/dist/types/schema.cjs +1 -0
- package/dist/types/schema.d.cts +241 -0
- package/dist/types/schema.d.ts +241 -0
- package/dist/types/schema.js +1 -0
- package/dist/types/service.cjs +1 -0
- package/dist/types/service.d.cts +14 -0
- package/dist/types/service.d.ts +14 -0
- package/dist/types/service.js +0 -0
- package/dist/types/token.cjs +1 -0
- package/dist/types/token.d.cts +35 -0
- package/dist/types/token.d.ts +35 -0
- package/dist/types/token.js +0 -0
- package/dist/utils/api.cjs +1 -0
- package/dist/utils/api.d.cts +4 -0
- package/dist/utils/api.d.ts +4 -0
- package/dist/utils/api.js +1 -0
- package/dist/utils/blockchain.cjs +1 -0
- package/dist/utils/blockchain.d.cts +7 -0
- package/dist/utils/blockchain.d.ts +7 -0
- package/dist/utils/blockchain.js +1 -0
- package/dist/utils/constants.cjs +1 -0
- package/dist/utils/constants.d.cts +9 -0
- package/dist/utils/constants.d.ts +9 -0
- package/dist/utils/constants.js +1 -0
- package/dist/utils/environment.cjs +1 -0
- package/dist/utils/environment.d.cts +3 -0
- package/dist/utils/environment.d.ts +3 -0
- package/dist/utils/environment.js +1 -0
- package/dist/utils/helpers.cjs +1 -0
- package/dist/utils/helpers.d.cts +4 -0
- package/dist/utils/helpers.d.ts +4 -0
- package/dist/utils/helpers.js +1 -0
- package/dist/utils/signer.cjs +1 -0
- package/dist/utils/signer.d.cts +15 -0
- package/dist/utils/signer.d.ts +15 -0
- package/dist/utils/signer.js +1 -0
- package/dist/utils/test.cjs +1 -0
- package/dist/utils/test.d.cts +18 -0
- package/dist/utils/test.d.ts +18 -0
- package/dist/utils/test.js +1 -0
- package/package.json +4 -5
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { EVMSmartWallet } from './EVMSmartWallet.js';
|
|
2
|
+
import 'viem';
|
|
3
|
+
import '../../api/CrossmintWalletService.js';
|
|
4
|
+
import '@crossmint/client-sdk-base';
|
|
5
|
+
import 'permissionless';
|
|
6
|
+
import 'permissionless/types/entrypoint';
|
|
7
|
+
import '../chains.js';
|
|
8
|
+
import 'viem/chains';
|
|
9
|
+
import '@crossmint/common-sdk-base';
|
|
10
|
+
import '../../types/params.js';
|
|
11
|
+
import '../../service-DqYCir8s.js';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import '@zerodev/sdk';
|
|
14
|
+
import 'permissionless/accounts';
|
|
15
|
+
import '../../types/schema.js';
|
|
16
|
+
import '@zerodev/passkey-validator';
|
|
17
|
+
import '../../utils/constants.js';
|
|
18
|
+
import '../../types/token.js';
|
|
19
|
+
import './SendTransactionService.js';
|
|
20
|
+
import 'permissionless/_types/types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as o}from"../../chunk-ETVJGLNY.js";import"../../chunk-S2XBSAGM.js";import"../../chunk-3F6P4HUZ.js";import"../../chunk-UPURFW46.js";export{o as EVMSmartWallet};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIQTGPM2Ucjs = require('../../chunk-IQTGPM2U.cjs');require('../../chunk-WJ6XJMRD.cjs');exports.paymasterMiddleware = _chunkIQTGPM2Ucjs.b; exports.usePaymaster = _chunkIQTGPM2Ucjs.a;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CrossmintWalletService } from '../../api/CrossmintWalletService.cjs';
|
|
2
|
+
import { Middleware } from 'permissionless/actions/smartAccount';
|
|
3
|
+
import { PimlicoBundlerClient } from 'permissionless/clients/pimlico';
|
|
4
|
+
import { EntryPoint } from 'permissionless/types/entrypoint';
|
|
5
|
+
import { UserParams } from '../../types/params.cjs';
|
|
6
|
+
import { SmartWalletChain } from '../chains.cjs';
|
|
7
|
+
import '@crossmint/client-sdk-base';
|
|
8
|
+
import 'permissionless';
|
|
9
|
+
import '../../service-Ir-Qho-9.cjs';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import '@zerodev/sdk';
|
|
12
|
+
import 'permissionless/accounts';
|
|
13
|
+
import 'viem';
|
|
14
|
+
import '../../types/schema.cjs';
|
|
15
|
+
import '@zerodev/passkey-validator';
|
|
16
|
+
import '../../utils/constants.cjs';
|
|
17
|
+
import 'viem/chains';
|
|
18
|
+
import '@crossmint/common-sdk-base';
|
|
19
|
+
|
|
20
|
+
declare function usePaymaster(chain: SmartWalletChain): boolean;
|
|
21
|
+
declare function paymasterMiddleware({ bundlerClient, entryPoint, chain, walletService, user, }: {
|
|
22
|
+
bundlerClient: PimlicoBundlerClient<EntryPoint>;
|
|
23
|
+
entryPoint: EntryPoint;
|
|
24
|
+
chain: SmartWalletChain;
|
|
25
|
+
walletService: CrossmintWalletService;
|
|
26
|
+
user: UserParams;
|
|
27
|
+
}): Middleware<EntryPoint>;
|
|
28
|
+
|
|
29
|
+
export { paymasterMiddleware, usePaymaster };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CrossmintWalletService } from '../../api/CrossmintWalletService.js';
|
|
2
|
+
import { Middleware } from 'permissionless/actions/smartAccount';
|
|
3
|
+
import { PimlicoBundlerClient } from 'permissionless/clients/pimlico';
|
|
4
|
+
import { EntryPoint } from 'permissionless/types/entrypoint';
|
|
5
|
+
import { UserParams } from '../../types/params.js';
|
|
6
|
+
import { SmartWalletChain } from '../chains.js';
|
|
7
|
+
import '@crossmint/client-sdk-base';
|
|
8
|
+
import 'permissionless';
|
|
9
|
+
import '../../service-DqYCir8s.js';
|
|
10
|
+
import 'zod';
|
|
11
|
+
import '@zerodev/sdk';
|
|
12
|
+
import 'permissionless/accounts';
|
|
13
|
+
import 'viem';
|
|
14
|
+
import '../../types/schema.js';
|
|
15
|
+
import '@zerodev/passkey-validator';
|
|
16
|
+
import '../../utils/constants.js';
|
|
17
|
+
import 'viem/chains';
|
|
18
|
+
import '@crossmint/common-sdk-base';
|
|
19
|
+
|
|
20
|
+
declare function usePaymaster(chain: SmartWalletChain): boolean;
|
|
21
|
+
declare function paymasterMiddleware({ bundlerClient, entryPoint, chain, walletService, user, }: {
|
|
22
|
+
bundlerClient: PimlicoBundlerClient<EntryPoint>;
|
|
23
|
+
entryPoint: EntryPoint;
|
|
24
|
+
chain: SmartWalletChain;
|
|
25
|
+
walletService: CrossmintWalletService;
|
|
26
|
+
user: UserParams;
|
|
27
|
+
}): Middleware<EntryPoint>;
|
|
28
|
+
|
|
29
|
+
export { paymasterMiddleware, usePaymaster };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"../../chunk-NLGILHJS.js";import"../../chunk-C3VZY7VJ.js";export{b as paymasterMiddleware,a as usePaymaster};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPPTSNCSQcjs = require('../../chunk-PPTSNCSQ.cjs');require('../../chunk-IQTGPM2U.cjs');require('../../chunk-WJ6XJMRD.cjs');require('../../chunk-SWWOVT47.cjs');require('../../chunk-7AVDZZGD.cjs');require('../../chunk-2GS5TXEY.cjs');require('../../chunk-7FXFOOQU.cjs');require('../../chunk-KYPTGHC6.cjs');require('../../chunk-5M3MSPHK.cjs');require('../../chunk-M4K3IZTT.cjs');exports.SmartWalletService = _chunkPPTSNCSQcjs.a;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CrossmintWalletService } from '../../api/CrossmintWalletService.cjs';
|
|
2
|
+
import { UserParams, WalletParams } from '../../types/params.cjs';
|
|
3
|
+
import { SmartWalletChain } from '../chains.cjs';
|
|
4
|
+
import { EVMSmartWallet } from './EVMSmartWallet.cjs';
|
|
5
|
+
import { AccountConfigService } from './account/config.cjs';
|
|
6
|
+
import { AccountCreator } from './account/creator.cjs';
|
|
7
|
+
import { ClientDecorator } from './clientDecorator.cjs';
|
|
8
|
+
import '@crossmint/client-sdk-base';
|
|
9
|
+
import 'permissionless';
|
|
10
|
+
import 'permissionless/types/entrypoint';
|
|
11
|
+
import '../../service-Ir-Qho-9.cjs';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import '@zerodev/sdk';
|
|
14
|
+
import 'permissionless/accounts';
|
|
15
|
+
import 'viem';
|
|
16
|
+
import '../../types/schema.cjs';
|
|
17
|
+
import '@zerodev/passkey-validator';
|
|
18
|
+
import '../../utils/constants.cjs';
|
|
19
|
+
import 'viem/chains';
|
|
20
|
+
import '@crossmint/common-sdk-base';
|
|
21
|
+
import '../../types/token.cjs';
|
|
22
|
+
import './SendTransactionService.cjs';
|
|
23
|
+
import 'permissionless/_types/types';
|
|
24
|
+
import './account/cache.cjs';
|
|
25
|
+
import './account/eoa.cjs';
|
|
26
|
+
import './account/strategy.cjs';
|
|
27
|
+
import './account/passkey.cjs';
|
|
28
|
+
import '../../error/processor.cjs';
|
|
29
|
+
import '../../error/index.cjs';
|
|
30
|
+
|
|
31
|
+
declare class SmartWalletService {
|
|
32
|
+
private readonly crossmintService;
|
|
33
|
+
private readonly accountConfigService;
|
|
34
|
+
private readonly accountCreator;
|
|
35
|
+
private readonly clientDecorator;
|
|
36
|
+
constructor(crossmintService: CrossmintWalletService, accountConfigService: AccountConfigService, accountCreator: AccountCreator, clientDecorator: ClientDecorator);
|
|
37
|
+
getOrCreate(user: UserParams, chain: SmartWalletChain, walletParams: WalletParams): Promise<EVMSmartWallet>;
|
|
38
|
+
private smartAccountClient;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { SmartWalletService };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CrossmintWalletService } from '../../api/CrossmintWalletService.js';
|
|
2
|
+
import { UserParams, WalletParams } from '../../types/params.js';
|
|
3
|
+
import { SmartWalletChain } from '../chains.js';
|
|
4
|
+
import { EVMSmartWallet } from './EVMSmartWallet.js';
|
|
5
|
+
import { AccountConfigService } from './account/config.js';
|
|
6
|
+
import { AccountCreator } from './account/creator.js';
|
|
7
|
+
import { ClientDecorator } from './clientDecorator.js';
|
|
8
|
+
import '@crossmint/client-sdk-base';
|
|
9
|
+
import 'permissionless';
|
|
10
|
+
import 'permissionless/types/entrypoint';
|
|
11
|
+
import '../../service-DqYCir8s.js';
|
|
12
|
+
import 'zod';
|
|
13
|
+
import '@zerodev/sdk';
|
|
14
|
+
import 'permissionless/accounts';
|
|
15
|
+
import 'viem';
|
|
16
|
+
import '../../types/schema.js';
|
|
17
|
+
import '@zerodev/passkey-validator';
|
|
18
|
+
import '../../utils/constants.js';
|
|
19
|
+
import 'viem/chains';
|
|
20
|
+
import '@crossmint/common-sdk-base';
|
|
21
|
+
import '../../types/token.js';
|
|
22
|
+
import './SendTransactionService.js';
|
|
23
|
+
import 'permissionless/_types/types';
|
|
24
|
+
import './account/cache.js';
|
|
25
|
+
import './account/eoa.js';
|
|
26
|
+
import './account/strategy.js';
|
|
27
|
+
import './account/passkey.js';
|
|
28
|
+
import '../../error/processor.js';
|
|
29
|
+
import '../../error/index.js';
|
|
30
|
+
|
|
31
|
+
declare class SmartWalletService {
|
|
32
|
+
private readonly crossmintService;
|
|
33
|
+
private readonly accountConfigService;
|
|
34
|
+
private readonly accountCreator;
|
|
35
|
+
private readonly clientDecorator;
|
|
36
|
+
constructor(crossmintService: CrossmintWalletService, accountConfigService: AccountConfigService, accountCreator: AccountCreator, clientDecorator: ClientDecorator);
|
|
37
|
+
getOrCreate(user: UserParams, chain: SmartWalletChain, walletParams: WalletParams): Promise<EVMSmartWallet>;
|
|
38
|
+
private smartAccountClient;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { SmartWalletService };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"../../chunk-LMVY4C4Y.js";import"../../chunk-NLGILHJS.js";import"../../chunk-C3VZY7VJ.js";import"../../chunk-ETVJGLNY.js";import"../../chunk-S2XBSAGM.js";import"../../chunk-YBHSEZMB.js";import"../../chunk-TZG6MROQ.js";import"../../chunk-3F6P4HUZ.js";import"../../chunk-WDM7PN4O.js";import"../../chunk-UPURFW46.js";export{a as SmartWalletService};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as S}from"./chunk-H4CMXNVK.js";import{a as y}from"./chunk-PBUJXVQT.js";import{a as g}from"./chunk-LMVY4C4Y.js";import{a as p}from"./chunk-G57LROTD.js";import{a as v}from"./chunk-ATQ4WGCW.js";import{a as f}from"./chunk-FIJ3CBJ4.js";import{a as h}from"./chunk-UG47CBKR.js";import{a as C}from"./chunk-D4NDUT36.js";import{a as m}from"./chunk-QVB3HE6Q.js";import{a as n,b as s}from"./chunk-Z22H3MJS.js";import{g as l,h as c}from"./chunk-YBHSEZMB.js";import{a as w}from"./chunk-7JAT6GQU.js";import{d as i}from"./chunk-WDM7PN4O.js";import{a as o}from"./chunk-UPURFW46.js";import{stringify as A}from"viem";import{validateAPIKey as I}from"@crossmint/common-sdk-base";var P=class W{constructor(r,t,a,e=n){this.crossmintEnv=r;this.smartWalletService=t;this.errorProcessor=a;this.logger=e}static init({clientApiKey:r}){let t=I(r);if(!t.isValid)throw new Error("API key invalid");let a=new m(r),e=new w(s),d=new f(new h,new S(a.getPasskeyServerUrl(),r)),E=new p(`smart-wallet-${i}`),u=new g(a,new v(a,E),d,new y(e));return new W(t.environment,u,e)}async getOrCreateWallet(r,t,a={signer:{type:"PASSKEY"}}){if(!C())throw new o("Smart Wallet SDK should only be used client side.");return this.assertValidChain(t),await this.logger.logPerformance("GET_OR_CREATE_WALLET",async()=>{try{return await this.smartWalletService.getOrCreate(r,t,a)}catch(e){throw this.errorProcessor.map(e,new o(`Wallet creation failed: ${e.message}.`,A(e)))}})}assertValidChain(r){if(!this.validChain(r))throw new o(`The selected chain "${r}" is not available in "${this.crossmintEnv}". Either set a valid chain or check you're using an API key for the environment you're trying to target.`)}validChain(r){return this.crossmintEnv==="development"||this.crossmintEnv==="staging"?l(r):c(r)}};export{P as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chains = require('viem/chains');var _commonsdkbase = require('@crossmint/common-sdk-base');var n={BASE_SEPOLIA:_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,POLYGON_AMOY:_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,OPTIMISM_SEPOLIA:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,ARBITRUM_SEPOLIA:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA},A= exports.b =_commonsdkbase.objectValues.call(void 0, n),o= exports.c ={BASE:_commonsdkbase.BlockchainIncludingTestnet.BASE,POLYGON:_commonsdkbase.BlockchainIncludingTestnet.POLYGON,OPTIMISM:_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,ARBITRUM:_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM},O= exports.d =_commonsdkbase.objectValues.call(void 0, o),T= exports.e ={...n,...o},u= exports.f =_commonsdkbase.objectValues.call(void 0, T);function y(e){return A.includes(e)}function E(e){return O.includes(e)}var L={polygon:_chains.polygon,"polygon-amoy":_chains.polygonAmoy,base:_chains.base,"base-sepolia":_chains.baseSepolia,optimism:_chains.optimism,"optimism-sepolia":_chains.optimismSepolia,arbitrum:_chains.arbitrum,"arbitrum-sepolia":_chains.arbitrumSepolia};exports.a = n; exports.b = A; exports.c = o; exports.d = O; exports.e = T; exports.f = u; exports.g = y; exports.h = E; exports.i = L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkGB35YMN4cjs = require('./chunk-GB35YMN4.cjs');var _chunkXJGFG3RTcjs = require('./chunk-XJGFG3RT.cjs');var _chunkDIDKPOO2cjs = require('./chunk-DIDKPOO2.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _ecdsavalidator = require('@zerodev/ecdsa-validator');var _sdk = require('@zerodev/sdk');var c=class{async create({chain:m,publicClient:o,entryPoint:a,walletParams:g,kernelVersion:t,user:p,existing:e}){let r=await _chunkDIDKPOO2cjs.a.call(void 0, {chain:m,walletParams:g});if(e!=null&&!_chunkXJGFG3RTcjs.b.call(void 0, r.address,e.signerConfig.data.eoaAddress))throw new (0, _chunkM4K3IZTTcjs.b)(`User '${p.id}' has an existing wallet with an eoa signer '${e.signerConfig.data.eoaAddress}', this does not match input eoa signer '${r.address}'.`,e.signerConfig.display(),{type:"eoa",eoaAddress:e.signerConfig.data.eoaAddress});let A=await _ecdsavalidator.signerToEcdsaValidator.call(void 0, o,{signer:r,entryPoint:a,kernelVersion:t});return{account:await _sdk.createKernelAccount.call(void 0, o,{plugins:{sudo:A},index:0n,entryPoint:a,kernelVersion:t,deployedAccountAddress:_optionalChain([e, 'optionalAccess', _ => _.address])}),signerConfig:new (0, _chunkGB35YMN4cjs.b)({eoaAddress:r.address,type:"eoa"})}}};exports.a = c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{erc20Abi as i,erc721Abi as p}from"viem";var s=[{inputs:[{internalType:"string",name:"uri_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];function m({contract:t,config:e,from:n,to:a}){switch(e.token.type){case"ft":return{account:n,address:t,abi:i,functionName:"transfer",args:[a,e.amount]};case"sft":return{account:n,address:t,abi:s,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId,e.quantity,"0x00"],tokenId:e.token.tokenId};case"nft":return{account:n,address:t,abi:p,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId],tokenId:e.token.tokenId}}}export{m as a};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var e="0.1.21";var r="ZeroDev",n= exports.b =0,d= exports.c ="SCW_SDK",c= exports.d =e,p= exports.e ="2024-06-09",a= exports.f =["0.3.1","0.3.0","0.2.4"],m= exports.g =["v0.6","v0.7"];exports.a = r; exports.b = n; exports.c = d; exports.d = c; exports.e = p; exports.f = a; exports.g = m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5M3MSPHKcjs = require('./chunk-5M3MSPHK.cjs');function l(e){return _chunk5M3MSPHKcjs.f.includes(e)}function p(e){return _chunk5M3MSPHKcjs.g.includes(e)}function i(e){return"signer"in e&&"type"in e.signer&&e.signer.type==="PASSKEY"}function g(e){let t=e.existing==null||e.existing.signerConfig.type==="passkeys";return i(e.walletParams)&&t}function s(e){return"signer"in e&&("type"in e.signer&&e.signer.type==="VIEM_ACCOUNT"||"request"in e.signer&&typeof e.signer.request=="function")}function P(e){let t=e.existing==null||e.existing.signerConfig.type==="eoa";return s(e.walletParams)&&t}exports.a = l; exports.b = p; exports.c = i; exports.d = g; exports.e = s; exports.f = P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var _clientsdkbase = require('@crossmint/client-sdk-base');var o=class extends _clientsdkbase.CrossmintSDKError{constructor(a,r,i,e=_clientsdkbase.WalletErrorCode.SEND_TRANSACTION_FAILED){super(a,e);this.viemError=r;this.stage=i}},c= exports.b =class extends o{constructor(a,r,i,e,n,h=i.data,f=i.reason){super(a,r,n,_clientsdkbase.WalletErrorCode.SEND_TRANSACTION_EXECUTION_REVERTED);this.viemError=r;this.txId=e;this.stage=n;this.data=h;this.reason=f}},p= exports.c =class{constructor(t,a={confirmations:2,transactionConfirmationTimeout:3e4}){this.client=t;this.defaultSendTransactionOptions=a}async sendTransaction(t,a={}){let{confirmations:r,transactionConfirmationTimeout:i}=this.getConfig(a);await this.simulateCall(t,void 0,"simulation");let e;try{e=await this.client.wallet.writeContract({...t,account:this.client.wallet.account,chain:this.client.wallet.chain})}catch(n){throw n instanceof _viem.BaseError?new o(n.message,n,"send"):n}try{let n=await this.client.public.waitForTransactionReceipt({hash:e,confirmations:r,timeout:i});return await this.handleReceipt(n,t)}catch(n){throw n instanceof _viem.BaseError?new o(n.message,n,"confirmation"):n}}getConfig(t){return{...this.defaultSendTransactionOptions,...t}}async handleReceipt(t,a){if(t.status==="reverted")throw await this.simulateCall(a,t.transactionHash,"execution"),new c("Transaction reverted but unable to detect the reason",new (0, _viem.ContractFunctionRevertedError)({abi:a.abi,functionName:a.functionName}),new (0, _viem.ContractFunctionRevertedError)({abi:a.abi,functionName:a.functionName}),t.transactionHash,"execution");return t.transactionHash}async simulateCall(t,a,r){try{await this.client.public.simulateContract({...t,account:this.client.wallet.account.address,chain:this.client.public.chain})}catch(i){if(i instanceof _viem.BaseError){let e=i.walk(n=>n instanceof _viem.ContractFunctionRevertedError);throw e instanceof _viem.ContractFunctionRevertedError?new c(e.message,i,e,a,r):new o(i.message,i,r)}throw i}}};exports.a = o; exports.b = c; exports.c = p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _commonsdkbase = require('@crossmint/common-sdk-base');var i="-7M6vRDBDknwvMxnqah_jbcieWg0qad9",o="pim_9dKmQPxiTCvtbUNF7XFBbA",n= exports.a ={polygon:"polygon-mainnet","polygon-amoy":"polygon-amoy",base:"base-mainnet","base-sepolia":"base-sepolia",optimism:"opt-mainnet","optimism-sepolia":"opt-sepolia",arbitrum:"arb-mainnet","arbitrum-sepolia":"arb-sepolia"};function p(t){return`https://${n[t]}.g.alchemy.com/v2/${i}`}function r(t){return`https://api.pimlico.io/v2/${_commonsdkbase.blockchainToChainId.call(void 0, t)}/rpc?apikey=${o}`}exports.a = n; exports.b = p; exports.c = r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as o}from"./chunk-WDM7PN4O.js";import{a}from"./chunk-UPURFW46.js";import{BaseError as e,stringify as i}from"viem";var r=class{constructor(n){this.logger=n}map(n,t){return this.record(n),n instanceof a||n instanceof e?n:t}record(n){let t=n instanceof Error?n.message:String(n);this.logger.error(`Smart Wallet SDK Error: ${t}`,{stack:n instanceof Error?n.stack:void 0,name:n instanceof Error?n.name:"UnknownError",details:i(n),domain:window.location.hostname,sdk_version:o})}};export{r as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as c,b as l}from"./chunk-BJZQA5VC.js";import{a as o}from"./chunk-UPURFW46.js";var p=class{constructor(t,e){this.crossmintService=t;this.configCache=e}async get(t,e){let i=this.configCache.get(t);if(i!=null)return{config:this.validateAndFormat(t,i),cached:!0};let r=await this.crossmintService.getSmartWalletConfig(t,e);return{config:this.validateAndFormat(t,r),cached:!1}}cache({entryPointVersion:t,kernelVersion:e,user:i,existing:r}){this.configCache.clear(),this.configCache.set(i,{entryPointVersion:t,kernelVersion:e,userId:i.id,signers:[{signerData:r.signerConfig.data}],smartContractWalletAddress:r.address})}validateAndFormat(t,{entryPointVersion:e,kernelVersion:i,signers:r,smartContractWalletAddress:n,userId:s}){if(e==="v0.7"&&i.startsWith("0.2")||e==="v0.6"&&i.startsWith("0.3"))throw new o(`Unsupported combination: entryPoint ${e} and kernel version ${i}. Please contact support`);let g=r.map(f=>f.signerData),a=this.getSigner(g);if(n!=null&&a==null||a!=null&&n==null)throw new o("Either both signer and address must be present, or both must be null");return a==null||n==null?{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s}}:{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s},existing:{signerConfig:a,address:n}}}getSigner(t){if(t.length===0)return;let e=t[0];if(e.type==="eoa")return new l(e);if(e.type==="passkeys")return new c(e)}};export{p as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkPLRQBDYScjs = require('./chunk-PLRQBDYS.cjs');var _chunkBXXREMNRcjs = require('./chunk-BXXREMNR.cjs');var _chunkXQ2K2K23cjs = require('./chunk-XQ2K2K23.cjs');var _chunk5M3MSPHKcjs = require('./chunk-5M3MSPHK.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _clientsdkbase = require('@crossmint/client-sdk-base');var _commonsdkbase = require('@crossmint/common-sdk-base');var c=class extends _clientsdkbase.BaseCrossmintService{constructor(){super(...arguments);this.logger=_chunkPLRQBDYScjs.a;this.apiErrorService=new (0, _clientsdkbase.APIErrorService)({ERROR_USER_WALLET_ALREADY_CREATED:({userId:r})=>new (0, _chunkM4K3IZTTcjs.d)(r),ERROR_ADMIN_SIGNER_ALREADY_USED:()=>new _chunkM4K3IZTTcjs.i,ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED:()=>new _chunkM4K3IZTTcjs.j})}async idempotentCreateSmartWallet(r,t){await this.fetchCrossmintAPI(`${_chunk5M3MSPHKcjs.e}/sdk/smart-wallet`,{method:"PUT",body:JSON.stringify(t)},"Error creating abstract wallet. Please contact support",r.jwt)}async sponsorUserOperation(r,t,o,e){let S=_commonsdkbase.blockchainToChainId.call(void 0, e),P=await this.fetchCrossmintAPI(`${_chunk5M3MSPHKcjs.e}/sdk/paymaster`,{method:"POST",body:JSON.stringify({userOp:_chunkXQ2K2K23cjs.a.call(void 0, t),entryPoint:o,chainId:S})},"Error sponsoring user operation. Please contact support",r.jwt);return _chunkXQ2K2K23cjs.b.call(void 0, P)}async getSmartWalletConfig(r,t){let o=await this.fetchCrossmintAPI(`${_chunk5M3MSPHKcjs.e}/sdk/smart-wallet/config?chain=${t}`,{method:"GET"},"Error getting smart wallet version configuration. Please contact support",r.jwt),e=_chunkBXXREMNRcjs.e.safeParse(o);if(!e.success)throw new (0, _clientsdkbase.CrossmintServiceError)(`Invalid smart wallet config, please contact support. Details below:
|
|
2
|
+
${e.error.toString()}`);return e.data}async fetchNFTs(r,t){return this.fetchCrossmintAPI(`v1-alpha1/wallets/${t}:${r}/nfts`,{method:"GET"},`Error fetching NFTs for wallet: ${r}`)}getPasskeyServerUrl(){return this.crossmintBaseUrl+"api/internal/passkeys"}};exports.a = c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{constructor(a){this.type="passkeys";this.data=a}display(){return{pubKeyX:this.data.pubKeyX,pubKeyY:this.data.pubKeyY,passkeyName:this.data.passkeyName,type:this.type}}},t=class{constructor(a){this.type="eoa";this.data=a}display(){return this.data}};export{e as a,t as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5M3MSPHKcjs = require('./chunk-5M3MSPHK.cjs');var _passkeyvalidator = require('@zerodev/passkey-validator');var _viem = require('viem');var _zod = require('zod');var m=_zod.z.custom(t=>_viem.isHex.call(void 0, t),{message:"Invalid hex string"}),s=_zod.z.custom(t=>_viem.isAddress.call(void 0, t),{message:"Invalid evm address"}),p= exports.a =_zod.z.object({eoaAddress:s,type:_zod.z.literal("eoa")}),c= exports.b =_zod.z.object({entryPoint:s,validatorAddress:s,pubKeyX:_zod.z.string(),pubKeyY:_zod.z.string(),authenticatorIdHash:m,authenticatorId:_zod.z.string()}),l= exports.c =c.extend({passkeyName:_zod.z.string(),validatorContractVersion:_zod.z.nativeEnum(_passkeyvalidator.PasskeyValidatorContractVersion),domain:_zod.z.string(),type:_zod.z.literal("passkeys")}),g= exports.d =_zod.z.discriminatedUnion("type",[l,p]),P= exports.e =_zod.z.object({kernelVersion:_zod.z.enum(_chunk5M3MSPHKcjs.f,{errorMap:(t,r)=>({message:`Unsupported kernel version. Supported versions: ${_chunk5M3MSPHKcjs.f.join(", ")}. Version used: ${r.data}. Please contact support`})}),entryPointVersion:_zod.z.enum(_chunk5M3MSPHKcjs.g,{errorMap:(t,r)=>({message:`Unsupported entry point version. Supported versions: ${_chunk5M3MSPHKcjs.g.join(", ")}. Version used: ${r.data}. Please contact support`})}),userId:_zod.z.string().min(1),signers:_zod.z.array(_zod.z.object({signerData:g})).min(0).max(1,"Invalid wallet signer configuration. Please contact support"),smartContractWalletAddress:s.optional()});exports.a = p; exports.b = c; exports.c = l; exports.d = g; exports.e = P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(a){return!1}export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as a,g as n}from"./chunk-WDM7PN4O.js";import{PasskeyValidatorContractVersion as o}from"@zerodev/passkey-validator";import{isAddress as i,isHex as d}from"viem";import{z as e}from"zod";var m=e.custom(t=>d(t),{message:"Invalid hex string"}),s=e.custom(t=>i(t),{message:"Invalid evm address"}),p=e.object({eoaAddress:s,type:e.literal("eoa")}),c=e.object({entryPoint:s,validatorAddress:s,pubKeyX:e.string(),pubKeyY:e.string(),authenticatorIdHash:m,authenticatorId:e.string()}),l=c.extend({passkeyName:e.string(),validatorContractVersion:e.nativeEnum(o),domain:e.string(),type:e.literal("passkeys")}),g=e.discriminatedUnion("type",[l,p]),h=e.object({kernelVersion:e.enum(a,{errorMap:(t,r)=>({message:`Unsupported kernel version. Supported versions: ${a.join(", ")}. Version used: ${r.data}. Please contact support`})}),entryPointVersion:e.enum(n,{errorMap:(t,r)=>({message:`Unsupported entry point version. Supported versions: ${n.join(", ")}. Version used: ${r.data}. Please contact support`})}),userId:e.string().min(1),signers:e.array(e.object({signerData:g})).min(0).max(1,"Invalid wallet signer configuration. Please contact support"),smartContractWalletAddress:s.optional()});export{p as a,c as b,l as c,g as d,h as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function o(n){return!n||n.length===0||n.trim().length===0}function i(n,e){return n?.toLowerCase()===e?.toLowerCase()}export{o as a,i as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function i(){return typeof window<"u"}export{i as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _permissionless = require('permissionless');async function p({walletParams:r}){if(i(r.signer))return await _permissionless.providerToSmartAccountSigner.call(void 0, r.signer);if(o(r.signer))return r.signer.account;{let t=r.signer;throw new (0, _chunkM4K3IZTTcjs.a)(`The signer type ${t.type} is not supported`)}}function i(r){return r&&typeof r.request=="function"}function o(r){return r&&r.type==="VIEM_ACCOUNT"}exports.a = p; exports.b = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c}from"./chunk-S2XBSAGM.js";import{a as i}from"./chunk-3F6P4HUZ.js";import{a as r}from"./chunk-UPURFW46.js";var o=class{constructor(e,t,n,a=new c(e)){this.crossmintService=n;this.sendTransactionService=a;this.chain=t,this.client=e}get address(){return this.client.wallet.account.address}async transferToken(e,t){if(this.chain!==t.token.chain)throw new r(`Chain mismatch: Expected ${t.token.chain}, but got ${this.chain}. Ensure you are interacting with the correct blockchain.`);return this.executeContract(i({contract:t.token.contractAddress,to:e,from:this.client.wallet.account,config:t}))}async nfts(){return this.crossmintService.fetchNFTs(this.address,this.chain)}async executeContract({address:e,abi:t,functionName:n,args:a,value:s,config:l}){return this.sendTransactionService.sendTransaction({address:e,abi:t,functionName:n,args:a,value:s},l)}};export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-UPURFW46.js";import{providerToSmartAccountSigner as n}from"permissionless";async function m({walletParams:r}){if(i(r.signer))return await n(r.signer);if(o(r.signer))return r.signer.account;{let t=r.signer;throw new e(`The signer type ${t.type} is not supported`)}}function i(r){return r&&typeof r.request=="function"}function o(r){return r&&r.type==="VIEM_ACCOUNT"}export{m as a,o as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{c as i,d as s,f as n}from"./chunk-XP6ESWVJ.js";import{b as a,h as t}from"./chunk-UPURFW46.js";var o=class{constructor(e,r){this.eoaStrategy=e;this.passkeyStrategy=r}get(e){if(s(e))return this.passkeyStrategy.create(e);if(n(e))return this.eoaStrategy.create(e);if(e.existing==null)throw new t(`Unsupported wallet params:
|
|
2
|
+
${e.walletParams}`);let r=e.existing.signerConfig.display(),y=i(e.walletParams)?"passkey":"eoa";throw new a(`Cannot create wallet with ${y} signer for user ${e.user.id}', they already have a wallet with signer:
|
|
3
|
+
'${JSON.stringify(r,null,2)}'`,r)}};export{o as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{e as l}from"./chunk-CPYNP4XI.js";import{keccak256 as o,toHex as i}from"viem";var s=class{constructor(e){this.keyPrefix=e}set(e,t){localStorage.setItem(this.key(e),JSON.stringify(t))}get(e){let t=this.key(e),r=localStorage.getItem(t);if(r==null)return null;let a=l.safeParse(JSON.parse(r));return a.success?a.data:(localStorage.removeItem(t),null)}clear(){for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);t&&t.startsWith(this.keyPrefix)&&(localStorage.removeItem(t),e--)}}key(e){return`${this.keyPrefix}-${o(i(e.jwt))}`}};export{s as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var e=class{constructor(a){this.type="passkeys";this.data=a}display(){return{pubKeyX:this.data.pubKeyX,pubKeyY:this.data.pubKeyY,passkeyName:this.data.passkeyName,type:this.type}}},t= exports.b =class{constructor(a){this.type="eoa";this.data=a}display(){return this.data}};exports.a = e; exports.b = t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as P}from"./chunk-BJZQA5VC.js";import{c as u,e as p,f as l,g as m}from"./chunk-UPURFW46.js";import{PasskeyValidatorContractVersion as S,WebAuthnMode as h,toPasskeyValidator as A}from"@zerodev/passkey-validator";import{createKernelAccount as E}from"@zerodev/sdk";import{toWebAuthnKey as w}from"@zerodev/webauthn-key";var f=class{constructor(e,t){this.passkeyServerUrl=e;this.apiKey=t}async create({user:e,publicClient:t,walletParams:r,entryPoint:c,kernelVersion:i,existing:a}){let n=r.signer.passkeyName??e.id;if(a!=null&&a.signerConfig.data.passkeyName!==n)throw new u(`User '${e.id}' has an existing wallet created with a passkey named '${a.signerConfig.data.passkeyName}', this does match input passkey name '${n}'.`,a.signerConfig.display());try{a==null&&r.signer.onPrePasskeyRegistration!=null&&await r.signer.onPrePasskeyRegistration();let s=await this.getPasskey(e,n,a?.signerConfig.data),g=S.V0_0_2,d=a==null?g:a.signerConfig.data.validatorContractVersion,y=await A(t,{webAuthnKey:s,entryPoint:c,validatorContractVersion:d,kernelVersion:i}),k=await E(t,{plugins:{sudo:y},entryPoint:c,kernelVersion:i,deployedAccountAddress:a?.address});return{signerConfig:this.getSignerConfig(y,d,n),account:this.decorate(k,n,r)}}catch(s){throw r.signer.onPasskeyRegistrationError!=null&&r.signer.onPasskeyRegistrationError(s),this.mapError(s,n)}}async getPasskey(e,t,r){return r!=null?{pubX:BigInt(r.pubKeyX),pubY:BigInt(r.pubKeyY),authenticatorId:r.authenticatorId,authenticatorIdHash:r.authenticatorIdHash}:w({passkeyName:t,passkeyServerUrl:this.passkeyServerUrl,mode:h.Register,passkeyServerHeaders:this.createPasskeysServerHeaders(e)})}getSignerConfig(e,t,r){return new P({...V(e.getSerializedData()),passkeyName:r,validatorContractVersion:t,domain:window.location.hostname,type:"passkeys"})}createPasskeysServerHeaders(e){return{"x-api-key":this.apiKey,Authorization:`Bearer ${e.jwt}`}}mapError(e,t){return e.code===0&&e.name==="DataError"?new m(t):e.message==="Registration not verified"?new l(t):e.code==="ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY"&&e.name==="NotAllowedError"?new p(t):e}decorate(e,t,r){return new Proxy(e,{get:(c,i,a)=>{let n=Reflect.get(c,i,a);if(typeof n!="function"||typeof i!="string"||!v(i))return n;let s=r.signer;return async(...g)=>{g?.[0]?.factoryData!=null&&i==="signUserOperation"&&s.type==="PASSKEY"&&s.onFirstTimePasskeySigning!=null&&await s.onFirstTimePasskeySigning();try{return await n.call(c,...g)}catch(y){throw s.onFirstTimePasskeySigningError!=null&&await s.onFirstTimePasskeySigningError(y),this.mapError(y,t)}}}})}},C=["signMessage","signTypedData","signUserOperation","signTransaction"];function v(o){return C.includes(o)}var V=o=>{let e=b(o),t=new TextDecoder().decode(e);return JSON.parse(t)};function b(o){let e=atob(o);return Uint8Array.from(e,t=>t.codePointAt(0))}export{f as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWJ6XJMRDcjs = require('./chunk-WJ6XJMRD.cjs');function p(r){return!_chunkWJ6XJMRDcjs.a.call(void 0, r)}function c({bundlerClient:r,entryPoint:t,chain:i,walletService:s,user:n}){return{middleware:{gasPrice:async()=>(await r.getUserOperationGasPrice()).fast,sponsorUserOperation:async({userOperation:a})=>{let{sponsorUserOpParams:o}=await s.sponsorUserOperation(n,a,t,i);return o}}}}exports.a = p; exports.b = c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');var s=[{inputs:[{internalType:"string",name:"uri_",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256[]",name:"ids",type:"uint256[]"},{indexed:!1,internalType:"uint256[]",name:"values",type:"uint256[]"}],name:"TransferBatch",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"TransferSingle",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"value",type:"string"},{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"URI",type:"event"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"id",type:"uint256"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"accounts",type:"address[]"},{internalType:"uint256[]",name:"ids",type:"uint256[]"}],name:"balanceOfBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256[]",name:"ids",type:"uint256[]"},{internalType:"uint256[]",name:"amounts",type:"uint256[]"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeBatchTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"id",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"uri",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"}];function l({contract:t,config:e,from:n,to:a}){switch(e.token.type){case"ft":return{account:n,address:t,abi:_viem.erc20Abi,functionName:"transfer",args:[a,e.amount]};case"sft":return{account:n,address:t,abi:s,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId,e.quantity,"0x00"],tokenId:e.token.tokenId};case"nft":return{account:n,address:t,abi:_viem.erc721Abi,functionName:"safeTransferFrom",args:[n.address,a,e.token.tokenId],tokenId:e.token.tokenId}}}exports.a = l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as f,b as S}from"./chunk-NLGILHJS.js";import{a as d}from"./chunk-ETVJGLNY.js";import{i as C}from"./chunk-YBHSEZMB.js";import{b as y,c as u}from"./chunk-TZG6MROQ.js";import{a as m,b as p}from"./chunk-WDM7PN4O.js";import{ENTRYPOINT_ADDRESS_V06 as W,ENTRYPOINT_ADDRESS_V07 as A,createSmartAccountClient as E}from"permissionless";import{createPimlicoBundlerClient as h}from"permissionless/clients/pimlico";import{createPublicClient as D,http as P}from"viem";import{blockchainToChainId as R}from"@crossmint/common-sdk-base";var v=class{constructor(r,t,i,e){this.crossmintService=r;this.accountConfigService=t;this.accountCreator=i;this.clientDecorator=e}async getOrCreate(r,t,i){let{config:{entryPointVersion:e,kernelVersion:o,existing:n,userWithId:a},cached:g}=await this.accountConfigService.get(r,t),c=D({transport:P(y(t))}),{account:s,signerConfig:l}=await this.accountCreator.get({chain:t,walletParams:i,publicClient:c,user:a,entryPoint:e==="v0.6"?W:A,kernelVersion:o,existing:n});return n==null&&await this.crossmintService.idempotentCreateSmartWallet(r,{type:m,smartContractWalletAddress:s.address,signerData:l.data,version:p,baseLayer:"evm",chainId:R(t),entryPointVersion:e,kernelVersion:o}),g||this.accountConfigService.cache({entryPointVersion:e,kernelVersion:o,user:a,existing:{address:s.address,signerConfig:l}}),new d({wallet:this.smartAccountClient(t,s,r),public:c},t,this.crossmintService)}smartAccountClient(r,t,i){let e=P(u(r)),o={chain:C[r],entryPoint:t.entryPoint},n=h({...o,transport:e}),a=E({account:t,bundlerTransport:e,...o,...f(r)&&S({bundlerClient:n,entryPoint:t.entryPoint,chain:r,walletService:this.crossmintService,user:i})});return this.clientDecorator.decorate({crossmintChain:r,smartAccountClient:a})}};export{v as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _clientsdkbase = require('@crossmint/client-sdk-base');var r=class extends _clientsdkbase.CrossmintSDKError{constructor(e,i,n=_clientsdkbase.SmartWalletErrorCode.UNCATEGORIZED){super(e,n,i)}},a= exports.b =class extends r{constructor(e,i,n){super(e,_clientsdkbase.SmartWalletErrorCode.ADMIN_MISMATCH),this.required=i,this.used=n}},p= exports.c =class extends r{constructor(e,i,n){super(e,_clientsdkbase.SmartWalletErrorCode.PASSKEY_MISMATCH),this.required=i,this.used=n}},l= exports.d =class extends r{constructor(i){super(`The user with userId ${i.toString()} already has a wallet created for this project`);this.code=_clientsdkbase.SmartWalletErrorCode.USER_WALLET_ALREADY_CREATED}},c= exports.e =class extends r{constructor(e){super(`Prompt was either cancelled or timed out for passkey ${e}`,void 0,_clientsdkbase.SmartWalletErrorCode.PASSKEY_PROMPT),this.passkeyName=e}},u= exports.f =class extends r{constructor(e){super(`Registration for passkey ${e} failed, either the registration took too long, or passkey signature vaildation failed.`,void 0,_clientsdkbase.SmartWalletErrorCode.PASSKEY_REGISTRATION),this.passkeyName=e}},d= exports.g =class extends r{constructor(e){super(`User selected authenticator for passkey ${e} is not compatible with Crossmint's Smart Wallets.`,void 0,_clientsdkbase.SmartWalletErrorCode.PASSKEY_INCOMPATIBLE_AUTHENTICATOR),this.passkeyName=e}},o= exports.h =class extends r{constructor(e){super(e,void 0,_clientsdkbase.SmartWalletErrorCode.WALLET_CONFIG)}},y= exports.i =class extends o{constructor(){super("This signer was already used to create another wallet. Please use a different signer.");this.code=_clientsdkbase.SmartWalletErrorCode.ADMIN_SIGNER_ALREADY_USED}},S= exports.j =class extends o{constructor(){super("Smart wallets are not enabled for this project. They can be enabled on the project settings page in the developer console.");this.code=_clientsdkbase.SmartWalletErrorCode.SMART_WALLETS_NOT_ENABLED}};exports.a = r; exports.b = a; exports.c = p; exports.d = l; exports.e = c; exports.f = u; exports.g = d; exports.h = o; exports.i = y; exports.j = S;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-C3VZY7VJ.js";function c(r){return!e(r)}function y({bundlerClient:r,entryPoint:t,chain:i,walletService:s,user:n}){return{middleware:{gasPrice:async()=>(await r.getUserOperationGasPrice()).fast,sponsorUserOperation:async({userOperation:a})=>{let{sponsorUserOpParams:o}=await s.sponsorUserOperation(n,a,t,i);return o}}}}export{c as a,y as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkGB35YMN4cjs = require('./chunk-GB35YMN4.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var p=class{constructor(t,e){this.crossmintService=t;this.configCache=e}async get(t,e){let i=this.configCache.get(t);if(i!=null)return{config:this.validateAndFormat(t,i),cached:!0};let r=await this.crossmintService.getSmartWalletConfig(t,e);return{config:this.validateAndFormat(t,r),cached:!1}}cache({entryPointVersion:t,kernelVersion:e,user:i,existing:r}){this.configCache.clear(),this.configCache.set(i,{entryPointVersion:t,kernelVersion:e,userId:i.id,signers:[{signerData:r.signerConfig.data}],smartContractWalletAddress:r.address})}validateAndFormat(t,{entryPointVersion:e,kernelVersion:i,signers:r,smartContractWalletAddress:n,userId:s}){if(e==="v0.7"&&i.startsWith("0.2")||e==="v0.6"&&i.startsWith("0.3"))throw new (0, _chunkM4K3IZTTcjs.a)(`Unsupported combination: entryPoint ${e} and kernel version ${i}. Please contact support`);let g=r.map(f=>f.signerData),a=this.getSigner(g);if(n!=null&&a==null||a!=null&&n==null)throw new (0, _chunkM4K3IZTTcjs.a)("Either both signer and address must be present, or both must be null");return a==null||n==null?{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s}}:{entryPointVersion:e,kernelVersion:i,userWithId:{...t,id:s},existing:{signerConfig:a,address:n}}}getSigner(t){if(t.length===0)return;let e=t[0];if(e.type==="eoa")return new (0, _chunkGB35YMN4cjs.b)(e);if(e.type==="passkeys")return new (0, _chunkGB35YMN4cjs.a)(e)}};exports.a = p;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5M3MSPHKcjs = require('./chunk-5M3MSPHK.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _viem = require('viem');var r=class{constructor(n){this.logger=n}map(n,t){return this.record(n),n instanceof _chunkM4K3IZTTcjs.a||n instanceof _viem.BaseError?n:t}record(n){let t=n instanceof Error?n.message:String(n);this.logger.error(`Smart Wallet SDK Error: ${t}`,{stack:n instanceof Error?n.stack:void 0,name:n instanceof Error?n.name:"UnknownError",details:_viem.stringify.call(void 0, n),domain:window.location.hostname,sdk_version:_chunk5M3MSPHKcjs.d})}};exports.a = r;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as d}from"./chunk-C3VZY7VJ.js";import{a as m}from"./chunk-Z22H3MJS.js";import{a as l}from"./chunk-UPURFW46.js";import{stringify as y}from"viem";var h=["sendTransaction","writeContract","sendUserOperation"],g=["signMessage","signTypedData"];function c(a){return h.includes(a)}function p(a){return g.includes(a)}var u=class{constructor(o,t=m){this.errorProcessor=o;this.logger=t}decorate({crossmintChain:o,smartAccountClient:t}){return new Proxy(t,{get:(n,e,s)=>{let r=Reflect.get(n,e,s);return typeof r!="function"||typeof e!="string"||!(p(e)||c(e))?r:(...i)=>this.logger.logPerformance(`CrossmintSmartWallet.${e}`,()=>this.execute(n,e,r,i,o))}})}async execute(o,t,n,e,s){try{this.logger.log(`[CrossmintSmartWallet.${t}] - params: ${y(e)}`);let r=c(t)?this.processTxnArgs(t,s,e):e;return await n.call(o,...r)}catch(r){let i=c(t)?"signing":"sending transaction";throw this.errorProcessor.map(r,new l(`Error ${i}: ${r.message}`,y(r)))}}processTxnArgs(o,t,n){if(o==="sendUserOperation"){let[{userOperation:s,middleware:r,account:i}]=n;return[{middleware:r,account:i,userOperation:this.addGelatoBundlerProperties(t,s)},...n.slice(1)]}let[e]=n;return[this.addGelatoBundlerProperties(t,e),...n.slice(1)]}addGelatoBundlerProperties(o,t){return d(o)?{...t,maxFeePerGas:"0x0",maxPriorityFeePerGas:"0x0"}:t}};export{u as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk5M3MSPHKcjs = require('./chunk-5M3MSPHK.cjs');var _clientsdkbase = require('@crossmint/client-sdk-base');var s=new (0, _clientsdkbase.SDKLogger)(_chunk5M3MSPHKcjs.c),w= exports.b =new (0, _clientsdkbase.SDKLogger)(_chunk5M3MSPHKcjs.c,_clientsdkbase.getBrowserLogger.call(void 0, _chunk5M3MSPHKcjs.c,{onlyDatadog:!0}));exports.a = s; exports.b = w;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkIQTGPM2Ucjs = require('./chunk-IQTGPM2U.cjs');var _chunkSWWOVT47cjs = require('./chunk-SWWOVT47.cjs');var _chunk2GS5TXEYcjs = require('./chunk-2GS5TXEY.cjs');var _chunk7FXFOOQUcjs = require('./chunk-7FXFOOQU.cjs');var _chunk5M3MSPHKcjs = require('./chunk-5M3MSPHK.cjs');var _permissionless = require('permissionless');var _pimlico = require('permissionless/clients/pimlico');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var v=class{constructor(r,t,i,e){this.crossmintService=r;this.accountConfigService=t;this.accountCreator=i;this.clientDecorator=e}async getOrCreate(r,t,i){let{config:{entryPointVersion:e,kernelVersion:o,existing:n,userWithId:a},cached:g}=await this.accountConfigService.get(r,t),c=_viem.createPublicClient.call(void 0, {transport:_viem.http.call(void 0, _chunk7FXFOOQUcjs.b.call(void 0, t))}),{account:s,signerConfig:l}=await this.accountCreator.get({chain:t,walletParams:i,publicClient:c,user:a,entryPoint:e==="v0.6"?_permissionless.ENTRYPOINT_ADDRESS_V06:_permissionless.ENTRYPOINT_ADDRESS_V07,kernelVersion:o,existing:n});return n==null&&await this.crossmintService.idempotentCreateSmartWallet(r,{type:_chunk5M3MSPHKcjs.a,smartContractWalletAddress:s.address,signerData:l.data,version:_chunk5M3MSPHKcjs.b,baseLayer:"evm",chainId:_commonsdkbase.blockchainToChainId.call(void 0, t),entryPointVersion:e,kernelVersion:o}),g||this.accountConfigService.cache({entryPointVersion:e,kernelVersion:o,user:a,existing:{address:s.address,signerConfig:l}}),new (0, _chunkSWWOVT47cjs.a)({wallet:this.smartAccountClient(t,s,r),public:c},t,this.crossmintService)}smartAccountClient(r,t,i){let e=_viem.http.call(void 0, _chunk7FXFOOQUcjs.c.call(void 0, r)),o={chain:_chunk2GS5TXEYcjs.i[r],entryPoint:t.entryPoint},n=_pimlico.createPimlicoBundlerClient.call(void 0, {...o,transport:e}),a=_permissionless.createSmartAccountClient.call(void 0, {account:t,bundlerTransport:e,...o,..._chunkIQTGPM2Ucjs.a.call(void 0, r)&&_chunkIQTGPM2Ucjs.b.call(void 0, {bundlerClient:n,entryPoint:t.entryPoint,chain:r,walletService:this.crossmintService,user:i})});return this.clientDecorator.decorate({crossmintChain:r,smartAccountClient:a})}};exports.a = v;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toHex as p}from"viem";function n(r,e){let t=e(r);return t.replace?t.value:Array.isArray(r)?r.map(i=>n(i,e)):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([i,o])=>[i,n(o,e)])):t.value}function s(r){return n(r,e=>typeof e=="bigint"?{value:p(e),replace:!0}:{value:e,replace:!1})}function f(r){return n(r,e=>e!=null&&typeof e=="object"&&"__xm_serializedType"in e&&"value"in e&&e.__xm_serializedType==="bigint"&&typeof e.value=="string"?{value:BigInt(e.value),replace:!0}:{value:e,replace:!1})}export{s as a,f as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBXXREMNRcjs = require('./chunk-BXXREMNR.cjs');var _viem = require('viem');var s=class{constructor(e){this.keyPrefix=e}set(e,t){localStorage.setItem(this.key(e),JSON.stringify(t))}get(e){let t=this.key(e),r=localStorage.getItem(t);if(r==null)return null;let a=_chunkBXXREMNRcjs.e.safeParse(JSON.parse(r));return a.success?a.data:(localStorage.removeItem(t),null)}clear(){for(let e=0;e<localStorage.length;e++){let t=localStorage.key(e);t&&t.startsWith(this.keyPrefix)&&(localStorage.removeItem(t),e--)}}key(e){return`${this.keyPrefix}-${_viem.keccak256.call(void 0, _viem.toHex.call(void 0, e.jwt))}`}};exports.a = s;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as m}from"./chunk-Z22H3MJS.js";import{e as l}from"./chunk-CPYNP4XI.js";import{a as p,b as E}from"./chunk-PZ6Q22YJ.js";import{e as s}from"./chunk-WDM7PN4O.js";import{d as a,i as n,j as i}from"./chunk-UPURFW46.js";import{APIErrorService as A,BaseCrossmintService as R,CrossmintServiceError as f}from"@crossmint/client-sdk-base";import{blockchainToChainId as h}from"@crossmint/common-sdk-base";var c=class extends R{constructor(){super(...arguments);this.logger=m;this.apiErrorService=new A({ERROR_USER_WALLET_ALREADY_CREATED:({userId:r})=>new a(r),ERROR_ADMIN_SIGNER_ALREADY_USED:()=>new n,ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED:()=>new i})}async idempotentCreateSmartWallet(r,t){await this.fetchCrossmintAPI(`${s}/sdk/smart-wallet`,{method:"PUT",body:JSON.stringify(t)},"Error creating abstract wallet. Please contact support",r.jwt)}async sponsorUserOperation(r,t,o,e){let S=h(e),P=await this.fetchCrossmintAPI(`${s}/sdk/paymaster`,{method:"POST",body:JSON.stringify({userOp:p(t),entryPoint:o,chainId:S})},"Error sponsoring user operation. Please contact support",r.jwt);return E(P)}async getSmartWalletConfig(r,t){let o=await this.fetchCrossmintAPI(`${s}/sdk/smart-wallet/config?chain=${t}`,{method:"GET"},"Error getting smart wallet version configuration. Please contact support",r.jwt),e=l.safeParse(o);if(!e.success)throw new f(`Invalid smart wallet config, please contact support. Details below:
|
|
2
|
+
${e.error.toString()}`);return e.data}async fetchNFTs(r,t){return this.fetchCrossmintAPI(`v1-alpha1/wallets/${t}:${r}/nfts`,{method:"GET"},`Error fetching NFTs for wallet: ${r}`)}getPasskeyServerUrl(){return this.crossmintBaseUrl+"api/internal/passkeys"}};export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{BaseError as l,ContractFunctionRevertedError as s}from"viem";import{CrossmintSDKError as d,WalletErrorCode as m}from"@crossmint/client-sdk-base";var o=class extends d{constructor(a,r,i,e=m.SEND_TRANSACTION_FAILED){super(a,e);this.viemError=r;this.stage=i}},c=class extends o{constructor(a,r,i,e,n,h=i.data,f=i.reason){super(a,r,n,m.SEND_TRANSACTION_EXECUTION_REVERTED);this.viemError=r;this.txId=e;this.stage=n;this.data=h;this.reason=f}},p=class{constructor(t,a={confirmations:2,transactionConfirmationTimeout:3e4}){this.client=t;this.defaultSendTransactionOptions=a}async sendTransaction(t,a={}){let{confirmations:r,transactionConfirmationTimeout:i}=this.getConfig(a);await this.simulateCall(t,void 0,"simulation");let e;try{e=await this.client.wallet.writeContract({...t,account:this.client.wallet.account,chain:this.client.wallet.chain})}catch(n){throw n instanceof l?new o(n.message,n,"send"):n}try{let n=await this.client.public.waitForTransactionReceipt({hash:e,confirmations:r,timeout:i});return await this.handleReceipt(n,t)}catch(n){throw n instanceof l?new o(n.message,n,"confirmation"):n}}getConfig(t){return{...this.defaultSendTransactionOptions,...t}}async handleReceipt(t,a){if(t.status==="reverted")throw await this.simulateCall(a,t.transactionHash,"execution"),new c("Transaction reverted but unable to detect the reason",new s({abi:a.abi,functionName:a.functionName}),new s({abi:a.abi,functionName:a.functionName}),t.transactionHash,"execution");return t.transactionHash}async simulateCall(t,a,r){try{await this.client.public.simulateContract({...t,account:this.client.wallet.account.address,chain:this.client.public.chain})}catch(i){if(i instanceof l){let e=i.walk(n=>n instanceof s);throw e instanceof s?new c(e.message,i,e,a,r):new o(i.message,i,r)}throw i}}};export{o as a,c as b,p as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkGB35YMN4cjs = require('./chunk-GB35YMN4.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _passkeyvalidator = require('@zerodev/passkey-validator');var _sdk = require('@zerodev/sdk');var _webauthnkey = require('@zerodev/webauthn-key');var f=class{constructor(e,t){this.passkeyServerUrl=e;this.apiKey=t}async create({user:e,publicClient:t,walletParams:r,entryPoint:c,kernelVersion:i,existing:a}){let n=_nullishCoalesce(r.signer.passkeyName, () => (e.id));if(a!=null&&a.signerConfig.data.passkeyName!==n)throw new (0, _chunkM4K3IZTTcjs.c)(`User '${e.id}' has an existing wallet created with a passkey named '${a.signerConfig.data.passkeyName}', this does match input passkey name '${n}'.`,a.signerConfig.display());try{a==null&&r.signer.onPrePasskeyRegistration!=null&&await r.signer.onPrePasskeyRegistration();let s=await this.getPasskey(e,n,_optionalChain([a, 'optionalAccess', _ => _.signerConfig, 'access', _2 => _2.data])),g=_passkeyvalidator.PasskeyValidatorContractVersion.V0_0_2,d=a==null?g:a.signerConfig.data.validatorContractVersion,y=await _passkeyvalidator.toPasskeyValidator.call(void 0, t,{webAuthnKey:s,entryPoint:c,validatorContractVersion:d,kernelVersion:i}),k=await _sdk.createKernelAccount.call(void 0, t,{plugins:{sudo:y},entryPoint:c,kernelVersion:i,deployedAccountAddress:_optionalChain([a, 'optionalAccess', _3 => _3.address])});return{signerConfig:this.getSignerConfig(y,d,n),account:this.decorate(k,n,r)}}catch(s){throw r.signer.onPasskeyRegistrationError!=null&&r.signer.onPasskeyRegistrationError(s),this.mapError(s,n)}}async getPasskey(e,t,r){return r!=null?{pubX:BigInt(r.pubKeyX),pubY:BigInt(r.pubKeyY),authenticatorId:r.authenticatorId,authenticatorIdHash:r.authenticatorIdHash}:_webauthnkey.toWebAuthnKey.call(void 0, {passkeyName:t,passkeyServerUrl:this.passkeyServerUrl,mode:_passkeyvalidator.WebAuthnMode.Register,passkeyServerHeaders:this.createPasskeysServerHeaders(e)})}getSignerConfig(e,t,r){return new (0, _chunkGB35YMN4cjs.a)({...V(e.getSerializedData()),passkeyName:r,validatorContractVersion:t,domain:window.location.hostname,type:"passkeys"})}createPasskeysServerHeaders(e){return{"x-api-key":this.apiKey,Authorization:`Bearer ${e.jwt}`}}mapError(e,t){return e.code===0&&e.name==="DataError"?new (0, _chunkM4K3IZTTcjs.g)(t):e.message==="Registration not verified"?new (0, _chunkM4K3IZTTcjs.f)(t):e.code==="ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY"&&e.name==="NotAllowedError"?new (0, _chunkM4K3IZTTcjs.e)(t):e}decorate(e,t,r){return new Proxy(e,{get:(c,i,a)=>{let n=Reflect.get(c,i,a);if(typeof n!="function"||typeof i!="string"||!v(i))return n;let s=r.signer;return async(...g)=>{_optionalChain([g, 'optionalAccess', _4 => _4[0], 'optionalAccess', _5 => _5.factoryData])!=null&&i==="signUserOperation"&&s.type==="PASSKEY"&&s.onFirstTimePasskeySigning!=null&&await s.onFirstTimePasskeySigning();try{return await n.call(c,...g)}catch(y){throw s.onFirstTimePasskeySigningError!=null&&await s.onFirstTimePasskeySigningError(y),this.mapError(y,t)}}}})}},C=["signMessage","signTypedData","signUserOperation","signTransaction"];function v(o){return C.includes(o)}var V=o=>{let e=b(o),t=new TextDecoder().decode(e);return JSON.parse(t)};function b(o){let e=atob(o);return Uint8Array.from(e,t=>t.codePointAt(0))}exports.a = f;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});function e(){return typeof window<"u"}exports.a = e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk7AVDZZGDcjs = require('./chunk-7AVDZZGD.cjs');var _chunkKYPTGHC6cjs = require('./chunk-KYPTGHC6.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var o=class{constructor(e,t,n,a=new (0, _chunk7AVDZZGDcjs.c)(e)){this.crossmintService=n;this.sendTransactionService=a;this.chain=t,this.client=e}get address(){return this.client.wallet.account.address}async transferToken(e,t){if(this.chain!==t.token.chain)throw new (0, _chunkM4K3IZTTcjs.a)(`Chain mismatch: Expected ${t.token.chain}, but got ${this.chain}. Ensure you are interacting with the correct blockchain.`);return this.executeContract(_chunkKYPTGHC6cjs.a.call(void 0, {contract:t.token.contractAddress,to:e,from:this.client.wallet.account,config:t}))}async nfts(){return this.crossmintService.fetchNFTs(this.address,this.chain)}async executeContract({address:e,abi:t,functionName:n,args:a,value:s,config:l}){return this.sendTransactionService.sendTransaction({address:e,abi:t,functionName:n,args:a,value:s},l)}};exports.a = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{blockchainToChainId as a}from"@crossmint/common-sdk-base";var i="-7M6vRDBDknwvMxnqah_jbcieWg0qad9",o="pim_9dKmQPxiTCvtbUNF7XFBbA",n={polygon:"polygon-mainnet","polygon-amoy":"polygon-amoy",base:"base-mainnet","base-sepolia":"base-sepolia",optimism:"opt-mainnet","optimism-sepolia":"opt-sepolia",arbitrum:"arb-mainnet","arbitrum-sepolia":"arb-sepolia"};function r(t){return`https://${n[t]}.g.alchemy.com/v2/${i}`}function l(t){return`https://api.pimlico.io/v2/${a(t)}/rpc?apikey=${o}`}export{n as a,r as b,l as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as s}from"./chunk-BJZQA5VC.js";import{b as d}from"./chunk-CUTQYF3F.js";import{a as i}from"./chunk-FHNNZVNU.js";import{b as n}from"./chunk-UPURFW46.js";import{signerToEcdsaValidator as f}from"@zerodev/ecdsa-validator";import{createKernelAccount as u}from"@zerodev/sdk";var c=class{async create({chain:m,publicClient:o,entryPoint:a,walletParams:g,kernelVersion:t,user:p,existing:e}){let r=await i({chain:m,walletParams:g});if(e!=null&&!d(r.address,e.signerConfig.data.eoaAddress))throw new n(`User '${p.id}' has an existing wallet with an eoa signer '${e.signerConfig.data.eoaAddress}', this does not match input eoa signer '${r.address}'.`,e.signerConfig.display(),{type:"eoa",eoaAddress:e.signerConfig.data.eoaAddress});let A=await f(o,{signer:r,entryPoint:a,kernelVersion:t});return{account:await u(o,{plugins:{sudo:A},index:0n,entryPoint:a,kernelVersion:t,deployedAccountAddress:e?.address}),signerConfig:new s({eoaAddress:r.address,type:"eoa"})}}};export{c as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CrossmintSDKError as g,SmartWalletErrorCode as s}from"@crossmint/client-sdk-base";var r=class extends g{constructor(e,i,n=s.UNCATEGORIZED){super(e,n,i)}},a=class extends r{constructor(e,i,n){super(e,s.ADMIN_MISMATCH),this.required=i,this.used=n}},p=class extends r{constructor(e,i,n){super(e,s.PASSKEY_MISMATCH),this.required=i,this.used=n}},l=class extends r{constructor(i){super(`The user with userId ${i.toString()} already has a wallet created for this project`);this.code=s.USER_WALLET_ALREADY_CREATED}},c=class extends r{constructor(e){super(`Prompt was either cancelled or timed out for passkey ${e}`,void 0,s.PASSKEY_PROMPT),this.passkeyName=e}},u=class extends r{constructor(e){super(`Registration for passkey ${e} failed, either the registration took too long, or passkey signature vaildation failed.`,void 0,s.PASSKEY_REGISTRATION),this.passkeyName=e}},d=class extends r{constructor(e){super(`User selected authenticator for passkey ${e} is not compatible with Crossmint's Smart Wallets.`,void 0,s.PASSKEY_INCOMPATIBLE_AUTHENTICATOR),this.passkeyName=e}},o=class extends r{constructor(e){super(e,void 0,s.WALLET_CONFIG)}},y=class extends o{constructor(){super("This signer was already used to create another wallet. Please use a different signer.");this.code=s.ADMIN_SIGNER_ALREADY_USED}},S=class extends o{constructor(){super("Smart wallets are not enabled for this project. They can be enabled on the project settings page in the developer console.");this.code=s.SMART_WALLETS_NOT_ENABLED}};export{r as a,a as b,p as c,l as d,c as e,u as f,d as g,o as h,y as i,S as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e="0.1.21";var n="ZeroDev",d=0,c="SCW_SDK",p=e,a="2024-06-09",m=["0.3.1","0.3.0","0.2.4"],E=["v0.6","v0.7"];export{n as a,d as b,c,p as d,a as e,m as f,E as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});function e(a){return!1}exports.a = e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkWJ6XJMRDcjs = require('./chunk-WJ6XJMRD.cjs');var _chunkPLRQBDYScjs = require('./chunk-PLRQBDYS.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _viem = require('viem');var h=["sendTransaction","writeContract","sendUserOperation"],g=["signMessage","signTypedData"];function c(a){return h.includes(a)}function p(a){return g.includes(a)}var u=class{constructor(o,t=_chunkPLRQBDYScjs.a){this.errorProcessor=o;this.logger=t}decorate({crossmintChain:o,smartAccountClient:t}){return new Proxy(t,{get:(n,e,s)=>{let r=Reflect.get(n,e,s);return typeof r!="function"||typeof e!="string"||!(p(e)||c(e))?r:(...i)=>this.logger.logPerformance(`CrossmintSmartWallet.${e}`,()=>this.execute(n,e,r,i,o))}})}async execute(o,t,n,e,s){try{this.logger.log(`[CrossmintSmartWallet.${t}] - params: ${_viem.stringify.call(void 0, e)}`);let r=c(t)?this.processTxnArgs(t,s,e):e;return await n.call(o,...r)}catch(r){let i=c(t)?"signing":"sending transaction";throw this.errorProcessor.map(r,new (0, _chunkM4K3IZTTcjs.a)(`Error ${i}: ${r.message}`,_viem.stringify.call(void 0, r)))}}processTxnArgs(o,t,n){if(o==="sendUserOperation"){let[{userOperation:s,middleware:r,account:i}]=n;return[{middleware:r,account:i,userOperation:this.addGelatoBundlerProperties(t,s)},...n.slice(1)]}let[e]=n;return[this.addGelatoBundlerProperties(t,e),...n.slice(1)]}addGelatoBundlerProperties(o,t){return _chunkWJ6XJMRDcjs.a.call(void 0, o)?{...t,maxFeePerGas:"0x0",maxPriorityFeePerGas:"0x0"}:t}};exports.a = u;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunk6DE5YEO5cjs = require('./chunk-6DE5YEO5.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var o=class{constructor(e,r){this.eoaStrategy=e;this.passkeyStrategy=r}get(e){if(_chunk6DE5YEO5cjs.d.call(void 0, e))return this.passkeyStrategy.create(e);if(_chunk6DE5YEO5cjs.f.call(void 0, e))return this.eoaStrategy.create(e);if(e.existing==null)throw new (0, _chunkM4K3IZTTcjs.h)(`Unsupported wallet params:
|
|
2
|
+
${e.walletParams}`);let r=e.existing.signerConfig.display(),y=_chunk6DE5YEO5cjs.c.call(void 0, e.walletParams)?"passkey":"eoa";throw new (0, _chunkM4K3IZTTcjs.b)(`Cannot create wallet with ${y} signer for user ${e.user.id}', they already have a wallet with signer:
|
|
3
|
+
'${JSON.stringify(r,null,2)}'`,r)}};exports.a = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }function r(n){return!n||n.length===0||n.trim().length===0}function o(n,e){return _optionalChain([n, 'optionalAccess', _ => _.toLowerCase, 'call', _2 => _2()])===_optionalChain([e, 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4()])}exports.a = r; exports.b = o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as n,g as r}from"./chunk-WDM7PN4O.js";function p(e){return n.includes(e)}function g(e){return r.includes(e)}function i(e){return"signer"in e&&"type"in e.signer&&e.signer.type==="PASSKEY"}function P(e){let t=e.existing==null||e.existing.signerConfig.type==="passkeys";return i(e.walletParams)&&t}function s(e){return"signer"in e&&("type"in e.signer&&e.signer.type==="VIEM_ACCOUNT"||"request"in e.signer&&typeof e.signer.request=="function")}function C(e){let t=e.existing==null||e.existing.signerConfig.type==="eoa";return s(e.walletParams)&&t}export{p as a,g as b,i as c,P as d,s as e,C as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _viem = require('viem');function n(r,e){let t=e(r);return t.replace?t.value:Array.isArray(r)?r.map(i=>n(i,e)):r!==null&&typeof r=="object"?Object.fromEntries(Object.entries(r).map(([i,o])=>[i,n(o,e)])):t.value}function c(r){return n(r,e=>typeof e=="bigint"?{value:_viem.toHex.call(void 0, e),replace:!0}:{value:e,replace:!1})}function s(r){return n(r,e=>e!=null&&typeof e=="object"&&"__xm_serializedType"in e&&"value"in e&&e.__xm_serializedType==="bigint"&&typeof e.value=="string"?{value:BigInt(e.value),replace:!0}:{value:e,replace:!1})}exports.a = c; exports.b = s;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{arbitrum as i,arbitrumSepolia as l,base as s,baseSepolia as r,optimism as S,optimismSepolia as p,polygon as m,polygonAmoy as c}from"viem/chains";import{BlockchainIncludingTestnet as t,objectValues as a}from"@crossmint/common-sdk-base";var n={BASE_SEPOLIA:t.BASE_SEPOLIA,POLYGON_AMOY:t.POLYGON_AMOY,OPTIMISM_SEPOLIA:t.OPTIMISM_SEPOLIA,ARBITRUM_SEPOLIA:t.ARBITRUM_SEPOLIA},A=a(n),o={BASE:t.BASE,POLYGON:t.POLYGON,OPTIMISM:t.OPTIMISM,ARBITRUM:t.ARBITRUM},O=a(o),T={...n,...o},y=a(T);function E(e){return A.includes(e)}function L(e){return O.includes(e)}var h={polygon:m,"polygon-amoy":c,base:s,"base-sepolia":r,optimism:S,"optimism-sepolia":p,arbitrum:i,"arbitrum-sepolia":l};export{n as a,A as b,o as c,O as d,T as e,y as f,E as g,L as h,h as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkSCXFZMLRcjs = require('./chunk-SCXFZMLR.cjs');var _chunkWTPE2I2Qcjs = require('./chunk-WTPE2I2Q.cjs');var _chunkPPTSNCSQcjs = require('./chunk-PPTSNCSQ.cjs');var _chunkQ44P7MO7cjs = require('./chunk-Q44P7MO7.cjs');var _chunkO2ACORIIcjs = require('./chunk-O2ACORII.cjs');var _chunkXHSA4YTOcjs = require('./chunk-XHSA4YTO.cjs');var _chunk2R6HK64Ncjs = require('./chunk-2R6HK64N.cjs');var _chunkSTH2LE35cjs = require('./chunk-STH2LE35.cjs');var _chunkB3LJJZXDcjs = require('./chunk-B3LJJZXD.cjs');var _chunkPLRQBDYScjs = require('./chunk-PLRQBDYS.cjs');var _chunk2GS5TXEYcjs = require('./chunk-2GS5TXEY.cjs');var _chunkOCJYX5QFcjs = require('./chunk-OCJYX5QF.cjs');var _chunk5M3MSPHKcjs = require('./chunk-5M3MSPHK.cjs');var _chunkM4K3IZTTcjs = require('./chunk-M4K3IZTT.cjs');var _viem = require('viem');var _commonsdkbase = require('@crossmint/common-sdk-base');var P=class W{constructor(r,t,a,e=_chunkPLRQBDYScjs.a){this.crossmintEnv=r;this.smartWalletService=t;this.errorProcessor=a;this.logger=e}static init({clientApiKey:r}){let t=_commonsdkbase.validateAPIKey.call(void 0, r);if(!t.isValid)throw new Error("API key invalid");let a=new (0, _chunkB3LJJZXDcjs.a)(r),e=new (0, _chunkOCJYX5QFcjs.a)(_chunkPLRQBDYScjs.b),d=new (0, _chunkXHSA4YTOcjs.a)(new _chunk2R6HK64Ncjs.a,new (0, _chunkSCXFZMLRcjs.a)(a.getPasskeyServerUrl(),r)),E=new (0, _chunkQ44P7MO7cjs.a)(`smart-wallet-${_chunk5M3MSPHKcjs.d}`),u=new (0, _chunkPPTSNCSQcjs.a)(a,new (0, _chunkO2ACORIIcjs.a)(a,E),d,new (0, _chunkWTPE2I2Qcjs.a)(e));return new W(t.environment,u,e)}async getOrCreateWallet(r,t,a={signer:{type:"PASSKEY"}}){if(!_chunkSTH2LE35cjs.a.call(void 0, ))throw new (0, _chunkM4K3IZTTcjs.a)("Smart Wallet SDK should only be used client side.");return this.assertValidChain(t),await this.logger.logPerformance("GET_OR_CREATE_WALLET",async()=>{try{return await this.smartWalletService.getOrCreate(r,t,a)}catch(e){throw this.errorProcessor.map(e,new (0, _chunkM4K3IZTTcjs.a)(`Wallet creation failed: ${e.message}.`,_viem.stringify.call(void 0, e)))}})}assertValidChain(r){if(!this.validChain(r))throw new (0, _chunkM4K3IZTTcjs.a)(`The selected chain "${r}" is not available in "${this.crossmintEnv}". Either set a valid chain or check you're using an API key for the environment you're trying to target.`)}validChain(r){return this.crossmintEnv==="development"||this.crossmintEnv==="staging"?_chunk2GS5TXEYcjs.g.call(void 0, r):_chunk2GS5TXEYcjs.h.call(void 0, r)}};exports.a = P;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as o}from"./chunk-WDM7PN4O.js";import{SDKLogger as r,getBrowserLogger as e}from"@crossmint/client-sdk-base";var w=new r(o),a=new r(o,e(o,{onlyDatadog:!0}));export{w as a,a as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkM4K3IZTTcjs = require('../chunk-M4K3IZTT.cjs');exports.AdminAlreadyUsedError = _chunkM4K3IZTTcjs.i; exports.AdminMismatchError = _chunkM4K3IZTTcjs.b; exports.ConfigError = _chunkM4K3IZTTcjs.h; exports.PasskeyIncompatibleAuthenticatorError = _chunkM4K3IZTTcjs.g; exports.PasskeyMismatchError = _chunkM4K3IZTTcjs.c; exports.PasskeyPromptError = _chunkM4K3IZTTcjs.e; exports.PasskeyRegistrationError = _chunkM4K3IZTTcjs.f; exports.SmartWalletError = _chunkM4K3IZTTcjs.a; exports.SmartWalletsNotEnabledError = _chunkM4K3IZTTcjs.j; exports.UserWalletAlreadyCreatedError = _chunkM4K3IZTTcjs.d;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { CrossmintSDKError, SmartWalletErrorCode } from '@crossmint/client-sdk-base';
|
|
2
|
+
import { a as SignerDisplay, P as PasskeyDisplay } from '../service-Ir-Qho-9.cjs';
|
|
3
|
+
import 'zod';
|
|
4
|
+
import '@zerodev/sdk';
|
|
5
|
+
import 'permissionless';
|
|
6
|
+
import 'permissionless/accounts';
|
|
7
|
+
import 'permissionless/types/entrypoint';
|
|
8
|
+
import 'viem';
|
|
9
|
+
import '../blockchain/chains.cjs';
|
|
10
|
+
import 'viem/chains';
|
|
11
|
+
import '@crossmint/common-sdk-base';
|
|
12
|
+
import '../types/schema.cjs';
|
|
13
|
+
import '@zerodev/passkey-validator';
|
|
14
|
+
import '../utils/constants.cjs';
|
|
15
|
+
import '../types/params.cjs';
|
|
16
|
+
|
|
17
|
+
declare class SmartWalletError extends CrossmintSDKError {
|
|
18
|
+
constructor(message: string, details?: string, code?: SmartWalletErrorCode);
|
|
19
|
+
}
|
|
20
|
+
declare class AdminMismatchError extends SmartWalletError {
|
|
21
|
+
readonly required: SignerDisplay;
|
|
22
|
+
readonly used?: SignerDisplay;
|
|
23
|
+
constructor(message: string, required: SignerDisplay, used?: SignerDisplay);
|
|
24
|
+
}
|
|
25
|
+
declare class PasskeyMismatchError extends SmartWalletError {
|
|
26
|
+
readonly required: PasskeyDisplay;
|
|
27
|
+
readonly used?: PasskeyDisplay;
|
|
28
|
+
constructor(message: string, required: PasskeyDisplay, used?: PasskeyDisplay);
|
|
29
|
+
}
|
|
30
|
+
declare class UserWalletAlreadyCreatedError extends SmartWalletError {
|
|
31
|
+
readonly code: "smart-wallet:user-wallet-already-created";
|
|
32
|
+
constructor(userId: string);
|
|
33
|
+
}
|
|
34
|
+
declare class PasskeyPromptError extends SmartWalletError {
|
|
35
|
+
passkeyName: string;
|
|
36
|
+
constructor(passkeyName: string);
|
|
37
|
+
}
|
|
38
|
+
declare class PasskeyRegistrationError extends SmartWalletError {
|
|
39
|
+
passkeyName: string;
|
|
40
|
+
constructor(passkeyName: string);
|
|
41
|
+
}
|
|
42
|
+
declare class PasskeyIncompatibleAuthenticatorError extends SmartWalletError {
|
|
43
|
+
passkeyName: string;
|
|
44
|
+
constructor(passkeyName: string);
|
|
45
|
+
}
|
|
46
|
+
declare class ConfigError extends SmartWalletError {
|
|
47
|
+
constructor(message: string);
|
|
48
|
+
}
|
|
49
|
+
declare class AdminAlreadyUsedError extends ConfigError {
|
|
50
|
+
readonly code: "smart-wallet:config.admin-signer-already-used";
|
|
51
|
+
constructor();
|
|
52
|
+
}
|
|
53
|
+
declare class SmartWalletsNotEnabledError extends ConfigError {
|
|
54
|
+
readonly code: "smart-wallet:not-enabled";
|
|
55
|
+
constructor();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { AdminAlreadyUsedError, AdminMismatchError, ConfigError, PasskeyIncompatibleAuthenticatorError, PasskeyMismatchError, PasskeyPromptError, PasskeyRegistrationError, SmartWalletError, SmartWalletsNotEnabledError, UserWalletAlreadyCreatedError };
|