@crossmint/wallets-sdk 0.20.1 → 0.20.2
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/index.cjs +4 -4
- package/dist/api/index.js +3 -3
- package/dist/chains/chains.cjs +4 -4
- package/dist/chains/chains.js +3 -3
- package/dist/{chunk-FGGGBNUF.js → chunk-2WBSPOWU.js} +1 -1
- package/dist/{chunk-LONKAMXJ.cjs → chunk-47R3UV3J.cjs} +6 -6
- package/dist/{chunk-Y35UJFTB.cjs → chunk-66UY53KP.cjs} +23 -23
- package/dist/{chunk-ZZLEVK2P.cjs → chunk-6FG5QXII.cjs} +9 -9
- package/dist/{chunk-3G4P2NHM.js → chunk-6UMJYMAY.js} +2 -2
- package/dist/{chunk-KN3AKBVY.cjs → chunk-7TT3VUDF.cjs} +6 -6
- package/dist/{chunk-IBV7DELQ.js → chunk-A6E67ZZP.js} +3 -3
- package/dist/{chunk-DZ6MCPD3.js → chunk-ABMZ3ZVN.js} +1 -1
- package/dist/{chunk-DENEF27X.js → chunk-CMBFV325.js} +3 -3
- package/dist/{chunk-DPZIHSN7.js → chunk-FHMKNG62.js} +4 -4
- package/dist/{chunk-TPW2OJIB.js → chunk-FICVKSXZ.js} +2 -2
- package/dist/{chunk-TYRXXYHP.js → chunk-HXJ3YPAN.js} +2 -2
- package/dist/{chunk-O42BRSEX.cjs → chunk-IDKGJO2G.cjs} +9 -9
- package/dist/{chunk-TC6ITDWV.cjs → chunk-JREZWZ2S.cjs} +3 -3
- package/dist/{chunk-AYE7XUR2.js → chunk-KQH5ZXJ4.js} +4 -4
- package/dist/{chunk-LPR7BODP.cjs → chunk-MRZXYVQO.cjs} +6 -6
- package/dist/{chunk-3WF7K4KF.cjs → chunk-PM7BGATN.cjs} +23 -23
- package/dist/{chunk-SJSXTTSY.cjs → chunk-POG76HDD.cjs} +44 -44
- package/dist/{chunk-XTKNO44C.js → chunk-PUO4QNXH.js} +2 -2
- package/dist/{chunk-HH3MM7IJ.cjs → chunk-R4AW5ADG.cjs} +1 -1
- package/dist/{chunk-XMVAZ7EW.cjs → chunk-R6DH4V7S.cjs} +7 -7
- package/dist/{chunk-NFV5K2D2.cjs → chunk-RYQI3RXL.cjs} +12 -12
- package/dist/{chunk-3SYMIYEW.js → chunk-T2XUADHW.js} +3 -3
- package/dist/{chunk-NPTNXK47.js → chunk-TYQ4YIP7.js} +1 -1
- package/dist/{chunk-3KEY2NLC.js → chunk-U3NV7UY7.js} +1 -1
- package/dist/{chunk-KD6N62YZ.js → chunk-W7K5E64Q.js} +2 -2
- package/dist/{chunk-H3XAAMD3.cjs → chunk-WDZY4PP4.cjs} +3 -3
- package/dist/{chunk-AEGU53OM.cjs → chunk-WHTECI7J.cjs} +6 -6
- package/dist/{chunk-J45OIOTF.js → chunk-WWW6IGZ7.js} +2 -2
- package/dist/{chunk-3ASKCQJN.cjs → chunk-ZAX22GSI.cjs} +18 -18
- 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 +13 -13
- package/dist/sdk.js +12 -12
- 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 +9 -9
- package/dist/wallets/__tests__/test-helpers.js +8 -8
- package/dist/wallets/evm.cjs +10 -10
- package/dist/wallets/evm.js +9 -9
- package/dist/wallets/solana.cjs +10 -10
- package/dist/wallets/solana.js +9 -9
- package/dist/wallets/stellar.cjs +10 -10
- package/dist/wallets/stellar.js +9 -9
- package/dist/wallets/wallet-factory.cjs +11 -11
- package/dist/wallets/wallet-factory.js +10 -10
- package/dist/wallets/wallet.cjs +9 -9
- package/dist/wallets/wallet.js +8 -8
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkR4AW5ADGcjs = require('./chunk-R4AW5ADG.cjs');
|
|
5
5
|
|
|
6
6
|
// src/logger/init.ts
|
|
7
7
|
|
|
@@ -20,8 +20,8 @@ function initWalletsLogger(apiKey) {
|
|
|
20
20
|
}
|
|
21
21
|
const { environment, projectId } = validationResult;
|
|
22
22
|
walletsLogger.init({
|
|
23
|
-
packageName:
|
|
24
|
-
packageVersion:
|
|
23
|
+
packageName: _chunkR4AW5ADGcjs.SDK_NAME,
|
|
24
|
+
packageVersion: _chunkR4AW5ADGcjs.SDK_VERSION,
|
|
25
25
|
environment,
|
|
26
26
|
projectId,
|
|
27
27
|
platform
|
|
@@ -4,20 +4,20 @@ import {
|
|
|
4
4
|
} from "./chunk-ZP4ZZCIE.js";
|
|
5
5
|
import {
|
|
6
6
|
Wallet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FHMKNG62.js";
|
|
8
8
|
import {
|
|
9
9
|
assembleSigner
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-T2XUADHW.js";
|
|
11
11
|
import {
|
|
12
12
|
validateChainForEnvironment
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2WBSPOWU.js";
|
|
14
14
|
import {
|
|
15
15
|
WalletCreationError,
|
|
16
16
|
WalletNotAvailableError
|
|
17
17
|
} from "./chunk-SGINWAB6.js";
|
|
18
18
|
import {
|
|
19
19
|
walletsLogger
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-ABMZ3ZVN.js";
|
|
21
21
|
import {
|
|
22
22
|
__async,
|
|
23
23
|
__decorateClass,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkZAX22GSIcjs = require('./chunk-ZAX22GSI.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
11
11
|
|
|
12
12
|
// src/signers/non-custodial/ncs-stellar-signer.ts
|
|
13
|
-
var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends
|
|
13
|
+
var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkZAX22GSIcjs.NonCustodialSigner {
|
|
14
14
|
constructor(config) {
|
|
15
15
|
super(config);
|
|
16
16
|
}
|
|
@@ -24,7 +24,7 @@ var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunk3
|
|
|
24
24
|
var _a;
|
|
25
25
|
yield this.handleAuthRequired();
|
|
26
26
|
const jwt = this.getJwtOrThrow();
|
|
27
|
-
|
|
27
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("sign: sending request", { keyType: "ed25519" });
|
|
28
28
|
const startTime = Date.now();
|
|
29
29
|
const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
|
|
30
30
|
event: "request:sign",
|
|
@@ -40,9 +40,9 @@ var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunk3
|
|
|
40
40
|
encoding: "base64"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
options:
|
|
43
|
+
options: _chunkZAX22GSIcjs.DEFAULT_EVENT_OPTIONS
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("sign: response received", {
|
|
46
46
|
status: res == null ? void 0 : res.status,
|
|
47
47
|
durationMs: Date.now() - startTime
|
|
48
48
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkPOG76HDDcjs = require('./chunk-POG76HDD.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkWDZY4PP4cjs = require('./chunk-WDZY4PP4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -11,7 +11,7 @@ var _chunkH3XAAMD3cjs = require('./chunk-H3XAAMD3.cjs');
|
|
|
11
11
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -20,7 +20,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
20
20
|
// src/wallets/evm.ts
|
|
21
21
|
var _viem = require('viem');
|
|
22
22
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
23
|
-
var _EVMWallet = class _EVMWallet extends
|
|
23
|
+
var _EVMWallet = class _EVMWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
24
24
|
constructor(wallet) {
|
|
25
25
|
super(
|
|
26
26
|
{
|
|
@@ -28,10 +28,10 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
28
28
|
address: wallet.address,
|
|
29
29
|
owner: wallet.owner,
|
|
30
30
|
signer: wallet.signer,
|
|
31
|
-
options:
|
|
31
|
+
options: _chunkPOG76HDDcjs.Wallet.getOptions(wallet),
|
|
32
32
|
alias: wallet.alias
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
_chunkPOG76HDDcjs.Wallet.getApiClient(wallet)
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
static from(wallet) {
|
|
@@ -43,12 +43,12 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
43
43
|
sendTransaction(params) {
|
|
44
44
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
45
45
|
var _a;
|
|
46
|
-
|
|
46
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.sendTransaction.start");
|
|
47
47
|
yield this.preAuthIfNeeded();
|
|
48
48
|
const builtTransaction = this.buildTransaction(params);
|
|
49
49
|
const createdTransaction = yield this.createTransaction(builtTransaction, params.options);
|
|
50
50
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
51
|
-
|
|
51
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.sendTransaction.prepared", {
|
|
52
52
|
transactionId: createdTransaction.id
|
|
53
53
|
});
|
|
54
54
|
return {
|
|
@@ -58,7 +58,7 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
const result = yield this.approveTransactionAndWait(createdTransaction.id);
|
|
61
|
-
|
|
61
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.sendTransaction.success", {
|
|
62
62
|
transactionId: createdTransaction.id,
|
|
63
63
|
hash: result.hash
|
|
64
64
|
});
|
|
@@ -68,7 +68,7 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
68
68
|
signMessage(params) {
|
|
69
69
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
70
70
|
var _a;
|
|
71
|
-
|
|
71
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signMessage.start");
|
|
72
72
|
yield this.preAuthIfNeeded();
|
|
73
73
|
const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
|
|
74
74
|
type: "message",
|
|
@@ -79,11 +79,11 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
if ("error" in signatureCreationResponse) {
|
|
82
|
-
|
|
82
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signMessage.error", { error: signatureCreationResponse });
|
|
83
83
|
throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
|
|
84
84
|
}
|
|
85
85
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
86
|
-
|
|
86
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signMessage.prepared", {
|
|
87
87
|
signatureId: signatureCreationResponse.id
|
|
88
88
|
});
|
|
89
89
|
return {
|
|
@@ -92,23 +92,23 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
|
|
95
|
-
|
|
95
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signMessage.success", { signatureId: signatureCreationResponse.id });
|
|
96
96
|
return result;
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
signTypedData(params) {
|
|
100
100
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
101
101
|
var _a;
|
|
102
|
-
|
|
102
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signTypedData.start");
|
|
103
103
|
yield this.preAuthIfNeeded();
|
|
104
104
|
const { domain, message, primaryType, types, chain } = params;
|
|
105
105
|
if (!domain || !message || !types || !chain) {
|
|
106
|
-
|
|
106
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data" });
|
|
107
107
|
throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data");
|
|
108
108
|
}
|
|
109
109
|
const { name, version, chainId, verifyingContract, salt } = domain;
|
|
110
110
|
if (!name || !version || !chainId || !verifyingContract) {
|
|
111
|
-
|
|
111
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data domain" });
|
|
112
112
|
throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data domain");
|
|
113
113
|
}
|
|
114
114
|
const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
|
|
@@ -131,11 +131,11 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
131
131
|
}
|
|
132
132
|
});
|
|
133
133
|
if ("error" in signatureCreationResponse) {
|
|
134
|
-
|
|
134
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("evmWallet.signTypedData.error", { error: signatureCreationResponse });
|
|
135
135
|
throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
|
|
136
136
|
}
|
|
137
137
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
138
|
-
|
|
138
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signTypedData.prepared", {
|
|
139
139
|
signatureId: signatureCreationResponse.id
|
|
140
140
|
});
|
|
141
141
|
return {
|
|
@@ -144,7 +144,7 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
144
144
|
};
|
|
145
145
|
}
|
|
146
146
|
const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
|
|
147
|
-
|
|
147
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("evmWallet.signTypedData.success", { signatureId: signatureCreationResponse.id });
|
|
148
148
|
return result;
|
|
149
149
|
});
|
|
150
150
|
}
|
|
@@ -157,7 +157,7 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
157
157
|
var _a;
|
|
158
158
|
return _viem.createPublicClient.call(void 0, {
|
|
159
159
|
transport: (_a = params == null ? void 0 : params.transport) != null ? _a : _viem.http.call(void 0, ),
|
|
160
|
-
chain:
|
|
160
|
+
chain: _chunkWDZY4PP4cjs.toViemChain.call(void 0, this.chain)
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
createTransaction(transaction, options) {
|
|
@@ -205,7 +205,7 @@ var _EVMWallet = class _EVMWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
|
205
205
|
};
|
|
206
206
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
207
207
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
208
|
-
logger:
|
|
208
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
209
209
|
methodName: "evmWallet.sendTransaction",
|
|
210
210
|
buildContext(thisArg) {
|
|
211
211
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -214,7 +214,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
214
214
|
], _EVMWallet.prototype, "sendTransaction", 1);
|
|
215
215
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
216
216
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
217
|
-
logger:
|
|
217
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
218
218
|
methodName: "evmWallet.signMessage",
|
|
219
219
|
buildContext(thisArg) {
|
|
220
220
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -223,7 +223,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
223
223
|
], _EVMWallet.prototype, "signMessage", 1);
|
|
224
224
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
225
225
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
226
|
-
logger:
|
|
226
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
227
227
|
methodName: "evmWallet.signTypedData",
|
|
228
228
|
buildContext(thisArg) {
|
|
229
229
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkZAX22GSIcjs = require('./chunk-ZAX22GSI.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkWDZY4PP4cjs = require('./chunk-WDZY4PP4.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -21,10 +21,10 @@ var _chunkH3XAAMD3cjs = require('./chunk-H3XAAMD3.cjs');
|
|
|
21
21
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkR4AW5ADGcjs = require('./chunk-R4AW5ADG.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
@@ -73,7 +73,7 @@ var Wallet = class {
|
|
|
73
73
|
}
|
|
74
74
|
balances(tokens) {
|
|
75
75
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
76
|
-
|
|
76
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.balances.start");
|
|
77
77
|
const resolvedChain = this.resolveChainForEnvironment();
|
|
78
78
|
let nativeToken;
|
|
79
79
|
switch (this.chain) {
|
|
@@ -93,16 +93,16 @@ var Wallet = class {
|
|
|
93
93
|
tokens: allTokens
|
|
94
94
|
});
|
|
95
95
|
if ("error" in response) {
|
|
96
|
-
|
|
96
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.balances.error", { error: response });
|
|
97
97
|
throw new Error(`Failed to get balances for wallet: ${JSON.stringify(response.message)}`);
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.balances.success");
|
|
100
100
|
return this.transformBalanceResponse(response, nativeToken, tokens);
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
stagingFund(amount, chain) {
|
|
104
104
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
105
|
-
|
|
105
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.stagingFund.start", {
|
|
106
106
|
amount,
|
|
107
107
|
chain: chain != null ? chain : this.chain
|
|
108
108
|
});
|
|
@@ -114,12 +114,12 @@ var Wallet = class {
|
|
|
114
114
|
chain: chain != null ? chain : this.chain
|
|
115
115
|
});
|
|
116
116
|
if ("error" in response) {
|
|
117
|
-
|
|
117
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.stagingFund.error", {
|
|
118
118
|
error: response
|
|
119
119
|
});
|
|
120
120
|
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.stagingFund.success");
|
|
123
123
|
return response;
|
|
124
124
|
});
|
|
125
125
|
}
|
|
@@ -244,7 +244,7 @@ var Wallet = class {
|
|
|
244
244
|
const resolvedChain = this.resolveChainForEnvironment();
|
|
245
245
|
const recipient = toRecipientLocator(to);
|
|
246
246
|
const tokenLocator = toTokenLocator(token, resolvedChain);
|
|
247
|
-
|
|
247
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.send.start", _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
248
248
|
recipient,
|
|
249
249
|
token: tokenLocator,
|
|
250
250
|
amount
|
|
@@ -256,7 +256,7 @@ var Wallet = class {
|
|
|
256
256
|
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {}), (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {});
|
|
257
257
|
const transactionCreationResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
258
258
|
if ("message" in transactionCreationResponse) {
|
|
259
|
-
|
|
259
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.send.error", {
|
|
260
260
|
error: transactionCreationResponse
|
|
261
261
|
});
|
|
262
262
|
throw new (0, _chunkXC2V34TScjs.TransactionNotCreatedError)(
|
|
@@ -264,7 +264,7 @@ var Wallet = class {
|
|
|
264
264
|
);
|
|
265
265
|
}
|
|
266
266
|
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
267
|
-
|
|
267
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.send.prepared", {
|
|
268
268
|
transactionId: transactionCreationResponse.id
|
|
269
269
|
});
|
|
270
270
|
return {
|
|
@@ -274,7 +274,7 @@ var Wallet = class {
|
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
276
|
const result = yield this.approveTransactionAndWait(transactionCreationResponse.id);
|
|
277
|
-
|
|
277
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.send.success", {
|
|
278
278
|
transactionId: transactionCreationResponse.id,
|
|
279
279
|
hash: result.hash
|
|
280
280
|
});
|
|
@@ -302,7 +302,7 @@ var Wallet = class {
|
|
|
302
302
|
}
|
|
303
303
|
approve(params) {
|
|
304
304
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
305
|
-
|
|
305
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.approve.start", {
|
|
306
306
|
transactionId: params.transactionId,
|
|
307
307
|
signatureId: params.signatureId
|
|
308
308
|
});
|
|
@@ -311,19 +311,19 @@ var Wallet = class {
|
|
|
311
311
|
params.transactionId,
|
|
312
312
|
params.options
|
|
313
313
|
);
|
|
314
|
-
|
|
314
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.approve.success", {
|
|
315
315
|
transactionId: params.transactionId
|
|
316
316
|
});
|
|
317
317
|
return result;
|
|
318
318
|
}
|
|
319
319
|
if (params.signatureId != null) {
|
|
320
320
|
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
321
|
-
|
|
321
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.approve.success", {
|
|
322
322
|
signatureId: params.signatureId
|
|
323
323
|
});
|
|
324
324
|
return result;
|
|
325
325
|
}
|
|
326
|
-
|
|
326
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.approve.error", {
|
|
327
327
|
error: "Either transactionId or signatureId must be provided"
|
|
328
328
|
});
|
|
329
329
|
throw new Error("Either transactionId or signatureId must be provided");
|
|
@@ -332,39 +332,39 @@ var Wallet = class {
|
|
|
332
332
|
addDelegatedSigner(params) {
|
|
333
333
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
334
334
|
var _a, _b, _c;
|
|
335
|
-
|
|
335
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
336
336
|
const response = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).registerSigner(this.walletLocator, {
|
|
337
337
|
signer: params.signer,
|
|
338
338
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
339
339
|
});
|
|
340
340
|
if ("error" in response) {
|
|
341
|
-
|
|
341
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
342
342
|
error: response
|
|
343
343
|
});
|
|
344
344
|
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
345
345
|
}
|
|
346
346
|
if (this.chain === "solana" || this.chain === "stellar") {
|
|
347
347
|
if (!("transaction" in response) || response.transaction == null) {
|
|
348
|
-
|
|
348
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
349
349
|
error: "Expected transaction in response for Solana/Stellar chain"
|
|
350
350
|
});
|
|
351
351
|
throw new Error("Expected transaction in response for Solana/Stellar chain");
|
|
352
352
|
}
|
|
353
353
|
const transactionId = response.transaction.id;
|
|
354
354
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
355
|
-
|
|
355
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
356
356
|
transactionId
|
|
357
357
|
});
|
|
358
358
|
return { transactionId };
|
|
359
359
|
}
|
|
360
360
|
yield this.approveTransactionAndWait(transactionId);
|
|
361
|
-
|
|
361
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
362
362
|
transactionId
|
|
363
363
|
});
|
|
364
364
|
return void 0;
|
|
365
365
|
}
|
|
366
366
|
if (!("chains" in response)) {
|
|
367
|
-
|
|
367
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
368
368
|
error: "Expected chains in response for EVM chain"
|
|
369
369
|
});
|
|
370
370
|
throw new Error("Expected chains in response for EVM chain");
|
|
@@ -372,42 +372,42 @@ var Wallet = class {
|
|
|
372
372
|
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
373
373
|
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
374
374
|
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
375
|
-
|
|
375
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
376
376
|
signatureId
|
|
377
377
|
});
|
|
378
378
|
return { signatureId };
|
|
379
379
|
}
|
|
380
380
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
381
381
|
yield this.approveSignatureAndWait(chainResponse.id);
|
|
382
|
-
|
|
382
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
383
383
|
signatureId: chainResponse.id
|
|
384
384
|
});
|
|
385
385
|
return void 0;
|
|
386
386
|
}
|
|
387
387
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
388
388
|
yield this.waitForSignature(chainResponse.id);
|
|
389
|
-
|
|
389
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
390
390
|
signatureId: chainResponse.id
|
|
391
391
|
});
|
|
392
392
|
return void 0;
|
|
393
393
|
}
|
|
394
|
-
|
|
394
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
395
395
|
return void 0;
|
|
396
396
|
});
|
|
397
397
|
}
|
|
398
398
|
delegatedSigners() {
|
|
399
399
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
400
400
|
var _a, _b, _c;
|
|
401
|
-
|
|
401
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.delegatedSigners.start");
|
|
402
402
|
const walletResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getWallet(this.walletLocator);
|
|
403
403
|
if ("error" in walletResponse) {
|
|
404
|
-
|
|
404
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
405
405
|
error: walletResponse
|
|
406
406
|
});
|
|
407
407
|
throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(walletResponse));
|
|
408
408
|
}
|
|
409
409
|
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
410
|
-
|
|
410
|
+
_chunkJREZWZ2Scjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
411
411
|
error: `Wallet type ${walletResponse.type} not supported`
|
|
412
412
|
});
|
|
413
413
|
throw new (0, _chunkXC2V34TScjs.WalletTypeNotSupportedError)(`Wallet type ${walletResponse.type} not supported`);
|
|
@@ -419,7 +419,7 @@ var Wallet = class {
|
|
|
419
419
|
signer: `external-wallet:${address}`
|
|
420
420
|
};
|
|
421
421
|
})) != null ? _c : [];
|
|
422
|
-
|
|
422
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.delegatedSigners.success", {
|
|
423
423
|
count: signers.length
|
|
424
424
|
});
|
|
425
425
|
return signers;
|
|
@@ -447,7 +447,7 @@ var Wallet = class {
|
|
|
447
447
|
}
|
|
448
448
|
preAuthIfNeeded() {
|
|
449
449
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
450
|
-
if (this.signer instanceof
|
|
450
|
+
if (this.signer instanceof _chunkZAX22GSIcjs.NonCustodialSigner) {
|
|
451
451
|
yield this.signer.ensureAuthenticated();
|
|
452
452
|
}
|
|
453
453
|
});
|
|
@@ -456,7 +456,7 @@ var Wallet = class {
|
|
|
456
456
|
return this.chain === "solana";
|
|
457
457
|
}
|
|
458
458
|
resolveChainForEnvironment() {
|
|
459
|
-
const resolvedChain =
|
|
459
|
+
const resolvedChain = _chunkWDZY4PP4cjs.validateChainForEnvironment.call(void 0, this.chain, _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).environment);
|
|
460
460
|
if (resolvedChain !== this.chain) {
|
|
461
461
|
this.chain = resolvedChain;
|
|
462
462
|
}
|
|
@@ -557,7 +557,7 @@ var Wallet = class {
|
|
|
557
557
|
}
|
|
558
558
|
executeApproveTransactionWithErrorHandling(transactionId, approvals) {
|
|
559
559
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
560
|
-
|
|
560
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.approve: submitting approval to API", { transactionId });
|
|
561
561
|
const approvedTransaction = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).approveTransaction(this.walletLocator, transactionId, {
|
|
562
562
|
approvals
|
|
563
563
|
});
|
|
@@ -582,7 +582,7 @@ var Wallet = class {
|
|
|
582
582
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
583
583
|
let signatureResponse = null;
|
|
584
584
|
do {
|
|
585
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
585
|
+
yield new Promise((resolve) => setTimeout(resolve, _chunkR4AW5ADGcjs.STATUS_POLLING_INTERVAL_MS));
|
|
586
586
|
signatureResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getSignature(this.walletLocator, signatureId);
|
|
587
587
|
if ("error" in signatureResponse) {
|
|
588
588
|
throw new (0, _chunkXC2V34TScjs.SignatureNotAvailableError)(JSON.stringify(signatureResponse));
|
|
@@ -604,10 +604,10 @@ var Wallet = class {
|
|
|
604
604
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, arguments, function* (transactionId, timeoutMs = 6e4, {
|
|
605
605
|
backoffMultiplier = 1.1,
|
|
606
606
|
maxBackoffMs = 2e3,
|
|
607
|
-
initialBackoffMs =
|
|
607
|
+
initialBackoffMs = _chunkR4AW5ADGcjs.STATUS_POLLING_INTERVAL_MS
|
|
608
608
|
} = {}) {
|
|
609
609
|
var _a;
|
|
610
|
-
|
|
610
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallet.approve: waiting for transaction confirmation", { transactionId, timeoutMs });
|
|
611
611
|
const startTime = Date.now();
|
|
612
612
|
let transactionResponse;
|
|
613
613
|
do {
|
|
@@ -656,7 +656,7 @@ _options = new WeakMap();
|
|
|
656
656
|
_apiClient = new WeakMap();
|
|
657
657
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
658
658
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
659
|
-
logger:
|
|
659
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
660
660
|
methodName: "wallet.balances",
|
|
661
661
|
buildContext(thisArg) {
|
|
662
662
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -665,7 +665,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
665
665
|
], Wallet.prototype, "balances", 1);
|
|
666
666
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
667
667
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
668
|
-
logger:
|
|
668
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
669
669
|
methodName: "wallet.stagingFund",
|
|
670
670
|
buildContext(thisArg) {
|
|
671
671
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -674,7 +674,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
674
674
|
], Wallet.prototype, "stagingFund", 1);
|
|
675
675
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
676
676
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
677
|
-
logger:
|
|
677
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
678
678
|
methodName: "wallet.send",
|
|
679
679
|
buildContext(thisArg) {
|
|
680
680
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -683,7 +683,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
683
683
|
], Wallet.prototype, "send", 1);
|
|
684
684
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
685
685
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
686
|
-
logger:
|
|
686
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
687
687
|
methodName: "wallet.approve",
|
|
688
688
|
buildContext(thisArg) {
|
|
689
689
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -692,7 +692,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
692
692
|
], Wallet.prototype, "approve", 1);
|
|
693
693
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
694
694
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
695
|
-
logger:
|
|
695
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
696
696
|
methodName: "wallet.addDelegatedSigner",
|
|
697
697
|
buildContext(thisArg) {
|
|
698
698
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -701,7 +701,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
701
701
|
], Wallet.prototype, "addDelegatedSigner", 1);
|
|
702
702
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
703
703
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
704
|
-
logger:
|
|
704
|
+
logger: _chunkJREZWZ2Scjs.walletsLogger,
|
|
705
705
|
methodName: "wallet.delegatedSigners",
|
|
706
706
|
buildContext(thisArg) {
|
|
707
707
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_EVENT_OPTIONS,
|
|
3
3
|
NonCustodialSigner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-U3NV7UY7.js";
|
|
5
5
|
import {
|
|
6
6
|
walletsLogger
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ABMZ3ZVN.js";
|
|
8
8
|
import {
|
|
9
9
|
__async
|
|
10
10
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk66UY53KPcjs = require('./chunk-66UY53KP.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkRYQI3RXLcjs = require('./chunk-RYQI3RXL.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -16,10 +16,10 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
16
16
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
17
17
|
var CrossmintWallets = class _CrossmintWallets {
|
|
18
18
|
constructor(crossmint) {
|
|
19
|
-
|
|
20
|
-
const apiClient = new (0,
|
|
21
|
-
this.walletFactory = new (0,
|
|
22
|
-
|
|
19
|
+
_chunkJREZWZ2Scjs.initWalletsLogger.call(void 0, crossmint.apiKey);
|
|
20
|
+
const apiClient = new (0, _chunkRYQI3RXLcjs.ApiClient)(crossmint);
|
|
21
|
+
this.walletFactory = new (0, _chunk66UY53KPcjs.WalletFactory)(apiClient);
|
|
22
|
+
_chunkJREZWZ2Scjs.walletsLogger.info("wallets.sdk.initialized");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Initialize the Wallets SDK
|