@crossmint/wallets-sdk 0.18.4 → 0.18.6
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 -3
- package/dist/api/client.js +3 -2
- package/dist/api/gen/index.cjs +1 -1
- package/dist/api/gen/index.js +1 -1
- package/dist/api/index.cjs +4 -3
- package/dist/api/index.js +3 -2
- package/dist/{chunk-HNRM45KF.cjs → chunk-34FDYDOM.cjs} +4 -4
- package/dist/{chunk-COVOGZ4S.js → chunk-454RYNSZ.js} +1 -1
- package/dist/chunk-455NK5LB.js +0 -0
- package/dist/{chunk-XH3ARVJG.cjs → chunk-5BP6CVYY.cjs} +12 -12
- package/dist/{chunk-DPERJZBG.js → chunk-5YR2ILEW.js} +8 -2
- package/dist/{chunk-5H5YHSCK.js → chunk-6G7ZWCCG.js} +54 -7
- package/dist/{chunk-E4LJ7252.cjs → chunk-B6JOIWRH.cjs} +1 -1
- package/dist/chunk-CCIGWTAO.cjs +1 -0
- package/dist/{chunk-BAULM7A2.js → chunk-CL44FTXR.js} +1 -1
- package/dist/{chunk-BFAU2NL6.js → chunk-E3OS753T.js} +1 -1
- package/dist/{chunk-PSPNZEG4.cjs → chunk-F6E3ZDRG.cjs} +4 -4
- package/dist/chunk-G3LEJR3P.cjs +53 -0
- package/dist/{chunk-OD5RGQ4Z.js → chunk-GLRDLJS5.js} +1 -1
- package/dist/{chunk-SG7WIZLK.cjs → chunk-GNF2U7IX.cjs} +10 -4
- package/dist/{chunk-RSPJPRQW.cjs → chunk-GQIZWD4F.cjs} +46 -7
- package/dist/{chunk-BAHU3KZE.cjs → chunk-HYKMSBCT.cjs} +3 -3
- package/dist/{chunk-YOJETSLN.cjs → chunk-IVNYZDI5.cjs} +3 -3
- package/dist/{chunk-AJCWEEWH.js → chunk-K3HFAPSV.js} +1 -1
- package/dist/{chunk-MYKPHXUR.cjs → chunk-LGONZW4W.cjs} +6 -6
- package/dist/{chunk-MPGPBFUZ.cjs → chunk-LHYSCUKJ.cjs} +1 -1
- package/dist/{chunk-EM6H7EUU.cjs → chunk-LKAO2MV2.cjs} +3 -3
- package/dist/{chunk-FK23BDCU.js → chunk-OKXSUK63.js} +1 -1
- package/dist/chunk-RAWKXOHR.js +53 -0
- package/dist/{chunk-7GHQBCRV.cjs → chunk-RBHGZDDX.cjs} +2 -1
- package/dist/{chunk-7QL5JVK4.js → chunk-S5YXROL6.js} +44 -5
- package/dist/{chunk-2DHIAP2S.js → chunk-TOHXQVLS.js} +10 -10
- package/dist/{chunk-4QGBVHV3.js → chunk-UKBWSQ7R.js} +4 -4
- package/dist/{chunk-4BMNDPJ4.cjs → chunk-UMGB3Q7I.cjs} +4 -4
- package/dist/{chunk-FAGFW4AR.js → chunk-WQVJM3PG.js} +1 -1
- package/dist/{chunk-HHDDI3CS.js → chunk-XRA5GFH3.js} +1 -1
- package/dist/{chunk-JICSSJOK.js → chunk-ZP4ZZCIE.js} +1 -0
- package/dist/{chunk-2VOEAAFA.cjs → chunk-ZZJ7U5G3.cjs} +53 -6
- package/dist/index.cjs +19 -17
- package/dist/index.js +18 -16
- package/dist/logger/index.cjs +11 -0
- package/dist/logger/index.d.cts +2 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger/index.js +11 -0
- package/dist/logger/init.cjs +10 -0
- package/dist/logger/init.d.cts +15 -0
- package/dist/logger/init.d.ts +15 -0
- package/dist/logger/init.js +10 -0
- package/dist/sdk.cjs +16 -14
- package/dist/sdk.js +15 -13
- package/dist/signers/index.cjs +8 -8
- package/dist/signers/index.js +7 -7
- package/dist/signers/non-custodial/index.cjs +5 -5
- package/dist/signers/non-custodial/index.js +6 -6
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +3 -3
- package/dist/signers/non-custodial/ncs-evm-signer.js +2 -2
- package/dist/signers/non-custodial/ncs-signer.cjs +2 -2
- package/dist/signers/non-custodial/ncs-signer.js +1 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +3 -3
- package/dist/signers/non-custodial/ncs-solana-signer.js +2 -2
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +3 -3
- package/dist/signers/non-custodial/ncs-stellar-signer.js +2 -2
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/utils/signer-validation.cjs +4 -2
- package/dist/utils/signer-validation.d.cts +7 -1
- package/dist/utils/signer-validation.d.ts +7 -1
- package/dist/utils/signer-validation.js +5 -3
- package/dist/wallets/evm.cjs +8 -8
- package/dist/wallets/evm.js +7 -7
- package/dist/wallets/solana.cjs +8 -8
- package/dist/wallets/solana.js +7 -7
- package/dist/wallets/stellar.cjs +8 -8
- package/dist/wallets/stellar.js +7 -7
- package/dist/wallets/wallet-factory.cjs +14 -12
- package/dist/wallets/wallet-factory.js +13 -11
- package/dist/wallets/wallet.cjs +7 -7
- package/dist/wallets/wallet.js +6 -6
- package/package.json +6 -5
package/dist/api/client.cjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-MPGPBFUZ.cjs');
|
|
3
|
+
var _chunkZZJ7U5G3cjs = require('../chunk-ZZJ7U5G3.cjs');
|
|
5
4
|
require('../chunk-XC2V34TS.cjs');
|
|
5
|
+
require('../chunk-G3LEJR3P.cjs');
|
|
6
|
+
require('../chunk-LHYSCUKJ.cjs');
|
|
6
7
|
require('../chunk-G5NYLGM5.cjs');
|
|
7
8
|
|
|
8
9
|
|
|
9
|
-
exports.ApiClient =
|
|
10
|
+
exports.ApiClient = _chunkZZJ7U5G3cjs.ApiClient;
|
package/dist/api/client.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiClient
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-FAGFW4AR.js";
|
|
3
|
+
} from "../chunk-6G7ZWCCG.js";
|
|
5
4
|
import "../chunk-SGINWAB6.js";
|
|
5
|
+
import "../chunk-RAWKXOHR.js";
|
|
6
|
+
import "../chunk-WQVJM3PG.js";
|
|
6
7
|
import "../chunk-FPMW7Q5O.js";
|
|
7
8
|
export {
|
|
8
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-RTRDZB52.js";
|
|
89
|
-
import "../../chunk-YMRXMNME.js";
|
|
90
89
|
import "../../chunk-KT3CVXFG.js";
|
|
90
|
+
import "../../chunk-YMRXMNME.js";
|
|
91
91
|
import "../../chunk-FPMW7Q5O.js";
|
|
92
92
|
export {
|
|
93
93
|
balanceControllerFundWallet2,
|
package/dist/api/index.cjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('../chunk-MPGPBFUZ.cjs');
|
|
4
|
+
var _chunkZZJ7U5G3cjs = require('../chunk-ZZJ7U5G3.cjs');
|
|
6
5
|
require('../chunk-XC2V34TS.cjs');
|
|
7
6
|
require('../chunk-ECAM5KTH.cjs');
|
|
7
|
+
require('../chunk-G3LEJR3P.cjs');
|
|
8
|
+
require('../chunk-LHYSCUKJ.cjs');
|
|
8
9
|
require('../chunk-G5NYLGM5.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
exports.ApiClient =
|
|
12
|
+
exports.ApiClient = _chunkZZJ7U5G3cjs.ApiClient;
|
package/dist/api/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import "../chunk-5IFDVB4Y.js";
|
|
2
2
|
import {
|
|
3
3
|
ApiClient
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-FAGFW4AR.js";
|
|
4
|
+
} from "../chunk-6G7ZWCCG.js";
|
|
6
5
|
import "../chunk-SGINWAB6.js";
|
|
7
6
|
import "../chunk-KBJA7JDT.js";
|
|
7
|
+
import "../chunk-RAWKXOHR.js";
|
|
8
|
+
import "../chunk-WQVJM3PG.js";
|
|
8
9
|
import "../chunk-FPMW7Q5O.js";
|
|
9
10
|
export {
|
|
10
11
|
ApiClient
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLGONZW4Wcjs = require('./chunk-LGONZW4W.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
@@ -10,7 +10,7 @@ var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
|
10
10
|
|
|
11
11
|
// src/wallets/stellar.ts
|
|
12
12
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
13
|
-
var StellarWallet = class _StellarWallet extends
|
|
13
|
+
var StellarWallet = class _StellarWallet extends _chunkLGONZW4Wcjs.Wallet {
|
|
14
14
|
constructor(wallet) {
|
|
15
15
|
super(
|
|
16
16
|
{
|
|
@@ -18,10 +18,10 @@ var StellarWallet = class _StellarWallet extends _chunkMYKPHXURcjs.Wallet {
|
|
|
18
18
|
address: wallet.address,
|
|
19
19
|
owner: wallet.owner,
|
|
20
20
|
signer: wallet.signer,
|
|
21
|
-
options:
|
|
21
|
+
options: _chunkLGONZW4Wcjs.Wallet.getOptions(wallet),
|
|
22
22
|
alias: wallet.alias
|
|
23
23
|
},
|
|
24
|
-
|
|
24
|
+
_chunkLGONZW4Wcjs.Wallet.getApiClient(wallet)
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
static from(wallet) {
|
|
File without changes
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLKAO2MV2cjs = require('./chunk-LKAO2MV2.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkHYKMSBCTcjs = require('./chunk-HYKMSBCT.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkIVNYZDI5cjs = require('./chunk-IVNYZDI5.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkCHGPNMRLcjs = require('./chunk-CHGPNMRL.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunk7ECQJFYMcjs = require('./chunk-7ECQJFYM.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkBSC55MYKcjs = require('./chunk-BSC55MYK.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkLLFD22UQcjs = require('./chunk-LLFD22UQ.cjs');
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _chunkR2OY54EJcjs = require('./chunk-R2OY54EJ.cjs');
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkYBA7WO32cjs = require('./chunk-YBA7WO32.cjs');
|
|
28
28
|
|
|
29
29
|
// src/signers/index.ts
|
|
30
30
|
function assembleSigner(chain, config) {
|
|
@@ -32,12 +32,12 @@ function assembleSigner(chain, config) {
|
|
|
32
32
|
case "email":
|
|
33
33
|
case "phone":
|
|
34
34
|
if (chain === "solana") {
|
|
35
|
-
return new (0,
|
|
35
|
+
return new (0, _chunkHYKMSBCTcjs.SolanaNonCustodialSigner)(config);
|
|
36
36
|
}
|
|
37
37
|
if (chain === "stellar") {
|
|
38
|
-
return new (0,
|
|
38
|
+
return new (0, _chunkIVNYZDI5cjs.StellarNonCustodialSigner)(config);
|
|
39
39
|
}
|
|
40
|
-
return new (0,
|
|
40
|
+
return new (0, _chunkLKAO2MV2cjs.EVMNonCustodialSigner)(config);
|
|
41
41
|
case "api-key":
|
|
42
42
|
return chain === "solana" ? new (0, _chunkLLFD22UQcjs.SolanaApiKeySigner)(config) : new (0, _chunkCHGPNMRLcjs.EVMApiKeySigner)(config);
|
|
43
43
|
case "external-wallet":
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WalletFactory
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-S5YXROL6.js";
|
|
4
4
|
import {
|
|
5
5
|
ApiClient
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-6G7ZWCCG.js";
|
|
7
|
+
import {
|
|
8
|
+
initWalletsLogger,
|
|
9
|
+
walletsLogger
|
|
10
|
+
} from "./chunk-RAWKXOHR.js";
|
|
7
11
|
import {
|
|
8
12
|
__async
|
|
9
13
|
} from "./chunk-FPMW7Q5O.js";
|
|
@@ -12,8 +16,10 @@ import {
|
|
|
12
16
|
import { createCrossmint } from "@crossmint/common-sdk-base";
|
|
13
17
|
var CrossmintWallets = class _CrossmintWallets {
|
|
14
18
|
constructor(crossmint) {
|
|
19
|
+
initWalletsLogger(crossmint.apiKey);
|
|
15
20
|
const apiClient = new ApiClient(crossmint);
|
|
16
21
|
this.walletFactory = new WalletFactory(apiClient);
|
|
22
|
+
walletsLogger.info("wallets.sdk.initialized");
|
|
17
23
|
}
|
|
18
24
|
/**
|
|
19
25
|
* Initialize the Wallets SDK
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SDK_NAME,
|
|
3
|
-
SDK_VERSION
|
|
4
|
-
} from "./chunk-FAGFW4AR.js";
|
|
5
1
|
import {
|
|
6
2
|
InvalidApiKeyError
|
|
7
3
|
} from "./chunk-SGINWAB6.js";
|
|
4
|
+
import {
|
|
5
|
+
walletsLogger
|
|
6
|
+
} from "./chunk-RAWKXOHR.js";
|
|
7
|
+
import {
|
|
8
|
+
SDK_NAME,
|
|
9
|
+
SDK_VERSION
|
|
10
|
+
} from "./chunk-WQVJM3PG.js";
|
|
8
11
|
import {
|
|
9
12
|
__async
|
|
10
13
|
} from "./chunk-FPMW7Q5O.js";
|
|
@@ -28,19 +31,45 @@ var ApiClient = class extends CrossmintApiClient {
|
|
|
28
31
|
createWallet(params) {
|
|
29
32
|
return __async(this, null, function* () {
|
|
30
33
|
const path = this.isServerSide ? `${this.apiPrefix}` : `${this.apiPrefix}/me`;
|
|
34
|
+
walletsLogger.info("wallets.api.createWallet", {
|
|
35
|
+
chainType: params.chainType,
|
|
36
|
+
walletType: params.type
|
|
37
|
+
});
|
|
31
38
|
const response = yield this.post(path, {
|
|
32
39
|
body: JSON.stringify(params),
|
|
33
40
|
headers: this.headers
|
|
34
41
|
});
|
|
35
|
-
|
|
42
|
+
const result = yield response.json();
|
|
43
|
+
if ("error" in result) {
|
|
44
|
+
walletsLogger.error("wallets.api.createWallet.error", {
|
|
45
|
+
error: result.error,
|
|
46
|
+
chainType: params.chainType
|
|
47
|
+
});
|
|
48
|
+
} else if ("address" in result) {
|
|
49
|
+
walletsLogger.info("wallets.api.createWallet.success", {
|
|
50
|
+
address: result.address,
|
|
51
|
+
chainType: params.chainType
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return result;
|
|
36
55
|
});
|
|
37
56
|
}
|
|
38
57
|
getWallet(locator) {
|
|
39
58
|
return __async(this, null, function* () {
|
|
59
|
+
walletsLogger.info("wallets.api.getWallet", { locator });
|
|
40
60
|
const response = yield this.get(`${this.apiPrefix}/${locator}`, {
|
|
41
61
|
headers: this.headers
|
|
42
62
|
});
|
|
43
|
-
|
|
63
|
+
const result = yield response.json();
|
|
64
|
+
if ("error" in result) {
|
|
65
|
+
walletsLogger.warn("wallets.api.getWallet.error", {
|
|
66
|
+
locator,
|
|
67
|
+
error: result.error
|
|
68
|
+
});
|
|
69
|
+
} else if ("address" in result) {
|
|
70
|
+
walletsLogger.info("wallets.api.getWallet.success", result);
|
|
71
|
+
}
|
|
72
|
+
return result;
|
|
44
73
|
});
|
|
45
74
|
}
|
|
46
75
|
createTransaction(walletLocator, params) {
|
|
@@ -171,11 +200,29 @@ var ApiClient = class extends CrossmintApiClient {
|
|
|
171
200
|
}
|
|
172
201
|
send(walletLocator, tokenLocator, params) {
|
|
173
202
|
return __async(this, null, function* () {
|
|
203
|
+
walletsLogger.info("wallets.api.send", {
|
|
204
|
+
walletLocator,
|
|
205
|
+
tokenLocator,
|
|
206
|
+
recipient: params.recipient
|
|
207
|
+
});
|
|
174
208
|
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/tokens/${tokenLocator}/transfers`, {
|
|
175
209
|
body: JSON.stringify(params),
|
|
176
210
|
headers: this.headers
|
|
177
211
|
});
|
|
178
|
-
|
|
212
|
+
const result = yield response.json();
|
|
213
|
+
if ("error" in result) {
|
|
214
|
+
walletsLogger.error("wallets.api.send.error", {
|
|
215
|
+
walletLocator,
|
|
216
|
+
tokenLocator,
|
|
217
|
+
error: result.error
|
|
218
|
+
});
|
|
219
|
+
} else if ("id" in result) {
|
|
220
|
+
walletsLogger.info("wallets.api.send.success", {
|
|
221
|
+
walletLocator,
|
|
222
|
+
transactionId: result.id
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
return result;
|
|
179
226
|
});
|
|
180
227
|
}
|
|
181
228
|
get isServerSide() {
|
|
@@ -240,7 +240,7 @@ var NonCustodialSigner = class {
|
|
|
240
240
|
(_d = this._authPromise) == null ? void 0 : _d.resolve();
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
|
-
console.error("[verifyOtp] Failed to validate OTP:", response);
|
|
243
|
+
console.error("[verifyOtp] Failed to validate OTP:", JSON.stringify(response, null, 2));
|
|
244
244
|
this._needsAuth = true;
|
|
245
245
|
const errorMessage = (response == null ? void 0 : response.status) === "error" ? response.error : "Failed to validate encrypted OTP";
|
|
246
246
|
const error = new Error(errorMessage);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -240,7 +240,7 @@ var NonCustodialSigner = class {
|
|
|
240
240
|
(_d = this._authPromise) == null ? void 0 : _d.resolve();
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
|
-
console.error("[verifyOtp] Failed to validate OTP:", response);
|
|
243
|
+
console.error("[verifyOtp] Failed to validate OTP:", JSON.stringify(response, null, 2));
|
|
244
244
|
this._needsAuth = true;
|
|
245
245
|
const errorMessage = (response == null ? void 0 : response.status) === "error" ? response.error : "Failed to validate encrypted OTP";
|
|
246
246
|
const error = new Error(errorMessage);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLGONZW4Wcjs = require('./chunk-LGONZW4W.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
|
16
16
|
// src/wallets/evm.ts
|
|
17
17
|
var _viem = require('viem');
|
|
18
18
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
19
|
-
var EVMWallet = class _EVMWallet extends
|
|
19
|
+
var EVMWallet = class _EVMWallet extends _chunkLGONZW4Wcjs.Wallet {
|
|
20
20
|
constructor(wallet) {
|
|
21
21
|
super(
|
|
22
22
|
{
|
|
@@ -24,10 +24,10 @@ var EVMWallet = class _EVMWallet extends _chunkMYKPHXURcjs.Wallet {
|
|
|
24
24
|
address: wallet.address,
|
|
25
25
|
owner: wallet.owner,
|
|
26
26
|
signer: wallet.signer,
|
|
27
|
-
options:
|
|
27
|
+
options: _chunkLGONZW4Wcjs.Wallet.getOptions(wallet),
|
|
28
28
|
alias: wallet.alias
|
|
29
29
|
},
|
|
30
|
-
|
|
30
|
+
_chunkLGONZW4Wcjs.Wallet.getApiClient(wallet)
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
static from(wallet) {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkLHYSCUKJcjs = require('./chunk-LHYSCUKJ.cjs');
|
|
5
|
+
|
|
6
|
+
// src/logger/init.ts
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
14
|
+
var _browserlogs = require('@datadog/browser-logs'); var datadogLogger = _interopRequireWildcard(_browserlogs);
|
|
15
|
+
var walletsLogger = new (0, _commonsdkbase.SdkLogger)();
|
|
16
|
+
function initWalletsLogger(apiKey) {
|
|
17
|
+
const platform = _commonsdkbase.detectPlatform.call(void 0, );
|
|
18
|
+
const validationResult = _commonsdkbase.validateAPIKey.call(void 0, apiKey);
|
|
19
|
+
if (!validationResult.isValid) {
|
|
20
|
+
throw new Error(`Invalid API key: ${validationResult.message}`);
|
|
21
|
+
}
|
|
22
|
+
const { environment, projectId } = validationResult;
|
|
23
|
+
walletsLogger.init({
|
|
24
|
+
packageName: _chunkLHYSCUKJcjs.SDK_NAME,
|
|
25
|
+
packageVersion: _chunkLHYSCUKJcjs.SDK_VERSION,
|
|
26
|
+
environment,
|
|
27
|
+
projectId,
|
|
28
|
+
platform
|
|
29
|
+
});
|
|
30
|
+
switch (platform) {
|
|
31
|
+
case "browser": {
|
|
32
|
+
const sink = new (0, _commonsdkbase.BrowserDatadogSink)(environment, datadogLogger);
|
|
33
|
+
walletsLogger.addSink(sink);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case "react-native": {
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case "server": {
|
|
40
|
+
const sink = new (0, _commonsdkbase.ServerDatadogSink)(environment);
|
|
41
|
+
walletsLogger.addSink(sink);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
default: {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
exports.walletsLogger = walletsLogger; exports.initWalletsLogger = initWalletsLogger;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGQIZWD4Fcjs = require('./chunk-GQIZWD4F.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkZZJ7U5G3cjs = require('./chunk-ZZJ7U5G3.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkG3LEJR3Pcjs = require('./chunk-G3LEJR3P.cjs');
|
|
7
11
|
|
|
8
12
|
|
|
9
13
|
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
@@ -12,8 +16,10 @@ var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
|
12
16
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
13
17
|
var CrossmintWallets = class _CrossmintWallets {
|
|
14
18
|
constructor(crossmint) {
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
_chunkG3LEJR3Pcjs.initWalletsLogger.call(void 0, crossmint.apiKey);
|
|
20
|
+
const apiClient = new (0, _chunkZZJ7U5G3cjs.ApiClient)(crossmint);
|
|
21
|
+
this.walletFactory = new (0, _chunkGQIZWD4Fcjs.WalletFactory)(apiClient);
|
|
22
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallets.sdk.initialized");
|
|
17
23
|
}
|
|
18
24
|
/**
|
|
19
25
|
* Initialize the Wallets SDK
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var _chunk7GHQBCRVcjs = require('./chunk-7GHQBCRV.cjs');
|
|
4
3
|
|
|
4
|
+
var _chunkRBHGZDDXcjs = require('./chunk-RBHGZDDX.cjs');
|
|
5
5
|
|
|
6
|
-
var _chunkMYKPHXURcjs = require('./chunk-MYKPHXUR.cjs');
|
|
7
6
|
|
|
7
|
+
var _chunkLGONZW4Wcjs = require('./chunk-LGONZW4W.cjs');
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
var _chunk5BP6CVYYcjs = require('./chunk-5BP6CVYY.cjs');
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
14
15
|
|
|
15
16
|
|
|
17
|
+
var _chunkG3LEJR3Pcjs = require('./chunk-G3LEJR3P.cjs');
|
|
18
|
+
|
|
19
|
+
|
|
16
20
|
|
|
17
21
|
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
18
22
|
|
|
@@ -31,10 +35,21 @@ var WalletFactory = class {
|
|
|
31
35
|
);
|
|
32
36
|
}
|
|
33
37
|
const locator = this.getWalletLocator(args);
|
|
38
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallet.getOrCreate.start", {
|
|
39
|
+
chain: args.chain,
|
|
40
|
+
signerType: args.signer.type
|
|
41
|
+
});
|
|
34
42
|
const existingWallet = yield this.apiClient.getWallet(locator);
|
|
35
43
|
if (existingWallet != null && !("error" in existingWallet)) {
|
|
44
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallet.getOrCreate.existing", {
|
|
45
|
+
chain: args.chain,
|
|
46
|
+
address: existingWallet.address
|
|
47
|
+
});
|
|
36
48
|
return this.createWalletInstance(existingWallet, args);
|
|
37
49
|
}
|
|
50
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallet.getOrCreate.creating", {
|
|
51
|
+
chain: args.chain
|
|
52
|
+
});
|
|
38
53
|
return this.createWallet(args);
|
|
39
54
|
});
|
|
40
55
|
}
|
|
@@ -43,10 +58,22 @@ var WalletFactory = class {
|
|
|
43
58
|
if (!this.apiClient.isServerSide) {
|
|
44
59
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)("getWallet is not supported on client side, use getOrCreateWallet instead");
|
|
45
60
|
}
|
|
61
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallet.get.start", {
|
|
62
|
+
walletLocator,
|
|
63
|
+
chain: args.chain
|
|
64
|
+
});
|
|
46
65
|
const existingWallet = yield this.apiClient.getWallet(walletLocator);
|
|
47
66
|
if ("error" in existingWallet) {
|
|
67
|
+
_chunkG3LEJR3Pcjs.walletsLogger.warn("wallet.get.notFound", {
|
|
68
|
+
walletLocator,
|
|
69
|
+
error: existingWallet.error
|
|
70
|
+
});
|
|
48
71
|
throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(existingWallet));
|
|
49
72
|
}
|
|
73
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallet.get.success", {
|
|
74
|
+
walletLocator,
|
|
75
|
+
address: existingWallet.address
|
|
76
|
+
});
|
|
50
77
|
return this.createWalletInstance(existingWallet, args);
|
|
51
78
|
});
|
|
52
79
|
}
|
|
@@ -54,6 +81,10 @@ var WalletFactory = class {
|
|
|
54
81
|
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
55
82
|
var _a, _b, _c, _d, _e;
|
|
56
83
|
yield (_c = (_b = (_a = args.options) == null ? void 0 : _a.experimental_callbacks) == null ? void 0 : _b.onWalletCreationStart) == null ? void 0 : _c.call(_b);
|
|
84
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallet.create.start", {
|
|
85
|
+
chain: args.chain,
|
|
86
|
+
signerType: args.signer.type
|
|
87
|
+
});
|
|
57
88
|
this.mutateSignerFromCustomAuth(args, true);
|
|
58
89
|
const adminSigner = args.signer.type === "passkey" ? yield this.createPasskeyAdminSigner(args.signer) : args.signer;
|
|
59
90
|
const walletResponse = yield this.apiClient.createWallet({
|
|
@@ -66,20 +97,28 @@ var WalletFactory = class {
|
|
|
66
97
|
alias: (_e = args.alias) != null ? _e : void 0
|
|
67
98
|
});
|
|
68
99
|
if ("error" in walletResponse) {
|
|
100
|
+
_chunkG3LEJR3Pcjs.walletsLogger.error("wallet.create.error", {
|
|
101
|
+
chain: args.chain,
|
|
102
|
+
error: walletResponse.error
|
|
103
|
+
});
|
|
69
104
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)(JSON.stringify(walletResponse));
|
|
70
105
|
}
|
|
106
|
+
_chunkG3LEJR3Pcjs.walletsLogger.info("wallet.create.success", {
|
|
107
|
+
chain: args.chain,
|
|
108
|
+
address: walletResponse.address
|
|
109
|
+
});
|
|
71
110
|
return this.createWalletInstance(walletResponse, args);
|
|
72
111
|
});
|
|
73
112
|
}
|
|
74
113
|
createWalletInstance(walletResponse, args) {
|
|
75
114
|
this.validateExistingWalletConfig(walletResponse, args);
|
|
76
115
|
const signerConfig = this.toInternalSignerConfig(walletResponse, args.signer, args.options);
|
|
77
|
-
return new (0,
|
|
116
|
+
return new (0, _chunkLGONZW4Wcjs.Wallet)(
|
|
78
117
|
{
|
|
79
118
|
chain: args.chain,
|
|
80
119
|
address: walletResponse.address,
|
|
81
120
|
owner: walletResponse.owner,
|
|
82
|
-
signer:
|
|
121
|
+
signer: _chunk5BP6CVYYcjs.assembleSigner.call(void 0, args.chain, signerConfig),
|
|
83
122
|
options: args.options,
|
|
84
123
|
alias: args.alias
|
|
85
124
|
},
|
|
@@ -198,7 +237,7 @@ var WalletFactory = class {
|
|
|
198
237
|
validateExistingWalletConfig(existingWallet, args) {
|
|
199
238
|
var _a;
|
|
200
239
|
this.mutateSignerFromCustomAuth(args);
|
|
201
|
-
if (args.owner != null && existingWallet.owner != null && args.owner !== existingWallet.owner) {
|
|
240
|
+
if (args.owner != null && existingWallet.owner != null && _chunkRBHGZDDXcjs.normalizeValueForComparison.call(void 0, args.owner) !== _chunkRBHGZDDXcjs.normalizeValueForComparison.call(void 0, existingWallet.owner)) {
|
|
202
241
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Wallet owner does not match existing wallet's linked user");
|
|
203
242
|
}
|
|
204
243
|
if (args.chain === "solana" && existingWallet.chainType !== "solana" || args.chain !== "solana" && existingWallet.chainType === "solana" || args.chain === "stellar" && existingWallet.chainType !== "stellar" || args.chain !== "stellar" && existingWallet.chainType === "stellar") {
|
|
@@ -217,7 +256,7 @@ var WalletFactory = class {
|
|
|
217
256
|
"The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type"
|
|
218
257
|
);
|
|
219
258
|
}
|
|
220
|
-
|
|
259
|
+
_chunkRBHGZDDXcjs.compareSignerConfigs.call(void 0, adminSignerArgs, existingWalletSigner);
|
|
221
260
|
}
|
|
222
261
|
if (args.delegatedSigners != null) {
|
|
223
262
|
this.validateDelegatedSigners(existingWallet, args.delegatedSigners);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkB6JOIWRHcjs = require('./chunk-B6JOIWRH.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
@@ -9,7 +9,7 @@ var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
|
9
9
|
// src/signers/non-custodial/ncs-solana-signer.ts
|
|
10
10
|
var _web3js = require('@solana/web3.js');
|
|
11
11
|
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
12
|
-
var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends
|
|
12
|
+
var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkB6JOIWRHcjs.NonCustodialSigner {
|
|
13
13
|
constructor(config) {
|
|
14
14
|
super(config);
|
|
15
15
|
}
|
|
@@ -40,7 +40,7 @@ var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkE4L
|
|
|
40
40
|
encoding: "base58"
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
options:
|
|
43
|
+
options: _chunkB6JOIWRHcjs.DEFAULT_EVENT_OPTIONS
|
|
44
44
|
});
|
|
45
45
|
if ((res == null ? void 0 : res.status) === "error") {
|
|
46
46
|
throw new Error(res.error);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkB6JOIWRHcjs = require('./chunk-B6JOIWRH.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
8
8
|
|
|
9
9
|
// src/signers/non-custodial/ncs-stellar-signer.ts
|
|
10
|
-
var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends
|
|
10
|
+
var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkB6JOIWRHcjs.NonCustodialSigner {
|
|
11
11
|
constructor(config) {
|
|
12
12
|
super(config);
|
|
13
13
|
}
|
|
@@ -35,7 +35,7 @@ var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends _chunkE
|
|
|
35
35
|
encoding: "base64"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
options:
|
|
38
|
+
options: _chunkB6JOIWRHcjs.DEFAULT_EVENT_OPTIONS
|
|
39
39
|
});
|
|
40
40
|
if ((res == null ? void 0 : res.status) === "error") {
|
|
41
41
|
throw new Error(res.error);
|