@crossmint/wallets-sdk 0.19.0 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/test-utils.cjs +5 -5
- package/dist/api/__tests__/test-utils.js +3 -3
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.js +3 -3
- package/dist/api/gen/types.gen.d.cts +35 -35
- package/dist/api/gen/types.gen.d.ts +35 -35
- package/dist/api/index.cjs +5 -5
- package/dist/api/index.js +4 -4
- package/dist/chains/chains.cjs +12 -3
- package/dist/chains/chains.d.cts +14 -2
- package/dist/chains/chains.d.ts +14 -2
- package/dist/chains/chains.js +13 -4
- package/dist/chains/definitions/tempo.cjs +7 -0
- package/dist/chains/definitions/tempo.d.cts +39 -0
- package/dist/chains/definitions/tempo.d.ts +39 -0
- package/dist/chains/definitions/tempo.js +7 -0
- package/dist/chains/definitions/tempoTestnet.cjs +2 -2
- package/dist/chains/definitions/tempoTestnet.d.cts +5 -9
- package/dist/chains/definitions/tempoTestnet.d.ts +5 -9
- package/dist/chains/definitions/tempoTestnet.js +1 -1
- package/dist/{chunk-REP547HH.cjs → chunk-3ASKCQJN.cjs} +18 -18
- package/dist/{chunk-N65K6TUY.js → chunk-3G4P2NHM.js} +2 -2
- package/dist/{chunk-W3OYA42M.js → chunk-3KEY2NLC.js} +1 -1
- package/dist/{chunk-ETCH6L2Y.js → chunk-3SYMIYEW.js} +5 -5
- package/dist/{chunk-XQSMZXBR.cjs → chunk-3WF7K4KF.cjs} +24 -24
- package/dist/chunk-7USEVMTW.cjs +21 -0
- package/dist/{chunk-VNPL3HFN.cjs → chunk-AEGU53OM.cjs} +6 -6
- package/dist/{chunk-7NKX266V.js → chunk-AYE7XUR2.js} +11 -33
- package/dist/{chunk-BBYNVHFR.js → chunk-DENEF27X.js} +3 -3
- package/dist/{chunk-XEZBA7I2.js → chunk-DPZIHSN7.js} +19 -6
- package/dist/{chunk-S2AKC2CK.js → chunk-DZ6MCPD3.js} +1 -1
- package/dist/{chunk-6H6ZBJC2.cjs → chunk-F7L2TZ3I.cjs} +5 -9
- package/dist/{chunk-XSMIDXUA.js → chunk-FGGGBNUF.js} +68 -3
- package/dist/{chunk-DIM3X4IX.cjs → chunk-H3XAAMD3.cjs} +68 -3
- package/dist/{chunk-5CBGJLA4.cjs → chunk-HH3MM7IJ.cjs} +1 -1
- package/dist/{chunk-57HPJVTI.js → chunk-IBV7DELQ.js} +5 -5
- package/dist/{chunk-SUJQZWLJ.js → chunk-J45OIOTF.js} +2 -2
- package/dist/{chunk-IZJUOXOZ.js → chunk-JWMQALLN.js} +5 -9
- package/dist/{chunk-6EP3PLGP.js → chunk-KD6N62YZ.js} +2 -2
- package/dist/{chunk-VWENCGQO.cjs → chunk-KN3AKBVY.cjs} +6 -6
- package/dist/{chunk-JLW3Q65G.cjs → chunk-LONKAMXJ.cjs} +6 -6
- package/dist/{chunk-YFOUZXSM.cjs → chunk-LPR7BODP.cjs} +6 -6
- package/dist/chunk-MMISP35W.js +21 -0
- package/dist/{chunk-C5F6IECX.cjs → chunk-NFV5K2D2.cjs} +12 -12
- package/dist/{chunk-KE6LX37B.js → chunk-NPTNXK47.js} +1 -1
- package/dist/{chunk-YXFIZNFL.cjs → chunk-O42BRSEX.cjs} +9 -9
- package/dist/{chunk-NXST74TX.cjs → chunk-SJSXTTSY.cjs} +58 -45
- package/dist/{chunk-FQV77LH4.cjs → chunk-TC6ITDWV.cjs} +3 -3
- package/dist/{chunk-7EZZGCYI.js → chunk-TPW2OJIB.js} +2 -2
- package/dist/{chunk-L5IMC3NM.js → chunk-TYRXXYHP.js} +2 -2
- package/dist/{chunk-TCNXKNBQ.cjs → chunk-XMVAZ7EW.cjs} +7 -7
- package/dist/{chunk-YF4DYTBM.js → chunk-XTKNO44C.js} +2 -2
- package/dist/{chunk-EIZVQAZO.cjs → chunk-Y35UJFTB.cjs} +24 -46
- package/dist/{chunk-JZQYCISB.cjs → chunk-ZZLEVK2P.cjs} +9 -9
- package/dist/index.cjs +19 -18
- package/dist/index.js +18 -17
- package/dist/logger/index.cjs +3 -3
- package/dist/logger/index.js +2 -2
- package/dist/logger/init.cjs +3 -3
- package/dist/logger/init.js +2 -2
- package/dist/sdk.cjs +16 -15
- package/dist/sdk.js +15 -14
- package/dist/signers/index.cjs +8 -8
- package/dist/signers/index.d.cts +1 -1
- package/dist/signers/index.d.ts +1 -1
- package/dist/signers/index.js +7 -7
- package/dist/signers/non-custodial/index.cjs +7 -7
- package/dist/signers/non-custodial/index.js +8 -8
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
- package/dist/signers/non-custodial/ncs-signer.js +3 -3
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +14 -8
- package/dist/wallets/__tests__/test-helpers.js +13 -7
- package/dist/wallets/evm.cjs +13 -12
- package/dist/wallets/evm.js +12 -11
- package/dist/wallets/solana.cjs +15 -9
- package/dist/wallets/solana.d.cts +1 -1
- package/dist/wallets/solana.d.ts +1 -1
- package/dist/wallets/solana.js +14 -8
- package/dist/wallets/stellar.cjs +15 -9
- package/dist/wallets/stellar.d.cts +1 -1
- package/dist/wallets/stellar.d.ts +1 -1
- package/dist/wallets/stellar.js +14 -8
- package/dist/wallets/types.d.cts +1 -1
- package/dist/wallets/types.d.ts +1 -1
- package/dist/wallets/wallet-factory.cjs +14 -13
- package/dist/wallets/wallet-factory.d.cts +0 -1
- package/dist/wallets/wallet-factory.d.ts +0 -1
- package/dist/wallets/wallet-factory.js +13 -12
- package/dist/wallets/wallet.cjs +14 -8
- package/dist/wallets/wallet.d.cts +1 -0
- package/dist/wallets/wallet.d.ts +1 -0
- package/dist/wallets/wallet.js +13 -7
- package/package.json +7 -7
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk3ASKCQJNcjs = require('./chunk-3ASKCQJN.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkTC6ITDWVcjs = require('./chunk-TC6ITDWV.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
11
11
|
|
|
12
12
|
// src/signers/non-custodial/ncs-stellar-signer.ts
|
|
13
|
-
var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends
|
|
13
|
+
var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunk3ASKCQJNcjs.NonCustodialSigner {
|
|
14
14
|
constructor(config) {
|
|
15
15
|
super(config);
|
|
16
16
|
}
|
|
@@ -24,7 +24,7 @@ var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkR
|
|
|
24
24
|
var _a;
|
|
25
25
|
yield this.handleAuthRequired();
|
|
26
26
|
const jwt = this.getJwtOrThrow();
|
|
27
|
-
|
|
27
|
+
_chunkTC6ITDWVcjs.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 _chunkR
|
|
|
40
40
|
encoding: "base64"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
options:
|
|
43
|
+
options: _chunk3ASKCQJNcjs.DEFAULT_EVENT_OPTIONS
|
|
44
44
|
});
|
|
45
|
-
|
|
45
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("sign: response received", {
|
|
46
46
|
status: res == null ? void 0 : res.status,
|
|
47
47
|
durationMs: Date.now() - startTime
|
|
48
48
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/chains/definitions/tempo.ts
|
|
2
|
+
import { defineChain } from "viem";
|
|
3
|
+
var tempo = defineChain({
|
|
4
|
+
id: 4217,
|
|
5
|
+
name: "Tempo",
|
|
6
|
+
nativeCurrency: void 0,
|
|
7
|
+
rpcUrls: {
|
|
8
|
+
default: { http: ["https://rpc.tempo.xyz"] }
|
|
9
|
+
},
|
|
10
|
+
blockExplorers: {
|
|
11
|
+
default: {
|
|
12
|
+
name: "Tempo Explorer",
|
|
13
|
+
url: "https://explore.mainnet.tempo.xyz"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
testnet: false
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
tempo
|
|
21
|
+
};
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkTC6ITDWVcjs = require('./chunk-TC6ITDWV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkHH3MM7IJcjs = require('./chunk-HH3MM7IJ.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -22,7 +22,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
22
22
|
constructor(crossmint) {
|
|
23
23
|
super(crossmint, {
|
|
24
24
|
internalConfig: {
|
|
25
|
-
sdkMetadata: { name:
|
|
25
|
+
sdkMetadata: { name: _chunkHH3MM7IJcjs.SDK_NAME, version: _chunkHH3MM7IJcjs.SDK_VERSION }
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
this.apiPrefix = "api/2025-06-09/wallets";
|
|
@@ -31,7 +31,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
31
31
|
createWallet(params) {
|
|
32
32
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
33
33
|
const path = this.isServerSide ? `${this.apiPrefix}` : `${this.apiPrefix}/me`;
|
|
34
|
-
|
|
34
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallets.api.createWallet", {
|
|
35
35
|
chainType: params.chainType,
|
|
36
36
|
walletType: params.type
|
|
37
37
|
});
|
|
@@ -41,12 +41,12 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
41
41
|
});
|
|
42
42
|
const result = yield response.json();
|
|
43
43
|
if ("error" in result) {
|
|
44
|
-
|
|
44
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallets.api.createWallet.error", {
|
|
45
45
|
error: result.error,
|
|
46
46
|
chainType: params.chainType
|
|
47
47
|
});
|
|
48
48
|
} else if ("address" in result) {
|
|
49
|
-
|
|
49
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallets.api.createWallet.success", {
|
|
50
50
|
address: result.address,
|
|
51
51
|
chainType: params.chainType
|
|
52
52
|
});
|
|
@@ -56,18 +56,18 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
56
56
|
}
|
|
57
57
|
getWallet(locator) {
|
|
58
58
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
59
|
-
|
|
59
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallets.api.getWallet", { locator });
|
|
60
60
|
const response = yield this.get(`${this.apiPrefix}/${locator}`, {
|
|
61
61
|
headers: this.headers
|
|
62
62
|
});
|
|
63
63
|
const result = yield response.json();
|
|
64
64
|
if ("error" in result) {
|
|
65
|
-
|
|
65
|
+
_chunkTC6ITDWVcjs.walletsLogger.warn("wallets.api.getWallet.error", {
|
|
66
66
|
locator,
|
|
67
67
|
error: result.error
|
|
68
68
|
});
|
|
69
69
|
} else if ("address" in result) {
|
|
70
|
-
|
|
70
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallets.api.getWallet.success", result);
|
|
71
71
|
}
|
|
72
72
|
return result;
|
|
73
73
|
});
|
|
@@ -200,7 +200,7 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
200
200
|
}
|
|
201
201
|
send(walletLocator, tokenLocator, params) {
|
|
202
202
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
203
|
-
|
|
203
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallets.api.send", {
|
|
204
204
|
walletLocator,
|
|
205
205
|
tokenLocator,
|
|
206
206
|
recipient: params.recipient
|
|
@@ -211,13 +211,13 @@ var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
|
211
211
|
});
|
|
212
212
|
const result = yield response.json();
|
|
213
213
|
if ("error" in result) {
|
|
214
|
-
|
|
214
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallets.api.send.error", {
|
|
215
215
|
walletLocator,
|
|
216
216
|
tokenLocator,
|
|
217
217
|
error: result.error
|
|
218
218
|
});
|
|
219
219
|
} else if ("id" in result) {
|
|
220
|
-
|
|
220
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallets.api.send.success", {
|
|
221
221
|
walletLocator,
|
|
222
222
|
transactionId: result.id
|
|
223
223
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
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 _chunkSJSXTTSYcjs = require('./chunk-SJSXTTSY.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
|
|
@@ -9,7 +9,7 @@ var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
|
|
|
9
9
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkTC6ITDWVcjs = require('./chunk-TC6ITDWV.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
18
18
|
// src/wallets/solana.ts
|
|
19
19
|
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
20
20
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
21
|
-
var _SolanaWallet = class _SolanaWallet extends
|
|
21
|
+
var _SolanaWallet = class _SolanaWallet extends _chunkSJSXTTSYcjs.Wallet {
|
|
22
22
|
constructor(wallet) {
|
|
23
23
|
super(
|
|
24
24
|
{
|
|
@@ -26,10 +26,10 @@ var _SolanaWallet = class _SolanaWallet extends _chunkNXST74TXcjs.Wallet {
|
|
|
26
26
|
address: wallet.address,
|
|
27
27
|
owner: wallet.owner,
|
|
28
28
|
signer: wallet.signer,
|
|
29
|
-
options:
|
|
29
|
+
options: _chunkSJSXTTSYcjs.Wallet.getOptions(wallet),
|
|
30
30
|
alias: wallet.alias
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
_chunkSJSXTTSYcjs.Wallet.getApiClient(wallet)
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
static from(wallet) {
|
|
@@ -41,11 +41,11 @@ var _SolanaWallet = class _SolanaWallet extends _chunkNXST74TXcjs.Wallet {
|
|
|
41
41
|
sendTransaction(params) {
|
|
42
42
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
43
43
|
var _a, _b;
|
|
44
|
-
|
|
44
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("solanaWallet.sendTransaction.start");
|
|
45
45
|
yield this.preAuthIfNeeded();
|
|
46
46
|
const createdTransaction = yield this.createTransaction(params);
|
|
47
47
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
48
|
-
|
|
48
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("solanaWallet.sendTransaction.prepared", {
|
|
49
49
|
transactionId: createdTransaction.id
|
|
50
50
|
});
|
|
51
51
|
return {
|
|
@@ -69,7 +69,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkNXST74TXcjs.Wallet {
|
|
|
69
69
|
additionalSigners: _additionalSigners
|
|
70
70
|
};
|
|
71
71
|
const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
|
|
72
|
-
|
|
72
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("solanaWallet.sendTransaction.success", {
|
|
73
73
|
transactionId: createdTransaction.id,
|
|
74
74
|
hash: result.hash
|
|
75
75
|
});
|
|
@@ -101,7 +101,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkNXST74TXcjs.Wallet {
|
|
|
101
101
|
};
|
|
102
102
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
103
103
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
104
|
-
logger:
|
|
104
|
+
logger: _chunkTC6ITDWVcjs.walletsLogger,
|
|
105
105
|
methodName: "solanaWallet.sendTransaction",
|
|
106
106
|
buildContext(thisArg) {
|
|
107
107
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk3ASKCQJNcjs = require('./chunk-3ASKCQJN.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkH3XAAMD3cjs = require('./chunk-H3XAAMD3.cjs');
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
|
|
@@ -18,10 +21,10 @@ var _chunkREP547HHcjs = require('./chunk-REP547HH.cjs');
|
|
|
18
21
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
19
22
|
|
|
20
23
|
|
|
21
|
-
var
|
|
24
|
+
var _chunkTC6ITDWVcjs = require('./chunk-TC6ITDWV.cjs');
|
|
22
25
|
|
|
23
26
|
|
|
24
|
-
var
|
|
27
|
+
var _chunkHH3MM7IJcjs = require('./chunk-HH3MM7IJ.cjs');
|
|
25
28
|
|
|
26
29
|
|
|
27
30
|
|
|
@@ -70,7 +73,8 @@ var Wallet = class {
|
|
|
70
73
|
}
|
|
71
74
|
balances(tokens) {
|
|
72
75
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
73
|
-
|
|
76
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.balances.start");
|
|
77
|
+
const resolvedChain = this.resolveChainForEnvironment();
|
|
74
78
|
let nativeToken;
|
|
75
79
|
switch (this.chain) {
|
|
76
80
|
case "solana":
|
|
@@ -85,20 +89,20 @@ var Wallet = class {
|
|
|
85
89
|
}
|
|
86
90
|
const allTokens = [nativeToken, "usdc", ...tokens != null ? tokens : []];
|
|
87
91
|
const response = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getBalance(this.address, {
|
|
88
|
-
chains: [
|
|
92
|
+
chains: [resolvedChain],
|
|
89
93
|
tokens: allTokens
|
|
90
94
|
});
|
|
91
95
|
if ("error" in response) {
|
|
92
|
-
|
|
96
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.balances.error", { error: response });
|
|
93
97
|
throw new Error(`Failed to get balances for wallet: ${JSON.stringify(response.message)}`);
|
|
94
98
|
}
|
|
95
|
-
|
|
99
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.balances.success");
|
|
96
100
|
return this.transformBalanceResponse(response, nativeToken, tokens);
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
103
|
stagingFund(amount, chain) {
|
|
100
104
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
101
|
-
|
|
105
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.stagingFund.start", {
|
|
102
106
|
amount,
|
|
103
107
|
chain: chain != null ? chain : this.chain
|
|
104
108
|
});
|
|
@@ -110,12 +114,12 @@ var Wallet = class {
|
|
|
110
114
|
chain: chain != null ? chain : this.chain
|
|
111
115
|
});
|
|
112
116
|
if ("error" in response) {
|
|
113
|
-
|
|
117
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.stagingFund.error", {
|
|
114
118
|
error: response
|
|
115
119
|
});
|
|
116
120
|
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
117
121
|
}
|
|
118
|
-
|
|
122
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.stagingFund.success");
|
|
119
123
|
return response;
|
|
120
124
|
});
|
|
121
125
|
}
|
|
@@ -227,7 +231,8 @@ var Wallet = class {
|
|
|
227
231
|
*/
|
|
228
232
|
experimental_activity() {
|
|
229
233
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
230
|
-
const
|
|
234
|
+
const resolvedChain = this.resolveChainForEnvironment();
|
|
235
|
+
const response = yield this.apiClient.experimental_activity(this.walletLocator, { chain: resolvedChain });
|
|
231
236
|
if ("error" in response) {
|
|
232
237
|
throw new Error(`Failed to get activity: ${JSON.stringify(response.message)}`);
|
|
233
238
|
}
|
|
@@ -236,9 +241,10 @@ var Wallet = class {
|
|
|
236
241
|
}
|
|
237
242
|
send(to, token, amount, options) {
|
|
238
243
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
244
|
+
const resolvedChain = this.resolveChainForEnvironment();
|
|
239
245
|
const recipient = toRecipientLocator(to);
|
|
240
|
-
const tokenLocator = toTokenLocator(token,
|
|
241
|
-
|
|
246
|
+
const tokenLocator = toTokenLocator(token, resolvedChain);
|
|
247
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.send.start", _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
242
248
|
recipient,
|
|
243
249
|
token: tokenLocator,
|
|
244
250
|
amount
|
|
@@ -250,7 +256,7 @@ var Wallet = class {
|
|
|
250
256
|
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {}), (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {});
|
|
251
257
|
const transactionCreationResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
252
258
|
if ("message" in transactionCreationResponse) {
|
|
253
|
-
|
|
259
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.send.error", {
|
|
254
260
|
error: transactionCreationResponse
|
|
255
261
|
});
|
|
256
262
|
throw new (0, _chunkXC2V34TScjs.TransactionNotCreatedError)(
|
|
@@ -258,7 +264,7 @@ var Wallet = class {
|
|
|
258
264
|
);
|
|
259
265
|
}
|
|
260
266
|
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
261
|
-
|
|
267
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.send.prepared", {
|
|
262
268
|
transactionId: transactionCreationResponse.id
|
|
263
269
|
});
|
|
264
270
|
return {
|
|
@@ -268,7 +274,7 @@ var Wallet = class {
|
|
|
268
274
|
};
|
|
269
275
|
}
|
|
270
276
|
const result = yield this.approveTransactionAndWait(transactionCreationResponse.id);
|
|
271
|
-
|
|
277
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.send.success", {
|
|
272
278
|
transactionId: transactionCreationResponse.id,
|
|
273
279
|
hash: result.hash
|
|
274
280
|
});
|
|
@@ -296,7 +302,7 @@ var Wallet = class {
|
|
|
296
302
|
}
|
|
297
303
|
approve(params) {
|
|
298
304
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
299
|
-
|
|
305
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.approve.start", {
|
|
300
306
|
transactionId: params.transactionId,
|
|
301
307
|
signatureId: params.signatureId
|
|
302
308
|
});
|
|
@@ -305,19 +311,19 @@ var Wallet = class {
|
|
|
305
311
|
params.transactionId,
|
|
306
312
|
params.options
|
|
307
313
|
);
|
|
308
|
-
|
|
314
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.approve.success", {
|
|
309
315
|
transactionId: params.transactionId
|
|
310
316
|
});
|
|
311
317
|
return result;
|
|
312
318
|
}
|
|
313
319
|
if (params.signatureId != null) {
|
|
314
320
|
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
315
|
-
|
|
321
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.approve.success", {
|
|
316
322
|
signatureId: params.signatureId
|
|
317
323
|
});
|
|
318
324
|
return result;
|
|
319
325
|
}
|
|
320
|
-
|
|
326
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.approve.error", {
|
|
321
327
|
error: "Either transactionId or signatureId must be provided"
|
|
322
328
|
});
|
|
323
329
|
throw new Error("Either transactionId or signatureId must be provided");
|
|
@@ -326,39 +332,39 @@ var Wallet = class {
|
|
|
326
332
|
addDelegatedSigner(params) {
|
|
327
333
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
328
334
|
var _a, _b, _c;
|
|
329
|
-
|
|
335
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
330
336
|
const response = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).registerSigner(this.walletLocator, {
|
|
331
337
|
signer: params.signer,
|
|
332
338
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
333
339
|
});
|
|
334
340
|
if ("error" in response) {
|
|
335
|
-
|
|
341
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
336
342
|
error: response
|
|
337
343
|
});
|
|
338
344
|
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
339
345
|
}
|
|
340
346
|
if (this.chain === "solana" || this.chain === "stellar") {
|
|
341
347
|
if (!("transaction" in response) || response.transaction == null) {
|
|
342
|
-
|
|
348
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
343
349
|
error: "Expected transaction in response for Solana/Stellar chain"
|
|
344
350
|
});
|
|
345
351
|
throw new Error("Expected transaction in response for Solana/Stellar chain");
|
|
346
352
|
}
|
|
347
353
|
const transactionId = response.transaction.id;
|
|
348
354
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
349
|
-
|
|
355
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
350
356
|
transactionId
|
|
351
357
|
});
|
|
352
358
|
return { transactionId };
|
|
353
359
|
}
|
|
354
360
|
yield this.approveTransactionAndWait(transactionId);
|
|
355
|
-
|
|
361
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
356
362
|
transactionId
|
|
357
363
|
});
|
|
358
364
|
return void 0;
|
|
359
365
|
}
|
|
360
366
|
if (!("chains" in response)) {
|
|
361
|
-
|
|
367
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
362
368
|
error: "Expected chains in response for EVM chain"
|
|
363
369
|
});
|
|
364
370
|
throw new Error("Expected chains in response for EVM chain");
|
|
@@ -366,42 +372,42 @@ var Wallet = class {
|
|
|
366
372
|
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
367
373
|
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
368
374
|
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
369
|
-
|
|
375
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", {
|
|
370
376
|
signatureId
|
|
371
377
|
});
|
|
372
378
|
return { signatureId };
|
|
373
379
|
}
|
|
374
380
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
375
381
|
yield this.approveSignatureAndWait(chainResponse.id);
|
|
376
|
-
|
|
382
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
377
383
|
signatureId: chainResponse.id
|
|
378
384
|
});
|
|
379
385
|
return void 0;
|
|
380
386
|
}
|
|
381
387
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
382
388
|
yield this.waitForSignature(chainResponse.id);
|
|
383
|
-
|
|
389
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.addDelegatedSigner.success", {
|
|
384
390
|
signatureId: chainResponse.id
|
|
385
391
|
});
|
|
386
392
|
return void 0;
|
|
387
393
|
}
|
|
388
|
-
|
|
394
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
389
395
|
return void 0;
|
|
390
396
|
});
|
|
391
397
|
}
|
|
392
398
|
delegatedSigners() {
|
|
393
399
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
394
400
|
var _a, _b, _c;
|
|
395
|
-
|
|
401
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.delegatedSigners.start");
|
|
396
402
|
const walletResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getWallet(this.walletLocator);
|
|
397
403
|
if ("error" in walletResponse) {
|
|
398
|
-
|
|
404
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
399
405
|
error: walletResponse
|
|
400
406
|
});
|
|
401
407
|
throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(walletResponse));
|
|
402
408
|
}
|
|
403
409
|
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
404
|
-
|
|
410
|
+
_chunkTC6ITDWVcjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
405
411
|
error: `Wallet type ${walletResponse.type} not supported`
|
|
406
412
|
});
|
|
407
413
|
throw new (0, _chunkXC2V34TScjs.WalletTypeNotSupportedError)(`Wallet type ${walletResponse.type} not supported`);
|
|
@@ -413,7 +419,7 @@ var Wallet = class {
|
|
|
413
419
|
signer: `external-wallet:${address}`
|
|
414
420
|
};
|
|
415
421
|
})) != null ? _c : [];
|
|
416
|
-
|
|
422
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.delegatedSigners.success", {
|
|
417
423
|
count: signers.length
|
|
418
424
|
});
|
|
419
425
|
return signers;
|
|
@@ -441,7 +447,7 @@ var Wallet = class {
|
|
|
441
447
|
}
|
|
442
448
|
preAuthIfNeeded() {
|
|
443
449
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
444
|
-
if (this.signer instanceof
|
|
450
|
+
if (this.signer instanceof _chunk3ASKCQJNcjs.NonCustodialSigner) {
|
|
445
451
|
yield this.signer.ensureAuthenticated();
|
|
446
452
|
}
|
|
447
453
|
});
|
|
@@ -449,6 +455,13 @@ var Wallet = class {
|
|
|
449
455
|
get isSolanaWallet() {
|
|
450
456
|
return this.chain === "solana";
|
|
451
457
|
}
|
|
458
|
+
resolveChainForEnvironment() {
|
|
459
|
+
const resolvedChain = _chunkH3XAAMD3cjs.validateChainForEnvironment.call(void 0, this.chain, _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).environment);
|
|
460
|
+
if (resolvedChain !== this.chain) {
|
|
461
|
+
this.chain = resolvedChain;
|
|
462
|
+
}
|
|
463
|
+
return this.chain;
|
|
464
|
+
}
|
|
452
465
|
approveTransactionAndWait(transactionId, options) {
|
|
453
466
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
454
467
|
yield this.approveTransactionInternal(transactionId, options);
|
|
@@ -544,7 +557,7 @@ var Wallet = class {
|
|
|
544
557
|
}
|
|
545
558
|
executeApproveTransactionWithErrorHandling(transactionId, approvals) {
|
|
546
559
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
547
|
-
|
|
560
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.approve: submitting approval to API", { transactionId });
|
|
548
561
|
const approvedTransaction = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).approveTransaction(this.walletLocator, transactionId, {
|
|
549
562
|
approvals
|
|
550
563
|
});
|
|
@@ -569,7 +582,7 @@ var Wallet = class {
|
|
|
569
582
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
570
583
|
let signatureResponse = null;
|
|
571
584
|
do {
|
|
572
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
585
|
+
yield new Promise((resolve) => setTimeout(resolve, _chunkHH3MM7IJcjs.STATUS_POLLING_INTERVAL_MS));
|
|
573
586
|
signatureResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getSignature(this.walletLocator, signatureId);
|
|
574
587
|
if ("error" in signatureResponse) {
|
|
575
588
|
throw new (0, _chunkXC2V34TScjs.SignatureNotAvailableError)(JSON.stringify(signatureResponse));
|
|
@@ -591,10 +604,10 @@ var Wallet = class {
|
|
|
591
604
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, arguments, function* (transactionId, timeoutMs = 6e4, {
|
|
592
605
|
backoffMultiplier = 1.1,
|
|
593
606
|
maxBackoffMs = 2e3,
|
|
594
|
-
initialBackoffMs =
|
|
607
|
+
initialBackoffMs = _chunkHH3MM7IJcjs.STATUS_POLLING_INTERVAL_MS
|
|
595
608
|
} = {}) {
|
|
596
609
|
var _a;
|
|
597
|
-
|
|
610
|
+
_chunkTC6ITDWVcjs.walletsLogger.info("wallet.approve: waiting for transaction confirmation", { transactionId, timeoutMs });
|
|
598
611
|
const startTime = Date.now();
|
|
599
612
|
let transactionResponse;
|
|
600
613
|
do {
|
|
@@ -643,7 +656,7 @@ _options = new WeakMap();
|
|
|
643
656
|
_apiClient = new WeakMap();
|
|
644
657
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
645
658
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
646
|
-
logger:
|
|
659
|
+
logger: _chunkTC6ITDWVcjs.walletsLogger,
|
|
647
660
|
methodName: "wallet.balances",
|
|
648
661
|
buildContext(thisArg) {
|
|
649
662
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -652,7 +665,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
652
665
|
], Wallet.prototype, "balances", 1);
|
|
653
666
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
654
667
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
655
|
-
logger:
|
|
668
|
+
logger: _chunkTC6ITDWVcjs.walletsLogger,
|
|
656
669
|
methodName: "wallet.stagingFund",
|
|
657
670
|
buildContext(thisArg) {
|
|
658
671
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -661,7 +674,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
661
674
|
], Wallet.prototype, "stagingFund", 1);
|
|
662
675
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
663
676
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
664
|
-
logger:
|
|
677
|
+
logger: _chunkTC6ITDWVcjs.walletsLogger,
|
|
665
678
|
methodName: "wallet.send",
|
|
666
679
|
buildContext(thisArg) {
|
|
667
680
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -670,7 +683,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
670
683
|
], Wallet.prototype, "send", 1);
|
|
671
684
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
672
685
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
673
|
-
logger:
|
|
686
|
+
logger: _chunkTC6ITDWVcjs.walletsLogger,
|
|
674
687
|
methodName: "wallet.approve",
|
|
675
688
|
buildContext(thisArg) {
|
|
676
689
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -679,7 +692,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
679
692
|
], Wallet.prototype, "approve", 1);
|
|
680
693
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
681
694
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
682
|
-
logger:
|
|
695
|
+
logger: _chunkTC6ITDWVcjs.walletsLogger,
|
|
683
696
|
methodName: "wallet.addDelegatedSigner",
|
|
684
697
|
buildContext(thisArg) {
|
|
685
698
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -688,7 +701,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
688
701
|
], Wallet.prototype, "addDelegatedSigner", 1);
|
|
689
702
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
690
703
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
691
|
-
logger:
|
|
704
|
+
logger: _chunkTC6ITDWVcjs.walletsLogger,
|
|
692
705
|
methodName: "wallet.delegatedSigners",
|
|
693
706
|
buildContext(thisArg) {
|
|
694
707
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkHH3MM7IJcjs = require('./chunk-HH3MM7IJ.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: _chunkHH3MM7IJcjs.SDK_NAME,
|
|
24
|
+
packageVersion: _chunkHH3MM7IJcjs.SDK_VERSION,
|
|
25
25
|
environment,
|
|
26
26
|
projectId,
|
|
27
27
|
platform
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_EVENT_OPTIONS,
|
|
3
3
|
NonCustodialSigner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-3KEY2NLC.js";
|
|
5
5
|
import {
|
|
6
6
|
walletsLogger
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
8
8
|
import {
|
|
9
9
|
__async
|
|
10
10
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DPZIHSN7.js";
|
|
4
4
|
import {
|
|
5
5
|
TransactionNotCreatedError
|
|
6
6
|
} from "./chunk-SGINWAB6.js";
|
|
7
7
|
import {
|
|
8
8
|
walletsLogger
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DZ6MCPD3.js";
|
|
10
10
|
import {
|
|
11
11
|
__async,
|
|
12
12
|
__decorateClass
|