@crossmint/wallets-sdk 0.19.0 → 0.20.1
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 +35 -35
- package/dist/api/gen/types.gen.d.ts +35 -35
- package/dist/api/index.cjs +5 -5
- package/dist/api/index.js +4 -4
- package/dist/chains/chains.cjs +12 -3
- package/dist/chains/chains.d.cts +14 -2
- package/dist/chains/chains.d.ts +14 -2
- package/dist/chains/chains.js +13 -4
- package/dist/chains/definitions/tempo.cjs +7 -0
- package/dist/chains/definitions/tempo.d.cts +39 -0
- package/dist/chains/definitions/tempo.d.ts +39 -0
- package/dist/chains/definitions/tempo.js +7 -0
- package/dist/chains/definitions/tempoTestnet.cjs +2 -2
- package/dist/chains/definitions/tempoTestnet.d.cts +5 -9
- package/dist/chains/definitions/tempoTestnet.d.ts +5 -9
- package/dist/chains/definitions/tempoTestnet.js +1 -1
- package/dist/{chunk-REP547HH.cjs → chunk-3ASKCQJN.cjs} +18 -18
- package/dist/{chunk-N65K6TUY.js → chunk-3G4P2NHM.js} +2 -2
- package/dist/{chunk-W3OYA42M.js → chunk-3KEY2NLC.js} +1 -1
- package/dist/{chunk-ETCH6L2Y.js → chunk-3SYMIYEW.js} +5 -5
- package/dist/{chunk-XQSMZXBR.cjs → chunk-3WF7K4KF.cjs} +24 -24
- package/dist/chunk-7USEVMTW.cjs +21 -0
- package/dist/{chunk-VNPL3HFN.cjs → chunk-AEGU53OM.cjs} +6 -6
- package/dist/{chunk-7NKX266V.js → chunk-AYE7XUR2.js} +11 -33
- package/dist/{chunk-BBYNVHFR.js → chunk-DENEF27X.js} +3 -3
- package/dist/{chunk-XEZBA7I2.js → chunk-DPZIHSN7.js} +19 -6
- package/dist/{chunk-S2AKC2CK.js → chunk-DZ6MCPD3.js} +1 -1
- package/dist/{chunk-6H6ZBJC2.cjs → chunk-F7L2TZ3I.cjs} +5 -9
- package/dist/{chunk-XSMIDXUA.js → chunk-FGGGBNUF.js} +68 -3
- package/dist/{chunk-DIM3X4IX.cjs → chunk-H3XAAMD3.cjs} +68 -3
- package/dist/{chunk-5CBGJLA4.cjs → chunk-HH3MM7IJ.cjs} +1 -1
- package/dist/{chunk-57HPJVTI.js → chunk-IBV7DELQ.js} +5 -5
- package/dist/{chunk-SUJQZWLJ.js → chunk-J45OIOTF.js} +2 -2
- package/dist/{chunk-IZJUOXOZ.js → chunk-JWMQALLN.js} +5 -9
- package/dist/{chunk-6EP3PLGP.js → chunk-KD6N62YZ.js} +2 -2
- package/dist/{chunk-VWENCGQO.cjs → chunk-KN3AKBVY.cjs} +6 -6
- package/dist/{chunk-JLW3Q65G.cjs → chunk-LONKAMXJ.cjs} +6 -6
- package/dist/{chunk-YFOUZXSM.cjs → chunk-LPR7BODP.cjs} +6 -6
- package/dist/chunk-MMISP35W.js +21 -0
- package/dist/{chunk-C5F6IECX.cjs → chunk-NFV5K2D2.cjs} +12 -12
- package/dist/{chunk-KE6LX37B.js → chunk-NPTNXK47.js} +1 -1
- package/dist/{chunk-YXFIZNFL.cjs → chunk-O42BRSEX.cjs} +9 -9
- package/dist/{chunk-NXST74TX.cjs → chunk-SJSXTTSY.cjs} +58 -45
- package/dist/{chunk-FQV77LH4.cjs → chunk-TC6ITDWV.cjs} +3 -3
- package/dist/{chunk-7EZZGCYI.js → chunk-TPW2OJIB.js} +2 -2
- package/dist/{chunk-L5IMC3NM.js → chunk-TYRXXYHP.js} +2 -2
- package/dist/{chunk-TCNXKNBQ.cjs → chunk-XMVAZ7EW.cjs} +7 -7
- package/dist/{chunk-YF4DYTBM.js → chunk-XTKNO44C.js} +2 -2
- package/dist/{chunk-EIZVQAZO.cjs → chunk-Y35UJFTB.cjs} +24 -46
- package/dist/{chunk-JZQYCISB.cjs → chunk-ZZLEVK2P.cjs} +9 -9
- package/dist/index.cjs +19 -18
- package/dist/index.js +18 -17
- 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 +16 -15
- package/dist/sdk.js +15 -14
- package/dist/signers/index.cjs +8 -8
- package/dist/signers/index.d.cts +1 -1
- package/dist/signers/index.d.ts +1 -1
- package/dist/signers/index.js +7 -7
- package/dist/signers/non-custodial/index.cjs +7 -7
- package/dist/signers/non-custodial/index.js +8 -8
- 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 +14 -8
- package/dist/wallets/__tests__/test-helpers.js +13 -7
- package/dist/wallets/evm.cjs +13 -12
- package/dist/wallets/evm.js +12 -11
- package/dist/wallets/solana.cjs +15 -9
- package/dist/wallets/solana.d.cts +1 -1
- package/dist/wallets/solana.d.ts +1 -1
- package/dist/wallets/solana.js +14 -8
- package/dist/wallets/stellar.cjs +15 -9
- package/dist/wallets/stellar.d.cts +1 -1
- package/dist/wallets/stellar.d.ts +1 -1
- package/dist/wallets/stellar.js +14 -8
- package/dist/wallets/types.d.cts +1 -1
- package/dist/wallets/types.d.ts +1 -1
- package/dist/wallets/wallet-factory.cjs +14 -13
- package/dist/wallets/wallet-factory.d.cts +0 -1
- package/dist/wallets/wallet-factory.d.ts +0 -1
- package/dist/wallets/wallet-factory.js +13 -12
- package/dist/wallets/wallet.cjs +14 -8
- package/dist/wallets/wallet.d.cts +1 -0
- package/dist/wallets/wallet.d.ts +1 -0
- package/dist/wallets/wallet.js +13 -7
- package/package.json +7 -7
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/chains/definitions/tempo.ts
|
|
2
|
+
var _viem = require('viem');
|
|
3
|
+
var tempo = _viem.defineChain.call(void 0, {
|
|
4
|
+
id: 4217,
|
|
5
|
+
name: "Tempo",
|
|
6
|
+
nativeCurrency: void 0,
|
|
7
|
+
rpcUrls: {
|
|
8
|
+
default: { http: ["https://rpc.tempo.xyz"] }
|
|
9
|
+
},
|
|
10
|
+
blockExplorers: {
|
|
11
|
+
default: {
|
|
12
|
+
name: "Tempo Explorer",
|
|
13
|
+
url: "https://explore.mainnet.tempo.xyz"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
testnet: false
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
exports.tempo = tempo;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk3ASKCQJNcjs = require('./chunk-3ASKCQJN.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTC6ITDWVcjs = require('./chunk-TC6ITDWV.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -12,7 +12,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
12
12
|
// src/signers/non-custodial/ncs-evm-signer.ts
|
|
13
13
|
var _ox = require('ox');
|
|
14
14
|
var _viem = require('viem');
|
|
15
|
-
var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends
|
|
15
|
+
var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends _chunk3ASKCQJNcjs.NonCustodialSigner {
|
|
16
16
|
constructor(config) {
|
|
17
17
|
super(config);
|
|
18
18
|
}
|
|
@@ -34,7 +34,7 @@ var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends _chunkREP547HHc
|
|
|
34
34
|
yield this.handleAuthRequired();
|
|
35
35
|
const jwt = this.getJwtOrThrow();
|
|
36
36
|
const hexString = raw.replace("0x", "");
|
|
37
|
-
|
|
37
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("sign: sending request", { keyType: "secp256k1" });
|
|
38
38
|
const startTime = Date.now();
|
|
39
39
|
const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
|
|
40
40
|
event: "request:sign",
|
|
@@ -50,9 +50,9 @@ var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends _chunkREP547HHc
|
|
|
50
50
|
encoding: "hex"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
options:
|
|
53
|
+
options: _chunk3ASKCQJNcjs.DEFAULT_EVENT_OPTIONS
|
|
54
54
|
});
|
|
55
|
-
|
|
55
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("sign: response received", {
|
|
56
56
|
status: res == null ? void 0 : res.status,
|
|
57
57
|
durationMs: Date.now() - startTime
|
|
58
58
|
});
|
|
@@ -4,29 +4,29 @@ import {
|
|
|
4
4
|
} from "./chunk-ZP4ZZCIE.js";
|
|
5
5
|
import {
|
|
6
6
|
Wallet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DPZIHSN7.js";
|
|
8
8
|
import {
|
|
9
9
|
assembleSigner
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3SYMIYEW.js";
|
|
11
|
+
import {
|
|
12
|
+
validateChainForEnvironment
|
|
13
|
+
} from "./chunk-FGGGBNUF.js";
|
|
11
14
|
import {
|
|
12
15
|
WalletCreationError,
|
|
13
16
|
WalletNotAvailableError
|
|
14
17
|
} from "./chunk-SGINWAB6.js";
|
|
15
|
-
import {
|
|
16
|
-
isMainnetChain,
|
|
17
|
-
isTestnetChain
|
|
18
|
-
} from "./chunk-XSMIDXUA.js";
|
|
19
18
|
import {
|
|
20
19
|
walletsLogger
|
|
21
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
22
21
|
import {
|
|
23
22
|
__async,
|
|
24
23
|
__decorateClass,
|
|
24
|
+
__spreadProps,
|
|
25
25
|
__spreadValues
|
|
26
26
|
} from "./chunk-ASE2FXWP.js";
|
|
27
27
|
|
|
28
28
|
// src/wallets/wallet-factory.ts
|
|
29
|
-
import { WithLoggerContext
|
|
29
|
+
import { WithLoggerContext } from "@crossmint/common-sdk-base";
|
|
30
30
|
import { WebAuthnP256 } from "ox";
|
|
31
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.";
|
|
32
32
|
var WalletFactory = class {
|
|
@@ -43,7 +43,7 @@ var WalletFactory = class {
|
|
|
43
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)."
|
|
44
44
|
);
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
args = __spreadProps(__spreadValues({}, args), { chain: validateChainForEnvironment(args.chain, this.apiClient.environment) });
|
|
47
47
|
const locator = this.getWalletLocator(args);
|
|
48
48
|
walletsLogger.info("walletFactory.getOrCreateWallet.start");
|
|
49
49
|
const existingWallet = yield this.apiClient.getWallet(locator);
|
|
@@ -65,7 +65,7 @@ var WalletFactory = class {
|
|
|
65
65
|
});
|
|
66
66
|
throw new WalletCreationError("getWallet is not supported on client side, use getOrCreateWallet instead");
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
args = __spreadProps(__spreadValues({}, args), { chain: validateChainForEnvironment(args.chain, this.apiClient.environment) });
|
|
69
69
|
walletsLogger.info("walletFactory.getWallet.start");
|
|
70
70
|
const existingWallet = yield this.apiClient.getWallet(walletLocator);
|
|
71
71
|
if ("error" in existingWallet) {
|
|
@@ -82,7 +82,7 @@ var WalletFactory = class {
|
|
|
82
82
|
}
|
|
83
83
|
createWallet(args) {
|
|
84
84
|
return __async(this, null, function* () {
|
|
85
|
-
|
|
85
|
+
args = __spreadProps(__spreadValues({}, args), { chain: validateChainForEnvironment(args.chain, this.apiClient.environment) });
|
|
86
86
|
return this.createWalletInternal(args);
|
|
87
87
|
});
|
|
88
88
|
}
|
|
@@ -298,28 +298,6 @@ var WalletFactory = class {
|
|
|
298
298
|
}
|
|
299
299
|
return "evm";
|
|
300
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
|
-
}
|
|
323
301
|
};
|
|
324
302
|
__decorateClass([
|
|
325
303
|
WithLoggerContext({
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WalletFactory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AYE7XUR2.js";
|
|
4
4
|
import {
|
|
5
5
|
ApiClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KD6N62YZ.js";
|
|
7
7
|
import {
|
|
8
8
|
initWalletsLogger,
|
|
9
9
|
walletsLogger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
11
11
|
import {
|
|
12
12
|
__async
|
|
13
13
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NonCustodialSigner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3KEY2NLC.js";
|
|
4
|
+
import {
|
|
5
|
+
validateChainForEnvironment
|
|
6
|
+
} from "./chunk-FGGGBNUF.js";
|
|
4
7
|
import {
|
|
5
8
|
InvalidSignerError,
|
|
6
9
|
SignatureFailedError,
|
|
@@ -18,10 +21,10 @@ import {
|
|
|
18
21
|
} from "./chunk-SGINWAB6.js";
|
|
19
22
|
import {
|
|
20
23
|
walletsLogger
|
|
21
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
22
25
|
import {
|
|
23
26
|
STATUS_POLLING_INTERVAL_MS
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-NPTNXK47.js";
|
|
25
28
|
import {
|
|
26
29
|
__async,
|
|
27
30
|
__decorateClass,
|
|
@@ -71,6 +74,7 @@ var Wallet = class {
|
|
|
71
74
|
balances(tokens) {
|
|
72
75
|
return __async(this, null, function* () {
|
|
73
76
|
walletsLogger.info("wallet.balances.start");
|
|
77
|
+
const resolvedChain = this.resolveChainForEnvironment();
|
|
74
78
|
let nativeToken;
|
|
75
79
|
switch (this.chain) {
|
|
76
80
|
case "solana":
|
|
@@ -85,7 +89,7 @@ var Wallet = class {
|
|
|
85
89
|
}
|
|
86
90
|
const allTokens = [nativeToken, "usdc", ...tokens != null ? tokens : []];
|
|
87
91
|
const response = yield __privateGet(this, _apiClient).getBalance(this.address, {
|
|
88
|
-
chains: [
|
|
92
|
+
chains: [resolvedChain],
|
|
89
93
|
tokens: allTokens
|
|
90
94
|
});
|
|
91
95
|
if ("error" in response) {
|
|
@@ -227,7 +231,8 @@ var Wallet = class {
|
|
|
227
231
|
*/
|
|
228
232
|
experimental_activity() {
|
|
229
233
|
return __async(this, null, function* () {
|
|
230
|
-
const
|
|
234
|
+
const resolvedChain = this.resolveChainForEnvironment();
|
|
235
|
+
const response = yield this.apiClient.experimental_activity(this.walletLocator, { chain: resolvedChain });
|
|
231
236
|
if ("error" in response) {
|
|
232
237
|
throw new Error(`Failed to get activity: ${JSON.stringify(response.message)}`);
|
|
233
238
|
}
|
|
@@ -236,8 +241,9 @@ var Wallet = class {
|
|
|
236
241
|
}
|
|
237
242
|
send(to, token, amount, options) {
|
|
238
243
|
return __async(this, null, function* () {
|
|
244
|
+
const resolvedChain = this.resolveChainForEnvironment();
|
|
239
245
|
const recipient = toRecipientLocator(to);
|
|
240
|
-
const tokenLocator = toTokenLocator(token,
|
|
246
|
+
const tokenLocator = toTokenLocator(token, resolvedChain);
|
|
241
247
|
walletsLogger.info("wallet.send.start", __spreadValues({
|
|
242
248
|
recipient,
|
|
243
249
|
token: tokenLocator,
|
|
@@ -449,6 +455,13 @@ var Wallet = class {
|
|
|
449
455
|
get isSolanaWallet() {
|
|
450
456
|
return this.chain === "solana";
|
|
451
457
|
}
|
|
458
|
+
resolveChainForEnvironment() {
|
|
459
|
+
const resolvedChain = validateChainForEnvironment(this.chain, __privateGet(this, _apiClient).environment);
|
|
460
|
+
if (resolvedChain !== this.chain) {
|
|
461
|
+
this.chain = resolvedChain;
|
|
462
|
+
}
|
|
463
|
+
return this.chain;
|
|
464
|
+
}
|
|
452
465
|
approveTransactionAndWait(transactionId, options) {
|
|
453
466
|
return __async(this, null, function* () {
|
|
454
467
|
yield this.approveTransactionInternal(transactionId, options);
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/chains/definitions/tempoTestnet.ts
|
|
2
2
|
var _viem = require('viem');
|
|
3
3
|
var tempoTestnet = _viem.defineChain.call(void 0, {
|
|
4
|
-
id:
|
|
4
|
+
id: 42431,
|
|
5
5
|
name: "Tempo Testnet",
|
|
6
|
-
nativeCurrency:
|
|
7
|
-
decimals: 6,
|
|
8
|
-
name: "pathUSD",
|
|
9
|
-
symbol: "pathUSD"
|
|
10
|
-
},
|
|
6
|
+
nativeCurrency: void 0,
|
|
11
7
|
rpcUrls: {
|
|
12
|
-
default: { http: ["https://rpc.
|
|
8
|
+
default: { http: ["https://rpc.moderato.tempo.xyz"] }
|
|
13
9
|
},
|
|
14
10
|
blockExplorers: {
|
|
15
11
|
default: {
|
|
16
|
-
name: "Tempo
|
|
17
|
-
url: "https://
|
|
12
|
+
name: "Tempo Explorer",
|
|
13
|
+
url: "https://explore.tempo.xyz"
|
|
18
14
|
}
|
|
19
15
|
},
|
|
20
16
|
testnet: true
|
|
@@ -4,15 +4,24 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
storyTestnet
|
|
6
6
|
} from "./chunk-3U6UAYOV.js";
|
|
7
|
+
import {
|
|
8
|
+
tempo
|
|
9
|
+
} from "./chunk-MMISP35W.js";
|
|
7
10
|
import {
|
|
8
11
|
tempoTestnet
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JWMQALLN.js";
|
|
10
13
|
import {
|
|
11
14
|
arcTestnet
|
|
12
15
|
} from "./chunk-ZBLW42YE.js";
|
|
16
|
+
import {
|
|
17
|
+
InvalidEnvironmentError
|
|
18
|
+
} from "./chunk-SGINWAB6.js";
|
|
19
|
+
import {
|
|
20
|
+
walletsLogger
|
|
21
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
13
22
|
|
|
14
23
|
// src/chains/chains.ts
|
|
15
|
-
import { BlockchainIncludingTestnet as Blockchain } from "@crossmint/common-sdk-base";
|
|
24
|
+
import { APIKeyEnvironmentPrefix, BlockchainIncludingTestnet as Blockchain } from "@crossmint/common-sdk-base";
|
|
16
25
|
import {
|
|
17
26
|
baseSepolia,
|
|
18
27
|
base,
|
|
@@ -72,6 +81,7 @@ var PRODUCTION_AA_CHAINS = [
|
|
|
72
81
|
Blockchain.SEI_PACIFIC_1,
|
|
73
82
|
Blockchain.SHAPE,
|
|
74
83
|
Blockchain.STORY,
|
|
84
|
+
Blockchain.TEMPO,
|
|
75
85
|
Blockchain.WORLDCHAIN,
|
|
76
86
|
Blockchain.ZORA
|
|
77
87
|
];
|
|
@@ -123,6 +133,8 @@ function toViemChain(chain) {
|
|
|
123
133
|
return plume;
|
|
124
134
|
case Blockchain.ARC_TESTNET:
|
|
125
135
|
return arcTestnet;
|
|
136
|
+
case Blockchain.TEMPO:
|
|
137
|
+
return tempo;
|
|
126
138
|
case Blockchain.TEMPO_TESTNET:
|
|
127
139
|
return tempoTestnet;
|
|
128
140
|
case Blockchain.ABSTRACT:
|
|
@@ -150,9 +162,62 @@ function isTestnetChain(chain) {
|
|
|
150
162
|
function isMainnetChain(chain) {
|
|
151
163
|
return PRODUCTION_AA_CHAINS.includes(chain);
|
|
152
164
|
}
|
|
165
|
+
var MAINNET_TO_TESTNET_MAP = {
|
|
166
|
+
[Blockchain.ABSTRACT]: Blockchain.ABSTRACT_TESTNET,
|
|
167
|
+
[Blockchain.APECHAIN]: Blockchain.CURTIS,
|
|
168
|
+
[Blockchain.ARBITRUM]: Blockchain.ARBITRUM_SEPOLIA,
|
|
169
|
+
[Blockchain.BASE]: Blockchain.BASE_SEPOLIA,
|
|
170
|
+
[Blockchain.FLOW]: Blockchain.FLOW_TESTNET,
|
|
171
|
+
[Blockchain.MANTLE]: Blockchain.MANTLE_SEPOLIA,
|
|
172
|
+
[Blockchain.MODE]: Blockchain.MODE_SEPOLIA,
|
|
173
|
+
[Blockchain.OPTIMISM]: Blockchain.OPTIMISM_SEPOLIA,
|
|
174
|
+
[Blockchain.PLUME]: Blockchain.PLUME_TESTNET,
|
|
175
|
+
[Blockchain.POLYGON]: Blockchain.POLYGON_AMOY,
|
|
176
|
+
[Blockchain.SCROLL]: Blockchain.SCROLL_SEPOLIA,
|
|
177
|
+
[Blockchain.SEI_PACIFIC_1]: Blockchain.SEI_ATLANTIC_2_TESTNET,
|
|
178
|
+
[Blockchain.STORY]: Blockchain.STORY_TESTNET,
|
|
179
|
+
[Blockchain.WORLDCHAIN]: Blockchain.WORLD_CHAIN_SEPOLIA,
|
|
180
|
+
[Blockchain.ZORA]: Blockchain.ZORA_SEPOLIA,
|
|
181
|
+
[Blockchain.TEMPO]: Blockchain.TEMPO_TESTNET
|
|
182
|
+
};
|
|
183
|
+
function mainnetToTestnet(chain) {
|
|
184
|
+
return MAINNET_TO_TESTNET_MAP[chain];
|
|
185
|
+
}
|
|
186
|
+
function validateChainForEnvironment(chain, environment) {
|
|
187
|
+
if (chain === "solana" || chain === "stellar") {
|
|
188
|
+
return chain;
|
|
189
|
+
}
|
|
190
|
+
const evmChain = chain;
|
|
191
|
+
const isProductionEnv = environment === APIKeyEnvironmentPrefix.PRODUCTION;
|
|
192
|
+
if (isProductionEnv && isTestnetChain(evmChain)) {
|
|
193
|
+
throw new InvalidEnvironmentError(
|
|
194
|
+
`Chain "${chain}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
if (!isProductionEnv && isMainnetChain(evmChain)) {
|
|
198
|
+
const testnetEquivalent = mainnetToTestnet(evmChain);
|
|
199
|
+
if (testnetEquivalent != null) {
|
|
200
|
+
walletsLogger.debug("validateChainForEnvironment.autoConverted", {
|
|
201
|
+
chain,
|
|
202
|
+
convertedTo: testnetEquivalent,
|
|
203
|
+
environment,
|
|
204
|
+
message: `Chain "${chain}" is a mainnet chain and cannot be used in ${environment} environment. Automatically converted to "${testnetEquivalent}".`
|
|
205
|
+
});
|
|
206
|
+
return testnetEquivalent;
|
|
207
|
+
}
|
|
208
|
+
walletsLogger.debug("validateChainForEnvironment.mismatch", {
|
|
209
|
+
chain,
|
|
210
|
+
environment,
|
|
211
|
+
message: `Chain "${chain}" is a mainnet chain and should not be used in ${environment} environment. No testnet equivalent is available. Please use a testnet chain instead.`
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return chain;
|
|
215
|
+
}
|
|
153
216
|
|
|
154
217
|
export {
|
|
155
218
|
toViemChain,
|
|
156
219
|
isTestnetChain,
|
|
157
|
-
isMainnetChain
|
|
220
|
+
isMainnetChain,
|
|
221
|
+
mainnetToTestnet,
|
|
222
|
+
validateChainForEnvironment
|
|
158
223
|
};
|
|
@@ -6,11 +6,20 @@ var _chunkNIBKCMQ2cjs = require('./chunk-NIBKCMQ2.cjs');
|
|
|
6
6
|
var _chunk55V4VMTXcjs = require('./chunk-55V4VMTX.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk7USEVMTWcjs = require('./chunk-7USEVMTW.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkF7L2TZ3Icjs = require('./chunk-F7L2TZ3I.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
var _chunkHTSQPZHWcjs = require('./chunk-HTSQPZHW.cjs');
|
|
13
16
|
|
|
17
|
+
|
|
18
|
+
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
var _chunkTC6ITDWVcjs = require('./chunk-TC6ITDWV.cjs');
|
|
22
|
+
|
|
14
23
|
// src/chains/chains.ts
|
|
15
24
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
16
25
|
|
|
@@ -72,6 +81,7 @@ var PRODUCTION_AA_CHAINS = [
|
|
|
72
81
|
_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,
|
|
73
82
|
_commonsdkbase.BlockchainIncludingTestnet.SHAPE,
|
|
74
83
|
_commonsdkbase.BlockchainIncludingTestnet.STORY,
|
|
84
|
+
_commonsdkbase.BlockchainIncludingTestnet.TEMPO,
|
|
75
85
|
_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,
|
|
76
86
|
_commonsdkbase.BlockchainIncludingTestnet.ZORA
|
|
77
87
|
];
|
|
@@ -123,8 +133,10 @@ function toViemChain(chain) {
|
|
|
123
133
|
return _chains.plume;
|
|
124
134
|
case _commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET:
|
|
125
135
|
return _chunkHTSQPZHWcjs.arcTestnet;
|
|
136
|
+
case _commonsdkbase.BlockchainIncludingTestnet.TEMPO:
|
|
137
|
+
return _chunk7USEVMTWcjs.tempo;
|
|
126
138
|
case _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET:
|
|
127
|
-
return
|
|
139
|
+
return _chunkF7L2TZ3Icjs.tempoTestnet;
|
|
128
140
|
case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:
|
|
129
141
|
case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:
|
|
130
142
|
case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:
|
|
@@ -150,9 +162,62 @@ function isTestnetChain(chain) {
|
|
|
150
162
|
function isMainnetChain(chain) {
|
|
151
163
|
return PRODUCTION_AA_CHAINS.includes(chain);
|
|
152
164
|
}
|
|
165
|
+
var MAINNET_TO_TESTNET_MAP = {
|
|
166
|
+
[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]: _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,
|
|
167
|
+
[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]: _commonsdkbase.BlockchainIncludingTestnet.CURTIS,
|
|
168
|
+
[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]: _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,
|
|
169
|
+
[_commonsdkbase.BlockchainIncludingTestnet.BASE]: _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,
|
|
170
|
+
[_commonsdkbase.BlockchainIncludingTestnet.FLOW]: _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,
|
|
171
|
+
[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]: _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,
|
|
172
|
+
[_commonsdkbase.BlockchainIncludingTestnet.MODE]: _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,
|
|
173
|
+
[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]: _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,
|
|
174
|
+
[_commonsdkbase.BlockchainIncludingTestnet.PLUME]: _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,
|
|
175
|
+
[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]: _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,
|
|
176
|
+
[_commonsdkbase.BlockchainIncludingTestnet.SCROLL]: _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,
|
|
177
|
+
[_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1]: _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,
|
|
178
|
+
[_commonsdkbase.BlockchainIncludingTestnet.STORY]: _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,
|
|
179
|
+
[_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN]: _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,
|
|
180
|
+
[_commonsdkbase.BlockchainIncludingTestnet.ZORA]: _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,
|
|
181
|
+
[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]: _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET
|
|
182
|
+
};
|
|
183
|
+
function mainnetToTestnet(chain) {
|
|
184
|
+
return MAINNET_TO_TESTNET_MAP[chain];
|
|
185
|
+
}
|
|
186
|
+
function validateChainForEnvironment(chain, environment) {
|
|
187
|
+
if (chain === "solana" || chain === "stellar") {
|
|
188
|
+
return chain;
|
|
189
|
+
}
|
|
190
|
+
const evmChain = chain;
|
|
191
|
+
const isProductionEnv = environment === _commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;
|
|
192
|
+
if (isProductionEnv && isTestnetChain(evmChain)) {
|
|
193
|
+
throw new (0, _chunkXC2V34TScjs.InvalidEnvironmentError)(
|
|
194
|
+
`Chain "${chain}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
if (!isProductionEnv && isMainnetChain(evmChain)) {
|
|
198
|
+
const testnetEquivalent = mainnetToTestnet(evmChain);
|
|
199
|
+
if (testnetEquivalent != null) {
|
|
200
|
+
_chunkTC6ITDWVcjs.walletsLogger.debug("validateChainForEnvironment.autoConverted", {
|
|
201
|
+
chain,
|
|
202
|
+
convertedTo: testnetEquivalent,
|
|
203
|
+
environment,
|
|
204
|
+
message: `Chain "${chain}" is a mainnet chain and cannot be used in ${environment} environment. Automatically converted to "${testnetEquivalent}".`
|
|
205
|
+
});
|
|
206
|
+
return testnetEquivalent;
|
|
207
|
+
}
|
|
208
|
+
_chunkTC6ITDWVcjs.walletsLogger.debug("validateChainForEnvironment.mismatch", {
|
|
209
|
+
chain,
|
|
210
|
+
environment,
|
|
211
|
+
message: `Chain "${chain}" is a mainnet chain and should not be used in ${environment} environment. No testnet equivalent is available. Please use a testnet chain instead.`
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return chain;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
|
|
153
218
|
|
|
154
219
|
|
|
155
220
|
|
|
156
221
|
|
|
157
222
|
|
|
158
|
-
exports.toViemChain = toViemChain; exports.isTestnetChain = isTestnetChain; exports.isMainnetChain = isMainnetChain;
|
|
223
|
+
exports.toViemChain = toViemChain; exports.isTestnetChain = isTestnetChain; exports.isMainnetChain = isMainnetChain; exports.mainnetToTestnet = mainnetToTestnet; exports.validateChainForEnvironment = validateChainForEnvironment;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DPZIHSN7.js";
|
|
4
|
+
import {
|
|
5
|
+
toViemChain
|
|
6
|
+
} from "./chunk-FGGGBNUF.js";
|
|
4
7
|
import {
|
|
5
8
|
InvalidTypedDataError,
|
|
6
9
|
SignatureNotCreatedError,
|
|
7
10
|
TransactionNotCreatedError
|
|
8
11
|
} from "./chunk-SGINWAB6.js";
|
|
9
|
-
import {
|
|
10
|
-
toViemChain
|
|
11
|
-
} from "./chunk-XSMIDXUA.js";
|
|
12
12
|
import {
|
|
13
13
|
walletsLogger
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
15
15
|
import {
|
|
16
16
|
__async,
|
|
17
17
|
__decorateClass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DPZIHSN7.js";
|
|
4
4
|
import {
|
|
5
5
|
SolanaExternalWalletSigner
|
|
6
6
|
} from "./chunk-PIFD6KNH.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-SGINWAB6.js";
|
|
10
10
|
import {
|
|
11
11
|
walletsLogger
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
13
13
|
import {
|
|
14
14
|
__async,
|
|
15
15
|
__decorateClass
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
// src/chains/definitions/tempoTestnet.ts
|
|
2
2
|
import { defineChain } from "viem";
|
|
3
3
|
var tempoTestnet = defineChain({
|
|
4
|
-
id:
|
|
4
|
+
id: 42431,
|
|
5
5
|
name: "Tempo Testnet",
|
|
6
|
-
nativeCurrency:
|
|
7
|
-
decimals: 6,
|
|
8
|
-
name: "pathUSD",
|
|
9
|
-
symbol: "pathUSD"
|
|
10
|
-
},
|
|
6
|
+
nativeCurrency: void 0,
|
|
11
7
|
rpcUrls: {
|
|
12
|
-
default: { http: ["https://rpc.
|
|
8
|
+
default: { http: ["https://rpc.moderato.tempo.xyz"] }
|
|
13
9
|
},
|
|
14
10
|
blockExplorers: {
|
|
15
11
|
default: {
|
|
16
|
-
name: "Tempo
|
|
17
|
-
url: "https://
|
|
12
|
+
name: "Tempo Explorer",
|
|
13
|
+
url: "https://explore.tempo.xyz"
|
|
18
14
|
}
|
|
19
15
|
},
|
|
20
16
|
testnet: true
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
} from "./chunk-SGINWAB6.js";
|
|
4
4
|
import {
|
|
5
5
|
walletsLogger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
7
7
|
import {
|
|
8
8
|
SDK_NAME,
|
|
9
9
|
SDK_VERSION
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NPTNXK47.js";
|
|
11
11
|
import {
|
|
12
12
|
__async
|
|
13
13
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk3ASKCQJNcjs = require('./chunk-3ASKCQJN.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTC6ITDWVcjs = require('./chunk-TC6ITDWV.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -12,7 +12,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
12
12
|
// src/signers/non-custodial/ncs-solana-signer.ts
|
|
13
13
|
var _web3js = require('@solana/web3.js');
|
|
14
14
|
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
15
|
-
var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends
|
|
15
|
+
var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunk3ASKCQJNcjs.NonCustodialSigner {
|
|
16
16
|
constructor(config) {
|
|
17
17
|
super(config);
|
|
18
18
|
}
|
|
@@ -29,7 +29,7 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkREP
|
|
|
29
29
|
const transactionBytes = _bs582.default.decode(transaction);
|
|
30
30
|
const deserializedTransaction = _web3js.VersionedTransaction.deserialize(transactionBytes);
|
|
31
31
|
const messageData = deserializedTransaction.message.serialize();
|
|
32
|
-
|
|
32
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("sign: sending request", { keyType: "ed25519" });
|
|
33
33
|
const startTime = Date.now();
|
|
34
34
|
const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
|
|
35
35
|
event: "request:sign",
|
|
@@ -45,9 +45,9 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkREP
|
|
|
45
45
|
encoding: "base58"
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
options:
|
|
48
|
+
options: _chunk3ASKCQJNcjs.DEFAULT_EVENT_OPTIONS
|
|
49
49
|
});
|
|
50
|
-
|
|
50
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("sign: response received", {
|
|
51
51
|
status: res == null ? void 0 : res.status,
|
|
52
52
|
durationMs: Date.now() - startTime
|
|
53
53
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKN3AKBVYcjs = require('./chunk-KN3AKBVY.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkLPR7BODPcjs = require('./chunk-LPR7BODP.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkAEGU53OMcjs = require('./chunk-AEGU53OM.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunkJSWTGW46cjs = require('./chunk-JSWTGW46.cjs');
|
|
@@ -32,12 +32,12 @@ function assembleSigner(chain, config) {
|
|
|
32
32
|
case "email":
|
|
33
33
|
case "phone":
|
|
34
34
|
if (chain === "solana") {
|
|
35
|
-
return new (0,
|
|
35
|
+
return new (0, _chunkKN3AKBVYcjs.SolanaNonCustodialSigner)(config);
|
|
36
36
|
}
|
|
37
37
|
if (chain === "stellar") {
|
|
38
|
-
return new (0,
|
|
38
|
+
return new (0, _chunkLPR7BODPcjs.StellarNonCustodialSigner)(config);
|
|
39
39
|
}
|
|
40
|
-
return new (0,
|
|
40
|
+
return new (0, _chunkAEGU53OMcjs.EVMNonCustodialSigner)(config);
|
|
41
41
|
case "api-key":
|
|
42
42
|
return chain === "solana" ? new (0, _chunkXOCC3MPKcjs.SolanaApiKeySigner)(config) : new (0, _chunkJSWTGW46cjs.EVMApiKeySigner)(config);
|
|
43
43
|
case "external-wallet":
|