@crossmint/wallets-sdk 0.20.2 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/test-utils.cjs +8 -8
- package/dist/api/__tests__/test-utils.d.cts +3 -3
- package/dist/api/__tests__/test-utils.d.ts +3 -3
- package/dist/api/__tests__/test-utils.js +6 -6
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.d.cts +1 -0
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.js +3 -3
- package/dist/api/gen/index.cjs +3 -103
- package/dist/api/gen/index.d.cts +2 -2
- package/dist/api/gen/index.d.ts +2 -2
- package/dist/api/gen/index.js +6 -106
- package/dist/api/gen/sdk.gen.cjs +2 -102
- package/dist/api/gen/sdk.gen.d.cts +22 -370
- package/dist/api/gen/sdk.gen.d.ts +22 -370
- package/dist/api/gen/sdk.gen.js +5 -105
- package/dist/api/gen/types.gen.d.cts +2558 -5712
- package/dist/api/gen/types.gen.d.ts +2558 -5712
- package/dist/api/index.cjs +4 -4
- package/dist/api/index.js +3 -3
- package/dist/api/types.d.cts +12 -12
- package/dist/api/types.d.ts +12 -12
- package/dist/chains/chains.cjs +5 -5
- package/dist/chains/chains.js +4 -4
- package/dist/{chunk-JREZWZ2S.cjs → chunk-2M32LBCA.cjs} +3 -3
- package/dist/{chunk-KQH5ZXJ4.js → chunk-2PSAUSOG.js} +61 -18
- package/dist/chunk-2RG6642I.js +39 -0
- package/dist/{chunk-R4AW5ADG.cjs → chunk-3WZUNLYI.cjs} +1 -1
- package/dist/{chunk-6UMJYMAY.js → chunk-4Z3YDHHG.js} +2 -2
- package/dist/{chunk-POG76HDD.cjs → chunk-4ZWUI6LE.cjs} +64 -48
- package/dist/chunk-5IC7UWND.cjs +1 -0
- package/dist/{chunk-HXJ3YPAN.js → chunk-65KPNJ77.js} +13 -4
- package/dist/{chunk-IDKGJO2G.cjs → chunk-7EZDSDKA.cjs} +21 -11
- package/dist/{chunk-PM7BGATN.cjs → chunk-7SUWMK4J.cjs} +34 -25
- package/dist/{chunk-47R3UV3J.cjs → chunk-7W4HGN3H.cjs} +11 -6
- package/dist/chunk-BR4UVMIC.js +332 -0
- package/dist/chunk-BUBSPQ7U.cjs +332 -0
- package/dist/{chunk-MRZXYVQO.cjs → chunk-CPZQ7BK5.cjs} +6 -6
- package/dist/chunk-CTOLL4BK.js +29 -0
- package/dist/chunk-DDNG224J.cjs +45 -0
- package/dist/{chunk-T2XUADHW.js → chunk-EVR4CD53.js} +8 -3
- package/dist/{chunk-U3NV7UY7.js → chunk-FZQG6OX2.js} +1 -1
- package/dist/chunk-GJT2JD3E.js +45 -0
- package/dist/{chunk-TYQ4YIP7.js → chunk-GLUD6EBN.js} +1 -1
- package/dist/chunk-H6WV5NRT.js +10 -0
- package/dist/{chunk-FICVKSXZ.js → chunk-HFEF2URB.js} +2 -2
- package/dist/chunk-HWTWDQYT.cjs +42 -0
- package/dist/{chunk-CMBFV325.js → chunk-HYA3ESUA.js} +3 -3
- package/dist/chunk-IGRPHTXZ.cjs +1 -0
- package/dist/chunk-K6LSGLG6.js +42 -0
- package/dist/chunk-KHY5FXO4.cjs +37 -0
- package/dist/chunk-L52GDMSH.js +0 -0
- package/dist/{chunk-A6E67ZZP.js → chunk-M47ZHA7Q.js} +14 -5
- package/dist/{chunk-6FG5QXII.cjs → chunk-M4HCASMG.cjs} +20 -11
- package/dist/chunk-M6IPPGXQ.cjs +29 -0
- package/dist/{chunk-R6DH4V7S.cjs → chunk-M7OPRXZH.cjs} +7 -7
- package/dist/{chunk-WDZY4PP4.cjs → chunk-MIKWTXUA.cjs} +6 -6
- package/dist/chunk-MNHK6EQK.cjs +57 -0
- package/dist/{chunk-66UY53KP.cjs → chunk-NO2KMGS2.cjs} +80 -37
- package/dist/chunk-OPKFMXPI.cjs +39 -0
- package/dist/{chunk-WWW6IGZ7.js → chunk-OXB6RTW7.js} +14 -4
- package/dist/{chunk-RYQI3RXL.cjs → chunk-P4XJHOLW.cjs} +18 -12
- package/dist/chunk-Q52MMQSC.js +57 -0
- package/dist/chunk-QM3BB4E2.js +0 -0
- package/dist/{chunk-ZAX22GSI.cjs → chunk-QQNDLR6E.cjs} +18 -18
- package/dist/chunk-RUQYXEEG.cjs +10 -0
- package/dist/chunk-S2L5Z2ZT.js +37 -0
- package/dist/{chunk-PUO4QNXH.js → chunk-T5NKL6F4.js} +2 -2
- package/dist/{chunk-WHTECI7J.cjs → chunk-U56Z2EOR.cjs} +6 -6
- package/dist/{chunk-W7K5E64Q.js → chunk-VLZ5ZS5U.js} +8 -2
- package/dist/{chunk-7TT3VUDF.cjs → chunk-VTF3WCXG.cjs} +6 -6
- package/dist/{chunk-FHMKNG62.js → chunk-VVPGO564.js} +24 -8
- package/dist/{chunk-2WBSPOWU.js → chunk-X4SPF4KJ.js} +4 -4
- package/dist/{chunk-ABMZ3ZVN.js → chunk-XEPUH4XH.js} +1 -1
- package/dist/index.cjs +26 -17
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -16
- 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 +23 -14
- package/dist/sdk.js +22 -13
- package/dist/signers/index.cjs +17 -8
- package/dist/signers/index.js +16 -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/signers/server/assemble-server-signer.cjs +14 -0
- package/dist/signers/server/assemble-server-signer.d.cts +11 -0
- package/dist/signers/server/assemble-server-signer.d.ts +11 -0
- package/dist/signers/server/assemble-server-signer.js +14 -0
- package/dist/signers/server/evm-server-signer.cjs +7 -0
- package/dist/signers/server/evm-server-signer.d.cts +25 -0
- package/dist/signers/server/evm-server-signer.d.ts +25 -0
- package/dist/signers/server/evm-server-signer.js +7 -0
- package/dist/signers/server/helpers/derive-server-signer.cjs +11 -0
- package/dist/signers/server/helpers/derive-server-signer.d.cts +15 -0
- package/dist/signers/server/helpers/derive-server-signer.d.ts +15 -0
- package/dist/signers/server/helpers/derive-server-signer.js +11 -0
- package/dist/signers/server/helpers/get-chain-type.cjs +7 -0
- package/dist/signers/server/helpers/get-chain-type.d.cts +7 -0
- package/dist/signers/server/helpers/get-chain-type.d.ts +7 -0
- package/dist/signers/server/helpers/get-chain-type.js +7 -0
- package/dist/signers/server/helpers/index.cjs +15 -0
- package/dist/signers/server/helpers/index.d.cts +9 -0
- package/dist/signers/server/helpers/index.d.ts +9 -0
- package/dist/signers/server/helpers/index.js +15 -0
- package/dist/signers/server/index.cjs +29 -0
- package/dist/signers/server/index.d.cts +12 -0
- package/dist/signers/server/index.d.ts +12 -0
- package/dist/signers/server/index.js +29 -0
- package/dist/signers/server/solana-server-signer.cjs +7 -0
- package/dist/signers/server/solana-server-signer.d.cts +25 -0
- package/dist/signers/server/solana-server-signer.d.ts +25 -0
- package/dist/signers/server/solana-server-signer.js +7 -0
- package/dist/signers/server/stellar-server-signer.cjs +7 -0
- package/dist/signers/server/stellar-server-signer.d.cts +25 -0
- package/dist/signers/server/stellar-server-signer.d.ts +25 -0
- package/dist/signers/server/stellar-server-signer.js +7 -0
- package/dist/signers/types.d.cts +15 -3
- package/dist/signers/types.d.ts +15 -3
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/utils/server-key-derivation.cjs +9 -0
- package/dist/utils/server-key-derivation.d.cts +20 -0
- package/dist/utils/server-key-derivation.d.ts +20 -0
- package/dist/utils/server-key-derivation.js +9 -0
- package/dist/wallets/__tests__/test-helpers.cjs +19 -10
- package/dist/wallets/__tests__/test-helpers.js +18 -9
- package/dist/wallets/evm.cjs +20 -11
- package/dist/wallets/evm.js +19 -10
- package/dist/wallets/solana.cjs +20 -11
- package/dist/wallets/solana.js +19 -10
- package/dist/wallets/stellar.cjs +20 -11
- package/dist/wallets/stellar.js +19 -10
- package/dist/wallets/types.d.cts +7 -4
- package/dist/wallets/types.d.ts +7 -4
- package/dist/wallets/wallet-factory.cjs +21 -12
- package/dist/wallets/wallet-factory.js +20 -11
- package/dist/wallets/wallet.cjs +19 -10
- package/dist/wallets/wallet.d.cts +2 -2
- package/dist/wallets/wallet.d.ts +2 -2
- package/dist/wallets/wallet.js +18 -9
- package/package.json +3 -2
- package/dist/chunk-BMMZIPXT.js +0 -778
- package/dist/chunk-COR3CNRW.cjs +0 -778
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkKHY5FXO4cjs = require('./chunk-KHY5FXO4.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkQQNDLR6Ecjs = require('./chunk-QQNDLR6E.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkMIKWTXUAcjs = require('./chunk-MIKWTXUA.cjs');
|
|
7
10
|
|
|
8
11
|
|
|
9
12
|
|
|
@@ -21,10 +24,10 @@ var _chunkWDZY4PP4cjs = require('./chunk-WDZY4PP4.cjs');
|
|
|
21
24
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
22
25
|
|
|
23
26
|
|
|
24
|
-
var
|
|
27
|
+
var _chunk2M32LBCAcjs = require('./chunk-2M32LBCA.cjs');
|
|
25
28
|
|
|
26
29
|
|
|
27
|
-
var
|
|
30
|
+
var _chunk3WZUNLYIcjs = require('./chunk-3WZUNLYI.cjs');
|
|
28
31
|
|
|
29
32
|
|
|
30
33
|
|
|
@@ -73,7 +76,7 @@ var Wallet = class {
|
|
|
73
76
|
}
|
|
74
77
|
balances(tokens) {
|
|
75
78
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
76
|
-
|
|
79
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.balances.start");
|
|
77
80
|
const resolvedChain = this.resolveChainForEnvironment();
|
|
78
81
|
let nativeToken;
|
|
79
82
|
switch (this.chain) {
|
|
@@ -93,16 +96,16 @@ var Wallet = class {
|
|
|
93
96
|
tokens: allTokens
|
|
94
97
|
});
|
|
95
98
|
if ("error" in response) {
|
|
96
|
-
|
|
99
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.balances.error", { error: response });
|
|
97
100
|
throw new Error(`Failed to get balances for wallet: ${JSON.stringify(response.message)}`);
|
|
98
101
|
}
|
|
99
|
-
|
|
102
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.balances.success");
|
|
100
103
|
return this.transformBalanceResponse(response, nativeToken, tokens);
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
106
|
stagingFund(amount, chain) {
|
|
104
107
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
105
|
-
|
|
108
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.stagingFund.start", {
|
|
106
109
|
amount,
|
|
107
110
|
chain: chain != null ? chain : this.chain
|
|
108
111
|
});
|
|
@@ -114,12 +117,12 @@ var Wallet = class {
|
|
|
114
117
|
chain: chain != null ? chain : this.chain
|
|
115
118
|
});
|
|
116
119
|
if ("error" in response) {
|
|
117
|
-
|
|
120
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.stagingFund.error", {
|
|
118
121
|
error: response
|
|
119
122
|
});
|
|
120
123
|
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
121
124
|
}
|
|
122
|
-
|
|
125
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.stagingFund.success");
|
|
123
126
|
return response;
|
|
124
127
|
});
|
|
125
128
|
}
|
|
@@ -244,19 +247,27 @@ var Wallet = class {
|
|
|
244
247
|
const resolvedChain = this.resolveChainForEnvironment();
|
|
245
248
|
const recipient = toRecipientLocator(to);
|
|
246
249
|
const tokenLocator = toTokenLocator(token, resolvedChain);
|
|
247
|
-
|
|
250
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.send.start", _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
248
251
|
recipient,
|
|
249
252
|
token: tokenLocator,
|
|
250
253
|
amount
|
|
251
254
|
}, (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {}));
|
|
252
255
|
yield this.preAuthIfNeeded();
|
|
256
|
+
let signer;
|
|
257
|
+
if ((options == null ? void 0 : options.experimental_signer) != null) {
|
|
258
|
+
if (typeof options.experimental_signer === "string") {
|
|
259
|
+
signer = options.experimental_signer;
|
|
260
|
+
} else {
|
|
261
|
+
signer = `server:${_chunkKHY5FXO4cjs.deriveServerSignerDetails.call(void 0, options.experimental_signer, this.chain, _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).projectId, _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).environment).derivedAddress}`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
253
264
|
const sendParams = _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
254
265
|
recipient,
|
|
255
266
|
amount
|
|
256
|
-
},
|
|
267
|
+
}, signer != null ? { signer } : {}), (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {});
|
|
257
268
|
const transactionCreationResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
258
269
|
if ("message" in transactionCreationResponse) {
|
|
259
|
-
|
|
270
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.send.error", {
|
|
260
271
|
error: transactionCreationResponse
|
|
261
272
|
});
|
|
262
273
|
throw new (0, _chunkXC2V34TScjs.TransactionNotCreatedError)(
|
|
@@ -264,7 +275,7 @@ var Wallet = class {
|
|
|
264
275
|
);
|
|
265
276
|
}
|
|
266
277
|
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
267
|
-
|
|
278
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.send.prepared", {
|
|
268
279
|
transactionId: transactionCreationResponse.id
|
|
269
280
|
});
|
|
270
281
|
return {
|
|
@@ -274,7 +285,7 @@ var Wallet = class {
|
|
|
274
285
|
};
|
|
275
286
|
}
|
|
276
287
|
const result = yield this.approveTransactionAndWait(transactionCreationResponse.id);
|
|
277
|
-
|
|
288
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.send.success", {
|
|
278
289
|
transactionId: transactionCreationResponse.id,
|
|
279
290
|
hash: result.hash
|
|
280
291
|
});
|
|
@@ -302,7 +313,7 @@ var Wallet = class {
|
|
|
302
313
|
}
|
|
303
314
|
approve(params) {
|
|
304
315
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
305
|
-
|
|
316
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.approve.start", {
|
|
306
317
|
transactionId: params.transactionId,
|
|
307
318
|
signatureId: params.signatureId
|
|
308
319
|
});
|
|
@@ -311,19 +322,19 @@ var Wallet = class {
|
|
|
311
322
|
params.transactionId,
|
|
312
323
|
params.options
|
|
313
324
|
);
|
|
314
|
-
|
|
325
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.approve.success", {
|
|
315
326
|
transactionId: params.transactionId
|
|
316
327
|
});
|
|
317
328
|
return result;
|
|
318
329
|
}
|
|
319
330
|
if (params.signatureId != null) {
|
|
320
331
|
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
321
|
-
|
|
332
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.approve.success", {
|
|
322
333
|
signatureId: params.signatureId
|
|
323
334
|
});
|
|
324
335
|
return result;
|
|
325
336
|
}
|
|
326
|
-
|
|
337
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.approve.error", {
|
|
327
338
|
error: "Either transactionId or signatureId must be provided"
|
|
328
339
|
});
|
|
329
340
|
throw new Error("Either transactionId or signatureId must be provided");
|
|
@@ -332,39 +343,40 @@ var Wallet = class {
|
|
|
332
343
|
addDelegatedSigner(params) {
|
|
333
344
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
334
345
|
var _a, _b, _c;
|
|
335
|
-
|
|
346
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
347
|
+
const resolvedSigner = typeof params.signer === "object" && params.signer.type === "server" ? `server:${_chunkKHY5FXO4cjs.deriveServerSignerDetails.call(void 0, params.signer, this.chain, _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).projectId, _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).environment).derivedAddress}` : params.signer;
|
|
336
348
|
const response = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).registerSigner(this.walletLocator, {
|
|
337
|
-
signer:
|
|
349
|
+
signer: resolvedSigner,
|
|
338
350
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
339
351
|
});
|
|
340
352
|
if ("error" in response) {
|
|
341
|
-
|
|
353
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
342
354
|
error: response
|
|
343
355
|
});
|
|
344
356
|
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
345
357
|
}
|
|
346
358
|
if (this.chain === "solana" || this.chain === "stellar") {
|
|
347
359
|
if (!("transaction" in response) || response.transaction == null) {
|
|
348
|
-
|
|
360
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
349
361
|
error: "Expected transaction in response for Solana/Stellar chain"
|
|
350
362
|
});
|
|
351
363
|
throw new Error("Expected transaction in response for Solana/Stellar chain");
|
|
352
364
|
}
|
|
353
365
|
const transactionId = response.transaction.id;
|
|
354
366
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
355
|
-
|
|
367
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
356
368
|
transactionId
|
|
357
369
|
});
|
|
358
370
|
return { transactionId };
|
|
359
371
|
}
|
|
360
372
|
yield this.approveTransactionAndWait(transactionId);
|
|
361
|
-
|
|
373
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
362
374
|
transactionId
|
|
363
375
|
});
|
|
364
376
|
return void 0;
|
|
365
377
|
}
|
|
366
378
|
if (!("chains" in response)) {
|
|
367
|
-
|
|
379
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
368
380
|
error: "Expected chains in response for EVM chain"
|
|
369
381
|
});
|
|
370
382
|
throw new Error("Expected chains in response for EVM chain");
|
|
@@ -372,42 +384,42 @@ var Wallet = class {
|
|
|
372
384
|
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
373
385
|
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
374
386
|
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
375
|
-
|
|
387
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
376
388
|
signatureId
|
|
377
389
|
});
|
|
378
390
|
return { signatureId };
|
|
379
391
|
}
|
|
380
392
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
381
393
|
yield this.approveSignatureAndWait(chainResponse.id);
|
|
382
|
-
|
|
394
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
383
395
|
signatureId: chainResponse.id
|
|
384
396
|
});
|
|
385
397
|
return void 0;
|
|
386
398
|
}
|
|
387
399
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
388
400
|
yield this.waitForSignature(chainResponse.id);
|
|
389
|
-
|
|
401
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
390
402
|
signatureId: chainResponse.id
|
|
391
403
|
});
|
|
392
404
|
return void 0;
|
|
393
405
|
}
|
|
394
|
-
|
|
406
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
395
407
|
return void 0;
|
|
396
408
|
});
|
|
397
409
|
}
|
|
398
410
|
delegatedSigners() {
|
|
399
411
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
400
412
|
var _a, _b, _c;
|
|
401
|
-
|
|
413
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.delegatedSigners.start");
|
|
402
414
|
const walletResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getWallet(this.walletLocator);
|
|
403
415
|
if ("error" in walletResponse) {
|
|
404
|
-
|
|
416
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
405
417
|
error: walletResponse
|
|
406
418
|
});
|
|
407
419
|
throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(walletResponse));
|
|
408
420
|
}
|
|
409
421
|
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
410
|
-
|
|
422
|
+
_chunk2M32LBCAcjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
411
423
|
error: `Wallet type ${walletResponse.type} not supported`
|
|
412
424
|
});
|
|
413
425
|
throw new (0, _chunkXC2V34TScjs.WalletTypeNotSupportedError)(`Wallet type ${walletResponse.type} not supported`);
|
|
@@ -419,7 +431,7 @@ var Wallet = class {
|
|
|
419
431
|
signer: `external-wallet:${address}`
|
|
420
432
|
};
|
|
421
433
|
})) != null ? _c : [];
|
|
422
|
-
|
|
434
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.delegatedSigners.success", {
|
|
423
435
|
count: signers.length
|
|
424
436
|
});
|
|
425
437
|
return signers;
|
|
@@ -447,7 +459,7 @@ var Wallet = class {
|
|
|
447
459
|
}
|
|
448
460
|
preAuthIfNeeded() {
|
|
449
461
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
450
|
-
if (this.signer instanceof
|
|
462
|
+
if (this.signer instanceof _chunkQQNDLR6Ecjs.NonCustodialSigner) {
|
|
451
463
|
yield this.signer.ensureAuthenticated();
|
|
452
464
|
}
|
|
453
465
|
});
|
|
@@ -456,7 +468,7 @@ var Wallet = class {
|
|
|
456
468
|
return this.chain === "solana";
|
|
457
469
|
}
|
|
458
470
|
resolveChainForEnvironment() {
|
|
459
|
-
const resolvedChain =
|
|
471
|
+
const resolvedChain = _chunkMIKWTXUAcjs.validateChainForEnvironment.call(void 0, this.chain, _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).environment);
|
|
460
472
|
if (resolvedChain !== this.chain) {
|
|
461
473
|
this.chain = resolvedChain;
|
|
462
474
|
}
|
|
@@ -508,7 +520,9 @@ var Wallet = class {
|
|
|
508
520
|
pendingApprovals.map((pendingApproval) => _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
509
521
|
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
510
522
|
if (signer == null) {
|
|
511
|
-
throw new (0, _chunkXC2V34TScjs.InvalidSignerError)(
|
|
523
|
+
throw new (0, _chunkXC2V34TScjs.InvalidSignerError)(
|
|
524
|
+
`Signer ${pendingApproval.signer.locator} not found in pending approvals`
|
|
525
|
+
);
|
|
512
526
|
}
|
|
513
527
|
const signature2 = yield signer.signMessage(pendingApproval.message);
|
|
514
528
|
return _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, signature2), {
|
|
@@ -543,7 +557,9 @@ var Wallet = class {
|
|
|
543
557
|
pendingApprovals.map((pendingApproval) => _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
544
558
|
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
545
559
|
if (signer == null) {
|
|
546
|
-
throw new (0, _chunkXC2V34TScjs.InvalidSignerError)(
|
|
560
|
+
throw new (0, _chunkXC2V34TScjs.InvalidSignerError)(
|
|
561
|
+
`Signer ${pendingApproval.signer.locator} not found in pending approvals`
|
|
562
|
+
);
|
|
547
563
|
}
|
|
548
564
|
const transactionToSign = transaction.chainType === "solana" && "transaction" in transaction.onChain ? transaction.onChain.transaction : pendingApproval.message;
|
|
549
565
|
const signature = yield signer.signTransaction(transactionToSign);
|
|
@@ -557,7 +573,7 @@ var Wallet = class {
|
|
|
557
573
|
}
|
|
558
574
|
executeApproveTransactionWithErrorHandling(transactionId, approvals) {
|
|
559
575
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
560
|
-
|
|
576
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.approve: submitting approval to API", { transactionId });
|
|
561
577
|
const approvedTransaction = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).approveTransaction(this.walletLocator, transactionId, {
|
|
562
578
|
approvals
|
|
563
579
|
});
|
|
@@ -582,7 +598,7 @@ var Wallet = class {
|
|
|
582
598
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
583
599
|
let signatureResponse = null;
|
|
584
600
|
do {
|
|
585
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
601
|
+
yield new Promise((resolve) => setTimeout(resolve, _chunk3WZUNLYIcjs.STATUS_POLLING_INTERVAL_MS));
|
|
586
602
|
signatureResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getSignature(this.walletLocator, signatureId);
|
|
587
603
|
if ("error" in signatureResponse) {
|
|
588
604
|
throw new (0, _chunkXC2V34TScjs.SignatureNotAvailableError)(JSON.stringify(signatureResponse));
|
|
@@ -604,10 +620,10 @@ var Wallet = class {
|
|
|
604
620
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, arguments, function* (transactionId, timeoutMs = 6e4, {
|
|
605
621
|
backoffMultiplier = 1.1,
|
|
606
622
|
maxBackoffMs = 2e3,
|
|
607
|
-
initialBackoffMs =
|
|
623
|
+
initialBackoffMs = _chunk3WZUNLYIcjs.STATUS_POLLING_INTERVAL_MS
|
|
608
624
|
} = {}) {
|
|
609
625
|
var _a;
|
|
610
|
-
|
|
626
|
+
_chunk2M32LBCAcjs.walletsLogger.info("wallet.approve: waiting for transaction confirmation", { transactionId, timeoutMs });
|
|
611
627
|
const startTime = Date.now();
|
|
612
628
|
let transactionResponse;
|
|
613
629
|
do {
|
|
@@ -656,7 +672,7 @@ _options = new WeakMap();
|
|
|
656
672
|
_apiClient = new WeakMap();
|
|
657
673
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
658
674
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
659
|
-
logger:
|
|
675
|
+
logger: _chunk2M32LBCAcjs.walletsLogger,
|
|
660
676
|
methodName: "wallet.balances",
|
|
661
677
|
buildContext(thisArg) {
|
|
662
678
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -665,7 +681,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
665
681
|
], Wallet.prototype, "balances", 1);
|
|
666
682
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
667
683
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
668
|
-
logger:
|
|
684
|
+
logger: _chunk2M32LBCAcjs.walletsLogger,
|
|
669
685
|
methodName: "wallet.stagingFund",
|
|
670
686
|
buildContext(thisArg) {
|
|
671
687
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -674,7 +690,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
674
690
|
], Wallet.prototype, "stagingFund", 1);
|
|
675
691
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
676
692
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
677
|
-
logger:
|
|
693
|
+
logger: _chunk2M32LBCAcjs.walletsLogger,
|
|
678
694
|
methodName: "wallet.send",
|
|
679
695
|
buildContext(thisArg) {
|
|
680
696
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -683,7 +699,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
683
699
|
], Wallet.prototype, "send", 1);
|
|
684
700
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
685
701
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
686
|
-
logger:
|
|
702
|
+
logger: _chunk2M32LBCAcjs.walletsLogger,
|
|
687
703
|
methodName: "wallet.approve",
|
|
688
704
|
buildContext(thisArg) {
|
|
689
705
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -692,7 +708,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
692
708
|
], Wallet.prototype, "approve", 1);
|
|
693
709
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
694
710
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
695
|
-
logger:
|
|
711
|
+
logger: _chunk2M32LBCAcjs.walletsLogger,
|
|
696
712
|
methodName: "wallet.addDelegatedSigner",
|
|
697
713
|
buildContext(thisArg) {
|
|
698
714
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -701,7 +717,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
701
717
|
], Wallet.prototype, "addDelegatedSigner", 1);
|
|
702
718
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
703
719
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
704
|
-
logger:
|
|
720
|
+
logger: _chunk2M32LBCAcjs.walletsLogger,
|
|
705
721
|
methodName: "wallet.delegatedSigners",
|
|
706
722
|
buildContext(thisArg) {
|
|
707
723
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VVPGO564.js";
|
|
4
|
+
import {
|
|
5
|
+
deriveServerSignerDetails
|
|
6
|
+
} from "./chunk-S2L5Z2ZT.js";
|
|
4
7
|
import {
|
|
5
8
|
TransactionNotCreatedError
|
|
6
9
|
} from "./chunk-SGINWAB6.js";
|
|
7
10
|
import {
|
|
8
11
|
walletsLogger
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XEPUH4XH.js";
|
|
10
13
|
import {
|
|
11
14
|
__async,
|
|
12
15
|
__decorateClass
|
|
@@ -61,9 +64,15 @@ var _StellarWallet = class _StellarWallet extends Wallet {
|
|
|
61
64
|
}
|
|
62
65
|
createTransaction(params) {
|
|
63
66
|
return __async(this, null, function* () {
|
|
64
|
-
var _a;
|
|
65
67
|
const { contractId, options } = params;
|
|
66
|
-
|
|
68
|
+
let signer;
|
|
69
|
+
if ((options == null ? void 0 : options.experimental_signer) == null) {
|
|
70
|
+
signer = this.signer.locator();
|
|
71
|
+
} else if (typeof options.experimental_signer === "string") {
|
|
72
|
+
signer = options.experimental_signer;
|
|
73
|
+
} else {
|
|
74
|
+
signer = `server:${deriveServerSignerDetails(options.experimental_signer, this.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}`;
|
|
75
|
+
}
|
|
67
76
|
let transaction;
|
|
68
77
|
if ("transaction" in params) {
|
|
69
78
|
transaction = {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk4ZWUI6LEcjs = require('./chunk-4ZWUI6LE.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkKHY5FXO4cjs = require('./chunk-KHY5FXO4.cjs');
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
|
|
@@ -9,7 +12,7 @@ var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
|
|
|
9
12
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
12
|
-
var
|
|
15
|
+
var _chunk2M32LBCAcjs = require('./chunk-2M32LBCA.cjs');
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
|
|
@@ -18,7 +21,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
18
21
|
// src/wallets/solana.ts
|
|
19
22
|
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
20
23
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
21
|
-
var _SolanaWallet = class _SolanaWallet extends
|
|
24
|
+
var _SolanaWallet = class _SolanaWallet extends _chunk4ZWUI6LEcjs.Wallet {
|
|
22
25
|
constructor(wallet) {
|
|
23
26
|
super(
|
|
24
27
|
{
|
|
@@ -26,10 +29,10 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
26
29
|
address: wallet.address,
|
|
27
30
|
owner: wallet.owner,
|
|
28
31
|
signer: wallet.signer,
|
|
29
|
-
options:
|
|
32
|
+
options: _chunk4ZWUI6LEcjs.Wallet.getOptions(wallet),
|
|
30
33
|
alias: wallet.alias
|
|
31
34
|
},
|
|
32
|
-
|
|
35
|
+
_chunk4ZWUI6LEcjs.Wallet.getApiClient(wallet)
|
|
33
36
|
);
|
|
34
37
|
}
|
|
35
38
|
static from(wallet) {
|
|
@@ -41,11 +44,11 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
41
44
|
sendTransaction(params) {
|
|
42
45
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
43
46
|
var _a, _b;
|
|
44
|
-
|
|
47
|
+
_chunk2M32LBCAcjs.walletsLogger.info("solanaWallet.sendTransaction.start");
|
|
45
48
|
yield this.preAuthIfNeeded();
|
|
46
49
|
const createdTransaction = yield this.createTransaction(params);
|
|
47
50
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
48
|
-
|
|
51
|
+
_chunk2M32LBCAcjs.walletsLogger.info("solanaWallet.sendTransaction.prepared", {
|
|
49
52
|
transactionId: createdTransaction.id
|
|
50
53
|
});
|
|
51
54
|
return {
|
|
@@ -69,7 +72,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
69
72
|
additionalSigners: _additionalSigners
|
|
70
73
|
};
|
|
71
74
|
const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
|
|
72
|
-
|
|
75
|
+
_chunk2M32LBCAcjs.walletsLogger.info("solanaWallet.sendTransaction.success", {
|
|
73
76
|
transactionId: createdTransaction.id,
|
|
74
77
|
hash: result.hash
|
|
75
78
|
});
|
|
@@ -78,8 +81,15 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
78
81
|
}
|
|
79
82
|
createTransaction(params) {
|
|
80
83
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
81
|
-
var _a
|
|
82
|
-
|
|
84
|
+
var _a;
|
|
85
|
+
let signer;
|
|
86
|
+
if (((_a = params.options) == null ? void 0 : _a.experimental_signer) == null) {
|
|
87
|
+
signer = this.signer.locator();
|
|
88
|
+
} else if (typeof params.options.experimental_signer === "string") {
|
|
89
|
+
signer = params.options.experimental_signer;
|
|
90
|
+
} else {
|
|
91
|
+
signer = `server:${_chunkKHY5FXO4cjs.deriveServerSignerDetails.call(void 0, params.options.experimental_signer, this.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}`;
|
|
92
|
+
}
|
|
83
93
|
let serializedTransaction;
|
|
84
94
|
if ("serializedTransaction" in params) {
|
|
85
95
|
serializedTransaction = params.serializedTransaction;
|
|
@@ -101,7 +111,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
101
111
|
};
|
|
102
112
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
103
113
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
104
|
-
logger:
|
|
114
|
+
logger: _chunk2M32LBCAcjs.walletsLogger,
|
|
105
115
|
methodName: "solanaWallet.sendTransaction",
|
|
106
116
|
buildContext(thisArg) {
|
|
107
117
|
return { chain: thisArg.chain, address: thisArg.address };
|