@crossmint/wallets-sdk 0.20.2 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/test-utils.cjs +8 -8
- package/dist/api/__tests__/test-utils.d.cts +3 -3
- package/dist/api/__tests__/test-utils.d.ts +3 -3
- package/dist/api/__tests__/test-utils.js +6 -6
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.d.cts +1 -0
- package/dist/api/client.d.ts +1 -0
- package/dist/api/client.js +3 -3
- package/dist/api/gen/index.cjs +3 -103
- package/dist/api/gen/index.d.cts +2 -2
- package/dist/api/gen/index.d.ts +2 -2
- package/dist/api/gen/index.js +6 -106
- package/dist/api/gen/sdk.gen.cjs +2 -102
- package/dist/api/gen/sdk.gen.d.cts +22 -370
- package/dist/api/gen/sdk.gen.d.ts +22 -370
- package/dist/api/gen/sdk.gen.js +5 -105
- package/dist/api/gen/types.gen.d.cts +2558 -5712
- package/dist/api/gen/types.gen.d.ts +2558 -5712
- package/dist/api/index.cjs +4 -4
- package/dist/api/index.js +3 -3
- package/dist/api/types.d.cts +12 -12
- package/dist/api/types.d.ts +12 -12
- package/dist/chains/chains.cjs +4 -4
- package/dist/chains/chains.js +3 -3
- package/dist/{chunk-6FG5QXII.cjs → chunk-2YGFMFQH.cjs} +20 -11
- package/dist/{chunk-47R3UV3J.cjs → chunk-357M7AYZ.cjs} +11 -6
- package/dist/chunk-4MEGQR3I.js +40 -0
- package/dist/chunk-5IC7UWND.cjs +1 -0
- package/dist/{chunk-ZAX22GSI.cjs → chunk-5NWGYER3.cjs} +18 -18
- package/dist/{chunk-RYQI3RXL.cjs → chunk-67C2QSRT.cjs} +18 -12
- package/dist/{chunk-CMBFV325.js → chunk-772Z6PBD.js} +3 -3
- package/dist/{chunk-JREZWZ2S.cjs → chunk-BJQHHI7K.cjs} +3 -3
- package/dist/chunk-BR4UVMIC.js +332 -0
- package/dist/chunk-BUBSPQ7U.cjs +332 -0
- package/dist/{chunk-FHMKNG62.js → chunk-CUE4X7Y4.js} +24 -8
- package/dist/chunk-DDNG224J.cjs +45 -0
- package/dist/{chunk-FICVKSXZ.js → chunk-FBUGIHIP.js} +2 -2
- package/dist/{chunk-HXJ3YPAN.js → chunk-GIHJEXL7.js} +13 -4
- package/dist/chunk-GJT2JD3E.js +45 -0
- package/dist/chunk-H6WV5NRT.js +10 -0
- package/dist/chunk-HWTWDQYT.cjs +42 -0
- package/dist/{chunk-66UY53KP.cjs → chunk-I3KIMQEV.cjs} +80 -37
- package/dist/chunk-IGRPHTXZ.cjs +1 -0
- package/dist/{chunk-IDKGJO2G.cjs → chunk-IL6J7SYU.cjs} +21 -11
- package/dist/chunk-IXDC5JR2.js +316 -0
- package/dist/{chunk-7TT3VUDF.cjs → chunk-IZQHJM2P.cjs} +6 -6
- package/dist/chunk-J65ILI3Y.cjs +44 -0
- package/dist/chunk-JD77GNRZ.cjs +40 -0
- package/dist/{chunk-PUO4QNXH.js → chunk-JO7QKDU4.js} +2 -2
- package/dist/{chunk-KQH5ZXJ4.js → chunk-JP6227LZ.js} +61 -18
- package/dist/{chunk-POG76HDD.cjs → chunk-JUS5BKF2.cjs} +64 -48
- package/dist/chunk-K6LSGLG6.js +42 -0
- package/dist/chunk-KEDMRERX.cjs +29 -0
- package/dist/{chunk-W7K5E64Q.js → chunk-KSN7G2DH.js} +8 -2
- package/dist/chunk-L52GDMSH.js +0 -0
- package/dist/{chunk-U3NV7UY7.js → chunk-LDVEJ2XZ.js} +1 -1
- package/dist/{chunk-PM7BGATN.cjs → chunk-LIUDLEBE.cjs} +34 -25
- package/dist/{chunk-6UMJYMAY.js → chunk-LQWOPRRW.js} +2 -2
- package/dist/chunk-M6E6A543.cjs +316 -0
- package/dist/chunk-MNHK6EQK.cjs +57 -0
- package/dist/{chunk-2WBSPOWU.js → chunk-NBBOYFQW.js} +1 -1
- package/dist/{chunk-A6E67ZZP.js → chunk-OBKOVQQJ.js} +14 -5
- package/dist/{chunk-TYQ4YIP7.js → chunk-PC3YMFJM.js} +1 -1
- package/dist/chunk-Q52MMQSC.js +57 -0
- package/dist/chunk-QM3BB4E2.js +0 -0
- package/dist/{chunk-R6DH4V7S.cjs → chunk-QMSFEJPD.cjs} +7 -7
- package/dist/{chunk-T2XUADHW.js → chunk-QPVKMB34.js} +10 -5
- package/dist/chunk-RUQYXEEG.cjs +10 -0
- package/dist/{chunk-WHTECI7J.cjs → chunk-RZYHYTWY.cjs} +6 -6
- package/dist/{chunk-ABMZ3ZVN.js → chunk-SIP7NNGL.js} +1 -1
- package/dist/{chunk-WDZY4PP4.cjs → chunk-UBWFRFQ6.cjs} +3 -3
- package/dist/{chunk-R4AW5ADG.cjs → chunk-WATHSVAQ.cjs} +1 -1
- package/dist/chunk-WQZLYIIG.js +44 -0
- package/dist/chunk-WXIYTJDM.js +29 -0
- package/dist/{chunk-WWW6IGZ7.js → chunk-Y2DLCE7H.js} +14 -4
- package/dist/{chunk-MRZXYVQO.cjs → chunk-ZXQHWKZN.cjs} +6 -6
- package/dist/index.cjs +26 -16
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -15
- package/dist/logger/index.cjs +3 -3
- package/dist/logger/index.js +2 -2
- package/dist/logger/init.cjs +3 -3
- package/dist/logger/init.js +2 -2
- package/dist/sdk.cjs +23 -13
- package/dist/sdk.js +22 -12
- package/dist/signers/index.cjs +18 -8
- package/dist/signers/index.js +17 -7
- package/dist/signers/non-custodial/index.cjs +7 -7
- package/dist/signers/non-custodial/index.js +8 -8
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
- package/dist/signers/non-custodial/ncs-signer.js +3 -3
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
- package/dist/signers/server/assemble-server-signer.cjs +15 -0
- package/dist/signers/server/assemble-server-signer.d.cts +11 -0
- package/dist/signers/server/assemble-server-signer.d.ts +11 -0
- package/dist/signers/server/assemble-server-signer.js +15 -0
- package/dist/signers/server/evm-server-signer.cjs +7 -0
- package/dist/signers/server/evm-server-signer.d.cts +25 -0
- package/dist/signers/server/evm-server-signer.d.ts +25 -0
- package/dist/signers/server/evm-server-signer.js +7 -0
- package/dist/signers/server/helpers/derive-server-signer.cjs +12 -0
- package/dist/signers/server/helpers/derive-server-signer.d.cts +15 -0
- package/dist/signers/server/helpers/derive-server-signer.d.ts +15 -0
- package/dist/signers/server/helpers/derive-server-signer.js +12 -0
- package/dist/signers/server/helpers/get-chain-type.cjs +7 -0
- package/dist/signers/server/helpers/get-chain-type.d.cts +7 -0
- package/dist/signers/server/helpers/get-chain-type.d.ts +7 -0
- package/dist/signers/server/helpers/get-chain-type.js +7 -0
- package/dist/signers/server/helpers/index.cjs +16 -0
- package/dist/signers/server/helpers/index.d.cts +9 -0
- package/dist/signers/server/helpers/index.d.ts +9 -0
- package/dist/signers/server/helpers/index.js +16 -0
- package/dist/signers/server/index.cjs +30 -0
- package/dist/signers/server/index.d.cts +12 -0
- package/dist/signers/server/index.d.ts +12 -0
- package/dist/signers/server/index.js +30 -0
- package/dist/signers/server/solana-server-signer.cjs +7 -0
- package/dist/signers/server/solana-server-signer.d.cts +25 -0
- package/dist/signers/server/solana-server-signer.d.ts +25 -0
- package/dist/signers/server/solana-server-signer.js +7 -0
- package/dist/signers/server/stellar-server-signer.cjs +8 -0
- package/dist/signers/server/stellar-server-signer.d.cts +25 -0
- package/dist/signers/server/stellar-server-signer.d.ts +25 -0
- package/dist/signers/server/stellar-server-signer.js +8 -0
- package/dist/signers/types.d.cts +15 -3
- package/dist/signers/types.d.ts +15 -3
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/utils/server-key-derivation.cjs +9 -0
- package/dist/utils/server-key-derivation.d.cts +20 -0
- package/dist/utils/server-key-derivation.d.ts +20 -0
- package/dist/utils/server-key-derivation.js +9 -0
- package/dist/utils/stellar.cjs +11 -0
- package/dist/utils/stellar.d.cts +18 -0
- package/dist/utils/stellar.d.ts +18 -0
- package/dist/utils/stellar.js +11 -0
- package/dist/wallets/__tests__/test-helpers.cjs +19 -9
- package/dist/wallets/__tests__/test-helpers.js +18 -8
- package/dist/wallets/evm.cjs +20 -10
- package/dist/wallets/evm.js +19 -9
- package/dist/wallets/solana.cjs +20 -10
- package/dist/wallets/solana.js +19 -9
- package/dist/wallets/stellar.cjs +20 -10
- package/dist/wallets/stellar.js +19 -9
- package/dist/wallets/types.d.cts +7 -4
- package/dist/wallets/types.d.ts +7 -4
- package/dist/wallets/wallet-factory.cjs +21 -11
- package/dist/wallets/wallet-factory.js +20 -10
- package/dist/wallets/wallet.cjs +19 -9
- package/dist/wallets/wallet.d.cts +2 -2
- package/dist/wallets/wallet.d.ts +2 -2
- package/dist/wallets/wallet.js +18 -8
- package/package.json +3 -3
- package/dist/chunk-BMMZIPXT.js +0 -778
- package/dist/chunk-COR3CNRW.cjs +0 -778
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deriveServerSignerDetails
|
|
3
|
+
} from "./chunk-4MEGQR3I.js";
|
|
1
4
|
import {
|
|
2
5
|
NonCustodialSigner
|
|
3
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LDVEJ2XZ.js";
|
|
4
7
|
import {
|
|
5
8
|
validateChainForEnvironment
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NBBOYFQW.js";
|
|
7
10
|
import {
|
|
8
11
|
InvalidSignerError,
|
|
9
12
|
SignatureFailedError,
|
|
@@ -21,10 +24,10 @@ import {
|
|
|
21
24
|
} from "./chunk-SGINWAB6.js";
|
|
22
25
|
import {
|
|
23
26
|
walletsLogger
|
|
24
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SIP7NNGL.js";
|
|
25
28
|
import {
|
|
26
29
|
STATUS_POLLING_INTERVAL_MS
|
|
27
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-PC3YMFJM.js";
|
|
28
31
|
import {
|
|
29
32
|
__async,
|
|
30
33
|
__decorateClass,
|
|
@@ -250,10 +253,18 @@ var Wallet = class {
|
|
|
250
253
|
amount
|
|
251
254
|
}, (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {}));
|
|
252
255
|
yield this.preAuthIfNeeded();
|
|
256
|
+
let signer;
|
|
257
|
+
if ((options == null ? void 0 : options.experimental_signer) != null) {
|
|
258
|
+
if (typeof options.experimental_signer === "string") {
|
|
259
|
+
signer = options.experimental_signer;
|
|
260
|
+
} else {
|
|
261
|
+
signer = `server:${deriveServerSignerDetails(options.experimental_signer, this.chain, __privateGet(this, _apiClient).projectId, __privateGet(this, _apiClient).environment).derivedAddress}`;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
253
264
|
const sendParams = __spreadValues(__spreadValues({
|
|
254
265
|
recipient,
|
|
255
266
|
amount
|
|
256
|
-
},
|
|
267
|
+
}, signer != null ? { signer } : {}), (options == null ? void 0 : options.transactionType) != null ? { transactionType: options.transactionType } : {});
|
|
257
268
|
const transactionCreationResponse = yield __privateGet(this, _apiClient).send(this.walletLocator, tokenLocator, sendParams);
|
|
258
269
|
if ("message" in transactionCreationResponse) {
|
|
259
270
|
walletsLogger.error("wallet.send.error", {
|
|
@@ -333,8 +344,9 @@ var Wallet = class {
|
|
|
333
344
|
return __async(this, null, function* () {
|
|
334
345
|
var _a, _b, _c;
|
|
335
346
|
walletsLogger.info("wallet.addDelegatedSigner.start");
|
|
347
|
+
const resolvedSigner = typeof params.signer === "object" && params.signer.type === "server" ? `server:${deriveServerSignerDetails(params.signer, this.chain, __privateGet(this, _apiClient).projectId, __privateGet(this, _apiClient).environment).derivedAddress}` : params.signer;
|
|
336
348
|
const response = yield __privateGet(this, _apiClient).registerSigner(this.walletLocator, {
|
|
337
|
-
signer:
|
|
349
|
+
signer: resolvedSigner,
|
|
338
350
|
chain: this.chain === "solana" || this.chain === "stellar" ? void 0 : this.chain
|
|
339
351
|
});
|
|
340
352
|
if ("error" in response) {
|
|
@@ -508,7 +520,9 @@ var Wallet = class {
|
|
|
508
520
|
pendingApprovals.map((pendingApproval) => __async(this, null, function* () {
|
|
509
521
|
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
510
522
|
if (signer == null) {
|
|
511
|
-
throw new InvalidSignerError(
|
|
523
|
+
throw new InvalidSignerError(
|
|
524
|
+
`Signer ${pendingApproval.signer.locator} not found in pending approvals`
|
|
525
|
+
);
|
|
512
526
|
}
|
|
513
527
|
const signature2 = yield signer.signMessage(pendingApproval.message);
|
|
514
528
|
return __spreadProps(__spreadValues({}, signature2), {
|
|
@@ -543,7 +557,9 @@ var Wallet = class {
|
|
|
543
557
|
pendingApprovals.map((pendingApproval) => __async(this, null, function* () {
|
|
544
558
|
const signer = signers.find((s) => s.locator() === pendingApproval.signer.locator);
|
|
545
559
|
if (signer == null) {
|
|
546
|
-
throw new InvalidSignerError(
|
|
560
|
+
throw new InvalidSignerError(
|
|
561
|
+
`Signer ${pendingApproval.signer.locator} not found in pending approvals`
|
|
562
|
+
);
|
|
547
563
|
}
|
|
548
564
|
const transactionToSign = transaction.chainType === "solana" && "transaction" in transaction.onChain ? transaction.onChain.transaction : pendingApproval.message;
|
|
549
565
|
const signature = yield signer.signTransaction(transactionToSign);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
4
|
+
|
|
5
|
+
// src/signers/server/evm-server-signer.ts
|
|
6
|
+
var _accounts = require('viem/accounts');
|
|
7
|
+
var _utils = require('@noble/hashes/utils');
|
|
8
|
+
var EVMServerSigner = class {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.type = "server";
|
|
11
|
+
this.account = _accounts.privateKeyToAccount.call(void 0, `0x${_utils.bytesToHex.call(void 0, config.derivedKeyBytes)}`);
|
|
12
|
+
this._address = this.account.address;
|
|
13
|
+
this._locator = config.locator;
|
|
14
|
+
}
|
|
15
|
+
address() {
|
|
16
|
+
return this._address;
|
|
17
|
+
}
|
|
18
|
+
locator() {
|
|
19
|
+
return this._locator;
|
|
20
|
+
}
|
|
21
|
+
signMessage(message) {
|
|
22
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
23
|
+
if (!message.startsWith("0x")) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`EVMServerSigner.signMessage expects a 0x-prefixed hex string, got: ${message.slice(0, 10)}...`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
const signature = yield this.account.signMessage({
|
|
29
|
+
message: {
|
|
30
|
+
raw: message
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return { signature };
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
signTransaction(transaction) {
|
|
37
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
38
|
+
return yield this.signMessage(transaction);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
exports.EVMServerSigner = EVMServerSigner;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_EVENT_OPTIONS,
|
|
3
3
|
NonCustodialSigner
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-LDVEJ2XZ.js";
|
|
5
5
|
import {
|
|
6
6
|
walletsLogger
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-SIP7NNGL.js";
|
|
8
8
|
import {
|
|
9
9
|
__async
|
|
10
10
|
} from "./chunk-ASE2FXWP.js";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Wallet
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CUE4X7Y4.js";
|
|
4
|
+
import {
|
|
5
|
+
deriveServerSignerDetails
|
|
6
|
+
} from "./chunk-4MEGQR3I.js";
|
|
4
7
|
import {
|
|
5
8
|
TransactionNotCreatedError
|
|
6
9
|
} from "./chunk-SGINWAB6.js";
|
|
7
10
|
import {
|
|
8
11
|
walletsLogger
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SIP7NNGL.js";
|
|
10
13
|
import {
|
|
11
14
|
__async,
|
|
12
15
|
__decorateClass
|
|
@@ -61,9 +64,15 @@ var _StellarWallet = class _StellarWallet extends Wallet {
|
|
|
61
64
|
}
|
|
62
65
|
createTransaction(params) {
|
|
63
66
|
return __async(this, null, function* () {
|
|
64
|
-
var _a;
|
|
65
67
|
const { contractId, options } = params;
|
|
66
|
-
|
|
68
|
+
let signer;
|
|
69
|
+
if ((options == null ? void 0 : options.experimental_signer) == null) {
|
|
70
|
+
signer = this.signer.locator();
|
|
71
|
+
} else if (typeof options.experimental_signer === "string") {
|
|
72
|
+
signer = options.experimental_signer;
|
|
73
|
+
} else {
|
|
74
|
+
signer = `server:${deriveServerSignerDetails(options.experimental_signer, this.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}`;
|
|
75
|
+
}
|
|
67
76
|
let transaction;
|
|
68
77
|
if ("transaction" in params) {
|
|
69
78
|
transaction = {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__async
|
|
3
|
+
} from "./chunk-ASE2FXWP.js";
|
|
4
|
+
|
|
5
|
+
// src/signers/server/evm-server-signer.ts
|
|
6
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
7
|
+
import { bytesToHex } from "@noble/hashes/utils";
|
|
8
|
+
var EVMServerSigner = class {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.type = "server";
|
|
11
|
+
this.account = privateKeyToAccount(`0x${bytesToHex(config.derivedKeyBytes)}`);
|
|
12
|
+
this._address = this.account.address;
|
|
13
|
+
this._locator = config.locator;
|
|
14
|
+
}
|
|
15
|
+
address() {
|
|
16
|
+
return this._address;
|
|
17
|
+
}
|
|
18
|
+
locator() {
|
|
19
|
+
return this._locator;
|
|
20
|
+
}
|
|
21
|
+
signMessage(message) {
|
|
22
|
+
return __async(this, null, function* () {
|
|
23
|
+
if (!message.startsWith("0x")) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`EVMServerSigner.signMessage expects a 0x-prefixed hex string, got: ${message.slice(0, 10)}...`
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
const signature = yield this.account.signMessage({
|
|
29
|
+
message: {
|
|
30
|
+
raw: message
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return { signature };
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
signTransaction(transaction) {
|
|
37
|
+
return __async(this, null, function* () {
|
|
38
|
+
return yield this.signMessage(transaction);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
EVMServerSigner
|
|
45
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
4
|
+
|
|
5
|
+
// src/signers/server/solana-server-signer.ts
|
|
6
|
+
var _web3js = require('@solana/web3.js');
|
|
7
|
+
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
8
|
+
var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);
|
|
9
|
+
var SolanaServerSigner = class {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.type = "server";
|
|
12
|
+
this.keypair = _web3js.Keypair.fromSeed(config.derivedKeyBytes);
|
|
13
|
+
this._address = this.keypair.publicKey.toBase58();
|
|
14
|
+
this._locator = config.locator;
|
|
15
|
+
}
|
|
16
|
+
address() {
|
|
17
|
+
return this._address;
|
|
18
|
+
}
|
|
19
|
+
locator() {
|
|
20
|
+
return this._locator;
|
|
21
|
+
}
|
|
22
|
+
signMessage(message) {
|
|
23
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
24
|
+
const messageBytes = _bs582.default.decode(message);
|
|
25
|
+
const signatureBytes = _tweetnacl2.default.sign.detached(messageBytes, this.keypair.secretKey);
|
|
26
|
+
return { signature: _bs582.default.encode(signatureBytes) };
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
signTransaction(transaction) {
|
|
30
|
+
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
31
|
+
const transactionBytes = _bs582.default.decode(transaction);
|
|
32
|
+
const versionedTx = _web3js.VersionedTransaction.deserialize(transactionBytes);
|
|
33
|
+
const messageBytes = versionedTx.message.serialize();
|
|
34
|
+
const signatureBytes = _tweetnacl2.default.sign.detached(messageBytes, this.keypair.secretKey);
|
|
35
|
+
return { signature: _bs582.default.encode(signatureBytes) };
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
exports.SolanaServerSigner = SolanaServerSigner;
|
|
@@ -4,20 +4,23 @@
|
|
|
4
4
|
var _chunkRBHGZDDXcjs = require('./chunk-RBHGZDDX.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkJUS5BKF2cjs = require('./chunk-JUS5BKF2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunk357M7AYZcjs = require('./chunk-357M7AYZ.cjs');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkJD77GNRZcjs = require('./chunk-JD77GNRZ.cjs');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkUBWFRFQ6cjs = require('./chunk-UBWFRFQ6.cjs');
|
|
14
17
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
18
21
|
|
|
19
22
|
|
|
20
|
-
var
|
|
23
|
+
var _chunkBJQHHI7Kcjs = require('./chunk-BJQHHI7K.cjs');
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
|
|
@@ -36,45 +39,45 @@ var WalletFactory = class {
|
|
|
36
39
|
getOrCreateWallet(args) {
|
|
37
40
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
38
41
|
if (this.apiClient.isServerSide) {
|
|
39
|
-
|
|
42
|
+
_chunkBJQHHI7Kcjs.walletsLogger.error("walletFactory.getOrCreateWallet.error", {
|
|
40
43
|
error: "getOrCreateWallet can only be called from client-side code"
|
|
41
44
|
});
|
|
42
45
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
|
|
43
46
|
"getOrCreateWallet can only be called from client-side code.\n- Make sure you're running this in the browser (or another client environment), not on your server.\n- Use your Crossmint Client API Key (not a server key)."
|
|
44
47
|
);
|
|
45
48
|
}
|
|
46
|
-
args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain:
|
|
49
|
+
args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain: _chunkUBWFRFQ6cjs.validateChainForEnvironment.call(void 0, args.chain, this.apiClient.environment) });
|
|
47
50
|
const locator = this.getWalletLocator(args);
|
|
48
|
-
|
|
51
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("walletFactory.getOrCreateWallet.start");
|
|
49
52
|
const existingWallet = yield this.apiClient.getWallet(locator);
|
|
50
53
|
if (existingWallet != null && !("error" in existingWallet)) {
|
|
51
|
-
|
|
54
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("walletFactory.getOrCreateWallet.existing", {
|
|
52
55
|
address: existingWallet.address
|
|
53
56
|
});
|
|
54
57
|
return this.createWalletInstance(existingWallet, args);
|
|
55
58
|
}
|
|
56
|
-
|
|
59
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("walletFactory.getOrCreateWallet.creating");
|
|
57
60
|
return this.createWalletInternal(args);
|
|
58
61
|
});
|
|
59
62
|
}
|
|
60
63
|
getWallet(walletLocator, args) {
|
|
61
64
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
62
65
|
if (!this.apiClient.isServerSide) {
|
|
63
|
-
|
|
66
|
+
_chunkBJQHHI7Kcjs.walletsLogger.error("walletFactory.getWallet.error", {
|
|
64
67
|
error: "getWallet is not supported on client side"
|
|
65
68
|
});
|
|
66
69
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)("getWallet is not supported on client side, use getOrCreateWallet instead");
|
|
67
70
|
}
|
|
68
|
-
args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain:
|
|
69
|
-
|
|
71
|
+
args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain: _chunkUBWFRFQ6cjs.validateChainForEnvironment.call(void 0, args.chain, this.apiClient.environment) });
|
|
72
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("walletFactory.getWallet.start");
|
|
70
73
|
const existingWallet = yield this.apiClient.getWallet(walletLocator);
|
|
71
74
|
if ("error" in existingWallet) {
|
|
72
|
-
|
|
75
|
+
_chunkBJQHHI7Kcjs.walletsLogger.warn("walletFactory.getWallet.notFound", {
|
|
73
76
|
error: existingWallet.error
|
|
74
77
|
});
|
|
75
78
|
throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(existingWallet));
|
|
76
79
|
}
|
|
77
|
-
|
|
80
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("walletFactory.getWallet.success", {
|
|
78
81
|
address: existingWallet.address
|
|
79
82
|
});
|
|
80
83
|
return this.createWalletInstance(existingWallet, args);
|
|
@@ -82,33 +85,49 @@ var WalletFactory = class {
|
|
|
82
85
|
}
|
|
83
86
|
createWallet(args) {
|
|
84
87
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
85
|
-
args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain:
|
|
88
|
+
args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain: _chunkUBWFRFQ6cjs.validateChainForEnvironment.call(void 0, args.chain, this.apiClient.environment) });
|
|
86
89
|
return this.createWalletInternal(args);
|
|
87
90
|
});
|
|
88
91
|
}
|
|
89
92
|
createWalletInternal(args) {
|
|
90
93
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
91
|
-
var _a, _b, _c, _d, _e;
|
|
94
|
+
var _a, _b, _c, _d, _e, _f;
|
|
92
95
|
yield (_c = (_b = (_a = args.options) == null ? void 0 : _a.experimental_callbacks) == null ? void 0 : _b.onWalletCreationStart) == null ? void 0 : _c.call(_b);
|
|
93
|
-
|
|
96
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("walletFactory.createWallet.start");
|
|
94
97
|
this.mutateSignerFromCustomAuth(args, true);
|
|
95
|
-
|
|
98
|
+
let adminSigner;
|
|
99
|
+
const delegatedSigners = (_d = args.delegatedSigners) == null ? void 0 : _d.map((ds) => ({
|
|
100
|
+
signer: typeof ds.signer === "object" && ds.signer.type === "server" ? `server:${_chunkJD77GNRZcjs.deriveServerSignerDetails.call(void 0, ds.signer, args.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}` : ds.signer
|
|
101
|
+
}));
|
|
102
|
+
if (args.signer.type === "passkey") {
|
|
103
|
+
adminSigner = yield this.createPasskeyAdminSigner(args.signer);
|
|
104
|
+
} else if (args.signer.type === "server") {
|
|
105
|
+
const { derivedAddress } = _chunkJD77GNRZcjs.deriveServerSignerDetails.call(void 0,
|
|
106
|
+
args.signer,
|
|
107
|
+
args.chain,
|
|
108
|
+
this.apiClient.projectId,
|
|
109
|
+
this.apiClient.environment
|
|
110
|
+
);
|
|
111
|
+
adminSigner = { type: "server", address: derivedAddress };
|
|
112
|
+
} else {
|
|
113
|
+
adminSigner = args.signer;
|
|
114
|
+
}
|
|
96
115
|
const walletResponse = yield this.apiClient.createWallet({
|
|
97
116
|
type: "smart",
|
|
98
117
|
chainType: this.getChainType(args.chain),
|
|
99
118
|
config: _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
|
|
100
119
|
adminSigner
|
|
101
|
-
}, (args == null ? void 0 : args.plugins) ? { plugins: args.plugins } : {}),
|
|
102
|
-
owner: (
|
|
103
|
-
alias: (
|
|
120
|
+
}, (args == null ? void 0 : args.plugins) ? { plugins: args.plugins } : {}), delegatedSigners != null ? { delegatedSigners } : {}),
|
|
121
|
+
owner: (_e = args.owner) != null ? _e : void 0,
|
|
122
|
+
alias: (_f = args.alias) != null ? _f : void 0
|
|
104
123
|
});
|
|
105
124
|
if ("error" in walletResponse) {
|
|
106
|
-
|
|
125
|
+
_chunkBJQHHI7Kcjs.walletsLogger.error("walletFactory.createWallet.error", {
|
|
107
126
|
error: walletResponse.error
|
|
108
127
|
});
|
|
109
128
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)(JSON.stringify(walletResponse));
|
|
110
129
|
}
|
|
111
|
-
|
|
130
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("walletFactory.createWallet.success", {
|
|
112
131
|
address: walletResponse.address
|
|
113
132
|
});
|
|
114
133
|
return this.createWalletInstance(walletResponse, args);
|
|
@@ -116,21 +135,21 @@ var WalletFactory = class {
|
|
|
116
135
|
}
|
|
117
136
|
createWalletInstance(walletResponse, args) {
|
|
118
137
|
this.validateExistingWalletConfig(walletResponse, args);
|
|
119
|
-
const signerConfig = this.toInternalSignerConfig(walletResponse, args.signer, args.options);
|
|
120
|
-
return new (0,
|
|
138
|
+
const signerConfig = this.toInternalSignerConfig(walletResponse, args.signer, args.chain, args.options);
|
|
139
|
+
return new (0, _chunkJUS5BKF2cjs.Wallet)(
|
|
121
140
|
{
|
|
122
141
|
chain: args.chain,
|
|
123
142
|
address: walletResponse.address,
|
|
124
143
|
owner: walletResponse.owner,
|
|
125
|
-
signer:
|
|
144
|
+
signer: _chunk357M7AYZcjs.assembleSigner.call(void 0, args.chain, signerConfig),
|
|
126
145
|
options: args.options,
|
|
127
146
|
alias: args.alias
|
|
128
147
|
},
|
|
129
148
|
this.apiClient
|
|
130
149
|
);
|
|
131
150
|
}
|
|
132
|
-
toInternalSignerConfig(walletResponse, signerArgs, options) {
|
|
133
|
-
var _a, _b, _c, _d, _e, _f;
|
|
151
|
+
toInternalSignerConfig(walletResponse, signerArgs, chain, options) {
|
|
152
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
134
153
|
if (!(walletResponse.chainType === "evm" || walletResponse.chainType === "solana" || walletResponse.chainType === "stellar")) {
|
|
135
154
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)(`Wallet type ${walletResponse.chainType} is not supported`);
|
|
136
155
|
}
|
|
@@ -165,8 +184,31 @@ var WalletFactory = class {
|
|
|
165
184
|
onCreatePasskey: signerArgs.onCreatePasskey,
|
|
166
185
|
onSignWithPasskey: signerArgs.onSignWithPasskey
|
|
167
186
|
};
|
|
187
|
+
case "server": {
|
|
188
|
+
const serverAdminSigner = (_e = walletResponse.config) == null ? void 0 : _e.adminSigner;
|
|
189
|
+
if ((serverAdminSigner == null ? void 0 : serverAdminSigner.type) !== "server") {
|
|
190
|
+
throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Server signer expects a server admin signer on the wallet");
|
|
191
|
+
}
|
|
192
|
+
const { derivedKeyBytes, derivedAddress } = _chunkJD77GNRZcjs.deriveServerSignerDetails.call(void 0,
|
|
193
|
+
signerArgs,
|
|
194
|
+
chain,
|
|
195
|
+
this.apiClient.projectId,
|
|
196
|
+
this.apiClient.environment
|
|
197
|
+
);
|
|
198
|
+
if (serverAdminSigner.address !== derivedAddress) {
|
|
199
|
+
throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
|
|
200
|
+
`Server signer address ${derivedAddress} does not match the wallet's admin signer address`
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
type: "server",
|
|
205
|
+
derivedKeyBytes,
|
|
206
|
+
locator: serverAdminSigner.locator,
|
|
207
|
+
address: derivedAddress
|
|
208
|
+
};
|
|
209
|
+
}
|
|
168
210
|
case "email": {
|
|
169
|
-
if (((
|
|
211
|
+
if (((_f = walletResponse.config) == null ? void 0 : _f.adminSigner.type) !== "email") {
|
|
170
212
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Email signer does not match the wallet's signer type");
|
|
171
213
|
}
|
|
172
214
|
const { locator, email, address } = walletResponse.config.adminSigner;
|
|
@@ -181,7 +223,7 @@ var WalletFactory = class {
|
|
|
181
223
|
};
|
|
182
224
|
}
|
|
183
225
|
case "phone": {
|
|
184
|
-
if (((
|
|
226
|
+
if (((_g = walletResponse.config) == null ? void 0 : _g.adminSigner.type) !== "phone") {
|
|
185
227
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Phone signer does not match the wallet's signer type");
|
|
186
228
|
}
|
|
187
229
|
const { locator, phone, address } = walletResponse.config.adminSigner;
|
|
@@ -263,10 +305,10 @@ var WalletFactory = class {
|
|
|
263
305
|
_chunkRBHGZDDXcjs.compareSignerConfigs.call(void 0, adminSignerArgs, existingWalletSigner);
|
|
264
306
|
}
|
|
265
307
|
if (args.delegatedSigners != null) {
|
|
266
|
-
this.validateDelegatedSigners(existingWallet, args.delegatedSigners);
|
|
308
|
+
this.validateDelegatedSigners(existingWallet, args.delegatedSigners, args.chain);
|
|
267
309
|
}
|
|
268
310
|
}
|
|
269
|
-
validateDelegatedSigners(existingWallet, inputDelegatedSigners) {
|
|
311
|
+
validateDelegatedSigners(existingWallet, inputDelegatedSigners, chain) {
|
|
270
312
|
var _a;
|
|
271
313
|
const existingDelegatedSigners = (_a = existingWallet == null ? void 0 : existingWallet.config) == null ? void 0 : _a.delegatedSigners;
|
|
272
314
|
if (inputDelegatedSigners.length === 0) {
|
|
@@ -278,13 +320,14 @@ var WalletFactory = class {
|
|
|
278
320
|
);
|
|
279
321
|
}
|
|
280
322
|
for (const argSigner of inputDelegatedSigners) {
|
|
323
|
+
const resolvedSigner = typeof argSigner.signer === "object" && argSigner.signer.type === "server" ? `server:${_chunkJD77GNRZcjs.deriveServerSignerDetails.call(void 0, argSigner.signer, chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}` : argSigner.signer;
|
|
281
324
|
const matchingExistingSigner = existingDelegatedSigners.find(
|
|
282
|
-
(existingSigner) => existingSigner.locator ===
|
|
325
|
+
(existingSigner) => existingSigner.locator === resolvedSigner
|
|
283
326
|
);
|
|
284
327
|
if (matchingExistingSigner == null) {
|
|
285
328
|
const walletSigners = existingDelegatedSigners.map((s) => s.locator).join(", ");
|
|
286
329
|
throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
|
|
287
|
-
`Delegated signer '${
|
|
330
|
+
`Delegated signer '${resolvedSigner}' does not exist in wallet "${existingWallet.address}". Available delegated signers: ${walletSigners}. ${DELEGATED_SIGNER_MISMATCH_ERROR}`
|
|
288
331
|
);
|
|
289
332
|
}
|
|
290
333
|
}
|
|
@@ -301,7 +344,7 @@ var WalletFactory = class {
|
|
|
301
344
|
};
|
|
302
345
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
303
346
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
304
|
-
logger:
|
|
347
|
+
logger: _chunkBJQHHI7Kcjs.walletsLogger,
|
|
305
348
|
methodName: "walletFactory.getOrCreateWallet",
|
|
306
349
|
buildContext(_thisArg, args) {
|
|
307
350
|
const walletArgs = args[0];
|
|
@@ -311,7 +354,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
311
354
|
], WalletFactory.prototype, "getOrCreateWallet", 1);
|
|
312
355
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
313
356
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
314
|
-
logger:
|
|
357
|
+
logger: _chunkBJQHHI7Kcjs.walletsLogger,
|
|
315
358
|
methodName: "walletFactory.getWallet",
|
|
316
359
|
buildContext(_thisArg, args) {
|
|
317
360
|
const walletLocator = args[0];
|
|
@@ -322,7 +365,7 @@ _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
|
322
365
|
], WalletFactory.prototype, "getWallet", 1);
|
|
323
366
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
324
367
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
325
|
-
logger:
|
|
368
|
+
logger: _chunkBJQHHI7Kcjs.walletsLogger,
|
|
326
369
|
methodName: "walletFactory.createWallet",
|
|
327
370
|
buildContext(_thisArg, args) {
|
|
328
371
|
const walletArgs = args[0];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJUS5BKF2cjs = require('./chunk-JUS5BKF2.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkJD77GNRZcjs = require('./chunk-JD77GNRZ.cjs');
|
|
4
7
|
|
|
5
8
|
|
|
6
9
|
var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
|
|
@@ -9,7 +12,7 @@ var _chunkQ5KNPVYIcjs = require('./chunk-Q5KNPVYI.cjs');
|
|
|
9
12
|
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
10
13
|
|
|
11
14
|
|
|
12
|
-
var
|
|
15
|
+
var _chunkBJQHHI7Kcjs = require('./chunk-BJQHHI7K.cjs');
|
|
13
16
|
|
|
14
17
|
|
|
15
18
|
|
|
@@ -18,7 +21,7 @@ var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
|
18
21
|
// src/wallets/solana.ts
|
|
19
22
|
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
20
23
|
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
21
|
-
var _SolanaWallet = class _SolanaWallet extends
|
|
24
|
+
var _SolanaWallet = class _SolanaWallet extends _chunkJUS5BKF2cjs.Wallet {
|
|
22
25
|
constructor(wallet) {
|
|
23
26
|
super(
|
|
24
27
|
{
|
|
@@ -26,10 +29,10 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
26
29
|
address: wallet.address,
|
|
27
30
|
owner: wallet.owner,
|
|
28
31
|
signer: wallet.signer,
|
|
29
|
-
options:
|
|
32
|
+
options: _chunkJUS5BKF2cjs.Wallet.getOptions(wallet),
|
|
30
33
|
alias: wallet.alias
|
|
31
34
|
},
|
|
32
|
-
|
|
35
|
+
_chunkJUS5BKF2cjs.Wallet.getApiClient(wallet)
|
|
33
36
|
);
|
|
34
37
|
}
|
|
35
38
|
static from(wallet) {
|
|
@@ -41,11 +44,11 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
41
44
|
sendTransaction(params) {
|
|
42
45
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
43
46
|
var _a, _b;
|
|
44
|
-
|
|
47
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("solanaWallet.sendTransaction.start");
|
|
45
48
|
yield this.preAuthIfNeeded();
|
|
46
49
|
const createdTransaction = yield this.createTransaction(params);
|
|
47
50
|
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
48
|
-
|
|
51
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("solanaWallet.sendTransaction.prepared", {
|
|
49
52
|
transactionId: createdTransaction.id
|
|
50
53
|
});
|
|
51
54
|
return {
|
|
@@ -69,7 +72,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
69
72
|
additionalSigners: _additionalSigners
|
|
70
73
|
};
|
|
71
74
|
const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
|
|
72
|
-
|
|
75
|
+
_chunkBJQHHI7Kcjs.walletsLogger.info("solanaWallet.sendTransaction.success", {
|
|
73
76
|
transactionId: createdTransaction.id,
|
|
74
77
|
hash: result.hash
|
|
75
78
|
});
|
|
@@ -78,8 +81,15 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
78
81
|
}
|
|
79
82
|
createTransaction(params) {
|
|
80
83
|
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
81
|
-
var _a
|
|
82
|
-
|
|
84
|
+
var _a;
|
|
85
|
+
let signer;
|
|
86
|
+
if (((_a = params.options) == null ? void 0 : _a.experimental_signer) == null) {
|
|
87
|
+
signer = this.signer.locator();
|
|
88
|
+
} else if (typeof params.options.experimental_signer === "string") {
|
|
89
|
+
signer = params.options.experimental_signer;
|
|
90
|
+
} else {
|
|
91
|
+
signer = `server:${_chunkJD77GNRZcjs.deriveServerSignerDetails.call(void 0, params.options.experimental_signer, this.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}`;
|
|
92
|
+
}
|
|
83
93
|
let serializedTransaction;
|
|
84
94
|
if ("serializedTransaction" in params) {
|
|
85
95
|
serializedTransaction = params.serializedTransaction;
|
|
@@ -101,7 +111,7 @@ var _SolanaWallet = class _SolanaWallet extends _chunkPOG76HDDcjs.Wallet {
|
|
|
101
111
|
};
|
|
102
112
|
_chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
|
|
103
113
|
_commonsdkbase.WithLoggerContext.call(void 0, {
|
|
104
|
-
logger:
|
|
114
|
+
logger: _chunkBJQHHI7Kcjs.walletsLogger,
|
|
105
115
|
methodName: "solanaWallet.sendTransaction",
|
|
106
116
|
buildContext(thisArg) {
|
|
107
117
|
return { chain: thisArg.chain, address: thisArg.address };
|