@crossmint/wallets-sdk 0.18.15 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/test-utils.cjs +5 -5
- package/dist/api/__tests__/test-utils.js +3 -3
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.js +3 -3
- package/dist/api/gen/types.gen.d.cts +8 -0
- package/dist/api/gen/types.gen.d.ts +8 -0
- package/dist/api/index.cjs +4 -4
- package/dist/api/index.js +3 -3
- package/dist/chains/chains.cjs +6 -2
- package/dist/chains/chains.d.cts +3 -1
- package/dist/chains/chains.d.ts +3 -1
- package/dist/chains/chains.js +5 -1
- package/dist/{chunk-5YX2BE4I.js → chunk-57HPJVTI.js} +8 -3
- package/dist/{chunk-PJTTM5QQ.cjs → chunk-5CBGJLA4.cjs} +1 -1
- package/dist/{chunk-YZOPFNY3.js → chunk-6EP3PLGP.js} +2 -2
- package/dist/{chunk-4ZFP3ST7.js → chunk-7EZZGCYI.js} +10 -1
- package/dist/{chunk-ZM437XPQ.js → chunk-7NKX266V.js} +39 -5
- package/dist/{chunk-GSDBCRGH.js → chunk-BBYNVHFR.js} +3 -3
- package/dist/{chunk-NFQT5TFO.cjs → chunk-C5F6IECX.cjs} +12 -12
- package/dist/{chunk-OWRKZD7H.cjs → chunk-DIM3X4IX.cjs} +9 -1
- package/dist/{chunk-QCTTQ4XE.cjs → chunk-EIZVQAZO.cjs} +54 -20
- package/dist/{chunk-V65OBC5I.js → chunk-ETCH6L2Y.js} +3 -3
- package/dist/{chunk-WMUNQJYD.cjs → chunk-FQV77LH4.cjs} +3 -3
- package/dist/{chunk-YT64AZL6.cjs → chunk-JLW3Q65G.cjs} +6 -6
- package/dist/{chunk-AKJOFUXU.cjs → chunk-JZQYCISB.cjs} +9 -9
- package/dist/{chunk-CJWHHO4B.js → chunk-KE6LX37B.js} +1 -1
- package/dist/{chunk-WQDGFD34.js → chunk-L5IMC3NM.js} +2 -2
- package/dist/{chunk-PHIXNAMT.js → chunk-N65K6TUY.js} +10 -1
- package/dist/{chunk-PADJ2CIV.cjs → chunk-NXST74TX.cjs} +80 -43
- package/dist/{chunk-BMXG52BZ.cjs → chunk-REP547HH.cjs} +36 -13
- package/dist/{chunk-LFUXRLJR.js → chunk-S2AKC2CK.js} +1 -1
- package/dist/{chunk-TOTOITTM.js → chunk-SUJQZWLJ.js} +2 -2
- package/dist/{chunk-AUNZEGWS.cjs → chunk-TCNXKNBQ.cjs} +7 -7
- package/dist/{chunk-AKAJ7UHQ.cjs → chunk-VNPL3HFN.cjs} +12 -3
- package/dist/{chunk-77HEKAFB.cjs → chunk-VWENCGQO.cjs} +12 -3
- package/dist/{chunk-VM6OLXBS.js → chunk-W3OYA42M.js} +32 -9
- package/dist/{chunk-OOVNMAQF.js → chunk-XEZBA7I2.js} +58 -21
- package/dist/{chunk-JDAWNKQ7.cjs → chunk-XQSMZXBR.cjs} +28 -23
- package/dist/{chunk-XVFUAZJY.js → chunk-XSMIDXUA.js} +9 -1
- package/dist/{chunk-SCU5YLUT.js → chunk-YF4DYTBM.js} +10 -1
- package/dist/{chunk-PRQOFWLH.cjs → chunk-YFOUZXSM.cjs} +12 -3
- package/dist/{chunk-OTI3LX45.cjs → chunk-YXFIZNFL.cjs} +9 -9
- package/dist/index.cjs +16 -16
- package/dist/index.js +15 -15
- package/dist/logger/index.cjs +3 -3
- package/dist/logger/index.js +2 -2
- package/dist/logger/init.cjs +3 -3
- package/dist/logger/init.js +2 -2
- package/dist/sdk.cjs +17 -12
- package/dist/sdk.js +16 -11
- package/dist/signers/index.cjs +8 -8
- package/dist/signers/index.js +7 -7
- package/dist/signers/non-custodial/index.cjs +7 -7
- package/dist/signers/non-custodial/index.js +6 -6
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
- package/dist/signers/non-custodial/ncs-signer.js +3 -3
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +10 -8
- package/dist/wallets/__tests__/test-helpers.d.cts +2 -1
- package/dist/wallets/__tests__/test-helpers.d.ts +2 -1
- package/dist/wallets/__tests__/test-helpers.js +9 -7
- package/dist/wallets/evm.cjs +10 -10
- package/dist/wallets/evm.d.cts +20 -0
- package/dist/wallets/evm.d.ts +20 -0
- package/dist/wallets/evm.js +9 -9
- package/dist/wallets/solana.cjs +9 -9
- package/dist/wallets/solana.d.cts +5 -0
- package/dist/wallets/solana.d.ts +5 -0
- package/dist/wallets/solana.js +8 -8
- package/dist/wallets/stellar.cjs +9 -9
- package/dist/wallets/stellar.d.cts +5 -0
- package/dist/wallets/stellar.d.ts +5 -0
- package/dist/wallets/stellar.js +8 -8
- package/dist/wallets/types.d.cts +5 -1
- package/dist/wallets/types.d.ts +5 -1
- package/dist/wallets/wallet-factory.cjs +15 -10
- package/dist/wallets/wallet-factory.d.cts +2 -0
- package/dist/wallets/wallet-factory.d.ts +2 -0
- package/dist/wallets/wallet-factory.js +14 -9
- package/dist/wallets/wallet.cjs +8 -8
- package/dist/wallets/wallet.d.cts +6 -2
- package/dist/wallets/wallet.d.ts +6 -2
- package/dist/wallets/wallet.js +7 -7
- package/package.json +4 -4
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
var _chunkG6QJHFSYcjs = require('../../chunk-G6QJHFSY.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkC5F6IECXcjs = require('../../chunk-C5F6IECX.cjs');
|
|
13
13
|
require('../../chunk-XC2V34TS.cjs');
|
|
14
|
-
require('../../chunk-
|
|
15
|
-
require('../../chunk-
|
|
14
|
+
require('../../chunk-FQV77LH4.cjs');
|
|
15
|
+
require('../../chunk-5CBGJLA4.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -46,7 +46,7 @@ var createMockCrossmint = (overrides = {}) => {
|
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
48
|
var createTestApiClient = (crossmint) => {
|
|
49
|
-
return new (0,
|
|
49
|
+
return new (0, _chunkC5F6IECXcjs.ApiClient)(crossmint || createMockCrossmint());
|
|
50
50
|
};
|
|
51
51
|
var createServerSideApiClient = () => {
|
|
52
52
|
const apiClient = createTestApiClient();
|
|
@@ -186,7 +186,7 @@ var createIntegrationApiClient = (apiKey, baseUrl, overrides = {}) => {
|
|
|
186
186
|
setJwt: () => crossmint,
|
|
187
187
|
experimental_setCustomAuth: () => crossmint
|
|
188
188
|
});
|
|
189
|
-
return new (0,
|
|
189
|
+
return new (0, _chunkC5F6IECXcjs.ApiClient)(crossmint);
|
|
190
190
|
};
|
|
191
191
|
var TestDataFactory = class {
|
|
192
192
|
constructor() {
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
} from "../../chunk-PJOJIRTY.js";
|
|
10
10
|
import {
|
|
11
11
|
ApiClient
|
|
12
|
-
} from "../../chunk-
|
|
12
|
+
} from "../../chunk-6EP3PLGP.js";
|
|
13
13
|
import "../../chunk-SGINWAB6.js";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-S2AKC2CK.js";
|
|
15
|
+
import "../../chunk-KE6LX37B.js";
|
|
16
16
|
import {
|
|
17
17
|
__async,
|
|
18
18
|
__spreadProps,
|
package/dist/api/client.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkC5F6IECXcjs = require('../chunk-C5F6IECX.cjs');
|
|
4
4
|
require('../chunk-XC2V34TS.cjs');
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-FQV77LH4.cjs');
|
|
6
|
+
require('../chunk-5CBGJLA4.cjs');
|
|
7
7
|
require('../chunk-UO2J2ZB2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.ApiClient =
|
|
10
|
+
exports.ApiClient = _chunkC5F6IECXcjs.ApiClient;
|
package/dist/api/client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-6EP3PLGP.js";
|
|
4
4
|
import "../chunk-SGINWAB6.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-S2AKC2CK.js";
|
|
6
|
+
import "../chunk-KE6LX37B.js";
|
|
7
7
|
import "../chunk-ASE2FXWP.js";
|
|
8
8
|
export {
|
|
9
9
|
ApiClient
|
|
@@ -2610,6 +2610,10 @@ type SendTokenDto = {
|
|
|
2610
2610
|
* Amount of tokens to transfer (in decimal format)
|
|
2611
2611
|
*/
|
|
2612
2612
|
amount?: string;
|
|
2613
|
+
/**
|
|
2614
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2615
|
+
*/
|
|
2616
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2613
2617
|
};
|
|
2614
2618
|
/**
|
|
2615
2619
|
* Base fields for all token transfers
|
|
@@ -2649,6 +2653,10 @@ type SendTokenV2025Dto = {
|
|
|
2649
2653
|
type: 'hash';
|
|
2650
2654
|
value: string;
|
|
2651
2655
|
};
|
|
2656
|
+
/**
|
|
2657
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2658
|
+
*/
|
|
2659
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2652
2660
|
};
|
|
2653
2661
|
/**
|
|
2654
2662
|
* Input for submitting one or more approvals
|
|
@@ -2610,6 +2610,10 @@ type SendTokenDto = {
|
|
|
2610
2610
|
* Amount of tokens to transfer (in decimal format)
|
|
2611
2611
|
*/
|
|
2612
2612
|
amount?: string;
|
|
2613
|
+
/**
|
|
2614
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2615
|
+
*/
|
|
2616
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2613
2617
|
};
|
|
2614
2618
|
/**
|
|
2615
2619
|
* Base fields for all token transfers
|
|
@@ -2649,6 +2653,10 @@ type SendTokenV2025Dto = {
|
|
|
2649
2653
|
type: 'hash';
|
|
2650
2654
|
value: string;
|
|
2651
2655
|
};
|
|
2656
|
+
/**
|
|
2657
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2658
|
+
*/
|
|
2659
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2652
2660
|
};
|
|
2653
2661
|
/**
|
|
2654
2662
|
* Input for submitting one or more approvals
|
package/dist/api/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkC5F6IECXcjs = require('../chunk-C5F6IECX.cjs');
|
|
5
5
|
require('../chunk-XC2V34TS.cjs');
|
|
6
6
|
require('../chunk-ECAM5KTH.cjs');
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-FQV77LH4.cjs');
|
|
8
|
+
require('../chunk-5CBGJLA4.cjs');
|
|
9
9
|
require('../chunk-UO2J2ZB2.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.ApiClient =
|
|
12
|
+
exports.ApiClient = _chunkC5F6IECXcjs.ApiClient;
|
package/dist/api/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../chunk-5IFDVB4Y.js";
|
|
2
2
|
import {
|
|
3
3
|
ApiClient
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-6EP3PLGP.js";
|
|
5
5
|
import "../chunk-SGINWAB6.js";
|
|
6
6
|
import "../chunk-KBJA7JDT.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-S2AKC2CK.js";
|
|
8
|
+
import "../chunk-KE6LX37B.js";
|
|
9
9
|
import "../chunk-ASE2FXWP.js";
|
|
10
10
|
export {
|
|
11
11
|
ApiClient
|
package/dist/chains/chains.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkDIM3X4IXcjs = require('../chunk-DIM3X4IX.cjs');
|
|
4
6
|
require('../chunk-NIBKCMQ2.cjs');
|
|
5
7
|
require('../chunk-55V4VMTX.cjs');
|
|
6
8
|
require('../chunk-6H6ZBJC2.cjs');
|
|
@@ -8,4 +10,6 @@ require('../chunk-HTSQPZHW.cjs');
|
|
|
8
10
|
require('../chunk-UO2J2ZB2.cjs');
|
|
9
11
|
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.isMainnetChain = _chunkDIM3X4IXcjs.isMainnetChain; exports.isTestnetChain = _chunkDIM3X4IXcjs.isTestnetChain; exports.toViemChain = _chunkDIM3X4IXcjs.toViemChain;
|
package/dist/chains/chains.d.cts
CHANGED
|
@@ -10,5 +10,7 @@ type SolanaChain = "solana";
|
|
|
10
10
|
type StellarChain = "stellar";
|
|
11
11
|
type EVMChain = EVMSmartWalletChain;
|
|
12
12
|
type Chain = SolanaChain | EVMChain | StellarChain;
|
|
13
|
+
declare function isTestnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletTestnet;
|
|
14
|
+
declare function isMainnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletMainnet;
|
|
13
15
|
|
|
14
|
-
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, toViemChain };
|
|
16
|
+
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, toViemChain };
|
package/dist/chains/chains.d.ts
CHANGED
|
@@ -10,5 +10,7 @@ type SolanaChain = "solana";
|
|
|
10
10
|
type StellarChain = "stellar";
|
|
11
11
|
type EVMChain = EVMSmartWalletChain;
|
|
12
12
|
type Chain = SolanaChain | EVMChain | StellarChain;
|
|
13
|
+
declare function isTestnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletTestnet;
|
|
14
|
+
declare function isMainnetChain(chain: EVMSmartWalletChain): chain is EVMSmartWalletMainnet;
|
|
13
15
|
|
|
14
|
-
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, toViemChain };
|
|
16
|
+
export { type Chain, type EVMChain, type EVMSmartWalletChain, type EVMSmartWalletMainnet, type EVMSmartWalletTestnet, type SolanaChain, type StellarChain, isMainnetChain, isTestnetChain, toViemChain };
|
package/dist/chains/chains.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
isMainnetChain,
|
|
3
|
+
isTestnetChain,
|
|
2
4
|
toViemChain
|
|
3
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-XSMIDXUA.js";
|
|
4
6
|
import "../chunk-2T5HHKUI.js";
|
|
5
7
|
import "../chunk-3U6UAYOV.js";
|
|
6
8
|
import "../chunk-IZJUOXOZ.js";
|
|
7
9
|
import "../chunk-ZBLW42YE.js";
|
|
8
10
|
import "../chunk-ASE2FXWP.js";
|
|
9
11
|
export {
|
|
12
|
+
isMainnetChain,
|
|
13
|
+
isTestnetChain,
|
|
10
14
|
toViemChain
|
|
11
15
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XEZBA7I2.js";
|
|
4
4
|
import {
|
|
5
5
|
InvalidTypedDataError,
|
|
6
6
|
SignatureNotCreatedError,
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
} from "./chunk-SGINWAB6.js";
|
|
9
9
|
import {
|
|
10
10
|
toViemChain
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-XSMIDXUA.js";
|
|
12
12
|
import {
|
|
13
13
|
walletsLogger
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-S2AKC2CK.js";
|
|
15
15
|
import {
|
|
16
16
|
__async,
|
|
17
17
|
__decorateClass
|
|
@@ -148,6 +148,11 @@ var _EVMWallet = class _EVMWallet extends Wallet {
|
|
|
148
148
|
return result;
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* Get a Viem public client instance configured for this wallet's chain.
|
|
153
|
+
* @param params - Optional transport configuration
|
|
154
|
+
* @returns A Viem public client
|
|
155
|
+
*/
|
|
151
156
|
getViemClient(params) {
|
|
152
157
|
var _a;
|
|
153
158
|
return createPublicClient({
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-SGINWAB6.js";
|
|
4
4
|
import {
|
|
5
5
|
walletsLogger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-S2AKC2CK.js";
|
|
7
7
|
import {
|
|
8
8
|
SDK_NAME,
|
|
9
9
|
SDK_VERSION
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-KE6LX37B.js";
|
|
11
11
|
import {
|
|
12
12
|
__async
|
|
13
13
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_EVENT_OPTIONS,
|
|
3
3
|
NonCustodialSigner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-W3OYA42M.js";
|
|
5
|
+
import {
|
|
6
|
+
walletsLogger
|
|
7
|
+
} from "./chunk-S2AKC2CK.js";
|
|
5
8
|
import {
|
|
6
9
|
__async
|
|
7
10
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -26,6 +29,8 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends NonCustod
|
|
|
26
29
|
const transactionBytes = base58.decode(transaction);
|
|
27
30
|
const deserializedTransaction = VersionedTransaction.deserialize(transactionBytes);
|
|
28
31
|
const messageData = deserializedTransaction.message.serialize();
|
|
32
|
+
walletsLogger.info("sign: sending request", { keyType: "ed25519" });
|
|
33
|
+
const startTime = Date.now();
|
|
29
34
|
const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
|
|
30
35
|
event: "request:sign",
|
|
31
36
|
responseEvent: "response:sign",
|
|
@@ -42,6 +47,10 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends NonCustod
|
|
|
42
47
|
},
|
|
43
48
|
options: DEFAULT_EVENT_OPTIONS
|
|
44
49
|
});
|
|
50
|
+
walletsLogger.info("sign: response received", {
|
|
51
|
+
status: res == null ? void 0 : res.status,
|
|
52
|
+
durationMs: Date.now() - startTime
|
|
53
|
+
});
|
|
45
54
|
if ((res == null ? void 0 : res.status) === "error") {
|
|
46
55
|
throw new Error(res.error);
|
|
47
56
|
}
|
|
@@ -4,17 +4,21 @@ import {
|
|
|
4
4
|
} from "./chunk-ZP4ZZCIE.js";
|
|
5
5
|
import {
|
|
6
6
|
Wallet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-XEZBA7I2.js";
|
|
8
8
|
import {
|
|
9
9
|
assembleSigner
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ETCH6L2Y.js";
|
|
11
11
|
import {
|
|
12
12
|
WalletCreationError,
|
|
13
13
|
WalletNotAvailableError
|
|
14
14
|
} from "./chunk-SGINWAB6.js";
|
|
15
|
+
import {
|
|
16
|
+
isMainnetChain,
|
|
17
|
+
isTestnetChain
|
|
18
|
+
} from "./chunk-XSMIDXUA.js";
|
|
15
19
|
import {
|
|
16
20
|
walletsLogger
|
|
17
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-S2AKC2CK.js";
|
|
18
22
|
import {
|
|
19
23
|
__async,
|
|
20
24
|
__decorateClass,
|
|
@@ -22,7 +26,7 @@ import {
|
|
|
22
26
|
} from "./chunk-ASE2FXWP.js";
|
|
23
27
|
|
|
24
28
|
// src/wallets/wallet-factory.ts
|
|
25
|
-
import { WithLoggerContext } from "@crossmint/common-sdk-base";
|
|
29
|
+
import { WithLoggerContext, APIKeyEnvironmentPrefix } from "@crossmint/common-sdk-base";
|
|
26
30
|
import { WebAuthnP256 } from "ox";
|
|
27
31
|
var DELEGATED_SIGNER_MISMATCH_ERROR = "When 'delegatedSigners' is provided to a method that may fetch an existing wallet, each specified delegated signer must exist in that wallet's configuration.";
|
|
28
32
|
var WalletFactory = class {
|
|
@@ -39,6 +43,7 @@ var WalletFactory = class {
|
|
|
39
43
|
"getOrCreateWallet can only be called from client-side code.\n- Make sure you're running this in the browser (or another client environment), not on your server.\n- Use your Crossmint Client API Key (not a server key)."
|
|
40
44
|
);
|
|
41
45
|
}
|
|
46
|
+
this.validateChainEnvironment(args.chain);
|
|
42
47
|
const locator = this.getWalletLocator(args);
|
|
43
48
|
walletsLogger.info("walletFactory.getOrCreateWallet.start");
|
|
44
49
|
const existingWallet = yield this.apiClient.getWallet(locator);
|
|
@@ -49,7 +54,7 @@ var WalletFactory = class {
|
|
|
49
54
|
return this.createWalletInstance(existingWallet, args);
|
|
50
55
|
}
|
|
51
56
|
walletsLogger.info("walletFactory.getOrCreateWallet.creating");
|
|
52
|
-
return this.
|
|
57
|
+
return this.createWalletInternal(args);
|
|
53
58
|
});
|
|
54
59
|
}
|
|
55
60
|
getWallet(walletLocator, args) {
|
|
@@ -60,6 +65,7 @@ var WalletFactory = class {
|
|
|
60
65
|
});
|
|
61
66
|
throw new WalletCreationError("getWallet is not supported on client side, use getOrCreateWallet instead");
|
|
62
67
|
}
|
|
68
|
+
this.validateChainEnvironment(args.chain);
|
|
63
69
|
walletsLogger.info("walletFactory.getWallet.start");
|
|
64
70
|
const existingWallet = yield this.apiClient.getWallet(walletLocator);
|
|
65
71
|
if ("error" in existingWallet) {
|
|
@@ -75,6 +81,12 @@ var WalletFactory = class {
|
|
|
75
81
|
});
|
|
76
82
|
}
|
|
77
83
|
createWallet(args) {
|
|
84
|
+
return __async(this, null, function* () {
|
|
85
|
+
this.validateChainEnvironment(args.chain);
|
|
86
|
+
return this.createWalletInternal(args);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
createWalletInternal(args) {
|
|
78
90
|
return __async(this, null, function* () {
|
|
79
91
|
var _a, _b, _c, _d, _e;
|
|
80
92
|
yield (_c = (_b = (_a = args.options) == null ? void 0 : _a.experimental_callbacks) == null ? void 0 : _b.onWalletCreationStart) == null ? void 0 : _c.call(_b);
|
|
@@ -286,6 +298,28 @@ var WalletFactory = class {
|
|
|
286
298
|
}
|
|
287
299
|
return "evm";
|
|
288
300
|
}
|
|
301
|
+
validateChainEnvironment(chain) {
|
|
302
|
+
if (chain === "solana" || chain === "stellar") {
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const evmChain = chain;
|
|
306
|
+
const environment = this.apiClient.environment;
|
|
307
|
+
const isProduction = environment === APIKeyEnvironmentPrefix.PRODUCTION;
|
|
308
|
+
if (isProduction && isTestnetChain(evmChain)) {
|
|
309
|
+
walletsLogger.warn("walletFactory.validateChainEnvironment.mismatch", {
|
|
310
|
+
chain,
|
|
311
|
+
environment,
|
|
312
|
+
message: `Chain "${chain}" is a testnet chain and should not be used in production environment. Please use a mainnet chain instead.`
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (!isProduction && isMainnetChain(evmChain)) {
|
|
316
|
+
walletsLogger.warn("walletFactory.validateChainEnvironment.mismatch", {
|
|
317
|
+
chain,
|
|
318
|
+
environment,
|
|
319
|
+
message: `Chain "${chain}" is a mainnet chain and should not be used in ${environment} environment. Please use a testnet chain instead.`
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
}
|
|
289
323
|
};
|
|
290
324
|
__decorateClass([
|
|
291
325
|
WithLoggerContext({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WalletFactory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7NKX266V.js";
|
|
4
4
|
import {
|
|
5
5
|
ApiClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6EP3PLGP.js";
|
|
7
7
|
import {
|
|
8
8
|
initWalletsLogger,
|
|
9
9
|
walletsLogger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-S2AKC2CK.js";
|
|
11
11
|
import {
|
|
12
12
|
__async
|
|
13
13
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkFQV77LH4cjs = require('./chunk-FQV77LH4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk5CBGJLA4cjs = require('./chunk-5CBGJLA4.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -22,7 +22,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
22
22
|
constructor(crossmint) {
|
|
23
23
|
super(crossmint, {
|
|
24
24
|
internalConfig: {
|
|
25
|
-
sdkMetadata: { name:
|
|
25
|
+
sdkMetadata: { name: _chunk5CBGJLA4cjs.SDK_NAME, version: _chunk5CBGJLA4cjs.SDK_VERSION }
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
this.apiPrefix = "api/2025-06-09/wallets";
|
|
@@ -31,7 +31,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
31
31
|
createWallet(params) {
|
|
32
32
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
33
33
|
const path = this.isServerSide ? `${this.apiPrefix}` : `${this.apiPrefix}/me`;
|
|
34
|
-
|
|
34
|
+
_chunkFQV77LH4cjs.walletsLogger.info("wallets.api.createWallet", {
|
|
35
35
|
chainType: params.chainType,
|
|
36
36
|
walletType: params.type
|
|
37
37
|
});
|
|
@@ -41,12 +41,12 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
41
41
|
});
|
|
42
42
|
const result = yield response.json();
|
|
43
43
|
if ("error" in result) {
|
|
44
|
-
|
|
44
|
+
_chunkFQV77LH4cjs.walletsLogger.error("wallets.api.createWallet.error", {
|
|
45
45
|
error: result.error,
|
|
46
46
|
chainType: params.chainType
|
|
47
47
|
});
|
|
48
48
|
} else if ("address" in result) {
|
|
49
|
-
|
|
49
|
+
_chunkFQV77LH4cjs.walletsLogger.info("wallets.api.createWallet.success", {
|
|
50
50
|
address: result.address,
|
|
51
51
|
chainType: params.chainType
|
|
52
52
|
});
|
|
@@ -56,18 +56,18 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
56
56
|
}
|
|
57
57
|
getWallet(locator) {
|
|
58
58
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
59
|
-
|
|
59
|
+
_chunkFQV77LH4cjs.walletsLogger.info("wallets.api.getWallet", { locator });
|
|
60
60
|
const response = yield this.get(`${this.apiPrefix}/${locator}`, {
|
|
61
61
|
headers: this.headers
|
|
62
62
|
});
|
|
63
63
|
const result = yield response.json();
|
|
64
64
|
if ("error" in result) {
|
|
65
|
-
|
|
65
|
+
_chunkFQV77LH4cjs.walletsLogger.warn("wallets.api.getWallet.error", {
|
|
66
66
|
locator,
|
|
67
67
|
error: result.error
|
|
68
68
|
});
|
|
69
69
|
} else if ("address" in result) {
|
|
70
|
-
|
|
70
|
+
_chunkFQV77LH4cjs.walletsLogger.info("wallets.api.getWallet.success", result);
|
|
71
71
|
}
|
|
72
72
|
return result;
|
|
73
73
|
});
|
|
@@ -200,7 +200,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
200
200
|
}
|
|
201
201
|
send(walletLocator, tokenLocator, params) {
|
|
202
202
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
203
|
-
|
|
203
|
+
_chunkFQV77LH4cjs.walletsLogger.info("wallets.api.send", {
|
|
204
204
|
walletLocator,
|
|
205
205
|
tokenLocator,
|
|
206
206
|
recipient: params.recipient
|
|
@@ -211,13 +211,13 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
211
211
|
});
|
|
212
212
|
const result = yield response.json();
|
|
213
213
|
if ("error" in result) {
|
|
214
|
-
|
|
214
|
+
_chunkFQV77LH4cjs.walletsLogger.error("wallets.api.send.error", {
|
|
215
215
|
walletLocator,
|
|
216
216
|
tokenLocator,
|
|
217
217
|
error: result.error
|
|
218
218
|
});
|
|
219
219
|
} else if ("id" in result) {
|
|
220
|
-
|
|
220
|
+
_chunkFQV77LH4cjs.walletsLogger.info("wallets.api.send.success", {
|
|
221
221
|
walletLocator,
|
|
222
222
|
transactionId: result.id
|
|
223
223
|
});
|
|
@@ -144,7 +144,15 @@ function toViemChain(chain) {
|
|
|
144
144
|
throw new Error(`Unknown chain: ${chain}`);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
|
+
function isTestnetChain(chain) {
|
|
148
|
+
return TESTNET_AA_CHAINS.includes(chain);
|
|
149
|
+
}
|
|
150
|
+
function isMainnetChain(chain) {
|
|
151
|
+
return PRODUCTION_AA_CHAINS.includes(chain);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
147
155
|
|
|
148
156
|
|
|
149
157
|
|
|
150
|
-
exports.toViemChain = toViemChain;
|
|
158
|
+
exports.toViemChain = toViemChain; exports.isTestnetChain = isTestnetChain; exports.isMainnetChain = isMainnetChain;
|