@coinbase/cdp-sdk 1.28.0 → 1.29.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/CHANGELOG.md +6 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js +1 -1
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/solana/toSolanaAccount.js +30 -0
- package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
- package/_cjs/actions/Quote.js +106 -0
- package/_cjs/actions/Quote.js.map +1 -0
- package/_cjs/actions/evm/fund/fund.js +5 -5
- package/_cjs/actions/evm/fund/fund.js.map +1 -1
- package/_cjs/actions/evm/fund/quoteFund.js +7 -7
- package/_cjs/actions/evm/fund/quoteFund.js.map +1 -1
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js +1 -0
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
- package/_cjs/actions/solana/fund/fund.js +50 -0
- package/_cjs/actions/solana/fund/fund.js.map +1 -0
- package/_cjs/actions/solana/fund/quoteFund.js +47 -0
- package/_cjs/actions/solana/fund/quoteFund.js.map +1 -0
- package/{_esm/actions/evm/fund → _cjs/actions}/types.js.map +1 -1
- package/_cjs/actions/{evm/fund/waitForFundOperationReceipt.js → waitForFundOperationReceipt.js} +2 -2
- package/_cjs/actions/waitForFundOperationReceipt.js.map +1 -0
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +15 -6
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +4 -3
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/solana/toSolanaAccount.js +30 -0
- package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
- package/_esm/actions/Quote.js +101 -0
- package/_esm/actions/Quote.js.map +1 -0
- package/_esm/actions/evm/fund/fund.js +5 -5
- package/_esm/actions/evm/fund/fund.js.map +1 -1
- package/_esm/actions/evm/fund/quoteFund.js +7 -7
- package/_esm/actions/evm/fund/quoteFund.js.map +1 -1
- package/_esm/actions/evm/transfer/accountTransferStrategy.js +1 -0
- package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
- package/_esm/actions/solana/fund/fund.js +47 -0
- package/_esm/actions/solana/fund/fund.js.map +1 -0
- package/_esm/actions/solana/fund/quoteFund.js +44 -0
- package/_esm/actions/solana/fund/quoteFund.js.map +1 -0
- package/{_cjs/actions/evm/fund → _esm/actions}/types.js.map +1 -1
- package/_esm/actions/{evm/fund/waitForFundOperationReceipt.js → waitForFundOperationReceipt.js} +2 -2
- package/_esm/actions/waitForFundOperationReceipt.js.map +1 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +14 -5
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +4 -3
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/types.d.ts +9 -9
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
- package/_types/actions/Quote.d.ts +97 -0
- package/_types/actions/Quote.d.ts.map +1 -0
- package/_types/actions/evm/fund/fund.d.ts +3 -7
- package/_types/actions/evm/fund/fund.d.ts.map +1 -1
- package/_types/actions/evm/fund/quoteFund.d.ts +4 -7
- package/_types/actions/evm/fund/quoteFund.d.ts.map +1 -1
- package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
- package/_types/actions/evm/types.d.ts +7 -7
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/actions/solana/fund/fund.d.ts +19 -0
- package/_types/actions/solana/fund/fund.d.ts.map +1 -0
- package/_types/actions/solana/fund/quoteFund.d.ts +20 -0
- package/_types/actions/solana/fund/quoteFund.d.ts.map +1 -0
- package/_types/actions/solana/types.d.ts +61 -0
- package/_types/actions/solana/types.d.ts.map +1 -1
- package/_types/actions/types.d.ts +37 -0
- package/_types/actions/types.d.ts.map +1 -0
- package/_types/actions/{evm/fund/waitForFundOperationReceipt.d.ts → waitForFundOperationReceipt.d.ts} +2 -2
- package/_types/actions/waitForFundOperationReceipt.d.ts.map +1 -0
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +26 -22
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmServerAccount.ts +11 -11
- package/accounts/evm/toEvmSmartAccount.ts +11 -11
- package/accounts/evm/toNetworkScopedEvmServerAccount.ts +5 -5
- package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +6 -6
- package/accounts/evm/types.ts +16 -12
- package/accounts/solana/toSolanaAccount.ts +41 -0
- package/actions/Quote.ts +154 -0
- package/actions/evm/fund/fund.ts +10 -14
- package/actions/evm/fund/quoteFund.ts +13 -16
- package/actions/evm/transfer/accountTransferStrategy.ts +2 -0
- package/actions/evm/types.ts +7 -7
- package/actions/solana/fund/fund.ts +71 -0
- package/actions/solana/fund/quoteFund.ts +77 -0
- package/actions/solana/types.ts +69 -0
- package/actions/types.ts +39 -0
- package/actions/{evm/fund/waitForFundOperationReceipt.ts → waitForFundOperationReceipt.ts} +2 -2
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +30 -30
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +4 -3
- package/package.json +1 -1
- package/version.ts +1 -1
- package/_cjs/actions/evm/fund/Quote.js +0 -63
- package/_cjs/actions/evm/fund/Quote.js.map +0 -1
- package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js.map +0 -1
- package/_esm/actions/evm/fund/Quote.js +0 -59
- package/_esm/actions/evm/fund/Quote.js.map +0 -1
- package/_esm/actions/evm/fund/waitForFundOperationReceipt.js.map +0 -1
- package/_types/actions/evm/fund/Quote.d.ts +0 -51
- package/_types/actions/evm/fund/Quote.d.ts.map +0 -1
- package/_types/actions/evm/fund/types.d.ts +0 -16
- package/_types/actions/evm/fund/types.d.ts.map +0 -1
- package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts.map +0 -1
- package/actions/evm/fund/Quote.ts +0 -83
- package/actions/evm/fund/types.ts +0 -16
- /package/_cjs/actions/{evm/fund/types.js → types.js} +0 -0
- /package/_esm/actions/{evm/fund/types.js → types.js} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { formatUnits } from "viem";
|
|
2
|
+
|
|
3
|
+
import { UserInputValidationError } from "../../../errors.js";
|
|
4
|
+
import {
|
|
5
|
+
CdpOpenApiClientType,
|
|
6
|
+
CreatePaymentTransferQuoteBodySourceType,
|
|
7
|
+
CreatePaymentTransferQuoteBodyTargetType,
|
|
8
|
+
} from "../../../openapi-client/index.js";
|
|
9
|
+
import { SolanaQuote } from "../../Quote.js";
|
|
10
|
+
import { BaseQuoteFundOptions } from "../../types.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Options for getting a quote to fund a Solana account.
|
|
14
|
+
*/
|
|
15
|
+
export interface SolanaQuoteFundOptions extends BaseQuoteFundOptions {
|
|
16
|
+
/** The token to request funds for. */
|
|
17
|
+
token: "sol" | "usdc";
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Gets a quote to fund a Solana account.
|
|
22
|
+
*
|
|
23
|
+
* @param apiClient - The API client.
|
|
24
|
+
* @param options - The options for getting a quote to fund a Solana account.
|
|
25
|
+
*
|
|
26
|
+
* @returns A promise that resolves to the quote.
|
|
27
|
+
*/
|
|
28
|
+
export async function quoteFund(
|
|
29
|
+
apiClient: CdpOpenApiClientType,
|
|
30
|
+
options: SolanaQuoteFundOptions,
|
|
31
|
+
): Promise<SolanaQuote> {
|
|
32
|
+
if (options.token !== "sol" && options.token !== "usdc") {
|
|
33
|
+
throw new UserInputValidationError("Invalid token, must be sol or usdc");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const decimals = options.token === "sol" ? 9 : 6;
|
|
37
|
+
const amount = formatUnits(options.amount, decimals);
|
|
38
|
+
|
|
39
|
+
const paymentMethods = await apiClient.getPaymentMethods();
|
|
40
|
+
const cardPaymentMethod = paymentMethods.find(
|
|
41
|
+
method => method.type === "card" && method.actions.includes("source"),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
if (!cardPaymentMethod) {
|
|
45
|
+
throw new Error("No card found to fund account");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const response = await apiClient.createPaymentTransferQuote({
|
|
49
|
+
sourceType: CreatePaymentTransferQuoteBodySourceType.payment_method,
|
|
50
|
+
source: {
|
|
51
|
+
id: cardPaymentMethod.id,
|
|
52
|
+
},
|
|
53
|
+
targetType: CreatePaymentTransferQuoteBodyTargetType.crypto_rail,
|
|
54
|
+
target: {
|
|
55
|
+
currency: options.token,
|
|
56
|
+
network: "solana",
|
|
57
|
+
address: options.address,
|
|
58
|
+
},
|
|
59
|
+
amount,
|
|
60
|
+
currency: options.token,
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
return new SolanaQuote(
|
|
64
|
+
apiClient,
|
|
65
|
+
response.transfer.id,
|
|
66
|
+
"solana",
|
|
67
|
+
response.transfer.sourceAmount,
|
|
68
|
+
response.transfer.sourceCurrency,
|
|
69
|
+
response.transfer.targetAmount,
|
|
70
|
+
response.transfer.targetCurrency,
|
|
71
|
+
response.transfer.fees.map(fee => ({
|
|
72
|
+
type: fee.type,
|
|
73
|
+
amount: fee.amount,
|
|
74
|
+
currency: fee.currency,
|
|
75
|
+
})),
|
|
76
|
+
);
|
|
77
|
+
}
|
package/actions/solana/types.ts
CHANGED
|
@@ -5,6 +5,14 @@ import {
|
|
|
5
5
|
SignMessageOptions,
|
|
6
6
|
SignTransactionOptions,
|
|
7
7
|
} from "../../client/solana/solana.types.js";
|
|
8
|
+
import { SolanaQuote } from "../Quote.js";
|
|
9
|
+
import { FundOperationResult } from "../types.js";
|
|
10
|
+
import {
|
|
11
|
+
WaitForFundOperationOptions,
|
|
12
|
+
WaitForFundOperationResult,
|
|
13
|
+
} from "../waitForFundOperationReceipt.js";
|
|
14
|
+
import { SolanaFundOptions } from "./fund/fund.js";
|
|
15
|
+
import { SolanaQuoteFundOptions } from "./fund/quoteFund.js";
|
|
8
16
|
|
|
9
17
|
export type AccountActions = {
|
|
10
18
|
/**
|
|
@@ -112,4 +120,65 @@ export type AccountActions = {
|
|
|
112
120
|
* ```
|
|
113
121
|
*/
|
|
114
122
|
transfer: (options: Omit<TransferOptions, "from">) => Promise<SignatureResult>;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Gets a quote to fund a Solana account.
|
|
126
|
+
*
|
|
127
|
+
* @param options - The options for the quote fund.
|
|
128
|
+
* @param options.token - The token to fund the account with.
|
|
129
|
+
* @param options.amount - The amount of the token to fund represented as an atomic unit.
|
|
130
|
+
* It's common to use `parseUnits` utils from viem to convert to atomic units.
|
|
131
|
+
* Otherwise, you can pass atomic units directly.
|
|
132
|
+
*
|
|
133
|
+
* @returns A promise that resolves to a Quote object containing details about the funding operation.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* const quote = await account.quoteFund({
|
|
138
|
+
* token: "usdc",
|
|
139
|
+
* amount: 1000000n,
|
|
140
|
+
* });
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
quoteFund: (options: Omit<SolanaQuoteFundOptions, "address">) => Promise<SolanaQuote>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Funds a Solana account with the specified token amount.
|
|
147
|
+
*
|
|
148
|
+
* @param options - The options for the fund operation.
|
|
149
|
+
* @param options.token - The token to fund the account with (e.g., 'usdc').
|
|
150
|
+
* @param options.amount - The amount of the token to fund represented as an atomic unit.
|
|
151
|
+
* It's common to use `parseUnits` utils from viem to convert to atomic units.
|
|
152
|
+
* Otherwise, you can pass atomic units directly.
|
|
153
|
+
*
|
|
154
|
+
* @returns A promise that resolves to the fund operation result containing the transfer details.
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const fundOperation = await account.fund({
|
|
159
|
+
* token: "usdc",
|
|
160
|
+
* amount: 1000000n,
|
|
161
|
+
* });
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
fund: (options: Omit<SolanaFundOptions, "address">) => Promise<FundOperationResult>;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Waits for a fund operation to complete and returns the transfer receipt.
|
|
168
|
+
*
|
|
169
|
+
* @param options - The options for the wait for fund operation.
|
|
170
|
+
* @param options.transferId - The ID of the transfer to wait for.
|
|
171
|
+
*
|
|
172
|
+
* @returns A promise that resolves to the completed transfer receipt containing details about the funding operation.
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```ts
|
|
176
|
+
* const completedTransfer = await account.waitForFundOperationReceipt({
|
|
177
|
+
* transferId: "transfer_123",
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
waitForFundOperationReceipt(
|
|
182
|
+
options: WaitForFundOperationOptions,
|
|
183
|
+
): Promise<WaitForFundOperationResult>;
|
|
115
184
|
};
|
package/actions/types.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { TransferStatus } from "../openapi-client/index.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base options for getting a quote to fund an account.
|
|
5
|
+
*/
|
|
6
|
+
export interface BaseQuoteFundOptions {
|
|
7
|
+
/** The address of the account. */
|
|
8
|
+
address: string;
|
|
9
|
+
/** The amount to fund the account with, in atomic units (e.g. wei for ETH, lamports for SOL) of the token. */
|
|
10
|
+
amount: bigint;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Base options for funding an account.
|
|
15
|
+
*/
|
|
16
|
+
export interface BaseFundOptions {
|
|
17
|
+
/** The address of the account. */
|
|
18
|
+
address: string;
|
|
19
|
+
/** The amount to fund the account with, in atomic units (e.g. wei for ETH, lamports for SOL) of the token. */
|
|
20
|
+
amount: bigint;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The result of a fund operation.
|
|
25
|
+
*/
|
|
26
|
+
export type FundOperationResult = {
|
|
27
|
+
/** The transfer that was created to fund the account. */
|
|
28
|
+
id: string;
|
|
29
|
+
/** The network that the transfer was created on. */
|
|
30
|
+
network: string;
|
|
31
|
+
/** The target amount that will be received. */
|
|
32
|
+
targetAmount: string;
|
|
33
|
+
/** The currency that will be received. */
|
|
34
|
+
targetCurrency: string;
|
|
35
|
+
/** The status of the fund operation. */
|
|
36
|
+
status: TransferStatus;
|
|
37
|
+
/** The transaction hash of the transfer. */
|
|
38
|
+
transactionHash?: string;
|
|
39
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CdpOpenApiClientType, Transfer, TransferStatus } from "
|
|
2
|
-
import { wait, WaitOptions } from "
|
|
1
|
+
import { CdpOpenApiClientType, Transfer, TransferStatus } from "../openapi-client/index.js";
|
|
2
|
+
import { wait, WaitOptions } from "../utils/wait.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Options for waiting for a fund operation.
|
|
@@ -57,6 +57,12 @@ export const ErrorType = {
|
|
|
57
57
|
policy_violation: "policy_violation",
|
|
58
58
|
policy_in_use: "policy_in_use",
|
|
59
59
|
account_limit_exceeded: "account_limit_exceeded",
|
|
60
|
+
network_not_tradable: "network_not_tradable",
|
|
61
|
+
guest_permission_denied: "guest_permission_denied",
|
|
62
|
+
guest_region_forbidden: "guest_region_forbidden",
|
|
63
|
+
guest_transaction_limit: "guest_transaction_limit",
|
|
64
|
+
guest_transaction_count: "guest_transaction_count",
|
|
65
|
+
guest_phone_number_verification_expired: "guest_phone_number_verification_expired",
|
|
60
66
|
} as const;
|
|
61
67
|
|
|
62
68
|
/**
|
|
@@ -143,6 +149,26 @@ Account names are guaranteed to be unique across all Smart Accounts in the devel
|
|
|
143
149
|
updatedAt?: string;
|
|
144
150
|
}
|
|
145
151
|
|
|
152
|
+
/**
|
|
153
|
+
* The network the user operation is for.
|
|
154
|
+
*/
|
|
155
|
+
export type EvmUserOperationNetwork =
|
|
156
|
+
(typeof EvmUserOperationNetwork)[keyof typeof EvmUserOperationNetwork];
|
|
157
|
+
|
|
158
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
159
|
+
export const EvmUserOperationNetwork = {
|
|
160
|
+
"base-sepolia": "base-sepolia",
|
|
161
|
+
base: "base",
|
|
162
|
+
arbitrum: "arbitrum",
|
|
163
|
+
optimism: "optimism",
|
|
164
|
+
zora: "zora",
|
|
165
|
+
polygon: "polygon",
|
|
166
|
+
bnb: "bnb",
|
|
167
|
+
avalanche: "avalanche",
|
|
168
|
+
ethereum: "ethereum",
|
|
169
|
+
"ethereum-sepolia": "ethereum-sepolia",
|
|
170
|
+
} as const;
|
|
171
|
+
|
|
146
172
|
export interface EvmCall {
|
|
147
173
|
/**
|
|
148
174
|
* The address the call is directed to.
|
|
@@ -158,18 +184,6 @@ export interface EvmCall {
|
|
|
158
184
|
data: string;
|
|
159
185
|
}
|
|
160
186
|
|
|
161
|
-
/**
|
|
162
|
-
* The network the user operation is for.
|
|
163
|
-
*/
|
|
164
|
-
export type EvmUserOperationNetwork =
|
|
165
|
-
(typeof EvmUserOperationNetwork)[keyof typeof EvmUserOperationNetwork];
|
|
166
|
-
|
|
167
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
168
|
-
export const EvmUserOperationNetwork = {
|
|
169
|
-
"base-sepolia": "base-sepolia",
|
|
170
|
-
base: "base",
|
|
171
|
-
} as const;
|
|
172
|
-
|
|
173
187
|
/**
|
|
174
188
|
* The status of the user operation.
|
|
175
189
|
*/
|
|
@@ -187,7 +201,6 @@ export const EvmUserOperationStatus = {
|
|
|
187
201
|
} as const;
|
|
188
202
|
|
|
189
203
|
export interface EvmUserOperation {
|
|
190
|
-
/** The network the user operation is for. */
|
|
191
204
|
network: EvmUserOperationNetwork;
|
|
192
205
|
/**
|
|
193
206
|
* The hash of the user operation. This is not the transaction hash, as a transaction consists of multiple user operations. The user operation hash is the hash of this particular user operation which gets signed by the owner of the Smart Account.
|
|
@@ -609,7 +622,7 @@ export const EvmAddressCriterionOperator = {
|
|
|
609
622
|
export interface EvmAddressCriterion {
|
|
610
623
|
/** The type of criterion to use. This should be `evmAddress`. */
|
|
611
624
|
type: EvmAddressCriterionType;
|
|
612
|
-
/** A list of 0x-prefixed EVM addresses that the transaction's `to` field should be compared to. There is a limit of
|
|
625
|
+
/** A list of 0x-prefixed EVM addresses that the transaction's `to` field should be compared to. There is a limit of 300 addresses per criterion. */
|
|
613
626
|
addresses: string[];
|
|
614
627
|
/** The operator to use for the comparison. The transaction's `to` field will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
|
|
615
628
|
operator: EvmAddressCriterionOperator;
|
|
@@ -1009,7 +1022,7 @@ export const EvmTypedAddressConditionOperator = {
|
|
|
1009
1022
|
* A schema for specifying criterion for an address field of an EVM typed message. The address can be deeply nested within the typed data's message.
|
|
1010
1023
|
*/
|
|
1011
1024
|
export interface EvmTypedAddressCondition {
|
|
1012
|
-
/** A list of 0x-prefixed EVM addresses that the value located at the message's path should be compared to. There is a limit of
|
|
1025
|
+
/** A list of 0x-prefixed EVM addresses that the value located at the message's path should be compared to. There is a limit of 300 addresses per criterion. */
|
|
1013
1026
|
addresses: string[];
|
|
1014
1027
|
/** The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
|
|
1015
1028
|
operator: EvmTypedAddressConditionOperator;
|
|
@@ -1135,7 +1148,7 @@ export const SignEvmTypedDataVerifyingContractCriterionOperator = {
|
|
|
1135
1148
|
export interface SignEvmTypedDataVerifyingContractCriterion {
|
|
1136
1149
|
/** The type of criterion to use. This should be `evmTypedDataVerifyingContract`. */
|
|
1137
1150
|
type: SignEvmTypedDataVerifyingContractCriterionType;
|
|
1138
|
-
/** A list of 0x-prefixed EVM addresses that the domain's verifying contract should be compared to. There is a limit of
|
|
1151
|
+
/** A list of 0x-prefixed EVM addresses that the domain's verifying contract should be compared to. There is a limit of 300 addresses per criterion. */
|
|
1139
1152
|
addresses: string[];
|
|
1140
1153
|
/** The operator to use for the comparison. The domain's verifying contract will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
|
|
1141
1154
|
operator: SignEvmTypedDataVerifyingContractCriterionOperator;
|
|
@@ -1947,21 +1960,8 @@ Account names must be unique across all EVM smart accounts in the developer's CD
|
|
|
1947
1960
|
name?: string;
|
|
1948
1961
|
};
|
|
1949
1962
|
|
|
1950
|
-
/**
|
|
1951
|
-
* The network to prepare the user operation for.
|
|
1952
|
-
*/
|
|
1953
|
-
export type PrepareUserOperationBodyNetwork =
|
|
1954
|
-
(typeof PrepareUserOperationBodyNetwork)[keyof typeof PrepareUserOperationBodyNetwork];
|
|
1955
|
-
|
|
1956
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1957
|
-
export const PrepareUserOperationBodyNetwork = {
|
|
1958
|
-
"base-sepolia": "base-sepolia",
|
|
1959
|
-
base: "base",
|
|
1960
|
-
} as const;
|
|
1961
|
-
|
|
1962
1963
|
export type PrepareUserOperationBody = {
|
|
1963
|
-
|
|
1964
|
-
network: PrepareUserOperationBodyNetwork;
|
|
1964
|
+
network: EvmUserOperationNetwork;
|
|
1965
1965
|
/** The list of calls to make from the Smart Account. */
|
|
1966
1966
|
calls: EvmCall[];
|
|
1967
1967
|
/** The URL of the paymaster to use for the user operation. */
|
|
@@ -9,6 +9,7 @@ import { faker } from "@faker-js/faker";
|
|
|
9
9
|
|
|
10
10
|
import { HttpResponse, delay, http } from "msw";
|
|
11
11
|
|
|
12
|
+
import { EvmUserOperationNetwork } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
12
13
|
import type {
|
|
13
14
|
EvmSmartAccount,
|
|
14
15
|
EvmUserOperation,
|
|
@@ -172,7 +173,7 @@ export const getUpdateEvmSmartAccountResponseMock = (
|
|
|
172
173
|
export const getPrepareUserOperationResponseMock = (
|
|
173
174
|
overrideResponse: Partial<EvmUserOperation> = {},
|
|
174
175
|
): EvmUserOperation => ({
|
|
175
|
-
network: faker.helpers.arrayElement(
|
|
176
|
+
network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
|
|
176
177
|
userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
|
|
177
178
|
calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
178
179
|
to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
@@ -197,7 +198,7 @@ export const getPrepareUserOperationResponseMock = (
|
|
|
197
198
|
export const getGetUserOperationResponseMock = (
|
|
198
199
|
overrideResponse: Partial<EvmUserOperation> = {},
|
|
199
200
|
): EvmUserOperation => ({
|
|
200
|
-
network: faker.helpers.arrayElement(
|
|
201
|
+
network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
|
|
201
202
|
userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
|
|
202
203
|
calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
203
204
|
to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
@@ -222,7 +223,7 @@ export const getGetUserOperationResponseMock = (
|
|
|
222
223
|
export const getSendUserOperationResponseMock = (
|
|
223
224
|
overrideResponse: Partial<EvmUserOperation> = {},
|
|
224
225
|
): EvmUserOperation => ({
|
|
225
|
-
network: faker.helpers.arrayElement(
|
|
226
|
+
network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
|
|
226
227
|
userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
|
|
227
228
|
calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
228
229
|
to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
package/package.json
CHANGED
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.29.0";
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Quote = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* A class representing a funding quote that can be executed.
|
|
6
|
-
*/
|
|
7
|
-
class Quote {
|
|
8
|
-
/** Quote for the transfer. */
|
|
9
|
-
quoteId;
|
|
10
|
-
/** Network to transfer the funds to. */
|
|
11
|
-
network;
|
|
12
|
-
/** The amount in fiat currency. */
|
|
13
|
-
fiatAmount;
|
|
14
|
-
/** The fiat currency. */
|
|
15
|
-
fiatCurrency;
|
|
16
|
-
/** The amount in the token to transfer. */
|
|
17
|
-
tokenAmount;
|
|
18
|
-
/** The token to transfer. */
|
|
19
|
-
token;
|
|
20
|
-
/** Fees in the token to transfer. */
|
|
21
|
-
fees;
|
|
22
|
-
apiClient;
|
|
23
|
-
/**
|
|
24
|
-
* Creates a new Quote instance.
|
|
25
|
-
*
|
|
26
|
-
* @param apiClient - The API client.
|
|
27
|
-
* @param quoteId - The quote ID.
|
|
28
|
-
* @param network - The network to transfer funds to.
|
|
29
|
-
* @param fiatAmount - The amount in fiat currency.
|
|
30
|
-
* @param fiatCurrency - The fiat currency.
|
|
31
|
-
* @param tokenAmount - The amount in the token to transfer.
|
|
32
|
-
* @param token - The token to transfer.
|
|
33
|
-
* @param fees - Fees for the transfer.
|
|
34
|
-
*/
|
|
35
|
-
constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
|
|
36
|
-
this.apiClient = apiClient;
|
|
37
|
-
this.quoteId = quoteId;
|
|
38
|
-
this.network = network;
|
|
39
|
-
this.fiatAmount = fiatAmount;
|
|
40
|
-
this.fiatCurrency = fiatCurrency;
|
|
41
|
-
this.tokenAmount = tokenAmount;
|
|
42
|
-
this.token = token;
|
|
43
|
-
this.fees = fees;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Executes the quote to perform the actual fund transfer.
|
|
47
|
-
*
|
|
48
|
-
* @returns A promise that resolves to the result of the executed quote.
|
|
49
|
-
*/
|
|
50
|
-
async execute() {
|
|
51
|
-
const transfer = await this.apiClient.executePaymentTransferQuote(this.quoteId);
|
|
52
|
-
return {
|
|
53
|
-
id: transfer.id,
|
|
54
|
-
network: transfer.target.network,
|
|
55
|
-
targetAmount: transfer.targetAmount,
|
|
56
|
-
targetCurrency: transfer.targetCurrency,
|
|
57
|
-
status: transfer.status,
|
|
58
|
-
transactionHash: transfer.transactionHash,
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.Quote = Quote;
|
|
63
|
-
//# sourceMappingURL=Quote.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../../../actions/evm/fund/Quote.ts"],"names":[],"mappings":";;;AAGA;;GAEG;AACH,MAAa,KAAK;IAChB,8BAA8B;IACvB,OAAO,CAAS;IACvB,wCAAwC;IACjC,OAAO,CAAsB;IACpC,mCAAmC;IAC5B,UAAU,CAAS;IAC1B,yBAAyB;IAClB,YAAY,CAAS;IAC5B,2CAA2C;IACpC,WAAW,CAAS;IAC3B,6BAA6B;IACtB,KAAK,CAAS;IACrB,qCAAqC;IAC9B,IAAI,CAKP;IAEI,SAAS,CAAuB;IAExC;;;;;;;;;;;OAWG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,OAA4B,EAC5B,UAAkB,EAClB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,IAIG;QAEH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhF,OAAO;YACL,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO;YAChC,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,eAAe,EAAE,QAAQ,CAAC,eAAe;SAC1C,CAAC;IACJ,CAAC;CACF;AA5ED,sBA4EC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"waitForFundOperationReceipt.js","sourceRoot":"","sources":["../../../../actions/evm/fund/waitForFundOperationReceipt.ts"],"names":[],"mappings":";;AAuEA,kEAwCC;AA/GD,+DAAkG;AAClG,oDAA2D;AAmD3D;;;;;;;;;;;;;;;;;;GAkBG;AACI,KAAK,UAAU,2BAA2B,CAC/C,MAA4B,EAC5B,OAAoC;IAEpC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,SAAmB,EAA8B,EAAE;QACpE,IAAI,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,MAAM,EAAE,CAAC;YAC/C,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;aACK,CAAC;QAClC,CAAC;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,SAAS,EAAE,CAAC;YACzD,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,eAAe,EAAE,SAAS,CAAC,eAAgB;aACX,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI;QACzC,cAAc,EAAE,GAAG;QACnB,eAAe,EAAE,CAAC;KACnB,CAAC;IAEF,OAAO,MAAM,IAAA,cAAI,EAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,SAAmB,EAAW,EAAE;IAClD,OAAO,CACL,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,yBAAc,CAAC,MAAM,CAC5F,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A class representing a funding quote that can be executed.
|
|
3
|
-
*/
|
|
4
|
-
export class Quote {
|
|
5
|
-
/** Quote for the transfer. */
|
|
6
|
-
quoteId;
|
|
7
|
-
/** Network to transfer the funds to. */
|
|
8
|
-
network;
|
|
9
|
-
/** The amount in fiat currency. */
|
|
10
|
-
fiatAmount;
|
|
11
|
-
/** The fiat currency. */
|
|
12
|
-
fiatCurrency;
|
|
13
|
-
/** The amount in the token to transfer. */
|
|
14
|
-
tokenAmount;
|
|
15
|
-
/** The token to transfer. */
|
|
16
|
-
token;
|
|
17
|
-
/** Fees in the token to transfer. */
|
|
18
|
-
fees;
|
|
19
|
-
apiClient;
|
|
20
|
-
/**
|
|
21
|
-
* Creates a new Quote instance.
|
|
22
|
-
*
|
|
23
|
-
* @param apiClient - The API client.
|
|
24
|
-
* @param quoteId - The quote ID.
|
|
25
|
-
* @param network - The network to transfer funds to.
|
|
26
|
-
* @param fiatAmount - The amount in fiat currency.
|
|
27
|
-
* @param fiatCurrency - The fiat currency.
|
|
28
|
-
* @param tokenAmount - The amount in the token to transfer.
|
|
29
|
-
* @param token - The token to transfer.
|
|
30
|
-
* @param fees - Fees for the transfer.
|
|
31
|
-
*/
|
|
32
|
-
constructor(apiClient, quoteId, network, fiatAmount, fiatCurrency, tokenAmount, token, fees) {
|
|
33
|
-
this.apiClient = apiClient;
|
|
34
|
-
this.quoteId = quoteId;
|
|
35
|
-
this.network = network;
|
|
36
|
-
this.fiatAmount = fiatAmount;
|
|
37
|
-
this.fiatCurrency = fiatCurrency;
|
|
38
|
-
this.tokenAmount = tokenAmount;
|
|
39
|
-
this.token = token;
|
|
40
|
-
this.fees = fees;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Executes the quote to perform the actual fund transfer.
|
|
44
|
-
*
|
|
45
|
-
* @returns A promise that resolves to the result of the executed quote.
|
|
46
|
-
*/
|
|
47
|
-
async execute() {
|
|
48
|
-
const transfer = await this.apiClient.executePaymentTransferQuote(this.quoteId);
|
|
49
|
-
return {
|
|
50
|
-
id: transfer.id,
|
|
51
|
-
network: transfer.target.network,
|
|
52
|
-
targetAmount: transfer.targetAmount,
|
|
53
|
-
targetCurrency: transfer.targetCurrency,
|
|
54
|
-
status: transfer.status,
|
|
55
|
-
transactionHash: transfer.transactionHash,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
//# sourceMappingURL=Quote.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Quote.js","sourceRoot":"","sources":["../../../../actions/evm/fund/Quote.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,OAAO,KAAK;IAChB,8BAA8B;IACvB,OAAO,CAAS;IACvB,wCAAwC;IACjC,OAAO,CAAsB;IACpC,mCAAmC;IAC5B,UAAU,CAAS;IAC1B,yBAAyB;IAClB,YAAY,CAAS;IAC5B,2CAA2C;IACpC,WAAW,CAAS;IAC3B,6BAA6B;IACtB,KAAK,CAAS;IACrB,qCAAqC;IAC9B,IAAI,CAKP;IAEI,SAAS,CAAuB;IAExC;;;;;;;;;;;OAWG;IACH,YACE,SAA+B,EAC/B,OAAe,EACf,OAA4B,EAC5B,UAAkB,EAClB,YAAoB,EACpB,WAAmB,EACnB,KAAa,EACb,IAIG;QAEH,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,OAAO;QACX,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,2BAA2B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEhF,OAAO;YACL,EAAE,EAAE,QAAQ,CAAC,EAAE;YACf,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO;YAChC,YAAY,EAAE,QAAQ,CAAC,YAAY;YACnC,cAAc,EAAE,QAAQ,CAAC,cAAc;YACvC,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,eAAe,EAAE,QAAQ,CAAC,eAAe;SAC1C,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"waitForFundOperationReceipt.js","sourceRoot":"","sources":["../../../../actions/evm/fund/waitForFundOperationReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkC,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAE,IAAI,EAAe,MAAM,wBAAwB,CAAC;AAmD3D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,MAA4B,EAC5B,OAAoC;IAEpC,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAE/B,MAAM,MAAM,GAAG,KAAK,IAAI,EAAE;QACxB,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC7D,OAAO,QAAQ,CAAC;IAClB,CAAC,CAAC;IAEF,MAAM,SAAS,GAAG,CAAC,SAAmB,EAA8B,EAAE;QACpE,IAAI,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,EAAE,CAAC;YAC/C,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;aACK,CAAC;QAClC,CAAC;aAAM,IAAI,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,SAAS,EAAE,CAAC;YACzD,OAAO;gBACL,EAAE,EAAE,SAAS,CAAC,EAAE;gBAChB,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,OAAO;gBACjC,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,cAAc,EAAE,SAAS,CAAC,cAAc;gBACxC,MAAM,EAAE,SAAS,CAAC,MAAM;gBACxB,eAAe,EAAE,SAAS,CAAC,eAAgB;aACX,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI;QACzC,cAAc,EAAE,GAAG;QACnB,eAAe,EAAE,CAAC;KACnB,CAAC;IAEF,OAAO,MAAM,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,SAAmB,EAAW,EAAE;IAClD,OAAO,CACL,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,CAC5F,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { FundOperationResult } from "./types.js";
|
|
2
|
-
import { CdpOpenApiClientType } from "../../../openapi-client/index.js";
|
|
3
|
-
/**
|
|
4
|
-
* A class representing a funding quote that can be executed.
|
|
5
|
-
*/
|
|
6
|
-
export declare class Quote {
|
|
7
|
-
/** Quote for the transfer. */
|
|
8
|
-
quoteId: string;
|
|
9
|
-
/** Network to transfer the funds to. */
|
|
10
|
-
network: "base" | "ethereum";
|
|
11
|
-
/** The amount in fiat currency. */
|
|
12
|
-
fiatAmount: string;
|
|
13
|
-
/** The fiat currency. */
|
|
14
|
-
fiatCurrency: string;
|
|
15
|
-
/** The amount in the token to transfer. */
|
|
16
|
-
tokenAmount: string;
|
|
17
|
-
/** The token to transfer. */
|
|
18
|
-
token: string;
|
|
19
|
-
/** Fees in the token to transfer. */
|
|
20
|
-
fees: {
|
|
21
|
-
/** The type of fee. */
|
|
22
|
-
type: "exchange_fee" | "network_fee";
|
|
23
|
-
amount: string;
|
|
24
|
-
currency: string;
|
|
25
|
-
}[];
|
|
26
|
-
private apiClient;
|
|
27
|
-
/**
|
|
28
|
-
* Creates a new Quote instance.
|
|
29
|
-
*
|
|
30
|
-
* @param apiClient - The API client.
|
|
31
|
-
* @param quoteId - The quote ID.
|
|
32
|
-
* @param network - The network to transfer funds to.
|
|
33
|
-
* @param fiatAmount - The amount in fiat currency.
|
|
34
|
-
* @param fiatCurrency - The fiat currency.
|
|
35
|
-
* @param tokenAmount - The amount in the token to transfer.
|
|
36
|
-
* @param token - The token to transfer.
|
|
37
|
-
* @param fees - Fees for the transfer.
|
|
38
|
-
*/
|
|
39
|
-
constructor(apiClient: CdpOpenApiClientType, quoteId: string, network: "base" | "ethereum", fiatAmount: string, fiatCurrency: string, tokenAmount: string, token: string, fees: {
|
|
40
|
-
type: "exchange_fee" | "network_fee";
|
|
41
|
-
amount: string;
|
|
42
|
-
currency: string;
|
|
43
|
-
}[]);
|
|
44
|
-
/**
|
|
45
|
-
* Executes the quote to perform the actual fund transfer.
|
|
46
|
-
*
|
|
47
|
-
* @returns A promise that resolves to the result of the executed quote.
|
|
48
|
-
*/
|
|
49
|
-
execute(): Promise<FundOperationResult>;
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=Quote.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Quote.d.ts","sourceRoot":"","sources":["../../../../actions/evm/fund/Quote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE;;GAEG;AACH,qBAAa,KAAK;IAChB,8BAA8B;IACvB,OAAO,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACjC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAC;IACpC,mCAAmC;IAC5B,UAAU,EAAE,MAAM,CAAC;IAC1B,yBAAyB;IAClB,YAAY,EAAE,MAAM,CAAC;IAC5B,2CAA2C;IACpC,WAAW,EAAE,MAAM,CAAC;IAC3B,6BAA6B;IACtB,KAAK,EAAE,MAAM,CAAC;IACrB,qCAAqC;IAC9B,IAAI,EAAE;QACX,uBAAuB;QACvB,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC;QACrC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;IAEJ,OAAO,CAAC,SAAS,CAAuB;IAExC;;;;;;;;;;;OAWG;gBAED,SAAS,EAAE,oBAAoB,EAC/B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE;QACJ,IAAI,EAAE,cAAc,GAAG,aAAa,CAAC;QACrC,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;KAClB,EAAE;IAYL;;;;OAIG;IACG,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAY9C"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { TransferStatus } from "../../../openapi-client/index.js";
|
|
2
|
-
export type FundOperationResult = {
|
|
3
|
-
/** The transfer that was created to fund the account. */
|
|
4
|
-
id: string;
|
|
5
|
-
/** The network that the transfer was created on. */
|
|
6
|
-
network: string;
|
|
7
|
-
/** The target amount that will be received. */
|
|
8
|
-
targetAmount: string;
|
|
9
|
-
/** The currency that will be received. */
|
|
10
|
-
targetCurrency: string;
|
|
11
|
-
/** The status of the fund operation. */
|
|
12
|
-
status: TransferStatus;
|
|
13
|
-
/** The transaction hash of the transfer. */
|
|
14
|
-
transactionHash?: string;
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../actions/evm/fund/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,MAAM,MAAM,mBAAmB,GAAG;IAChC,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,MAAM,EAAE,cAAc,CAAC;IACvB,4CAA4C;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"waitForFundOperationReceipt.d.ts","sourceRoot":"","sources":["../../../../actions/evm/fund/waitForFundOperationReceipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAY,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClG,OAAO,EAAQ,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG;IACxC,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAC;IACnB,+CAA+C;IAC/C,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,MAAM,EAAE,OAAO,cAAc,CAAC,MAAM,CAAC;CACtC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,cAAc,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,MAAM,EAAE,OAAO,cAAc,CAAC,SAAS,CAAC;IACxC,4CAA4C;IAC5C,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG,mBAAmB,GAAG,sBAAsB,CAAC;AAEtF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,2BAA2B,CAC/C,MAAM,EAAE,oBAAoB,EAC5B,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,CAAC,CAqCrC"}
|