@crossmint/wallets-sdk 0.18.10 → 0.18.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.js +3 -3
- package/dist/api/gen/index.cjs +1 -1
- package/dist/api/gen/index.js +1 -1
- package/dist/api/index.cjs +4 -4
- package/dist/api/index.js +3 -3
- package/dist/{chunk-ZJUXMOUB.js → chunk-23HJV5QR.js} +2 -3
- package/dist/{chunk-TYN3KL7U.cjs → chunk-2YEF7ARX.cjs} +9 -9
- package/dist/{chunk-OWGPEA2A.cjs → chunk-3K3ZODTJ.cjs} +5 -6
- package/dist/{chunk-73EJIGRV.js → chunk-EDVMJRYK.js} +2 -2
- package/dist/{chunk-QXJZ75GW.cjs → chunk-EP3UIAFB.cjs} +38 -38
- package/dist/{chunk-LVSVT2VD.js → chunk-FYJW7Q2N.js} +1 -1
- package/dist/{chunk-KMHPLOVX.js → chunk-G2NUNSFB.js} +3 -3
- package/dist/{chunk-NBDHZJ44.cjs → chunk-IG557MDN.cjs} +7 -7
- package/dist/{chunk-AZIXXLMP.cjs → chunk-K45GD5NV.cjs} +12 -12
- package/dist/{chunk-OFQDCA2H.cjs → chunk-K4KXB2EM.cjs} +1 -1
- package/dist/{chunk-IYTDGUGZ.js → chunk-LXWT2YKV.js} +2 -2
- package/dist/{chunk-YNLL6GP4.js → chunk-OZ5QGDNP.js} +2 -2
- package/dist/{chunk-GRAV7BTN.cjs → chunk-QOBVGFJV.cjs} +9 -9
- package/dist/{chunk-CQNVHQHH.js → chunk-SF4JGPRB.js} +2 -2
- package/dist/{chunk-5KFST6KH.cjs → chunk-SZCB7LEX.cjs} +17 -17
- package/dist/{chunk-R5TY6M5Z.js → chunk-VBKKSVLN.js} +2 -2
- package/dist/{chunk-NIHJXITI.js → chunk-VYVA567V.js} +2 -2
- package/dist/{chunk-UXNFYAIS.cjs → chunk-WW2RXFIY.cjs} +21 -21
- package/dist/index.cjs +10 -10
- package/dist/index.js +9 -9
- package/dist/logger/index.cjs +3 -3
- package/dist/logger/index.js +2 -2
- package/dist/logger/init.cjs +3 -3
- package/dist/logger/init.js +2 -2
- package/dist/sdk.cjs +7 -7
- package/dist/sdk.js +6 -6
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/evm.cjs +5 -5
- package/dist/wallets/evm.js +4 -4
- package/dist/wallets/solana.cjs +5 -5
- package/dist/wallets/solana.js +4 -4
- package/dist/wallets/stellar.cjs +5 -5
- package/dist/wallets/stellar.js +4 -4
- package/dist/wallets/wallet-factory.cjs +5 -5
- package/dist/wallets/wallet-factory.js +4 -4
- package/dist/wallets/wallet.cjs +4 -4
- package/dist/wallets/wallet.js +3 -3
- package/package.json +4 -5
package/dist/api/client.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkK45GD5NVcjs = require('../chunk-K45GD5NV.cjs');
|
|
4
4
|
require('../chunk-XC2V34TS.cjs');
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-3K3ZODTJ.cjs');
|
|
6
|
+
require('../chunk-K4KXB2EM.cjs');
|
|
7
7
|
require('../chunk-UO2J2ZB2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.ApiClient =
|
|
10
|
+
exports.ApiClient = _chunkK45GD5NVcjs.ApiClient;
|
package/dist/api/client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-SF4JGPRB.js";
|
|
4
4
|
import "../chunk-SGINWAB6.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-23HJV5QR.js";
|
|
6
|
+
import "../chunk-FYJW7Q2N.js";
|
|
7
7
|
import "../chunk-ASE2FXWP.js";
|
|
8
8
|
export {
|
|
9
9
|
ApiClient
|
package/dist/api/gen/index.cjs
CHANGED
package/dist/api/gen/index.js
CHANGED
|
@@ -86,8 +86,8 @@ import {
|
|
|
86
86
|
walletsV2025ControllerSubmitSignatureApprovals2,
|
|
87
87
|
walletsVerifyRecipientControllerVerifyWalletOwnership2
|
|
88
88
|
} from "../../chunk-BMMZIPXT.js";
|
|
89
|
-
import "../../chunk-YMRXMNME.js";
|
|
90
89
|
import "../../chunk-KT3CVXFG.js";
|
|
90
|
+
import "../../chunk-YMRXMNME.js";
|
|
91
91
|
import "../../chunk-ASE2FXWP.js";
|
|
92
92
|
export {
|
|
93
93
|
balanceControllerFundWallet2,
|
package/dist/api/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkK45GD5NVcjs = require('../chunk-K45GD5NV.cjs');
|
|
5
5
|
require('../chunk-XC2V34TS.cjs');
|
|
6
6
|
require('../chunk-ECAM5KTH.cjs');
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-3K3ZODTJ.cjs');
|
|
8
|
+
require('../chunk-K4KXB2EM.cjs');
|
|
9
9
|
require('../chunk-UO2J2ZB2.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.ApiClient =
|
|
12
|
+
exports.ApiClient = _chunkK45GD5NVcjs.ApiClient;
|
package/dist/api/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "../chunk-5IFDVB4Y.js";
|
|
2
2
|
import {
|
|
3
3
|
ApiClient
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-SF4JGPRB.js";
|
|
5
5
|
import "../chunk-SGINWAB6.js";
|
|
6
6
|
import "../chunk-KBJA7JDT.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-23HJV5QR.js";
|
|
8
|
+
import "../chunk-FYJW7Q2N.js";
|
|
9
9
|
import "../chunk-ASE2FXWP.js";
|
|
10
10
|
export {
|
|
11
11
|
ApiClient
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SDK_NAME,
|
|
3
3
|
SDK_VERSION
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FYJW7Q2N.js";
|
|
5
5
|
|
|
6
6
|
// src/logger/init.ts
|
|
7
7
|
import {
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
validateAPIKey,
|
|
12
12
|
ServerDatadogSink
|
|
13
13
|
} from "@crossmint/common-sdk-base";
|
|
14
|
-
import * as datadogLogger from "@datadog/browser-logs";
|
|
15
14
|
var walletsLogger = new SdkLogger();
|
|
16
15
|
function initWalletsLogger(apiKey) {
|
|
17
16
|
const platform = detectPlatform();
|
|
@@ -29,7 +28,7 @@ function initWalletsLogger(apiKey) {
|
|
|
29
28
|
});
|
|
30
29
|
switch (platform) {
|
|
31
30
|
case "browser": {
|
|
32
|
-
const sink = new BrowserDatadogSink(environment
|
|
31
|
+
const sink = new BrowserDatadogSink(environment);
|
|
33
32
|
walletsLogger.addSink(sink);
|
|
34
33
|
break;
|
|
35
34
|
}
|
|
@@ -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 _chunkEP3UIAFBcjs = require('./chunk-EP3UIAFB.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 _chunk3K3ZODTJcjs = require('./chunk-3K3ZODTJ.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 _chunkEP3UIAFBcjs.Wallet {
|
|
22
22
|
constructor(wallet) {
|
|
23
23
|
super(
|
|
24
24
|
{
|
|
@@ -26,10 +26,10 @@ var _SolanaWallet = class _SolanaWallet extends _chunkQXJZ75GWcjs.Wallet {
|
|
|
26
26
|
address: wallet.address,
|
|
27
27
|
owner: wallet.owner,
|
|
28
28
|
signer: wallet.signer,
|
|
29
|
-
options:
|
|
29
|
+
options: _chunkEP3UIAFBcjs.Wallet.getOptions(wallet),
|
|
30
30
|
alias: wallet.alias
|
|
31
31
|
},
|
|
32
|
-
|
|
32
|
+
_chunkEP3UIAFBcjs.Wallet.getApiClient(wallet)
|
|
33
33
|
);
|
|
34
34
|
}
|
|
35
35
|
static from(wallet) {
|
|
@@ -41,11 +41,11 @@ var _SolanaWallet = class _SolanaWallet extends _chunkQXJZ75GWcjs.Wallet {
|
|
|
41
41
|
sendTransaction(params) {
|
|
42
42
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
43
43
|
var _a, _b;
|
|
44
|
-
|
|
44
|
+
_chunk3K3ZODTJcjs.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
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("solanaWallet.sendTransaction.prepared", {
|
|
49
49
|
transactionId: createdTransaction.id
|
|
50
50
|
});
|
|
51
51
|
return {
|
|
@@ -69,7 +69,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkQXJZ75GWcjs.Wallet {
|
|
|
69
69
|
additionalSigners: _additionalSigners
|
|
70
70
|
};
|
|
71
71
|
const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
|
|
72
|
-
|
|
72
|
+
_chunk3K3ZODTJcjs.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 _chunkQXJZ75GWcjs.Wallet {
|
|
|
101
101
|
};
|
|
102
102
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
103
103
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
104
|
-
logger:
|
|
104
|
+
logger: _chunk3K3ZODTJcjs.walletsLogger,
|
|
105
105
|
methodName: "solanaWallet.sendTransaction",
|
|
106
106
|
buildContext(thisArg) {
|
|
107
107
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkK4KXB2EMcjs = require('./chunk-K4KXB2EM.cjs');
|
|
5
5
|
|
|
6
6
|
// src/logger/init.ts
|
|
7
7
|
|
|
@@ -11,7 +11,6 @@ var _chunkOFQDCA2Hcjs = require('./chunk-OFQDCA2H.cjs');
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
14
|
-
var _browserlogs = require('@datadog/browser-logs'); var datadogLogger = _interopRequireWildcard(_browserlogs);
|
|
15
14
|
var walletsLogger = new (0, _commonsdkbase.SdkLogger)();
|
|
16
15
|
function initWalletsLogger(apiKey) {
|
|
17
16
|
const platform = _commonsdkbase.detectPlatform.call(void 0, );
|
|
@@ -21,15 +20,15 @@ function initWalletsLogger(apiKey) {
|
|
|
21
20
|
}
|
|
22
21
|
const { environment, projectId } = validationResult;
|
|
23
22
|
walletsLogger.init({
|
|
24
|
-
packageName:
|
|
25
|
-
packageVersion:
|
|
23
|
+
packageName: _chunkK4KXB2EMcjs.SDK_NAME,
|
|
24
|
+
packageVersion: _chunkK4KXB2EMcjs.SDK_VERSION,
|
|
26
25
|
environment,
|
|
27
26
|
projectId,
|
|
28
27
|
platform
|
|
29
28
|
});
|
|
30
29
|
switch (platform) {
|
|
31
30
|
case "browser": {
|
|
32
|
-
const sink = new (0, _commonsdkbase.BrowserDatadogSink)(environment
|
|
31
|
+
const sink = new (0, _commonsdkbase.BrowserDatadogSink)(environment);
|
|
33
32
|
walletsLogger.addSink(sink);
|
|
34
33
|
break;
|
|
35
34
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-LXWT2YKV.js";
|
|
4
4
|
import {
|
|
5
5
|
SolanaExternalWalletSigner
|
|
6
6
|
} from "./chunk-PIFD6KNH.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-SGINWAB6.js";
|
|
10
10
|
import {
|
|
11
11
|
walletsLogger
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-23HJV5QR.js";
|
|
13
13
|
import {
|
|
14
14
|
__async,
|
|
15
15
|
__decorateClass
|
|
@@ -18,10 +18,10 @@ var _chunkTEQYWMHScjs = require('./chunk-TEQYWMHS.cjs');
|
|
|
18
18
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunk3K3ZODTJcjs = require('./chunk-3K3ZODTJ.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkK4KXB2EMcjs = require('./chunk-K4KXB2EM.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -70,7 +70,7 @@ var Wallet = class {
|
|
|
70
70
|
}
|
|
71
71
|
balances(tokens, chains) {
|
|
72
72
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
73
|
-
|
|
73
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.balances.start");
|
|
74
74
|
let nativeToken;
|
|
75
75
|
switch (this.chain) {
|
|
76
76
|
case "solana":
|
|
@@ -89,16 +89,16 @@ var Wallet = class {
|
|
|
89
89
|
tokens: allTokens
|
|
90
90
|
});
|
|
91
91
|
if ("error" in response) {
|
|
92
|
-
|
|
92
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.balances.error", { error: response });
|
|
93
93
|
throw new Error(`Failed to get balances for wallet: ${JSON.stringify(response.message)}`);
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.balances.success");
|
|
96
96
|
return this.transformBalanceResponse(response, nativeToken, tokens);
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
stagingFund(amount, chain) {
|
|
100
100
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
101
|
-
|
|
101
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.stagingFund.start", { amount, chain: chain != null ? chain : this.chain });
|
|
102
102
|
const response = yield this.apiClient.fundWallet(this.address, {
|
|
103
103
|
amount,
|
|
104
104
|
token: "usdxm",
|
|
@@ -107,10 +107,10 @@ var Wallet = class {
|
|
|
107
107
|
chain: chain != null ? chain : this.chain
|
|
108
108
|
});
|
|
109
109
|
if ("error" in response) {
|
|
110
|
-
|
|
110
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.stagingFund.error", { error: response });
|
|
111
111
|
throw new Error(`Failed to fund wallet: ${JSON.stringify(response.message)}`);
|
|
112
112
|
}
|
|
113
|
-
|
|
113
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.stagingFund.success");
|
|
114
114
|
return response;
|
|
115
115
|
});
|
|
116
116
|
}
|
|
@@ -231,7 +231,7 @@ var Wallet = class {
|
|
|
231
231
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
232
232
|
const recipient = toRecipientLocator(to);
|
|
233
233
|
const tokenLocator = toTokenLocator(token, this.chain);
|
|
234
|
-
|
|
234
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.send.start", { recipient, token: tokenLocator, amount });
|
|
235
235
|
yield this.preAuthIfNeeded();
|
|
236
236
|
const sendParams = _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
237
237
|
recipient,
|
|
@@ -239,13 +239,13 @@ var Wallet = class {
|
|
|
239
239
|
}, (options == null ? void 0 : options.experimental_signer) != null ? { signer: options.experimental_signer } : {});
|
|
240
240
|
const transactionCreationResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
241
241
|
if ("message" in transactionCreationResponse) {
|
|
242
|
-
|
|
242
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.send.error", { error: transactionCreationResponse });
|
|
243
243
|
throw new (0, _chunkXC2V34TScjs.TransactionNotCreatedError)(
|
|
244
244
|
`Failed to send token: ${JSON.stringify(transactionCreationResponse.message)}`
|
|
245
245
|
);
|
|
246
246
|
}
|
|
247
247
|
if (options == null ? void 0 : options.experimental_prepareOnly) {
|
|
248
|
-
|
|
248
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.send.prepared", { transactionId: transactionCreationResponse.id });
|
|
249
249
|
return {
|
|
250
250
|
hash: void 0,
|
|
251
251
|
explorerLink: void 0,
|
|
@@ -253,7 +253,7 @@ var Wallet = class {
|
|
|
253
253
|
};
|
|
254
254
|
}
|
|
255
255
|
const result = yield this.approveTransactionAndWait(transactionCreationResponse.id);
|
|
256
|
-
|
|
256
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.send.success", {
|
|
257
257
|
transactionId: transactionCreationResponse.id,
|
|
258
258
|
hash: result.hash
|
|
259
259
|
});
|
|
@@ -281,7 +281,7 @@ var Wallet = class {
|
|
|
281
281
|
}
|
|
282
282
|
approve(params) {
|
|
283
283
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
284
|
-
|
|
284
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.approve.start", {
|
|
285
285
|
transactionId: params.transactionId,
|
|
286
286
|
signatureId: params.signatureId
|
|
287
287
|
});
|
|
@@ -290,15 +290,15 @@ var Wallet = class {
|
|
|
290
290
|
params.transactionId,
|
|
291
291
|
params.options
|
|
292
292
|
);
|
|
293
|
-
|
|
293
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.approve.success", { transactionId: params.transactionId });
|
|
294
294
|
return result;
|
|
295
295
|
}
|
|
296
296
|
if (params.signatureId != null) {
|
|
297
297
|
const result = yield this.approveSignatureAndWait(params.signatureId, params.options);
|
|
298
|
-
|
|
298
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.approve.success", { signatureId: params.signatureId });
|
|
299
299
|
return result;
|
|
300
300
|
}
|
|
301
|
-
|
|
301
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.approve.error", {
|
|
302
302
|
error: "Either transactionId or signatureId must be provided"
|
|
303
303
|
});
|
|
304
304
|
throw new Error("Either transactionId or signatureId must be provided");
|
|
@@ -307,33 +307,33 @@ var Wallet = class {
|
|
|
307
307
|
addDelegatedSigner(params) {
|
|
308
308
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
309
309
|
var _a, _b, _c;
|
|
310
|
-
|
|
310
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
311
311
|
const response = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).registerSigner(this.walletLocator, {
|
|
312
312
|
signer: params.signer,
|
|
313
313
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
314
314
|
});
|
|
315
315
|
if ("error" in response) {
|
|
316
|
-
|
|
316
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.addDelegatedSigner.error", { error: response });
|
|
317
317
|
throw new Error(`Failed to register signer: ${JSON.stringify(response.message)}`);
|
|
318
318
|
}
|
|
319
319
|
if (this.chain === "solana" || this.chain === "stellar") {
|
|
320
320
|
if (!("transaction" in response) || response.transaction == null) {
|
|
321
|
-
|
|
321
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
322
322
|
error: "Expected transaction in response for Solana/Stellar chain"
|
|
323
323
|
});
|
|
324
324
|
throw new Error("Expected transaction in response for Solana/Stellar chain");
|
|
325
325
|
}
|
|
326
326
|
const transactionId = response.transaction.id;
|
|
327
327
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
328
|
-
|
|
328
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", { transactionId });
|
|
329
329
|
return { transactionId };
|
|
330
330
|
}
|
|
331
331
|
yield this.approveTransactionAndWait(transactionId);
|
|
332
|
-
|
|
332
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.addDelegatedSigner.success", { transactionId });
|
|
333
333
|
return void 0;
|
|
334
334
|
}
|
|
335
335
|
if (!("chains" in response)) {
|
|
336
|
-
|
|
336
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.addDelegatedSigner.error", {
|
|
337
337
|
error: "Expected chains in response for EVM chain"
|
|
338
338
|
});
|
|
339
339
|
throw new Error("Expected chains in response for EVM chain");
|
|
@@ -341,34 +341,34 @@ var Wallet = class {
|
|
|
341
341
|
const chainResponse = (_b = response.chains) == null ? void 0 : _b[this.chain];
|
|
342
342
|
if ((_c = params.options) == null ? void 0 : _c.experimental_prepareOnly) {
|
|
343
343
|
const signatureId = (chainResponse == null ? void 0 : chainResponse.status) !== "success" ? chainResponse == null ? void 0 : chainResponse.id : void 0;
|
|
344
|
-
|
|
344
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.addDelegatedSigner.prepared", { signatureId });
|
|
345
345
|
return { signatureId };
|
|
346
346
|
}
|
|
347
347
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "awaiting-approval") {
|
|
348
348
|
yield this.approveSignatureAndWait(chainResponse.id);
|
|
349
|
-
|
|
349
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
|
|
350
350
|
return void 0;
|
|
351
351
|
}
|
|
352
352
|
if ((chainResponse == null ? void 0 : chainResponse.status) === "pending") {
|
|
353
353
|
yield this.waitForSignature(chainResponse.id);
|
|
354
|
-
|
|
354
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.addDelegatedSigner.success", { signatureId: chainResponse.id });
|
|
355
355
|
return void 0;
|
|
356
356
|
}
|
|
357
|
-
|
|
357
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.addDelegatedSigner.success");
|
|
358
358
|
return void 0;
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
delegatedSigners() {
|
|
362
362
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
363
363
|
var _a, _b, _c;
|
|
364
|
-
|
|
364
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.delegatedSigners.start");
|
|
365
365
|
const walletResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getWallet(this.walletLocator);
|
|
366
366
|
if ("error" in walletResponse) {
|
|
367
|
-
|
|
367
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.delegatedSigners.error", { error: walletResponse });
|
|
368
368
|
throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(walletResponse));
|
|
369
369
|
}
|
|
370
370
|
if (walletResponse.type !== "smart" || walletResponse.chainType !== "evm" && walletResponse.chainType !== "solana" && walletResponse.chainType !== "stellar") {
|
|
371
|
-
|
|
371
|
+
_chunk3K3ZODTJcjs.walletsLogger.error("wallet.delegatedSigners.error", {
|
|
372
372
|
error: `Wallet type ${walletResponse.type} not supported`
|
|
373
373
|
});
|
|
374
374
|
throw new (0, _chunkXC2V34TScjs.WalletTypeNotSupportedError)(`Wallet type ${walletResponse.type} not supported`);
|
|
@@ -380,7 +380,7 @@ var Wallet = class {
|
|
|
380
380
|
signer: `external-wallet:${address}`
|
|
381
381
|
};
|
|
382
382
|
})) != null ? _c : [];
|
|
383
|
-
|
|
383
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallet.delegatedSigners.success", { count: signers.length });
|
|
384
384
|
return signers;
|
|
385
385
|
});
|
|
386
386
|
}
|
|
@@ -537,7 +537,7 @@ var Wallet = class {
|
|
|
537
537
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
538
538
|
let signatureResponse = null;
|
|
539
539
|
do {
|
|
540
|
-
yield new Promise((resolve) => setTimeout(resolve,
|
|
540
|
+
yield new Promise((resolve) => setTimeout(resolve, _chunkK4KXB2EMcjs.STATUS_POLLING_INTERVAL_MS));
|
|
541
541
|
signatureResponse = yield _chunkUO2J2ZB2cjs.__privateGet.call(void 0, this, _apiClient).getSignature(this.walletLocator, signatureId);
|
|
542
542
|
if ("error" in signatureResponse) {
|
|
543
543
|
throw new (0, _chunkXC2V34TScjs.SignatureNotAvailableError)(JSON.stringify(signatureResponse));
|
|
@@ -559,7 +559,7 @@ var Wallet = class {
|
|
|
559
559
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, arguments, function* (transactionId, timeoutMs = 6e4, {
|
|
560
560
|
backoffMultiplier = 1.1,
|
|
561
561
|
maxBackoffMs = 2e3,
|
|
562
|
-
initialBackoffMs =
|
|
562
|
+
initialBackoffMs = _chunkK4KXB2EMcjs.STATUS_POLLING_INTERVAL_MS
|
|
563
563
|
} = {}) {
|
|
564
564
|
var _a;
|
|
565
565
|
const startTime = Date.now();
|
|
@@ -610,7 +610,7 @@ _options = new WeakMap();
|
|
|
610
610
|
_apiClient = new WeakMap();
|
|
611
611
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
612
612
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
613
|
-
logger:
|
|
613
|
+
logger: _chunk3K3ZODTJcjs.walletsLogger,
|
|
614
614
|
methodName: "wallet.balances",
|
|
615
615
|
buildContext(thisArg) {
|
|
616
616
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -619,7 +619,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
619
619
|
], Wallet.prototype, "balances", 1);
|
|
620
620
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
621
621
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
622
|
-
logger:
|
|
622
|
+
logger: _chunk3K3ZODTJcjs.walletsLogger,
|
|
623
623
|
methodName: "wallet.stagingFund",
|
|
624
624
|
buildContext(thisArg) {
|
|
625
625
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -628,7 +628,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
628
628
|
], Wallet.prototype, "stagingFund", 1);
|
|
629
629
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
630
630
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
631
|
-
logger:
|
|
631
|
+
logger: _chunk3K3ZODTJcjs.walletsLogger,
|
|
632
632
|
methodName: "wallet.send",
|
|
633
633
|
buildContext(thisArg) {
|
|
634
634
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -637,7 +637,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
637
637
|
], Wallet.prototype, "send", 1);
|
|
638
638
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
639
639
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
640
|
-
logger:
|
|
640
|
+
logger: _chunk3K3ZODTJcjs.walletsLogger,
|
|
641
641
|
methodName: "wallet.approve",
|
|
642
642
|
buildContext(thisArg) {
|
|
643
643
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -646,7 +646,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
646
646
|
], Wallet.prototype, "approve", 1);
|
|
647
647
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
648
648
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
649
|
-
logger:
|
|
649
|
+
logger: _chunk3K3ZODTJcjs.walletsLogger,
|
|
650
650
|
methodName: "wallet.addDelegatedSigner",
|
|
651
651
|
buildContext(thisArg) {
|
|
652
652
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -655,7 +655,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
655
655
|
], Wallet.prototype, "addDelegatedSigner", 1);
|
|
656
656
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
657
657
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
658
|
-
logger:
|
|
658
|
+
logger: _chunk3K3ZODTJcjs.walletsLogger,
|
|
659
659
|
methodName: "wallet.delegatedSigners",
|
|
660
660
|
buildContext(thisArg) {
|
|
661
661
|
return { chain: thisArg.chain, address: thisArg.address };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WalletFactory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VYVA567V.js";
|
|
4
4
|
import {
|
|
5
5
|
ApiClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SF4JGPRB.js";
|
|
7
7
|
import {
|
|
8
8
|
initWalletsLogger,
|
|
9
9
|
walletsLogger
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-23HJV5QR.js";
|
|
11
11
|
import {
|
|
12
12
|
__async
|
|
13
13
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSZCB7LEXcjs = require('./chunk-SZCB7LEX.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkK45GD5NVcjs = require('./chunk-K45GD5NV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk3K3ZODTJcjs = require('./chunk-3K3ZODTJ.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
@@ -16,10 +16,10 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
16
16
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
17
17
|
var CrossmintWallets = class _CrossmintWallets {
|
|
18
18
|
constructor(crossmint) {
|
|
19
|
-
|
|
20
|
-
const apiClient = new (0,
|
|
21
|
-
this.walletFactory = new (0,
|
|
22
|
-
|
|
19
|
+
_chunk3K3ZODTJcjs.initWalletsLogger.call(void 0, crossmint.apiKey);
|
|
20
|
+
const apiClient = new (0, _chunkK45GD5NVcjs.ApiClient)(crossmint);
|
|
21
|
+
this.walletFactory = new (0, _chunkSZCB7LEXcjs.WalletFactory)(apiClient);
|
|
22
|
+
_chunk3K3ZODTJcjs.walletsLogger.info("wallets.sdk.initialized");
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Initialize the Wallets SDK
|