@crossmint/client-sdk-smart-wallet 0.1.24 → 0.1.26
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 -34
- package/dist/SmartWalletSDK.js +1 -34
- package/dist/api/CrossmintWalletService.cjs +1 -13
- package/dist/api/CrossmintWalletService.js +1 -13
- package/dist/blockchain/chains.cjs +1 -23
- package/dist/blockchain/chains.js +1 -23
- package/dist/blockchain/rpc.cjs +1 -11
- package/dist/blockchain/rpc.js +1 -11
- package/dist/blockchain/transfer.cjs +1 -7
- package/dist/blockchain/transfer.js +1 -7
- package/dist/blockchain/wallets/EVMSmartWallet.cjs +1 -10
- package/dist/blockchain/wallets/EVMSmartWallet.js +1 -10
- package/dist/blockchain/wallets/SendTransactionService.cjs +1 -11
- package/dist/blockchain/wallets/SendTransactionService.js +1 -11
- package/dist/blockchain/wallets/account/cache.cjs +1 -9
- package/dist/blockchain/wallets/account/cache.js +1 -9
- package/dist/blockchain/wallets/account/config.cjs +1 -9
- package/dist/blockchain/wallets/account/config.js +1 -9
- package/dist/blockchain/wallets/account/creator.cjs +1 -10
- package/dist/blockchain/wallets/account/creator.js +1 -10
- package/dist/blockchain/wallets/account/eoa.cjs +1 -11
- package/dist/blockchain/wallets/account/eoa.js +1 -11
- package/dist/blockchain/wallets/account/passkey.cjs +1 -9
- package/dist/blockchain/wallets/account/passkey.js +1 -9
- package/dist/blockchain/wallets/account/signer.cjs +1 -9
- package/dist/blockchain/wallets/account/signer.js +1 -9
- package/dist/blockchain/wallets/account/strategy.cjs +1 -1
- package/dist/blockchain/wallets/account/strategy.js +0 -1
- package/dist/blockchain/wallets/clientDecorator.cjs +1 -12
- package/dist/blockchain/wallets/clientDecorator.js +1 -12
- package/dist/blockchain/wallets/index.cjs +1 -10
- package/dist/blockchain/wallets/index.js +1 -10
- package/dist/blockchain/wallets/paymaster.cjs +1 -10
- package/dist/blockchain/wallets/paymaster.js +1 -10
- package/dist/blockchain/wallets/service.cjs +1 -16
- package/dist/blockchain/wallets/service.js +1 -16
- package/dist/chunk-265KNPZR.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-7AVDZZGD.cjs +1 -0
- package/dist/chunk-7FXFOOQU.cjs +1 -0
- package/dist/chunk-7KTCGFU5.js +1 -0
- package/dist/chunk-AK6IIUTM.js +1 -0
- package/dist/chunk-ATQ4WGCW.js +1 -0
- package/dist/chunk-BIJAOWPS.js +1 -0
- package/dist/chunk-BJZQA5VC.js +1 -0
- package/dist/chunk-C3VZY7VJ.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-DQNKQDE2.cjs +1 -0
- package/dist/chunk-E3NG3YWO.js +1 -0
- package/dist/chunk-ETVJGLNY.js +1 -0
- package/dist/chunk-FHNNZVNU.js +1 -0
- package/dist/chunk-GB35YMN4.cjs +1 -0
- package/dist/chunk-H4CMXNVK.js +1 -0
- package/dist/chunk-HGA3WK6L.cjs +1 -0
- package/dist/chunk-II4HKF7X.cjs +1 -0
- package/dist/chunk-IQTGPM2U.cjs +1 -0
- package/dist/chunk-KYPTGHC6.cjs +1 -0
- package/dist/chunk-LDNU6SJL.cjs +3 -0
- package/dist/chunk-M4K3IZTT.cjs +1 -0
- package/dist/chunk-MJ62KCTK.cjs +1 -0
- package/dist/chunk-NAX6LRUY.cjs +1 -0
- package/dist/chunk-NLGILHJS.js +1 -0
- package/dist/chunk-O2ACORII.cjs +1 -0
- package/dist/chunk-ODAUWGUU.cjs +1 -0
- package/dist/chunk-PZ6Q22YJ.js +1 -0
- package/dist/chunk-QD2JKGX6.cjs +1 -0
- package/dist/chunk-S2XBSAGM.js +1 -0
- package/dist/chunk-SBW2PS63.cjs +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-TBTRV56U.cjs +2 -0
- package/dist/chunk-TWADESPF.cjs +1 -0
- package/dist/chunk-TXLAUKCK.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-UXNWF66Q.js +1 -0
- package/dist/chunk-VMOQWOZV.js +3 -0
- package/dist/chunk-VXGNAQOW.js +1 -0
- package/dist/chunk-WJ6XJMRD.cjs +1 -0
- package/dist/{chunk-5MG5CIEX.cjs → chunk-XJGFG3RT.cjs} +1 -13
- package/dist/chunk-XQ2K2K23.cjs +1 -0
- package/dist/chunk-YBHSEZMB.js +1 -0
- package/dist/chunk-YJUD5MVS.js +1 -0
- package/dist/chunk-YUWCRSYD.js +1 -0
- package/dist/chunk-Z7MMOBIC.js +2 -0
- package/dist/error/index.cjs +1 -25
- package/dist/error/index.js +1 -25
- package/dist/error/processor.cjs +1 -9
- package/dist/error/processor.js +1 -9
- package/dist/index.cjs +1 -86
- package/dist/index.js +1 -86
- package/dist/services/index.cjs +1 -11
- package/dist/services/index.js +1 -11
- package/dist/services/logger.cjs +1 -10
- package/dist/services/logger.js +1 -10
- package/dist/types/internal.cjs +1 -18
- package/dist/types/internal.js +1 -18
- package/dist/types/params.cjs +1 -1
- package/dist/types/params.js +0 -1
- package/dist/types/schema.cjs +1 -16
- package/dist/types/schema.js +1 -16
- package/dist/types/service.cjs +1 -1
- package/dist/types/service.js +0 -1
- package/dist/types/token.cjs +1 -1
- package/dist/types/token.js +0 -1
- package/dist/utils/api.cjs +1 -9
- package/dist/utils/api.js +1 -9
- package/dist/utils/blockchain.cjs +1 -7
- package/dist/utils/blockchain.js +1 -7
- package/dist/utils/constants.cjs +1 -19
- package/dist/utils/constants.js +1 -19
- package/dist/utils/environment.cjs +1 -7
- package/dist/utils/environment.js +1 -7
- package/dist/utils/helpers.cjs +1 -9
- package/dist/utils/helpers.js +1 -9
- package/dist/utils/signer.cjs +1 -10
- package/dist/utils/signer.js +1 -10
- package/dist/utils/test.cjs +1 -27
- package/dist/utils/test.js +1 -27
- package/package.json +3 -4
- package/dist/SmartWalletSDK.cjs.map +0 -1
- package/dist/SmartWalletSDK.js.map +0 -1
- package/dist/api/CrossmintWalletService.cjs.map +0 -1
- package/dist/api/CrossmintWalletService.js.map +0 -1
- package/dist/blockchain/chains.cjs.map +0 -1
- package/dist/blockchain/chains.js.map +0 -1
- package/dist/blockchain/rpc.cjs.map +0 -1
- package/dist/blockchain/rpc.js.map +0 -1
- package/dist/blockchain/transfer.cjs.map +0 -1
- package/dist/blockchain/transfer.js.map +0 -1
- package/dist/blockchain/wallets/EVMSmartWallet.cjs.map +0 -1
- package/dist/blockchain/wallets/EVMSmartWallet.js.map +0 -1
- package/dist/blockchain/wallets/SendTransactionService.cjs.map +0 -1
- package/dist/blockchain/wallets/SendTransactionService.js.map +0 -1
- package/dist/blockchain/wallets/account/cache.cjs.map +0 -1
- package/dist/blockchain/wallets/account/cache.js.map +0 -1
- package/dist/blockchain/wallets/account/config.cjs.map +0 -1
- package/dist/blockchain/wallets/account/config.js.map +0 -1
- package/dist/blockchain/wallets/account/creator.cjs.map +0 -1
- package/dist/blockchain/wallets/account/creator.js.map +0 -1
- package/dist/blockchain/wallets/account/eoa.cjs.map +0 -1
- package/dist/blockchain/wallets/account/eoa.js.map +0 -1
- package/dist/blockchain/wallets/account/passkey.cjs.map +0 -1
- package/dist/blockchain/wallets/account/passkey.js.map +0 -1
- package/dist/blockchain/wallets/account/signer.cjs.map +0 -1
- package/dist/blockchain/wallets/account/signer.js.map +0 -1
- package/dist/blockchain/wallets/account/strategy.cjs.map +0 -1
- package/dist/blockchain/wallets/account/strategy.js.map +0 -1
- package/dist/blockchain/wallets/clientDecorator.cjs.map +0 -1
- package/dist/blockchain/wallets/clientDecorator.js.map +0 -1
- package/dist/blockchain/wallets/index.cjs.map +0 -1
- package/dist/blockchain/wallets/index.js.map +0 -1
- package/dist/blockchain/wallets/paymaster.cjs.map +0 -1
- package/dist/blockchain/wallets/paymaster.js.map +0 -1
- package/dist/blockchain/wallets/service.cjs.map +0 -1
- package/dist/blockchain/wallets/service.js.map +0 -1
- package/dist/chunk-2BBSPDW4.cjs +0 -99
- package/dist/chunk-2BBSPDW4.cjs.map +0 -1
- package/dist/chunk-2GADBKIW.cjs +0 -39
- package/dist/chunk-2GADBKIW.cjs.map +0 -1
- package/dist/chunk-2HB65Y7D.js +0 -79
- package/dist/chunk-2HB65Y7D.js.map +0 -1
- package/dist/chunk-3EQHAQXO.js +0 -112
- package/dist/chunk-3EQHAQXO.js.map +0 -1
- package/dist/chunk-3R6PW6HY.js +0 -30
- package/dist/chunk-3R6PW6HY.js.map +0 -1
- package/dist/chunk-5MG5CIEX.cjs.map +0 -1
- package/dist/chunk-5URMCCO6.js +0 -9
- package/dist/chunk-5URMCCO6.js.map +0 -1
- package/dist/chunk-5WVQ7J3E.cjs +0 -369
- package/dist/chunk-5WVQ7J3E.cjs.map +0 -1
- package/dist/chunk-6FS2OI5W.js +0 -66
- package/dist/chunk-6FS2OI5W.js.map +0 -1
- package/dist/chunk-6NJVFL2X.js +0 -60
- package/dist/chunk-6NJVFL2X.js.map +0 -1
- package/dist/chunk-74NTQGER.js +0 -44
- package/dist/chunk-74NTQGER.js.map +0 -1
- package/dist/chunk-77GT6B5L.cjs +0 -79
- package/dist/chunk-77GT6B5L.cjs.map +0 -1
- package/dist/chunk-7KTQNIAZ.cjs +0 -112
- package/dist/chunk-7KTQNIAZ.cjs.map +0 -1
- package/dist/chunk-7ORLXP6K.cjs +0 -93
- package/dist/chunk-7ORLXP6K.cjs.map +0 -1
- package/dist/chunk-ASIPMVRQ.js +0 -90
- package/dist/chunk-ASIPMVRQ.js.map +0 -1
- package/dist/chunk-BARW756O.js +0 -27
- package/dist/chunk-BARW756O.js.map +0 -1
- package/dist/chunk-BXSAJOIV.cjs +0 -90
- package/dist/chunk-BXSAJOIV.cjs.map +0 -1
- package/dist/chunk-DTEA33DF.cjs +0 -59
- package/dist/chunk-DTEA33DF.cjs.map +0 -1
- package/dist/chunk-DYO4HODM.cjs +0 -36
- package/dist/chunk-DYO4HODM.cjs.map +0 -1
- package/dist/chunk-EPEGJY6N.cjs +0 -9
- package/dist/chunk-EPEGJY6N.cjs.map +0 -1
- package/dist/chunk-EQSMHR77.js +0 -30
- package/dist/chunk-EQSMHR77.js.map +0 -1
- package/dist/chunk-FSIMJYXR.js +0 -36
- package/dist/chunk-FSIMJYXR.js.map +0 -1
- package/dist/chunk-FXGOVLZW.cjs +0 -9
- package/dist/chunk-FXGOVLZW.cjs.map +0 -1
- package/dist/chunk-ICLDP7BD.cjs +0 -36
- package/dist/chunk-ICLDP7BD.cjs.map +0 -1
- package/dist/chunk-IZZQHNZT.cjs +0 -22
- package/dist/chunk-IZZQHNZT.cjs.map +0 -1
- package/dist/chunk-JLZCSWUY.cjs +0 -14
- package/dist/chunk-JLZCSWUY.cjs.map +0 -1
- package/dist/chunk-JOB7STIS.js +0 -9
- package/dist/chunk-JOB7STIS.js.map +0 -1
- package/dist/chunk-KHROQTVY.js +0 -1
- package/dist/chunk-KHROQTVY.js.map +0 -1
- package/dist/chunk-LWVV7JDJ.js +0 -36
- package/dist/chunk-LWVV7JDJ.js.map +0 -1
- package/dist/chunk-N6DG5EZG.cjs +0 -156
- package/dist/chunk-N6DG5EZG.cjs.map +0 -1
- package/dist/chunk-NI6WQXMN.js +0 -99
- package/dist/chunk-NI6WQXMN.js.map +0 -1
- package/dist/chunk-O6IFYHDP.cjs +0 -36
- package/dist/chunk-O6IFYHDP.cjs.map +0 -1
- package/dist/chunk-OGA3YDWS.cjs +0 -112
- package/dist/chunk-OGA3YDWS.cjs.map +0 -1
- package/dist/chunk-OIEP34C6.js +0 -41
- package/dist/chunk-OIEP34C6.js.map +0 -1
- package/dist/chunk-ON4DOYVD.js +0 -369
- package/dist/chunk-ON4DOYVD.js.map +0 -1
- package/dist/chunk-PVFA6PBX.cjs +0 -60
- package/dist/chunk-PVFA6PBX.cjs.map +0 -1
- package/dist/chunk-QBQDYMNI.js +0 -39
- package/dist/chunk-QBQDYMNI.js.map +0 -1
- package/dist/chunk-QJ3BSVGV.js +0 -36
- package/dist/chunk-QJ3BSVGV.js.map +0 -1
- package/dist/chunk-RUTDRRS2.cjs +0 -66
- package/dist/chunk-RUTDRRS2.cjs.map +0 -1
- package/dist/chunk-SBR2CREX.js +0 -82
- package/dist/chunk-SBR2CREX.js.map +0 -1
- package/dist/chunk-SMDX2MXU.js +0 -13
- package/dist/chunk-SMDX2MXU.js.map +0 -1
- package/dist/chunk-TDJDKTRS.js +0 -156
- package/dist/chunk-TDJDKTRS.js.map +0 -1
- package/dist/chunk-TZUJ5MXW.cjs +0 -82
- package/dist/chunk-TZUJ5MXW.cjs.map +0 -1
- package/dist/chunk-U4OBHCIP.js +0 -59
- package/dist/chunk-U4OBHCIP.js.map +0 -1
- package/dist/chunk-UQKE6R5W.cjs +0 -27
- package/dist/chunk-UQKE6R5W.cjs.map +0 -1
- package/dist/chunk-UZGHOTKZ.js +0 -112
- package/dist/chunk-UZGHOTKZ.js.map +0 -1
- package/dist/chunk-WRH3YJT3.js +0 -14
- package/dist/chunk-WRH3YJT3.js.map +0 -1
- package/dist/chunk-X4KT4AKM.cjs +0 -123
- package/dist/chunk-X4KT4AKM.cjs.map +0 -1
- package/dist/chunk-YKW7PMBU.js +0 -22
- package/dist/chunk-YKW7PMBU.js.map +0 -1
- package/dist/chunk-YWCXHOSD.cjs +0 -30
- package/dist/chunk-YWCXHOSD.cjs.map +0 -1
- package/dist/chunk-Z5DNJTAW.cjs +0 -41
- package/dist/chunk-Z5DNJTAW.cjs.map +0 -1
- package/dist/chunk-Z7JWER3L.js +0 -93
- package/dist/chunk-Z7JWER3L.js.map +0 -1
- package/dist/chunk-ZAQLXUMA.cjs +0 -44
- package/dist/chunk-ZAQLXUMA.cjs.map +0 -1
- package/dist/chunk-ZEWOQEKM.js +0 -123
- package/dist/chunk-ZEWOQEKM.js.map +0 -1
- package/dist/chunk-ZN42AA2G.cjs +0 -1
- package/dist/chunk-ZN42AA2G.cjs.map +0 -1
- package/dist/chunk-ZOXKITU4.cjs +0 -30
- package/dist/chunk-ZOXKITU4.cjs.map +0 -1
- package/dist/error/index.cjs.map +0 -1
- package/dist/error/index.js.map +0 -1
- package/dist/error/processor.cjs.map +0 -1
- package/dist/error/processor.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/services/index.cjs.map +0 -1
- package/dist/services/index.js.map +0 -1
- package/dist/services/logger.cjs.map +0 -1
- package/dist/services/logger.js.map +0 -1
- package/dist/types/internal.cjs.map +0 -1
- package/dist/types/internal.js.map +0 -1
- package/dist/types/params.cjs.map +0 -1
- package/dist/types/params.js.map +0 -1
- package/dist/types/schema.cjs.map +0 -1
- package/dist/types/schema.js.map +0 -1
- package/dist/types/service.cjs.map +0 -1
- package/dist/types/service.js.map +0 -1
- package/dist/types/token.cjs.map +0 -1
- package/dist/types/token.js.map +0 -1
- package/dist/utils/api.cjs.map +0 -1
- package/dist/utils/api.js.map +0 -1
- package/dist/utils/blockchain.cjs.map +0 -1
- package/dist/utils/blockchain.js.map +0 -1
- package/dist/utils/constants.cjs.map +0 -1
- package/dist/utils/constants.js.map +0 -1
- package/dist/utils/environment.cjs.map +0 -1
- package/dist/utils/environment.js.map +0 -1
- package/dist/utils/helpers.cjs.map +0 -1
- package/dist/utils/helpers.js.map +0 -1
- package/dist/utils/signer.cjs.map +0 -1
- package/dist/utils/signer.js.map +0 -1
- package/dist/utils/test.cjs.map +0 -1
- package/dist/utils/test.js.map +0 -1
- package/src/ABI/ERC1155.json +0 -325
- package/src/ABI/ERC20.json +0 -222
- package/src/ABI/ERC721.json +0 -320
- package/src/SmartWalletSDK.test.ts +0 -31
- package/src/SmartWalletSDK.ts +0 -104
- package/src/api/CrossmintWalletService.test.ts +0 -43
- package/src/api/CrossmintWalletService.ts +0 -84
- package/src/blockchain/chains.ts +0 -57
- package/src/blockchain/rpc.ts +0 -25
- package/src/blockchain/transfer.ts +0 -54
- package/src/blockchain/wallets/EVMSmartWallet.ts +0 -157
- package/src/blockchain/wallets/SendTransactionService.test.ts +0 -159
- package/src/blockchain/wallets/SendTransactionService.ts +0 -188
- package/src/blockchain/wallets/account/cache.test.ts +0 -67
- package/src/blockchain/wallets/account/cache.ts +0 -43
- package/src/blockchain/wallets/account/config.test.ts +0 -103
- package/src/blockchain/wallets/account/config.ts +0 -116
- package/src/blockchain/wallets/account/creator.ts +0 -40
- package/src/blockchain/wallets/account/eoa.ts +0 -51
- package/src/blockchain/wallets/account/passkey.ts +0 -198
- package/src/blockchain/wallets/account/signer.ts +0 -44
- package/src/blockchain/wallets/account/strategy.ts +0 -5
- package/src/blockchain/wallets/clientDecorator.ts +0 -128
- package/src/blockchain/wallets/index.ts +0 -1
- package/src/blockchain/wallets/paymaster.ts +0 -41
- package/src/blockchain/wallets/service.ts +0 -107
- package/src/error/index.ts +0 -100
- package/src/error/processor.ts +0 -36
- package/src/index.ts +0 -47
- package/src/services/index.ts +0 -1
- package/src/services/logger.ts +0 -6
- package/src/types/internal.ts +0 -76
- package/src/types/params.ts +0 -34
- package/src/types/schema.ts +0 -63
- package/src/types/service.ts +0 -31
- package/src/types/token.ts +0 -29
- package/src/utils/api.ts +0 -39
- package/src/utils/blockchain.ts +0 -5
- package/src/utils/constants.ts +0 -9
- package/src/utils/environment.ts +0 -3
- package/src/utils/helpers.ts +0 -7
- package/src/utils/signer.ts +0 -33
- package/src/utils/test.ts +0 -24
package/src/ABI/ERC721.json
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"inputs": [
|
|
4
|
-
{
|
|
5
|
-
"internalType": "string",
|
|
6
|
-
"name": "name_",
|
|
7
|
-
"type": "string"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"internalType": "string",
|
|
11
|
-
"name": "symbol_",
|
|
12
|
-
"type": "string"
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
"stateMutability": "nonpayable",
|
|
16
|
-
"type": "constructor"
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"anonymous": false,
|
|
20
|
-
"inputs": [
|
|
21
|
-
{
|
|
22
|
-
"indexed": true,
|
|
23
|
-
"internalType": "address",
|
|
24
|
-
"name": "owner",
|
|
25
|
-
"type": "address"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
"indexed": true,
|
|
29
|
-
"internalType": "address",
|
|
30
|
-
"name": "approved",
|
|
31
|
-
"type": "address"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"indexed": true,
|
|
35
|
-
"internalType": "uint256",
|
|
36
|
-
"name": "tokenId",
|
|
37
|
-
"type": "uint256"
|
|
38
|
-
}
|
|
39
|
-
],
|
|
40
|
-
"name": "Approval",
|
|
41
|
-
"type": "event"
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"anonymous": false,
|
|
45
|
-
"inputs": [
|
|
46
|
-
{
|
|
47
|
-
"indexed": true,
|
|
48
|
-
"internalType": "address",
|
|
49
|
-
"name": "owner",
|
|
50
|
-
"type": "address"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
"indexed": true,
|
|
54
|
-
"internalType": "address",
|
|
55
|
-
"name": "operator",
|
|
56
|
-
"type": "address"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"indexed": false,
|
|
60
|
-
"internalType": "bool",
|
|
61
|
-
"name": "approved",
|
|
62
|
-
"type": "bool"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
"name": "ApprovalForAll",
|
|
66
|
-
"type": "event"
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"anonymous": false,
|
|
70
|
-
"inputs": [
|
|
71
|
-
{
|
|
72
|
-
"indexed": true,
|
|
73
|
-
"internalType": "address",
|
|
74
|
-
"name": "from",
|
|
75
|
-
"type": "address"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"indexed": true,
|
|
79
|
-
"internalType": "address",
|
|
80
|
-
"name": "to",
|
|
81
|
-
"type": "address"
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
"indexed": true,
|
|
85
|
-
"internalType": "uint256",
|
|
86
|
-
"name": "tokenId",
|
|
87
|
-
"type": "uint256"
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
"name": "Transfer",
|
|
91
|
-
"type": "event"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"inputs": [
|
|
95
|
-
{
|
|
96
|
-
"internalType": "address",
|
|
97
|
-
"name": "to",
|
|
98
|
-
"type": "address"
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
"internalType": "uint256",
|
|
102
|
-
"name": "tokenId",
|
|
103
|
-
"type": "uint256"
|
|
104
|
-
}
|
|
105
|
-
],
|
|
106
|
-
"name": "approve",
|
|
107
|
-
"outputs": [],
|
|
108
|
-
"stateMutability": "nonpayable",
|
|
109
|
-
"type": "function"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"inputs": [
|
|
113
|
-
{
|
|
114
|
-
"internalType": "address",
|
|
115
|
-
"name": "owner",
|
|
116
|
-
"type": "address"
|
|
117
|
-
}
|
|
118
|
-
],
|
|
119
|
-
"name": "balanceOf",
|
|
120
|
-
"outputs": [
|
|
121
|
-
{
|
|
122
|
-
"internalType": "uint256",
|
|
123
|
-
"name": "",
|
|
124
|
-
"type": "uint256"
|
|
125
|
-
}
|
|
126
|
-
],
|
|
127
|
-
"stateMutability": "view",
|
|
128
|
-
"type": "function"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
"inputs": [
|
|
132
|
-
{
|
|
133
|
-
"internalType": "uint256",
|
|
134
|
-
"name": "tokenId",
|
|
135
|
-
"type": "uint256"
|
|
136
|
-
}
|
|
137
|
-
],
|
|
138
|
-
"name": "getApproved",
|
|
139
|
-
"outputs": [
|
|
140
|
-
{
|
|
141
|
-
"internalType": "address",
|
|
142
|
-
"name": "",
|
|
143
|
-
"type": "address"
|
|
144
|
-
}
|
|
145
|
-
],
|
|
146
|
-
"stateMutability": "view",
|
|
147
|
-
"type": "function"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
"inputs": [
|
|
151
|
-
{
|
|
152
|
-
"internalType": "address",
|
|
153
|
-
"name": "owner",
|
|
154
|
-
"type": "address"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"internalType": "address",
|
|
158
|
-
"name": "operator",
|
|
159
|
-
"type": "address"
|
|
160
|
-
}
|
|
161
|
-
],
|
|
162
|
-
"name": "isApprovedForAll",
|
|
163
|
-
"outputs": [
|
|
164
|
-
{
|
|
165
|
-
"internalType": "bool",
|
|
166
|
-
"name": "",
|
|
167
|
-
"type": "bool"
|
|
168
|
-
}
|
|
169
|
-
],
|
|
170
|
-
"stateMutability": "view",
|
|
171
|
-
"type": "function"
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
"inputs": [],
|
|
175
|
-
"name": "name",
|
|
176
|
-
"outputs": [
|
|
177
|
-
{
|
|
178
|
-
"internalType": "string",
|
|
179
|
-
"name": "",
|
|
180
|
-
"type": "string"
|
|
181
|
-
}
|
|
182
|
-
],
|
|
183
|
-
"stateMutability": "view",
|
|
184
|
-
"type": "function"
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
"inputs": [
|
|
188
|
-
{
|
|
189
|
-
"internalType": "uint256",
|
|
190
|
-
"name": "tokenId",
|
|
191
|
-
"type": "uint256"
|
|
192
|
-
}
|
|
193
|
-
],
|
|
194
|
-
"name": "ownerOf",
|
|
195
|
-
"outputs": [
|
|
196
|
-
{
|
|
197
|
-
"internalType": "address",
|
|
198
|
-
"name": "",
|
|
199
|
-
"type": "address"
|
|
200
|
-
}
|
|
201
|
-
],
|
|
202
|
-
"stateMutability": "view",
|
|
203
|
-
"type": "function"
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
"inputs": [
|
|
207
|
-
{
|
|
208
|
-
"internalType": "address",
|
|
209
|
-
"name": "from",
|
|
210
|
-
"type": "address"
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
"internalType": "address",
|
|
214
|
-
"name": "to",
|
|
215
|
-
"type": "address"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"internalType": "uint256",
|
|
219
|
-
"name": "tokenId",
|
|
220
|
-
"type": "uint256"
|
|
221
|
-
}
|
|
222
|
-
],
|
|
223
|
-
"name": "safeTransferFrom",
|
|
224
|
-
"outputs": [],
|
|
225
|
-
"stateMutability": "nonpayable",
|
|
226
|
-
"type": "function"
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
"inputs": [
|
|
230
|
-
{
|
|
231
|
-
"internalType": "address",
|
|
232
|
-
"name": "operator",
|
|
233
|
-
"type": "address"
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
"internalType": "bool",
|
|
237
|
-
"name": "approved",
|
|
238
|
-
"type": "bool"
|
|
239
|
-
}
|
|
240
|
-
],
|
|
241
|
-
"name": "setApprovalForAll",
|
|
242
|
-
"outputs": [],
|
|
243
|
-
"stateMutability": "nonpayable",
|
|
244
|
-
"type": "function"
|
|
245
|
-
},
|
|
246
|
-
{
|
|
247
|
-
"inputs": [
|
|
248
|
-
{
|
|
249
|
-
"internalType": "bytes4",
|
|
250
|
-
"name": "interfaceId",
|
|
251
|
-
"type": "bytes4"
|
|
252
|
-
}
|
|
253
|
-
],
|
|
254
|
-
"name": "supportsInterface",
|
|
255
|
-
"outputs": [
|
|
256
|
-
{
|
|
257
|
-
"internalType": "bool",
|
|
258
|
-
"name": "",
|
|
259
|
-
"type": "bool"
|
|
260
|
-
}
|
|
261
|
-
],
|
|
262
|
-
"stateMutability": "view",
|
|
263
|
-
"type": "function"
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
"inputs": [],
|
|
267
|
-
"name": "symbol",
|
|
268
|
-
"outputs": [
|
|
269
|
-
{
|
|
270
|
-
"internalType": "string",
|
|
271
|
-
"name": "",
|
|
272
|
-
"type": "string"
|
|
273
|
-
}
|
|
274
|
-
],
|
|
275
|
-
"stateMutability": "view",
|
|
276
|
-
"type": "function"
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
"inputs": [
|
|
280
|
-
{
|
|
281
|
-
"internalType": "uint256",
|
|
282
|
-
"name": "tokenId",
|
|
283
|
-
"type": "uint256"
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
"name": "tokenURI",
|
|
287
|
-
"outputs": [
|
|
288
|
-
{
|
|
289
|
-
"internalType": "string",
|
|
290
|
-
"name": "",
|
|
291
|
-
"type": "string"
|
|
292
|
-
}
|
|
293
|
-
],
|
|
294
|
-
"stateMutability": "view",
|
|
295
|
-
"type": "function"
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
"inputs": [
|
|
299
|
-
{
|
|
300
|
-
"internalType": "address",
|
|
301
|
-
"name": "from",
|
|
302
|
-
"type": "address"
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
"internalType": "address",
|
|
306
|
-
"name": "to",
|
|
307
|
-
"type": "address"
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
"internalType": "uint256",
|
|
311
|
-
"name": "tokenId",
|
|
312
|
-
"type": "uint256"
|
|
313
|
-
}
|
|
314
|
-
],
|
|
315
|
-
"name": "transferFrom",
|
|
316
|
-
"outputs": [],
|
|
317
|
-
"stateMutability": "nonpayable",
|
|
318
|
-
"type": "function"
|
|
319
|
-
}
|
|
320
|
-
]
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { SmartWalletSDK } from "./SmartWalletSDK";
|
|
4
|
-
|
|
5
|
-
vi.mock("./services/logging");
|
|
6
|
-
|
|
7
|
-
// Mock global window object
|
|
8
|
-
vi.stubGlobal("window", {
|
|
9
|
-
location: {
|
|
10
|
-
origin: "http://localhost",
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe("SmartWalletSDK", () => {
|
|
15
|
-
let sdk: SmartWalletSDK;
|
|
16
|
-
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
// Reset mocks before each test
|
|
19
|
-
vi.clearAllMocks();
|
|
20
|
-
sdk = SmartWalletSDK.init({
|
|
21
|
-
clientApiKey:
|
|
22
|
-
"sk_staging_A4vDwAp4t5az6fVQMpQK6qapBnAqgpxrrD35TaFQnyKgxehNbd959uZeaHjNCadWDXrgLRAK1CxeasZjtYEq4TbFkKMBBvbQ9oinAxQf8LbHsSYW2DMzT8fBko3YGLq9t7ZiXZjmgkTioxGVUUjyLtWLeBKwNUDLgpshWjaoR7pKRnSE9SqhwjQbiK62VKiBTdA3KvHsyG9k8mLMcKrDyfXp",
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe("init", () => {
|
|
27
|
-
it("should initialize the SDK correctly", () => {
|
|
28
|
-
expect(sdk).toBeInstanceOf(SmartWalletSDK);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
package/src/SmartWalletSDK.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { stringify } from "viem";
|
|
2
|
-
|
|
3
|
-
import { type APIKeyEnvironmentPrefix, validateAPIKey } from "@crossmint/common-sdk-base";
|
|
4
|
-
|
|
5
|
-
import { CrossmintWalletService } from "./api/CrossmintWalletService";
|
|
6
|
-
import { type SmartWalletChain, isMainnetChain, isTestnetChain } from "./blockchain/chains";
|
|
7
|
-
import type { EVMSmartWallet } from "./blockchain/wallets";
|
|
8
|
-
import { AccountConfigCache } from "./blockchain/wallets/account/cache";
|
|
9
|
-
import { AccountConfigService } from "./blockchain/wallets/account/config";
|
|
10
|
-
import { AccountCreator } from "./blockchain/wallets/account/creator";
|
|
11
|
-
import { EOACreationStrategy } from "./blockchain/wallets/account/eoa";
|
|
12
|
-
import { PasskeyCreationStrategy } from "./blockchain/wallets/account/passkey";
|
|
13
|
-
import { ClientDecorator } from "./blockchain/wallets/clientDecorator";
|
|
14
|
-
import { SmartWalletService } from "./blockchain/wallets/service";
|
|
15
|
-
import { SmartWalletError } from "./error";
|
|
16
|
-
import { ErrorProcessor } from "./error/processor";
|
|
17
|
-
import { scwDatadogLogger, scwLogger } from "./services";
|
|
18
|
-
import type { SmartWalletSDKInitParams, UserParams, WalletParams } from "./types/params";
|
|
19
|
-
import { SDK_VERSION } from "./utils/constants";
|
|
20
|
-
import { isClient } from "./utils/environment";
|
|
21
|
-
|
|
22
|
-
export class SmartWalletSDK {
|
|
23
|
-
private constructor(
|
|
24
|
-
private readonly crossmintEnv: APIKeyEnvironmentPrefix,
|
|
25
|
-
private readonly smartWalletService: SmartWalletService,
|
|
26
|
-
private readonly errorProcessor: ErrorProcessor,
|
|
27
|
-
private readonly logger = scwLogger
|
|
28
|
-
) {}
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Initializes the SDK with the **client side** API key obtained from the Crossmint console.
|
|
32
|
-
* @throws error if the api key is not formatted correctly.
|
|
33
|
-
*/
|
|
34
|
-
static init({ clientApiKey }: SmartWalletSDKInitParams): SmartWalletSDK {
|
|
35
|
-
const validationResult = validateAPIKey(clientApiKey);
|
|
36
|
-
if (!validationResult.isValid) {
|
|
37
|
-
throw new Error("API key invalid");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const crossmintService = new CrossmintWalletService(clientApiKey);
|
|
41
|
-
const errorProcessor = new ErrorProcessor(scwDatadogLogger);
|
|
42
|
-
const accountCreator = new AccountCreator(
|
|
43
|
-
new EOACreationStrategy(),
|
|
44
|
-
new PasskeyCreationStrategy(crossmintService.getPasskeyServerUrl(), clientApiKey)
|
|
45
|
-
);
|
|
46
|
-
const accountCache = new AccountConfigCache(`smart-wallet-${SDK_VERSION}`);
|
|
47
|
-
|
|
48
|
-
const smartWalletService = new SmartWalletService(
|
|
49
|
-
crossmintService,
|
|
50
|
-
new AccountConfigService(crossmintService, accountCache),
|
|
51
|
-
accountCreator,
|
|
52
|
-
new ClientDecorator(errorProcessor)
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
return new SmartWalletSDK(validationResult.environment, smartWalletService, errorProcessor);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Retrieves or creates a wallet for the specified user.
|
|
60
|
-
* The default configuration is a `PasskeySigner` with the name, which is displayed to the user during creation or signing prompts, derived from the provided jwt.
|
|
61
|
-
*
|
|
62
|
-
* Example using the default passkey signer:
|
|
63
|
-
* ```ts
|
|
64
|
-
* const wallet = await smartWalletSDK.getOrCreateWallet({ jwt: "xxx" }, "base");
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
async getOrCreateWallet(
|
|
68
|
-
user: UserParams,
|
|
69
|
-
chain: SmartWalletChain,
|
|
70
|
-
walletParams: WalletParams = { signer: { type: "PASSKEY" } }
|
|
71
|
-
): Promise<EVMSmartWallet> {
|
|
72
|
-
if (!isClient()) {
|
|
73
|
-
throw new SmartWalletError("Smart Wallet SDK should only be used client side.");
|
|
74
|
-
}
|
|
75
|
-
this.assertValidChain(chain);
|
|
76
|
-
|
|
77
|
-
return await this.logger.logPerformance("GET_OR_CREATE_WALLET", async () => {
|
|
78
|
-
try {
|
|
79
|
-
return await this.smartWalletService.getOrCreate(user, chain, walletParams);
|
|
80
|
-
} catch (error: any) {
|
|
81
|
-
throw this.errorProcessor.map(
|
|
82
|
-
error,
|
|
83
|
-
new SmartWalletError(`Wallet creation failed: ${error.message}.`, stringify(error))
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private assertValidChain(chain: SmartWalletChain) {
|
|
90
|
-
if (!this.validChain(chain)) {
|
|
91
|
-
throw new SmartWalletError(
|
|
92
|
-
`The selected chain "${chain}" 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.`
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
private validChain(chain: SmartWalletChain): boolean {
|
|
98
|
-
if (this.crossmintEnv === "development" || this.crossmintEnv === "staging") {
|
|
99
|
-
return isTestnetChain(chain);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return isMainnetChain(chain);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
-
|
|
3
|
-
import { CROSSMINT_STG_URL } from "@crossmint/common-sdk-base";
|
|
4
|
-
|
|
5
|
-
import { CrossmintWalletService } from "./CrossmintWalletService";
|
|
6
|
-
|
|
7
|
-
vi.mock("../services/logging", () => ({
|
|
8
|
-
logError: vi.fn(),
|
|
9
|
-
logInfo: vi.fn(),
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
vi.mock("../utils/helpers", () => ({
|
|
13
|
-
isLocalhost: vi.fn().mockReturnValue(true),
|
|
14
|
-
}));
|
|
15
|
-
|
|
16
|
-
describe("CrossmintService", () => {
|
|
17
|
-
let crossmintService: CrossmintWalletService;
|
|
18
|
-
const apiKey =
|
|
19
|
-
"sk_staging_A4vDwAp4t5az6fVQMpQK6qapBnAqgpxrrD35TaFQnyKgxehNbd959uZeaHjNCadWDXrgLRAK1CxeasZjtYEq4TbFkKMBBvbQ9oinAxQf8LbHsSYW2DMzT8fBko3YGLq9t7ZiXZjmgkTioxGVUUjyLtWLeBKwNUDLgpshWjaoR7pKRnSE9SqhwjQbiK62VKiBTdA3KvHsyG9k8mLMcKrDyfXp";
|
|
20
|
-
|
|
21
|
-
beforeEach(() => {
|
|
22
|
-
crossmintService = new CrossmintWalletService(apiKey);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe("constructor", () => {
|
|
26
|
-
it("should initialize with correct headers and base URL", () => {
|
|
27
|
-
expect(crossmintService).toBeDefined();
|
|
28
|
-
|
|
29
|
-
expect(crossmintService["crossmintAPIHeaders"]).toEqual({
|
|
30
|
-
accept: "application/json",
|
|
31
|
-
"content-type": "application/json",
|
|
32
|
-
"x-api-key": apiKey,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
// Check if the base URL is correctly set to the staging URL
|
|
36
|
-
expect(crossmintService["crossmintBaseUrl"]).toBe(CROSSMINT_STG_URL);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
afterEach(() => {
|
|
41
|
-
vi.clearAllMocks();
|
|
42
|
-
});
|
|
43
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { UserOperation } from "permissionless";
|
|
2
|
-
import type { EntryPoint, GetEntryPointVersion } from "permissionless/types/entrypoint";
|
|
3
|
-
|
|
4
|
-
import { APIErrorService, BaseCrossmintService, CrossmintServiceError } from "@crossmint/client-sdk-base";
|
|
5
|
-
import { blockchainToChainId } from "@crossmint/common-sdk-base";
|
|
6
|
-
|
|
7
|
-
import type { SmartWalletChain } from "../blockchain/chains";
|
|
8
|
-
import { AdminAlreadyUsedError, SmartWalletsNotEnabledError, UserWalletAlreadyCreatedError } from "../error";
|
|
9
|
-
import { scwLogger } from "../services";
|
|
10
|
-
import type { UserParams } from "../types/params";
|
|
11
|
-
import { SmartWalletConfigSchema } from "../types/schema";
|
|
12
|
-
import type { SmartWalletConfig, StoreSmartWalletParams } from "../types/service";
|
|
13
|
-
import { bigintsToHex, parseBigintAPIResponse } from "../utils/api";
|
|
14
|
-
import { API_VERSION } from "../utils/constants";
|
|
15
|
-
|
|
16
|
-
type WalletsAPIErrorCodes =
|
|
17
|
-
| "ERROR_USER_WALLET_ALREADY_CREATED"
|
|
18
|
-
| "ERROR_ADMIN_SIGNER_ALREADY_USED"
|
|
19
|
-
| "ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED";
|
|
20
|
-
|
|
21
|
-
export class CrossmintWalletService extends BaseCrossmintService {
|
|
22
|
-
logger = scwLogger;
|
|
23
|
-
protected apiErrorService = new APIErrorService<WalletsAPIErrorCodes>({
|
|
24
|
-
ERROR_USER_WALLET_ALREADY_CREATED: ({ userId }: { userId: string }) =>
|
|
25
|
-
new UserWalletAlreadyCreatedError(userId),
|
|
26
|
-
ERROR_ADMIN_SIGNER_ALREADY_USED: () => new AdminAlreadyUsedError(),
|
|
27
|
-
ERROR_PROJECT_NONCUSTODIAL_WALLETS_NOT_ENABLED: () => new SmartWalletsNotEnabledError(),
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
async idempotentCreateSmartWallet(user: UserParams, input: StoreSmartWalletParams): Promise<void> {
|
|
31
|
-
await this.fetchCrossmintAPI(
|
|
32
|
-
`${API_VERSION}/sdk/smart-wallet`,
|
|
33
|
-
{ method: "PUT", body: JSON.stringify(input) },
|
|
34
|
-
"Error creating abstract wallet. Please contact support",
|
|
35
|
-
user.jwt
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async sponsorUserOperation<E extends EntryPoint>(
|
|
40
|
-
user: UserParams,
|
|
41
|
-
userOp: UserOperation<GetEntryPointVersion<E>>,
|
|
42
|
-
entryPoint: E,
|
|
43
|
-
chain: SmartWalletChain
|
|
44
|
-
): Promise<{ sponsorUserOpParams: UserOperation<GetEntryPointVersion<E>> }> {
|
|
45
|
-
const chainId = blockchainToChainId(chain);
|
|
46
|
-
const result = await this.fetchCrossmintAPI(
|
|
47
|
-
`${API_VERSION}/sdk/paymaster`,
|
|
48
|
-
{ method: "POST", body: JSON.stringify({ userOp: bigintsToHex(userOp), entryPoint, chainId }) },
|
|
49
|
-
"Error sponsoring user operation. Please contact support",
|
|
50
|
-
user.jwt
|
|
51
|
-
);
|
|
52
|
-
return parseBigintAPIResponse(result);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async getSmartWalletConfig(user: UserParams, chain: SmartWalletChain): Promise<SmartWalletConfig> {
|
|
56
|
-
const data: unknown = await this.fetchCrossmintAPI(
|
|
57
|
-
`${API_VERSION}/sdk/smart-wallet/config?chain=${chain}`,
|
|
58
|
-
{ method: "GET" },
|
|
59
|
-
"Error getting smart wallet version configuration. Please contact support",
|
|
60
|
-
user.jwt
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const result = SmartWalletConfigSchema.safeParse(data);
|
|
64
|
-
if (!result.success) {
|
|
65
|
-
throw new CrossmintServiceError(
|
|
66
|
-
`Invalid smart wallet config, please contact support. Details below:\n${result.error.toString()}`
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return result.data;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
async fetchNFTs(address: string, chain: SmartWalletChain) {
|
|
74
|
-
return this.fetchCrossmintAPI(
|
|
75
|
-
`v1-alpha1/wallets/${chain}:${address}/nfts`,
|
|
76
|
-
{ method: "GET" },
|
|
77
|
-
`Error fetching NFTs for wallet: ${address}`
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public getPasskeyServerUrl(): string {
|
|
82
|
-
return this.crossmintBaseUrl + "api/internal/passkeys";
|
|
83
|
-
}
|
|
84
|
-
}
|
package/src/blockchain/chains.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type Chain,
|
|
3
|
-
arbitrum,
|
|
4
|
-
arbitrumSepolia,
|
|
5
|
-
base,
|
|
6
|
-
baseSepolia,
|
|
7
|
-
optimism,
|
|
8
|
-
optimismSepolia,
|
|
9
|
-
polygon,
|
|
10
|
-
polygonAmoy,
|
|
11
|
-
} from "viem/chains";
|
|
12
|
-
|
|
13
|
-
import { BlockchainIncludingTestnet as Blockchain, type ObjectValues, objectValues } from "@crossmint/common-sdk-base";
|
|
14
|
-
|
|
15
|
-
export const SmartWalletTestnet = {
|
|
16
|
-
BASE_SEPOLIA: Blockchain.BASE_SEPOLIA,
|
|
17
|
-
POLYGON_AMOY: Blockchain.POLYGON_AMOY,
|
|
18
|
-
OPTIMISM_SEPOLIA: Blockchain.OPTIMISM_SEPOLIA,
|
|
19
|
-
ARBITRUM_SEPOLIA: Blockchain.ARBITRUM_SEPOLIA,
|
|
20
|
-
} as const;
|
|
21
|
-
export type SmartWalletTestnet = ObjectValues<typeof SmartWalletTestnet>;
|
|
22
|
-
export const SMART_WALLET_TESTNETS = objectValues(SmartWalletTestnet);
|
|
23
|
-
|
|
24
|
-
export const SmartWalletMainnet = {
|
|
25
|
-
BASE: Blockchain.BASE,
|
|
26
|
-
POLYGON: Blockchain.POLYGON,
|
|
27
|
-
OPTIMISM: Blockchain.OPTIMISM,
|
|
28
|
-
ARBITRUM: Blockchain.ARBITRUM,
|
|
29
|
-
} as const;
|
|
30
|
-
export type SmartWalletMainnet = ObjectValues<typeof SmartWalletMainnet>;
|
|
31
|
-
export const SMART_WALLET_MAINNETS = objectValues(SmartWalletMainnet);
|
|
32
|
-
|
|
33
|
-
export const SmartWalletChain = {
|
|
34
|
-
...SmartWalletTestnet,
|
|
35
|
-
...SmartWalletMainnet,
|
|
36
|
-
} as const;
|
|
37
|
-
export type SmartWalletChain = ObjectValues<typeof SmartWalletChain>;
|
|
38
|
-
export const SMART_WALLET_CHAINS = objectValues(SmartWalletChain);
|
|
39
|
-
|
|
40
|
-
export function isTestnetChain(chain: SmartWalletChain): chain is SmartWalletTestnet {
|
|
41
|
-
return (SMART_WALLET_TESTNETS as any).includes(chain);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function isMainnetChain(chain: SmartWalletChain): chain is SmartWalletMainnet {
|
|
45
|
-
return (SMART_WALLET_MAINNETS as any).includes(chain);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const viemNetworks: Record<SmartWalletChain, Chain> = {
|
|
49
|
-
polygon: polygon,
|
|
50
|
-
"polygon-amoy": polygonAmoy,
|
|
51
|
-
base: base,
|
|
52
|
-
"base-sepolia": baseSepolia,
|
|
53
|
-
optimism: optimism,
|
|
54
|
-
"optimism-sepolia": optimismSepolia,
|
|
55
|
-
arbitrum: arbitrum,
|
|
56
|
-
"arbitrum-sepolia": arbitrumSepolia,
|
|
57
|
-
};
|
package/src/blockchain/rpc.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { blockchainToChainId } from "@crossmint/common-sdk-base";
|
|
2
|
-
|
|
3
|
-
import type { SmartWalletChain } from "./chains";
|
|
4
|
-
|
|
5
|
-
const ALCHEMY_API_KEY = "-7M6vRDBDknwvMxnqah_jbcieWg0qad9";
|
|
6
|
-
const PIMLICO_API_KEY = "pim_9dKmQPxiTCvtbUNF7XFBbA";
|
|
7
|
-
|
|
8
|
-
export const ALCHEMY_RPC_SUBDOMAIN: Record<SmartWalletChain, string> = {
|
|
9
|
-
polygon: "polygon-mainnet",
|
|
10
|
-
"polygon-amoy": "polygon-amoy",
|
|
11
|
-
base: "base-mainnet",
|
|
12
|
-
"base-sepolia": "base-sepolia",
|
|
13
|
-
optimism: "opt-mainnet",
|
|
14
|
-
"optimism-sepolia": "opt-sepolia",
|
|
15
|
-
arbitrum: "arb-mainnet",
|
|
16
|
-
"arbitrum-sepolia": "arb-sepolia",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export function getAlchemyRPC(chain: SmartWalletChain): string {
|
|
20
|
-
return `https://${ALCHEMY_RPC_SUBDOMAIN[chain]}.g.alchemy.com/v2/${ALCHEMY_API_KEY}`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function getPimlicoBundlerRPC(chain: SmartWalletChain): string {
|
|
24
|
-
return `https://api.pimlico.io/v2/${blockchainToChainId(chain)}/rpc?apikey=${PIMLICO_API_KEY}`;
|
|
25
|
-
}
|