@coinbase/cdp-sdk 1.29.0 → 1.30.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 +10 -0
- package/_cjs/accounts/evm/networkCapabilities.js +101 -0
- package/_cjs/accounts/evm/networkCapabilities.js.map +1 -1
- package/_cjs/accounts/evm/toEvmServerAccount.js +11 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +11 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +10 -0
- package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +10 -0
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/solana/toSolanaAccount.js +11 -1
- package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
- package/_cjs/actions/evm/getUserOperation.js +1 -0
- package/_cjs/actions/evm/getUserOperation.js.map +1 -1
- package/_cjs/actions/evm/spend-permissions/account.use.js +33 -0
- package/_cjs/actions/evm/spend-permissions/account.use.js.map +1 -0
- package/_cjs/actions/evm/spend-permissions/smartAccount.use.js +35 -0
- package/_cjs/actions/evm/spend-permissions/smartAccount.use.js.map +1 -0
- package/_cjs/actions/evm/spend-permissions/types.js +3 -0
- package/_cjs/actions/evm/spend-permissions/types.js.map +1 -0
- package/_cjs/actions/solana/sendTransaction.js +1 -0
- package/_cjs/actions/solana/sendTransaction.js.map +1 -1
- package/_cjs/actions/solana/signTransaction.js +1 -0
- package/_cjs/actions/solana/signTransaction.js.map +1 -1
- package/_cjs/auth/hooks/axios/withAuth.js +3 -0
- package/_cjs/auth/hooks/axios/withAuth.js.map +1 -1
- package/_cjs/auth/utils/http.js +2 -1
- package/_cjs/auth/utils/http.js.map +1 -1
- package/_cjs/client/evm/evm.js +51 -1
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/index.js +5 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +41 -3
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +14 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +72 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +2 -0
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js +30 -0
- package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -0
- package/_cjs/openapi-client/generated/onramp/onramp.msw.js +98 -0
- package/_cjs/openapi-client/generated/onramp/onramp.msw.js.map +1 -0
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js +15 -0
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +69 -0
- package/_cjs/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
- package/_cjs/openapi-client/index.js +2 -0
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/spend-permissions/constants.js +716 -0
- package/_cjs/spend-permissions/constants.js.map +1 -0
- package/_cjs/spend-permissions/types.js +3 -0
- package/_cjs/spend-permissions/types.js.map +1 -0
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/networkCapabilities.js +101 -0
- package/_esm/accounts/evm/networkCapabilities.js.map +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +11 -0
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +11 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +10 -0
- package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +10 -0
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/solana/toSolanaAccount.js +11 -1
- package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
- package/_esm/actions/evm/getUserOperation.js +1 -0
- package/_esm/actions/evm/getUserOperation.js.map +1 -1
- package/_esm/actions/evm/spend-permissions/account.use.js +30 -0
- package/_esm/actions/evm/spend-permissions/account.use.js.map +1 -0
- package/_esm/actions/evm/spend-permissions/smartAccount.use.js +32 -0
- package/_esm/actions/evm/spend-permissions/smartAccount.use.js.map +1 -0
- package/_esm/actions/evm/spend-permissions/types.js +2 -0
- package/_esm/actions/evm/spend-permissions/types.js.map +1 -0
- package/_esm/actions/solana/sendTransaction.js +1 -0
- package/_esm/actions/solana/sendTransaction.js.map +1 -1
- package/_esm/actions/solana/signTransaction.js +1 -0
- package/_esm/actions/solana/signTransaction.js.map +1 -1
- package/_esm/auth/hooks/axios/withAuth.js +3 -0
- package/_esm/auth/hooks/axios/withAuth.js.map +1 -1
- package/_esm/auth/utils/http.js +2 -1
- package/_esm/auth/utils/http.js.map +1 -1
- package/_esm/client/evm/evm.js +51 -1
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/solana/solana.js +2 -2
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/index.js +2 -1
- package/_esm/index.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +39 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +12 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +69 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/index.msw.js +2 -0
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/onramp/onramp.js +25 -0
- package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -0
- package/_esm/openapi-client/generated/onramp/onramp.msw.js +90 -0
- package/_esm/openapi-client/generated/onramp/onramp.msw.js.map +1 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js +11 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.js.map +1 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js +63 -0
- package/_esm/openapi-client/generated/x402-facilitator/x402-facilitator.msw.js.map +1 -0
- package/_esm/openapi-client/index.js +2 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/spend-permissions/constants.js +713 -0
- package/_esm/spend-permissions/constants.js.map +1 -0
- package/_esm/spend-permissions/types.js +2 -0
- package/_esm/spend-permissions/types.js.map +1 -0
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/networkCapabilities.d.ts +101 -0
- package/_types/accounts/evm/networkCapabilities.d.ts.map +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/types.d.ts +6 -0
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
- package/_types/actions/evm/getUserOperation.d.ts.map +1 -1
- package/_types/actions/evm/spend-permissions/account.use.d.ts +15 -0
- package/_types/actions/evm/spend-permissions/account.use.d.ts.map +1 -0
- package/_types/actions/evm/spend-permissions/smartAccount.use.d.ts +15 -0
- package/_types/actions/evm/spend-permissions/smartAccount.use.d.ts.map +1 -0
- package/_types/actions/evm/spend-permissions/types.d.ts +13 -0
- package/_types/actions/evm/spend-permissions/types.d.ts.map +1 -0
- package/_types/actions/evm/types.d.ts +75 -0
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/actions/solana/sendTransaction.d.ts +8 -2
- package/_types/actions/solana/sendTransaction.d.ts.map +1 -1
- package/_types/actions/solana/signTransaction.d.ts +8 -2
- package/_types/actions/solana/signTransaction.d.ts.map +1 -1
- package/_types/actions/solana/types.d.ts +38 -3
- package/_types/actions/solana/types.d.ts.map +1 -1
- package/_types/auth/hooks/axios/withAuth.d.ts.map +1 -1
- package/_types/auth/utils/http.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +19 -1
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +29 -2
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +5 -3
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/index.d.ts +3 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +333 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +7 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +2 -0
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +2 -0
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts +28 -0
- package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -0
- package/_types/openapi-client/generated/onramp/onramp.msw.d.ts +8 -0
- package/_types/openapi-client/generated/onramp/onramp.msw.d.ts.map +1 -0
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts +20 -0
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.d.ts.map +1 -0
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts +6 -0
- package/_types/openapi-client/generated/x402-facilitator/x402-facilitator.msw.d.ts.map +1 -0
- package/_types/openapi-client/index.d.ts +4 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/spend-permissions/constants.d.ts +1357 -0
- package/_types/spend-permissions/constants.d.ts.map +1 -0
- package/_types/spend-permissions/types.d.ts +30 -0
- package/_types/spend-permissions/types.d.ts.map +1 -0
- package/_types/version.d.ts +1 -1
- package/accounts/evm/networkCapabilities.ts +101 -0
- package/accounts/evm/toEvmServerAccount.ts +15 -0
- package/accounts/evm/toEvmSmartAccount.ts +19 -4
- package/accounts/evm/toNetworkScopedEvmServerAccount.ts +15 -0
- package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +15 -0
- package/accounts/evm/types.ts +18 -0
- package/accounts/solana/toSolanaAccount.ts +17 -3
- package/actions/evm/getUserOperation.ts +1 -0
- package/actions/evm/spend-permissions/account.use.ts +48 -0
- package/actions/evm/spend-permissions/smartAccount.use.ts +49 -0
- package/actions/evm/spend-permissions/types.ts +13 -0
- package/actions/evm/types.ts +81 -0
- package/actions/solana/sendTransaction.ts +10 -2
- package/actions/solana/signTransaction.ts +10 -2
- package/actions/solana/types.ts +44 -2
- package/auth/hooks/axios/withAuth.ts +3 -0
- package/auth/utils/http.ts +2 -1
- package/client/evm/evm.ts +61 -1
- package/client/evm/evm.types.ts +31 -0
- package/client/solana/solana.ts +10 -5
- package/index.ts +6 -1
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +375 -1
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +85 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +23 -0
- package/openapi-client/generated/index.msw.ts +2 -0
- package/openapi-client/generated/onramp/onramp.msw.ts +135 -0
- package/openapi-client/generated/onramp/onramp.ts +54 -0
- package/openapi-client/generated/x402-facilitator/x402-facilitator.msw.ts +85 -0
- package/openapi-client/generated/x402-facilitator/x402-facilitator.ts +34 -0
- package/openapi-client/index.ts +2 -0
- package/package.json +1 -1
- package/spend-permissions/constants.ts +713 -0
- package/spend-permissions/types.ts +42 -0
- package/version.ts +1 -1
|
@@ -62,7 +62,7 @@ export const ErrorType = {
|
|
|
62
62
|
guest_region_forbidden: "guest_region_forbidden",
|
|
63
63
|
guest_transaction_limit: "guest_transaction_limit",
|
|
64
64
|
guest_transaction_count: "guest_transaction_count",
|
|
65
|
-
|
|
65
|
+
phone_number_verification_expired: "phone_number_verification_expired",
|
|
66
66
|
} as const;
|
|
67
67
|
|
|
68
68
|
/**
|
|
@@ -184,6 +184,26 @@ export interface EvmCall {
|
|
|
184
184
|
data: string;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
/**
|
|
188
|
+
* The revert data if the user operation has reverted.
|
|
189
|
+
*/
|
|
190
|
+
export interface UserOperationReceiptRevert {
|
|
191
|
+
/**
|
|
192
|
+
* The 0x-prefixed raw hex string.
|
|
193
|
+
* @pattern ^0x[0-9a-fA-F]*$
|
|
194
|
+
*/
|
|
195
|
+
data: string;
|
|
196
|
+
/** Human-readable revert reason if able to decode. */
|
|
197
|
+
message: string;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* The receipt that contains information about the execution of user operation.
|
|
202
|
+
*/
|
|
203
|
+
export interface UserOperationReceipt {
|
|
204
|
+
revert?: UserOperationReceiptRevert;
|
|
205
|
+
}
|
|
206
|
+
|
|
187
207
|
/**
|
|
188
208
|
* The status of the user operation.
|
|
189
209
|
*/
|
|
@@ -216,6 +236,42 @@ export interface EvmUserOperation {
|
|
|
216
236
|
* @pattern ^0x[0-9a-fA-F]{64}$|^$
|
|
217
237
|
*/
|
|
218
238
|
transactionHash?: string;
|
|
239
|
+
/** The list of receipts associated with the user operation. */
|
|
240
|
+
receipts?: UserOperationReceipt[];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface CreateSpendPermissionRequest {
|
|
244
|
+
/** The network of the spend permission. */
|
|
245
|
+
network: string;
|
|
246
|
+
/**
|
|
247
|
+
* Smart account this spend permission is valid for.
|
|
248
|
+
* @pattern ^0x[a-fA-F0-9]{40}$
|
|
249
|
+
*/
|
|
250
|
+
account: string;
|
|
251
|
+
/**
|
|
252
|
+
* Entity that can spend account's tokens.
|
|
253
|
+
* @pattern ^0x[a-fA-F0-9]{40}$
|
|
254
|
+
*/
|
|
255
|
+
spender: string;
|
|
256
|
+
/**
|
|
257
|
+
* Token address (ERC-7528 native token address or ERC-20 contract).
|
|
258
|
+
* @pattern ^0x[a-fA-F0-9]{40}$
|
|
259
|
+
*/
|
|
260
|
+
token: string;
|
|
261
|
+
/** Maximum allowed value to spend, in atomic units for the specified token, within each period. */
|
|
262
|
+
allowance: string;
|
|
263
|
+
/** Time duration for resetting used allowance on a recurring basis (seconds). */
|
|
264
|
+
period: string;
|
|
265
|
+
/** The start time for this spend permission, in Unix seconds. */
|
|
266
|
+
start: string;
|
|
267
|
+
/** The expiration time for this spend permission, in Unix seconds. */
|
|
268
|
+
end: string;
|
|
269
|
+
/** An arbitrary salt to differentiate unique spend permissions with otherwise identical data. */
|
|
270
|
+
salt?: string;
|
|
271
|
+
/** Arbitrary data to include in the permission. */
|
|
272
|
+
extraData?: string;
|
|
273
|
+
/** The paymaster URL of the spend permission. */
|
|
274
|
+
paymasterUrl?: string;
|
|
219
275
|
}
|
|
220
276
|
|
|
221
277
|
/**
|
|
@@ -1498,6 +1554,147 @@ export interface SolanaTokenBalance {
|
|
|
1498
1554
|
token: SolanaToken;
|
|
1499
1555
|
}
|
|
1500
1556
|
|
|
1557
|
+
/**
|
|
1558
|
+
* The version of the x402 protocol.
|
|
1559
|
+
*/
|
|
1560
|
+
export type X402Version = (typeof X402Version)[keyof typeof X402Version];
|
|
1561
|
+
|
|
1562
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1563
|
+
export const X402Version = {
|
|
1564
|
+
NUMBER_1: 1,
|
|
1565
|
+
} as const;
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`.
|
|
1569
|
+
*/
|
|
1570
|
+
export type X402PaymentRequirementsScheme =
|
|
1571
|
+
(typeof X402PaymentRequirementsScheme)[keyof typeof X402PaymentRequirementsScheme];
|
|
1572
|
+
|
|
1573
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1574
|
+
export const X402PaymentRequirementsScheme = {
|
|
1575
|
+
exact: "exact",
|
|
1576
|
+
} as const;
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* The network of the blockchain to send payment on.
|
|
1580
|
+
*/
|
|
1581
|
+
export type X402PaymentRequirementsNetwork =
|
|
1582
|
+
(typeof X402PaymentRequirementsNetwork)[keyof typeof X402PaymentRequirementsNetwork];
|
|
1583
|
+
|
|
1584
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1585
|
+
export const X402PaymentRequirementsNetwork = {
|
|
1586
|
+
"base-sepolia": "base-sepolia",
|
|
1587
|
+
base: "base",
|
|
1588
|
+
} as const;
|
|
1589
|
+
|
|
1590
|
+
/**
|
|
1591
|
+
* The optional JSON schema describing the resource output.
|
|
1592
|
+
*/
|
|
1593
|
+
export type X402PaymentRequirementsOutputSchema = { [key: string]: unknown };
|
|
1594
|
+
|
|
1595
|
+
/**
|
|
1596
|
+
* The optional additional scheme-specific payment info.
|
|
1597
|
+
*/
|
|
1598
|
+
export type X402PaymentRequirementsExtra = { [key: string]: unknown };
|
|
1599
|
+
|
|
1600
|
+
/**
|
|
1601
|
+
* The x402 protocol payment requirements that the resource server expects the client's payment payload to meet.
|
|
1602
|
+
*/
|
|
1603
|
+
export interface X402PaymentRequirements {
|
|
1604
|
+
/** The scheme of the payment protocol to use. Currently, the only supported scheme is `exact`. */
|
|
1605
|
+
scheme: X402PaymentRequirementsScheme;
|
|
1606
|
+
/** The network of the blockchain to send payment on. */
|
|
1607
|
+
network: X402PaymentRequirementsNetwork;
|
|
1608
|
+
/** The maximum amount required to pay for the resource in atomic units of the payment asset. */
|
|
1609
|
+
maxAmountRequired: string;
|
|
1610
|
+
/** The URL of the resource to pay for. */
|
|
1611
|
+
resource: string;
|
|
1612
|
+
/** The description of the resource. */
|
|
1613
|
+
description: string;
|
|
1614
|
+
/** The MIME type of the resource response. */
|
|
1615
|
+
mimeType: string;
|
|
1616
|
+
/** The optional JSON schema describing the resource output. */
|
|
1617
|
+
outputSchema?: X402PaymentRequirementsOutputSchema;
|
|
1618
|
+
/**
|
|
1619
|
+
* The destination to pay value to.
|
|
1620
|
+
|
|
1621
|
+
For EVM networks, payTo will be a 0x-prefixed, checksum EVM address.
|
|
1622
|
+
|
|
1623
|
+
For Solana-based networks, payTo will be a base58-encoded Solana address.
|
|
1624
|
+
* @pattern ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
1625
|
+
*/
|
|
1626
|
+
payTo: string;
|
|
1627
|
+
/** The maximum time in seconds for the resource server to respond. */
|
|
1628
|
+
maxTimeoutSeconds: number;
|
|
1629
|
+
/**
|
|
1630
|
+
* The asset to pay with.
|
|
1631
|
+
|
|
1632
|
+
For EVM networks, the asset will be a 0x-prefixed, checksum EVM address.
|
|
1633
|
+
|
|
1634
|
+
For Solana-based networks, the asset will be a base58-encoded Solana address.
|
|
1635
|
+
* @pattern ^0x[a-fA-F0-9]{40}|[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
1636
|
+
*/
|
|
1637
|
+
asset: string;
|
|
1638
|
+
/** The optional additional scheme-specific payment info. */
|
|
1639
|
+
extra?: X402PaymentRequirementsExtra;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Communication protocol (e.g., "http", "mcp").
|
|
1644
|
+
*/
|
|
1645
|
+
export type X402DiscoveryResourceType =
|
|
1646
|
+
(typeof X402DiscoveryResourceType)[keyof typeof X402DiscoveryResourceType];
|
|
1647
|
+
|
|
1648
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1649
|
+
export const X402DiscoveryResourceType = {
|
|
1650
|
+
http: "http",
|
|
1651
|
+
} as const;
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Additional metadata as a JSON object.
|
|
1655
|
+
*/
|
|
1656
|
+
export type X402DiscoveryResourceMetadata = { [key: string]: unknown };
|
|
1657
|
+
|
|
1658
|
+
/**
|
|
1659
|
+
* A single discovered x402 resource.
|
|
1660
|
+
*/
|
|
1661
|
+
export interface X402DiscoveryResource {
|
|
1662
|
+
/** The normalized resource identifier. */
|
|
1663
|
+
resource: string;
|
|
1664
|
+
/** Communication protocol (e.g., "http", "mcp"). */
|
|
1665
|
+
type: X402DiscoveryResourceType;
|
|
1666
|
+
x402Version: X402Version;
|
|
1667
|
+
/** Payment requirements as an array of JSON objects. */
|
|
1668
|
+
accepts?: X402PaymentRequirements[];
|
|
1669
|
+
/** Timestamp of the last update. */
|
|
1670
|
+
lastUpdated: string;
|
|
1671
|
+
/** Additional metadata as a JSON object. */
|
|
1672
|
+
metadata?: X402DiscoveryResourceMetadata;
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* Pagination information for the response.
|
|
1677
|
+
*/
|
|
1678
|
+
export type X402DiscoveryResourcesResponsePagination = {
|
|
1679
|
+
/** The number of discovered x402 resources to return per page. */
|
|
1680
|
+
limit?: number;
|
|
1681
|
+
/** The offset of the first discovered x402 resource to return. */
|
|
1682
|
+
offset?: number;
|
|
1683
|
+
/** The total number of discovered x402 resources. */
|
|
1684
|
+
total?: number;
|
|
1685
|
+
};
|
|
1686
|
+
|
|
1687
|
+
/**
|
|
1688
|
+
* Response containing discovered x402 resources.
|
|
1689
|
+
*/
|
|
1690
|
+
export interface X402DiscoveryResourcesResponse {
|
|
1691
|
+
x402Version: X402Version;
|
|
1692
|
+
/** List of discovered x402 resources. */
|
|
1693
|
+
items: X402DiscoveryResource[];
|
|
1694
|
+
/** Pagination information for the response. */
|
|
1695
|
+
pagination: X402DiscoveryResourcesResponsePagination;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1501
1698
|
/**
|
|
1502
1699
|
* The action of the payment method.
|
|
1503
1700
|
*/
|
|
@@ -1728,6 +1925,110 @@ export interface Transfer {
|
|
|
1728
1925
|
transactionHash?: string;
|
|
1729
1926
|
}
|
|
1730
1927
|
|
|
1928
|
+
/**
|
|
1929
|
+
* The type of payment method to be used to complete the order.
|
|
1930
|
+
*/
|
|
1931
|
+
export type OnrampPaymentMethodTypeId =
|
|
1932
|
+
(typeof OnrampPaymentMethodTypeId)[keyof typeof OnrampPaymentMethodTypeId];
|
|
1933
|
+
|
|
1934
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1935
|
+
export const OnrampPaymentMethodTypeId = {
|
|
1936
|
+
GUEST_CHECKOUT_APPLE_PAY: "GUEST_CHECKOUT_APPLE_PAY",
|
|
1937
|
+
} as const;
|
|
1938
|
+
|
|
1939
|
+
/**
|
|
1940
|
+
* The type of fee.
|
|
1941
|
+
*/
|
|
1942
|
+
export type OnrampOrderFeeType = (typeof OnrampOrderFeeType)[keyof typeof OnrampOrderFeeType];
|
|
1943
|
+
|
|
1944
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1945
|
+
export const OnrampOrderFeeType = {
|
|
1946
|
+
FEE_TYPE_NETWORK: "FEE_TYPE_NETWORK",
|
|
1947
|
+
FEE_TYPE_EXCHANGE: "FEE_TYPE_EXCHANGE",
|
|
1948
|
+
} as const;
|
|
1949
|
+
|
|
1950
|
+
/**
|
|
1951
|
+
* A fee associated with an order.
|
|
1952
|
+
*/
|
|
1953
|
+
export interface OnrampOrderFee {
|
|
1954
|
+
/** The type of fee. */
|
|
1955
|
+
type: OnrampOrderFeeType;
|
|
1956
|
+
/** The amount of the fee. */
|
|
1957
|
+
amount: string;
|
|
1958
|
+
/** The currency of the fee. */
|
|
1959
|
+
currency: string;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
/**
|
|
1963
|
+
* The status of an onramp order.
|
|
1964
|
+
*/
|
|
1965
|
+
export type OnrampOrderStatus = (typeof OnrampOrderStatus)[keyof typeof OnrampOrderStatus];
|
|
1966
|
+
|
|
1967
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1968
|
+
export const OnrampOrderStatus = {
|
|
1969
|
+
ONRAMP_ORDER_STATUS_PENDING_AUTH: "ONRAMP_ORDER_STATUS_PENDING_AUTH",
|
|
1970
|
+
ONRAMP_ORDER_STATUS_PENDING_PAYMENT: "ONRAMP_ORDER_STATUS_PENDING_PAYMENT",
|
|
1971
|
+
ONRAMP_ORDER_STATUS_PROCESSING: "ONRAMP_ORDER_STATUS_PROCESSING",
|
|
1972
|
+
ONRAMP_ORDER_STATUS_COMPLETED: "ONRAMP_ORDER_STATUS_COMPLETED",
|
|
1973
|
+
ONRAMP_ORDER_STATUS_FAILED: "ONRAMP_ORDER_STATUS_FAILED",
|
|
1974
|
+
} as const;
|
|
1975
|
+
|
|
1976
|
+
/**
|
|
1977
|
+
* An Onramp order.
|
|
1978
|
+
*/
|
|
1979
|
+
export interface OnrampOrder {
|
|
1980
|
+
/** The ID of the onramp order. */
|
|
1981
|
+
orderId: string;
|
|
1982
|
+
/** The total amount of fiat to be paid. */
|
|
1983
|
+
paymentTotal: string;
|
|
1984
|
+
/** The amount of fiat to be converted to crypto. */
|
|
1985
|
+
paymentSubtotal: unknown;
|
|
1986
|
+
/** The fiat currency to be converted to crypto. */
|
|
1987
|
+
paymentCurrency: string;
|
|
1988
|
+
paymentMethod: OnrampPaymentMethodTypeId;
|
|
1989
|
+
/** The amount of crypto to be purchased. */
|
|
1990
|
+
purchaseAmount: string;
|
|
1991
|
+
/** The crypto currency to be purchased. */
|
|
1992
|
+
purchaseCurrency: string;
|
|
1993
|
+
/** The fees associated with the order. */
|
|
1994
|
+
fees: OnrampOrderFee[];
|
|
1995
|
+
/** The exchange rate used to convert fiat to crypto. */
|
|
1996
|
+
exchangeRate: string;
|
|
1997
|
+
/** The destination address to send the crypto to. */
|
|
1998
|
+
destinationAddress: string;
|
|
1999
|
+
/** The network to send the crypto on. */
|
|
2000
|
+
destinationNetwork: string;
|
|
2001
|
+
status: OnrampOrderStatus;
|
|
2002
|
+
/** The transaction hash of the order (only available once crypto has been sent). */
|
|
2003
|
+
txHash?: string;
|
|
2004
|
+
/** The date and time the order was created. */
|
|
2005
|
+
createdAt: string;
|
|
2006
|
+
/** The date and time the order was last updated. */
|
|
2007
|
+
updatedAt: string;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
/**
|
|
2011
|
+
* The type of payment link.
|
|
2012
|
+
*/
|
|
2013
|
+
export type OnrampPaymentLinkType =
|
|
2014
|
+
(typeof OnrampPaymentLinkType)[keyof typeof OnrampPaymentLinkType];
|
|
2015
|
+
|
|
2016
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
2017
|
+
export const OnrampPaymentLinkType = {
|
|
2018
|
+
PAYMENT_LINK_TYPE_APPLE_PAY_BUTTON: "PAYMENT_LINK_TYPE_APPLE_PAY_BUTTON",
|
|
2019
|
+
} as const;
|
|
2020
|
+
|
|
2021
|
+
/**
|
|
2022
|
+
* A payment link to pay for an order.
|
|
2023
|
+
|
|
2024
|
+
Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for details on how to integrate with the different payment link types.
|
|
2025
|
+
*/
|
|
2026
|
+
export interface OnrampPaymentLink {
|
|
2027
|
+
/** The URL to the hosted widget the user should be redirected to, append your own redirect_url query parameter to this URL to ensure the user is redirected back to your app after the widget completes. */
|
|
2028
|
+
url: string;
|
|
2029
|
+
paymentLinkType: OnrampPaymentLinkType;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
1731
2032
|
/**
|
|
1732
2033
|
* Internal server error.
|
|
1733
2034
|
*/
|
|
@@ -1758,6 +2059,16 @@ export type IdempotencyErrorResponse = Error;
|
|
|
1758
2059
|
*/
|
|
1759
2060
|
export type AlreadyExistsErrorResponse = Error;
|
|
1760
2061
|
|
|
2062
|
+
/**
|
|
2063
|
+
* Unauthorized.
|
|
2064
|
+
*/
|
|
2065
|
+
export type UnauthorizedErrorResponse = Error;
|
|
2066
|
+
|
|
2067
|
+
/**
|
|
2068
|
+
* Rate limit exceeded.
|
|
2069
|
+
*/
|
|
2070
|
+
export type RateLimitExceededResponse = Error;
|
|
2071
|
+
|
|
1761
2072
|
/**
|
|
1762
2073
|
* A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
1763
2074
|
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
@@ -2321,6 +2632,22 @@ export type ListSolanaTokenBalances200AllOf = {
|
|
|
2321
2632
|
|
|
2322
2633
|
export type ListSolanaTokenBalances200 = ListSolanaTokenBalances200AllOf & ListResponse;
|
|
2323
2634
|
|
|
2635
|
+
export type ListX402DiscoveryResourcesParams = {
|
|
2636
|
+
/**
|
|
2637
|
+
* Filter by protocol type (e.g., "http", "mcp").
|
|
2638
|
+
Currently, the only supported protocol type is "http".
|
|
2639
|
+
*/
|
|
2640
|
+
type?: string;
|
|
2641
|
+
/**
|
|
2642
|
+
* The number of discovered x402 resources to return per page.
|
|
2643
|
+
*/
|
|
2644
|
+
limit?: number;
|
|
2645
|
+
/**
|
|
2646
|
+
* The offset of the first discovered x402 resource to return.
|
|
2647
|
+
*/
|
|
2648
|
+
offset?: number;
|
|
2649
|
+
};
|
|
2650
|
+
|
|
2324
2651
|
export type GetCryptoRailsParams = {
|
|
2325
2652
|
/**
|
|
2326
2653
|
* Comma separated list of networks to filter the rails by.
|
|
@@ -2368,3 +2695,50 @@ export type CreatePaymentTransferQuoteBody = {
|
|
|
2368
2695
|
export type CreatePaymentTransferQuote201 = {
|
|
2369
2696
|
transfer: Transfer;
|
|
2370
2697
|
};
|
|
2698
|
+
|
|
2699
|
+
export type CreateOnrampOrderBody = {
|
|
2700
|
+
/** The timestamp of the time the user acknowledged they are accepting the Coinbase service agreement (https://www.coinbase.com/legal/guest-checkout/us) by using Coinbase Onramp. */
|
|
2701
|
+
agreementAcceptedAt: string;
|
|
2702
|
+
/** The address the purchased crypto will be sent to. */
|
|
2703
|
+
destinationAddress: string;
|
|
2704
|
+
/** The name of the crypto network the purchased currency will be sent on.
|
|
2705
|
+
|
|
2706
|
+
Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported networks for your user's location. */
|
|
2707
|
+
destinationNetwork: string;
|
|
2708
|
+
/** The email address of the user requesting the onramp transaction. */
|
|
2709
|
+
email: string;
|
|
2710
|
+
/** If true, this API will return a quote without creating any transaction. */
|
|
2711
|
+
isQuote?: boolean;
|
|
2712
|
+
/** Optional partner order reference ID. */
|
|
2713
|
+
partnerOrderRef?: string;
|
|
2714
|
+
/** A unique string that represents the user in your app. This can be used to link individual transactions together so you can retrieve the transaction history for your users. Prefix this string with “sandbox-” to perform a sandbox transaction which will allow you to test your integration without any real transfer of funds.
|
|
2715
|
+
|
|
2716
|
+
This value can be used with with [Onramp User Transactions API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-onramp-transactions-by-id) to retrieve all transactions created by the user. */
|
|
2717
|
+
partnerUserRef: string;
|
|
2718
|
+
/** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter, the returned quote will be inclusive of fees i.e. the user will pay this exact amount of the payment currency. */
|
|
2719
|
+
paymentAmount?: string;
|
|
2720
|
+
/** The fiat currency to be converted to crypto. */
|
|
2721
|
+
paymentCurrency: string;
|
|
2722
|
+
paymentMethod: OnrampPaymentMethodTypeId;
|
|
2723
|
+
/** The phone number of the user requesting the onramp transaction in E.164 format. This phone number must be verified by your app (via OTP) before being used with the Onramp API.
|
|
2724
|
+
|
|
2725
|
+
Please refer to the [Onramp docs](https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/onramp-overview) for more details on phone number verification requirements and best practices. */
|
|
2726
|
+
phoneNumber: string;
|
|
2727
|
+
/** Timestamp of when the user's phone number was verified via OTP. User phone number must be verified every 60 days. If this timestamp is older than 60 days, an error will be returned. */
|
|
2728
|
+
phoneNumberVerifiedAt: string;
|
|
2729
|
+
/** A string representing the amount of fiat the user wishes to pay in exchange for crypto. When using this parameter the returned quote will be exclusive of fees i.e. the user will receive this exact amount of the purchase currency. */
|
|
2730
|
+
purchaseAmount?: string;
|
|
2731
|
+
/** The ticker (e.g. `BTC`, `USDC`) or the UUID (e.g. `d85dce9b-5b73-5c3c-8978-522ce1d1c1b4`) of crypto asset to be purchased.
|
|
2732
|
+
|
|
2733
|
+
Use the [Onramp Buy Options API](https://docs.cdp.coinbase.com/api-reference/rest-api/onramp-offramp/get-buy-options) to discover the supported purchase currencies for your user's location. */
|
|
2734
|
+
purchaseCurrency: string;
|
|
2735
|
+
};
|
|
2736
|
+
|
|
2737
|
+
export type CreateOnrampOrder201 = {
|
|
2738
|
+
order: OnrampOrder;
|
|
2739
|
+
paymentLink?: OnrampPaymentLink;
|
|
2740
|
+
};
|
|
2741
|
+
|
|
2742
|
+
export type GetOnrampOrderById200 = {
|
|
2743
|
+
order: OnrampOrder;
|
|
2744
|
+
};
|
|
@@ -192,6 +192,15 @@ export const getPrepareUserOperationResponseMock = (
|
|
|
192
192
|
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
193
193
|
undefined,
|
|
194
194
|
]),
|
|
195
|
+
receipts: faker.helpers.arrayElement([
|
|
196
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
197
|
+
revert: faker.helpers.arrayElement([
|
|
198
|
+
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
199
|
+
undefined,
|
|
200
|
+
]),
|
|
201
|
+
})),
|
|
202
|
+
undefined,
|
|
203
|
+
]),
|
|
195
204
|
...overrideResponse,
|
|
196
205
|
});
|
|
197
206
|
|
|
@@ -217,6 +226,15 @@ export const getGetUserOperationResponseMock = (
|
|
|
217
226
|
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
218
227
|
undefined,
|
|
219
228
|
]),
|
|
229
|
+
receipts: faker.helpers.arrayElement([
|
|
230
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
231
|
+
revert: faker.helpers.arrayElement([
|
|
232
|
+
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
233
|
+
undefined,
|
|
234
|
+
]),
|
|
235
|
+
})),
|
|
236
|
+
undefined,
|
|
237
|
+
]),
|
|
220
238
|
...overrideResponse,
|
|
221
239
|
});
|
|
222
240
|
|
|
@@ -242,6 +260,49 @@ export const getSendUserOperationResponseMock = (
|
|
|
242
260
|
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
243
261
|
undefined,
|
|
244
262
|
]),
|
|
263
|
+
receipts: faker.helpers.arrayElement([
|
|
264
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
265
|
+
revert: faker.helpers.arrayElement([
|
|
266
|
+
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
267
|
+
undefined,
|
|
268
|
+
]),
|
|
269
|
+
})),
|
|
270
|
+
undefined,
|
|
271
|
+
]),
|
|
272
|
+
...overrideResponse,
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
export const getCreateSpendPermissionResponseMock = (
|
|
276
|
+
overrideResponse: Partial<EvmUserOperation> = {},
|
|
277
|
+
): EvmUserOperation => ({
|
|
278
|
+
network: faker.helpers.arrayElement(Object.values(EvmUserOperationNetwork)),
|
|
279
|
+
userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
|
|
280
|
+
calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
281
|
+
to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
282
|
+
value: faker.string.alpha(20),
|
|
283
|
+
data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"),
|
|
284
|
+
})),
|
|
285
|
+
status: faker.helpers.arrayElement([
|
|
286
|
+
"pending",
|
|
287
|
+
"signed",
|
|
288
|
+
"broadcast",
|
|
289
|
+
"complete",
|
|
290
|
+
"dropped",
|
|
291
|
+
"failed",
|
|
292
|
+
] as const),
|
|
293
|
+
transactionHash: faker.helpers.arrayElement([
|
|
294
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
295
|
+
undefined,
|
|
296
|
+
]),
|
|
297
|
+
receipts: faker.helpers.arrayElement([
|
|
298
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
299
|
+
revert: faker.helpers.arrayElement([
|
|
300
|
+
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
301
|
+
undefined,
|
|
302
|
+
]),
|
|
303
|
+
})),
|
|
304
|
+
undefined,
|
|
305
|
+
]),
|
|
245
306
|
...overrideResponse,
|
|
246
307
|
});
|
|
247
308
|
|
|
@@ -431,6 +492,29 @@ export const getSendUserOperationMockHandler = (
|
|
|
431
492
|
},
|
|
432
493
|
);
|
|
433
494
|
};
|
|
495
|
+
|
|
496
|
+
export const getCreateSpendPermissionMockHandler = (
|
|
497
|
+
overrideResponse?:
|
|
498
|
+
| EvmUserOperation
|
|
499
|
+
| ((
|
|
500
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
501
|
+
) => Promise<EvmUserOperation> | EvmUserOperation),
|
|
502
|
+
) => {
|
|
503
|
+
return http.post("*/v2/evm/smart-accounts/:address/spend-permissions", async info => {
|
|
504
|
+
await delay(0);
|
|
505
|
+
|
|
506
|
+
return new HttpResponse(
|
|
507
|
+
JSON.stringify(
|
|
508
|
+
overrideResponse !== undefined
|
|
509
|
+
? typeof overrideResponse === "function"
|
|
510
|
+
? await overrideResponse(info)
|
|
511
|
+
: overrideResponse
|
|
512
|
+
: getCreateSpendPermissionResponseMock(),
|
|
513
|
+
),
|
|
514
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
515
|
+
);
|
|
516
|
+
});
|
|
517
|
+
};
|
|
434
518
|
export const getEvmSmartAccountsMock = () => [
|
|
435
519
|
getListEvmSmartAccountsMockHandler(),
|
|
436
520
|
getCreateEvmSmartAccountMockHandler(),
|
|
@@ -440,4 +524,5 @@ export const getEvmSmartAccountsMock = () => [
|
|
|
440
524
|
getPrepareUserOperationMockHandler(),
|
|
441
525
|
getGetUserOperationMockHandler(),
|
|
442
526
|
getSendUserOperationMockHandler(),
|
|
527
|
+
getCreateSpendPermissionMockHandler(),
|
|
443
528
|
];
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type {
|
|
9
9
|
CreateEvmSmartAccountBody,
|
|
10
|
+
CreateSpendPermissionRequest,
|
|
10
11
|
EvmSmartAccount,
|
|
11
12
|
EvmUserOperation,
|
|
12
13
|
ListEvmSmartAccounts200,
|
|
@@ -153,6 +154,25 @@ export const sendUserOperation = (
|
|
|
153
154
|
options,
|
|
154
155
|
);
|
|
155
156
|
};
|
|
157
|
+
/**
|
|
158
|
+
* Creates a spend permission for the given smart account address.
|
|
159
|
+
* @summary Create a spend permission
|
|
160
|
+
*/
|
|
161
|
+
export const createSpendPermission = (
|
|
162
|
+
address: string,
|
|
163
|
+
createSpendPermissionRequest: CreateSpendPermissionRequest,
|
|
164
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
165
|
+
) => {
|
|
166
|
+
return cdpApiClient<EvmUserOperation>(
|
|
167
|
+
{
|
|
168
|
+
url: `/v2/evm/smart-accounts/${address}/spend-permissions`,
|
|
169
|
+
method: "POST",
|
|
170
|
+
headers: { "Content-Type": "application/json" },
|
|
171
|
+
data: createSpendPermissionRequest,
|
|
172
|
+
},
|
|
173
|
+
options,
|
|
174
|
+
);
|
|
175
|
+
};
|
|
156
176
|
export type ListEvmSmartAccountsResult = NonNullable<
|
|
157
177
|
Awaited<ReturnType<typeof listEvmSmartAccounts>>
|
|
158
178
|
>;
|
|
@@ -171,3 +191,6 @@ export type PrepareUserOperationResult = NonNullable<
|
|
|
171
191
|
>;
|
|
172
192
|
export type GetUserOperationResult = NonNullable<Awaited<ReturnType<typeof getUserOperation>>>;
|
|
173
193
|
export type SendUserOperationResult = NonNullable<Awaited<ReturnType<typeof sendUserOperation>>>;
|
|
194
|
+
export type CreateSpendPermissionResult = NonNullable<
|
|
195
|
+
Awaited<ReturnType<typeof createSpendPermission>>
|
|
196
|
+
>;
|
|
@@ -3,7 +3,9 @@ export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
|
3
3
|
export * from "./evm-swaps/evm-swaps.msw.js";
|
|
4
4
|
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
5
5
|
export * from "./faucets/faucets.msw.js";
|
|
6
|
+
export * from "./onramp/onramp.msw.js";
|
|
6
7
|
export * from "./payments-alpha/payments-alpha.msw.js";
|
|
7
8
|
export * from "./policy-engine/policy-engine.msw.js";
|
|
8
9
|
export * from "./solana-accounts/solana-accounts.msw.js";
|
|
9
10
|
export * from "./solana-token-balances/solana-token-balances.msw.js";
|
|
11
|
+
export * from "./x402-facilitator/x402-facilitator.msw.js";
|