@crossmint/wallets-sdk 0.20.2 → 0.20.5
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/package.json +1 -1
- package/LICENSE +0 -201
- package/README.md +0 -96
- package/dist/api/__tests__/constants.cjs +0 -31
- package/dist/api/__tests__/constants.d.cts +0 -96
- package/dist/api/__tests__/constants.d.ts +0 -96
- package/dist/api/__tests__/constants.js +0 -31
- package/dist/api/__tests__/test-utils.cjs +0 -372
- package/dist/api/__tests__/test-utils.d.cts +0 -99
- package/dist/api/__tests__/test-utils.d.ts +0 -99
- package/dist/api/__tests__/test-utils.js +0 -372
- package/dist/api/client.cjs +0 -10
- package/dist/api/client.d.cts +0 -42
- package/dist/api/client.d.ts +0 -42
- package/dist/api/client.js +0 -10
- package/dist/api/gen/client.gen.cjs +0 -7
- package/dist/api/gen/client.gen.d.cts +0 -16
- package/dist/api/gen/client.gen.d.ts +0 -16
- package/dist/api/gen/client.gen.js +0 -7
- package/dist/api/gen/index.cjs +0 -179
- package/dist/api/gen/index.d.cts +0 -3
- package/dist/api/gen/index.d.ts +0 -3
- package/dist/api/gen/index.js +0 -179
- package/dist/api/gen/sdk.gen.cjs +0 -178
- package/dist/api/gen/sdk.gen.d.cts +0 -611
- package/dist/api/gen/sdk.gen.d.ts +0 -611
- package/dist/api/gen/sdk.gen.js +0 -178
- package/dist/api/gen/types.gen.cjs +0 -1
- package/dist/api/gen/types.gen.d.cts +0 -13865
- package/dist/api/gen/types.gen.d.ts +0 -13865
- package/dist/api/gen/types.gen.js +0 -1
- package/dist/api/index.cjs +0 -12
- package/dist/api/index.d.cts +0 -6
- package/dist/api/index.d.ts +0 -6
- package/dist/api/index.js +0 -12
- package/dist/api/types.cjs +0 -1
- package/dist/api/types.d.cts +0 -55
- package/dist/api/types.d.ts +0 -55
- package/dist/api/types.js +0 -1
- package/dist/chains/chains.cjs +0 -24
- package/dist/chains/chains.d.cts +0 -28
- package/dist/chains/chains.d.ts +0 -28
- package/dist/chains/chains.js +0 -24
- package/dist/chains/definitions/arcTestnet.cjs +0 -7
- package/dist/chains/definitions/arcTestnet.d.cts +0 -43
- package/dist/chains/definitions/arcTestnet.d.ts +0 -43
- package/dist/chains/definitions/arcTestnet.js +0 -7
- package/dist/chains/definitions/story.cjs +0 -7
- package/dist/chains/definitions/story.d.cts +0 -49
- package/dist/chains/definitions/story.d.ts +0 -49
- package/dist/chains/definitions/story.js +0 -7
- package/dist/chains/definitions/storyTestnet.cjs +0 -7
- package/dist/chains/definitions/storyTestnet.d.cts +0 -43
- package/dist/chains/definitions/storyTestnet.d.ts +0 -43
- package/dist/chains/definitions/storyTestnet.js +0 -7
- package/dist/chains/definitions/tempo.cjs +0 -7
- package/dist/chains/definitions/tempo.d.cts +0 -39
- package/dist/chains/definitions/tempo.d.ts +0 -39
- package/dist/chains/definitions/tempo.js +0 -7
- package/dist/chains/definitions/tempoTestnet.cjs +0 -7
- package/dist/chains/definitions/tempoTestnet.d.cts +0 -39
- package/dist/chains/definitions/tempoTestnet.d.ts +0 -39
- package/dist/chains/definitions/tempoTestnet.js +0 -7
- package/dist/chunk-2I2OFGNL.js +0 -36
- package/dist/chunk-2T5HHKUI.js +0 -19
- package/dist/chunk-2WBSPOWU.js +0 -223
- package/dist/chunk-3U6UAYOV.js +0 -25
- package/dist/chunk-455NK5LB.js +0 -0
- package/dist/chunk-47R3UV3J.cjs +0 -58
- package/dist/chunk-47WKYTRN.js +0 -63
- package/dist/chunk-4GFSUI2I.cjs +0 -66
- package/dist/chunk-55V4VMTX.cjs +0 -25
- package/dist/chunk-5IFDVB4Y.js +0 -0
- package/dist/chunk-66UY53KP.cjs +0 -336
- package/dist/chunk-6FG5QXII.cjs +0 -110
- package/dist/chunk-6HXIZLEQ.cjs +0 -1
- package/dist/chunk-6UMJYMAY.js +0 -82
- package/dist/chunk-7GOUUPS4.js +0 -36
- package/dist/chunk-7TT3VUDF.cjs +0 -84
- package/dist/chunk-7USEVMTW.cjs +0 -21
- package/dist/chunk-A6E67ZZP.js +0 -237
- package/dist/chunk-ABMZ3ZVN.js +0 -52
- package/dist/chunk-ASE2FXWP.js +0 -65
- package/dist/chunk-BMMZIPXT.js +0 -778
- package/dist/chunk-CCIGWTAO.cjs +0 -1
- package/dist/chunk-CMBFV325.js +0 -69
- package/dist/chunk-COR3CNRW.cjs +0 -778
- package/dist/chunk-ECAM5KTH.cjs +0 -1
- package/dist/chunk-F7L2TZ3I.cjs +0 -21
- package/dist/chunk-FHMKNG62.js +0 -741
- package/dist/chunk-FICVKSXZ.js +0 -84
- package/dist/chunk-FOOISYCJ.js +0 -66
- package/dist/chunk-G6QJHFSY.cjs +0 -74
- package/dist/chunk-HTSQPZHW.cjs +0 -25
- package/dist/chunk-HXJ3YPAN.js +0 -110
- package/dist/chunk-IDKGJO2G.cjs +0 -115
- package/dist/chunk-IOMKHF6R.cjs +0 -44
- package/dist/chunk-IPO25BCU.js +0 -43
- package/dist/chunk-JREZWZ2S.cjs +0 -52
- package/dist/chunk-JSWTGW46.cjs +0 -36
- package/dist/chunk-JWMQALLN.js +0 -21
- package/dist/chunk-KBJA7JDT.js +0 -0
- package/dist/chunk-KQH5ZXJ4.js +0 -336
- package/dist/chunk-KT3CVXFG.js +0 -9
- package/dist/chunk-MMISP35W.js +0 -21
- package/dist/chunk-MRZXYVQO.cjs +0 -82
- package/dist/chunk-NIBKCMQ2.cjs +0 -19
- package/dist/chunk-PIFD6KNH.js +0 -59
- package/dist/chunk-PJOJIRTY.js +0 -74
- package/dist/chunk-PK7J3Y3L.js +0 -44
- package/dist/chunk-PM7BGATN.cjs +0 -237
- package/dist/chunk-PO6S7UR3.cjs +0 -1
- package/dist/chunk-POG76HDD.cjs +0 -741
- package/dist/chunk-PUO4QNXH.js +0 -89
- package/dist/chunk-Q5KNPVYI.cjs +0 -59
- package/dist/chunk-R4AW5ADG.cjs +0 -16
- package/dist/chunk-R6DH4V7S.cjs +0 -69
- package/dist/chunk-RBHGZDDX.cjs +0 -58
- package/dist/chunk-RHR6P2KP.cjs +0 -15
- package/dist/chunk-RYQI3RXL.cjs +0 -247
- package/dist/chunk-SGINWAB6.js +0 -155
- package/dist/chunk-T2XUADHW.js +0 -58
- package/dist/chunk-TYQ4YIP7.js +0 -16
- package/dist/chunk-U3NV7UY7.js +0 -323
- package/dist/chunk-UO2J2ZB2.cjs +0 -65
- package/dist/chunk-W7K5E64Q.js +0 -247
- package/dist/chunk-WDZY4PP4.cjs +0 -223
- package/dist/chunk-WHTECI7J.cjs +0 -89
- package/dist/chunk-WJUPOCKJ.js +0 -15
- package/dist/chunk-WWW6IGZ7.js +0 -115
- package/dist/chunk-XC2V34TS.cjs +0 -155
- package/dist/chunk-XOCC3MPK.cjs +0 -36
- package/dist/chunk-XPMCPXI3.cjs +0 -1
- package/dist/chunk-YDZRBHS3.js +0 -0
- package/dist/chunk-YMRXMNME.js +0 -0
- package/dist/chunk-ZAX22GSI.cjs +0 -323
- package/dist/chunk-ZBLW42YE.js +0 -25
- package/dist/chunk-ZNAGDENG.cjs +0 -43
- package/dist/chunk-ZP4ZZCIE.js +0 -58
- package/dist/chunk-ZT7EGOCI.cjs +0 -9
- package/dist/chunk-ZTEMOYS2.cjs +0 -63
- package/dist/index.cjs +0 -60
- package/dist/index.d.cts +0 -19
- package/dist/index.d.ts +0 -19
- package/dist/index.js +0 -60
- package/dist/logger/index.cjs +0 -11
- package/dist/logger/index.d.cts +0 -2
- package/dist/logger/index.d.ts +0 -2
- package/dist/logger/index.js +0 -11
- package/dist/logger/init.cjs +0 -10
- package/dist/logger/init.d.cts +0 -15
- package/dist/logger/init.d.ts +0 -15
- package/dist/logger/init.js +0 -10
- package/dist/sdk.cjs +0 -39
- package/dist/sdk.d.cts +0 -48
- package/dist/sdk.d.ts +0 -48
- package/dist/sdk.js +0 -39
- package/dist/signers/evm-api-key.cjs +0 -7
- package/dist/signers/evm-api-key.d.cts +0 -18
- package/dist/signers/evm-api-key.d.ts +0 -18
- package/dist/signers/evm-api-key.js +0 -7
- package/dist/signers/evm-external-wallet.cjs +0 -7
- package/dist/signers/evm-external-wallet.d.cts +0 -26
- package/dist/signers/evm-external-wallet.d.ts +0 -26
- package/dist/signers/evm-external-wallet.js +0 -7
- package/dist/signers/index.cjs +0 -24
- package/dist/signers/index.d.cts +0 -11
- package/dist/signers/index.d.ts +0 -11
- package/dist/signers/index.js +0 -24
- package/dist/signers/non-custodial/index.cjs +0 -27
- package/dist/signers/non-custodial/index.d.cts +0 -11
- package/dist/signers/non-custodial/index.d.ts +0 -11
- package/dist/signers/non-custodial/index.js +0 -27
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +0 -13
- package/dist/signers/non-custodial/ncs-evm-signer.d.cts +0 -30
- package/dist/signers/non-custodial/ncs-evm-signer.d.ts +0 -30
- package/dist/signers/non-custodial/ncs-evm-signer.js +0 -13
- package/dist/signers/non-custodial/ncs-iframe-manager.cjs +0 -7
- package/dist/signers/non-custodial/ncs-iframe-manager.d.cts +0 -16
- package/dist/signers/non-custodial/ncs-iframe-manager.d.ts +0 -16
- package/dist/signers/non-custodial/ncs-iframe-manager.js +0 -7
- package/dist/signers/non-custodial/ncs-signer.cjs +0 -14
- package/dist/signers/non-custodial/ncs-signer.d.cts +0 -50
- package/dist/signers/non-custodial/ncs-signer.d.ts +0 -50
- package/dist/signers/non-custodial/ncs-signer.js +0 -14
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +0 -13
- package/dist/signers/non-custodial/ncs-solana-signer.d.cts +0 -27
- package/dist/signers/non-custodial/ncs-solana-signer.d.ts +0 -27
- package/dist/signers/non-custodial/ncs-solana-signer.js +0 -13
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +0 -13
- package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +0 -27
- package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +0 -27
- package/dist/signers/non-custodial/ncs-stellar-signer.js +0 -13
- package/dist/signers/passkey.cjs +0 -7
- package/dist/signers/passkey.d.cts +0 -19
- package/dist/signers/passkey.d.ts +0 -19
- package/dist/signers/passkey.js +0 -7
- package/dist/signers/solana-api-key.cjs +0 -7
- package/dist/signers/solana-api-key.d.cts +0 -18
- package/dist/signers/solana-api-key.d.ts +0 -18
- package/dist/signers/solana-api-key.js +0 -7
- package/dist/signers/solana-external-wallet.cjs +0 -8
- package/dist/signers/solana-external-wallet.d.cts +0 -24
- package/dist/signers/solana-external-wallet.d.ts +0 -24
- package/dist/signers/solana-external-wallet.js +0 -8
- package/dist/signers/stellar-external-wallet.cjs +0 -7
- package/dist/signers/stellar-external-wallet.d.cts +0 -23
- package/dist/signers/stellar-external-wallet.d.ts +0 -23
- package/dist/signers/stellar-external-wallet.js +0 -7
- package/dist/signers/types.cjs +0 -9
- package/dist/signers/types.d.cts +0 -91
- package/dist/signers/types.d.ts +0 -91
- package/dist/signers/types.js +0 -9
- package/dist/utils/constants.cjs +0 -13
- package/dist/utils/constants.d.cts +0 -6
- package/dist/utils/constants.d.ts +0 -6
- package/dist/utils/constants.js +0 -13
- package/dist/utils/errors.cjs +0 -55
- package/dist/utils/errors.d.cts +0 -80
- package/dist/utils/errors.d.ts +0 -80
- package/dist/utils/errors.js +0 -55
- package/dist/utils/signer-validation.cjs +0 -10
- package/dist/utils/signer-validation.d.cts +0 -9
- package/dist/utils/signer-validation.d.ts +0 -9
- package/dist/utils/signer-validation.js +0 -10
- package/dist/wallets/__tests__/setup.cjs +0 -36
- package/dist/wallets/__tests__/setup.d.cts +0 -2
- package/dist/wallets/__tests__/setup.d.ts +0 -2
- package/dist/wallets/__tests__/setup.js +0 -36
- package/dist/wallets/__tests__/test-helpers.cjs +0 -93
- package/dist/wallets/__tests__/test-helpers.d.cts +0 -36
- package/dist/wallets/__tests__/test-helpers.d.ts +0 -36
- package/dist/wallets/__tests__/test-helpers.js +0 -93
- package/dist/wallets/evm.cjs +0 -25
- package/dist/wallets/evm.d.cts +0 -155
- package/dist/wallets/evm.d.ts +0 -155
- package/dist/wallets/evm.js +0 -25
- package/dist/wallets/solana.cjs +0 -26
- package/dist/wallets/solana.d.cts +0 -28
- package/dist/wallets/solana.d.ts +0 -28
- package/dist/wallets/solana.js +0 -26
- package/dist/wallets/stellar.cjs +0 -25
- package/dist/wallets/stellar.d.cts +0 -30
- package/dist/wallets/stellar.d.ts +0 -30
- package/dist/wallets/stellar.js +0 -25
- package/dist/wallets/types.cjs +0 -1
- package/dist/wallets/types.d.cts +0 -170
- package/dist/wallets/types.d.ts +0 -170
- package/dist/wallets/types.js +0 -0
- package/dist/wallets/wallet-factory.cjs +0 -33
- package/dist/wallets/wallet-factory.d.cts +0 -33
- package/dist/wallets/wallet-factory.d.ts +0 -33
- package/dist/wallets/wallet-factory.js +0 -33
- package/dist/wallets/wallet.cjs +0 -24
- package/dist/wallets/wallet.d.cts +0 -168
- package/dist/wallets/wallet.d.ts +0 -168
- package/dist/wallets/wallet.js +0 -24
package/dist/chunk-W7K5E64Q.js
DELETED
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InvalidApiKeyError
|
|
3
|
-
} from "./chunk-SGINWAB6.js";
|
|
4
|
-
import {
|
|
5
|
-
walletsLogger
|
|
6
|
-
} from "./chunk-ABMZ3ZVN.js";
|
|
7
|
-
import {
|
|
8
|
-
SDK_NAME,
|
|
9
|
-
SDK_VERSION
|
|
10
|
-
} from "./chunk-TYQ4YIP7.js";
|
|
11
|
-
import {
|
|
12
|
-
__async
|
|
13
|
-
} from "./chunk-ASE2FXWP.js";
|
|
14
|
-
|
|
15
|
-
// src/api/client.ts
|
|
16
|
-
import {
|
|
17
|
-
APIKeyEnvironmentPrefix,
|
|
18
|
-
APIKeyUsageOrigin,
|
|
19
|
-
CrossmintApiClient
|
|
20
|
-
} from "@crossmint/common-sdk-base";
|
|
21
|
-
var ApiClient = class extends CrossmintApiClient {
|
|
22
|
-
constructor(crossmint) {
|
|
23
|
-
super(crossmint, {
|
|
24
|
-
internalConfig: {
|
|
25
|
-
sdkMetadata: { name: SDK_NAME, version: SDK_VERSION }
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
this.apiPrefix = "api/2025-06-09/wallets";
|
|
29
|
-
this.legacyApiPrefix = "api/2022-06-09/wallets";
|
|
30
|
-
}
|
|
31
|
-
createWallet(params) {
|
|
32
|
-
return __async(this, null, function* () {
|
|
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
|
-
});
|
|
38
|
-
const response = yield this.post(path, {
|
|
39
|
-
body: JSON.stringify(params),
|
|
40
|
-
headers: this.headers
|
|
41
|
-
});
|
|
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;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
getWallet(locator) {
|
|
58
|
-
return __async(this, null, function* () {
|
|
59
|
-
walletsLogger.info("wallets.api.getWallet", { locator });
|
|
60
|
-
const response = yield this.get(`${this.apiPrefix}/${locator}`, {
|
|
61
|
-
headers: this.headers
|
|
62
|
-
});
|
|
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;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
createTransaction(walletLocator, params) {
|
|
76
|
-
return __async(this, null, function* () {
|
|
77
|
-
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/transactions`, {
|
|
78
|
-
body: JSON.stringify(params),
|
|
79
|
-
headers: this.headers
|
|
80
|
-
});
|
|
81
|
-
return response.json();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
approveTransaction(walletLocator, transactionId, params) {
|
|
85
|
-
return __async(this, null, function* () {
|
|
86
|
-
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/transactions/${transactionId}/approvals`, {
|
|
87
|
-
body: JSON.stringify(params),
|
|
88
|
-
headers: this.headers
|
|
89
|
-
});
|
|
90
|
-
return response.json();
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
getTransaction(walletLocator, transactionId) {
|
|
94
|
-
return __async(this, null, function* () {
|
|
95
|
-
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/transactions/${transactionId}`, {
|
|
96
|
-
headers: this.headers
|
|
97
|
-
});
|
|
98
|
-
return response.json();
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
createSignature(walletLocator, params) {
|
|
102
|
-
return __async(this, null, function* () {
|
|
103
|
-
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/signatures`, {
|
|
104
|
-
body: JSON.stringify(params),
|
|
105
|
-
headers: this.headers
|
|
106
|
-
});
|
|
107
|
-
return response.json();
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
approveSignature(walletLocator, signatureId, params) {
|
|
111
|
-
return __async(this, null, function* () {
|
|
112
|
-
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/signatures/${signatureId}/approvals`, {
|
|
113
|
-
body: JSON.stringify(params),
|
|
114
|
-
headers: this.headers
|
|
115
|
-
});
|
|
116
|
-
return response.json();
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
getSignature(walletLocator, signatureId) {
|
|
120
|
-
return __async(this, null, function* () {
|
|
121
|
-
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/signatures/${signatureId}`, {
|
|
122
|
-
headers: this.headers
|
|
123
|
-
});
|
|
124
|
-
return response.json();
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
getTransactions(walletLocator) {
|
|
128
|
-
return __async(this, null, function* () {
|
|
129
|
-
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/transactions`, {
|
|
130
|
-
headers: this.headers
|
|
131
|
-
});
|
|
132
|
-
return response.json();
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
experimental_getNfts(params) {
|
|
136
|
-
return __async(this, null, function* () {
|
|
137
|
-
const queryParams = new URLSearchParams();
|
|
138
|
-
queryParams.append("page", params.page.toString());
|
|
139
|
-
queryParams.append("perPage", params.perPage.toString());
|
|
140
|
-
const identifier = `${params.chain}:${params.address}`;
|
|
141
|
-
const response = yield this.get(`${this.apiPrefix}/${identifier}/nfts?${queryParams.toString()}`, {
|
|
142
|
-
headers: this.headers
|
|
143
|
-
});
|
|
144
|
-
return response.json();
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
experimental_activity(walletLocator, params) {
|
|
148
|
-
return __async(this, null, function* () {
|
|
149
|
-
let legacyLocator = walletLocator;
|
|
150
|
-
if (!this.isServerSide) {
|
|
151
|
-
legacyLocator = `me:${params.chain === "solana" ? "solana-smart-wallet" : "evm-smart-wallet"}`;
|
|
152
|
-
}
|
|
153
|
-
const queryParams = new URLSearchParams();
|
|
154
|
-
queryParams.append("chain", params.chain.toString());
|
|
155
|
-
const response = yield this.get(`${this.legacyApiPrefix}/${legacyLocator}/activity?${queryParams.toString()}`, {
|
|
156
|
-
headers: this.headers
|
|
157
|
-
});
|
|
158
|
-
return response.json();
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
getBalance(walletLocator, params) {
|
|
162
|
-
return __async(this, null, function* () {
|
|
163
|
-
const queryParams = new URLSearchParams();
|
|
164
|
-
queryParams.append("tokens", params.tokens.join(","));
|
|
165
|
-
queryParams.append("chains", params.chains.join(","));
|
|
166
|
-
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/balances?${queryParams.toString()}`, {
|
|
167
|
-
headers: this.headers
|
|
168
|
-
});
|
|
169
|
-
return response.json();
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
fundWallet(walletLocator, params) {
|
|
173
|
-
return __async(this, null, function* () {
|
|
174
|
-
if (this.environment === APIKeyEnvironmentPrefix.PRODUCTION) {
|
|
175
|
-
throw new Error("Funding wallets is only supported in staging environment");
|
|
176
|
-
}
|
|
177
|
-
const response = yield this.post(`api/v1-alpha2/wallets/${walletLocator}/balances`, {
|
|
178
|
-
body: JSON.stringify(params),
|
|
179
|
-
headers: this.headers
|
|
180
|
-
});
|
|
181
|
-
return response.json();
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
registerSigner(walletLocator, params) {
|
|
185
|
-
return __async(this, null, function* () {
|
|
186
|
-
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/signers`, {
|
|
187
|
-
body: JSON.stringify(params),
|
|
188
|
-
headers: this.headers
|
|
189
|
-
});
|
|
190
|
-
return response.json();
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
getSigner(walletLocator, signer) {
|
|
194
|
-
return __async(this, null, function* () {
|
|
195
|
-
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/signers/${signer}`, {
|
|
196
|
-
headers: this.headers
|
|
197
|
-
});
|
|
198
|
-
return response.json();
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
send(walletLocator, tokenLocator, params) {
|
|
202
|
-
return __async(this, null, function* () {
|
|
203
|
-
walletsLogger.info("wallets.api.send", {
|
|
204
|
-
walletLocator,
|
|
205
|
-
tokenLocator,
|
|
206
|
-
recipient: params.recipient
|
|
207
|
-
});
|
|
208
|
-
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/tokens/${tokenLocator}/transfers`, {
|
|
209
|
-
body: JSON.stringify(params),
|
|
210
|
-
headers: this.headers
|
|
211
|
-
});
|
|
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;
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
get isServerSide() {
|
|
229
|
-
return this.parsedAPIKey.usageOrigin === APIKeyUsageOrigin.SERVER;
|
|
230
|
-
}
|
|
231
|
-
get environment() {
|
|
232
|
-
if (!this.parsedAPIKey.isValid) {
|
|
233
|
-
throw new InvalidApiKeyError("Invalid API key");
|
|
234
|
-
}
|
|
235
|
-
return this.parsedAPIKey.environment;
|
|
236
|
-
}
|
|
237
|
-
get headers() {
|
|
238
|
-
const headers = {
|
|
239
|
-
"Content-Type": "application/json"
|
|
240
|
-
};
|
|
241
|
-
return headers;
|
|
242
|
-
}
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
export {
|
|
246
|
-
ApiClient
|
|
247
|
-
};
|
package/dist/chunk-WDZY4PP4.cjs
DELETED
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkNIBKCMQ2cjs = require('./chunk-NIBKCMQ2.cjs');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var _chunk55V4VMTXcjs = require('./chunk-55V4VMTX.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var _chunk7USEVMTWcjs = require('./chunk-7USEVMTW.cjs');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _chunkF7L2TZ3Icjs = require('./chunk-F7L2TZ3I.cjs');
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
var _chunkHTSQPZHWcjs = require('./chunk-HTSQPZHW.cjs');
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
|
|
22
|
-
|
|
23
|
-
// src/chains/chains.ts
|
|
24
|
-
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
var _chains = require('viem/chains');
|
|
47
|
-
var TESTNET_AA_CHAINS = [
|
|
48
|
-
_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,
|
|
49
|
-
_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,
|
|
50
|
-
_commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,
|
|
51
|
-
_commonsdkbase.BlockchainIncludingTestnet.CURTIS,
|
|
52
|
-
_commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA,
|
|
53
|
-
_commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,
|
|
54
|
-
_commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,
|
|
55
|
-
_commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,
|
|
56
|
-
_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,
|
|
57
|
-
_commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,
|
|
58
|
-
_commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,
|
|
59
|
-
_commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,
|
|
60
|
-
_commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,
|
|
61
|
-
_commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,
|
|
62
|
-
_commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,
|
|
63
|
-
_commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,
|
|
64
|
-
_commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET,
|
|
65
|
-
_commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET
|
|
66
|
-
];
|
|
67
|
-
var PRODUCTION_AA_CHAINS = [
|
|
68
|
-
_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT,
|
|
69
|
-
_commonsdkbase.BlockchainIncludingTestnet.APECHAIN,
|
|
70
|
-
_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM,
|
|
71
|
-
_commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA,
|
|
72
|
-
_commonsdkbase.BlockchainIncludingTestnet.BASE,
|
|
73
|
-
_commonsdkbase.BlockchainIncludingTestnet.BSC,
|
|
74
|
-
_commonsdkbase.BlockchainIncludingTestnet.FLOW,
|
|
75
|
-
_commonsdkbase.BlockchainIncludingTestnet.MANTLE,
|
|
76
|
-
_commonsdkbase.BlockchainIncludingTestnet.MODE,
|
|
77
|
-
_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM,
|
|
78
|
-
_commonsdkbase.BlockchainIncludingTestnet.PLUME,
|
|
79
|
-
_commonsdkbase.BlockchainIncludingTestnet.POLYGON,
|
|
80
|
-
_commonsdkbase.BlockchainIncludingTestnet.SCROLL,
|
|
81
|
-
_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1,
|
|
82
|
-
_commonsdkbase.BlockchainIncludingTestnet.SHAPE,
|
|
83
|
-
_commonsdkbase.BlockchainIncludingTestnet.STORY,
|
|
84
|
-
_commonsdkbase.BlockchainIncludingTestnet.TEMPO,
|
|
85
|
-
_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN,
|
|
86
|
-
_commonsdkbase.BlockchainIncludingTestnet.ZORA
|
|
87
|
-
];
|
|
88
|
-
function toViemChain(chain) {
|
|
89
|
-
switch (chain) {
|
|
90
|
-
case _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA:
|
|
91
|
-
return _chains.baseSepolia;
|
|
92
|
-
case _commonsdkbase.BlockchainIncludingTestnet.BASE:
|
|
93
|
-
return _chains.base;
|
|
94
|
-
case _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY:
|
|
95
|
-
return _chains.polygonAmoy;
|
|
96
|
-
case _commonsdkbase.BlockchainIncludingTestnet.POLYGON:
|
|
97
|
-
return _chains.polygon;
|
|
98
|
-
case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA:
|
|
99
|
-
return _chains.optimismSepolia;
|
|
100
|
-
case _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM:
|
|
101
|
-
return _chains.optimism;
|
|
102
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA:
|
|
103
|
-
return _chains.arbitrumSepolia;
|
|
104
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM:
|
|
105
|
-
return _chains.arbitrum;
|
|
106
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ARBITRUMNOVA:
|
|
107
|
-
return _chains.arbitrumNova;
|
|
108
|
-
case _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET:
|
|
109
|
-
return _chunk55V4VMTXcjs.storyTestnet;
|
|
110
|
-
case _commonsdkbase.BlockchainIncludingTestnet.STORY:
|
|
111
|
-
return _chunkNIBKCMQ2cjs.story;
|
|
112
|
-
case _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA:
|
|
113
|
-
return _chains.modeTestnet;
|
|
114
|
-
case _commonsdkbase.BlockchainIncludingTestnet.MODE:
|
|
115
|
-
return _chains.mode;
|
|
116
|
-
case _commonsdkbase.BlockchainIncludingTestnet.BSC:
|
|
117
|
-
return _chains.bsc;
|
|
118
|
-
case _commonsdkbase.BlockchainIncludingTestnet.SHAPE:
|
|
119
|
-
return _chains.shape;
|
|
120
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ZORA:
|
|
121
|
-
return _chains.zora;
|
|
122
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA:
|
|
123
|
-
return _chains.zoraSepolia;
|
|
124
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ETHEREUM_SEPOLIA:
|
|
125
|
-
return _chains.sepolia;
|
|
126
|
-
case _commonsdkbase.BlockchainIncludingTestnet.FLOW:
|
|
127
|
-
return _chains.flowMainnet;
|
|
128
|
-
case _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET:
|
|
129
|
-
return _chains.flowTestnet;
|
|
130
|
-
case _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET:
|
|
131
|
-
return _chains.plumeTestnet;
|
|
132
|
-
case _commonsdkbase.BlockchainIncludingTestnet.PLUME:
|
|
133
|
-
return _chains.plume;
|
|
134
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ARC_TESTNET:
|
|
135
|
-
return _chunkHTSQPZHWcjs.arcTestnet;
|
|
136
|
-
case _commonsdkbase.BlockchainIncludingTestnet.TEMPO:
|
|
137
|
-
return _chunk7USEVMTWcjs.tempo;
|
|
138
|
-
case _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET:
|
|
139
|
-
return _chunkF7L2TZ3Icjs.tempoTestnet;
|
|
140
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT:
|
|
141
|
-
case _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET:
|
|
142
|
-
case _commonsdkbase.BlockchainIncludingTestnet.APECHAIN:
|
|
143
|
-
case _commonsdkbase.BlockchainIncludingTestnet.MANTLE:
|
|
144
|
-
case _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA:
|
|
145
|
-
case _commonsdkbase.BlockchainIncludingTestnet.SCROLL:
|
|
146
|
-
case _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA:
|
|
147
|
-
case _commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1:
|
|
148
|
-
case _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET:
|
|
149
|
-
case _commonsdkbase.BlockchainIncludingTestnet.CURTIS:
|
|
150
|
-
case _commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN:
|
|
151
|
-
case _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA:
|
|
152
|
-
throw new Error(
|
|
153
|
-
`Chain ${chain} is not yet supported in toViemChain function. Please add the appropriate viem chain definition.`
|
|
154
|
-
);
|
|
155
|
-
default:
|
|
156
|
-
throw new Error(`Unknown chain: ${chain}`);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function isTestnetChain(chain) {
|
|
160
|
-
return TESTNET_AA_CHAINS.includes(chain);
|
|
161
|
-
}
|
|
162
|
-
function isMainnetChain(chain) {
|
|
163
|
-
return PRODUCTION_AA_CHAINS.includes(chain);
|
|
164
|
-
}
|
|
165
|
-
var MAINNET_TO_TESTNET_MAP = {
|
|
166
|
-
[_commonsdkbase.BlockchainIncludingTestnet.ABSTRACT]: _commonsdkbase.BlockchainIncludingTestnet.ABSTRACT_TESTNET,
|
|
167
|
-
[_commonsdkbase.BlockchainIncludingTestnet.APECHAIN]: _commonsdkbase.BlockchainIncludingTestnet.CURTIS,
|
|
168
|
-
[_commonsdkbase.BlockchainIncludingTestnet.ARBITRUM]: _commonsdkbase.BlockchainIncludingTestnet.ARBITRUM_SEPOLIA,
|
|
169
|
-
[_commonsdkbase.BlockchainIncludingTestnet.BASE]: _commonsdkbase.BlockchainIncludingTestnet.BASE_SEPOLIA,
|
|
170
|
-
[_commonsdkbase.BlockchainIncludingTestnet.FLOW]: _commonsdkbase.BlockchainIncludingTestnet.FLOW_TESTNET,
|
|
171
|
-
[_commonsdkbase.BlockchainIncludingTestnet.MANTLE]: _commonsdkbase.BlockchainIncludingTestnet.MANTLE_SEPOLIA,
|
|
172
|
-
[_commonsdkbase.BlockchainIncludingTestnet.MODE]: _commonsdkbase.BlockchainIncludingTestnet.MODE_SEPOLIA,
|
|
173
|
-
[_commonsdkbase.BlockchainIncludingTestnet.OPTIMISM]: _commonsdkbase.BlockchainIncludingTestnet.OPTIMISM_SEPOLIA,
|
|
174
|
-
[_commonsdkbase.BlockchainIncludingTestnet.PLUME]: _commonsdkbase.BlockchainIncludingTestnet.PLUME_TESTNET,
|
|
175
|
-
[_commonsdkbase.BlockchainIncludingTestnet.POLYGON]: _commonsdkbase.BlockchainIncludingTestnet.POLYGON_AMOY,
|
|
176
|
-
[_commonsdkbase.BlockchainIncludingTestnet.SCROLL]: _commonsdkbase.BlockchainIncludingTestnet.SCROLL_SEPOLIA,
|
|
177
|
-
[_commonsdkbase.BlockchainIncludingTestnet.SEI_PACIFIC_1]: _commonsdkbase.BlockchainIncludingTestnet.SEI_ATLANTIC_2_TESTNET,
|
|
178
|
-
[_commonsdkbase.BlockchainIncludingTestnet.STORY]: _commonsdkbase.BlockchainIncludingTestnet.STORY_TESTNET,
|
|
179
|
-
[_commonsdkbase.BlockchainIncludingTestnet.WORLDCHAIN]: _commonsdkbase.BlockchainIncludingTestnet.WORLD_CHAIN_SEPOLIA,
|
|
180
|
-
[_commonsdkbase.BlockchainIncludingTestnet.ZORA]: _commonsdkbase.BlockchainIncludingTestnet.ZORA_SEPOLIA,
|
|
181
|
-
[_commonsdkbase.BlockchainIncludingTestnet.TEMPO]: _commonsdkbase.BlockchainIncludingTestnet.TEMPO_TESTNET
|
|
182
|
-
};
|
|
183
|
-
function mainnetToTestnet(chain) {
|
|
184
|
-
return MAINNET_TO_TESTNET_MAP[chain];
|
|
185
|
-
}
|
|
186
|
-
function validateChainForEnvironment(chain, environment) {
|
|
187
|
-
if (chain === "solana" || chain === "stellar") {
|
|
188
|
-
return chain;
|
|
189
|
-
}
|
|
190
|
-
const evmChain = chain;
|
|
191
|
-
const isProductionEnv = environment === _commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION;
|
|
192
|
-
if (isProductionEnv && isTestnetChain(evmChain)) {
|
|
193
|
-
throw new (0, _chunkXC2V34TScjs.InvalidEnvironmentError)(
|
|
194
|
-
`Chain "${chain}" is a testnet chain and cannot be used in production. Please use a mainnet chain instead.`
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
if (!isProductionEnv && isMainnetChain(evmChain)) {
|
|
198
|
-
const testnetEquivalent = mainnetToTestnet(evmChain);
|
|
199
|
-
if (testnetEquivalent != null) {
|
|
200
|
-
_chunkJREZWZ2Scjs.walletsLogger.debug("validateChainForEnvironment.autoConverted", {
|
|
201
|
-
chain,
|
|
202
|
-
convertedTo: testnetEquivalent,
|
|
203
|
-
environment,
|
|
204
|
-
message: `Chain "${chain}" is a mainnet chain and cannot be used in ${environment} environment. Automatically converted to "${testnetEquivalent}".`
|
|
205
|
-
});
|
|
206
|
-
return testnetEquivalent;
|
|
207
|
-
}
|
|
208
|
-
_chunkJREZWZ2Scjs.walletsLogger.debug("validateChainForEnvironment.mismatch", {
|
|
209
|
-
chain,
|
|
210
|
-
environment,
|
|
211
|
-
message: `Chain "${chain}" is a mainnet chain and should not be used in ${environment} environment. No testnet equivalent is available. Please use a testnet chain instead.`
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
return chain;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
exports.toViemChain = toViemChain; exports.isTestnetChain = isTestnetChain; exports.isMainnetChain = isMainnetChain; exports.mainnetToTestnet = mainnetToTestnet; exports.validateChainForEnvironment = validateChainForEnvironment;
|
package/dist/chunk-WHTECI7J.cjs
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkZAX22GSIcjs = require('./chunk-ZAX22GSI.cjs');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
|
|
11
|
-
|
|
12
|
-
// src/signers/non-custodial/ncs-evm-signer.ts
|
|
13
|
-
var _ox = require('ox');
|
|
14
|
-
var _viem = require('viem');
|
|
15
|
-
var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends _chunkZAX22GSIcjs.NonCustodialSigner {
|
|
16
|
-
constructor(config) {
|
|
17
|
-
super(config);
|
|
18
|
-
}
|
|
19
|
-
signMessage(message) {
|
|
20
|
-
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
21
|
-
const messageRaw = _viem.isHex.call(void 0, message) ? message : _viem.toHex.call(void 0, message);
|
|
22
|
-
const messageToSign = _ox.PersonalMessage.getSignPayload(messageRaw);
|
|
23
|
-
return yield this.sign(messageToSign);
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
signTransaction(transaction) {
|
|
27
|
-
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
28
|
-
return yield this.sign(transaction);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
sign(raw) {
|
|
32
|
-
return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
|
|
33
|
-
var _a;
|
|
34
|
-
yield this.handleAuthRequired();
|
|
35
|
-
const jwt = this.getJwtOrThrow();
|
|
36
|
-
const hexString = raw.replace("0x", "");
|
|
37
|
-
_chunkJREZWZ2Scjs.walletsLogger.info("sign: sending request", { keyType: "secp256k1" });
|
|
38
|
-
const startTime = Date.now();
|
|
39
|
-
const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
|
|
40
|
-
event: "request:sign",
|
|
41
|
-
responseEvent: "response:sign",
|
|
42
|
-
data: {
|
|
43
|
-
authData: {
|
|
44
|
-
jwt,
|
|
45
|
-
apiKey: this.config.crossmint.apiKey
|
|
46
|
-
},
|
|
47
|
-
data: {
|
|
48
|
-
keyType: "secp256k1",
|
|
49
|
-
bytes: hexString,
|
|
50
|
-
encoding: "hex"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
options: _chunkZAX22GSIcjs.DEFAULT_EVENT_OPTIONS
|
|
54
|
-
});
|
|
55
|
-
_chunkJREZWZ2Scjs.walletsLogger.info("sign: response received", {
|
|
56
|
-
status: res == null ? void 0 : res.status,
|
|
57
|
-
durationMs: Date.now() - startTime
|
|
58
|
-
});
|
|
59
|
-
if ((res == null ? void 0 : res.status) === "error") {
|
|
60
|
-
throw new Error(res.error);
|
|
61
|
-
}
|
|
62
|
-
if ((res == null ? void 0 : res.signature) == null) {
|
|
63
|
-
throw new Error("Failed to sign transaction");
|
|
64
|
-
}
|
|
65
|
-
_EVMNonCustodialSigner.verifyPublicKeyFormat(res.publicKey);
|
|
66
|
-
return { signature: res.signature.bytes };
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
static verifyPublicKeyFormat(publicKey) {
|
|
70
|
-
if (publicKey == null) {
|
|
71
|
-
throw new Error("No public key found");
|
|
72
|
-
}
|
|
73
|
-
if (publicKey.encoding !== "hex" || publicKey.keyType !== "secp256k1" || publicKey.bytes == null) {
|
|
74
|
-
throw new Error(
|
|
75
|
-
"Not supported. Expected public key to be in hex encoding and secp256k1 key type. Got: " + JSON.stringify(publicKey)
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
getChainKeyParams() {
|
|
80
|
-
return {
|
|
81
|
-
scheme: "secp256k1",
|
|
82
|
-
encoding: "hex"
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
exports.EVMNonCustodialSigner = EVMNonCustodialSigner;
|
package/dist/chunk-WJUPOCKJ.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// src/signers/types.ts
|
|
2
|
-
var AuthRejectedError = class extends Error {
|
|
3
|
-
constructor() {
|
|
4
|
-
super("Authentication was rejected by the user");
|
|
5
|
-
this.name = "AuthRejectedError";
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
function isExportableSigner(signer) {
|
|
9
|
-
return signer._exportPrivateKey !== void 0;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
AuthRejectedError,
|
|
14
|
-
isExportableSigner
|
|
15
|
-
};
|
package/dist/chunk-WWW6IGZ7.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Wallet
|
|
3
|
-
} from "./chunk-FHMKNG62.js";
|
|
4
|
-
import {
|
|
5
|
-
SolanaExternalWalletSigner
|
|
6
|
-
} from "./chunk-PIFD6KNH.js";
|
|
7
|
-
import {
|
|
8
|
-
TransactionNotCreatedError
|
|
9
|
-
} from "./chunk-SGINWAB6.js";
|
|
10
|
-
import {
|
|
11
|
-
walletsLogger
|
|
12
|
-
} from "./chunk-ABMZ3ZVN.js";
|
|
13
|
-
import {
|
|
14
|
-
__async,
|
|
15
|
-
__decorateClass
|
|
16
|
-
} from "./chunk-ASE2FXWP.js";
|
|
17
|
-
|
|
18
|
-
// src/wallets/solana.ts
|
|
19
|
-
import bs58 from "bs58";
|
|
20
|
-
import { isValidSolanaAddress, WithLoggerContext } from "@crossmint/common-sdk-base";
|
|
21
|
-
var _SolanaWallet = class _SolanaWallet extends Wallet {
|
|
22
|
-
constructor(wallet) {
|
|
23
|
-
super(
|
|
24
|
-
{
|
|
25
|
-
chain: wallet.chain,
|
|
26
|
-
address: wallet.address,
|
|
27
|
-
owner: wallet.owner,
|
|
28
|
-
signer: wallet.signer,
|
|
29
|
-
options: Wallet.getOptions(wallet),
|
|
30
|
-
alias: wallet.alias
|
|
31
|
-
},
|
|
32
|
-
Wallet.getApiClient(wallet)
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
static from(wallet) {
|
|
36
|
-
if (!isValidSolanaAddress(wallet.address)) {
|
|
37
|
-
throw new Error("Wallet is not a Solana wallet");
|
|
38
|
-
}
|
|
39
|
-
return new _SolanaWallet(wallet);
|
|
40
|
-
}
|
|
41
|
-
sendTransaction(params) {
|
|
42
|
-
return __async(this, null, function* () {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
walletsLogger.info("solanaWallet.sendTransaction.start");
|
|
45
|
-
yield this.preAuthIfNeeded();
|
|
46
|
-
const createdTransaction = yield this.createTransaction(params);
|
|
47
|
-
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
48
|
-
walletsLogger.info("solanaWallet.sendTransaction.prepared", {
|
|
49
|
-
transactionId: createdTransaction.id
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
hash: void 0,
|
|
53
|
-
explorerLink: void 0,
|
|
54
|
-
transactionId: createdTransaction.id
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
const _additionalSigners = (_b = params.additionalSigners) == null ? void 0 : _b.map(
|
|
58
|
-
(signer) => new SolanaExternalWalletSigner({
|
|
59
|
-
type: "external-wallet",
|
|
60
|
-
address: signer.publicKey.toString(),
|
|
61
|
-
locator: `external-wallet:${signer.publicKey.toString()}`,
|
|
62
|
-
onSignTransaction: (transaction) => {
|
|
63
|
-
transaction.sign([signer]);
|
|
64
|
-
return Promise.resolve(transaction);
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
);
|
|
68
|
-
const options = {
|
|
69
|
-
additionalSigners: _additionalSigners
|
|
70
|
-
};
|
|
71
|
-
const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
|
|
72
|
-
walletsLogger.info("solanaWallet.sendTransaction.success", {
|
|
73
|
-
transactionId: createdTransaction.id,
|
|
74
|
-
hash: result.hash
|
|
75
|
-
});
|
|
76
|
-
return result;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
createTransaction(params) {
|
|
80
|
-
return __async(this, null, function* () {
|
|
81
|
-
var _a, _b;
|
|
82
|
-
const signer = (_b = (_a = params.options) == null ? void 0 : _a.experimental_signer) != null ? _b : this.signer.locator();
|
|
83
|
-
let serializedTransaction;
|
|
84
|
-
if ("serializedTransaction" in params) {
|
|
85
|
-
serializedTransaction = params.serializedTransaction;
|
|
86
|
-
} else {
|
|
87
|
-
serializedTransaction = bs58.encode(params.transaction.serialize());
|
|
88
|
-
}
|
|
89
|
-
const transactionCreationResponse = yield this.apiClient.createTransaction(this.walletLocator, {
|
|
90
|
-
params: {
|
|
91
|
-
transaction: serializedTransaction,
|
|
92
|
-
signer
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
if ("error" in transactionCreationResponse) {
|
|
96
|
-
throw new TransactionNotCreatedError(JSON.stringify(transactionCreationResponse));
|
|
97
|
-
}
|
|
98
|
-
return transactionCreationResponse;
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
__decorateClass([
|
|
103
|
-
WithLoggerContext({
|
|
104
|
-
logger: walletsLogger,
|
|
105
|
-
methodName: "solanaWallet.sendTransaction",
|
|
106
|
-
buildContext(thisArg) {
|
|
107
|
-
return { chain: thisArg.chain, address: thisArg.address };
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
], _SolanaWallet.prototype, "sendTransaction", 1);
|
|
111
|
-
var SolanaWallet = _SolanaWallet;
|
|
112
|
-
|
|
113
|
-
export {
|
|
114
|
-
SolanaWallet
|
|
115
|
-
};
|