@crossmint/client-sdk-smart-wallet 0.1.21 → 0.1.23
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 +34 -1
- package/dist/SmartWalletSDK.cjs.map +1 -0
- package/dist/SmartWalletSDK.js +34 -1
- package/dist/SmartWalletSDK.js.map +1 -0
- package/dist/api/CrossmintWalletService.cjs +13 -1
- package/dist/api/CrossmintWalletService.cjs.map +1 -0
- package/dist/api/CrossmintWalletService.js +13 -1
- package/dist/api/CrossmintWalletService.js.map +1 -0
- package/dist/blockchain/chains.cjs +23 -1
- package/dist/blockchain/chains.cjs.map +1 -0
- package/dist/blockchain/chains.js +23 -1
- package/dist/blockchain/chains.js.map +1 -0
- package/dist/blockchain/rpc.cjs +11 -1
- package/dist/blockchain/rpc.cjs.map +1 -0
- package/dist/blockchain/rpc.js +11 -1
- package/dist/blockchain/rpc.js.map +1 -0
- package/dist/blockchain/transfer.cjs +7 -1
- package/dist/blockchain/transfer.cjs.map +1 -0
- package/dist/blockchain/transfer.js +7 -1
- package/dist/blockchain/transfer.js.map +1 -0
- package/dist/blockchain/wallets/EVMSmartWallet.cjs +10 -1
- package/dist/blockchain/wallets/EVMSmartWallet.cjs.map +1 -0
- package/dist/blockchain/wallets/EVMSmartWallet.js +10 -1
- package/dist/blockchain/wallets/EVMSmartWallet.js.map +1 -0
- package/dist/blockchain/wallets/SendTransactionService.cjs +11 -1
- package/dist/blockchain/wallets/SendTransactionService.cjs.map +1 -0
- package/dist/blockchain/wallets/SendTransactionService.js +11 -1
- package/dist/blockchain/wallets/SendTransactionService.js.map +1 -0
- package/dist/blockchain/wallets/account/cache.cjs +9 -1
- package/dist/blockchain/wallets/account/cache.cjs.map +1 -0
- package/dist/blockchain/wallets/account/cache.js +9 -1
- package/dist/blockchain/wallets/account/cache.js.map +1 -0
- package/dist/blockchain/wallets/account/config.cjs +9 -1
- package/dist/blockchain/wallets/account/config.cjs.map +1 -0
- package/dist/blockchain/wallets/account/config.js +9 -1
- package/dist/blockchain/wallets/account/config.js.map +1 -0
- package/dist/blockchain/wallets/account/creator.cjs +10 -1
- package/dist/blockchain/wallets/account/creator.cjs.map +1 -0
- package/dist/blockchain/wallets/account/creator.js +10 -1
- package/dist/blockchain/wallets/account/creator.js.map +1 -0
- package/dist/blockchain/wallets/account/eoa.cjs +11 -1
- package/dist/blockchain/wallets/account/eoa.cjs.map +1 -0
- package/dist/blockchain/wallets/account/eoa.js +11 -1
- package/dist/blockchain/wallets/account/eoa.js.map +1 -0
- package/dist/blockchain/wallets/account/passkey.cjs +9 -1
- package/dist/blockchain/wallets/account/passkey.cjs.map +1 -0
- package/dist/blockchain/wallets/account/passkey.js +9 -1
- package/dist/blockchain/wallets/account/passkey.js.map +1 -0
- package/dist/blockchain/wallets/account/signer.cjs +9 -1
- package/dist/blockchain/wallets/account/signer.cjs.map +1 -0
- package/dist/blockchain/wallets/account/signer.js +9 -1
- package/dist/blockchain/wallets/account/signer.js.map +1 -0
- package/dist/blockchain/wallets/account/strategy.cjs +1 -1
- package/dist/blockchain/wallets/account/strategy.cjs.map +1 -0
- package/dist/blockchain/wallets/account/strategy.js +1 -0
- package/dist/blockchain/wallets/account/strategy.js.map +1 -0
- package/dist/blockchain/wallets/clientDecorator.cjs +12 -1
- package/dist/blockchain/wallets/clientDecorator.cjs.map +1 -0
- package/dist/blockchain/wallets/clientDecorator.js +12 -1
- package/dist/blockchain/wallets/clientDecorator.js.map +1 -0
- package/dist/blockchain/wallets/index.cjs +10 -1
- package/dist/blockchain/wallets/index.cjs.map +1 -0
- package/dist/blockchain/wallets/index.js +10 -1
- package/dist/blockchain/wallets/index.js.map +1 -0
- package/dist/blockchain/wallets/paymaster.cjs +10 -1
- package/dist/blockchain/wallets/paymaster.cjs.map +1 -0
- package/dist/blockchain/wallets/paymaster.js +10 -1
- package/dist/blockchain/wallets/paymaster.js.map +1 -0
- package/dist/blockchain/wallets/service.cjs +16 -1
- package/dist/blockchain/wallets/service.cjs.map +1 -0
- package/dist/blockchain/wallets/service.js +16 -1
- package/dist/blockchain/wallets/service.js.map +1 -0
- package/dist/chunk-2HB65Y7D.js +79 -0
- package/dist/chunk-2HB65Y7D.js.map +1 -0
- package/dist/chunk-3EQHAQXO.js +112 -0
- package/dist/chunk-3EQHAQXO.js.map +1 -0
- package/dist/chunk-3R6PW6HY.js +30 -0
- package/dist/chunk-3R6PW6HY.js.map +1 -0
- package/dist/{chunk-XJGFG3RT.cjs → chunk-5MG5CIEX.cjs} +13 -1
- package/dist/chunk-5MG5CIEX.cjs.map +1 -0
- package/dist/chunk-5URMCCO6.js +9 -0
- package/dist/chunk-5URMCCO6.js.map +1 -0
- package/dist/chunk-5VHMVO22.js +39 -0
- package/dist/chunk-5VHMVO22.js.map +1 -0
- package/dist/chunk-5W4NYW72.js +44 -0
- package/dist/chunk-5W4NYW72.js.map +1 -0
- package/dist/chunk-5WVQ7J3E.cjs +369 -0
- package/dist/chunk-5WVQ7J3E.cjs.map +1 -0
- package/dist/chunk-6NJVFL2X.js +60 -0
- package/dist/chunk-6NJVFL2X.js.map +1 -0
- package/dist/chunk-77GT6B5L.cjs +79 -0
- package/dist/chunk-77GT6B5L.cjs.map +1 -0
- package/dist/chunk-7AT3QDQV.js +36 -0
- package/dist/chunk-7AT3QDQV.js.map +1 -0
- package/dist/chunk-7B2CZEJG.cjs +66 -0
- package/dist/chunk-7B2CZEJG.cjs.map +1 -0
- package/dist/chunk-7G2SBZTE.js +93 -0
- package/dist/chunk-7G2SBZTE.js.map +1 -0
- package/dist/chunk-7KTQNIAZ.cjs +112 -0
- package/dist/chunk-7KTQNIAZ.cjs.map +1 -0
- package/dist/chunk-ASIPMVRQ.js +90 -0
- package/dist/chunk-ASIPMVRQ.js.map +1 -0
- package/dist/chunk-BARW756O.js +27 -0
- package/dist/chunk-BARW756O.js.map +1 -0
- package/dist/chunk-BSFIJZ5X.js +41 -0
- package/dist/chunk-BSFIJZ5X.js.map +1 -0
- package/dist/chunk-BXSAJOIV.cjs +90 -0
- package/dist/chunk-BXSAJOIV.cjs.map +1 -0
- package/dist/chunk-C5ZRYSCP.cjs +14 -0
- package/dist/chunk-C5ZRYSCP.cjs.map +1 -0
- package/dist/chunk-DTEA33DF.cjs +59 -0
- package/dist/chunk-DTEA33DF.cjs.map +1 -0
- package/dist/chunk-DYO4HODM.cjs +36 -0
- package/dist/chunk-DYO4HODM.cjs.map +1 -0
- package/dist/chunk-EPEGJY6N.cjs +9 -0
- package/dist/chunk-EPEGJY6N.cjs.map +1 -0
- package/dist/chunk-EQSMHR77.js +30 -0
- package/dist/chunk-EQSMHR77.js.map +1 -0
- package/dist/chunk-EUQLY4SC.cjs +82 -0
- package/dist/chunk-EUQLY4SC.cjs.map +1 -0
- package/dist/chunk-FSIMJYXR.js +36 -0
- package/dist/chunk-FSIMJYXR.js.map +1 -0
- package/dist/chunk-FXGOVLZW.cjs +9 -0
- package/dist/chunk-FXGOVLZW.cjs.map +1 -0
- package/dist/chunk-GLHQIT4Q.cjs +36 -0
- package/dist/chunk-GLHQIT4Q.cjs.map +1 -0
- package/dist/chunk-IDNF4BNP.cjs +44 -0
- package/dist/chunk-IDNF4BNP.cjs.map +1 -0
- package/dist/chunk-JOB7STIS.js +9 -0
- package/dist/chunk-JOB7STIS.js.map +1 -0
- package/dist/chunk-KEY2LM72.cjs +93 -0
- package/dist/chunk-KEY2LM72.cjs.map +1 -0
- package/dist/chunk-KHROQTVY.js +1 -0
- package/dist/chunk-KHROQTVY.js.map +1 -0
- package/dist/chunk-MAID7XYG.js +14 -0
- package/dist/chunk-MAID7XYG.js.map +1 -0
- package/dist/chunk-MJZ2DXMN.cjs +123 -0
- package/dist/chunk-MJZ2DXMN.cjs.map +1 -0
- package/dist/chunk-N6DG5EZG.cjs +156 -0
- package/dist/chunk-N6DG5EZG.cjs.map +1 -0
- package/dist/chunk-NXDZHR5C.js +99 -0
- package/dist/chunk-NXDZHR5C.js.map +1 -0
- package/dist/chunk-O6IFYHDP.cjs +36 -0
- package/dist/chunk-O6IFYHDP.cjs.map +1 -0
- package/dist/chunk-OCG67QSU.cjs +41 -0
- package/dist/chunk-OCG67QSU.cjs.map +1 -0
- package/dist/chunk-OGA3YDWS.cjs +112 -0
- package/dist/chunk-OGA3YDWS.cjs.map +1 -0
- package/dist/chunk-ON4DOYVD.js +369 -0
- package/dist/chunk-ON4DOYVD.js.map +1 -0
- package/dist/chunk-OYKL3RNL.js +66 -0
- package/dist/chunk-OYKL3RNL.js.map +1 -0
- package/dist/chunk-PVFA6PBX.cjs +60 -0
- package/dist/chunk-PVFA6PBX.cjs.map +1 -0
- package/dist/chunk-QJ3BSVGV.js +36 -0
- package/dist/chunk-QJ3BSVGV.js.map +1 -0
- package/dist/chunk-RB4JSPZH.cjs +99 -0
- package/dist/chunk-RB4JSPZH.cjs.map +1 -0
- package/dist/chunk-SMDX2MXU.js +13 -0
- package/dist/chunk-SMDX2MXU.js.map +1 -0
- package/dist/chunk-TDJDKTRS.js +156 -0
- package/dist/chunk-TDJDKTRS.js.map +1 -0
- package/dist/chunk-TK3ZLI22.cjs +39 -0
- package/dist/chunk-TK3ZLI22.cjs.map +1 -0
- package/dist/chunk-TUVECZA7.cjs +22 -0
- package/dist/chunk-TUVECZA7.cjs.map +1 -0
- package/dist/chunk-U4OBHCIP.js +59 -0
- package/dist/chunk-U4OBHCIP.js.map +1 -0
- package/dist/chunk-UDDYHPSW.js +22 -0
- package/dist/chunk-UDDYHPSW.js.map +1 -0
- package/dist/chunk-UNP5V2AB.js +82 -0
- package/dist/chunk-UNP5V2AB.js.map +1 -0
- package/dist/chunk-UQKE6R5W.cjs +27 -0
- package/dist/chunk-UQKE6R5W.cjs.map +1 -0
- package/dist/chunk-UZGHOTKZ.js +112 -0
- package/dist/chunk-UZGHOTKZ.js.map +1 -0
- package/dist/chunk-XZTGDSSL.js +123 -0
- package/dist/chunk-XZTGDSSL.js.map +1 -0
- package/dist/chunk-YWCXHOSD.cjs +30 -0
- package/dist/chunk-YWCXHOSD.cjs.map +1 -0
- package/dist/chunk-ZN42AA2G.cjs +1 -0
- package/dist/chunk-ZN42AA2G.cjs.map +1 -0
- package/dist/chunk-ZOXKITU4.cjs +30 -0
- package/dist/chunk-ZOXKITU4.cjs.map +1 -0
- package/dist/error/index.cjs +25 -1
- package/dist/error/index.cjs.map +1 -0
- package/dist/error/index.js +25 -1
- package/dist/error/index.js.map +1 -0
- package/dist/error/processor.cjs +9 -1
- package/dist/error/processor.cjs.map +1 -0
- package/dist/error/processor.js +9 -1
- package/dist/error/processor.js.map +1 -0
- package/dist/index.cjs +86 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +86 -1
- package/dist/index.js.map +1 -0
- package/dist/services/index.cjs +11 -1
- package/dist/services/index.cjs.map +1 -0
- package/dist/services/index.js +11 -1
- package/dist/services/index.js.map +1 -0
- package/dist/services/logger.cjs +10 -1
- package/dist/services/logger.cjs.map +1 -0
- package/dist/services/logger.js +10 -1
- package/dist/services/logger.js.map +1 -0
- package/dist/types/internal.cjs +18 -1
- package/dist/types/internal.cjs.map +1 -0
- package/dist/types/internal.js +18 -1
- package/dist/types/internal.js.map +1 -0
- package/dist/types/params.cjs +1 -1
- package/dist/types/params.cjs.map +1 -0
- package/dist/types/params.js +1 -0
- package/dist/types/params.js.map +1 -0
- package/dist/types/schema.cjs +16 -1
- package/dist/types/schema.cjs.map +1 -0
- package/dist/types/schema.js +16 -1
- package/dist/types/schema.js.map +1 -0
- package/dist/types/service.cjs +1 -1
- package/dist/types/service.cjs.map +1 -0
- package/dist/types/service.js +1 -0
- package/dist/types/service.js.map +1 -0
- package/dist/types/token.cjs +1 -1
- package/dist/types/token.cjs.map +1 -0
- package/dist/types/token.js +1 -0
- package/dist/types/token.js.map +1 -0
- package/dist/utils/api.cjs +9 -1
- package/dist/utils/api.cjs.map +1 -0
- package/dist/utils/api.js +9 -1
- package/dist/utils/api.js.map +1 -0
- package/dist/utils/blockchain.cjs +7 -1
- package/dist/utils/blockchain.cjs.map +1 -0
- package/dist/utils/blockchain.js +7 -1
- package/dist/utils/blockchain.js.map +1 -0
- package/dist/utils/constants.cjs +19 -1
- package/dist/utils/constants.cjs.map +1 -0
- package/dist/utils/constants.js +19 -1
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/environment.cjs +7 -1
- package/dist/utils/environment.cjs.map +1 -0
- package/dist/utils/environment.js +7 -1
- package/dist/utils/environment.js.map +1 -0
- package/dist/utils/helpers.cjs +9 -1
- package/dist/utils/helpers.cjs.map +1 -0
- package/dist/utils/helpers.js +9 -1
- package/dist/utils/helpers.js.map +1 -0
- package/dist/utils/signer.cjs +10 -1
- package/dist/utils/signer.cjs.map +1 -0
- package/dist/utils/signer.js +10 -1
- package/dist/utils/signer.js.map +1 -0
- package/dist/utils/test.cjs +27 -1
- package/dist/utils/test.cjs.map +1 -0
- package/dist/utils/test.js +27 -1
- package/dist/utils/test.js.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-27US7ZBX.js +0 -1
- package/dist/chunk-2GS5TXEY.cjs +0 -1
- package/dist/chunk-2R6HK64N.cjs +0 -1
- package/dist/chunk-3F6P4HUZ.js +0 -1
- package/dist/chunk-4SPA557P.js +0 -0
- package/dist/chunk-5M3MSPHK.cjs +0 -1
- package/dist/chunk-6DE5YEO5.cjs +0 -1
- package/dist/chunk-7AVDZZGD.cjs +0 -1
- package/dist/chunk-7FXFOOQU.cjs +0 -1
- package/dist/chunk-7JAT6GQU.js +0 -1
- package/dist/chunk-ATQ4WGCW.js +0 -1
- package/dist/chunk-B3LJJZXD.cjs +0 -2
- package/dist/chunk-BJZQA5VC.js +0 -1
- package/dist/chunk-BXXREMNR.cjs +0 -1
- package/dist/chunk-C3VZY7VJ.js +0 -1
- package/dist/chunk-CPYNP4XI.js +0 -1
- package/dist/chunk-CUTQYF3F.js +0 -1
- package/dist/chunk-D4NDUT36.js +0 -1
- package/dist/chunk-DIDKPOO2.cjs +0 -1
- package/dist/chunk-ETVJGLNY.js +0 -1
- package/dist/chunk-FHNNZVNU.js +0 -1
- package/dist/chunk-FIJ3CBJ4.js +0 -3
- package/dist/chunk-G57LROTD.js +0 -1
- package/dist/chunk-GB35YMN4.cjs +0 -1
- package/dist/chunk-H4CMXNVK.js +0 -1
- package/dist/chunk-IQTGPM2U.cjs +0 -1
- package/dist/chunk-KYPTGHC6.cjs +0 -1
- package/dist/chunk-LMVY4C4Y.js +0 -1
- package/dist/chunk-M4K3IZTT.cjs +0 -1
- package/dist/chunk-NLGILHJS.js +0 -1
- package/dist/chunk-O2ACORII.cjs +0 -1
- package/dist/chunk-OCJYX5QF.cjs +0 -1
- package/dist/chunk-ODAUWGUU.cjs +0 -1
- package/dist/chunk-PBUJXVQT.js +0 -1
- package/dist/chunk-PLRQBDYS.cjs +0 -1
- package/dist/chunk-PPTSNCSQ.cjs +0 -1
- package/dist/chunk-PZ6Q22YJ.js +0 -1
- package/dist/chunk-Q44P7MO7.cjs +0 -1
- package/dist/chunk-QVB3HE6Q.js +0 -2
- package/dist/chunk-S2XBSAGM.js +0 -1
- package/dist/chunk-SCXFZMLR.cjs +0 -1
- package/dist/chunk-STH2LE35.cjs +0 -1
- package/dist/chunk-SWWOVT47.cjs +0 -1
- package/dist/chunk-TZG6MROQ.js +0 -1
- package/dist/chunk-UG47CBKR.js +0 -1
- package/dist/chunk-UPURFW46.js +0 -1
- package/dist/chunk-WDM7PN4O.js +0 -1
- package/dist/chunk-WJ6XJMRD.cjs +0 -1
- package/dist/chunk-WTPE2I2Q.cjs +0 -1
- package/dist/chunk-XHSA4YTO.cjs +0 -3
- package/dist/chunk-XP6ESWVJ.js +0 -1
- package/dist/chunk-XQ2K2K23.cjs +0 -1
- package/dist/chunk-YBHSEZMB.js +0 -1
- package/dist/chunk-YZQJV2KA.cjs +0 -1
- package/dist/chunk-Z22H3MJS.js +0 -1
|
@@ -1 +1,10 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import {
|
|
2
|
+
paymasterMiddleware,
|
|
3
|
+
usePaymaster
|
|
4
|
+
} from "../../chunk-QJ3BSVGV.js";
|
|
5
|
+
import "../../chunk-JOB7STIS.js";
|
|
6
|
+
export {
|
|
7
|
+
paymasterMiddleware,
|
|
8
|
+
usePaymaster
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=paymaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkRB4JSPZHcjs = require('../../chunk-RB4JSPZH.cjs');
|
|
4
|
+
require('../../chunk-DYO4HODM.cjs');
|
|
5
|
+
require('../../chunk-FXGOVLZW.cjs');
|
|
6
|
+
require('../../chunk-OGA3YDWS.cjs');
|
|
7
|
+
require('../../chunk-7KTQNIAZ.cjs');
|
|
8
|
+
require('../../chunk-PVFA6PBX.cjs');
|
|
9
|
+
require('../../chunk-UQKE6R5W.cjs');
|
|
10
|
+
require('../../chunk-5WVQ7J3E.cjs');
|
|
11
|
+
require('../../chunk-TUVECZA7.cjs');
|
|
12
|
+
require('../../chunk-BXSAJOIV.cjs');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.SmartWalletService = _chunkRB4JSPZHcjs.SmartWalletService;
|
|
16
|
+
//# sourceMappingURL=service.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1 +1,16 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import {
|
|
2
|
+
SmartWalletService
|
|
3
|
+
} from "../../chunk-NXDZHR5C.js";
|
|
4
|
+
import "../../chunk-QJ3BSVGV.js";
|
|
5
|
+
import "../../chunk-JOB7STIS.js";
|
|
6
|
+
import "../../chunk-UZGHOTKZ.js";
|
|
7
|
+
import "../../chunk-3EQHAQXO.js";
|
|
8
|
+
import "../../chunk-6NJVFL2X.js";
|
|
9
|
+
import "../../chunk-BARW756O.js";
|
|
10
|
+
import "../../chunk-ON4DOYVD.js";
|
|
11
|
+
import "../../chunk-UDDYHPSW.js";
|
|
12
|
+
import "../../chunk-ASIPMVRQ.js";
|
|
13
|
+
export {
|
|
14
|
+
SmartWalletService
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EOASignerConfig,
|
|
3
|
+
PasskeySignerConfig
|
|
4
|
+
} from "./chunk-3R6PW6HY.js";
|
|
5
|
+
import {
|
|
6
|
+
SmartWalletError
|
|
7
|
+
} from "./chunk-ASIPMVRQ.js";
|
|
8
|
+
|
|
9
|
+
// src/blockchain/wallets/account/config.ts
|
|
10
|
+
var AccountConfigService = class {
|
|
11
|
+
constructor(crossmintService, configCache) {
|
|
12
|
+
this.crossmintService = crossmintService;
|
|
13
|
+
this.configCache = configCache;
|
|
14
|
+
}
|
|
15
|
+
async get(user, chain) {
|
|
16
|
+
const cached = this.configCache.get(user);
|
|
17
|
+
if (cached != null) {
|
|
18
|
+
return {
|
|
19
|
+
config: this.validateAndFormat(user, cached),
|
|
20
|
+
cached: true
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const config = await this.crossmintService.getSmartWalletConfig(user, chain);
|
|
24
|
+
return { config: this.validateAndFormat(user, config), cached: false };
|
|
25
|
+
}
|
|
26
|
+
cache({
|
|
27
|
+
entryPointVersion,
|
|
28
|
+
kernelVersion,
|
|
29
|
+
user,
|
|
30
|
+
existing
|
|
31
|
+
}) {
|
|
32
|
+
this.configCache.clear();
|
|
33
|
+
this.configCache.set(user, {
|
|
34
|
+
entryPointVersion,
|
|
35
|
+
kernelVersion,
|
|
36
|
+
userId: user.id,
|
|
37
|
+
signers: [{ signerData: existing.signerConfig.data }],
|
|
38
|
+
smartContractWalletAddress: existing.address
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
validateAndFormat(user, { entryPointVersion, kernelVersion, signers, smartContractWalletAddress, userId }) {
|
|
42
|
+
if (entryPointVersion === "v0.7" && kernelVersion.startsWith("0.2") || entryPointVersion === "v0.6" && kernelVersion.startsWith("0.3")) {
|
|
43
|
+
throw new SmartWalletError(
|
|
44
|
+
`Unsupported combination: entryPoint ${entryPointVersion} and kernel version ${kernelVersion}. Please contact support`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
const signerData = signers.map((x) => x.signerData);
|
|
48
|
+
const signer = this.getSigner(signerData);
|
|
49
|
+
if (smartContractWalletAddress != null && signer == null || signer != null && smartContractWalletAddress == null) {
|
|
50
|
+
throw new SmartWalletError("Either both signer and address must be present, or both must be null");
|
|
51
|
+
}
|
|
52
|
+
if (signer == null || smartContractWalletAddress == null) {
|
|
53
|
+
return { entryPointVersion, kernelVersion, userWithId: { ...user, id: userId } };
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
entryPointVersion,
|
|
57
|
+
kernelVersion,
|
|
58
|
+
userWithId: { ...user, id: userId },
|
|
59
|
+
existing: { signerConfig: signer, address: smartContractWalletAddress }
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
getSigner(signers) {
|
|
63
|
+
if (signers.length === 0) {
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
const data = signers[0];
|
|
67
|
+
if (data.type === "eoa") {
|
|
68
|
+
return new EOASignerConfig(data);
|
|
69
|
+
}
|
|
70
|
+
if (data.type === "passkeys") {
|
|
71
|
+
return new PasskeySignerConfig(data);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
AccountConfigService
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=chunk-2HB65Y7D.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/blockchain/wallets/account/config.ts"],"sourcesContent":["import type { CrossmintWalletService } from \"../../../api/CrossmintWalletService\";\nimport type { SmartWalletChain } from \"../../../blockchain/chains\";\nimport { SmartWalletError } from \"../../../error\";\nimport type {\n PreExistingWalletProperties,\n SupportedEntryPointVersion,\n SupportedKernelVersion,\n} from \"../../../types/internal\";\nimport type { UserParams } from \"../../../types/params\";\nimport type { SignerData, SmartWalletConfig } from \"../../../types/service\";\nimport type { AccountConfigCache } from \"./cache\";\nimport { EOASignerConfig, PasskeySignerConfig, type SignerConfig } from \"./signer\";\n\ninterface AccountConfig {\n entryPointVersion: SupportedEntryPointVersion;\n kernelVersion: SupportedKernelVersion;\n userWithId: UserParams & { id: string };\n existing?: PreExistingWalletProperties;\n}\nexport class AccountConfigService {\n constructor(\n private readonly crossmintService: CrossmintWalletService,\n private readonly configCache: AccountConfigCache\n ) {}\n\n public async get(\n user: UserParams,\n chain: SmartWalletChain\n ): Promise<{\n config: AccountConfig;\n cached: boolean;\n }> {\n const cached = this.configCache.get(user);\n if (cached != null) {\n return {\n config: this.validateAndFormat(user, cached),\n cached: true,\n };\n }\n\n const config = await this.crossmintService.getSmartWalletConfig(user, chain);\n return { config: this.validateAndFormat(user, config), cached: false };\n }\n\n public cache({\n entryPointVersion,\n kernelVersion,\n user,\n existing,\n }: {\n entryPointVersion: SupportedEntryPointVersion;\n kernelVersion: SupportedKernelVersion;\n user: UserParams & { id: string };\n existing: PreExistingWalletProperties;\n }) {\n this.configCache.clear();\n this.configCache.set(user, {\n entryPointVersion,\n kernelVersion,\n userId: user.id,\n signers: [{ signerData: existing.signerConfig.data }],\n smartContractWalletAddress: existing.address,\n });\n }\n\n private validateAndFormat(\n user: UserParams,\n { entryPointVersion, kernelVersion, signers, smartContractWalletAddress, userId }: SmartWalletConfig\n ): AccountConfig {\n if (\n (entryPointVersion === \"v0.7\" && kernelVersion.startsWith(\"0.2\")) ||\n (entryPointVersion === \"v0.6\" && kernelVersion.startsWith(\"0.3\"))\n ) {\n throw new SmartWalletError(\n `Unsupported combination: entryPoint ${entryPointVersion} and kernel version ${kernelVersion}. Please contact support`\n );\n }\n\n const signerData = signers.map((x) => x.signerData);\n const signer = this.getSigner(signerData);\n\n if (\n (smartContractWalletAddress != null && signer == null) ||\n (signer != null && smartContractWalletAddress == null)\n ) {\n throw new SmartWalletError(\"Either both signer and address must be present, or both must be null\");\n }\n\n if (signer == null || smartContractWalletAddress == null) {\n return { entryPointVersion, kernelVersion, userWithId: { ...user, id: userId } };\n }\n\n return {\n entryPointVersion,\n kernelVersion,\n userWithId: { ...user, id: userId },\n existing: { signerConfig: signer, address: smartContractWalletAddress },\n };\n }\n\n private getSigner(signers: SignerData[]): SignerConfig | undefined {\n if (signers.length === 0) {\n return undefined;\n }\n\n const data = signers[0];\n\n if (data.type === \"eoa\") {\n return new EOASignerConfig(data);\n }\n\n if (data.type === \"passkeys\") {\n return new PasskeySignerConfig(data);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAmBO,IAAM,uBAAN,MAA2B;AAAA,EAC9B,YACqB,kBACA,aACnB;AAFmB;AACA;AAAA,EAClB;AAAA,EAEH,MAAa,IACT,MACA,OAID;AACC,UAAM,SAAS,KAAK,YAAY,IAAI,IAAI;AACxC,QAAI,UAAU,MAAM;AAChB,aAAO;AAAA,QACH,QAAQ,KAAK,kBAAkB,MAAM,MAAM;AAAA,QAC3C,QAAQ;AAAA,MACZ;AAAA,IACJ;AAEA,UAAM,SAAS,MAAM,KAAK,iBAAiB,qBAAqB,MAAM,KAAK;AAC3E,WAAO,EAAE,QAAQ,KAAK,kBAAkB,MAAM,MAAM,GAAG,QAAQ,MAAM;AAAA,EACzE;AAAA,EAEO,MAAM;AAAA,IACT;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ,GAKG;AACC,SAAK,YAAY,MAAM;AACvB,SAAK,YAAY,IAAI,MAAM;AAAA,MACvB;AAAA,MACA;AAAA,MACA,QAAQ,KAAK;AAAA,MACb,SAAS,CAAC,EAAE,YAAY,SAAS,aAAa,KAAK,CAAC;AAAA,MACpD,4BAA4B,SAAS;AAAA,IACzC,CAAC;AAAA,EACL;AAAA,EAEQ,kBACJ,MACA,EAAE,mBAAmB,eAAe,SAAS,4BAA4B,OAAO,GACnE;AACb,QACK,sBAAsB,UAAU,cAAc,WAAW,KAAK,KAC9D,sBAAsB,UAAU,cAAc,WAAW,KAAK,GACjE;AACE,YAAM,IAAI;AAAA,QACN,uCAAuC,iBAAiB,uBAAuB,aAAa;AAAA,MAChG;AAAA,IACJ;AAEA,UAAM,aAAa,QAAQ,IAAI,CAAC,MAAM,EAAE,UAAU;AAClD,UAAM,SAAS,KAAK,UAAU,UAAU;AAExC,QACK,8BAA8B,QAAQ,UAAU,QAChD,UAAU,QAAQ,8BAA8B,MACnD;AACE,YAAM,IAAI,iBAAiB,sEAAsE;AAAA,IACrG;AAEA,QAAI,UAAU,QAAQ,8BAA8B,MAAM;AACtD,aAAO,EAAE,mBAAmB,eAAe,YAAY,EAAE,GAAG,MAAM,IAAI,OAAO,EAAE;AAAA,IACnF;AAEA,WAAO;AAAA,MACH;AAAA,MACA;AAAA,MACA,YAAY,EAAE,GAAG,MAAM,IAAI,OAAO;AAAA,MAClC,UAAU,EAAE,cAAc,QAAQ,SAAS,2BAA2B;AAAA,IAC1E;AAAA,EACJ;AAAA,EAEQ,UAAU,SAAiD;AAC/D,QAAI,QAAQ,WAAW,GAAG;AACtB,aAAO;AAAA,IACX;AAEA,UAAM,OAAO,QAAQ,CAAC;AAEtB,QAAI,KAAK,SAAS,OAAO;AACrB,aAAO,IAAI,gBAAgB,IAAI;AAAA,IACnC;AAEA,QAAI,KAAK,SAAS,YAAY;AAC1B,aAAO,IAAI,oBAAoB,IAAI;AAAA,IACvC;AAAA,EACJ;AACJ;","names":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// src/blockchain/wallets/SendTransactionService.ts
|
|
2
|
+
import {
|
|
3
|
+
BaseError,
|
|
4
|
+
ContractFunctionRevertedError
|
|
5
|
+
} from "viem";
|
|
6
|
+
import { CrossmintSDKError, WalletErrorCode } from "@crossmint/client-sdk-base";
|
|
7
|
+
var EVMSendTransactionError = class extends CrossmintSDKError {
|
|
8
|
+
constructor(message, viemError, stage, code = WalletErrorCode.SEND_TRANSACTION_FAILED) {
|
|
9
|
+
super(message, code);
|
|
10
|
+
this.viemError = viemError;
|
|
11
|
+
this.stage = stage;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var EVMSendTransactionExecutionRevertedError = class extends EVMSendTransactionError {
|
|
15
|
+
constructor(message, viemError, revertError, txId, stage, data = revertError.data, reason = revertError.reason) {
|
|
16
|
+
super(message, viemError, stage, WalletErrorCode.SEND_TRANSACTION_EXECUTION_REVERTED);
|
|
17
|
+
this.viemError = viemError;
|
|
18
|
+
this.txId = txId;
|
|
19
|
+
this.stage = stage;
|
|
20
|
+
this.data = data;
|
|
21
|
+
this.reason = reason;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
var SendTransactionService = class {
|
|
25
|
+
constructor(client, defaultSendTransactionOptions = {
|
|
26
|
+
confirmations: 2,
|
|
27
|
+
transactionConfirmationTimeout: 3e4
|
|
28
|
+
}) {
|
|
29
|
+
this.client = client;
|
|
30
|
+
this.defaultSendTransactionOptions = defaultSendTransactionOptions;
|
|
31
|
+
}
|
|
32
|
+
async sendTransaction(request, config = {}) {
|
|
33
|
+
const { confirmations, transactionConfirmationTimeout } = this.getConfig(config);
|
|
34
|
+
await this.simulateCall(request, void 0, "simulation");
|
|
35
|
+
let hash;
|
|
36
|
+
try {
|
|
37
|
+
hash = await this.client.wallet.writeContract({
|
|
38
|
+
...request,
|
|
39
|
+
account: this.client.wallet.account,
|
|
40
|
+
chain: this.client.wallet.chain
|
|
41
|
+
});
|
|
42
|
+
} catch (e) {
|
|
43
|
+
if (e instanceof BaseError) {
|
|
44
|
+
throw new EVMSendTransactionError(e.message, e, "send");
|
|
45
|
+
}
|
|
46
|
+
throw e;
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
const receipt = await this.client.public.waitForTransactionReceipt({
|
|
50
|
+
hash,
|
|
51
|
+
confirmations,
|
|
52
|
+
timeout: transactionConfirmationTimeout
|
|
53
|
+
});
|
|
54
|
+
return await this.handleReceipt(receipt, request);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
if (e instanceof BaseError) {
|
|
57
|
+
throw new EVMSendTransactionError(e.message, e, "confirmation");
|
|
58
|
+
}
|
|
59
|
+
throw e;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
getConfig(config) {
|
|
63
|
+
return {
|
|
64
|
+
...this.defaultSendTransactionOptions,
|
|
65
|
+
...config
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
async handleReceipt(receipt, request) {
|
|
69
|
+
if (receipt.status === "reverted") {
|
|
70
|
+
await this.simulateCall(request, receipt.transactionHash, "execution");
|
|
71
|
+
throw new EVMSendTransactionExecutionRevertedError(
|
|
72
|
+
"Transaction reverted but unable to detect the reason",
|
|
73
|
+
new ContractFunctionRevertedError({ abi: request.abi, functionName: request.functionName }),
|
|
74
|
+
new ContractFunctionRevertedError({ abi: request.abi, functionName: request.functionName }),
|
|
75
|
+
receipt.transactionHash,
|
|
76
|
+
"execution"
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
return receipt.transactionHash;
|
|
80
|
+
}
|
|
81
|
+
async simulateCall(request, passthroughTxId, stage) {
|
|
82
|
+
try {
|
|
83
|
+
await this.client.public.simulateContract({
|
|
84
|
+
...request,
|
|
85
|
+
account: this.client.wallet.account.address,
|
|
86
|
+
chain: this.client.public.chain
|
|
87
|
+
});
|
|
88
|
+
} catch (e) {
|
|
89
|
+
if (e instanceof BaseError) {
|
|
90
|
+
const revertError = e.walk((err) => err instanceof ContractFunctionRevertedError);
|
|
91
|
+
if (revertError instanceof ContractFunctionRevertedError) {
|
|
92
|
+
throw new EVMSendTransactionExecutionRevertedError(
|
|
93
|
+
revertError.message,
|
|
94
|
+
e,
|
|
95
|
+
revertError,
|
|
96
|
+
passthroughTxId,
|
|
97
|
+
stage
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
throw new EVMSendTransactionError(e.message, e, stage);
|
|
101
|
+
}
|
|
102
|
+
throw e;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export {
|
|
108
|
+
EVMSendTransactionError,
|
|
109
|
+
EVMSendTransactionExecutionRevertedError,
|
|
110
|
+
SendTransactionService
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=chunk-3EQHAQXO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/blockchain/wallets/SendTransactionService.ts"],"sourcesContent":["import type { SmartAccountClient } from \"permissionless\";\nimport type { EntryPoint } from \"permissionless/_types/types\";\nimport type { SmartAccount } from \"permissionless/accounts\";\nimport {\n type Abi,\n type Address,\n BaseError,\n type Chain,\n ContractFunctionRevertedError,\n type Hex,\n type PublicClient,\n type TransactionReceipt,\n type Transport,\n} from \"viem\";\n\nimport { CrossmintSDKError, WalletErrorCode } from \"@crossmint/client-sdk-base\";\n\nexport type TransactionServiceTransactionRequest = {\n address: Address;\n abi: Abi;\n functionName: string;\n args: any;\n value?: bigint;\n};\n\nexport type SendTransactionFailureStage = \"simulation\" | \"send\" | \"confirmation\" | \"execution\";\n\n/**\n * Error thrown when a transaction fails to send.\n * @param viemError The error thrown by the viem client. See https://viem.sh/docs/glossary/errors.html\n */\nexport class EVMSendTransactionError extends CrossmintSDKError {\n constructor(\n message: string,\n public readonly viemError: BaseError,\n public readonly stage: SendTransactionFailureStage,\n code = WalletErrorCode.SEND_TRANSACTION_FAILED\n ) {\n super(message, code);\n }\n}\n\n/**\n * Error thrown when a transaction fails due to a contract execution error.\n * @param viemError The error thrown by the viem client. See https://viem.sh/docs/glossary/errors.html\n * @param data The name and arguments of the revert error from the provided ABI\n * @param reason The revert error if it is a string and not an ABI error\n * @example\n * try {\n * await wallet.executeContract({\n * address: contractAddress,\n * abi,\n * functionName: \"mintNFT\",\n * args: [recipientAddress],\n * });\n * } catch (e) {\n * if (e instanceof SendTransactionExecutionRevertedError) {\n * alert(`Transaction reverted: ${e.message}`);\n * }\n * throw e;\n * }\n */\nexport class EVMSendTransactionExecutionRevertedError extends EVMSendTransactionError {\n constructor(\n message: string,\n public readonly viemError: BaseError,\n revertError: ContractFunctionRevertedError,\n public readonly txId: string | undefined,\n public readonly stage: SendTransactionFailureStage,\n public readonly data = revertError.data,\n public readonly reason = revertError.reason\n ) {\n super(message, viemError, stage, WalletErrorCode.SEND_TRANSACTION_EXECUTION_REVERTED);\n }\n}\n\nexport interface SendTransactionOptions {\n /**\n * The number of confirmations to wait for before yielding the transaction hash.\n */\n confirmations: number;\n /**\n * The timeout in milliseconds to wait for a transaction to confirm before throwing an error.\n */\n transactionConfirmationTimeout: number;\n}\n\nexport class SendTransactionService {\n constructor(\n private readonly client: {\n public: PublicClient;\n wallet: SmartAccountClient<EntryPoint, Transport, Chain, SmartAccount<EntryPoint>>;\n },\n private readonly defaultSendTransactionOptions: SendTransactionOptions = {\n confirmations: 2,\n transactionConfirmationTimeout: 30_000,\n }\n ) {}\n\n async sendTransaction(\n request: TransactionServiceTransactionRequest,\n config: Partial<SendTransactionOptions> = {}\n ): Promise<Hex> {\n const { confirmations, transactionConfirmationTimeout } = this.getConfig(config);\n\n await this.simulateCall(request, undefined, \"simulation\");\n\n let hash;\n try {\n hash = await this.client.wallet.writeContract({\n ...request,\n account: this.client.wallet.account,\n chain: this.client.wallet.chain,\n });\n } catch (e) {\n if (e instanceof BaseError) {\n throw new EVMSendTransactionError(e.message, e, \"send\");\n }\n throw e;\n }\n\n try {\n const receipt = await this.client.public.waitForTransactionReceipt({\n hash,\n confirmations,\n timeout: transactionConfirmationTimeout,\n });\n return await this.handleReceipt(receipt, request);\n } catch (e) {\n if (e instanceof BaseError) {\n throw new EVMSendTransactionError(e.message, e, \"confirmation\");\n }\n throw e;\n }\n }\n\n private getConfig(config: Partial<SendTransactionOptions>): SendTransactionOptions {\n return {\n ...this.defaultSendTransactionOptions,\n ...config,\n };\n }\n\n private async handleReceipt(receipt: TransactionReceipt, request: TransactionServiceTransactionRequest) {\n if (receipt.status === \"reverted\") {\n // This should revert and throw the full reason\n await this.simulateCall(request, receipt.transactionHash, \"execution\");\n // Otherwise, throw a generic error (this should practically never happen)\n throw new EVMSendTransactionExecutionRevertedError(\n \"Transaction reverted but unable to detect the reason\",\n new ContractFunctionRevertedError({ abi: request.abi as Abi, functionName: request.functionName }),\n new ContractFunctionRevertedError({ abi: request.abi as Abi, functionName: request.functionName }),\n receipt.transactionHash,\n \"execution\"\n );\n }\n return receipt.transactionHash;\n }\n\n private async simulateCall(\n request: TransactionServiceTransactionRequest,\n passthroughTxId: string | undefined,\n stage: SendTransactionFailureStage\n ) {\n try {\n await this.client.public.simulateContract({\n ...request,\n account: this.client.wallet.account.address,\n chain: this.client.public.chain,\n });\n } catch (e) {\n if (e instanceof BaseError) {\n const revertError = e.walk((err) => err instanceof ContractFunctionRevertedError);\n if (revertError instanceof ContractFunctionRevertedError) {\n throw new EVMSendTransactionExecutionRevertedError(\n revertError.message,\n e,\n revertError,\n passthroughTxId,\n stage\n );\n }\n throw new EVMSendTransactionError(e.message, e, stage);\n }\n throw e;\n }\n }\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// src/blockchain/wallets/account/signer.ts
|
|
2
|
+
var PasskeySignerConfig = class {
|
|
3
|
+
constructor(data) {
|
|
4
|
+
this.type = "passkeys";
|
|
5
|
+
this.data = data;
|
|
6
|
+
}
|
|
7
|
+
display() {
|
|
8
|
+
return {
|
|
9
|
+
pubKeyX: this.data.pubKeyX,
|
|
10
|
+
pubKeyY: this.data.pubKeyY,
|
|
11
|
+
passkeyName: this.data.passkeyName,
|
|
12
|
+
type: this.type
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var EOASignerConfig = class {
|
|
17
|
+
constructor(data) {
|
|
18
|
+
this.type = "eoa";
|
|
19
|
+
this.data = data;
|
|
20
|
+
}
|
|
21
|
+
display() {
|
|
22
|
+
return this.data;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
PasskeySignerConfig,
|
|
28
|
+
EOASignerConfig
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=chunk-3R6PW6HY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/blockchain/wallets/account/signer.ts"],"sourcesContent":["import type {\n EOASignerData,\n PasskeyDisplay,\n PasskeySignerData,\n SignerData,\n SignerDisplay,\n} from \"../../../types/service\";\n\nexport interface SignerConfig {\n readonly type: \"passkeys\" | \"eoa\";\n display(): SignerDisplay;\n readonly data: SignerData;\n}\n\nexport class PasskeySignerConfig implements SignerConfig {\n public readonly data: PasskeySignerData;\n public readonly type = \"passkeys\";\n\n constructor(data: PasskeySignerData) {\n this.data = data;\n }\n\n public display(): PasskeyDisplay {\n return {\n pubKeyX: this.data.pubKeyX,\n pubKeyY: this.data.pubKeyY,\n passkeyName: this.data.passkeyName,\n type: this.type,\n };\n }\n}\n\nexport class EOASignerConfig implements SignerConfig {\n public readonly data: EOASignerData;\n public readonly type = \"eoa\";\n\n constructor(data: EOASignerData) {\n this.data = data;\n }\n\n public display() {\n return this.data;\n }\n}\n"],"mappings":";AAcO,IAAM,sBAAN,MAAkD;AAAA,EAIrD,YAAY,MAAyB;AAFrC,SAAgB,OAAO;AAGnB,SAAK,OAAO;AAAA,EAChB;AAAA,EAEO,UAA0B;AAC7B,WAAO;AAAA,MACH,SAAS,KAAK,KAAK;AAAA,MACnB,SAAS,KAAK,KAAK;AAAA,MACnB,aAAa,KAAK,KAAK;AAAA,MACvB,MAAM,KAAK;AAAA,IACf;AAAA,EACJ;AACJ;AAEO,IAAM,kBAAN,MAA8C;AAAA,EAIjD,YAAY,MAAqB;AAFjC,SAAgB,OAAO;AAGnB,SAAK,OAAO;AAAA,EAChB;AAAA,EAEO,UAAU;AACb,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
|
|
@@ -1 +1,13 @@
|
|
|
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; }
|
|
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; }// src/utils/helpers.ts
|
|
2
|
+
function isEmpty(str) {
|
|
3
|
+
return !str || str.length === 0 || str.trim().length === 0;
|
|
4
|
+
}
|
|
5
|
+
function equalsIgnoreCase(a, b) {
|
|
6
|
+
return _optionalChain([a, 'optionalAccess', _ => _.toLowerCase, 'call', _2 => _2()]) === _optionalChain([b, 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4()]);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.isEmpty = isEmpty; exports.equalsIgnoreCase = equalsIgnoreCase;
|
|
13
|
+
//# sourceMappingURL=chunk-5MG5CIEX.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/helpers.ts"],"names":[],"mappings":";AAAO,SAAS,QAAQ,KAAyD;AAC7E,SAAO,CAAC,OAAO,IAAI,WAAW,KAAK,IAAI,KAAK,EAAE,WAAW;AAC7D;AAEO,SAAS,iBAAiB,GAAY,GAAqB;AAC9D,SAAO,GAAG,YAAY,MAAM,GAAG,YAAY;AAC/C","sourcesContent":["export function isEmpty(str: string | undefined | null): str is undefined | null {\n return !str || str.length === 0 || str.trim().length === 0;\n}\n\nexport function equalsIgnoreCase(a?: string, b?: string): boolean {\n return a?.toLowerCase() === b?.toLowerCase();\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/environment.ts"],"sourcesContent":["export function isClient() {\n return typeof window !== \"undefined\";\n}\n"],"mappings":";AAAO,SAAS,WAAW;AACvB,SAAO,OAAO,WAAW;AAC7B;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SDK_VERSION
|
|
3
|
+
} from "./chunk-UDDYHPSW.js";
|
|
4
|
+
import {
|
|
5
|
+
SmartWalletError
|
|
6
|
+
} from "./chunk-ASIPMVRQ.js";
|
|
7
|
+
|
|
8
|
+
// src/error/processor.ts
|
|
9
|
+
import { BaseError, stringify } from "viem";
|
|
10
|
+
var ErrorProcessor = class {
|
|
11
|
+
constructor(logger) {
|
|
12
|
+
this.logger = logger;
|
|
13
|
+
}
|
|
14
|
+
map(error, fallback) {
|
|
15
|
+
this.record(error);
|
|
16
|
+
if (error instanceof SmartWalletError) {
|
|
17
|
+
return error;
|
|
18
|
+
}
|
|
19
|
+
if (error instanceof BaseError) {
|
|
20
|
+
return error;
|
|
21
|
+
}
|
|
22
|
+
return fallback;
|
|
23
|
+
}
|
|
24
|
+
record(error) {
|
|
25
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
26
|
+
this.logger.error(`Smart Wallet SDK Error: ${message}`, {
|
|
27
|
+
stack: error instanceof Error ? error.stack : void 0,
|
|
28
|
+
name: error instanceof Error ? error.name : "UnknownError",
|
|
29
|
+
details: stringify(error),
|
|
30
|
+
domain: window.location.hostname,
|
|
31
|
+
sdk_version: SDK_VERSION
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
ErrorProcessor
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=chunk-5VHMVO22.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/error/processor.ts"],"sourcesContent":["import { BaseError, stringify } from \"viem\";\n\nimport type { SDKLogger } from \"@crossmint/client-sdk-base\";\n\nimport { SmartWalletError } from \".\";\nimport { SDK_VERSION } from \"../utils/constants\";\n\nexport class ErrorProcessor {\n constructor(private readonly logger: SDKLogger) {}\n\n public map(error: unknown, fallback: SmartWalletError): SmartWalletError | BaseError {\n this.record(error);\n\n if (error instanceof SmartWalletError) {\n return error;\n }\n\n // Allow viem errors, which are generally pretty friendly.\n if (error instanceof BaseError) {\n return error;\n }\n\n return fallback;\n }\n\n private record(error: unknown) {\n const message = error instanceof Error ? error.message : String(error);\n this.logger.error(`Smart Wallet SDK Error: ${message}`, {\n stack: error instanceof Error ? error.stack : undefined,\n name: error instanceof Error ? error.name : \"UnknownError\",\n details: stringify(error),\n domain: window.location.hostname,\n sdk_version: SDK_VERSION,\n });\n }\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,WAAW,iBAAiB;AAO9B,IAAM,iBAAN,MAAqB;AAAA,EACxB,YAA6B,QAAmB;AAAnB;AAAA,EAAoB;AAAA,EAE1C,IAAI,OAAgB,UAA0D;AACjF,SAAK,OAAO,KAAK;AAEjB,QAAI,iBAAiB,kBAAkB;AACnC,aAAO;AAAA,IACX;AAGA,QAAI,iBAAiB,WAAW;AAC5B,aAAO;AAAA,IACX;AAEA,WAAO;AAAA,EACX;AAAA,EAEQ,OAAO,OAAgB;AAC3B,UAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AACrE,SAAK,OAAO,MAAM,2BAA2B,OAAO,IAAI;AAAA,MACpD,OAAO,iBAAiB,QAAQ,MAAM,QAAQ;AAAA,MAC9C,MAAM,iBAAiB,QAAQ,MAAM,OAAO;AAAA,MAC5C,SAAS,UAAU,KAAK;AAAA,MACxB,QAAQ,OAAO,SAAS;AAAA,MACxB,aAAa;AAAA,IACjB,CAAC;AAAA,EACL;AACJ;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SmartWalletConfigSchema
|
|
3
|
+
} from "./chunk-OYKL3RNL.js";
|
|
4
|
+
|
|
5
|
+
// src/blockchain/wallets/account/cache.ts
|
|
6
|
+
import { keccak256, toHex } from "viem";
|
|
7
|
+
var AccountConfigCache = class {
|
|
8
|
+
constructor(keyPrefix) {
|
|
9
|
+
this.keyPrefix = keyPrefix;
|
|
10
|
+
}
|
|
11
|
+
set(user, config) {
|
|
12
|
+
localStorage.setItem(this.key(user), JSON.stringify(config));
|
|
13
|
+
}
|
|
14
|
+
get(user) {
|
|
15
|
+
const key = this.key(user);
|
|
16
|
+
const data = localStorage.getItem(key);
|
|
17
|
+
if (data == null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const result = SmartWalletConfigSchema.safeParse(JSON.parse(data));
|
|
21
|
+
if (!result.success) {
|
|
22
|
+
localStorage.removeItem(key);
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return result.data;
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
29
|
+
const key = localStorage.key(i);
|
|
30
|
+
if (key && key.startsWith(this.keyPrefix)) {
|
|
31
|
+
localStorage.removeItem(key);
|
|
32
|
+
i--;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
key(user) {
|
|
37
|
+
return `${this.keyPrefix}-${keccak256(toHex(user.jwt))}`;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
AccountConfigCache
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=chunk-5W4NYW72.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/blockchain/wallets/account/cache.ts"],"sourcesContent":["import { keccak256, toHex } from \"viem\";\n\nimport type { UserParams } from \"../../../types/params\";\nimport { SmartWalletConfigSchema } from \"../../../types/schema\";\nimport type { SmartWalletConfig } from \"../../../types/service\";\n\nexport class AccountConfigCache {\n constructor(private readonly keyPrefix: string) {}\n\n public set(user: UserParams, config: SmartWalletConfig) {\n localStorage.setItem(this.key(user), JSON.stringify(config));\n }\n\n public get(user: UserParams): SmartWalletConfig | null {\n const key = this.key(user);\n const data = localStorage.getItem(key);\n if (data == null) {\n return null;\n }\n\n const result = SmartWalletConfigSchema.safeParse(JSON.parse(data));\n if (!result.success) {\n localStorage.removeItem(key);\n return null;\n }\n\n return result.data;\n }\n\n public clear() {\n for (let i = 0; i < localStorage.length; i++) {\n const key = localStorage.key(i);\n if (key && key.startsWith(this.keyPrefix)) {\n localStorage.removeItem(key);\n i--; // Decrement i since we've removed an item\n }\n }\n }\n\n private key(user: UserParams) {\n return `${this.keyPrefix}-${keccak256(toHex(user.jwt))}`;\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,WAAW,aAAa;AAM1B,IAAM,qBAAN,MAAyB;AAAA,EAC5B,YAA6B,WAAmB;AAAnB;AAAA,EAAoB;AAAA,EAE1C,IAAI,MAAkB,QAA2B;AACpD,iBAAa,QAAQ,KAAK,IAAI,IAAI,GAAG,KAAK,UAAU,MAAM,CAAC;AAAA,EAC/D;AAAA,EAEO,IAAI,MAA4C;AACnD,UAAM,MAAM,KAAK,IAAI,IAAI;AACzB,UAAM,OAAO,aAAa,QAAQ,GAAG;AACrC,QAAI,QAAQ,MAAM;AACd,aAAO;AAAA,IACX;AAEA,UAAM,SAAS,wBAAwB,UAAU,KAAK,MAAM,IAAI,CAAC;AACjE,QAAI,CAAC,OAAO,SAAS;AACjB,mBAAa,WAAW,GAAG;AAC3B,aAAO;AAAA,IACX;AAEA,WAAO,OAAO;AAAA,EAClB;AAAA,EAEO,QAAQ;AACX,aAAS,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;AAC1C,YAAM,MAAM,aAAa,IAAI,CAAC;AAC9B,UAAI,OAAO,IAAI,WAAW,KAAK,SAAS,GAAG;AACvC,qBAAa,WAAW,GAAG;AAC3B;AAAA,MACJ;AAAA,IACJ;AAAA,EACJ;AAAA,EAEQ,IAAI,MAAkB;AAC1B,WAAO,GAAG,KAAK,SAAS,IAAI,UAAU,MAAM,KAAK,GAAG,CAAC,CAAC;AAAA,EAC1D;AACJ;","names":[]}
|