@crossmint/wallets-sdk 0.18.7 → 0.18.9
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 +5 -5
- package/dist/api/client.js +4 -4
- package/dist/api/gen/client.gen.cjs +1 -1
- package/dist/api/gen/client.gen.js +1 -1
- package/dist/api/gen/index.cjs +3 -3
- package/dist/api/gen/index.js +2 -2
- package/dist/api/gen/sdk.gen.cjs +3 -3
- package/dist/api/gen/sdk.gen.js +2 -2
- 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 +5 -3
- package/dist/chains/chains.d.cts +1 -1
- package/dist/chains/chains.d.ts +1 -1
- package/dist/chains/chains.js +4 -2
- package/dist/chains/definitions/arcTestnet.cjs +7 -0
- package/dist/chains/definitions/arcTestnet.d.cts +43 -0
- package/dist/chains/definitions/arcTestnet.d.ts +43 -0
- package/dist/chains/definitions/arcTestnet.js +7 -0
- package/dist/chains/definitions/story.cjs +1 -1
- package/dist/chains/definitions/story.js +1 -1
- package/dist/chains/definitions/storyTestnet.cjs +1 -1
- package/dist/chains/definitions/storyTestnet.js +1 -1
- package/dist/chains/definitions/tempoTestnet.cjs +7 -0
- package/dist/chains/definitions/tempoTestnet.d.cts +43 -0
- package/dist/chains/definitions/tempoTestnet.d.ts +43 -0
- package/dist/chains/definitions/tempoTestnet.js +7 -0
- package/dist/{chunk-XTXWNKEW.cjs → chunk-223GEFZO.cjs} +3 -3
- package/dist/{chunk-ZTGRDOOH.js → chunk-2I2OFGNL.js} +1 -1
- package/dist/{chunk-JDZCRHTY.cjs → chunk-2ZSKJAOT.cjs} +60 -37
- package/dist/{chunk-ZOANONUJ.js → chunk-3RSZDA3X.js} +2 -2
- package/dist/{chunk-MZBFXUHT.js → chunk-47WKYTRN.js} +1 -1
- package/dist/{chunk-6FVQPO66.cjs → chunk-4GFSUI2I.cjs} +4 -4
- package/dist/{chunk-SD6JISMO.js → chunk-4QK4L5VF.js} +30 -7
- package/dist/{chunk-CN2GVFBU.cjs → chunk-5KDA2N2A.cjs} +13 -1
- package/dist/{chunk-5YQOFAXT.cjs → chunk-5M7F5ACW.cjs} +33 -10
- package/dist/{chunk-F4IOVQGC.js → chunk-5W4XWZHO.js} +1 -1
- package/dist/chunk-6Z5QSTIS.cjs +58 -0
- package/dist/{chunk-AL77JANE.js → chunk-7GOUUPS4.js} +1 -1
- package/dist/{chunk-KMJLRX2U.cjs → chunk-AN7MHABM.cjs} +6 -6
- package/dist/{chunk-FPMW7Q5O.js → chunk-ASE2FXWP.js} +10 -0
- package/dist/{chunk-57XM4JCJ.js → chunk-BILOL2NR.js} +66 -9
- package/dist/{chunk-RTRDZB52.js → chunk-BMMZIPXT.js} +1 -1
- package/dist/{chunk-V3QJQUT7.cjs → chunk-COR3CNRW.cjs} +128 -128
- package/dist/{chunk-3RMFEHPA.cjs → chunk-DLPFZLN7.cjs} +71 -14
- package/dist/{chunk-DPGKYBPQ.js → chunk-FOOISYCJ.js} +2 -2
- package/dist/{chunk-HGX4JKQO.js → chunk-FQUH37WQ.js} +1 -1
- package/dist/{chunk-C6XOBHAK.js → chunk-G2CYEQE2.js} +116 -50
- package/dist/{chunk-IW7ZXEEH.cjs → chunk-HMAWUNLS.cjs} +11 -11
- package/dist/chunk-HTSQPZHW.cjs +25 -0
- package/dist/{chunk-V4BXPC4K.cjs → chunk-IIGQSNJW.cjs} +1 -1
- package/dist/{chunk-YBA7WO32.cjs → chunk-IOMKHF6R.cjs} +3 -3
- package/dist/{chunk-EYJQSDDI.js → chunk-IPO25BCU.js} +1 -1
- package/dist/{chunk-KS63YEQ4.js → chunk-IZBTRZ6H.js} +13 -1
- package/dist/chunk-J5XAUV2V.cjs +25 -0
- package/dist/{chunk-CHGPNMRL.cjs → chunk-JSWTGW46.cjs} +3 -3
- package/dist/{chunk-SUEZ3ZZI.js → chunk-K4RPCL5B.js} +3 -3
- package/dist/{chunk-J34BVUZE.js → chunk-LOYQBZ5U.js} +29 -6
- package/dist/{chunk-BXKSBJGR.cjs → chunk-LQLIK47F.cjs} +29 -29
- package/dist/{chunk-2DXHWIAK.cjs → chunk-MNJA5EPY.cjs} +6 -6
- package/dist/{chunk-D5RIZNPL.js → chunk-NIVHH42N.js} +52 -29
- package/dist/{chunk-DQCXGBZM.js → chunk-PIFD6KNH.js} +1 -1
- package/dist/{chunk-WC7T2CR4.js → chunk-PK7J3Y3L.js} +1 -1
- package/dist/{chunk-6Q7KXVOM.cjs → chunk-PNCAKT7I.cjs} +166 -100
- package/dist/{chunk-R2OY54EJ.cjs → chunk-Q5KNPVYI.cjs} +3 -3
- package/dist/{chunk-XSZFANJU.js → chunk-RCK3ZEP7.js} +2 -2
- package/dist/{chunk-B42QPEM7.js → chunk-SYZKDDGK.js} +2 -2
- package/dist/chunk-T5QUCHZJ.js +25 -0
- package/dist/{chunk-XHHRPN7K.cjs → chunk-TEQYWMHS.cjs} +13 -13
- package/dist/{chunk-G5NYLGM5.cjs → chunk-UO2J2ZB2.cjs} +11 -1
- package/dist/{chunk-4YY7QG2J.js → chunk-UPS2UQJO.js} +2 -2
- package/dist/{chunk-OH2AXAJO.js → chunk-UZN67GMO.js} +9 -9
- package/dist/{chunk-ZTX2DZ6I.cjs → chunk-WCT4BKO2.cjs} +31 -8
- package/dist/{chunk-LULVNCZY.cjs → chunk-WFGKVGZ2.cjs} +7 -7
- package/dist/{chunk-LLFD22UQ.cjs → chunk-XOCC3MPK.cjs} +3 -3
- package/dist/{chunk-MXIFTAQ7.js → chunk-Z46X5PNX.js} +4 -4
- package/dist/chunk-ZBLW42YE.js +25 -0
- package/dist/{chunk-BSC55MYK.cjs → chunk-ZNAGDENG.cjs} +3 -3
- package/dist/{chunk-7ECQJFYM.cjs → chunk-ZTEMOYS2.cjs} +3 -3
- package/dist/index.cjs +26 -24
- package/dist/index.js +25 -23
- package/dist/logger/index.cjs +4 -4
- package/dist/logger/index.js +3 -3
- package/dist/logger/init.cjs +4 -4
- package/dist/logger/init.js +3 -3
- package/dist/sdk.cjs +20 -20
- package/dist/sdk.js +19 -19
- package/dist/signers/evm-api-key.cjs +3 -3
- package/dist/signers/evm-api-key.js +2 -2
- package/dist/signers/evm-external-wallet.cjs +3 -3
- package/dist/signers/evm-external-wallet.js +2 -2
- package/dist/signers/index.cjs +14 -14
- package/dist/signers/index.js +13 -13
- 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-iframe-manager.cjs +3 -3
- package/dist/signers/non-custodial/ncs-iframe-manager.js +2 -2
- 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/passkey.cjs +3 -3
- package/dist/signers/passkey.js +2 -2
- package/dist/signers/solana-api-key.cjs +3 -3
- package/dist/signers/solana-api-key.js +2 -2
- package/dist/signers/solana-external-wallet.cjs +3 -3
- package/dist/signers/solana-external-wallet.js +2 -2
- package/dist/signers/stellar-external-wallet.cjs +3 -3
- package/dist/signers/stellar-external-wallet.js +2 -2
- package/dist/signers/types.cjs +1 -1
- package/dist/signers/types.js +1 -1
- package/dist/utils/constants.cjs +3 -3
- package/dist/utils/constants.js +2 -2
- package/dist/utils/errors.cjs +1 -1
- package/dist/utils/errors.js +1 -1
- package/dist/utils/signer-validation.cjs +1 -1
- package/dist/utils/signer-validation.js +1 -1
- package/dist/wallets/evm.cjs +15 -11
- package/dist/wallets/evm.js +14 -10
- package/dist/wallets/solana.cjs +13 -11
- package/dist/wallets/solana.js +12 -10
- package/dist/wallets/stellar.cjs +12 -10
- package/dist/wallets/stellar.js +11 -9
- package/dist/wallets/wallet-factory.cjs +18 -18
- package/dist/wallets/wallet-factory.js +17 -17
- package/dist/wallets/wallet.cjs +11 -9
- package/dist/wallets/wallet.js +10 -8
- package/package.json +3 -3
- package/dist/chunk-T4C3VL7H.cjs +0 -58
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkPNCAKT7Icjs = require('./chunk-PNCAKT7I.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -8,15 +8,19 @@ var _chunk6Q7KXVOMcjs = require('./chunk-6Q7KXVOM.cjs');
|
|
|
8
8
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk5KDA2N2Acjs = require('./chunk-5KDA2N2A.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk223GEFZOcjs = require('./chunk-223GEFZO.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
15
19
|
|
|
16
20
|
// src/wallets/evm.ts
|
|
17
21
|
var _viem = require('viem');
|
|
18
22
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
19
|
-
var
|
|
23
|
+
var _EVMWallet = class _EVMWallet extends _chunkPNCAKT7Icjs.Wallet {
|
|
20
24
|
constructor(wallet) {
|
|
21
25
|
super(
|
|
22
26
|
{
|
|
@@ -24,10 +28,10 @@ var EVMWallet = class _EVMWallet extends _chunk6Q7KXVOMcjs.Wallet {
|
|
|
24
28
|
address: wallet.address,
|
|
25
29
|
owner: wallet.owner,
|
|
26
30
|
signer: wallet.signer,
|
|
27
|
-
options:
|
|
31
|
+
options: _chunkPNCAKT7Icjs.Wallet.getOptions(wallet),
|
|
28
32
|
alias: wallet.alias
|
|
29
33
|
},
|
|
30
|
-
|
|
34
|
+
_chunkPNCAKT7Icjs.Wallet.getApiClient(wallet)
|
|
31
35
|
);
|
|
32
36
|
}
|
|
33
37
|
static from(wallet) {
|
|
@@ -37,24 +41,34 @@ var EVMWallet = class _EVMWallet extends _chunk6Q7KXVOMcjs.Wallet {
|
|
|
37
41
|
return new _EVMWallet(wallet);
|
|
38
42
|
}
|
|
39
43
|
sendTransaction(params) {
|
|
40
|
-
return
|
|
44
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
41
45
|
var _a;
|
|
46
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.sendTransaction.start");
|
|
42
47
|
yield this.preAuthIfNeeded();
|
|
43
48
|
const builtTransaction = this.buildTransaction(params);
|
|
44
49
|
const createdTransaction = yield this.createTransaction(builtTransaction, params.options);
|
|
45
50
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
51
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.sendTransaction.prepared", {
|
|
52
|
+
transactionId: createdTransaction.id
|
|
53
|
+
});
|
|
46
54
|
return {
|
|
47
55
|
hash: void 0,
|
|
48
56
|
explorerLink: void 0,
|
|
49
57
|
transactionId: createdTransaction.id
|
|
50
58
|
};
|
|
51
59
|
}
|
|
52
|
-
|
|
60
|
+
const result = yield this.approveTransactionAndWait(createdTransaction.id);
|
|
61
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.sendTransaction.success", {
|
|
62
|
+
transactionId: createdTransaction.id,
|
|
63
|
+
hash: result.hash
|
|
64
|
+
});
|
|
65
|
+
return result;
|
|
53
66
|
});
|
|
54
67
|
}
|
|
55
68
|
signMessage(params) {
|
|
56
|
-
return
|
|
69
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
57
70
|
var _a;
|
|
71
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.signMessage.start");
|
|
58
72
|
yield this.preAuthIfNeeded();
|
|
59
73
|
const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
|
|
60
74
|
type: "message",
|
|
@@ -65,27 +79,36 @@ var EVMWallet = class _EVMWallet extends _chunk6Q7KXVOMcjs.Wallet {
|
|
|
65
79
|
}
|
|
66
80
|
});
|
|
67
81
|
if ("error" in signatureCreationResponse) {
|
|
82
|
+
_chunk223GEFZOcjs.walletsLogger.error("evmWallet.signMessage.error", { error: signatureCreationResponse });
|
|
68
83
|
throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
|
|
69
84
|
}
|
|
70
85
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
86
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.signMessage.prepared", {
|
|
87
|
+
signatureId: signatureCreationResponse.id
|
|
88
|
+
});
|
|
71
89
|
return {
|
|
72
90
|
signature: void 0,
|
|
73
91
|
signatureId: signatureCreationResponse.id
|
|
74
92
|
};
|
|
75
93
|
}
|
|
76
|
-
|
|
94
|
+
const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
|
|
95
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.signMessage.success", { signatureId: signatureCreationResponse.id });
|
|
96
|
+
return result;
|
|
77
97
|
});
|
|
78
98
|
}
|
|
79
99
|
signTypedData(params) {
|
|
80
|
-
return
|
|
100
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
81
101
|
var _a;
|
|
102
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.signTypedData.start");
|
|
82
103
|
yield this.preAuthIfNeeded();
|
|
83
104
|
const { domain, message, primaryType, types, chain } = params;
|
|
84
105
|
if (!domain || !message || !types || !chain) {
|
|
106
|
+
_chunk223GEFZOcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data" });
|
|
85
107
|
throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data");
|
|
86
108
|
}
|
|
87
109
|
const { name, version, chainId, verifyingContract, salt } = domain;
|
|
88
110
|
if (!name || !version || !chainId || !verifyingContract) {
|
|
111
|
+
_chunk223GEFZOcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: "Invalid typed data domain" });
|
|
89
112
|
throw new (0, _chunkXC2V34TScjs.InvalidTypedDataError)("Invalid typed data domain");
|
|
90
113
|
}
|
|
91
114
|
const signatureCreationResponse = yield this.apiClient.createSignature(this.walletLocator, {
|
|
@@ -108,26 +131,32 @@ var EVMWallet = class _EVMWallet extends _chunk6Q7KXVOMcjs.Wallet {
|
|
|
108
131
|
}
|
|
109
132
|
});
|
|
110
133
|
if ("error" in signatureCreationResponse) {
|
|
134
|
+
_chunk223GEFZOcjs.walletsLogger.error("evmWallet.signTypedData.error", { error: signatureCreationResponse });
|
|
111
135
|
throw new (0, _chunkXC2V34TScjs.SignatureNotCreatedError)(JSON.stringify(signatureCreationResponse));
|
|
112
136
|
}
|
|
113
137
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
138
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.signTypedData.prepared", {
|
|
139
|
+
signatureId: signatureCreationResponse.id
|
|
140
|
+
});
|
|
114
141
|
return {
|
|
115
142
|
signature: void 0,
|
|
116
143
|
signatureId: signatureCreationResponse.id
|
|
117
144
|
};
|
|
118
145
|
}
|
|
119
|
-
|
|
146
|
+
const result = yield this.approveSignatureAndWait(signatureCreationResponse.id);
|
|
147
|
+
_chunk223GEFZOcjs.walletsLogger.info("evmWallet.signTypedData.success", { signatureId: signatureCreationResponse.id });
|
|
148
|
+
return result;
|
|
120
149
|
});
|
|
121
150
|
}
|
|
122
151
|
getViemClient(params) {
|
|
123
152
|
var _a;
|
|
124
153
|
return _viem.createPublicClient.call(void 0, {
|
|
125
154
|
transport: (_a = params == null ? void 0 : params.transport) != null ? _a : _viem.http.call(void 0, ),
|
|
126
|
-
chain:
|
|
155
|
+
chain: _chunk5KDA2N2Acjs.toViemChain.call(void 0, this.chain)
|
|
127
156
|
});
|
|
128
157
|
}
|
|
129
158
|
createTransaction(transaction, options) {
|
|
130
|
-
return
|
|
159
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
131
160
|
var _a;
|
|
132
161
|
const signer = (_a = options == null ? void 0 : options.experimental_signer) != null ? _a : this.signer.locator();
|
|
133
162
|
const transactionCreationResponse = yield this.apiClient.createTransaction(this.walletLocator, {
|
|
@@ -169,6 +198,34 @@ var EVMWallet = class _EVMWallet extends _chunk6Q7KXVOMcjs.Wallet {
|
|
|
169
198
|
};
|
|
170
199
|
}
|
|
171
200
|
};
|
|
201
|
+
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
202
|
+
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
203
|
+
logger: _chunk223GEFZOcjs.walletsLogger,
|
|
204
|
+
methodName: "evmWallet.sendTransaction",
|
|
205
|
+
buildContext(thisArg) {
|
|
206
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
], _EVMWallet.prototype, "sendTransaction", 1);
|
|
210
|
+
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
211
|
+
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
212
|
+
logger: _chunk223GEFZOcjs.walletsLogger,
|
|
213
|
+
methodName: "evmWallet.signMessage",
|
|
214
|
+
buildContext(thisArg) {
|
|
215
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
216
|
+
}
|
|
217
|
+
})
|
|
218
|
+
], _EVMWallet.prototype, "signMessage", 1);
|
|
219
|
+
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
220
|
+
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
221
|
+
logger: _chunk223GEFZOcjs.walletsLogger,
|
|
222
|
+
methodName: "evmWallet.signTypedData",
|
|
223
|
+
buildContext(thisArg) {
|
|
224
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
225
|
+
}
|
|
226
|
+
})
|
|
227
|
+
], _EVMWallet.prototype, "signTypedData", 1);
|
|
228
|
+
var EVMWallet = _EVMWallet;
|
|
172
229
|
|
|
173
230
|
|
|
174
231
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__async
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ASE2FXWP.js";
|
|
4
4
|
|
|
5
5
|
// src/signers/non-custodial/ncs-iframe-manager.ts
|
|
6
6
|
import { IFrameWindow, SignersWindowTransport } from "@crossmint/client-sdk-window";
|
|
@@ -28,7 +28,7 @@ var NcsIframeManager = class {
|
|
|
28
28
|
outgoingEvents: signerInboundEvents,
|
|
29
29
|
handshakeOptions: {
|
|
30
30
|
timeoutMs: 3e4,
|
|
31
|
-
intervalMs:
|
|
31
|
+
intervalMs: 100
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
SignersWindowTransport
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
NonCustodialSigner
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RCK3ZEP7.js";
|
|
4
4
|
import {
|
|
5
5
|
InvalidSignerError,
|
|
6
6
|
SignatureFailedError,
|
|
@@ -16,20 +16,24 @@ import {
|
|
|
16
16
|
WalletNotAvailableError,
|
|
17
17
|
WalletTypeNotSupportedError
|
|
18
18
|
} from "./chunk-SGINWAB6.js";
|
|
19
|
+
import {
|
|
20
|
+
walletsLogger
|
|
21
|
+
} from "./chunk-FQUH37WQ.js";
|
|
19
22
|
import {
|
|
20
23
|
STATUS_POLLING_INTERVAL_MS
|
|
21
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-5W4XWZHO.js";
|
|
22
25
|
import {
|
|
23
26
|
__async,
|
|
27
|
+
__decorateClass,
|
|
24
28
|
__privateAdd,
|
|
25
29
|
__privateGet,
|
|
26
30
|
__privateSet,
|
|
27
31
|
__spreadProps,
|
|
28
32
|
__spreadValues
|
|
29
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-ASE2FXWP.js";
|
|
30
34
|
|
|
31
35
|
// src/wallets/wallet.ts
|
|
32
|
-
import { isValidAddress } from "@crossmint/common-sdk-base";
|
|
36
|
+
import { isValidAddress, WithLoggerContext } from "@crossmint/common-sdk-base";
|
|
33
37
|
var _options, _apiClient;
|
|
34
38
|
var Wallet = class {
|
|
35
39
|
constructor(args, apiClient) {
|
|
@@ -64,15 +68,9 @@ var Wallet = class {
|
|
|
64
68
|
experimental_apiClient() {
|
|
65
69
|
return __privateGet(this, _apiClient);
|
|
66
70
|
}
|
|
67
|
-
/**
|
|
68
|
-
* Get the wallet balances - always includes USDC and native token (ETH/SOL)
|
|
69
|
-
* @param {string[]} tokens - Additional tokens to request (optional: native token and usdc are always included)
|
|
70
|
-
* @param {Chain[]} chains - The chains (optional)
|
|
71
|
-
* @returns {Promise<Balances<C>>} The balances returns nativeToken, usdc, tokens
|
|
72
|
-
* @throws {Error} If the balances cannot be retrieved
|
|
73
|
-
*/
|
|
74
71
|
balances(tokens, chains) {
|
|
75
72
|
return __async(this, null, function* () {
|
|
73
|
+
walletsLogger.info("wallet.balances.start");
|
|
76
74
|
let nativeToken;
|
|
77
75
|
switch (this.chain) {
|
|
78
76
|
case "solana":
|
|
@@ -91,23 +89,16 @@ var Wallet = class {
|
|
|
91
89
|
tokens: allTokens
|
|
92
90
|
});
|
|
93
91
|
if ("error" in response) {
|
|
92
|
+
walletsLogger.error("wallet.balances.error", { error: response });
|
|
94
93
|
throw new Error(`Failed to get balances for wallet: ${JSON.stringify(response.message)}`);
|
|
95
94
|
}
|
|
95
|
+
walletsLogger.info("wallet.balances.success");
|
|
96
96
|
return this.transformBalanceResponse(response, nativeToken, tokens);
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
|
-
/**
|
|
100
|
-
* Funds the wallet with Crossmint's stablecoin (USDXM).
|
|
101
|
-
*
|
|
102
|
-
* **Note:** This method is only available in staging environments and exclusively supports USDXM tokens.
|
|
103
|
-
* It cannot be used in production environments.
|
|
104
|
-
* @param amount - The amount of USDXM to fund the wallet with
|
|
105
|
-
* @param chain - Optional chain to fund on. If not provided, uses the wallet's default chain
|
|
106
|
-
* @returns The funding response
|
|
107
|
-
* @throws {Error} If the funding operation fails or if called in a production environment
|
|
108
|
-
*/
|
|
109
99
|
stagingFund(amount, chain) {
|
|
110
100
|
return __async(this, null, function* () {
|
|
101
|
+
walletsLogger.info("wallet.stagingFund.start", { amount, chain: chain != null ? chain : this.chain });
|
|
111
102
|
const response = yield this.apiClient.fundWallet(this.address, {
|
|
112
103
|
amount,
|
|
113
104
|
token: "usdxm",
|
|
@@ -116,8 +107,10 @@ var Wallet = class {
|
|
|
116
107
|
chain: chain != null ? chain : this.chain
|
|
117
108
|
});
|
|
118
109
|
if ("error" in response) {
|
|
110
|
+
walletsLogger.error("wallet.stagingFund.error", { error: response });
|
|
119
111
|
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
120
112
|
}
|
|
113
|
+
walletsLogger.info("wallet.stagingFund.success");
|
|
121
114
|
return response;
|
|
122
115
|
});
|
|
123
116
|
}
|
|
@@ -234,37 +227,37 @@ var Wallet = class {
|
|
|
234
227
|
return response;
|
|
235
228
|
});
|
|
236
229
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Send a token to a wallet or user locator
|
|
239
|
-
* @param {string | UserLocator} to - The recipient (address or user locator)
|
|
240
|
-
* @param {string} token - The token (address or currency symbol)
|
|
241
|
-
* @param {string} amount - The amount to send (decimal units)
|
|
242
|
-
* @param {TransactionInputOptions} options - The options for the transaction
|
|
243
|
-
* @returns {Transaction} The transaction
|
|
244
|
-
*/
|
|
245
230
|
send(to, token, amount, options) {
|
|
246
231
|
return __async(this, null, function* () {
|
|
247
|
-
yield this.preAuthIfNeeded();
|
|
248
232
|
const recipient = toRecipientLocator(to);
|
|
249
233
|
const tokenLocator = toTokenLocator(token, this.chain);
|
|
234
|
+
walletsLogger.info("wallet.send.start", { recipient, token: tokenLocator, amount });
|
|
235
|
+
yield this.preAuthIfNeeded();
|
|
250
236
|
const sendParams = __spreadValues({
|
|
251
237
|
recipient,
|
|
252
238
|
amount
|
|
253
239
|
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {});
|
|
254
240
|
const transactionCreationResponse = yield __privateGet(this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
255
241
|
if ("message" in transactionCreationResponse) {
|
|
242
|
+
walletsLogger.error("wallet.send.error", { error: transactionCreationResponse });
|
|
256
243
|
throw new TransactionNotCreatedError(
|
|
257
244
|
`Failed to send token: ${JSON.stringify(transactionCreationResponse.message)}`
|
|
258
245
|
);
|
|
259
246
|
}
|
|
260
247
|
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
248
|
+
walletsLogger.info("wallet.send.prepared", { transactionId: transactionCreationResponse.id });
|
|
261
249
|
return {
|
|
262
250
|
hash: void 0,
|
|
263
251
|
explorerLink: void 0,
|
|
264
252
|
transactionId: transactionCreationResponse.id
|
|
265
253
|
};
|
|
266
254
|
}
|
|
267
|
-
|
|
255
|
+
const result = yield this.approveTransactionAndWait(transactionCreationResponse.id);
|
|
256
|
+
walletsLogger.info("wallet.send.success", {
|
|
257
|
+
transactionId: transactionCreationResponse.id,
|
|
258
|
+
hash: result.hash
|
|
259
|
+
});
|
|
260
|
+
return result;
|
|
268
261
|
});
|
|
269
262
|
}
|
|
270
263
|
/**
|
|
@@ -286,90 +279,109 @@ var Wallet = class {
|
|
|
286
279
|
return yield this.approve(params);
|
|
287
280
|
});
|
|
288
281
|
}
|
|
289
|
-
/**
|
|
290
|
-
* Approve a transaction or signature
|
|
291
|
-
* @param params - The parameters
|
|
292
|
-
* @param params.transactionId - The transaction id or
|
|
293
|
-
* @param params.signatureId - The signature id
|
|
294
|
-
* @param params.options - The options for the transaction
|
|
295
|
-
* @param params.options.experimental_approval - The approval
|
|
296
|
-
* @param params.options.additionalSigners - The additional signers
|
|
297
|
-
* @returns The transaction or signature
|
|
298
|
-
*/
|
|
299
282
|
approve(params) {
|
|
300
283
|
return __async(this, null, function* () {
|
|
284
|
+
walletsLogger.info("wallet.approve.start", {
|
|
285
|
+
transactionId: params.transactionId,
|
|
286
|
+
signatureId: params.signatureId
|
|
287
|
+
});
|
|
301
288
|
if (params.transactionId != null) {
|
|
302
|
-
|
|
289
|
+
const result = yield this.approveTransactionAndWait(
|
|
290
|
+
params.transactionId,
|
|
291
|
+
params.options
|
|
292
|
+
);
|
|
293
|
+
walletsLogger.info("wallet.approve.success", { transactionId: params.transactionId });
|
|
294
|
+
return result;
|
|
303
295
|
}
|
|
304
296
|
if (params.signatureId != null) {
|
|
305
|
-
|
|
297
|
+
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
298
|
+
walletsLogger.info("wallet.approve.success", { signatureId: params.signatureId });
|
|
299
|
+
return result;
|
|
306
300
|
}
|
|
301
|
+
walletsLogger.error("wallet.approve.error", {
|
|
302
|
+
error: "Either transactionId or signatureId must be provided"
|
|
303
|
+
});
|
|
307
304
|
throw new Error("Either transactionId or signatureId must be provided");
|
|
308
305
|
});
|
|
309
306
|
}
|
|
310
|
-
/**
|
|
311
|
-
* Add a delegated signer to the wallet
|
|
312
|
-
* @param signer - The signer. For Solana, it must be a string. For EVM, it can be a string or a passkey.
|
|
313
|
-
* @param options - The options for the operation
|
|
314
|
-
* @param options.experimental_prepareOnly - If true, returns the transaction/signature ID without auto-approving
|
|
315
|
-
*/
|
|
316
307
|
addDelegatedSigner(params) {
|
|
317
308
|
return __async(this, null, function* () {
|
|
318
309
|
var _a, _b, _c;
|
|
310
|
+
walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
319
311
|
const response = yield __privateGet(this, _apiClient).registerSigner(this.walletLocator, {
|
|
320
312
|
signer: params.signer,
|
|
321
313
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
322
314
|
});
|
|
323
315
|
if ("error" in response) {
|
|
316
|
+
walletsLogger.error("wallet.addDelegatedSigner.error", { error: response });
|
|
324
317
|
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
325
318
|
}
|
|
326
319
|
if (this.chain === "solana" || this.chain === "stellar") {
|
|
327
320
|
if (!("transaction" in response) || response.transaction == null) {
|
|
321
|
+
walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
322
|
+
error: "Expected transaction in response for Solana/Stellar chain"
|
|
323
|
+
});
|
|
328
324
|
throw new Error("Expected transaction in response for Solana/Stellar chain");
|
|
329
325
|
}
|
|
330
326
|
const transactionId = response.transaction.id;
|
|
331
327
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
328
|
+
walletsLogger.info("wallet.addDelegatedSigner.prepared", { transactionId });
|
|
332
329
|
return { transactionId };
|
|
333
330
|
}
|
|
334
331
|
yield this.approveTransactionAndWait(transactionId);
|
|
332
|
+
walletsLogger.info("wallet.addDelegatedSigner.success", { transactionId });
|
|
335
333
|
return void 0;
|
|
336
334
|
}
|
|
337
335
|
if (!("chains" in response)) {
|
|
336
|
+
walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
337
|
+
error: "Expected chains in response for EVM chain"
|
|
338
|
+
});
|
|
338
339
|
throw new Error("Expected chains in response for EVM chain");
|
|
339
340
|
}
|
|
340
341
|
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
341
342
|
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
342
343
|
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
344
|
+
walletsLogger.info("wallet.addDelegatedSigner.prepared", { signatureId });
|
|
343
345
|
return { signatureId };
|
|
344
346
|
}
|
|
345
347
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
346
348
|
yield this.approveSignatureAndWait(chainResponse.id);
|
|
349
|
+
walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
|
|
347
350
|
return void 0;
|
|
348
351
|
}
|
|
349
352
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
350
353
|
yield this.waitForSignature(chainResponse.id);
|
|
354
|
+
walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
|
|
351
355
|
return void 0;
|
|
352
356
|
}
|
|
357
|
+
walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
353
358
|
return void 0;
|
|
354
359
|
});
|
|
355
360
|
}
|
|
356
361
|
delegatedSigners() {
|
|
357
362
|
return __async(this, null, function* () {
|
|
358
363
|
var _a, _b, _c;
|
|
364
|
+
walletsLogger.info("wallet.delegatedSigners.start");
|
|
359
365
|
const walletResponse = yield __privateGet(this, _apiClient).getWallet(this.walletLocator);
|
|
360
366
|
if ("error" in walletResponse) {
|
|
367
|
+
walletsLogger.error("wallet.delegatedSigners.error", { error: walletResponse });
|
|
361
368
|
throw new WalletNotAvailableError(JSON.stringify(walletResponse));
|
|
362
369
|
}
|
|
363
370
|
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
371
|
+
walletsLogger.error("wallet.delegatedSigners.error", {
|
|
372
|
+
error: `Wallet type ${walletResponse.type} not supported`
|
|
373
|
+
});
|
|
364
374
|
throw new WalletTypeNotSupportedError(`Wallet type ${walletResponse.type} not supported`);
|
|
365
375
|
}
|
|
366
|
-
|
|
376
|
+
const signers = (_c = (_b = (_a = walletResponse == null ? void 0 : walletResponse.config) == null ? void 0 : _a.delegatedSigners) == null ? void 0 : _b.map((signer) => {
|
|
367
377
|
const colonIndex = signer.locator.indexOf(":");
|
|
368
378
|
const address = colonIndex >= 0 ? signer.locator.slice(colonIndex + 1) : signer.locator;
|
|
369
379
|
return {
|
|
370
380
|
signer: `external-wallet:${address}`
|
|
371
381
|
};
|
|
372
382
|
})) != null ? _c : [];
|
|
383
|
+
walletsLogger.info("wallet.delegatedSigners.success", { count: signers.length });
|
|
384
|
+
return signers;
|
|
373
385
|
});
|
|
374
386
|
}
|
|
375
387
|
get walletLocator() {
|
|
@@ -596,6 +608,60 @@ var Wallet = class {
|
|
|
596
608
|
};
|
|
597
609
|
_options = new WeakMap();
|
|
598
610
|
_apiClient = new WeakMap();
|
|
611
|
+
__decorateClass([
|
|
612
|
+
WithLoggerContext({
|
|
613
|
+
logger: walletsLogger,
|
|
614
|
+
methodName: "wallet.balances",
|
|
615
|
+
buildContext(thisArg) {
|
|
616
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
617
|
+
}
|
|
618
|
+
})
|
|
619
|
+
], Wallet.prototype, "balances", 1);
|
|
620
|
+
__decorateClass([
|
|
621
|
+
WithLoggerContext({
|
|
622
|
+
logger: walletsLogger,
|
|
623
|
+
methodName: "wallet.stagingFund",
|
|
624
|
+
buildContext(thisArg) {
|
|
625
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
626
|
+
}
|
|
627
|
+
})
|
|
628
|
+
], Wallet.prototype, "stagingFund", 1);
|
|
629
|
+
__decorateClass([
|
|
630
|
+
WithLoggerContext({
|
|
631
|
+
logger: walletsLogger,
|
|
632
|
+
methodName: "wallet.send",
|
|
633
|
+
buildContext(thisArg) {
|
|
634
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
635
|
+
}
|
|
636
|
+
})
|
|
637
|
+
], Wallet.prototype, "send", 1);
|
|
638
|
+
__decorateClass([
|
|
639
|
+
WithLoggerContext({
|
|
640
|
+
logger: walletsLogger,
|
|
641
|
+
methodName: "wallet.approve",
|
|
642
|
+
buildContext(thisArg) {
|
|
643
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
644
|
+
}
|
|
645
|
+
})
|
|
646
|
+
], Wallet.prototype, "approve", 1);
|
|
647
|
+
__decorateClass([
|
|
648
|
+
WithLoggerContext({
|
|
649
|
+
logger: walletsLogger,
|
|
650
|
+
methodName: "wallet.addDelegatedSigner",
|
|
651
|
+
buildContext(thisArg) {
|
|
652
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
653
|
+
}
|
|
654
|
+
})
|
|
655
|
+
], Wallet.prototype, "addDelegatedSigner", 1);
|
|
656
|
+
__decorateClass([
|
|
657
|
+
WithLoggerContext({
|
|
658
|
+
logger: walletsLogger,
|
|
659
|
+
methodName: "wallet.delegatedSigners",
|
|
660
|
+
buildContext(thisArg) {
|
|
661
|
+
return { chain: thisArg.chain, address: thisArg.address };
|
|
662
|
+
}
|
|
663
|
+
})
|
|
664
|
+
], Wallet.prototype, "delegatedSigners", 1);
|
|
599
665
|
function toRecipientLocator(to) {
|
|
600
666
|
if (typeof to === "string") {
|
|
601
667
|
return to;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk2ZSKJAOTcjs = require('./chunk-2ZSKJAOT.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkLQLIK47Fcjs = require('./chunk-LQLIK47F.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk223GEFZOcjs = require('./chunk-223GEFZO.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
14
14
|
|
|
15
15
|
// src/sdk.ts
|
|
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
|
+
_chunk223GEFZOcjs.initWalletsLogger.call(void 0, crossmint.apiKey);
|
|
20
|
+
const apiClient = new (0, _chunkLQLIK47Fcjs.ApiClient)(crossmint);
|
|
21
|
+
this.walletFactory = new (0, _chunk2ZSKJAOTcjs.WalletFactory)(apiClient);
|
|
22
|
+
_chunk223GEFZOcjs.walletsLogger.info("wallets.sdk.initialized");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Initialize the Wallets SDK
|
|
@@ -36,7 +36,7 @@ var CrossmintWallets = class _CrossmintWallets {
|
|
|
36
36
|
* @returns An existing wallet or a new wallet
|
|
37
37
|
*/
|
|
38
38
|
getOrCreateWallet(options) {
|
|
39
|
-
return
|
|
39
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
40
40
|
return yield this.walletFactory.getOrCreateWallet(options);
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -47,7 +47,7 @@ var CrossmintWallets = class _CrossmintWallets {
|
|
|
47
47
|
* @returns A wallet if found, throws WalletNotAvailableError if not found
|
|
48
48
|
*/
|
|
49
49
|
getWallet(walletLocator, options) {
|
|
50
|
-
return
|
|
50
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
51
51
|
return yield this.walletFactory.getWallet(walletLocator, options);
|
|
52
52
|
});
|
|
53
53
|
}
|
|
@@ -57,7 +57,7 @@ var CrossmintWallets = class _CrossmintWallets {
|
|
|
57
57
|
* @returns A new wallet
|
|
58
58
|
*/
|
|
59
59
|
createWallet(options) {
|
|
60
|
-
return
|
|
60
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
61
61
|
return yield this.walletFactory.createWallet(options);
|
|
62
62
|
});
|
|
63
63
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/chains/definitions/arcTestnet.ts
|
|
2
|
+
var _viem = require('viem');
|
|
3
|
+
var arcTestnet = _viem.defineChain.call(void 0, {
|
|
4
|
+
id: 5042002,
|
|
5
|
+
name: "Arc Testnet",
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 6,
|
|
8
|
+
name: "USDC",
|
|
9
|
+
symbol: "USDC"
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ["https://rpc.testnet.arc.network"] }
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: "Arc Testnet Explorer",
|
|
17
|
+
url: "https://testnet.arcscan.app"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
testnet: true
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
exports.arcTestnet = arcTestnet;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
4
4
|
|
|
5
5
|
// src/signers/stellar-external-wallet.ts
|
|
6
6
|
var StellarExternalWalletSigner = class {
|
|
@@ -20,12 +20,12 @@ var StellarExternalWalletSigner = class {
|
|
|
20
20
|
return this.config.locator;
|
|
21
21
|
}
|
|
22
22
|
signMessage() {
|
|
23
|
-
return
|
|
23
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
24
24
|
return yield Promise.reject(new Error("signMessage method not implemented for stellar external wallet signer"));
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
signTransaction(payload) {
|
|
28
|
-
return
|
|
28
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
29
29
|
if (this.onSignStellarTransaction == null) {
|
|
30
30
|
return yield Promise.reject(
|
|
31
31
|
new Error(
|