@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.
Files changed (257) hide show
  1. package/package.json +1 -1
  2. package/LICENSE +0 -201
  3. package/README.md +0 -96
  4. package/dist/api/__tests__/constants.cjs +0 -31
  5. package/dist/api/__tests__/constants.d.cts +0 -96
  6. package/dist/api/__tests__/constants.d.ts +0 -96
  7. package/dist/api/__tests__/constants.js +0 -31
  8. package/dist/api/__tests__/test-utils.cjs +0 -372
  9. package/dist/api/__tests__/test-utils.d.cts +0 -99
  10. package/dist/api/__tests__/test-utils.d.ts +0 -99
  11. package/dist/api/__tests__/test-utils.js +0 -372
  12. package/dist/api/client.cjs +0 -10
  13. package/dist/api/client.d.cts +0 -42
  14. package/dist/api/client.d.ts +0 -42
  15. package/dist/api/client.js +0 -10
  16. package/dist/api/gen/client.gen.cjs +0 -7
  17. package/dist/api/gen/client.gen.d.cts +0 -16
  18. package/dist/api/gen/client.gen.d.ts +0 -16
  19. package/dist/api/gen/client.gen.js +0 -7
  20. package/dist/api/gen/index.cjs +0 -179
  21. package/dist/api/gen/index.d.cts +0 -3
  22. package/dist/api/gen/index.d.ts +0 -3
  23. package/dist/api/gen/index.js +0 -179
  24. package/dist/api/gen/sdk.gen.cjs +0 -178
  25. package/dist/api/gen/sdk.gen.d.cts +0 -611
  26. package/dist/api/gen/sdk.gen.d.ts +0 -611
  27. package/dist/api/gen/sdk.gen.js +0 -178
  28. package/dist/api/gen/types.gen.cjs +0 -1
  29. package/dist/api/gen/types.gen.d.cts +0 -13865
  30. package/dist/api/gen/types.gen.d.ts +0 -13865
  31. package/dist/api/gen/types.gen.js +0 -1
  32. package/dist/api/index.cjs +0 -12
  33. package/dist/api/index.d.cts +0 -6
  34. package/dist/api/index.d.ts +0 -6
  35. package/dist/api/index.js +0 -12
  36. package/dist/api/types.cjs +0 -1
  37. package/dist/api/types.d.cts +0 -55
  38. package/dist/api/types.d.ts +0 -55
  39. package/dist/api/types.js +0 -1
  40. package/dist/chains/chains.cjs +0 -24
  41. package/dist/chains/chains.d.cts +0 -28
  42. package/dist/chains/chains.d.ts +0 -28
  43. package/dist/chains/chains.js +0 -24
  44. package/dist/chains/definitions/arcTestnet.cjs +0 -7
  45. package/dist/chains/definitions/arcTestnet.d.cts +0 -43
  46. package/dist/chains/definitions/arcTestnet.d.ts +0 -43
  47. package/dist/chains/definitions/arcTestnet.js +0 -7
  48. package/dist/chains/definitions/story.cjs +0 -7
  49. package/dist/chains/definitions/story.d.cts +0 -49
  50. package/dist/chains/definitions/story.d.ts +0 -49
  51. package/dist/chains/definitions/story.js +0 -7
  52. package/dist/chains/definitions/storyTestnet.cjs +0 -7
  53. package/dist/chains/definitions/storyTestnet.d.cts +0 -43
  54. package/dist/chains/definitions/storyTestnet.d.ts +0 -43
  55. package/dist/chains/definitions/storyTestnet.js +0 -7
  56. package/dist/chains/definitions/tempo.cjs +0 -7
  57. package/dist/chains/definitions/tempo.d.cts +0 -39
  58. package/dist/chains/definitions/tempo.d.ts +0 -39
  59. package/dist/chains/definitions/tempo.js +0 -7
  60. package/dist/chains/definitions/tempoTestnet.cjs +0 -7
  61. package/dist/chains/definitions/tempoTestnet.d.cts +0 -39
  62. package/dist/chains/definitions/tempoTestnet.d.ts +0 -39
  63. package/dist/chains/definitions/tempoTestnet.js +0 -7
  64. package/dist/chunk-2I2OFGNL.js +0 -36
  65. package/dist/chunk-2T5HHKUI.js +0 -19
  66. package/dist/chunk-2WBSPOWU.js +0 -223
  67. package/dist/chunk-3U6UAYOV.js +0 -25
  68. package/dist/chunk-455NK5LB.js +0 -0
  69. package/dist/chunk-47R3UV3J.cjs +0 -58
  70. package/dist/chunk-47WKYTRN.js +0 -63
  71. package/dist/chunk-4GFSUI2I.cjs +0 -66
  72. package/dist/chunk-55V4VMTX.cjs +0 -25
  73. package/dist/chunk-5IFDVB4Y.js +0 -0
  74. package/dist/chunk-66UY53KP.cjs +0 -336
  75. package/dist/chunk-6FG5QXII.cjs +0 -110
  76. package/dist/chunk-6HXIZLEQ.cjs +0 -1
  77. package/dist/chunk-6UMJYMAY.js +0 -82
  78. package/dist/chunk-7GOUUPS4.js +0 -36
  79. package/dist/chunk-7TT3VUDF.cjs +0 -84
  80. package/dist/chunk-7USEVMTW.cjs +0 -21
  81. package/dist/chunk-A6E67ZZP.js +0 -237
  82. package/dist/chunk-ABMZ3ZVN.js +0 -52
  83. package/dist/chunk-ASE2FXWP.js +0 -65
  84. package/dist/chunk-BMMZIPXT.js +0 -778
  85. package/dist/chunk-CCIGWTAO.cjs +0 -1
  86. package/dist/chunk-CMBFV325.js +0 -69
  87. package/dist/chunk-COR3CNRW.cjs +0 -778
  88. package/dist/chunk-ECAM5KTH.cjs +0 -1
  89. package/dist/chunk-F7L2TZ3I.cjs +0 -21
  90. package/dist/chunk-FHMKNG62.js +0 -741
  91. package/dist/chunk-FICVKSXZ.js +0 -84
  92. package/dist/chunk-FOOISYCJ.js +0 -66
  93. package/dist/chunk-G6QJHFSY.cjs +0 -74
  94. package/dist/chunk-HTSQPZHW.cjs +0 -25
  95. package/dist/chunk-HXJ3YPAN.js +0 -110
  96. package/dist/chunk-IDKGJO2G.cjs +0 -115
  97. package/dist/chunk-IOMKHF6R.cjs +0 -44
  98. package/dist/chunk-IPO25BCU.js +0 -43
  99. package/dist/chunk-JREZWZ2S.cjs +0 -52
  100. package/dist/chunk-JSWTGW46.cjs +0 -36
  101. package/dist/chunk-JWMQALLN.js +0 -21
  102. package/dist/chunk-KBJA7JDT.js +0 -0
  103. package/dist/chunk-KQH5ZXJ4.js +0 -336
  104. package/dist/chunk-KT3CVXFG.js +0 -9
  105. package/dist/chunk-MMISP35W.js +0 -21
  106. package/dist/chunk-MRZXYVQO.cjs +0 -82
  107. package/dist/chunk-NIBKCMQ2.cjs +0 -19
  108. package/dist/chunk-PIFD6KNH.js +0 -59
  109. package/dist/chunk-PJOJIRTY.js +0 -74
  110. package/dist/chunk-PK7J3Y3L.js +0 -44
  111. package/dist/chunk-PM7BGATN.cjs +0 -237
  112. package/dist/chunk-PO6S7UR3.cjs +0 -1
  113. package/dist/chunk-POG76HDD.cjs +0 -741
  114. package/dist/chunk-PUO4QNXH.js +0 -89
  115. package/dist/chunk-Q5KNPVYI.cjs +0 -59
  116. package/dist/chunk-R4AW5ADG.cjs +0 -16
  117. package/dist/chunk-R6DH4V7S.cjs +0 -69
  118. package/dist/chunk-RBHGZDDX.cjs +0 -58
  119. package/dist/chunk-RHR6P2KP.cjs +0 -15
  120. package/dist/chunk-RYQI3RXL.cjs +0 -247
  121. package/dist/chunk-SGINWAB6.js +0 -155
  122. package/dist/chunk-T2XUADHW.js +0 -58
  123. package/dist/chunk-TYQ4YIP7.js +0 -16
  124. package/dist/chunk-U3NV7UY7.js +0 -323
  125. package/dist/chunk-UO2J2ZB2.cjs +0 -65
  126. package/dist/chunk-W7K5E64Q.js +0 -247
  127. package/dist/chunk-WDZY4PP4.cjs +0 -223
  128. package/dist/chunk-WHTECI7J.cjs +0 -89
  129. package/dist/chunk-WJUPOCKJ.js +0 -15
  130. package/dist/chunk-WWW6IGZ7.js +0 -115
  131. package/dist/chunk-XC2V34TS.cjs +0 -155
  132. package/dist/chunk-XOCC3MPK.cjs +0 -36
  133. package/dist/chunk-XPMCPXI3.cjs +0 -1
  134. package/dist/chunk-YDZRBHS3.js +0 -0
  135. package/dist/chunk-YMRXMNME.js +0 -0
  136. package/dist/chunk-ZAX22GSI.cjs +0 -323
  137. package/dist/chunk-ZBLW42YE.js +0 -25
  138. package/dist/chunk-ZNAGDENG.cjs +0 -43
  139. package/dist/chunk-ZP4ZZCIE.js +0 -58
  140. package/dist/chunk-ZT7EGOCI.cjs +0 -9
  141. package/dist/chunk-ZTEMOYS2.cjs +0 -63
  142. package/dist/index.cjs +0 -60
  143. package/dist/index.d.cts +0 -19
  144. package/dist/index.d.ts +0 -19
  145. package/dist/index.js +0 -60
  146. package/dist/logger/index.cjs +0 -11
  147. package/dist/logger/index.d.cts +0 -2
  148. package/dist/logger/index.d.ts +0 -2
  149. package/dist/logger/index.js +0 -11
  150. package/dist/logger/init.cjs +0 -10
  151. package/dist/logger/init.d.cts +0 -15
  152. package/dist/logger/init.d.ts +0 -15
  153. package/dist/logger/init.js +0 -10
  154. package/dist/sdk.cjs +0 -39
  155. package/dist/sdk.d.cts +0 -48
  156. package/dist/sdk.d.ts +0 -48
  157. package/dist/sdk.js +0 -39
  158. package/dist/signers/evm-api-key.cjs +0 -7
  159. package/dist/signers/evm-api-key.d.cts +0 -18
  160. package/dist/signers/evm-api-key.d.ts +0 -18
  161. package/dist/signers/evm-api-key.js +0 -7
  162. package/dist/signers/evm-external-wallet.cjs +0 -7
  163. package/dist/signers/evm-external-wallet.d.cts +0 -26
  164. package/dist/signers/evm-external-wallet.d.ts +0 -26
  165. package/dist/signers/evm-external-wallet.js +0 -7
  166. package/dist/signers/index.cjs +0 -24
  167. package/dist/signers/index.d.cts +0 -11
  168. package/dist/signers/index.d.ts +0 -11
  169. package/dist/signers/index.js +0 -24
  170. package/dist/signers/non-custodial/index.cjs +0 -27
  171. package/dist/signers/non-custodial/index.d.cts +0 -11
  172. package/dist/signers/non-custodial/index.d.ts +0 -11
  173. package/dist/signers/non-custodial/index.js +0 -27
  174. package/dist/signers/non-custodial/ncs-evm-signer.cjs +0 -13
  175. package/dist/signers/non-custodial/ncs-evm-signer.d.cts +0 -30
  176. package/dist/signers/non-custodial/ncs-evm-signer.d.ts +0 -30
  177. package/dist/signers/non-custodial/ncs-evm-signer.js +0 -13
  178. package/dist/signers/non-custodial/ncs-iframe-manager.cjs +0 -7
  179. package/dist/signers/non-custodial/ncs-iframe-manager.d.cts +0 -16
  180. package/dist/signers/non-custodial/ncs-iframe-manager.d.ts +0 -16
  181. package/dist/signers/non-custodial/ncs-iframe-manager.js +0 -7
  182. package/dist/signers/non-custodial/ncs-signer.cjs +0 -14
  183. package/dist/signers/non-custodial/ncs-signer.d.cts +0 -50
  184. package/dist/signers/non-custodial/ncs-signer.d.ts +0 -50
  185. package/dist/signers/non-custodial/ncs-signer.js +0 -14
  186. package/dist/signers/non-custodial/ncs-solana-signer.cjs +0 -13
  187. package/dist/signers/non-custodial/ncs-solana-signer.d.cts +0 -27
  188. package/dist/signers/non-custodial/ncs-solana-signer.d.ts +0 -27
  189. package/dist/signers/non-custodial/ncs-solana-signer.js +0 -13
  190. package/dist/signers/non-custodial/ncs-stellar-signer.cjs +0 -13
  191. package/dist/signers/non-custodial/ncs-stellar-signer.d.cts +0 -27
  192. package/dist/signers/non-custodial/ncs-stellar-signer.d.ts +0 -27
  193. package/dist/signers/non-custodial/ncs-stellar-signer.js +0 -13
  194. package/dist/signers/passkey.cjs +0 -7
  195. package/dist/signers/passkey.d.cts +0 -19
  196. package/dist/signers/passkey.d.ts +0 -19
  197. package/dist/signers/passkey.js +0 -7
  198. package/dist/signers/solana-api-key.cjs +0 -7
  199. package/dist/signers/solana-api-key.d.cts +0 -18
  200. package/dist/signers/solana-api-key.d.ts +0 -18
  201. package/dist/signers/solana-api-key.js +0 -7
  202. package/dist/signers/solana-external-wallet.cjs +0 -8
  203. package/dist/signers/solana-external-wallet.d.cts +0 -24
  204. package/dist/signers/solana-external-wallet.d.ts +0 -24
  205. package/dist/signers/solana-external-wallet.js +0 -8
  206. package/dist/signers/stellar-external-wallet.cjs +0 -7
  207. package/dist/signers/stellar-external-wallet.d.cts +0 -23
  208. package/dist/signers/stellar-external-wallet.d.ts +0 -23
  209. package/dist/signers/stellar-external-wallet.js +0 -7
  210. package/dist/signers/types.cjs +0 -9
  211. package/dist/signers/types.d.cts +0 -91
  212. package/dist/signers/types.d.ts +0 -91
  213. package/dist/signers/types.js +0 -9
  214. package/dist/utils/constants.cjs +0 -13
  215. package/dist/utils/constants.d.cts +0 -6
  216. package/dist/utils/constants.d.ts +0 -6
  217. package/dist/utils/constants.js +0 -13
  218. package/dist/utils/errors.cjs +0 -55
  219. package/dist/utils/errors.d.cts +0 -80
  220. package/dist/utils/errors.d.ts +0 -80
  221. package/dist/utils/errors.js +0 -55
  222. package/dist/utils/signer-validation.cjs +0 -10
  223. package/dist/utils/signer-validation.d.cts +0 -9
  224. package/dist/utils/signer-validation.d.ts +0 -9
  225. package/dist/utils/signer-validation.js +0 -10
  226. package/dist/wallets/__tests__/setup.cjs +0 -36
  227. package/dist/wallets/__tests__/setup.d.cts +0 -2
  228. package/dist/wallets/__tests__/setup.d.ts +0 -2
  229. package/dist/wallets/__tests__/setup.js +0 -36
  230. package/dist/wallets/__tests__/test-helpers.cjs +0 -93
  231. package/dist/wallets/__tests__/test-helpers.d.cts +0 -36
  232. package/dist/wallets/__tests__/test-helpers.d.ts +0 -36
  233. package/dist/wallets/__tests__/test-helpers.js +0 -93
  234. package/dist/wallets/evm.cjs +0 -25
  235. package/dist/wallets/evm.d.cts +0 -155
  236. package/dist/wallets/evm.d.ts +0 -155
  237. package/dist/wallets/evm.js +0 -25
  238. package/dist/wallets/solana.cjs +0 -26
  239. package/dist/wallets/solana.d.cts +0 -28
  240. package/dist/wallets/solana.d.ts +0 -28
  241. package/dist/wallets/solana.js +0 -26
  242. package/dist/wallets/stellar.cjs +0 -25
  243. package/dist/wallets/stellar.d.cts +0 -30
  244. package/dist/wallets/stellar.d.ts +0 -30
  245. package/dist/wallets/stellar.js +0 -25
  246. package/dist/wallets/types.cjs +0 -1
  247. package/dist/wallets/types.d.cts +0 -170
  248. package/dist/wallets/types.d.ts +0 -170
  249. package/dist/wallets/types.js +0 -0
  250. package/dist/wallets/wallet-factory.cjs +0 -33
  251. package/dist/wallets/wallet-factory.d.cts +0 -33
  252. package/dist/wallets/wallet-factory.d.ts +0 -33
  253. package/dist/wallets/wallet-factory.js +0 -33
  254. package/dist/wallets/wallet.cjs +0 -24
  255. package/dist/wallets/wallet.d.cts +0 -168
  256. package/dist/wallets/wallet.d.ts +0 -168
  257. package/dist/wallets/wallet.js +0 -24
@@ -1,89 +0,0 @@
1
- import {
2
- DEFAULT_EVENT_OPTIONS,
3
- NonCustodialSigner
4
- } from "./chunk-U3NV7UY7.js";
5
- import {
6
- walletsLogger
7
- } from "./chunk-ABMZ3ZVN.js";
8
- import {
9
- __async
10
- } from "./chunk-ASE2FXWP.js";
11
-
12
- // src/signers/non-custodial/ncs-evm-signer.ts
13
- import { PersonalMessage } from "ox";
14
- import { isHex, toHex } from "viem";
15
- var EVMNonCustodialSigner = class _EVMNonCustodialSigner extends NonCustodialSigner {
16
- constructor(config) {
17
- super(config);
18
- }
19
- signMessage(message) {
20
- return __async(this, null, function* () {
21
- const messageRaw = isHex(message) ? message : toHex(message);
22
- const messageToSign = PersonalMessage.getSignPayload(messageRaw);
23
- return yield this.sign(messageToSign);
24
- });
25
- }
26
- signTransaction(transaction) {
27
- return __async(this, null, function* () {
28
- return yield this.sign(transaction);
29
- });
30
- }
31
- sign(raw) {
32
- return __async(this, null, function* () {
33
- var _a;
34
- yield this.handleAuthRequired();
35
- const jwt = this.getJwtOrThrow();
36
- const hexString = raw.replace("0x", "");
37
- 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: DEFAULT_EVENT_OPTIONS
54
- });
55
- 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
- export {
88
- EVMNonCustodialSigner
89
- };
@@ -1,59 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
-
3
- var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
4
-
5
-
6
- var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
7
-
8
- // src/signers/solana-external-wallet.ts
9
- var _web3js = require('@solana/web3.js');
10
- var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
11
- var SolanaExternalWalletSigner = class {
12
- constructor(config) {
13
- this.config = config;
14
- this.type = "external-wallet";
15
- if (config.address == null) {
16
- throw new Error("Please provide an address for the External Wallet Signer");
17
- }
18
- this._address = config.address;
19
- this.onSignTransaction = config.onSignTransaction;
20
- }
21
- address() {
22
- return this._address;
23
- }
24
- locator() {
25
- return this.config.locator;
26
- }
27
- signMessage() {
28
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
29
- return yield Promise.reject(new Error("signMessage method not implemented for solana external wallet signer"));
30
- });
31
- }
32
- signTransaction(transaction) {
33
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
34
- if (this.onSignTransaction == null) {
35
- return yield Promise.reject(
36
- new Error("onSignTransaction method is required to sign transactions with a Solana external wallet")
37
- );
38
- }
39
- const transactionBytes = _bs582.default.decode(transaction);
40
- const deserializedTransaction = _web3js.VersionedTransaction.deserialize(transactionBytes);
41
- const signedTxn = yield this.onSignTransaction(deserializedTransaction);
42
- const externalWalletPublicKey = new (0, _web3js.PublicKey)(this._address);
43
- const signerIndex = signedTxn.message.staticAccountKeys.findIndex((key) => key.equals(externalWalletPublicKey));
44
- if (signerIndex === -1) {
45
- throw new (0, _chunkXC2V34TScjs.TransactionFailedError)("Wallet public key not found in transaction signers");
46
- }
47
- const validSignature = signedTxn.signatures[signerIndex];
48
- if (validSignature == null) {
49
- throw new (0, _chunkXC2V34TScjs.TransactionFailedError)("No valid signature found in the transaction");
50
- }
51
- const signatureBytes = new Uint8Array(Object.values(validSignature));
52
- return { signature: _bs582.default.encode(signatureBytes) };
53
- });
54
- }
55
- };
56
-
57
-
58
-
59
- exports.SolanaExternalWalletSigner = SolanaExternalWalletSigner;
@@ -1,16 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// package.json
2
- var name = "@crossmint/wallets-sdk";
3
- var version = "0.20.2";
4
-
5
- // src/utils/constants.ts
6
- var WALLETS_SERVICE = "WALLETS_SDK";
7
- var SDK_VERSION = version;
8
- var SDK_NAME = name;
9
- var STATUS_POLLING_INTERVAL_MS = 500;
10
-
11
-
12
-
13
-
14
-
15
-
16
- exports.WALLETS_SERVICE = WALLETS_SERVICE; exports.SDK_VERSION = SDK_VERSION; exports.SDK_NAME = SDK_NAME; exports.STATUS_POLLING_INTERVAL_MS = STATUS_POLLING_INTERVAL_MS;
@@ -1,69 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunk66UY53KPcjs = require('./chunk-66UY53KP.cjs');
4
-
5
-
6
- var _chunkRYQI3RXLcjs = require('./chunk-RYQI3RXL.cjs');
7
-
8
-
9
-
10
- var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
11
-
12
-
13
- var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
14
-
15
- // src/sdk.ts
16
- var _commonsdkbase = require('@crossmint/common-sdk-base');
17
- var CrossmintWallets = class _CrossmintWallets {
18
- constructor(crossmint) {
19
- _chunkJREZWZ2Scjs.initWalletsLogger.call(void 0, crossmint.apiKey);
20
- const apiClient = new (0, _chunkRYQI3RXLcjs.ApiClient)(crossmint);
21
- this.walletFactory = new (0, _chunk66UY53KPcjs.WalletFactory)(apiClient);
22
- _chunkJREZWZ2Scjs.walletsLogger.info("wallets.sdk.initialized");
23
- }
24
- /**
25
- * Initialize the Wallets SDK
26
- * @param crossmint - Crossmint data (use `createCrossmint` to initialize)
27
- * @returns A new CrossmintWallets instance
28
- */
29
- static from(crossmint) {
30
- return new _CrossmintWallets(crossmint);
31
- }
32
- /**
33
- * Get or create a wallet, can only be called on the client side
34
- * @param args - Wallet data
35
- * @param options - Wallet options
36
- * @returns An existing wallet or a new wallet
37
- */
38
- getOrCreateWallet(options) {
39
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
40
- return yield this.walletFactory.getOrCreateWallet(options);
41
- });
42
- }
43
- /**
44
- * Get an existing wallet by its locator, can only be called on the server side
45
- * @param walletLocator - Wallet locator
46
- * @param options - Wallet options
47
- * @returns A wallet if found, throws WalletNotAvailableError if not found
48
- */
49
- getWallet(walletLocator, options) {
50
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
51
- return yield this.walletFactory.getWallet(walletLocator, options);
52
- });
53
- }
54
- /**
55
- * Create a new wallet, can only be called on the server side
56
- * @param options - Wallet options
57
- * @returns A new wallet
58
- */
59
- createWallet(options) {
60
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
61
- return yield this.walletFactory.createWallet(options);
62
- });
63
- }
64
- };
65
-
66
-
67
-
68
-
69
- exports.createCrossmint = _commonsdkbase.createCrossmint; exports.CrossmintWallets = CrossmintWallets;
@@ -1,58 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
4
-
5
- // src/utils/signer-validation.ts
6
- var _commonsdkauth = require('@crossmint/common-sdk-auth');
7
- var signerConfigMismatchErrorMessage = (fieldPath, newValue, existingValue) => `Wallet signer configuration mismatch at "${fieldPath}" - expected "${existingValue}" from existing wallet but found "${newValue}"`;
8
- function normalizeEmail(email) {
9
- const lowerCaseEmail = email.toLowerCase();
10
- const emailParts = lowerCaseEmail.split("@");
11
- const domain = emailParts[1];
12
- const isGoogleMailDomain = domain === "googlemail.com";
13
- const isGmail = isGoogleMailDomain || domain === "gmail.com";
14
- const isGmailAndHasDots = isGmail && emailParts[0].includes(".");
15
- if (isGoogleMailDomain) {
16
- emailParts[1] = "gmail.com";
17
- }
18
- if (isGmailAndHasDots) {
19
- emailParts[0] = emailParts[0].replace(/\./g, "");
20
- }
21
- return `${emailParts[0]}@${emailParts[1]}`;
22
- }
23
- function normalizeValueForComparison(value) {
24
- if (typeof value === "string" && _commonsdkauth.isEmailValid.call(void 0, value)) {
25
- return normalizeEmail(value);
26
- }
27
- return value;
28
- }
29
- function compareSignerConfigs(newSignerConfig, existingSignerConfig, path = "") {
30
- if (newSignerConfig === existingSignerConfig) {
31
- return;
32
- }
33
- if (newSignerConfig == null || existingSignerConfig == null) {
34
- throw new Error(`Cannot compare null or undefined signer configs at path: ${path}`);
35
- }
36
- for (const key of Object.keys(newSignerConfig)) {
37
- if (!(key in existingSignerConfig)) {
38
- continue;
39
- }
40
- const fieldPath = path ? `${path}.${key}` : key;
41
- const newValue = newSignerConfig[key];
42
- const existingValue = existingSignerConfig[key];
43
- if (typeof newValue === "object" && newValue !== null && typeof existingValue === "object" && existingValue !== null) {
44
- compareSignerConfigs(
45
- newValue,
46
- existingValue,
47
- fieldPath
48
- );
49
- } else if (normalizeValueForComparison(newValue) !== normalizeValueForComparison(existingValue)) {
50
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(signerConfigMismatchErrorMessage(fieldPath, newValue, existingValue));
51
- }
52
- }
53
- }
54
-
55
-
56
-
57
-
58
- exports.normalizeValueForComparison = normalizeValueForComparison; exports.compareSignerConfigs = compareSignerConfigs;
@@ -1,15 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// 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
-
13
-
14
-
15
- exports.AuthRejectedError = AuthRejectedError; exports.isExportableSigner = isExportableSigner;
@@ -1,247 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
4
-
5
-
6
- var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
7
-
8
-
9
-
10
- var _chunkR4AW5ADGcjs = require('./chunk-R4AW5ADG.cjs');
11
-
12
-
13
- var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
14
-
15
- // src/api/client.ts
16
-
17
-
18
-
19
-
20
- var _commonsdkbase = require('@crossmint/common-sdk-base');
21
- var ApiClient = class extends _commonsdkbase.CrossmintApiClient {
22
- constructor(crossmint) {
23
- super(crossmint, {
24
- internalConfig: {
25
- sdkMetadata: { name: _chunkR4AW5ADGcjs.SDK_NAME, version: _chunkR4AW5ADGcjs.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 _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
33
- const path = this.isServerSide ? `${this.apiPrefix}` : `${this.apiPrefix}/me`;
34
- _chunkJREZWZ2Scjs.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
- _chunkJREZWZ2Scjs.walletsLogger.error("wallets.api.createWallet.error", {
45
- error: result.error,
46
- chainType: params.chainType
47
- });
48
- } else if ("address" in result) {
49
- _chunkJREZWZ2Scjs.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 _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
59
- _chunkJREZWZ2Scjs.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
- _chunkJREZWZ2Scjs.walletsLogger.warn("wallets.api.getWallet.error", {
66
- locator,
67
- error: result.error
68
- });
69
- } else if ("address" in result) {
70
- _chunkJREZWZ2Scjs.walletsLogger.info("wallets.api.getWallet.success", result);
71
- }
72
- return result;
73
- });
74
- }
75
- createTransaction(walletLocator, params) {
76
- return _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
174
- if (this.environment === _commonsdkbase.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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, 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 _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
203
- _chunkJREZWZ2Scjs.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
- _chunkJREZWZ2Scjs.walletsLogger.error("wallets.api.send.error", {
215
- walletLocator,
216
- tokenLocator,
217
- error: result.error
218
- });
219
- } else if ("id" in result) {
220
- _chunkJREZWZ2Scjs.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 === _commonsdkbase.APIKeyUsageOrigin.SERVER;
230
- }
231
- get environment() {
232
- if (!this.parsedAPIKey.isValid) {
233
- throw new (0, _chunkXC2V34TScjs.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
-
246
-
247
- exports.ApiClient = ApiClient;