@coinbase/cdp-sdk 1.10.0 → 1.11.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 +8 -0
- package/README.md +20 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js +18 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +18 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/actions/evm/fund/Quote.js +63 -0
- package/_cjs/actions/evm/fund/Quote.js.map +1 -0
- package/_cjs/actions/evm/fund/fund.js +49 -0
- package/_cjs/actions/evm/fund/fund.js.map +1 -0
- package/_cjs/actions/evm/fund/quoteFund.js +46 -0
- package/_cjs/actions/evm/fund/quoteFund.js.map +1 -0
- package/_cjs/actions/evm/fund/types.js +3 -0
- package/_cjs/actions/evm/fund/types.js.map +1 -0
- package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js +64 -0
- package/_cjs/actions/evm/fund/waitForFundOperationReceipt.js.map +1 -0
- package/_cjs/client/evm/evm.js +1 -0
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/solana/solana.js +4 -1
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +40 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +4 -3
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js +50 -0
- package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.js.map +1 -0
- package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.msw.js +270 -0
- package/_cjs/openapi-client/generated/payments-alpha/payments-alpha.msw.js.map +1 -0
- package/_cjs/openapi-client/index.js +3 -0
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +18 -0
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +18 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/actions/evm/fund/Quote.js +59 -0
- package/_esm/actions/evm/fund/Quote.js.map +1 -0
- package/_esm/actions/evm/fund/fund.js +46 -0
- package/_esm/actions/evm/fund/fund.js.map +1 -0
- package/_esm/actions/evm/fund/quoteFund.js +43 -0
- package/_esm/actions/evm/fund/quoteFund.js.map +1 -0
- package/_esm/actions/evm/fund/types.js +2 -0
- package/_esm/actions/evm/fund/types.js.map +1 -0
- package/_esm/actions/evm/fund/waitForFundOperationReceipt.js +61 -0
- package/_esm/actions/evm/fund/waitForFundOperationReceipt.js.map +1 -0
- package/_esm/client/evm/evm.js +1 -0
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/solana/solana.js +4 -1
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +39 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/index.msw.js +4 -3
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js +42 -0
- package/_esm/openapi-client/generated/payments-alpha/payments-alpha.js.map +1 -0
- package/_esm/openapi-client/generated/payments-alpha/payments-alpha.msw.js +250 -0
- package/_esm/openapi-client/generated/payments-alpha/payments-alpha.msw.js.map +1 -0
- package/_esm/openapi-client/index.js +3 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/types.d.ts +1 -2
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/actions/evm/fund/Quote.d.ts +51 -0
- package/_types/actions/evm/fund/Quote.d.ts.map +1 -0
- package/_types/actions/evm/fund/fund.d.ts +25 -0
- package/_types/actions/evm/fund/fund.d.ts.map +1 -0
- package/_types/actions/evm/fund/quoteFund.d.ts +25 -0
- package/_types/actions/evm/fund/quoteFund.d.ts.map +1 -0
- package/_types/actions/evm/fund/types.d.ts +16 -0
- package/_types/actions/evm/fund/types.d.ts.map +1 -0
- package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts +68 -0
- package/_types/actions/evm/fund/waitForFundOperationReceipt.d.ts.map +1 -0
- package/_types/actions/evm/types.d.ts +65 -0
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +2 -0
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +2 -0
- package/_types/client/solana/solana.types.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +247 -0
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +4 -3
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts +42 -0
- package/_types/openapi-client/generated/payments-alpha/payments-alpha.d.ts.map +1 -0
- package/_types/openapi-client/generated/payments-alpha/payments-alpha.msw.d.ts +20 -0
- package/_types/openapi-client/generated/payments-alpha/payments-alpha.msw.d.ts.map +1 -0
- package/_types/openapi-client/index.d.ts +6 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/types/misc.d.ts +2 -2
- package/_types/types/misc.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmServerAccount.ts +26 -0
- package/accounts/evm/toEvmSmartAccount.ts +26 -0
- package/accounts/evm/types.ts +1 -2
- package/actions/evm/fund/Quote.ts +83 -0
- package/actions/evm/fund/fund.ts +76 -0
- package/actions/evm/fund/quoteFund.ts +81 -0
- package/actions/evm/fund/types.ts +16 -0
- package/actions/evm/fund/waitForFundOperationReceipt.ts +118 -0
- package/actions/evm/types.ts +73 -0
- package/client/evm/evm.ts +1 -0
- package/client/evm/evm.types.ts +2 -0
- package/client/solana/solana.ts +4 -1
- package/client/solana/solana.types.ts +2 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +288 -0
- package/openapi-client/generated/index.msw.ts +4 -3
- package/openapi-client/generated/payments-alpha/payments-alpha.msw.ts +369 -0
- package/openapi-client/generated/payments-alpha/payments-alpha.ts +96 -0
- package/openapi-client/index.ts +3 -0
- package/package.json +1 -1
- package/types/misc.ts +2 -2
- package/version.ts +1 -1
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { CdpOpenApiClientType, Transfer, TransferStatus } from "../../../openapi-client/index.js";
|
|
2
|
+
import { wait, WaitOptions } from "../../../utils/wait.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Options for waiting for a fund operation.
|
|
6
|
+
*/
|
|
7
|
+
export type WaitForFundOperationOptions = {
|
|
8
|
+
/** The ID of the transfer to wait for. */
|
|
9
|
+
transferId: string;
|
|
10
|
+
/** Optional options for the wait operation. */
|
|
11
|
+
waitOptions?: WaitOptions;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents a failed fund operation.
|
|
16
|
+
*/
|
|
17
|
+
export type FailedFundOperation = {
|
|
18
|
+
/** The ID of the transfer. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** The network that the transfer was created on. */
|
|
21
|
+
network: string;
|
|
22
|
+
/** The target amount that will be received. */
|
|
23
|
+
targetAmount: string;
|
|
24
|
+
/** The currency that will be received. */
|
|
25
|
+
targetCurrency: string;
|
|
26
|
+
/** The status of the transfer. */
|
|
27
|
+
status: typeof TransferStatus.failed;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Represents a completed fund operation.
|
|
32
|
+
*/
|
|
33
|
+
export type CompletedFundOperation = {
|
|
34
|
+
/** The ID of the transfer. */
|
|
35
|
+
id: string;
|
|
36
|
+
/** The network that the transfer was created on. */
|
|
37
|
+
network: string;
|
|
38
|
+
/** The target amount that will be received. */
|
|
39
|
+
targetAmount: string;
|
|
40
|
+
/** The currency that will be received. */
|
|
41
|
+
targetCurrency: string;
|
|
42
|
+
/** The status of the transfer. */
|
|
43
|
+
status: typeof TransferStatus.completed;
|
|
44
|
+
/** The transaction hash of the transfer. */
|
|
45
|
+
transactionHash: string;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Represents the return type of the waitForFundOperation function.
|
|
50
|
+
*/
|
|
51
|
+
export type WaitForFundOperationResult = FailedFundOperation | CompletedFundOperation;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Waits for a fund operation to complete or fail.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { waitForFundOperation } from "@coinbase/cdp-sdk";
|
|
59
|
+
*
|
|
60
|
+
* const result = await waitForFundOperation(client, {
|
|
61
|
+
* transferId: "0x1234567890123456789012345678901234567890",
|
|
62
|
+
* waitOptions: {
|
|
63
|
+
* timeoutSeconds: 30,
|
|
64
|
+
* },
|
|
65
|
+
* });
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param {CdpOpenApiClientType} client - The client to use to wait for the fund operation.
|
|
69
|
+
* @param {WaitForFundOperationOptions} options - The options for the wait operation.
|
|
70
|
+
* @returns {Promise<WaitForFundOperationResult>} The result of the fund operation.
|
|
71
|
+
*/
|
|
72
|
+
export async function waitForFundOperationReceipt(
|
|
73
|
+
client: CdpOpenApiClientType,
|
|
74
|
+
options: WaitForFundOperationOptions,
|
|
75
|
+
): Promise<WaitForFundOperationResult> {
|
|
76
|
+
const { transferId } = options;
|
|
77
|
+
|
|
78
|
+
const reload = async () => {
|
|
79
|
+
const response = await client.getPaymentTransfer(transferId);
|
|
80
|
+
return response;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const transform = (operation: Transfer): WaitForFundOperationResult => {
|
|
84
|
+
if (operation.status === TransferStatus.failed) {
|
|
85
|
+
return {
|
|
86
|
+
id: operation.id,
|
|
87
|
+
network: operation.target.network,
|
|
88
|
+
targetAmount: operation.targetAmount,
|
|
89
|
+
targetCurrency: operation.targetCurrency,
|
|
90
|
+
status: operation.status,
|
|
91
|
+
} satisfies FailedFundOperation;
|
|
92
|
+
} else if (operation.status === TransferStatus.completed) {
|
|
93
|
+
return {
|
|
94
|
+
id: operation.id,
|
|
95
|
+
network: operation.target.network,
|
|
96
|
+
targetAmount: operation.targetAmount,
|
|
97
|
+
targetCurrency: operation.targetCurrency,
|
|
98
|
+
status: operation.status,
|
|
99
|
+
transactionHash: operation.transactionHash!,
|
|
100
|
+
} satisfies CompletedFundOperation;
|
|
101
|
+
} else {
|
|
102
|
+
throw new Error("Transfer is not terminal");
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const waitOptions = options.waitOptions || {
|
|
107
|
+
timeoutSeconds: 900,
|
|
108
|
+
intervalSeconds: 1,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
return await wait(reload, isTerminal, transform, waitOptions);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const isTerminal = (operation: Transfer): boolean => {
|
|
115
|
+
return (
|
|
116
|
+
operation.status === TransferStatus.completed || operation.status === TransferStatus.failed
|
|
117
|
+
);
|
|
118
|
+
};
|
package/actions/evm/types.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import { FundOptions } from "./fund/fund.js";
|
|
2
|
+
import { Quote } from "./fund/Quote.js";
|
|
3
|
+
import { QuoteFundOptions } from "./fund/quoteFund.js";
|
|
4
|
+
import { FundOperationResult } from "./fund/types.js";
|
|
5
|
+
import {
|
|
6
|
+
WaitForFundOperationOptions,
|
|
7
|
+
WaitForFundOperationResult,
|
|
8
|
+
} from "./fund/waitForFundOperationReceipt.js";
|
|
1
9
|
import { SendUserOperationOptions, SendUserOperationReturnType } from "./sendUserOperation.js";
|
|
2
10
|
import { GetUserOperationOptions, UserOperation } from "../../client/evm/evm.types.js";
|
|
3
11
|
import { Hex } from "../../types/misc.js";
|
|
@@ -50,6 +58,71 @@ type Actions = {
|
|
|
50
58
|
* ```
|
|
51
59
|
*/
|
|
52
60
|
requestFaucet: (options: Omit<RequestFaucetOptions, "address">) => Promise<RequestFaucetResult>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Gets a quote to fund an EVM account.
|
|
64
|
+
*
|
|
65
|
+
* @param options - The options for the quote fund.
|
|
66
|
+
* @param options.network - The network to fund the account on.
|
|
67
|
+
* @param options.token - The token to fund the account with.
|
|
68
|
+
* @param options.amount - The amount of the token to fund represented as an atomic unit.
|
|
69
|
+
* It's common to use `parseUnits` utils from viem to convert to atomic units.
|
|
70
|
+
* Otherwise, you can pass atomic units directly.
|
|
71
|
+
*
|
|
72
|
+
* @returns A promise that resolves to a Quote object containing details about the funding operation.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const quote = await account.quoteFund({
|
|
77
|
+
* network: "base",
|
|
78
|
+
* token: "usdc",
|
|
79
|
+
* amount: 1000000n,
|
|
80
|
+
* });
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
quoteFund: (options: Omit<QuoteFundOptions, "address">) => Promise<Quote>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Funds an EVM account with the specified token amount.
|
|
87
|
+
*
|
|
88
|
+
* @param options - The options for the fund operation.
|
|
89
|
+
* @param options.network - The network to fund the account on.
|
|
90
|
+
* @param options.token - The token to fund the account with (e.g., 'usdc').
|
|
91
|
+
* @param options.amount - The amount of the token to fund represented as an atomic unit.
|
|
92
|
+
* It's common to use `parseUnits` utils from viem to convert to atomic units.
|
|
93
|
+
* Otherwise, you can pass atomic units directly.
|
|
94
|
+
*
|
|
95
|
+
* @returns A promise that resolves to the fund operation result containing the transfer details.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const fundOperation = await account.fund({
|
|
100
|
+
* network: "base",
|
|
101
|
+
* token: "usdc",
|
|
102
|
+
* amount: 1000000n,
|
|
103
|
+
* });
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
fund: (options: Omit<FundOptions, "address">) => Promise<FundOperationResult>;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Waits for a fund operation to complete and returns the transfer receipt.
|
|
110
|
+
*
|
|
111
|
+
* @param options - The options for the wait for fund operation.
|
|
112
|
+
* @param options.transferId - The ID of the transfer to wait for.
|
|
113
|
+
*
|
|
114
|
+
* @returns A promise that resolves to the completed transfer receipt containing details about the funding operation.
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* const completedTransfer = await account.waitForFundOperationReceipt({
|
|
119
|
+
* transferId: "transfer_123",
|
|
120
|
+
* });
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
waitForFundOperationReceipt(
|
|
124
|
+
options: WaitForFundOperationOptions,
|
|
125
|
+
): Promise<WaitForFundOperationResult>;
|
|
53
126
|
};
|
|
54
127
|
|
|
55
128
|
export type AccountActions = Actions & {
|
package/client/evm/evm.ts
CHANGED
package/client/evm/evm.types.ts
CHANGED
|
@@ -145,6 +145,8 @@ export interface UserOperation {
|
|
|
145
145
|
export interface CreateServerAccountOptions {
|
|
146
146
|
/** The name of the account. */
|
|
147
147
|
name?: string;
|
|
148
|
+
/** The policy ID to apply to the account. */
|
|
149
|
+
accountPolicy?: string;
|
|
148
150
|
/** The idempotency key. */
|
|
149
151
|
idempotencyKey?: string;
|
|
150
152
|
}
|
package/client/solana/solana.ts
CHANGED
|
@@ -56,7 +56,10 @@ export class SolanaClient implements SolanaClientInterface {
|
|
|
56
56
|
*/
|
|
57
57
|
async createAccount(options: CreateAccountOptions = {}): Promise<SolanaAccount> {
|
|
58
58
|
const openApiAccount = await CdpOpenApiClient.createSolanaAccount(
|
|
59
|
-
|
|
59
|
+
{
|
|
60
|
+
name: options.name,
|
|
61
|
+
accountPolicy: options.accountPolicy,
|
|
62
|
+
},
|
|
60
63
|
options.idempotencyKey,
|
|
61
64
|
);
|
|
62
65
|
|
|
@@ -40,6 +40,8 @@ export interface SignatureResult {
|
|
|
40
40
|
export interface CreateAccountOptions {
|
|
41
41
|
/** The name of the account. */
|
|
42
42
|
name?: string;
|
|
43
|
+
/** The policy ID to apply to the account. */
|
|
44
|
+
accountPolicy?: string;
|
|
43
45
|
/** The idempotency key. */
|
|
44
46
|
idempotencyKey?: string;
|
|
45
47
|
}
|
|
@@ -578,6 +578,236 @@ Account names are guaranteed to be unique across all Solana accounts in the deve
|
|
|
578
578
|
policies?: string[];
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
+
/**
|
|
582
|
+
* The action of the payment method.
|
|
583
|
+
*/
|
|
584
|
+
export type PaymentRailAction = (typeof PaymentRailAction)[keyof typeof PaymentRailAction];
|
|
585
|
+
|
|
586
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
587
|
+
export const PaymentRailAction = {
|
|
588
|
+
source: "source",
|
|
589
|
+
target: "target",
|
|
590
|
+
} as const;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* The type of payment method.
|
|
594
|
+
*/
|
|
595
|
+
export type PaymentMethodType = (typeof PaymentMethodType)[keyof typeof PaymentMethodType];
|
|
596
|
+
|
|
597
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
598
|
+
export const PaymentMethodType = {
|
|
599
|
+
card: "card",
|
|
600
|
+
fiat_account: "fiat_account",
|
|
601
|
+
} as const;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* The limit for this payment method being used as a source for transfers.
|
|
605
|
+
*/
|
|
606
|
+
export type PaymentMethodLimitsSourceLimit = {
|
|
607
|
+
/** The amount of the limit. */
|
|
608
|
+
amount?: string;
|
|
609
|
+
/** The currency of the limit. */
|
|
610
|
+
currency?: string;
|
|
611
|
+
};
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* The limit for this payment method being used as a target for transfers.
|
|
615
|
+
*/
|
|
616
|
+
export type PaymentMethodLimitsTargetLimit = {
|
|
617
|
+
/** The amount of the limit. */
|
|
618
|
+
amount?: string;
|
|
619
|
+
/** The currency of the limit. */
|
|
620
|
+
currency?: string;
|
|
621
|
+
};
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* The limits of the payment method.
|
|
625
|
+
*/
|
|
626
|
+
export type PaymentMethodLimits = {
|
|
627
|
+
/** The limit for this payment method being used as a source for transfers. */
|
|
628
|
+
sourceLimit?: PaymentMethodLimitsSourceLimit;
|
|
629
|
+
/** The limit for this payment method being used as a target for transfers. */
|
|
630
|
+
targetLimit?: PaymentMethodLimitsTargetLimit;
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* The fiat payment method object.
|
|
635
|
+
*/
|
|
636
|
+
export interface PaymentMethod {
|
|
637
|
+
/**
|
|
638
|
+
* The ID of the payment method which previously was added.
|
|
639
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
|
|
640
|
+
*/
|
|
641
|
+
id: string;
|
|
642
|
+
/** The type of payment method. */
|
|
643
|
+
type: PaymentMethodType;
|
|
644
|
+
/** The currency of the payment method. */
|
|
645
|
+
currency: string;
|
|
646
|
+
/** The actions for the payment method. */
|
|
647
|
+
actions: PaymentRailAction[];
|
|
648
|
+
/** The limits of the payment method. */
|
|
649
|
+
limits?: PaymentMethodLimits;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* The networks of the asset.
|
|
654
|
+
*/
|
|
655
|
+
export type CryptoRailNetworksItem = {
|
|
656
|
+
/** The name of the network. */
|
|
657
|
+
name?: string;
|
|
658
|
+
/** The chain ID of the network. */
|
|
659
|
+
chainId?: number;
|
|
660
|
+
/** The contract address of the asset on the network. */
|
|
661
|
+
contractAddress?: string;
|
|
662
|
+
};
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* The crypto rails available.
|
|
666
|
+
*/
|
|
667
|
+
export interface CryptoRail {
|
|
668
|
+
/** The currency symbol of the asset. */
|
|
669
|
+
currency: string;
|
|
670
|
+
/** The name of the asset. */
|
|
671
|
+
name: string;
|
|
672
|
+
/** All available networks of the asset. */
|
|
673
|
+
networks: CryptoRailNetworksItem[];
|
|
674
|
+
/** The actions for the crypto rail. */
|
|
675
|
+
actions: PaymentRailAction[];
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
/**
|
|
679
|
+
* The fiat payment method request object.
|
|
680
|
+
*/
|
|
681
|
+
export interface PaymentMethodRequest {
|
|
682
|
+
/**
|
|
683
|
+
* The ID of the payment method.
|
|
684
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
|
|
685
|
+
*/
|
|
686
|
+
id: string;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* The source of the transfer.
|
|
691
|
+
*/
|
|
692
|
+
export type TransferSource = PaymentMethodRequest;
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* The crypto rail input object which specifies the symbol, network, and address which is the source or destination wallet address.
|
|
696
|
+
*/
|
|
697
|
+
export interface CryptoRailAddress {
|
|
698
|
+
/** The symbol of the currency of the payment rail. */
|
|
699
|
+
currency: string;
|
|
700
|
+
/** The network of the payment rail. */
|
|
701
|
+
network: string;
|
|
702
|
+
/** The address of the payment rail. This is the source or destination wallet address. It is not a contract address. */
|
|
703
|
+
address: string;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
/**
|
|
707
|
+
* The target of the transfer.
|
|
708
|
+
*/
|
|
709
|
+
export type TransferTarget = CryptoRailAddress;
|
|
710
|
+
|
|
711
|
+
/**
|
|
712
|
+
* The type of fee.
|
|
713
|
+
*/
|
|
714
|
+
export type FeeType = (typeof FeeType)[keyof typeof FeeType];
|
|
715
|
+
|
|
716
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
717
|
+
export const FeeType = {
|
|
718
|
+
exchange_fee: "exchange_fee",
|
|
719
|
+
network_fee: "network_fee",
|
|
720
|
+
} as const;
|
|
721
|
+
|
|
722
|
+
/**
|
|
723
|
+
* The fee for the transfer.
|
|
724
|
+
*/
|
|
725
|
+
export interface Fee {
|
|
726
|
+
/** The type of fee. */
|
|
727
|
+
type: FeeType;
|
|
728
|
+
/** The amount of the fee. */
|
|
729
|
+
amount: string;
|
|
730
|
+
/** The currency of the fee. */
|
|
731
|
+
currency: string;
|
|
732
|
+
/** The description of the fee. */
|
|
733
|
+
description?: string;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* The type of the source of the transfer.
|
|
738
|
+
*/
|
|
739
|
+
export type TransferSourceType = (typeof TransferSourceType)[keyof typeof TransferSourceType];
|
|
740
|
+
|
|
741
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
742
|
+
export const TransferSourceType = {
|
|
743
|
+
payment_method: "payment_method",
|
|
744
|
+
} as const;
|
|
745
|
+
|
|
746
|
+
/**
|
|
747
|
+
* The type of the target of the transfer.
|
|
748
|
+
*/
|
|
749
|
+
export type TransferTargetType = (typeof TransferTargetType)[keyof typeof TransferTargetType];
|
|
750
|
+
|
|
751
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
752
|
+
export const TransferTargetType = {
|
|
753
|
+
crypto_rail: "crypto_rail",
|
|
754
|
+
} as const;
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
|
+
* The status of the transfer.
|
|
758
|
+
*/
|
|
759
|
+
export type TransferStatus = (typeof TransferStatus)[keyof typeof TransferStatus];
|
|
760
|
+
|
|
761
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
762
|
+
export const TransferStatus = {
|
|
763
|
+
created: "created",
|
|
764
|
+
pending: "pending",
|
|
765
|
+
started: "started",
|
|
766
|
+
completed: "completed",
|
|
767
|
+
failed: "failed",
|
|
768
|
+
} as const;
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
|
+
* The transfer object.
|
|
772
|
+
*/
|
|
773
|
+
export interface Transfer {
|
|
774
|
+
/**
|
|
775
|
+
* The ID of the transfer.
|
|
776
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
|
|
777
|
+
*/
|
|
778
|
+
id: string;
|
|
779
|
+
/** The type of the source of the transfer. */
|
|
780
|
+
sourceType: TransferSourceType;
|
|
781
|
+
/** The source of the transfer. */
|
|
782
|
+
source: PaymentMethodRequest;
|
|
783
|
+
/** The type of the target of the transfer. */
|
|
784
|
+
targetType: TransferTargetType;
|
|
785
|
+
/** The target of the transfer. */
|
|
786
|
+
target: CryptoRailAddress;
|
|
787
|
+
/** The amount the source will transfer. */
|
|
788
|
+
sourceAmount: string;
|
|
789
|
+
/** The currency the source will transfer. */
|
|
790
|
+
sourceCurrency: string;
|
|
791
|
+
/** The amount the target will receive. */
|
|
792
|
+
targetAmount: string;
|
|
793
|
+
/** The currency the target will receive. */
|
|
794
|
+
targetCurrency: string;
|
|
795
|
+
/** The amount the customer put in to transfer. */
|
|
796
|
+
userAmount: string;
|
|
797
|
+
/** The currency the customer put in to transfer. */
|
|
798
|
+
userCurrency: string;
|
|
799
|
+
/** The fees for the transfer. */
|
|
800
|
+
fees: Fee[];
|
|
801
|
+
/** The status of the transfer. */
|
|
802
|
+
status: TransferStatus;
|
|
803
|
+
/** The UTC date and time in ISO 8601 format the transfer was created. */
|
|
804
|
+
createdAt: string;
|
|
805
|
+
/** The UTC date and time in ISO 8601 format the transfer was updated. */
|
|
806
|
+
updatedAt: string;
|
|
807
|
+
/** The transaction hash or transaction signature of the transfer. */
|
|
808
|
+
transactionHash?: string;
|
|
809
|
+
}
|
|
810
|
+
|
|
581
811
|
/**
|
|
582
812
|
* Internal server error.
|
|
583
813
|
*/
|
|
@@ -645,6 +875,11 @@ Account names must be unique across all EVM accounts in the developer's CDP Proj
|
|
|
645
875
|
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
646
876
|
*/
|
|
647
877
|
name?: string;
|
|
878
|
+
/**
|
|
879
|
+
* The ID of the account-level policy to apply to the account.
|
|
880
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
|
|
881
|
+
*/
|
|
882
|
+
accountPolicy?: string;
|
|
648
883
|
};
|
|
649
884
|
|
|
650
885
|
export type UpdateEvmAccountBody = {
|
|
@@ -936,6 +1171,11 @@ Account names must be unique across all Solana accounts in the developer's CDP P
|
|
|
936
1171
|
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
937
1172
|
*/
|
|
938
1173
|
name?: string;
|
|
1174
|
+
/**
|
|
1175
|
+
* The ID of the account-level policy to apply to the account.
|
|
1176
|
+
* @pattern ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
|
|
1177
|
+
*/
|
|
1178
|
+
accountPolicy?: string;
|
|
939
1179
|
};
|
|
940
1180
|
|
|
941
1181
|
export type UpdateSolanaAccountBody = {
|
|
@@ -998,3 +1238,51 @@ export type RequestSolanaFaucet200 = {
|
|
|
998
1238
|
/** The signature identifying the transaction that requested the funds. */
|
|
999
1239
|
transactionSignature: string;
|
|
1000
1240
|
};
|
|
1241
|
+
|
|
1242
|
+
export type GetCryptoRailsParams = {
|
|
1243
|
+
/**
|
|
1244
|
+
* Comma separated list of networks to filter the rails by.
|
|
1245
|
+
*/
|
|
1246
|
+
networks?: string;
|
|
1247
|
+
};
|
|
1248
|
+
|
|
1249
|
+
/**
|
|
1250
|
+
* The type of the source of the transfer.
|
|
1251
|
+
*/
|
|
1252
|
+
export type CreatePaymentTransferQuoteBodySourceType =
|
|
1253
|
+
(typeof CreatePaymentTransferQuoteBodySourceType)[keyof typeof CreatePaymentTransferQuoteBodySourceType];
|
|
1254
|
+
|
|
1255
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1256
|
+
export const CreatePaymentTransferQuoteBodySourceType = {
|
|
1257
|
+
payment_method: "payment_method",
|
|
1258
|
+
} as const;
|
|
1259
|
+
|
|
1260
|
+
/**
|
|
1261
|
+
* The type of the target of the transfer.
|
|
1262
|
+
*/
|
|
1263
|
+
export type CreatePaymentTransferQuoteBodyTargetType =
|
|
1264
|
+
(typeof CreatePaymentTransferQuoteBodyTargetType)[keyof typeof CreatePaymentTransferQuoteBodyTargetType];
|
|
1265
|
+
|
|
1266
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1267
|
+
export const CreatePaymentTransferQuoteBodyTargetType = {
|
|
1268
|
+
crypto_rail: "crypto_rail",
|
|
1269
|
+
} as const;
|
|
1270
|
+
|
|
1271
|
+
export type CreatePaymentTransferQuoteBody = {
|
|
1272
|
+
/** The type of the source of the transfer. */
|
|
1273
|
+
sourceType: CreatePaymentTransferQuoteBodySourceType;
|
|
1274
|
+
source: TransferSource;
|
|
1275
|
+
/** The type of the target of the transfer. */
|
|
1276
|
+
targetType: CreatePaymentTransferQuoteBodyTargetType;
|
|
1277
|
+
target: TransferTarget;
|
|
1278
|
+
/** The amount of the transfer, which is either for the source currency to buy, or the target currency to receive. */
|
|
1279
|
+
amount: string;
|
|
1280
|
+
/** The currency of the transfer. This can be specified as the source currency, which would be used to buy, or else the target currency, which is how much will be received. */
|
|
1281
|
+
currency: string;
|
|
1282
|
+
/** Whether to execute the transfer. If true, the transfer will be committed and executed. If false, the quote will be generated and returned. */
|
|
1283
|
+
execute?: boolean;
|
|
1284
|
+
};
|
|
1285
|
+
|
|
1286
|
+
export type CreatePaymentTransferQuote201 = {
|
|
1287
|
+
transfer: Transfer;
|
|
1288
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
2
1
|
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
3
|
-
export * from "./evm-
|
|
2
|
+
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
4
3
|
export * from "./faucets/faucets.msw.js";
|
|
5
|
-
export * from "./policy-engine/policy-engine.msw.js";
|
|
6
4
|
export * from "./solana-accounts/solana-accounts.msw.js";
|
|
5
|
+
export * from "./payments-alpha/payments-alpha.msw.js";
|
|
6
|
+
export * from "./policy-engine/policy-engine.msw.js";
|
|
7
|
+
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|