@crossmint/wallets-sdk 0.18.2 → 0.18.4
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 +9 -1
- package/dist/api/client.d.cts +4 -4
- package/dist/api/client.d.ts +4 -4
- package/dist/api/client.js +9 -1
- package/dist/api/gen/client.gen.cjs +7 -1
- package/dist/api/gen/client.gen.js +7 -1
- package/dist/api/gen/index.cjs +179 -1
- package/dist/api/gen/index.js +179 -1
- package/dist/api/gen/sdk.gen.cjs +178 -1
- package/dist/api/gen/sdk.gen.js +178 -1
- package/dist/api/gen/types.gen.js +1 -1
- package/dist/api/index.cjs +11 -1
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js +11 -1
- package/dist/api/types.d.cts +4 -2
- package/dist/api/types.d.ts +4 -2
- package/dist/api/types.js +1 -1
- package/dist/chains/chains.cjs +9 -1
- package/dist/chains/chains.js +9 -1
- package/dist/chains/definitions/story.cjs +7 -1
- package/dist/chains/definitions/story.js +7 -1
- package/dist/chains/definitions/storyTestnet.cjs +7 -1
- package/dist/chains/definitions/storyTestnet.js +7 -1
- package/dist/chunk-2DHIAP2S.js +58 -0
- package/dist/chunk-2T5HHKUI.js +19 -0
- package/dist/chunk-2VOEAAFA.cjs +200 -0
- package/dist/chunk-3U6UAYOV.js +25 -0
- package/dist/chunk-4BMNDPJ4.cjs +92 -0
- package/dist/chunk-4QGBVHV3.js +629 -0
- package/dist/chunk-55V4VMTX.cjs +25 -0
- package/dist/chunk-5H5YHSCK.js +200 -0
- package/dist/chunk-7ECQJFYM.cjs +63 -0
- package/dist/chunk-7GHQBCRV.cjs +57 -0
- package/dist/chunk-7JFVG4IY.js +59 -0
- package/dist/chunk-7QL5JVK4.js +262 -0
- package/dist/chunk-AJCWEEWH.js +73 -0
- package/dist/chunk-AL77JANE.js +36 -0
- package/dist/chunk-BAHU3KZE.cjs +75 -0
- package/dist/chunk-BAULM7A2.js +289 -0
- package/dist/chunk-BFAU2NL6.js +175 -0
- package/dist/chunk-BSC55MYK.cjs +43 -0
- package/dist/chunk-CHGPNMRL.cjs +36 -0
- package/dist/chunk-CN2GVFBU.cjs +138 -0
- package/dist/chunk-COVOGZ4S.js +80 -0
- package/dist/chunk-DPERJZBG.js +63 -0
- package/dist/chunk-DQCXGBZM.js +59 -0
- package/dist/chunk-E4LJ7252.cjs +289 -0
- package/dist/chunk-EM6H7EUU.cjs +80 -0
- package/dist/chunk-EYJQSDDI.js +43 -0
- package/dist/chunk-FAGFW4AR.js +16 -0
- package/dist/chunk-FK23BDCU.js +87 -0
- package/dist/chunk-FPMW7Q5O.js +55 -0
- package/dist/chunk-G5NYLGM5.cjs +55 -0
- package/dist/chunk-HHDDI3CS.js +75 -0
- package/dist/chunk-HNRM45KF.cjs +87 -0
- package/dist/chunk-JICSSJOK.js +57 -0
- package/dist/chunk-KS63YEQ4.js +138 -0
- package/dist/chunk-KT3CVXFG.js +9 -0
- package/dist/chunk-LLFD22UQ.cjs +36 -0
- package/dist/chunk-MPGPBFUZ.cjs +16 -0
- package/dist/chunk-MYKPHXUR.cjs +629 -0
- package/dist/chunk-MZBFXUHT.js +63 -0
- package/dist/chunk-NIBKCMQ2.cjs +19 -0
- package/dist/chunk-OD5RGQ4Z.js +92 -0
- package/dist/chunk-PSPNZEG4.cjs +175 -0
- package/dist/chunk-R2OY54EJ.cjs +59 -0
- package/dist/chunk-RHR6P2KP.cjs +15 -0
- package/dist/chunk-RSPJPRQW.cjs +262 -0
- package/dist/chunk-RTRDZB52.js +778 -0
- package/dist/chunk-SG7WIZLK.cjs +63 -0
- package/dist/chunk-SGINWAB6.js +155 -0
- package/dist/chunk-TK3EUCQ4.cjs +59 -0
- package/dist/chunk-V3QJQUT7.cjs +778 -0
- package/dist/chunk-WC7T2CR4.js +44 -0
- package/dist/chunk-WJUPOCKJ.js +15 -0
- package/dist/chunk-XC2V34TS.cjs +155 -0
- package/dist/chunk-XH3ARVJG.cjs +58 -0
- package/dist/chunk-YBA7WO32.cjs +44 -0
- package/dist/chunk-YOJETSLN.cjs +73 -0
- package/dist/chunk-ZT7EGOCI.cjs +9 -0
- package/dist/chunk-ZTGRDOOH.js +36 -0
- package/dist/index.cjs +55 -1
- package/dist/index.js +55 -1
- package/dist/sdk.cjs +31 -1
- package/dist/sdk.js +31 -1
- package/dist/signers/evm-api-key.cjs +7 -1
- package/dist/signers/evm-api-key.js +7 -1
- package/dist/signers/evm-external-wallet.cjs +7 -1
- package/dist/signers/evm-external-wallet.js +7 -1
- package/dist/signers/index.cjs +21 -1
- package/dist/signers/index.js +21 -1
- package/dist/signers/non-custodial/index.cjs +24 -1
- package/dist/signers/non-custodial/index.js +24 -1
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +10 -1
- package/dist/signers/non-custodial/ncs-evm-signer.js +10 -1
- package/dist/signers/non-custodial/ncs-iframe-manager.cjs +7 -1
- package/dist/signers/non-custodial/ncs-iframe-manager.js +7 -1
- package/dist/signers/non-custodial/ncs-signer.cjs +11 -1
- package/dist/signers/non-custodial/ncs-signer.js +11 -1
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +10 -1
- package/dist/signers/non-custodial/ncs-solana-signer.js +10 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +10 -1
- package/dist/signers/non-custodial/ncs-stellar-signer.js +10 -1
- package/dist/signers/passkey.cjs +7 -1
- package/dist/signers/passkey.js +7 -1
- package/dist/signers/solana-api-key.cjs +7 -1
- package/dist/signers/solana-api-key.js +7 -1
- package/dist/signers/solana-external-wallet.cjs +8 -1
- package/dist/signers/solana-external-wallet.js +8 -1
- package/dist/signers/stellar-external-wallet.cjs +7 -1
- package/dist/signers/stellar-external-wallet.js +7 -1
- package/dist/signers/types.cjs +9 -1
- package/dist/signers/types.js +9 -1
- package/dist/utils/constants.cjs +13 -1
- package/dist/utils/constants.js +13 -1
- package/dist/utils/errors.cjs +55 -1
- package/dist/utils/errors.js +55 -1
- package/dist/utils/signer-validation.cjs +8 -1
- package/dist/utils/signer-validation.js +8 -1
- package/dist/wallets/evm.cjs +20 -1
- package/dist/wallets/evm.js +20 -1
- package/dist/wallets/solana.cjs +18 -1
- package/dist/wallets/solana.js +18 -1
- package/dist/wallets/stellar.cjs +17 -1
- package/dist/wallets/stellar.js +17 -1
- package/dist/wallets/wallet-factory.cjs +25 -1
- package/dist/wallets/wallet-factory.js +25 -1
- package/dist/wallets/wallet.cjs +16 -1
- package/dist/wallets/wallet.d.cts +12 -1
- package/dist/wallets/wallet.d.ts +12 -1
- package/dist/wallets/wallet.js +16 -1
- package/package.json +4 -4
- package/dist/chunk-23ZHV3VD.js +0 -1
- package/dist/chunk-2SHDBC47.js +0 -1
- package/dist/chunk-2XVV7Z43.cjs +0 -1
- package/dist/chunk-2YH3NVVK.cjs +0 -1
- package/dist/chunk-3APSOOE3.js +0 -1
- package/dist/chunk-3IZNWAZE.cjs +0 -1
- package/dist/chunk-4AJT6I6Q.js +0 -1
- package/dist/chunk-4KXOWU5E.cjs +0 -1
- package/dist/chunk-5M7IRODB.js +0 -1
- package/dist/chunk-5QIW67NU.cjs +0 -1
- package/dist/chunk-6PVKL5RC.js +0 -1
- package/dist/chunk-73RCBQG5.js +0 -1
- package/dist/chunk-7JIPYRKX.js +0 -1
- package/dist/chunk-7WKKOG6H.cjs +0 -3
- package/dist/chunk-BQZES4ST.js +0 -1
- package/dist/chunk-BW7YYVZE.js +0 -1
- package/dist/chunk-C3T63EC7.cjs +0 -1
- package/dist/chunk-CVZ3RNWV.cjs +0 -1
- package/dist/chunk-GEY574TH.cjs +0 -1
- package/dist/chunk-H4T4IXCF.js +0 -1
- package/dist/chunk-HJ5EDMTA.js +0 -1
- package/dist/chunk-HMPMFEPS.cjs +0 -1
- package/dist/chunk-HPHVJ6BA.cjs +0 -1
- package/dist/chunk-HRSVFJND.cjs +0 -1
- package/dist/chunk-IGBQEAD5.js +0 -1
- package/dist/chunk-IR5WN6FQ.cjs +0 -1
- package/dist/chunk-JUSY5XEE.js +0 -1
- package/dist/chunk-KHSWQE6W.js +0 -1
- package/dist/chunk-KKQBZXFE.js +0 -1
- package/dist/chunk-KO6QYKDX.cjs +0 -1
- package/dist/chunk-KRV3IXJU.cjs +0 -1
- package/dist/chunk-L5L64FWM.js +0 -1
- package/dist/chunk-LW6JSI4J.js +0 -1
- package/dist/chunk-M4TOGGLV.cjs +0 -1
- package/dist/chunk-MQP5VZCA.cjs +0 -1
- package/dist/chunk-NEJPPLYW.cjs +0 -1
- package/dist/chunk-NIKULSJK.cjs +0 -1
- package/dist/chunk-NT4EICOB.cjs +0 -1
- package/dist/chunk-O4FVTK7X.cjs +0 -1
- package/dist/chunk-P6JJHAAV.js +0 -1
- package/dist/chunk-PONCGT2H.cjs +0 -1
- package/dist/chunk-PSXRNSOE.js +0 -1
- package/dist/chunk-R6VFNNAA.js +0 -3
- package/dist/chunk-RJZV72YF.js +0 -1
- package/dist/chunk-S3DYQVRD.js +0 -1
- package/dist/chunk-SHVVA55W.js +0 -1
- package/dist/chunk-STYSP6KL.cjs +0 -1
- package/dist/chunk-UBOWSXW3.js +0 -1
- package/dist/chunk-UNBXKCNN.js +0 -1
- package/dist/chunk-VXFSSEA4.js +0 -1
- package/dist/chunk-VY634F3J.js +0 -1
- package/dist/chunk-WQP2FSVI.js +0 -1
- package/dist/chunk-WYYAPI4G.cjs +0 -1
- package/dist/chunk-WZFHEUWT.cjs +0 -1
- package/dist/chunk-XALFCQKD.cjs +0 -1
- package/dist/chunk-XIRT2EZN.cjs +0 -1
- package/dist/chunk-YWPTI2QO.cjs +0 -1
- package/dist/chunk-YZ4HRYSL.cjs +0 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkMPGPBFUZcjs = require('./chunk-MPGPBFUZ.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
11
|
+
|
|
12
|
+
// src/api/client.ts
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
18
|
+
var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
|
|
19
|
+
constructor(crossmint) {
|
|
20
|
+
super(crossmint, {
|
|
21
|
+
internalConfig: {
|
|
22
|
+
sdkMetadata: { name: _chunkMPGPBFUZcjs.SDK_NAME, version: _chunkMPGPBFUZcjs.SDK_VERSION }
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
this.apiPrefix = "api/2025-06-09/wallets";
|
|
26
|
+
this.legacyApiPrefix = "api/2022-06-09/wallets";
|
|
27
|
+
}
|
|
28
|
+
createWallet(params) {
|
|
29
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
30
|
+
const path = this.isServerSide ? `${this.apiPrefix}` : `${this.apiPrefix}/me`;
|
|
31
|
+
const response = yield this.post(path, {
|
|
32
|
+
body: JSON.stringify(params),
|
|
33
|
+
headers: this.headers
|
|
34
|
+
});
|
|
35
|
+
return response.json();
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
getWallet(locator) {
|
|
39
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
40
|
+
const response = yield this.get(`${this.apiPrefix}/${locator}`, {
|
|
41
|
+
headers: this.headers
|
|
42
|
+
});
|
|
43
|
+
return response.json();
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
createTransaction(walletLocator, params) {
|
|
47
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
48
|
+
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/transactions`, {
|
|
49
|
+
body: JSON.stringify(params),
|
|
50
|
+
headers: this.headers
|
|
51
|
+
});
|
|
52
|
+
return response.json();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
approveTransaction(walletLocator, transactionId, params) {
|
|
56
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
57
|
+
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/transactions/${transactionId}/approvals`, {
|
|
58
|
+
body: JSON.stringify(params),
|
|
59
|
+
headers: this.headers
|
|
60
|
+
});
|
|
61
|
+
return response.json();
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getTransaction(walletLocator, transactionId) {
|
|
65
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
66
|
+
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/transactions/${transactionId}`, {
|
|
67
|
+
headers: this.headers
|
|
68
|
+
});
|
|
69
|
+
return response.json();
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
createSignature(walletLocator, params) {
|
|
73
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
74
|
+
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/signatures`, {
|
|
75
|
+
body: JSON.stringify(params),
|
|
76
|
+
headers: this.headers
|
|
77
|
+
});
|
|
78
|
+
return response.json();
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
approveSignature(walletLocator, signatureId, params) {
|
|
82
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
83
|
+
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/signatures/${signatureId}/approvals`, {
|
|
84
|
+
body: JSON.stringify(params),
|
|
85
|
+
headers: this.headers
|
|
86
|
+
});
|
|
87
|
+
return response.json();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
getSignature(walletLocator, signatureId) {
|
|
91
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
92
|
+
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/signatures/${signatureId}`, {
|
|
93
|
+
headers: this.headers
|
|
94
|
+
});
|
|
95
|
+
return response.json();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
getTransactions(walletLocator) {
|
|
99
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
100
|
+
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/transactions`, {
|
|
101
|
+
headers: this.headers
|
|
102
|
+
});
|
|
103
|
+
return response.json();
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
experimental_getNfts(params) {
|
|
107
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
108
|
+
const queryParams = new URLSearchParams();
|
|
109
|
+
queryParams.append("page", params.page.toString());
|
|
110
|
+
queryParams.append("perPage", params.perPage.toString());
|
|
111
|
+
const identifier = `${params.chain}:${params.address}`;
|
|
112
|
+
const response = yield this.get(`${this.apiPrefix}/${identifier}/nfts?${queryParams.toString()}`, {
|
|
113
|
+
headers: this.headers
|
|
114
|
+
});
|
|
115
|
+
return response.json();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
experimental_activity(walletLocator, params) {
|
|
119
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
120
|
+
let legacyLocator = walletLocator;
|
|
121
|
+
if (!this.isServerSide) {
|
|
122
|
+
legacyLocator = `me:${params.chain === "solana" ? "solana-smart-wallet" : "evm-smart-wallet"}`;
|
|
123
|
+
}
|
|
124
|
+
const queryParams = new URLSearchParams();
|
|
125
|
+
queryParams.append("chain", params.chain.toString());
|
|
126
|
+
const response = yield this.get(`${this.legacyApiPrefix}/${legacyLocator}/activity?${queryParams.toString()}`, {
|
|
127
|
+
headers: this.headers
|
|
128
|
+
});
|
|
129
|
+
return response.json();
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
getBalance(walletLocator, params) {
|
|
133
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
134
|
+
const queryParams = new URLSearchParams();
|
|
135
|
+
queryParams.append("tokens", params.tokens.join(","));
|
|
136
|
+
queryParams.append("chains", params.chains.join(","));
|
|
137
|
+
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/balances?${queryParams.toString()}`, {
|
|
138
|
+
headers: this.headers
|
|
139
|
+
});
|
|
140
|
+
return response.json();
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
fundWallet(walletLocator, params) {
|
|
144
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
145
|
+
if (this.environment === _commonsdkbase.APIKeyEnvironmentPrefix.PRODUCTION) {
|
|
146
|
+
throw new Error("Funding wallets is only supported in staging environment");
|
|
147
|
+
}
|
|
148
|
+
const response = yield this.post(`api/v1-alpha2/wallets/${walletLocator}/balances`, {
|
|
149
|
+
body: JSON.stringify(params),
|
|
150
|
+
headers: this.headers
|
|
151
|
+
});
|
|
152
|
+
return response.json();
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
registerSigner(walletLocator, params) {
|
|
156
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
157
|
+
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/signers`, {
|
|
158
|
+
body: JSON.stringify(params),
|
|
159
|
+
headers: this.headers
|
|
160
|
+
});
|
|
161
|
+
return response.json();
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
getSigner(walletLocator, signer) {
|
|
165
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
166
|
+
const response = yield this.get(`${this.apiPrefix}/${walletLocator}/signers/${signer}`, {
|
|
167
|
+
headers: this.headers
|
|
168
|
+
});
|
|
169
|
+
return response.json();
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
send(walletLocator, tokenLocator, params) {
|
|
173
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
174
|
+
const response = yield this.post(`${this.apiPrefix}/${walletLocator}/tokens/${tokenLocator}/transfers`, {
|
|
175
|
+
body: JSON.stringify(params),
|
|
176
|
+
headers: this.headers
|
|
177
|
+
});
|
|
178
|
+
return response.json();
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
get isServerSide() {
|
|
182
|
+
return this.parsedAPIKey.usageOrigin === _commonsdkbase.APIKeyUsageOrigin.SERVER;
|
|
183
|
+
}
|
|
184
|
+
get environment() {
|
|
185
|
+
if (!this.parsedAPIKey.isValid) {
|
|
186
|
+
throw new (0, _chunkXC2V34TScjs.InvalidApiKeyError)("Invalid API key");
|
|
187
|
+
}
|
|
188
|
+
return this.parsedAPIKey.environment;
|
|
189
|
+
}
|
|
190
|
+
get headers() {
|
|
191
|
+
const headers = {
|
|
192
|
+
"Content-Type": "application/json"
|
|
193
|
+
};
|
|
194
|
+
return headers;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
exports.ApiClient = ApiClient;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// src/chains/definitions/storyTestnet.ts
|
|
2
|
+
import { defineChain } from "viem";
|
|
3
|
+
var storyTestnet = defineChain({
|
|
4
|
+
id: 1513,
|
|
5
|
+
name: "Story Testnet",
|
|
6
|
+
nativeCurrency: {
|
|
7
|
+
decimals: 18,
|
|
8
|
+
name: "IP",
|
|
9
|
+
symbol: "IP"
|
|
10
|
+
},
|
|
11
|
+
rpcUrls: {
|
|
12
|
+
default: { http: ["https://testnet.storyrpc.io"] }
|
|
13
|
+
},
|
|
14
|
+
blockExplorers: {
|
|
15
|
+
default: {
|
|
16
|
+
name: "Story Testnet Explorer",
|
|
17
|
+
url: "https://testnet.storyscan.xyz"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
testnet: true
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
storyTestnet
|
|
25
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
+
|
|
3
|
+
var _chunkMYKPHXURcjs = require('./chunk-MYKPHXUR.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkR2OY54EJcjs = require('./chunk-R2OY54EJ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkG5NYLGM5cjs = require('./chunk-G5NYLGM5.cjs');
|
|
13
|
+
|
|
14
|
+
// src/wallets/solana.ts
|
|
15
|
+
var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
|
|
16
|
+
var _commonsdkbase = require('@crossmint/common-sdk-base');
|
|
17
|
+
var SolanaWallet = class _SolanaWallet extends _chunkMYKPHXURcjs.Wallet {
|
|
18
|
+
constructor(wallet) {
|
|
19
|
+
super(
|
|
20
|
+
{
|
|
21
|
+
chain: wallet.chain,
|
|
22
|
+
address: wallet.address,
|
|
23
|
+
owner: wallet.owner,
|
|
24
|
+
signer: wallet.signer,
|
|
25
|
+
options: _chunkMYKPHXURcjs.Wallet.getOptions(wallet),
|
|
26
|
+
alias: wallet.alias
|
|
27
|
+
},
|
|
28
|
+
_chunkMYKPHXURcjs.Wallet.getApiClient(wallet)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
static from(wallet) {
|
|
32
|
+
if (!_commonsdkbase.isValidSolanaAddress.call(void 0, wallet.address)) {
|
|
33
|
+
throw new Error("Wallet is not a Solana wallet");
|
|
34
|
+
}
|
|
35
|
+
return new _SolanaWallet(wallet);
|
|
36
|
+
}
|
|
37
|
+
sendTransaction(params) {
|
|
38
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
yield this.preAuthIfNeeded();
|
|
41
|
+
const createdTransaction = yield this.createTransaction(params);
|
|
42
|
+
if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
|
|
43
|
+
return {
|
|
44
|
+
hash: void 0,
|
|
45
|
+
explorerLink: void 0,
|
|
46
|
+
transactionId: createdTransaction.id
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const _additionalSigners = (_b = params.additionalSigners) == null ? void 0 : _b.map(
|
|
50
|
+
(signer) => new (0, _chunkR2OY54EJcjs.SolanaExternalWalletSigner)({
|
|
51
|
+
type: "external-wallet",
|
|
52
|
+
address: signer.publicKey.toString(),
|
|
53
|
+
locator: `external-wallet:${signer.publicKey.toString()}`,
|
|
54
|
+
onSignTransaction: (transaction) => {
|
|
55
|
+
transaction.sign([signer]);
|
|
56
|
+
return Promise.resolve(transaction);
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
const options = {
|
|
61
|
+
additionalSigners: _additionalSigners
|
|
62
|
+
};
|
|
63
|
+
return yield this.approveTransactionAndWait(createdTransaction.id, options);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
createTransaction(params) {
|
|
67
|
+
return _chunkG5NYLGM5cjs.__async.call(void 0, this, null, function* () {
|
|
68
|
+
var _a, _b;
|
|
69
|
+
const signer = (_b = (_a = params.options) == null ? void 0 : _a.experimental_signer) != null ? _b : this.signer.locator();
|
|
70
|
+
let serializedTransaction;
|
|
71
|
+
if ("serializedTransaction" in params) {
|
|
72
|
+
serializedTransaction = params.serializedTransaction;
|
|
73
|
+
} else {
|
|
74
|
+
serializedTransaction = _bs582.default.encode(params.transaction.serialize());
|
|
75
|
+
}
|
|
76
|
+
const transactionCreationResponse = yield this.apiClient.createTransaction(this.walletLocator, {
|
|
77
|
+
params: {
|
|
78
|
+
transaction: serializedTransaction,
|
|
79
|
+
signer
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if ("error" in transactionCreationResponse) {
|
|
83
|
+
throw new (0, _chunkXC2V34TScjs.TransactionNotCreatedError)(JSON.stringify(transactionCreationResponse));
|
|
84
|
+
}
|
|
85
|
+
return transactionCreationResponse;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
exports.SolanaWallet = SolanaWallet;
|