@crossmint/wallets-sdk 0.18.11 → 0.18.13
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/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/{chunk-QKDQHKDJ.cjs → chunk-67UIXCUO.cjs} +54 -58
- package/dist/{chunk-PSKZR36J.cjs → chunk-AJYIGJX4.cjs} +9 -9
- package/dist/{chunk-6DRR3LG4.js → chunk-DWFSHFFE.js} +2 -2
- package/dist/{chunk-WACETVEE.cjs → chunk-HJSOHFJU.cjs} +7 -7
- package/dist/{chunk-AJIUH7J4.js → chunk-I4CWGAHI.js} +2 -2
- package/dist/{chunk-FQRYO6LZ.js → chunk-JISEH6WV.js} +2 -3
- package/dist/{chunk-THJFGWWT.cjs → chunk-JVQJG2ZF.cjs} +17 -17
- package/dist/{chunk-KWII4S3U.cjs → chunk-JX4TJWJW.cjs} +21 -21
- package/dist/{chunk-UCHEZUU2.js → chunk-JZLD56DI.js} +2 -2
- package/dist/{chunk-JFIN435P.js → chunk-L43QEK3D.js} +18 -22
- package/dist/{chunk-GAGVFMN7.js → chunk-LCE4ULCI.js} +2 -2
- package/dist/{chunk-XCBU56Z2.js → chunk-NHOA33JP.js} +3 -3
- package/dist/{chunk-HZKNKBU5.cjs → chunk-OKQ5QPXT.cjs} +1 -1
- package/dist/{chunk-WDYAGKXG.cjs → chunk-QQYGLANV.cjs} +12 -12
- package/dist/{chunk-EDBSUNF2.js → chunk-SOCAHGD5.js} +1 -1
- package/dist/{chunk-WRIOKE3W.cjs → chunk-TGD5JBGG.cjs} +5 -6
- package/dist/{chunk-UH62INDA.cjs → chunk-VURM6PSV.cjs} +9 -9
- package/dist/{chunk-66OKXCYL.js → chunk-Y65TSCBL.js} +2 -2
- package/dist/index.cjs +10 -10
- package/dist/index.js +9 -9
- 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 +7 -7
- package/dist/sdk.js +6 -6
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/__tests__/setup.cjs +36 -0
- package/dist/wallets/__tests__/setup.d.cts +2 -0
- package/dist/wallets/__tests__/setup.d.ts +2 -0
- package/dist/wallets/__tests__/setup.js +36 -0
- package/dist/wallets/__tests__/test-helpers.cjs +85 -0
- package/dist/wallets/__tests__/test-helpers.d.cts +35 -0
- package/dist/wallets/__tests__/test-helpers.d.ts +35 -0
- package/dist/wallets/__tests__/test-helpers.js +85 -0
- package/dist/wallets/evm.cjs +5 -5
- package/dist/wallets/evm.js +4 -4
- package/dist/wallets/solana.cjs +5 -5
- package/dist/wallets/solana.js +4 -4
- package/dist/wallets/stellar.cjs +5 -5
- package/dist/wallets/stellar.js +4 -4
- package/dist/wallets/wallet-factory.cjs +5 -5
- package/dist/wallets/wallet-factory.js +4 -4
- package/dist/wallets/wallet.cjs +4 -4
- package/dist/wallets/wallet.d.cts +1 -2
- package/dist/wallets/wallet.d.ts +1 -2
- package/dist/wallets/wallet.js +3 -3
- package/package.json +3 -4
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 _chunkQQYGLANVcjs = require('../chunk-QQYGLANV.cjs');
|
|
4
4
|
require('../chunk-XC2V34TS.cjs');
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-TGD5JBGG.cjs');
|
|
6
|
+
require('../chunk-OKQ5QPXT.cjs');
|
|
7
7
|
require('../chunk-UO2J2ZB2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.ApiClient =
|
|
10
|
+
exports.ApiClient = _chunkQQYGLANVcjs.ApiClient;
|
package/dist/api/client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-Y65TSCBL.js";
|
|
4
4
|
import "../chunk-SGINWAB6.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-JISEH6WV.js";
|
|
6
|
+
import "../chunk-SOCAHGD5.js";
|
|
7
7
|
import "../chunk-ASE2FXWP.js";
|
|
8
8
|
export {
|
|
9
9
|
ApiClient
|
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 _chunkQQYGLANVcjs = require('../chunk-QQYGLANV.cjs');
|
|
5
5
|
require('../chunk-XC2V34TS.cjs');
|
|
6
6
|
require('../chunk-ECAM5KTH.cjs');
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-TGD5JBGG.cjs');
|
|
8
|
+
require('../chunk-OKQ5QPXT.cjs');
|
|
9
9
|
require('../chunk-UO2J2ZB2.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.ApiClient =
|
|
12
|
+
exports.ApiClient = _chunkQQYGLANVcjs.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-Y65TSCBL.js";
|
|
5
5
|
import "../chunk-SGINWAB6.js";
|
|
6
6
|
import "../chunk-KBJA7JDT.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-JISEH6WV.js";
|
|
8
|
+
import "../chunk-SOCAHGD5.js";
|
|
9
9
|
import "../chunk-ASE2FXWP.js";
|
|
10
10
|
export {
|
|
11
11
|
ApiClient
|
|
@@ -18,10 +18,10 @@ var _chunkTEQYWMHScjs = require('./chunk-TEQYWMHS.cjs');
|
|
|
18
18
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkTGD5JBGGcjs = require('./chunk-TGD5JBGG.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkOKQ5QPXTcjs = require('./chunk-OKQ5QPXT.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -68,9 +68,9 @@ var Wallet = class {
|
|
|
68
68
|
experimental_apiClient() {
|
|
69
69
|
return _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient);
|
|
70
70
|
}
|
|
71
|
-
balances(tokens
|
|
71
|
+
balances(tokens) {
|
|
72
72
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
73
|
-
|
|
73
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.balances.start");
|
|
74
74
|
let nativeToken;
|
|
75
75
|
switch (this.chain) {
|
|
76
76
|
case "solana":
|
|
@@ -85,20 +85,20 @@ var Wallet = class {
|
|
|
85
85
|
}
|
|
86
86
|
const allTokens = [nativeToken, "usdc", ...tokens != null ? tokens : []];
|
|
87
87
|
const response = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getBalance(this.address, {
|
|
88
|
-
chains:
|
|
88
|
+
chains: [this.chain],
|
|
89
89
|
tokens: allTokens
|
|
90
90
|
});
|
|
91
91
|
if ("error" in response) {
|
|
92
|
-
|
|
92
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.balances.error", { error: response });
|
|
93
93
|
throw new Error(`Failed to get balances for wallet: ${JSON.stringify(response.message)}`);
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.balances.success");
|
|
96
96
|
return this.transformBalanceResponse(response, nativeToken, tokens);
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
stagingFund(amount, chain) {
|
|
100
100
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
101
|
-
|
|
101
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.stagingFund.start", { amount, chain: chain != null ? chain : this.chain });
|
|
102
102
|
const response = yield this.apiClient.fundWallet(this.address, {
|
|
103
103
|
amount,
|
|
104
104
|
token: "usdxm",
|
|
@@ -107,10 +107,10 @@ var Wallet = class {
|
|
|
107
107
|
chain: chain != null ? chain : this.chain
|
|
108
108
|
});
|
|
109
109
|
if ("error" in response) {
|
|
110
|
-
|
|
110
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.stagingFund.error", { error: response });
|
|
111
111
|
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.stagingFund.success");
|
|
114
114
|
return response;
|
|
115
115
|
});
|
|
116
116
|
}
|
|
@@ -231,7 +231,7 @@ var Wallet = class {
|
|
|
231
231
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
232
232
|
const recipient = toRecipientLocator(to);
|
|
233
233
|
const tokenLocator = toTokenLocator(token, this.chain);
|
|
234
|
-
|
|
234
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.send.start", { recipient, token: tokenLocator, amount });
|
|
235
235
|
yield this.preAuthIfNeeded();
|
|
236
236
|
const sendParams = _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
237
237
|
recipient,
|
|
@@ -239,13 +239,13 @@ var Wallet = class {
|
|
|
239
239
|
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {});
|
|
240
240
|
const transactionCreationResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
241
241
|
if ("message" in transactionCreationResponse) {
|
|
242
|
-
|
|
242
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.send.error", { error: transactionCreationResponse });
|
|
243
243
|
throw new (0, _chunkXC2V34TScjs.TransactionNotCreatedError)(
|
|
244
244
|
`Failed to send token: ${JSON.stringify(transactionCreationResponse.message)}`
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
248
|
-
|
|
248
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.send.prepared", { transactionId: transactionCreationResponse.id });
|
|
249
249
|
return {
|
|
250
250
|
hash: void 0,
|
|
251
251
|
explorerLink: void 0,
|
|
@@ -253,7 +253,7 @@ var Wallet = class {
|
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
const result = yield this.approveTransactionAndWait(transactionCreationResponse.id);
|
|
256
|
-
|
|
256
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.send.success", {
|
|
257
257
|
transactionId: transactionCreationResponse.id,
|
|
258
258
|
hash: result.hash
|
|
259
259
|
});
|
|
@@ -281,7 +281,7 @@ var Wallet = class {
|
|
|
281
281
|
}
|
|
282
282
|
approve(params) {
|
|
283
283
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
284
|
-
|
|
284
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.approve.start", {
|
|
285
285
|
transactionId: params.transactionId,
|
|
286
286
|
signatureId: params.signatureId
|
|
287
287
|
});
|
|
@@ -290,15 +290,15 @@ var Wallet = class {
|
|
|
290
290
|
params.transactionId,
|
|
291
291
|
params.options
|
|
292
292
|
);
|
|
293
|
-
|
|
293
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.approve.success", { transactionId: params.transactionId });
|
|
294
294
|
return result;
|
|
295
295
|
}
|
|
296
296
|
if (params.signatureId != null) {
|
|
297
297
|
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
298
|
-
|
|
298
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.approve.success", { signatureId: params.signatureId });
|
|
299
299
|
return result;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.approve.error", {
|
|
302
302
|
error: "Either transactionId or signatureId must be provided"
|
|
303
303
|
});
|
|
304
304
|
throw new Error("Either transactionId or signatureId must be provided");
|
|
@@ -307,33 +307,33 @@ var Wallet = class {
|
|
|
307
307
|
addDelegatedSigner(params) {
|
|
308
308
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
309
309
|
var _a, _b, _c;
|
|
310
|
-
|
|
310
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
311
311
|
const response = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).registerSigner(this.walletLocator, {
|
|
312
312
|
signer: params.signer,
|
|
313
313
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
314
314
|
});
|
|
315
315
|
if ("error" in response) {
|
|
316
|
-
|
|
316
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.addDelegatedSigner.error", { error: response });
|
|
317
317
|
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
318
318
|
}
|
|
319
319
|
if (this.chain === "solana" || this.chain === "stellar") {
|
|
320
320
|
if (!("transaction" in response) || response.transaction == null) {
|
|
321
|
-
|
|
321
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
322
322
|
error: "Expected transaction in response for Solana/Stellar chain"
|
|
323
323
|
});
|
|
324
324
|
throw new Error("Expected transaction in response for Solana/Stellar chain");
|
|
325
325
|
}
|
|
326
326
|
const transactionId = response.transaction.id;
|
|
327
327
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
328
|
-
|
|
328
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", { transactionId });
|
|
329
329
|
return { transactionId };
|
|
330
330
|
}
|
|
331
331
|
yield this.approveTransactionAndWait(transactionId);
|
|
332
|
-
|
|
332
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.addDelegatedSigner.success", { transactionId });
|
|
333
333
|
return void 0;
|
|
334
334
|
}
|
|
335
335
|
if (!("chains" in response)) {
|
|
336
|
-
|
|
336
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
337
337
|
error: "Expected chains in response for EVM chain"
|
|
338
338
|
});
|
|
339
339
|
throw new Error("Expected chains in response for EVM chain");
|
|
@@ -341,34 +341,34 @@ var Wallet = class {
|
|
|
341
341
|
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
342
342
|
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
343
343
|
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
344
|
-
|
|
344
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", { signatureId });
|
|
345
345
|
return { signatureId };
|
|
346
346
|
}
|
|
347
347
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
348
348
|
yield this.approveSignatureAndWait(chainResponse.id);
|
|
349
|
-
|
|
349
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
|
|
350
350
|
return void 0;
|
|
351
351
|
}
|
|
352
352
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
353
353
|
yield this.waitForSignature(chainResponse.id);
|
|
354
|
-
|
|
354
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
|
|
355
355
|
return void 0;
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
358
358
|
return void 0;
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
delegatedSigners() {
|
|
362
362
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
363
363
|
var _a, _b, _c;
|
|
364
|
-
|
|
364
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.delegatedSigners.start");
|
|
365
365
|
const walletResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getWallet(this.walletLocator);
|
|
366
366
|
if ("error" in walletResponse) {
|
|
367
|
-
|
|
367
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.delegatedSigners.error", { error: walletResponse });
|
|
368
368
|
throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(walletResponse));
|
|
369
369
|
}
|
|
370
370
|
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
371
|
-
|
|
371
|
+
_chunkTGD5JBGGcjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
372
372
|
error: `Wallet type ${walletResponse.type} not supported`
|
|
373
373
|
});
|
|
374
374
|
throw new (0, _chunkXC2V34TScjs.WalletTypeNotSupportedError)(`Wallet type ${walletResponse.type} not supported`);
|
|
@@ -380,7 +380,7 @@ var Wallet = class {
|
|
|
380
380
|
signer: `external-wallet:${address}`
|
|
381
381
|
};
|
|
382
382
|
})) != null ? _c : [];
|
|
383
|
-
|
|
383
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallet.delegatedSigners.success", { count: signers.length });
|
|
384
384
|
return signers;
|
|
385
385
|
});
|
|
386
386
|
}
|
|
@@ -456,20 +456,18 @@ var Wallet = class {
|
|
|
456
456
|
return signature;
|
|
457
457
|
}
|
|
458
458
|
const signers = [...(_b = options == null ? void 0 : options.additionalSigners) != null ? _b : [], this.signer];
|
|
459
|
-
const
|
|
460
|
-
pendingApprovals.map((pendingApproval) => {
|
|
459
|
+
const approvals = yield Promise.all(
|
|
460
|
+
pendingApprovals.map((pendingApproval) => _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
461
461
|
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
462
462
|
if (signer == null) {
|
|
463
463
|
throw new (0, _chunkXC2V34TScjs.InvalidSignerError)(`Signer ${pendingApproval.signer} not found in pending approvals`);
|
|
464
464
|
}
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
const signature2 = yield signer.signMessage(pendingApproval.message);
|
|
466
|
+
return _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, signature2), {
|
|
467
|
+
signer: signer.locator()
|
|
468
|
+
});
|
|
469
|
+
}))
|
|
467
470
|
);
|
|
468
|
-
const approvals = signedApprovals.map((signature2) => {
|
|
469
|
-
return _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, signature2), {
|
|
470
|
-
signer: this.signer.locator()
|
|
471
|
-
});
|
|
472
|
-
});
|
|
473
471
|
return yield this.executeApproveSignatureWithErrorHandling(signatureId, approvals);
|
|
474
472
|
});
|
|
475
473
|
}
|
|
@@ -493,21 +491,19 @@ var Wallet = class {
|
|
|
493
491
|
return transaction;
|
|
494
492
|
}
|
|
495
493
|
const signers = [...(_e = options == null ? void 0 : options.additionalSigners) != null ? _e : [], this.signer];
|
|
496
|
-
const
|
|
497
|
-
pendingApprovals.map((pendingApproval) => {
|
|
494
|
+
const approvals = yield Promise.all(
|
|
495
|
+
pendingApprovals.map((pendingApproval) => _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
498
496
|
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
499
497
|
if (signer == null) {
|
|
500
498
|
throw new (0, _chunkXC2V34TScjs.InvalidSignerError)(`Signer ${pendingApproval.signer} not found in pending approvals`);
|
|
501
499
|
}
|
|
502
500
|
const transactionToSign = transaction.chainType === "solana" && "transaction" in transaction.onChain ? transaction.onChain.transaction : pendingApproval.message;
|
|
503
|
-
|
|
504
|
-
|
|
501
|
+
const signature = yield signer.signTransaction(transactionToSign);
|
|
502
|
+
return _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, signature), {
|
|
503
|
+
signer: signer.locator()
|
|
504
|
+
});
|
|
505
|
+
}))
|
|
505
506
|
);
|
|
506
|
-
const approvals = signedApprovals.map((signature) => {
|
|
507
|
-
return _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, signature), {
|
|
508
|
-
signer: this.signer.locator()
|
|
509
|
-
});
|
|
510
|
-
});
|
|
511
507
|
return yield this.executeApproveTransactionWithErrorHandling(transactionId, approvals);
|
|
512
508
|
});
|
|
513
509
|
}
|
|
@@ -537,7 +533,7 @@ var Wallet = class {
|
|
|
537
533
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
538
534
|
let signatureResponse = null;
|
|
539
535
|
do {
|
|
540
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
536
|
+
yield new Promise((resolve) => setTimeout(resolve, _chunkOKQ5QPXTcjs.STATUS_POLLING_INTERVAL_MS));
|
|
541
537
|
signatureResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getSignature(this.walletLocator, signatureId);
|
|
542
538
|
if ("error" in signatureResponse) {
|
|
543
539
|
throw new (0, _chunkXC2V34TScjs.SignatureNotAvailableError)(JSON.stringify(signatureResponse));
|
|
@@ -559,7 +555,7 @@ var Wallet = class {
|
|
|
559
555
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, arguments, function* (transactionId, timeoutMs = 6e4, {
|
|
560
556
|
backoffMultiplier = 1.1,
|
|
561
557
|
maxBackoffMs = 2e3,
|
|
562
|
-
initialBackoffMs =
|
|
558
|
+
initialBackoffMs = _chunkOKQ5QPXTcjs.STATUS_POLLING_INTERVAL_MS
|
|
563
559
|
} = {}) {
|
|
564
560
|
var _a;
|
|
565
561
|
const startTime = Date.now();
|
|
@@ -610,7 +606,7 @@ _options = new WeakMap();
|
|
|
610
606
|
_apiClient = new WeakMap();
|
|
611
607
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
612
608
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
613
|
-
logger:
|
|
609
|
+
logger: _chunkTGD5JBGGcjs.walletsLogger,
|
|
614
610
|
methodName: "wallet.balances",
|
|
615
611
|
buildContext(thisArg) {
|
|
616
612
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -619,7 +615,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
619
615
|
], Wallet.prototype, "balances", 1);
|
|
620
616
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
621
617
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
622
|
-
logger:
|
|
618
|
+
logger: _chunkTGD5JBGGcjs.walletsLogger,
|
|
623
619
|
methodName: "wallet.stagingFund",
|
|
624
620
|
buildContext(thisArg) {
|
|
625
621
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -628,7 +624,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
628
624
|
], Wallet.prototype, "stagingFund", 1);
|
|
629
625
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
630
626
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
631
|
-
logger:
|
|
627
|
+
logger: _chunkTGD5JBGGcjs.walletsLogger,
|
|
632
628
|
methodName: "wallet.send",
|
|
633
629
|
buildContext(thisArg) {
|
|
634
630
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -637,7 +633,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
637
633
|
], Wallet.prototype, "send", 1);
|
|
638
634
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
639
635
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
640
|
-
logger:
|
|
636
|
+
logger: _chunkTGD5JBGGcjs.walletsLogger,
|
|
641
637
|
methodName: "wallet.approve",
|
|
642
638
|
buildContext(thisArg) {
|
|
643
639
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -646,7 +642,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
646
642
|
], Wallet.prototype, "approve", 1);
|
|
647
643
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
648
644
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
649
|
-
logger:
|
|
645
|
+
logger: _chunkTGD5JBGGcjs.walletsLogger,
|
|
650
646
|
methodName: "wallet.addDelegatedSigner",
|
|
651
647
|
buildContext(thisArg) {
|
|
652
648
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -655,7 +651,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
655
651
|
], Wallet.prototype, "addDelegatedSigner", 1);
|
|
656
652
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
657
653
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
658
|
-
logger:
|
|
654
|
+
logger: _chunkTGD5JBGGcjs.walletsLogger,
|
|
659
655
|
methodName: "wallet.delegatedSigners",
|
|
660
656
|
buildContext(thisArg) {
|
|
661
657
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk67UIXCUOcjs = require('./chunk-67UIXCUO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkTGD5JBGGcjs = require('./chunk-TGD5JBGG.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
@@ -14,7 +14,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
14
14
|
|
|
15
15
|
// src/wallets/stellar.ts
|
|
16
16
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
17
|
-
var _StellarWallet = class _StellarWallet extends
|
|
17
|
+
var _StellarWallet = class _StellarWallet extends _chunk67UIXCUOcjs.Wallet {
|
|
18
18
|
constructor(wallet) {
|
|
19
19
|
super(
|
|
20
20
|
{
|
|
@@ -22,10 +22,10 @@ var _StellarWallet = class _StellarWallet extends _chunkQKDQHKDJcjs.Wallet {
|
|
|
22
22
|
address: wallet.address,
|
|
23
23
|
owner: wallet.owner,
|
|
24
24
|
signer: wallet.signer,
|
|
25
|
-
options:
|
|
25
|
+
options: _chunk67UIXCUOcjs.Wallet.getOptions(wallet),
|
|
26
26
|
alias: wallet.alias
|
|
27
27
|
},
|
|
28
|
-
|
|
28
|
+
_chunk67UIXCUOcjs.Wallet.getApiClient(wallet)
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
static from(wallet) {
|
|
@@ -37,11 +37,11 @@ var _StellarWallet = class _StellarWallet extends _chunkQKDQHKDJcjs.Wallet {
|
|
|
37
37
|
sendTransaction(params) {
|
|
38
38
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
39
39
|
var _a;
|
|
40
|
-
|
|
40
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("stellarWallet.sendTransaction.start");
|
|
41
41
|
yield this.preAuthIfNeeded();
|
|
42
42
|
const createdTransaction = yield this.createTransaction(params);
|
|
43
43
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
44
|
-
|
|
44
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("stellarWallet.sendTransaction.prepared", {
|
|
45
45
|
transactionId: createdTransaction.id
|
|
46
46
|
});
|
|
47
47
|
return {
|
|
@@ -52,7 +52,7 @@ var _StellarWallet = class _StellarWallet extends _chunkQKDQHKDJcjs.Wallet {
|
|
|
52
52
|
}
|
|
53
53
|
const options = {};
|
|
54
54
|
const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
|
|
55
|
-
|
|
55
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("stellarWallet.sendTransaction.success", {
|
|
56
56
|
transactionId: createdTransaction.id,
|
|
57
57
|
hash: result.hash
|
|
58
58
|
});
|
|
@@ -96,7 +96,7 @@ var _StellarWallet = class _StellarWallet extends _chunkQKDQHKDJcjs.Wallet {
|
|
|
96
96
|
};
|
|
97
97
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
98
98
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
99
|
-
logger:
|
|
99
|
+
logger: _chunkTGD5JBGGcjs.walletsLogger,
|
|
100
100
|
methodName: "stellarWallet.sendTransaction",
|
|
101
101
|
buildContext(thisArg) {
|
|
102
102
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-ZP4ZZCIE.js";
|
|
5
5
|
import {
|
|
6
6
|
Wallet
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-L43QEK3D.js";
|
|
8
8
|
import {
|
|
9
9
|
assembleSigner
|
|
10
10
|
} from "./chunk-UZN67GMO.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-SGINWAB6.js";
|
|
15
15
|
import {
|
|
16
16
|
walletsLogger
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-JISEH6WV.js";
|
|
18
18
|
import {
|
|
19
19
|
__async,
|
|
20
20
|
__decorateClass,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJVQJG2ZFcjs = require('./chunk-JVQJG2ZF.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkQQYGLANVcjs = require('./chunk-QQYGLANV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkTGD5JBGGcjs = require('./chunk-TGD5JBGG.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
|
+
_chunkTGD5JBGGcjs.initWalletsLogger.call(void 0, crossmint.apiKey);
|
|
20
|
+
const apiClient = new (0, _chunkQQYGLANVcjs.ApiClient)(crossmint);
|
|
21
|
+
this.walletFactory = new (0, _chunkJVQJG2ZFcjs.WalletFactory)(apiClient);
|
|
22
|
+
_chunkTGD5JBGGcjs.walletsLogger.info("wallets.sdk.initialized");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Initialize the Wallets SDK
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-L43QEK3D.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-JISEH6WV.js";
|
|
13
13
|
import {
|
|
14
14
|
__async,
|
|
15
15
|
__decorateClass
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_NAME,
|
|
3
3
|
SDK_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SOCAHGD5.js";
|
|
5
5
|
|
|
6
6
|
// src/logger/init.ts
|
|
7
7
|
import {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
validateAPIKey,
|
|
12
12
|
ServerDatadogSink
|
|
13
13
|
} from "@crossmint/common-sdk-base";
|
|
14
|
-
import * as datadogLogger from "@datadog/browser-logs";
|
|
15
14
|
var walletsLogger = new SdkLogger();
|
|
16
15
|
function initWalletsLogger(apiKey) {
|
|
17
16
|
const platform = detectPlatform();
|
|
@@ -29,7 +28,7 @@ function initWalletsLogger(apiKey) {
|
|
|
29
28
|
});
|
|
30
29
|
switch (platform) {
|
|
31
30
|
case "browser": {
|
|
32
|
-
const sink = new BrowserDatadogSink(environment
|
|
31
|
+
const sink = new BrowserDatadogSink(environment);
|
|
33
32
|
walletsLogger.addSink(sink);
|
|
34
33
|
break;
|
|
35
34
|
}
|