@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,372 +0,0 @@
1
- import {
2
- DELAY_LONG,
3
- DELAY_RATE_LIMIT_WINDOW,
4
- HTTP_ERROR_STATUSES,
5
- MOCK_API_KEY,
6
- TEST_ADDRESSES,
7
- TEST_VALUES,
8
- WALLET_LOCATORS
9
- } from "../../chunk-PJOJIRTY.js";
10
- import {
11
- ApiClient
12
- } from "../../chunk-W7K5E64Q.js";
13
- import "../../chunk-SGINWAB6.js";
14
- import "../../chunk-ABMZ3ZVN.js";
15
- import "../../chunk-TYQ4YIP7.js";
16
- import {
17
- __async,
18
- __spreadProps,
19
- __spreadValues
20
- } from "../../chunk-ASE2FXWP.js";
21
-
22
- // src/api/__tests__/test-utils.ts
23
- import { expect, vi } from "vitest";
24
- var createMockResponse = ({
25
- data,
26
- status = 200,
27
- ok = true,
28
- statusText = "OK"
29
- }) => {
30
- return {
31
- json: vi.fn().mockResolvedValue(data),
32
- ok,
33
- status,
34
- statusText
35
- };
36
- };
37
- var createMockSuccessResponse = (data) => createMockResponse({ data });
38
- var createMockErrorResponse = (data, status = 400, statusText = "Bad Request") => createMockResponse({ data, status, ok: false, statusText });
39
- var createMockCrossmint = (overrides = {}) => {
40
- const base = __spreadValues({
41
- apiKey: MOCK_API_KEY
42
- }, overrides);
43
- return __spreadProps(__spreadValues({}, base), {
44
- setJwt: vi.fn().mockReturnThis(),
45
- experimental_setCustomAuth: vi.fn().mockReturnThis()
46
- });
47
- };
48
- var createTestApiClient = (crossmint) => {
49
- return new ApiClient(crossmint || createMockCrossmint());
50
- };
51
- var createServerSideApiClient = () => {
52
- const apiClient = createTestApiClient();
53
- Object.defineProperty(apiClient, "isServerSide", {
54
- get: () => true,
55
- configurable: true
56
- });
57
- return apiClient;
58
- };
59
- var extractFetchCall = (mockFn) => {
60
- const calls = mockFn.mock.calls;
61
- if (calls.length === 0) {
62
- return void 0;
63
- }
64
- const lastCall = calls[calls.length - 1];
65
- return {
66
- path: lastCall[0],
67
- options: lastCall[1]
68
- };
69
- };
70
- var expectRequestPath = (call, expectedPath) => {
71
- expect(call == null ? void 0 : call.path).toBe(expectedPath);
72
- };
73
- var expectCommonHeaders = (headers) => {
74
- const headerObj = headers;
75
- expect(headerObj["Content-Type"]).toBe("application/json");
76
- };
77
- var expectRequestBody = (options, expectedBody) => {
78
- expect(options.body).toBe(JSON.stringify(expectedBody));
79
- };
80
- var validateRequest = (call, expectedPath, expectedBody) => {
81
- expect(call).toBeDefined();
82
- if (!call) {
83
- return;
84
- }
85
- expectRequestPath(call, expectedPath);
86
- if (call.options.headers) {
87
- expectCommonHeaders(call.options.headers);
88
- }
89
- if (expectedBody !== void 0 && call.options) {
90
- expectRequestBody(call.options, expectedBody);
91
- }
92
- };
93
- var testHttpErrorResponse = (apiCall, mockFn, errorData, statusCode) => __async(void 0, null, function* () {
94
- mockFn.mockResolvedValue(createMockErrorResponse(errorData, statusCode));
95
- const result = yield apiCall();
96
- expect(isErrorResponse(result)).toBe(true);
97
- if (isErrorResponse(result)) {
98
- expect(result.error).toBe(true);
99
- if (errorData.message) {
100
- expect(result.message).toBe(errorData.message);
101
- }
102
- }
103
- });
104
- var testCommonHttpErrors = (_0, _1, ..._2) => __async(void 0, [_0, _1, ..._2], function* (apiCall, mockFn, skipStatuses = []) {
105
- for (const { status, message } of HTTP_ERROR_STATUSES) {
106
- if (skipStatuses.includes(status)) {
107
- continue;
108
- }
109
- const errorResponse = { error: true, message };
110
- mockFn.mockResolvedValueOnce(createMockErrorResponse(errorResponse, status));
111
- const result = yield apiCall();
112
- expect(isErrorResponse(result)).toBe(true);
113
- }
114
- });
115
- var testNetworkError = (apiCall, mockFn) => __async(void 0, null, function* () {
116
- mockFn.mockRejectedValue(new Error("Network error"));
117
- yield expect(apiCall()).rejects.toThrow("Network error");
118
- });
119
- var testInvalidJsonResponse = (apiCall, mockFn) => __async(void 0, null, function* () {
120
- const mockResponse = {
121
- json: vi.fn().mockRejectedValue(new Error("Invalid JSON")),
122
- ok: true,
123
- status: 200
124
- };
125
- mockFn.mockResolvedValue(mockResponse);
126
- yield expect(apiCall()).rejects.toThrow();
127
- });
128
- var testTimeoutError = (apiCall, mockFn) => __async(void 0, null, function* () {
129
- mockFn.mockImplementation(
130
- () => new Promise((_, reject) => setTimeout(() => reject(new Error("Request timeout")), 0))
131
- );
132
- yield expect(apiCall()).rejects.toThrow("Request timeout");
133
- });
134
- var testMalformedResponse = (apiCall, mockFn, malformedData) => __async(void 0, null, function* () {
135
- mockFn.mockResolvedValue(createMockSuccessResponse(malformedData));
136
- const result = yield apiCall();
137
- expect(result).toEqual(malformedData);
138
- });
139
- var createMockWalletResponse = (overrides = {}) => __spreadValues({
140
- address: WALLET_LOCATORS.evmAddress,
141
- chainType: "evm",
142
- type: "smart",
143
- config: {
144
- adminSigner: {
145
- type: "external-wallet",
146
- address: TEST_ADDRESSES.EVM_TEST
147
- }
148
- }
149
- }, overrides);
150
- var createMockSendResponse = (overrides = {}) => __spreadValues({
151
- id: "txn-123",
152
- status: "pending",
153
- chainType: "evm",
154
- walletType: "evm-smart-wallet",
155
- params: {
156
- transaction: "0x1234567890abcdef",
157
- signer: "api-key:test"
158
- },
159
- onChain: {
160
- txId: "0xabcdef1234567890abcdef1234567890abcdef12",
161
- explorerLink: "https://explorer.example.com/tx/0xabcdef1234567890abcdef1234567890abcdef12"
162
- },
163
- createdAt: Date.now()
164
- }, overrides);
165
- function isErrorResponse(response) {
166
- return typeof response === "object" && response !== null && "error" in response && response.error === true;
167
- }
168
- function isSuccessWalletResponse(response) {
169
- return typeof response === "object" && response !== null && "address" in response && "chainType" in response && "type" in response;
170
- }
171
- function isSuccessTransactionResponse(response) {
172
- return typeof response === "object" && response !== null && "id" in response && "status" in response && "chainType" in response;
173
- }
174
- var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
175
- var isValidEthereumAddress = (address) => {
176
- return /^0x[a-fA-F0-9]{40}$/.test(address);
177
- };
178
- var isValidSolanaAddress = (address) => {
179
- return /^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(address);
180
- };
181
- var createIntegrationApiClient = (apiKey, baseUrl, overrides = {}) => {
182
- const base = __spreadValues(__spreadValues({
183
- apiKey
184
- }, baseUrl && { overrideBaseUrl: baseUrl }), overrides);
185
- const crossmint = __spreadProps(__spreadValues({}, base), {
186
- setJwt: () => crossmint,
187
- experimental_setCustomAuth: () => crossmint
188
- });
189
- return new ApiClient(crossmint);
190
- };
191
- var TestDataFactory = class {
192
- constructor() {
193
- this.wallets = [];
194
- this.transactions = [];
195
- }
196
- addWallet(address) {
197
- if (address && !this.wallets.includes(address)) {
198
- this.wallets.push(address);
199
- }
200
- }
201
- addTransaction(id) {
202
- if (id && !this.transactions.includes(id)) {
203
- this.transactions.push(id);
204
- }
205
- }
206
- getWallet(index = 0) {
207
- return this.wallets[index];
208
- }
209
- getTransaction(index = 0) {
210
- return this.transactions[index];
211
- }
212
- hasWallets() {
213
- return this.wallets.length > 0;
214
- }
215
- clear() {
216
- this.wallets = [];
217
- this.transactions = [];
218
- }
219
- };
220
- function ensureWalletExists(_0, _1) {
221
- return __async(this, arguments, function* (apiClient, testData, options = {}) {
222
- if (testData.hasWallets()) {
223
- return testData.getWallet();
224
- }
225
- const { chainType = "evm", type = "mpc", owner, testName = "default" } = options;
226
- const ownerId = owner || `userId:integration-${testName}-${Date.now()}`;
227
- const createResult = yield apiClient.createWallet(__spreadValues({
228
- chainType,
229
- type
230
- }, owner && { owner: ownerId }));
231
- if (isSuccessWalletResponse(createResult)) {
232
- testData.addWallet(createResult.address);
233
- return createResult.address;
234
- }
235
- return void 0;
236
- });
237
- }
238
- function createTestWallet(apiClient, testData, params) {
239
- return __async(this, null, function* () {
240
- const result = yield apiClient.createWallet(params);
241
- if (isSuccessWalletResponse(result)) {
242
- testData.addWallet(result.address);
243
- }
244
- return result;
245
- });
246
- }
247
- function expectErrorResponse(response, message) {
248
- expect(isErrorResponse(response)).toBe(true);
249
- if (message) {
250
- expect(response.message).toBeDefined();
251
- }
252
- }
253
- function expectSuccessWalletResponse(response) {
254
- expect(isSuccessWalletResponse(response)).toBe(true);
255
- }
256
- function expectSuccessTransactionResponse(response) {
257
- expect(isSuccessTransactionResponse(response)).toBe(true);
258
- }
259
- var fundWallet = (apiClient, walletLocator, amount, token = "usdxm", chain = "base-sepolia") => __async(void 0, null, function* () {
260
- const params = {
261
- amount,
262
- token,
263
- chain
264
- };
265
- const result = yield apiClient.fundWallet(walletLocator, params);
266
- if (isErrorResponse(result)) {
267
- throw new Error(`Failed to fund wallet: ${result.message || "Unknown error"}`);
268
- }
269
- yield delay(DELAY_LONG);
270
- return result;
271
- });
272
- var approveTransaction = (_0, _1, _2, ..._3) => __async(void 0, [_0, _1, _2, ..._3], function* (apiClient, walletLocator, transactionId, maxRetries = TEST_VALUES.APPROVE_TRANSACTION_MAX_RETRIES) {
273
- var _a;
274
- for (let i = 0; i < maxRetries; i++) {
275
- const transaction = yield apiClient.getTransaction(walletLocator, transactionId);
276
- if (isErrorResponse(transaction)) {
277
- throw new Error(`Transaction not found: ${transaction.message || "Unknown error"}`);
278
- }
279
- if ("status" in transaction && (transaction.status === "success" || transaction.status === "failed")) {
280
- return transaction;
281
- }
282
- const pendingApprovals = "approvals" in transaction ? (_a = transaction.approvals) == null ? void 0 : _a.pending : void 0;
283
- if (pendingApprovals && pendingApprovals.length > 0) {
284
- const approvals = {
285
- approvals: pendingApprovals.map((approval) => ({
286
- signer: approval.signer.locator,
287
- signature: ""
288
- }))
289
- };
290
- const approvedTransaction = yield apiClient.approveTransaction(walletLocator, transactionId, approvals);
291
- if (isErrorResponse(approvedTransaction)) {
292
- throw new Error(`Failed to approve transaction: ${approvedTransaction.message || "Unknown error"}`);
293
- }
294
- yield delay(DELAY_RATE_LIMIT_WINDOW);
295
- continue;
296
- }
297
- yield delay(DELAY_LONG);
298
- }
299
- const finalTransaction = yield apiClient.getTransaction(walletLocator, transactionId);
300
- if (isErrorResponse(finalTransaction)) {
301
- throw new Error(`Transaction not found after retries: ${finalTransaction.message || "Unknown error"}`);
302
- }
303
- if (!("status" in finalTransaction)) {
304
- throw new Error("Transaction response missing status property");
305
- }
306
- return finalTransaction;
307
- });
308
- var fundWalletAndWait = (apiClient, walletLocator, amount = 1, token = "usdxm", chain = "base-sepolia") => __async(void 0, null, function* () {
309
- return fundWallet(apiClient, walletLocator, amount, token, chain);
310
- });
311
- var sendTokenAndApprove = (apiClient, walletLocator, tokenLocator, recipient, amount) => __async(void 0, null, function* () {
312
- const sendResult = yield apiClient.send(walletLocator, tokenLocator, {
313
- recipient,
314
- amount
315
- });
316
- if (isErrorResponse(sendResult)) {
317
- throw new Error(`Failed to send token: ${sendResult.message || "Unknown error"}`);
318
- }
319
- if (typeof sendResult === "object" && sendResult !== null && "id" in sendResult && typeof sendResult.id === "string") {
320
- return approveTransaction(apiClient, walletLocator, sendResult.id);
321
- }
322
- throw new Error("Transaction ID not found in send response");
323
- });
324
- var ensureWalletFunded = (apiClient, walletLocator, amount = 1, token = "usdxm", chain = "base-sepolia") => __async(void 0, null, function* () {
325
- try {
326
- yield fundWallet(apiClient, walletLocator, amount, token, chain);
327
- } catch (error) {
328
- const errorMessage = error instanceof Error ? error.message : String(error);
329
- if (!errorMessage.includes("already funded") && !errorMessage.includes("insufficient")) {
330
- throw error;
331
- }
332
- }
333
- });
334
- export {
335
- TestDataFactory,
336
- approveTransaction,
337
- createIntegrationApiClient,
338
- createMockCrossmint,
339
- createMockErrorResponse,
340
- createMockResponse,
341
- createMockSendResponse,
342
- createMockSuccessResponse,
343
- createMockWalletResponse,
344
- createServerSideApiClient,
345
- createTestApiClient,
346
- createTestWallet,
347
- delay,
348
- ensureWalletExists,
349
- ensureWalletFunded,
350
- expectCommonHeaders,
351
- expectErrorResponse,
352
- expectRequestBody,
353
- expectRequestPath,
354
- expectSuccessTransactionResponse,
355
- expectSuccessWalletResponse,
356
- extractFetchCall,
357
- fundWallet,
358
- fundWalletAndWait,
359
- isErrorResponse,
360
- isSuccessTransactionResponse,
361
- isSuccessWalletResponse,
362
- isValidEthereumAddress,
363
- isValidSolanaAddress,
364
- sendTokenAndApprove,
365
- testCommonHttpErrors,
366
- testHttpErrorResponse,
367
- testInvalidJsonResponse,
368
- testMalformedResponse,
369
- testNetworkError,
370
- testTimeoutError,
371
- validateRequest
372
- };
@@ -1,10 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkRYQI3RXLcjs = require('../chunk-RYQI3RXL.cjs');
4
- require('../chunk-XC2V34TS.cjs');
5
- require('../chunk-JREZWZ2S.cjs');
6
- require('../chunk-R4AW5ADG.cjs');
7
- require('../chunk-UO2J2ZB2.cjs');
8
-
9
-
10
- exports.ApiClient = _chunkRYQI3RXLcjs.ApiClient;
@@ -1,42 +0,0 @@
1
- import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
- import { CreateWalletParams, CreateWalletResponse, WalletLocator, GetWalletResponse, CreateTransactionParams, CreateTransactionResponse, ApproveTransactionParams, ApproveTransactionResponse, GetTransactionResponse, CreateSignatureParams, CreateSignatureResponse, ApproveSignatureParams, ApproveSignatureResponse, GetSignatureResponse, GetTransactionsResponse, GetNftsResponse, GetActivityResponse, GetBalanceResponse, FundWalletParams, FundWalletResponse, RegisterSignerParams, RegisterSignerResponse, GetSignerResponse, SendParams, SendResponse } from './types.cjs';
3
- import { Chain } from '../chains/chains.cjs';
4
- import 'viem';
5
- import './gen/types.gen.cjs';
6
-
7
- declare class ApiClient extends CrossmintApiClient {
8
- private apiPrefix;
9
- private legacyApiPrefix;
10
- constructor(crossmint: Crossmint);
11
- createWallet(params: CreateWalletParams): Promise<CreateWalletResponse>;
12
- getWallet(locator: WalletLocator): Promise<GetWalletResponse>;
13
- createTransaction(walletLocator: WalletLocator, params: CreateTransactionParams): Promise<CreateTransactionResponse>;
14
- approveTransaction(walletLocator: WalletLocator, transactionId: string, params: ApproveTransactionParams): Promise<ApproveTransactionResponse>;
15
- getTransaction(walletLocator: WalletLocator, transactionId: string): Promise<GetTransactionResponse>;
16
- createSignature(walletLocator: WalletLocator, params: CreateSignatureParams): Promise<CreateSignatureResponse>;
17
- approveSignature(walletLocator: WalletLocator, signatureId: string, params: ApproveSignatureParams): Promise<ApproveSignatureResponse>;
18
- getSignature(walletLocator: WalletLocator, signatureId: string): Promise<GetSignatureResponse>;
19
- getTransactions(walletLocator: WalletLocator): Promise<GetTransactionsResponse>;
20
- experimental_getNfts(params: {
21
- address: string;
22
- perPage: number;
23
- page: number;
24
- chain: string;
25
- }): Promise<GetNftsResponse>;
26
- experimental_activity(walletLocator: WalletLocator, params: {
27
- chain: Chain;
28
- }): Promise<GetActivityResponse>;
29
- getBalance(walletLocator: WalletLocator, params: {
30
- chains: Chain[];
31
- tokens: string[];
32
- }): Promise<GetBalanceResponse>;
33
- fundWallet(walletLocator: WalletLocator, params: FundWalletParams): Promise<FundWalletResponse>;
34
- registerSigner(walletLocator: WalletLocator, params: RegisterSignerParams): Promise<RegisterSignerResponse>;
35
- getSigner(walletLocator: WalletLocator, signer: string): Promise<GetSignerResponse>;
36
- send(walletLocator: WalletLocator, tokenLocator: string, params: SendParams): Promise<SendResponse>;
37
- get isServerSide(): boolean;
38
- get environment(): APIKeyEnvironmentPrefix;
39
- private get headers();
40
- }
41
-
42
- export { ApiClient };
@@ -1,42 +0,0 @@
1
- import { CrossmintApiClient, Crossmint, APIKeyEnvironmentPrefix } from '@crossmint/common-sdk-base';
2
- import { CreateWalletParams, CreateWalletResponse, WalletLocator, GetWalletResponse, CreateTransactionParams, CreateTransactionResponse, ApproveTransactionParams, ApproveTransactionResponse, GetTransactionResponse, CreateSignatureParams, CreateSignatureResponse, ApproveSignatureParams, ApproveSignatureResponse, GetSignatureResponse, GetTransactionsResponse, GetNftsResponse, GetActivityResponse, GetBalanceResponse, FundWalletParams, FundWalletResponse, RegisterSignerParams, RegisterSignerResponse, GetSignerResponse, SendParams, SendResponse } from './types.js';
3
- import { Chain } from '../chains/chains.js';
4
- import 'viem';
5
- import './gen/types.gen.js';
6
-
7
- declare class ApiClient extends CrossmintApiClient {
8
- private apiPrefix;
9
- private legacyApiPrefix;
10
- constructor(crossmint: Crossmint);
11
- createWallet(params: CreateWalletParams): Promise<CreateWalletResponse>;
12
- getWallet(locator: WalletLocator): Promise<GetWalletResponse>;
13
- createTransaction(walletLocator: WalletLocator, params: CreateTransactionParams): Promise<CreateTransactionResponse>;
14
- approveTransaction(walletLocator: WalletLocator, transactionId: string, params: ApproveTransactionParams): Promise<ApproveTransactionResponse>;
15
- getTransaction(walletLocator: WalletLocator, transactionId: string): Promise<GetTransactionResponse>;
16
- createSignature(walletLocator: WalletLocator, params: CreateSignatureParams): Promise<CreateSignatureResponse>;
17
- approveSignature(walletLocator: WalletLocator, signatureId: string, params: ApproveSignatureParams): Promise<ApproveSignatureResponse>;
18
- getSignature(walletLocator: WalletLocator, signatureId: string): Promise<GetSignatureResponse>;
19
- getTransactions(walletLocator: WalletLocator): Promise<GetTransactionsResponse>;
20
- experimental_getNfts(params: {
21
- address: string;
22
- perPage: number;
23
- page: number;
24
- chain: string;
25
- }): Promise<GetNftsResponse>;
26
- experimental_activity(walletLocator: WalletLocator, params: {
27
- chain: Chain;
28
- }): Promise<GetActivityResponse>;
29
- getBalance(walletLocator: WalletLocator, params: {
30
- chains: Chain[];
31
- tokens: string[];
32
- }): Promise<GetBalanceResponse>;
33
- fundWallet(walletLocator: WalletLocator, params: FundWalletParams): Promise<FundWalletResponse>;
34
- registerSigner(walletLocator: WalletLocator, params: RegisterSignerParams): Promise<RegisterSignerResponse>;
35
- getSigner(walletLocator: WalletLocator, signer: string): Promise<GetSignerResponse>;
36
- send(walletLocator: WalletLocator, tokenLocator: string, params: SendParams): Promise<SendResponse>;
37
- get isServerSide(): boolean;
38
- get environment(): APIKeyEnvironmentPrefix;
39
- private get headers();
40
- }
41
-
42
- export { ApiClient };
@@ -1,10 +0,0 @@
1
- import {
2
- ApiClient
3
- } from "../chunk-W7K5E64Q.js";
4
- import "../chunk-SGINWAB6.js";
5
- import "../chunk-ABMZ3ZVN.js";
6
- import "../chunk-TYQ4YIP7.js";
7
- import "../chunk-ASE2FXWP.js";
8
- export {
9
- ApiClient
10
- };
@@ -1,7 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _chunkZT7EGOCIcjs = require('../../chunk-ZT7EGOCI.cjs');
4
- require('../../chunk-UO2J2ZB2.cjs');
5
-
6
-
7
- exports.client = _chunkZT7EGOCIcjs.client;
@@ -1,16 +0,0 @@
1
- import * as _hey_api_client_fetch from '@hey-api/client-fetch';
2
- import { ClientOptions, Config } from '@hey-api/client-fetch';
3
- import { ClientOptions as ClientOptions$1 } from './types.gen.cjs';
4
-
5
- /**
6
- * The `createClientConfig()` function will be called on client initialization
7
- * and the returned object will become the client's initial configuration.
8
- *
9
- * You may want to initialize your client this way instead of calling
10
- * `setConfig()`. This is useful for example if you're using Next.js
11
- * to ensure your client always has the correct values.
12
- */
13
- type CreateClientConfig<T extends ClientOptions = ClientOptions$1> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
14
- declare const client: _hey_api_client_fetch.Client;
15
-
16
- export { type CreateClientConfig, client };
@@ -1,16 +0,0 @@
1
- import * as _hey_api_client_fetch from '@hey-api/client-fetch';
2
- import { ClientOptions, Config } from '@hey-api/client-fetch';
3
- import { ClientOptions as ClientOptions$1 } from './types.gen.js';
4
-
5
- /**
6
- * The `createClientConfig()` function will be called on client initialization
7
- * and the returned object will become the client's initial configuration.
8
- *
9
- * You may want to initialize your client this way instead of calling
10
- * `setConfig()`. This is useful for example if you're using Next.js
11
- * to ensure your client always has the correct values.
12
- */
13
- type CreateClientConfig<T extends ClientOptions = ClientOptions$1> = (override?: Config<ClientOptions & T>) => Config<Required<ClientOptions> & T>;
14
- declare const client: _hey_api_client_fetch.Client;
15
-
16
- export { type CreateClientConfig, client };
@@ -1,7 +0,0 @@
1
- import {
2
- client
3
- } from "../../chunk-KT3CVXFG.js";
4
- import "../../chunk-ASE2FXWP.js";
5
- export {
6
- client
7
- };