@crossmint/wallets-sdk 0.18.14 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/__tests__/constants.cjs +31 -0
- package/dist/api/__tests__/constants.d.cts +96 -0
- package/dist/api/__tests__/constants.d.ts +96 -0
- package/dist/api/__tests__/constants.js +31 -0
- package/dist/api/__tests__/test-utils.cjs +372 -0
- package/dist/api/__tests__/test-utils.d.cts +99 -0
- package/dist/api/__tests__/test-utils.d.ts +99 -0
- package/dist/api/__tests__/test-utils.js +372 -0
- package/dist/api/client.cjs +4 -4
- package/dist/api/client.js +3 -3
- package/dist/api/gen/types.gen.d.cts +8 -0
- package/dist/api/gen/types.gen.d.ts +8 -0
- package/dist/api/index.cjs +4 -4
- package/dist/api/index.js +3 -3
- package/dist/chains/chains.cjs +8 -4
- package/dist/chains/chains.d.cts +3 -1
- package/dist/chains/chains.d.ts +3 -1
- package/dist/chains/chains.js +7 -3
- package/dist/{chunk-AAESOWQL.js → chunk-57HPJVTI.js} +8 -3
- package/dist/{chunk-ADCODBBF.cjs → chunk-5CBGJLA4.cjs} +1 -1
- package/dist/{chunk-CEFMURL3.js → chunk-6EP3PLGP.js} +2 -2
- package/dist/{chunk-ZJZO6LQ3.js → chunk-7EZZGCYI.js} +10 -1
- package/dist/{chunk-THLRRDVV.js → chunk-7NKX266V.js} +39 -5
- package/dist/{chunk-5CTWIW7X.js → chunk-BBYNVHFR.js} +3 -3
- package/dist/{chunk-PUXRHELK.cjs → chunk-C5F6IECX.cjs} +12 -12
- package/dist/{chunk-GROJZ247.cjs → chunk-DIM3X4IX.cjs} +13 -5
- package/dist/{chunk-OPKBL6A2.cjs → chunk-EIZVQAZO.cjs} +54 -20
- package/dist/{chunk-VJ2ZKU3R.js → chunk-ETCH6L2Y.js} +5 -5
- package/dist/{chunk-SWPJZ5JX.cjs → chunk-FQV77LH4.cjs} +3 -3
- package/dist/chunk-G6QJHFSY.cjs +74 -0
- package/dist/{chunk-FV4PV7HU.cjs → chunk-JLW3Q65G.cjs} +6 -6
- package/dist/{chunk-FUMQWMQR.cjs → chunk-JZQYCISB.cjs} +9 -9
- package/dist/{chunk-SEGDDAL2.js → chunk-KE6LX37B.js} +1 -1
- package/dist/{chunk-3PI54IUS.js → chunk-L5IMC3NM.js} +2 -2
- package/dist/{chunk-KIS2P5DM.js → chunk-N65K6TUY.js} +10 -1
- package/dist/{chunk-PST7R25G.cjs → chunk-NXST74TX.cjs} +80 -43
- package/dist/chunk-PJOJIRTY.js +74 -0
- package/dist/{chunk-SGKMU5NX.cjs → chunk-REP547HH.cjs} +36 -13
- package/dist/{chunk-B24CPC6Y.js → chunk-S2AKC2CK.js} +1 -1
- package/dist/{chunk-PCZDMOJH.js → chunk-SUJQZWLJ.js} +2 -2
- package/dist/{chunk-BEJB6ZUK.cjs → chunk-TCNXKNBQ.cjs} +7 -7
- package/dist/{chunk-5TYDRD6D.cjs → chunk-VNPL3HFN.cjs} +12 -3
- package/dist/{chunk-G7TC2YMQ.cjs → chunk-VWENCGQO.cjs} +12 -3
- package/dist/{chunk-LKAE7D7W.js → chunk-W3OYA42M.js} +32 -9
- package/dist/{chunk-ZQACPBUW.js → chunk-XEZBA7I2.js} +58 -21
- package/dist/{chunk-5WJE5X7V.cjs → chunk-XQSMZXBR.cjs} +28 -23
- package/dist/{chunk-NJTKHWXR.js → chunk-XSMIDXUA.js} +15 -7
- package/dist/{chunk-UWKMOJ4D.js → chunk-YF4DYTBM.js} +10 -1
- package/dist/{chunk-2RVPHSR5.cjs → chunk-YFOUZXSM.cjs} +12 -3
- package/dist/{chunk-SB5FTFPM.cjs → chunk-YXFIZNFL.cjs} +9 -9
- package/dist/index.cjs +18 -18
- package/dist/index.js +17 -17
- package/dist/logger/index.cjs +3 -3
- package/dist/logger/index.js +2 -2
- package/dist/logger/init.cjs +3 -3
- package/dist/logger/init.js +2 -2
- package/dist/sdk.cjs +17 -12
- package/dist/sdk.js +16 -11
- package/dist/signers/index.cjs +8 -8
- package/dist/signers/index.js +7 -7
- package/dist/signers/non-custodial/index.cjs +7 -7
- package/dist/signers/non-custodial/index.js +8 -8
- package/dist/signers/non-custodial/ncs-evm-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-evm-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-signer.cjs +4 -4
- package/dist/signers/non-custodial/ncs-signer.js +3 -3
- package/dist/signers/non-custodial/ncs-solana-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-solana-signer.js +4 -4
- package/dist/signers/non-custodial/ncs-stellar-signer.cjs +5 -5
- package/dist/signers/non-custodial/ncs-stellar-signer.js +4 -4
- package/dist/utils/constants.cjs +2 -2
- package/dist/utils/constants.js +1 -1
- package/dist/wallets/__tests__/test-helpers.cjs +10 -8
- package/dist/wallets/__tests__/test-helpers.d.cts +2 -1
- package/dist/wallets/__tests__/test-helpers.d.ts +2 -1
- package/dist/wallets/__tests__/test-helpers.js +9 -7
- package/dist/wallets/evm.cjs +12 -12
- package/dist/wallets/evm.d.cts +20 -0
- package/dist/wallets/evm.d.ts +20 -0
- package/dist/wallets/evm.js +11 -11
- package/dist/wallets/solana.cjs +9 -9
- package/dist/wallets/solana.d.cts +5 -0
- package/dist/wallets/solana.d.ts +5 -0
- package/dist/wallets/solana.js +8 -8
- package/dist/wallets/stellar.cjs +9 -9
- package/dist/wallets/stellar.d.cts +5 -0
- package/dist/wallets/stellar.d.ts +5 -0
- package/dist/wallets/stellar.js +8 -8
- package/dist/wallets/types.d.cts +5 -1
- package/dist/wallets/types.d.ts +5 -1
- package/dist/wallets/wallet-factory.cjs +15 -10
- package/dist/wallets/wallet-factory.d.cts +2 -0
- package/dist/wallets/wallet-factory.d.ts +2 -0
- package/dist/wallets/wallet-factory.js +14 -9
- package/dist/wallets/wallet.cjs +8 -8
- package/dist/wallets/wallet.d.cts +6 -2
- package/dist/wallets/wallet.d.ts +6 -2
- package/dist/wallets/wallet.js +7 -7
- package/package.json +4 -4
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { MockedFunction } from 'vitest';
|
|
2
|
+
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
|
+
import { ApiClient } from '../client.cjs';
|
|
4
|
+
import { CreateWalletResponse, SendResponse, CreateWalletParams, WalletLocator, FundWalletResponse, GetTransactionResponse } from '../types.cjs';
|
|
5
|
+
import '../../chains/chains.cjs';
|
|
6
|
+
import 'viem';
|
|
7
|
+
import '../gen/types.gen.cjs';
|
|
8
|
+
|
|
9
|
+
type MockResponseOptions<T> = {
|
|
10
|
+
data: T;
|
|
11
|
+
status?: number;
|
|
12
|
+
ok?: boolean;
|
|
13
|
+
statusText?: string;
|
|
14
|
+
};
|
|
15
|
+
type FetchCallInfo = {
|
|
16
|
+
path: string;
|
|
17
|
+
options: RequestInit;
|
|
18
|
+
};
|
|
19
|
+
declare const createMockResponse: <T>({ data, status, ok, statusText, }: MockResponseOptions<T>) => Response;
|
|
20
|
+
declare const createMockSuccessResponse: <T>(data: T) => Response;
|
|
21
|
+
declare const createMockErrorResponse: <T>(data: T, status?: number, statusText?: string) => Response;
|
|
22
|
+
declare const createMockCrossmint: (overrides?: Partial<Crossmint>) => Crossmint;
|
|
23
|
+
declare const createTestApiClient: (crossmint?: Crossmint) => ApiClient;
|
|
24
|
+
declare const createServerSideApiClient: () => ApiClient;
|
|
25
|
+
declare const extractFetchCall: (mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => FetchCallInfo | undefined;
|
|
26
|
+
declare const expectRequestPath: (call: FetchCallInfo | undefined, expectedPath: string) => void;
|
|
27
|
+
declare const expectCommonHeaders: (headers: HeadersInit) => void;
|
|
28
|
+
declare const expectRequestBody: (options: RequestInit, expectedBody: unknown) => void;
|
|
29
|
+
declare const validateRequest: (call: FetchCallInfo | undefined, expectedPath: string, expectedBody?: unknown) => void;
|
|
30
|
+
declare const testHttpErrorResponse: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>, errorData: {
|
|
31
|
+
error: boolean;
|
|
32
|
+
message?: string;
|
|
33
|
+
}, statusCode: number) => Promise<void>;
|
|
34
|
+
declare const testCommonHttpErrors: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>, skipStatuses?: number[]) => Promise<void>;
|
|
35
|
+
declare const testNetworkError: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => Promise<void>;
|
|
36
|
+
declare const testInvalidJsonResponse: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => Promise<void>;
|
|
37
|
+
declare const testTimeoutError: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => Promise<void>;
|
|
38
|
+
declare const testMalformedResponse: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>, malformedData: unknown) => Promise<void>;
|
|
39
|
+
declare const createMockWalletResponse: (overrides?: Partial<CreateWalletResponse>) => CreateWalletResponse;
|
|
40
|
+
declare const createMockSendResponse: (overrides?: Partial<SendResponse>) => SendResponse;
|
|
41
|
+
interface ErrorResponse {
|
|
42
|
+
error: true;
|
|
43
|
+
message?: string;
|
|
44
|
+
details?: unknown;
|
|
45
|
+
}
|
|
46
|
+
interface SuccessWalletResponse {
|
|
47
|
+
address: string;
|
|
48
|
+
chainType: string;
|
|
49
|
+
type: string;
|
|
50
|
+
config?: {
|
|
51
|
+
adminSigner?: {
|
|
52
|
+
type: string;
|
|
53
|
+
address: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface SuccessTransactionResponse {
|
|
58
|
+
id: string;
|
|
59
|
+
status: string;
|
|
60
|
+
chainType: string;
|
|
61
|
+
}
|
|
62
|
+
declare function isErrorResponse(response: unknown): response is ErrorResponse;
|
|
63
|
+
declare function isSuccessWalletResponse(response: unknown): response is SuccessWalletResponse;
|
|
64
|
+
declare function isSuccessTransactionResponse(response: unknown): response is SuccessTransactionResponse;
|
|
65
|
+
declare const delay: (ms: number) => Promise<unknown>;
|
|
66
|
+
declare const isValidEthereumAddress: (address: string) => boolean;
|
|
67
|
+
declare const isValidSolanaAddress: (address: string) => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Creates an API client for integration tests using environment variables.
|
|
70
|
+
* This is different from createTestApiClient which uses mocked data.
|
|
71
|
+
*/
|
|
72
|
+
declare const createIntegrationApiClient: (apiKey: string, baseUrl?: string, overrides?: Partial<Crossmint>) => ApiClient;
|
|
73
|
+
declare class TestDataFactory {
|
|
74
|
+
private wallets;
|
|
75
|
+
private transactions;
|
|
76
|
+
addWallet(address: string): void;
|
|
77
|
+
addTransaction(id: string): void;
|
|
78
|
+
getWallet(index?: number): string | undefined;
|
|
79
|
+
getTransaction(index?: number): string | undefined;
|
|
80
|
+
hasWallets(): boolean;
|
|
81
|
+
clear(): void;
|
|
82
|
+
}
|
|
83
|
+
declare function ensureWalletExists(apiClient: ApiClient, testData: TestDataFactory, options?: {
|
|
84
|
+
chainType?: "evm" | "solana";
|
|
85
|
+
type?: "mpc" | "smart";
|
|
86
|
+
owner?: string;
|
|
87
|
+
testName?: string;
|
|
88
|
+
}): Promise<string | undefined>;
|
|
89
|
+
declare function createTestWallet(apiClient: ApiClient, testData: TestDataFactory, params: CreateWalletParams): Promise<CreateWalletResponse>;
|
|
90
|
+
declare function expectErrorResponse(response: unknown, message?: string): asserts response is ErrorResponse;
|
|
91
|
+
declare function expectSuccessWalletResponse(response: unknown): asserts response is SuccessWalletResponse;
|
|
92
|
+
declare function expectSuccessTransactionResponse(response: unknown): asserts response is SuccessTransactionResponse;
|
|
93
|
+
declare const fundWallet: (apiClient: ApiClient, walletLocator: WalletLocator, amount: number, token?: "usdc" | "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
94
|
+
declare const approveTransaction: (apiClient: ApiClient, walletLocator: WalletLocator, transactionId: string, maxRetries?: number) => Promise<GetTransactionResponse>;
|
|
95
|
+
declare const fundWalletAndWait: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdc" | "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
96
|
+
declare const sendTokenAndApprove: (apiClient: ApiClient, walletLocator: WalletLocator, tokenLocator: string, recipient: string, amount: string) => Promise<GetTransactionResponse>;
|
|
97
|
+
declare const ensureWalletFunded: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdc" | "usdxm", chain?: string) => Promise<void>;
|
|
98
|
+
|
|
99
|
+
export { type ErrorResponse, type FetchCallInfo, type MockResponseOptions, type SuccessTransactionResponse, type SuccessWalletResponse, TestDataFactory, approveTransaction, createIntegrationApiClient, createMockCrossmint, createMockErrorResponse, createMockResponse, createMockSendResponse, createMockSuccessResponse, createMockWalletResponse, createServerSideApiClient, createTestApiClient, createTestWallet, delay, ensureWalletExists, ensureWalletFunded, expectCommonHeaders, expectErrorResponse, expectRequestBody, expectRequestPath, expectSuccessTransactionResponse, expectSuccessWalletResponse, extractFetchCall, fundWallet, fundWalletAndWait, isErrorResponse, isSuccessTransactionResponse, isSuccessWalletResponse, isValidEthereumAddress, isValidSolanaAddress, sendTokenAndApprove, testCommonHttpErrors, testHttpErrorResponse, testInvalidJsonResponse, testMalformedResponse, testNetworkError, testTimeoutError, validateRequest };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { MockedFunction } from 'vitest';
|
|
2
|
+
import { Crossmint } from '@crossmint/common-sdk-base';
|
|
3
|
+
import { ApiClient } from '../client.js';
|
|
4
|
+
import { CreateWalletResponse, SendResponse, CreateWalletParams, WalletLocator, FundWalletResponse, GetTransactionResponse } from '../types.js';
|
|
5
|
+
import '../../chains/chains.js';
|
|
6
|
+
import 'viem';
|
|
7
|
+
import '../gen/types.gen.js';
|
|
8
|
+
|
|
9
|
+
type MockResponseOptions<T> = {
|
|
10
|
+
data: T;
|
|
11
|
+
status?: number;
|
|
12
|
+
ok?: boolean;
|
|
13
|
+
statusText?: string;
|
|
14
|
+
};
|
|
15
|
+
type FetchCallInfo = {
|
|
16
|
+
path: string;
|
|
17
|
+
options: RequestInit;
|
|
18
|
+
};
|
|
19
|
+
declare const createMockResponse: <T>({ data, status, ok, statusText, }: MockResponseOptions<T>) => Response;
|
|
20
|
+
declare const createMockSuccessResponse: <T>(data: T) => Response;
|
|
21
|
+
declare const createMockErrorResponse: <T>(data: T, status?: number, statusText?: string) => Response;
|
|
22
|
+
declare const createMockCrossmint: (overrides?: Partial<Crossmint>) => Crossmint;
|
|
23
|
+
declare const createTestApiClient: (crossmint?: Crossmint) => ApiClient;
|
|
24
|
+
declare const createServerSideApiClient: () => ApiClient;
|
|
25
|
+
declare const extractFetchCall: (mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => FetchCallInfo | undefined;
|
|
26
|
+
declare const expectRequestPath: (call: FetchCallInfo | undefined, expectedPath: string) => void;
|
|
27
|
+
declare const expectCommonHeaders: (headers: HeadersInit) => void;
|
|
28
|
+
declare const expectRequestBody: (options: RequestInit, expectedBody: unknown) => void;
|
|
29
|
+
declare const validateRequest: (call: FetchCallInfo | undefined, expectedPath: string, expectedBody?: unknown) => void;
|
|
30
|
+
declare const testHttpErrorResponse: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>, errorData: {
|
|
31
|
+
error: boolean;
|
|
32
|
+
message?: string;
|
|
33
|
+
}, statusCode: number) => Promise<void>;
|
|
34
|
+
declare const testCommonHttpErrors: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>, skipStatuses?: number[]) => Promise<void>;
|
|
35
|
+
declare const testNetworkError: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => Promise<void>;
|
|
36
|
+
declare const testInvalidJsonResponse: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => Promise<void>;
|
|
37
|
+
declare const testTimeoutError: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>) => Promise<void>;
|
|
38
|
+
declare const testMalformedResponse: <T>(apiCall: () => Promise<T>, mockFn: MockedFunction<any> | MockedFunction<ApiClient["post"]> | MockedFunction<ApiClient["get"]>, malformedData: unknown) => Promise<void>;
|
|
39
|
+
declare const createMockWalletResponse: (overrides?: Partial<CreateWalletResponse>) => CreateWalletResponse;
|
|
40
|
+
declare const createMockSendResponse: (overrides?: Partial<SendResponse>) => SendResponse;
|
|
41
|
+
interface ErrorResponse {
|
|
42
|
+
error: true;
|
|
43
|
+
message?: string;
|
|
44
|
+
details?: unknown;
|
|
45
|
+
}
|
|
46
|
+
interface SuccessWalletResponse {
|
|
47
|
+
address: string;
|
|
48
|
+
chainType: string;
|
|
49
|
+
type: string;
|
|
50
|
+
config?: {
|
|
51
|
+
adminSigner?: {
|
|
52
|
+
type: string;
|
|
53
|
+
address: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
interface SuccessTransactionResponse {
|
|
58
|
+
id: string;
|
|
59
|
+
status: string;
|
|
60
|
+
chainType: string;
|
|
61
|
+
}
|
|
62
|
+
declare function isErrorResponse(response: unknown): response is ErrorResponse;
|
|
63
|
+
declare function isSuccessWalletResponse(response: unknown): response is SuccessWalletResponse;
|
|
64
|
+
declare function isSuccessTransactionResponse(response: unknown): response is SuccessTransactionResponse;
|
|
65
|
+
declare const delay: (ms: number) => Promise<unknown>;
|
|
66
|
+
declare const isValidEthereumAddress: (address: string) => boolean;
|
|
67
|
+
declare const isValidSolanaAddress: (address: string) => boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Creates an API client for integration tests using environment variables.
|
|
70
|
+
* This is different from createTestApiClient which uses mocked data.
|
|
71
|
+
*/
|
|
72
|
+
declare const createIntegrationApiClient: (apiKey: string, baseUrl?: string, overrides?: Partial<Crossmint>) => ApiClient;
|
|
73
|
+
declare class TestDataFactory {
|
|
74
|
+
private wallets;
|
|
75
|
+
private transactions;
|
|
76
|
+
addWallet(address: string): void;
|
|
77
|
+
addTransaction(id: string): void;
|
|
78
|
+
getWallet(index?: number): string | undefined;
|
|
79
|
+
getTransaction(index?: number): string | undefined;
|
|
80
|
+
hasWallets(): boolean;
|
|
81
|
+
clear(): void;
|
|
82
|
+
}
|
|
83
|
+
declare function ensureWalletExists(apiClient: ApiClient, testData: TestDataFactory, options?: {
|
|
84
|
+
chainType?: "evm" | "solana";
|
|
85
|
+
type?: "mpc" | "smart";
|
|
86
|
+
owner?: string;
|
|
87
|
+
testName?: string;
|
|
88
|
+
}): Promise<string | undefined>;
|
|
89
|
+
declare function createTestWallet(apiClient: ApiClient, testData: TestDataFactory, params: CreateWalletParams): Promise<CreateWalletResponse>;
|
|
90
|
+
declare function expectErrorResponse(response: unknown, message?: string): asserts response is ErrorResponse;
|
|
91
|
+
declare function expectSuccessWalletResponse(response: unknown): asserts response is SuccessWalletResponse;
|
|
92
|
+
declare function expectSuccessTransactionResponse(response: unknown): asserts response is SuccessTransactionResponse;
|
|
93
|
+
declare const fundWallet: (apiClient: ApiClient, walletLocator: WalletLocator, amount: number, token?: "usdc" | "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
94
|
+
declare const approveTransaction: (apiClient: ApiClient, walletLocator: WalletLocator, transactionId: string, maxRetries?: number) => Promise<GetTransactionResponse>;
|
|
95
|
+
declare const fundWalletAndWait: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdc" | "usdxm", chain?: string) => Promise<FundWalletResponse>;
|
|
96
|
+
declare const sendTokenAndApprove: (apiClient: ApiClient, walletLocator: WalletLocator, tokenLocator: string, recipient: string, amount: string) => Promise<GetTransactionResponse>;
|
|
97
|
+
declare const ensureWalletFunded: (apiClient: ApiClient, walletLocator: WalletLocator, amount?: number, token?: "usdc" | "usdxm", chain?: string) => Promise<void>;
|
|
98
|
+
|
|
99
|
+
export { type ErrorResponse, type FetchCallInfo, type MockResponseOptions, type SuccessTransactionResponse, type SuccessWalletResponse, TestDataFactory, approveTransaction, createIntegrationApiClient, createMockCrossmint, createMockErrorResponse, createMockResponse, createMockSendResponse, createMockSuccessResponse, createMockWalletResponse, createServerSideApiClient, createTestApiClient, createTestWallet, delay, ensureWalletExists, ensureWalletFunded, expectCommonHeaders, expectErrorResponse, expectRequestBody, expectRequestPath, expectSuccessTransactionResponse, expectSuccessWalletResponse, extractFetchCall, fundWallet, fundWalletAndWait, isErrorResponse, isSuccessTransactionResponse, isSuccessWalletResponse, isValidEthereumAddress, isValidSolanaAddress, sendTokenAndApprove, testCommonHttpErrors, testHttpErrorResponse, testInvalidJsonResponse, testMalformedResponse, testNetworkError, testTimeoutError, validateRequest };
|
|
@@ -0,0 +1,372 @@
|
|
|
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-6EP3PLGP.js";
|
|
13
|
+
import "../../chunk-SGINWAB6.js";
|
|
14
|
+
import "../../chunk-S2AKC2CK.js";
|
|
15
|
+
import "../../chunk-KE6LX37B.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
|
+
};
|
package/dist/api/client.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkC5F6IECXcjs = require('../chunk-C5F6IECX.cjs');
|
|
4
4
|
require('../chunk-XC2V34TS.cjs');
|
|
5
|
-
require('../chunk-
|
|
6
|
-
require('../chunk-
|
|
5
|
+
require('../chunk-FQV77LH4.cjs');
|
|
6
|
+
require('../chunk-5CBGJLA4.cjs');
|
|
7
7
|
require('../chunk-UO2J2ZB2.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.ApiClient =
|
|
10
|
+
exports.ApiClient = _chunkC5F6IECXcjs.ApiClient;
|
package/dist/api/client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiClient
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-6EP3PLGP.js";
|
|
4
4
|
import "../chunk-SGINWAB6.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-S2AKC2CK.js";
|
|
6
|
+
import "../chunk-KE6LX37B.js";
|
|
7
7
|
import "../chunk-ASE2FXWP.js";
|
|
8
8
|
export {
|
|
9
9
|
ApiClient
|
|
@@ -2610,6 +2610,10 @@ type SendTokenDto = {
|
|
|
2610
2610
|
* Amount of tokens to transfer (in decimal format)
|
|
2611
2611
|
*/
|
|
2612
2612
|
amount?: string;
|
|
2613
|
+
/**
|
|
2614
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2615
|
+
*/
|
|
2616
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2613
2617
|
};
|
|
2614
2618
|
/**
|
|
2615
2619
|
* Base fields for all token transfers
|
|
@@ -2649,6 +2653,10 @@ type SendTokenV2025Dto = {
|
|
|
2649
2653
|
type: 'hash';
|
|
2650
2654
|
value: string;
|
|
2651
2655
|
};
|
|
2656
|
+
/**
|
|
2657
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2658
|
+
*/
|
|
2659
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2652
2660
|
};
|
|
2653
2661
|
/**
|
|
2654
2662
|
* Input for submitting one or more approvals
|
|
@@ -2610,6 +2610,10 @@ type SendTokenDto = {
|
|
|
2610
2610
|
* Amount of tokens to transfer (in decimal format)
|
|
2611
2611
|
*/
|
|
2612
2612
|
amount?: string;
|
|
2613
|
+
/**
|
|
2614
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2615
|
+
*/
|
|
2616
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2613
2617
|
};
|
|
2614
2618
|
/**
|
|
2615
2619
|
* Base fields for all token transfers
|
|
@@ -2649,6 +2653,10 @@ type SendTokenV2025Dto = {
|
|
|
2649
2653
|
type: 'hash';
|
|
2650
2654
|
value: string;
|
|
2651
2655
|
};
|
|
2656
|
+
/**
|
|
2657
|
+
* Specifies the type of transaction. Choose 'direct' for standard interactions or 'regulated-transfer' for operations requiring compliance checks.
|
|
2658
|
+
*/
|
|
2659
|
+
transactionType?: 'direct' | 'regulated-transfer' | 'onramp';
|
|
2652
2660
|
};
|
|
2653
2661
|
/**
|
|
2654
2662
|
* Input for submitting one or more approvals
|
package/dist/api/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-6HXIZLEQ.cjs');
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkC5F6IECXcjs = require('../chunk-C5F6IECX.cjs');
|
|
5
5
|
require('../chunk-XC2V34TS.cjs');
|
|
6
6
|
require('../chunk-ECAM5KTH.cjs');
|
|
7
|
-
require('../chunk-
|
|
8
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-FQV77LH4.cjs');
|
|
8
|
+
require('../chunk-5CBGJLA4.cjs');
|
|
9
9
|
require('../chunk-UO2J2ZB2.cjs');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.ApiClient =
|
|
12
|
+
exports.ApiClient = _chunkC5F6IECXcjs.ApiClient;
|