@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,25 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/chains/definitions/storyTestnet.ts
2
- var _viem = require('viem');
3
- var storyTestnet = _viem.defineChain.call(void 0, {
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
-
24
-
25
- exports.storyTestnet = storyTestnet;
File without changes
@@ -1,336 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkRBHGZDDXcjs = require('./chunk-RBHGZDDX.cjs');
5
-
6
-
7
- var _chunkPOG76HDDcjs = require('./chunk-POG76HDD.cjs');
8
-
9
-
10
- var _chunk47R3UV3Jcjs = require('./chunk-47R3UV3J.cjs');
11
-
12
-
13
- var _chunkWDZY4PP4cjs = require('./chunk-WDZY4PP4.cjs');
14
-
15
-
16
-
17
- var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
18
-
19
-
20
- var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
21
-
22
-
23
-
24
-
25
-
26
- var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
27
-
28
- // src/wallets/wallet-factory.ts
29
- var _commonsdkbase = require('@crossmint/common-sdk-base');
30
- var _ox = require('ox');
31
- var DELEGATED_SIGNER_MISMATCH_ERROR = "When 'delegatedSigners' is provided to a method that may fetch an existing wallet, each specified delegated signer must exist in that wallet's configuration.";
32
- var WalletFactory = class {
33
- constructor(apiClient) {
34
- this.apiClient = apiClient;
35
- }
36
- getOrCreateWallet(args) {
37
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
38
- if (this.apiClient.isServerSide) {
39
- _chunkJREZWZ2Scjs.walletsLogger.error("walletFactory.getOrCreateWallet.error", {
40
- error: "getOrCreateWallet can only be called from client-side code"
41
- });
42
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
43
- "getOrCreateWallet can only be called from client-side code.\n- Make sure you're running this in the browser (or another client environment), not on your server.\n- Use your Crossmint Client API Key (not a server key)."
44
- );
45
- }
46
- args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain: _chunkWDZY4PP4cjs.validateChainForEnvironment.call(void 0, args.chain, this.apiClient.environment) });
47
- const locator = this.getWalletLocator(args);
48
- _chunkJREZWZ2Scjs.walletsLogger.info("walletFactory.getOrCreateWallet.start");
49
- const existingWallet = yield this.apiClient.getWallet(locator);
50
- if (existingWallet != null && !("error" in existingWallet)) {
51
- _chunkJREZWZ2Scjs.walletsLogger.info("walletFactory.getOrCreateWallet.existing", {
52
- address: existingWallet.address
53
- });
54
- return this.createWalletInstance(existingWallet, args);
55
- }
56
- _chunkJREZWZ2Scjs.walletsLogger.info("walletFactory.getOrCreateWallet.creating");
57
- return this.createWalletInternal(args);
58
- });
59
- }
60
- getWallet(walletLocator, args) {
61
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
62
- if (!this.apiClient.isServerSide) {
63
- _chunkJREZWZ2Scjs.walletsLogger.error("walletFactory.getWallet.error", {
64
- error: "getWallet is not supported on client side"
65
- });
66
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("getWallet is not supported on client side, use getOrCreateWallet instead");
67
- }
68
- args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain: _chunkWDZY4PP4cjs.validateChainForEnvironment.call(void 0, args.chain, this.apiClient.environment) });
69
- _chunkJREZWZ2Scjs.walletsLogger.info("walletFactory.getWallet.start");
70
- const existingWallet = yield this.apiClient.getWallet(walletLocator);
71
- if ("error" in existingWallet) {
72
- _chunkJREZWZ2Scjs.walletsLogger.warn("walletFactory.getWallet.notFound", {
73
- error: existingWallet.error
74
- });
75
- throw new (0, _chunkXC2V34TScjs.WalletNotAvailableError)(JSON.stringify(existingWallet));
76
- }
77
- _chunkJREZWZ2Scjs.walletsLogger.info("walletFactory.getWallet.success", {
78
- address: existingWallet.address
79
- });
80
- return this.createWalletInstance(existingWallet, args);
81
- });
82
- }
83
- createWallet(args) {
84
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
85
- args = _chunkUO2J2ZB2cjs.__spreadProps.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, args), { chain: _chunkWDZY4PP4cjs.validateChainForEnvironment.call(void 0, args.chain, this.apiClient.environment) });
86
- return this.createWalletInternal(args);
87
- });
88
- }
89
- createWalletInternal(args) {
90
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
91
- var _a, _b, _c, _d, _e;
92
- yield (_c = (_b = (_a = args.options) == null ? void 0 : _a.experimental_callbacks) == null ? void 0 : _b.onWalletCreationStart) == null ? void 0 : _c.call(_b);
93
- _chunkJREZWZ2Scjs.walletsLogger.info("walletFactory.createWallet.start");
94
- this.mutateSignerFromCustomAuth(args, true);
95
- const adminSigner = args.signer.type === "passkey" ? yield this.createPasskeyAdminSigner(args.signer) : args.signer;
96
- const walletResponse = yield this.apiClient.createWallet({
97
- type: "smart",
98
- chainType: this.getChainType(args.chain),
99
- config: _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {
100
- adminSigner
101
- }, (args == null ? void 0 : args.plugins) ? { plugins: args.plugins } : {}), args.delegatedSigners != null ? { delegatedSigners: args.delegatedSigners } : {}),
102
- owner: (_d = args.owner) != null ? _d : void 0,
103
- alias: (_e = args.alias) != null ? _e : void 0
104
- });
105
- if ("error" in walletResponse) {
106
- _chunkJREZWZ2Scjs.walletsLogger.error("walletFactory.createWallet.error", {
107
- error: walletResponse.error
108
- });
109
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(JSON.stringify(walletResponse));
110
- }
111
- _chunkJREZWZ2Scjs.walletsLogger.info("walletFactory.createWallet.success", {
112
- address: walletResponse.address
113
- });
114
- return this.createWalletInstance(walletResponse, args);
115
- });
116
- }
117
- createWalletInstance(walletResponse, args) {
118
- this.validateExistingWalletConfig(walletResponse, args);
119
- const signerConfig = this.toInternalSignerConfig(walletResponse, args.signer, args.options);
120
- return new (0, _chunkPOG76HDDcjs.Wallet)(
121
- {
122
- chain: args.chain,
123
- address: walletResponse.address,
124
- owner: walletResponse.owner,
125
- signer: _chunk47R3UV3Jcjs.assembleSigner.call(void 0, args.chain, signerConfig),
126
- options: args.options,
127
- alias: args.alias
128
- },
129
- this.apiClient
130
- );
131
- }
132
- toInternalSignerConfig(walletResponse, signerArgs, options) {
133
- var _a, _b, _c, _d, _e, _f;
134
- if (!(walletResponse.chainType === "evm" || walletResponse.chainType === "solana" || walletResponse.chainType === "stellar")) {
135
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(`Wallet type ${walletResponse.chainType} is not supported`);
136
- }
137
- if (signerArgs == null && ((_a = walletResponse.config) == null ? void 0 : _a.adminSigner) == null) {
138
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Signer is required to create a wallet");
139
- }
140
- switch (signerArgs.type) {
141
- case "api-key": {
142
- if (((_b = walletResponse.config) == null ? void 0 : _b.adminSigner.type) !== "api-key") {
143
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("API key signer does not match the wallet's signer type");
144
- }
145
- return {
146
- type: "api-key",
147
- address: walletResponse.config.adminSigner.address,
148
- locator: walletResponse.config.adminSigner.locator
149
- };
150
- }
151
- case "external-wallet":
152
- if (((_c = walletResponse.config) == null ? void 0 : _c.adminSigner.type) !== "external-wallet") {
153
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("External wallet signer does not match the wallet's signer type");
154
- }
155
- return _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, _chunkUO2J2ZB2cjs.__spreadValues.call(void 0, {}, walletResponse.config.adminSigner), signerArgs);
156
- case "passkey":
157
- if (((_d = walletResponse.config) == null ? void 0 : _d.adminSigner.type) !== "passkey") {
158
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Passkey signer does not match the wallet's signer type");
159
- }
160
- return {
161
- type: "passkey",
162
- id: walletResponse.config.adminSigner.id,
163
- name: walletResponse.config.adminSigner.name,
164
- locator: walletResponse.config.adminSigner.locator,
165
- onCreatePasskey: signerArgs.onCreatePasskey,
166
- onSignWithPasskey: signerArgs.onSignWithPasskey
167
- };
168
- case "email": {
169
- if (((_e = walletResponse.config) == null ? void 0 : _e.adminSigner.type) !== "email") {
170
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Email signer does not match the wallet's signer type");
171
- }
172
- const { locator, email, address } = walletResponse.config.adminSigner;
173
- return {
174
- type: "email",
175
- email,
176
- locator,
177
- address,
178
- crossmint: this.apiClient.crossmint,
179
- onAuthRequired: signerArgs.onAuthRequired,
180
- clientTEEConnection: options == null ? void 0 : options.clientTEEConnection
181
- };
182
- }
183
- case "phone": {
184
- if (((_f = walletResponse.config) == null ? void 0 : _f.adminSigner.type) !== "phone") {
185
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Phone signer does not match the wallet's signer type");
186
- }
187
- const { locator, phone, address } = walletResponse.config.adminSigner;
188
- return {
189
- type: "phone",
190
- phone,
191
- locator,
192
- address,
193
- crossmint: this.apiClient.crossmint,
194
- onAuthRequired: signerArgs.onAuthRequired,
195
- clientTEEConnection: options == null ? void 0 : options.clientTEEConnection
196
- };
197
- }
198
- default:
199
- throw new Error("Invalid signer type");
200
- }
201
- }
202
- getWalletLocator(args) {
203
- return `me:${this.getChainType(args.chain)}:smart` + (args.alias != null ? `:alias:${args.alias}` : "");
204
- }
205
- createPasskeyAdminSigner(signer) {
206
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
207
- var _a;
208
- if (signer.type !== "passkey") {
209
- throw new Error("Signer is not a passkey");
210
- }
211
- const passkeyName = (_a = signer.name) != null ? _a : `Crossmint Wallet ${Date.now()}`;
212
- const passkeyCredential = signer.onCreatePasskey ? yield signer.onCreatePasskey(passkeyName) : yield _ox.WebAuthnP256.createCredential({ name: passkeyName });
213
- return {
214
- type: "passkey",
215
- id: passkeyCredential.id,
216
- name: passkeyName,
217
- publicKey: {
218
- x: passkeyCredential.publicKey.x.toString(),
219
- y: passkeyCredential.publicKey.y.toString()
220
- }
221
- };
222
- });
223
- }
224
- mutateSignerFromCustomAuth(args, isNewWalletSigner = false) {
225
- var _a, _b;
226
- const { experimental_customAuth } = this.apiClient.crossmint;
227
- if (args.signer.type === "email" && (experimental_customAuth == null ? void 0 : experimental_customAuth.email) != null) {
228
- args.signer.email = (_a = args.signer.email) != null ? _a : experimental_customAuth.email;
229
- }
230
- if (args.signer.type === "phone" && (experimental_customAuth == null ? void 0 : experimental_customAuth.phone) != null) {
231
- args.signer.phone = (_b = args.signer.phone) != null ? _b : experimental_customAuth.phone;
232
- }
233
- if (args.signer.type === "external-wallet" && (experimental_customAuth == null ? void 0 : experimental_customAuth.externalWalletSigner) != null) {
234
- args.signer = isNewWalletSigner ? {
235
- type: "external-wallet",
236
- address: experimental_customAuth.externalWalletSigner.address
237
- } : experimental_customAuth.externalWalletSigner;
238
- }
239
- return;
240
- }
241
- validateExistingWalletConfig(existingWallet, args) {
242
- var _a;
243
- this.mutateSignerFromCustomAuth(args);
244
- if (args.owner != null && existingWallet.owner != null && _chunkRBHGZDDXcjs.normalizeValueForComparison.call(void 0, args.owner) !== _chunkRBHGZDDXcjs.normalizeValueForComparison.call(void 0, existingWallet.owner)) {
245
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)("Wallet owner does not match existing wallet's linked user");
246
- }
247
- if (args.chain === "solana" && existingWallet.chainType !== "solana" || args.chain !== "solana" && existingWallet.chainType === "solana" || args.chain === "stellar" && existingWallet.chainType !== "stellar" || args.chain !== "stellar" && existingWallet.chainType === "stellar") {
248
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
249
- `Wallet chain does not match existing wallet's chain. You must use chain: ${existingWallet.chainType}.`
250
- );
251
- }
252
- if (existingWallet.type !== "smart") {
253
- return;
254
- }
255
- const adminSignerArgs = args.signer;
256
- const existingWalletSigner = (_a = existingWallet == null ? void 0 : existingWallet.config) == null ? void 0 : _a.adminSigner;
257
- if (adminSignerArgs != null && existingWalletSigner != null) {
258
- if (adminSignerArgs.type !== existingWalletSigner.type) {
259
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
260
- "The wallet signer type provided in the wallet config does not match the existing wallet's adminSigner type"
261
- );
262
- }
263
- _chunkRBHGZDDXcjs.compareSignerConfigs.call(void 0, adminSignerArgs, existingWalletSigner);
264
- }
265
- if (args.delegatedSigners != null) {
266
- this.validateDelegatedSigners(existingWallet, args.delegatedSigners);
267
- }
268
- }
269
- validateDelegatedSigners(existingWallet, inputDelegatedSigners) {
270
- var _a;
271
- const existingDelegatedSigners = (_a = existingWallet == null ? void 0 : existingWallet.config) == null ? void 0 : _a.delegatedSigners;
272
- if (inputDelegatedSigners.length === 0) {
273
- return;
274
- }
275
- if (existingDelegatedSigners == null || existingDelegatedSigners.length === 0) {
276
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
277
- `${inputDelegatedSigners.length} delegated signer(s) specified, but wallet "${existingWallet.address}" has no delegated signers. ${DELEGATED_SIGNER_MISMATCH_ERROR}`
278
- );
279
- }
280
- for (const argSigner of inputDelegatedSigners) {
281
- const matchingExistingSigner = existingDelegatedSigners.find(
282
- (existingSigner) => existingSigner.locator === argSigner.signer
283
- );
284
- if (matchingExistingSigner == null) {
285
- const walletSigners = existingDelegatedSigners.map((s) => s.locator).join(", ");
286
- throw new (0, _chunkXC2V34TScjs.WalletCreationError)(
287
- `Delegated signer '${argSigner.signer}' does not exist in wallet "${existingWallet.address}". Available delegated signers: ${walletSigners}. ${DELEGATED_SIGNER_MISMATCH_ERROR}`
288
- );
289
- }
290
- }
291
- }
292
- getChainType(chain) {
293
- if (chain === "solana") {
294
- return "solana";
295
- }
296
- if (chain === "stellar") {
297
- return "stellar";
298
- }
299
- return "evm";
300
- }
301
- };
302
- _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
303
- _commonsdkbase.WithLoggerContext.call(void 0, {
304
- logger: _chunkJREZWZ2Scjs.walletsLogger,
305
- methodName: "walletFactory.getOrCreateWallet",
306
- buildContext(_thisArg, args) {
307
- const walletArgs = args[0];
308
- return { chain: walletArgs.chain, signerType: walletArgs.signer.type };
309
- }
310
- })
311
- ], WalletFactory.prototype, "getOrCreateWallet", 1);
312
- _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
313
- _commonsdkbase.WithLoggerContext.call(void 0, {
314
- logger: _chunkJREZWZ2Scjs.walletsLogger,
315
- methodName: "walletFactory.getWallet",
316
- buildContext(_thisArg, args) {
317
- const walletLocator = args[0];
318
- const walletArgs = args[1];
319
- return { walletLocator, chain: walletArgs.chain };
320
- }
321
- })
322
- ], WalletFactory.prototype, "getWallet", 1);
323
- _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
324
- _commonsdkbase.WithLoggerContext.call(void 0, {
325
- logger: _chunkJREZWZ2Scjs.walletsLogger,
326
- methodName: "walletFactory.createWallet",
327
- buildContext(_thisArg, args) {
328
- const walletArgs = args[0];
329
- return { chain: walletArgs.chain, signerType: walletArgs.signer.type };
330
- }
331
- })
332
- ], WalletFactory.prototype, "createWallet", 1);
333
-
334
-
335
-
336
- exports.WalletFactory = WalletFactory;
@@ -1,110 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkPOG76HDDcjs = require('./chunk-POG76HDD.cjs');
4
-
5
-
6
- var _chunkXC2V34TScjs = require('./chunk-XC2V34TS.cjs');
7
-
8
-
9
- var _chunkJREZWZ2Scjs = require('./chunk-JREZWZ2S.cjs');
10
-
11
-
12
-
13
- var _chunkUO2J2ZB2cjs = require('./chunk-UO2J2ZB2.cjs');
14
-
15
- // src/wallets/stellar.ts
16
- var _commonsdkbase = require('@crossmint/common-sdk-base');
17
- var _StellarWallet = class _StellarWallet extends _chunkPOG76HDDcjs.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: _chunkPOG76HDDcjs.Wallet.getOptions(wallet),
26
- alias: wallet.alias
27
- },
28
- _chunkPOG76HDDcjs.Wallet.getApiClient(wallet)
29
- );
30
- }
31
- static from(wallet) {
32
- if (!_commonsdkbase.isValidStellarAddress.call(void 0, wallet.address)) {
33
- throw new Error("Wallet is not a Stellar wallet");
34
- }
35
- return new _StellarWallet(wallet);
36
- }
37
- sendTransaction(params) {
38
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
39
- var _a;
40
- _chunkJREZWZ2Scjs.walletsLogger.info("stellarWallet.sendTransaction.start");
41
- yield this.preAuthIfNeeded();
42
- const createdTransaction = yield this.createTransaction(params);
43
- if ((_a = params.options) == null ? void 0 : _a.experimental_prepareOnly) {
44
- _chunkJREZWZ2Scjs.walletsLogger.info("stellarWallet.sendTransaction.prepared", {
45
- transactionId: createdTransaction.id
46
- });
47
- return {
48
- hash: void 0,
49
- explorerLink: void 0,
50
- transactionId: createdTransaction.id
51
- };
52
- }
53
- const options = {};
54
- const result = yield this.approveTransactionAndWait(createdTransaction.id, options);
55
- _chunkJREZWZ2Scjs.walletsLogger.info("stellarWallet.sendTransaction.success", {
56
- transactionId: createdTransaction.id,
57
- hash: result.hash
58
- });
59
- return result;
60
- });
61
- }
62
- createTransaction(params) {
63
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
64
- var _a;
65
- const { contractId, options } = params;
66
- const signer = (_a = options == null ? void 0 : options.experimental_signer) != null ? _a : this.signer.locator();
67
- let transaction;
68
- if ("transaction" in params) {
69
- transaction = {
70
- type: "serialized-transaction",
71
- serializedTransaction: params.transaction,
72
- contractId
73
- };
74
- } else {
75
- const { method, memo, args } = params;
76
- transaction = {
77
- type: "contract-call",
78
- contractId,
79
- method,
80
- memo: memo != null ? { type: "text", value: memo } : void 0,
81
- args
82
- };
83
- }
84
- const transactionCreationResponse = yield this.apiClient.createTransaction(this.walletLocator, {
85
- params: {
86
- transaction,
87
- signer
88
- }
89
- });
90
- if ("error" in transactionCreationResponse) {
91
- throw new (0, _chunkXC2V34TScjs.TransactionNotCreatedError)(JSON.stringify(transactionCreationResponse));
92
- }
93
- return transactionCreationResponse;
94
- });
95
- }
96
- };
97
- _chunkUO2J2ZB2cjs.__decorateClass.call(void 0, [
98
- _commonsdkbase.WithLoggerContext.call(void 0, {
99
- logger: _chunkJREZWZ2Scjs.walletsLogger,
100
- methodName: "stellarWallet.sendTransaction",
101
- buildContext(thisArg) {
102
- return { chain: thisArg.chain, address: thisArg.address };
103
- }
104
- })
105
- ], _StellarWallet.prototype, "sendTransaction", 1);
106
- var StellarWallet = _StellarWallet;
107
-
108
-
109
-
110
- exports.StellarWallet = StellarWallet;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,82 +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-stellar-signer.ts
13
- var StellarNonCustodialSigner = class _StellarNonCustodialSigner extends NonCustodialSigner {
14
- constructor(config) {
15
- super(config);
16
- }
17
- signMessage() {
18
- return __async(this, null, function* () {
19
- return yield Promise.reject(new Error("signMessage method not implemented for stellar signer"));
20
- });
21
- }
22
- signTransaction(payload) {
23
- return __async(this, null, function* () {
24
- var _a;
25
- yield this.handleAuthRequired();
26
- const jwt = this.getJwtOrThrow();
27
- walletsLogger.info("sign: sending request", { keyType: "ed25519" });
28
- const startTime = Date.now();
29
- const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
30
- event: "request:sign",
31
- responseEvent: "response:sign",
32
- data: {
33
- authData: {
34
- jwt,
35
- apiKey: this.config.crossmint.apiKey
36
- },
37
- data: {
38
- keyType: "ed25519",
39
- bytes: payload,
40
- encoding: "base64"
41
- }
42
- },
43
- options: DEFAULT_EVENT_OPTIONS
44
- });
45
- walletsLogger.info("sign: response received", {
46
- status: res == null ? void 0 : res.status,
47
- durationMs: Date.now() - startTime
48
- });
49
- if ((res == null ? void 0 : res.status) === "error") {
50
- throw new Error(res.error);
51
- }
52
- if ((res == null ? void 0 : res.signature) == null) {
53
- throw new Error("Failed to sign transaction");
54
- }
55
- _StellarNonCustodialSigner.verifyPublicKeyFormat(res.publicKey);
56
- if (res.signature.encoding !== "base64") {
57
- throw new Error("Wrong encoding for signature. Expected base64, got " + res.signature.encoding);
58
- }
59
- return { signature: res.signature.bytes };
60
- });
61
- }
62
- static verifyPublicKeyFormat(publicKey) {
63
- if (publicKey == null) {
64
- throw new Error("No public key found");
65
- }
66
- if (publicKey.encoding !== "base64" || publicKey.keyType !== "ed25519" || publicKey.bytes == null) {
67
- throw new Error(
68
- "Not supported. Expected public key to be in base64 encoding and ed25519 key type. Got: " + JSON.stringify(publicKey)
69
- );
70
- }
71
- }
72
- getChainKeyParams() {
73
- return {
74
- scheme: "ed25519",
75
- encoding: "strkey"
76
- };
77
- }
78
- };
79
-
80
- export {
81
- StellarNonCustodialSigner
82
- };
@@ -1,36 +0,0 @@
1
- import {
2
- __async
3
- } from "./chunk-ASE2FXWP.js";
4
-
5
- // src/signers/evm-api-key.ts
6
- var EVMApiKeySigner = class {
7
- constructor(config) {
8
- this.config = config;
9
- this.type = "api-key";
10
- }
11
- locator() {
12
- return this.config.locator;
13
- }
14
- signMessage() {
15
- return __async(this, null, function* () {
16
- return yield Promise.reject(
17
- new Error(
18
- "API key signers do not support direct message signing - signatures are handled automatically by the backend"
19
- )
20
- );
21
- });
22
- }
23
- signTransaction() {
24
- return __async(this, null, function* () {
25
- return yield Promise.reject(
26
- new Error(
27
- "API key signers do not support direct transaction signing - transaction are handled automatically by the backend"
28
- )
29
- );
30
- });
31
- }
32
- };
33
-
34
- export {
35
- EVMApiKeySigner
36
- };
@@ -1,84 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
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-solana-signer.ts
13
- var _web3js = require('@solana/web3.js');
14
- var _bs58 = require('bs58'); var _bs582 = _interopRequireDefault(_bs58);
15
- var SolanaNonCustodialSigner = class _SolanaNonCustodialSigner extends _chunkZAX22GSIcjs.NonCustodialSigner {
16
- constructor(config) {
17
- super(config);
18
- }
19
- signMessage() {
20
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
21
- return yield Promise.reject(new Error("signMessage method not implemented for email signer"));
22
- });
23
- }
24
- signTransaction(transaction) {
25
- return _chunkUO2J2ZB2cjs.__async.call(void 0, this, null, function* () {
26
- var _a;
27
- yield this.handleAuthRequired();
28
- const jwt = this.getJwtOrThrow();
29
- const transactionBytes = _bs582.default.decode(transaction);
30
- const deserializedTransaction = _web3js.VersionedTransaction.deserialize(transactionBytes);
31
- const messageData = deserializedTransaction.message.serialize();
32
- _chunkJREZWZ2Scjs.walletsLogger.info("sign: sending request", { keyType: "ed25519" });
33
- const startTime = Date.now();
34
- const res = yield (_a = this.config.clientTEEConnection) == null ? void 0 : _a.sendAction({
35
- event: "request:sign",
36
- responseEvent: "response:sign",
37
- data: {
38
- authData: {
39
- jwt,
40
- apiKey: this.config.crossmint.apiKey
41
- },
42
- data: {
43
- keyType: "ed25519",
44
- bytes: _bs582.default.encode(messageData),
45
- encoding: "base58"
46
- }
47
- },
48
- options: _chunkZAX22GSIcjs.DEFAULT_EVENT_OPTIONS
49
- });
50
- _chunkJREZWZ2Scjs.walletsLogger.info("sign: response received", {
51
- status: res == null ? void 0 : res.status,
52
- durationMs: Date.now() - startTime
53
- });
54
- if ((res == null ? void 0 : res.status) === "error") {
55
- throw new Error(res.error);
56
- }
57
- if ((res == null ? void 0 : res.signature) == null) {
58
- throw new Error("Failed to sign transaction");
59
- }
60
- _SolanaNonCustodialSigner.verifyPublicKeyFormat(res.publicKey);
61
- return { signature: res.signature.bytes };
62
- });
63
- }
64
- static verifyPublicKeyFormat(publicKey) {
65
- if (publicKey == null) {
66
- throw new Error("No public key found");
67
- }
68
- if (publicKey.encoding !== "base58" || publicKey.keyType !== "ed25519" || publicKey.bytes == null) {
69
- throw new Error(
70
- "Not supported. Expected public key to be in base58 encoding and ed25519 key type. Got: " + JSON.stringify(publicKey)
71
- );
72
- }
73
- }
74
- getChainKeyParams() {
75
- return {
76
- scheme: "ed25519",
77
- encoding: "base58"
78
- };
79
- }
80
- };
81
-
82
-
83
-
84
- exports.SolanaNonCustodialSigner = SolanaNonCustodialSigner;