@coinbase/cdp-sdk 1.6.0 → 1.8.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 +23 -0
- package/README.md +284 -1
- package/_cjs/accounts/evm/toEvmServerAccount.js +4 -2
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +7 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/evm/types.js.map +1 -0
- package/_cjs/accounts/solana/toSolanaAccount.js +42 -0
- package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -0
- package/_cjs/accounts/solana/types.js +3 -0
- package/_cjs/accounts/solana/types.js.map +1 -0
- package/_cjs/actions/evm/getUserOperation.js +36 -0
- package/_cjs/actions/evm/getUserOperation.js.map +1 -0
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js +11 -7
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
- package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +9 -6
- package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
- package/_cjs/actions/evm/transfer/transfer.js +7 -3
- package/_cjs/actions/evm/transfer/transfer.js.map +1 -1
- package/_cjs/actions/solana/requestFaucet.js +29 -0
- package/_cjs/actions/solana/requestFaucet.js.map +1 -0
- package/_cjs/actions/solana/signMessage.js +29 -0
- package/_cjs/actions/solana/signMessage.js.map +1 -0
- package/_cjs/actions/solana/signTransaction.js +46 -0
- package/_cjs/actions/solana/signTransaction.js.map +1 -0
- package/_cjs/actions/solana/types.js +3 -0
- package/_cjs/actions/solana/types.js.map +1 -0
- package/_cjs/analytics.js +68 -8
- package/_cjs/analytics.js.map +1 -1
- package/_cjs/client/cdp.js +9 -3
- package/_cjs/client/cdp.js.map +1 -1
- package/_cjs/client/evm/evm.js +135 -27
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/policies/index.js +6 -0
- package/_cjs/client/policies/index.js.map +1 -0
- package/_cjs/client/policies/policies.js +232 -0
- package/_cjs/client/policies/policies.js.map +1 -0
- package/_cjs/client/policies/policies.types.js +3 -0
- package/_cjs/client/policies/policies.types.js.map +1 -0
- package/_cjs/client/solana/solana.js +84 -22
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/index.js +4 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +59 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +27 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +56 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +3 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +3 -2
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.js +56 -0
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.js.map +1 -0
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +284 -0
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -0
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +14 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +42 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/index.js +7 -1
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/policies/schema.js +186 -0
- package/_cjs/policies/schema.js.map +1 -0
- package/_cjs/policies/types.js +3 -0
- package/_cjs/{accounts → policies}/types.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +4 -2
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +7 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/evm/types.js.map +1 -0
- package/_esm/accounts/solana/toSolanaAccount.js +39 -0
- package/_esm/accounts/solana/toSolanaAccount.js.map +1 -0
- package/_esm/accounts/solana/types.js +2 -0
- package/_esm/accounts/solana/types.js.map +1 -0
- package/_esm/actions/evm/getUserOperation.js +33 -0
- package/_esm/actions/evm/getUserOperation.js.map +1 -0
- package/_esm/actions/evm/transfer/accountTransferStrategy.js +11 -7
- package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
- package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +9 -6
- package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
- package/_esm/actions/evm/transfer/transfer.js +7 -3
- package/_esm/actions/evm/transfer/transfer.js.map +1 -1
- package/_esm/actions/solana/requestFaucet.js +26 -0
- package/_esm/actions/solana/requestFaucet.js.map +1 -0
- package/_esm/actions/solana/signMessage.js +26 -0
- package/_esm/actions/solana/signMessage.js.map +1 -0
- package/_esm/actions/solana/signTransaction.js +43 -0
- package/_esm/actions/solana/signTransaction.js.map +1 -0
- package/_esm/actions/solana/types.js +2 -0
- package/_esm/actions/solana/types.js.map +1 -0
- package/_esm/analytics.js +68 -7
- package/_esm/analytics.js.map +1 -1
- package/_esm/client/cdp.js +10 -4
- package/_esm/client/cdp.js.map +1 -1
- package/_esm/client/evm/evm.js +135 -27
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/policies/index.js +2 -0
- package/_esm/client/policies/index.js.map +1 -0
- package/_esm/client/policies/policies.js +228 -0
- package/_esm/client/policies/policies.js.map +1 -0
- package/_esm/client/policies/policies.types.js +2 -0
- package/_esm/client/policies/policies.types.js.map +1 -0
- package/_esm/client/solana/solana.js +84 -22
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/index.js +1 -0
- package/_esm/index.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +58 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +24 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +51 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +3 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/index.msw.js +3 -2
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/policy-engine/policy-engine.js +48 -0
- package/_esm/openapi-client/generated/policy-engine/policy-engine.js.map +1 -0
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +259 -0
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +12 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +39 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/index.js +6 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/policies/schema.js +183 -0
- package/_esm/policies/schema.js.map +1 -0
- package/_esm/policies/types.js +2 -0
- package/_esm/{accounts → policies}/types.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts +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/{types.d.ts → evm/types.d.ts} +10 -7
- package/_types/accounts/evm/types.d.ts.map +1 -0
- package/_types/accounts/solana/toSolanaAccount.d.ts +20 -0
- package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -0
- package/_types/accounts/solana/types.d.ts +12 -0
- package/_types/accounts/solana/types.d.ts.map +1 -0
- package/_types/actions/evm/getUserOperation.d.ts +22 -0
- package/_types/actions/evm/getUserOperation.d.ts.map +1 -0
- package/_types/actions/evm/sendUserOperation.d.ts +1 -1
- package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/evm/transfer/accountTransferStrategy.d.ts +1 -1
- package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
- package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts +1 -1
- package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -1
- package/_types/actions/evm/transfer/transfer.d.ts +3 -3
- package/_types/actions/evm/transfer/transfer.d.ts.map +1 -1
- package/_types/actions/evm/transfer/types.d.ts +39 -6
- package/_types/actions/evm/transfer/types.d.ts.map +1 -1
- package/_types/actions/evm/types.d.ts +28 -5
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/actions/solana/requestFaucet.d.ts +23 -0
- package/_types/actions/solana/requestFaucet.d.ts.map +1 -0
- package/_types/actions/solana/signMessage.d.ts +23 -0
- package/_types/actions/solana/signMessage.d.ts.map +1 -0
- package/_types/actions/solana/signTransaction.d.ts +38 -0
- package/_types/actions/solana/signTransaction.d.ts.map +1 -0
- package/_types/actions/solana/types.d.ts +80 -0
- package/_types/actions/solana/types.d.ts.map +1 -0
- package/_types/analytics.d.ts +14 -5
- package/_types/analytics.d.ts.map +1 -1
- package/_types/client/cdp.d.ts +3 -0
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +89 -1
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +36 -6
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/policies/index.d.ts +2 -0
- package/_types/client/policies/index.d.ts.map +1 -0
- package/_types/client/policies/policies.d.ts +216 -0
- package/_types/client/policies/policies.d.ts.map +1 -0
- package/_types/client/policies/policies.types.d.ts +96 -0
- package/_types/client/policies/policies.types.d.ts.map +1 -0
- package/_types/client/solana/solana.d.ts +47 -4
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +21 -12
- package/_types/client/solana/solana.types.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 +299 -0
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +13 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +5 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +3 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +3 -2
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.d.ts +43 -0
- package/_types/openapi-client/generated/policy-engine/policy-engine.d.ts.map +1 -0
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +25 -0
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -0
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +7 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +2 -0
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +19 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/schema.d.ts +922 -0
- package/_types/policies/schema.d.ts.map +1 -0
- package/_types/policies/types.d.ts +19 -0
- package/_types/policies/types.d.ts.map +1 -0
- package/_types/types/misc.d.ts +39 -0
- package/_types/types/misc.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmServerAccount.ts +7 -4
- package/accounts/evm/toEvmSmartAccount.ts +11 -1
- package/accounts/{types.ts → evm/types.ts} +10 -12
- package/accounts/solana/toSolanaAccount.ts +60 -0
- package/accounts/solana/types.ts +13 -0
- package/actions/evm/getUserOperation.ts +40 -0
- package/actions/evm/sendUserOperation.ts +1 -1
- package/actions/evm/transfer/accountTransferStrategy.ts +12 -8
- package/actions/evm/transfer/smartAccountTransferStrategy.ts +10 -7
- package/actions/evm/transfer/transfer.ts +17 -6
- package/actions/evm/transfer/types.ts +54 -11
- package/actions/evm/types.ts +37 -5
- package/actions/solana/requestFaucet.ts +35 -0
- package/actions/solana/signMessage.ts +36 -0
- package/actions/solana/signTransaction.ts +53 -0
- package/actions/solana/types.ts +87 -0
- package/analytics.ts +84 -11
- package/client/cdp.ts +11 -4
- package/client/evm/evm.ts +162 -33
- package/client/evm/evm.types.ts +42 -4
- package/client/policies/index.ts +1 -0
- package/client/policies/policies.ts +246 -0
- package/client/policies/policies.types.ts +109 -0
- package/client/solana/solana.ts +107 -38
- package/client/solana/solana.types.ts +25 -15
- package/index.ts +8 -1
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +360 -0
- package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +102 -0
- package/openapi-client/generated/evm-accounts/evm-accounts.ts +43 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +3 -1
- package/openapi-client/generated/index.msw.ts +3 -2
- package/openapi-client/generated/policy-engine/policy-engine.msw.ts +404 -0
- package/openapi-client/generated/policy-engine/policy-engine.ts +95 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +75 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.ts +23 -0
- package/openapi-client/index.ts +7 -0
- package/package.json +3 -2
- package/policies/schema.ts +266 -0
- package/policies/types.ts +19 -0
- package/types/misc.ts +41 -0
- package/version.ts +1 -1
- package/_types/accounts/types.d.ts.map +0 -1
- /package/_cjs/accounts/{types.js → evm/types.js} +0 -0
- /package/_esm/accounts/{types.js → evm/types.js} +0 -0
|
@@ -18,6 +18,8 @@ Account names are guaranteed to be unique across all EVM accounts in the develop
|
|
|
18
18
|
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
19
19
|
*/
|
|
20
20
|
name?: string;
|
|
21
|
+
/** The list of policy IDs that apply to the account. This will include both the project-level policy and the account-level policy, if one exists. */
|
|
22
|
+
policies?: string[];
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
export interface ListResponse {
|
|
@@ -33,6 +35,7 @@ export type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];
|
|
|
33
35
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
34
36
|
export const ErrorType = {
|
|
35
37
|
already_exists: "already_exists",
|
|
38
|
+
bad_gateway: "bad_gateway",
|
|
36
39
|
faucet_limit_exceeded: "faucet_limit_exceeded",
|
|
37
40
|
forbidden: "forbidden",
|
|
38
41
|
idempotency_error: "idempotency_error",
|
|
@@ -43,9 +46,11 @@ export const ErrorType = {
|
|
|
43
46
|
not_found: "not_found",
|
|
44
47
|
rate_limit_exceeded: "rate_limit_exceeded",
|
|
45
48
|
request_canceled: "request_canceled",
|
|
49
|
+
service_unavailable: "service_unavailable",
|
|
46
50
|
timed_out: "timed_out",
|
|
47
51
|
unauthorized: "unauthorized",
|
|
48
52
|
policy_violation: "policy_violation",
|
|
53
|
+
policy_in_use: "policy_in_use",
|
|
49
54
|
} as const;
|
|
50
55
|
|
|
51
56
|
/**
|
|
@@ -61,6 +66,54 @@ export interface Error {
|
|
|
61
66
|
errorLink?: string;
|
|
62
67
|
}
|
|
63
68
|
|
|
69
|
+
/**
|
|
70
|
+
* The domain of the EIP-712 typed data.
|
|
71
|
+
*/
|
|
72
|
+
export interface EIP712Domain {
|
|
73
|
+
/** The name of the DApp or protocol. */
|
|
74
|
+
name?: string;
|
|
75
|
+
/** The version of the DApp or protocol. */
|
|
76
|
+
version?: string;
|
|
77
|
+
/** The chain ID of the EVM network. */
|
|
78
|
+
chainId?: number;
|
|
79
|
+
/**
|
|
80
|
+
* The 0x-prefixed EVM address of the verifying smart contract.
|
|
81
|
+
* @pattern ^0x[a-fA-F0-9]{40}$
|
|
82
|
+
*/
|
|
83
|
+
verifyingContract?: string;
|
|
84
|
+
/**
|
|
85
|
+
* The optional 32-byte 0x-prefixed hex salt for domain separation.
|
|
86
|
+
* @pattern ^0x[a-fA-F0-9]{64}$
|
|
87
|
+
*/
|
|
88
|
+
salt?: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A mapping of struct names to an array of type objects (name + type).
|
|
93
|
+
Each key corresponds to a type name (e.g., "`EIP712Domain`", "`PermitTransferFrom`").
|
|
94
|
+
|
|
95
|
+
*/
|
|
96
|
+
export interface EIP712Types {
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The message to sign. The structure of this message must match the `primaryType` struct in the `types` object.
|
|
102
|
+
*/
|
|
103
|
+
export type EIP712MessageMessage = { [key: string]: unknown };
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* The message to sign using EIP-712.
|
|
107
|
+
*/
|
|
108
|
+
export interface EIP712Message {
|
|
109
|
+
domain: EIP712Domain;
|
|
110
|
+
types: EIP712Types;
|
|
111
|
+
/** The primary type of the message. This is the name of the struct in the `types` object that is the root of the message. */
|
|
112
|
+
primaryType: string;
|
|
113
|
+
/** The message to sign. The structure of this message must match the `primaryType` struct in the `types` object. */
|
|
114
|
+
message: EIP712MessageMessage;
|
|
115
|
+
}
|
|
116
|
+
|
|
64
117
|
export interface EvmSmartAccount {
|
|
65
118
|
/**
|
|
66
119
|
* The 0x-prefixed, checksum address of the Smart Account.
|
|
@@ -197,6 +250,201 @@ export interface TokenBalance {
|
|
|
197
250
|
token: Token;
|
|
198
251
|
}
|
|
199
252
|
|
|
253
|
+
/**
|
|
254
|
+
* The type of criterion to use. This should be `ethValue`.
|
|
255
|
+
*/
|
|
256
|
+
export type EthValueCriterionType =
|
|
257
|
+
(typeof EthValueCriterionType)[keyof typeof EthValueCriterionType];
|
|
258
|
+
|
|
259
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
260
|
+
export const EthValueCriterionType = {
|
|
261
|
+
ethValue: "ethValue",
|
|
262
|
+
} as const;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* The operator to use for the comparison. The transaction's `value` field will be on the left-hand side of the operator, and the `ethValue` field will be on the right-hand side.
|
|
266
|
+
*/
|
|
267
|
+
export type EthValueCriterionOperator =
|
|
268
|
+
(typeof EthValueCriterionOperator)[keyof typeof EthValueCriterionOperator];
|
|
269
|
+
|
|
270
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
271
|
+
export const EthValueCriterionOperator = {
|
|
272
|
+
">": ">",
|
|
273
|
+
">=": ">=",
|
|
274
|
+
"<": "<",
|
|
275
|
+
"<=": "<=",
|
|
276
|
+
"==": "==",
|
|
277
|
+
} as const;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* A schema for specifying a criterion for the `value` field of an EVM transaction.
|
|
281
|
+
*/
|
|
282
|
+
export interface EthValueCriterion {
|
|
283
|
+
/** The type of criterion to use. This should be `ethValue`. */
|
|
284
|
+
type: EthValueCriterionType;
|
|
285
|
+
/**
|
|
286
|
+
* The amount of ETH, in wei, that the transaction's `value` field should be compared to.
|
|
287
|
+
* @pattern ^[0-9]+$
|
|
288
|
+
*/
|
|
289
|
+
ethValue: string;
|
|
290
|
+
/** The operator to use for the comparison. The transaction's `value` field will be on the left-hand side of the operator, and the `ethValue` field will be on the right-hand side. */
|
|
291
|
+
operator: EthValueCriterionOperator;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* The type of criterion to use. This should be `evmAddress`.
|
|
296
|
+
*/
|
|
297
|
+
export type EvmAddressCriterionType =
|
|
298
|
+
(typeof EvmAddressCriterionType)[keyof typeof EvmAddressCriterionType];
|
|
299
|
+
|
|
300
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
301
|
+
export const EvmAddressCriterionType = {
|
|
302
|
+
evmAddress: "evmAddress",
|
|
303
|
+
} as const;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* 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.
|
|
307
|
+
*/
|
|
308
|
+
export type EvmAddressCriterionOperator =
|
|
309
|
+
(typeof EvmAddressCriterionOperator)[keyof typeof EvmAddressCriterionOperator];
|
|
310
|
+
|
|
311
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
312
|
+
export const EvmAddressCriterionOperator = {
|
|
313
|
+
in: "in",
|
|
314
|
+
not_in: "not in",
|
|
315
|
+
} as const;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* A schema for specifying a criterion for the `to` field of an EVM transaction.
|
|
319
|
+
*/
|
|
320
|
+
export interface EvmAddressCriterion {
|
|
321
|
+
/** The type of criterion to use. This should be `evmAddress`. */
|
|
322
|
+
type: EvmAddressCriterionType;
|
|
323
|
+
/** A list of 0x-prefixed EVM addresses that the transaction's `to` field should be compared to. There is a limit of 100 addresses per criterion. */
|
|
324
|
+
addresses: string[];
|
|
325
|
+
/** 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. */
|
|
326
|
+
operator: EvmAddressCriterionOperator;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export type SignEvmTransactionCriteriaItem = EthValueCriterion | EvmAddressCriterion;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* A schema for specifying the rejection criteria for the SignEvmTransaction operation.
|
|
333
|
+
*/
|
|
334
|
+
export type SignEvmTransactionCriteria = SignEvmTransactionCriteriaItem[];
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* The type of criterion to use. This should be `solAddress`.
|
|
338
|
+
*/
|
|
339
|
+
export type SolAddressCriterionType =
|
|
340
|
+
(typeof SolAddressCriterionType)[keyof typeof SolAddressCriterionType];
|
|
341
|
+
|
|
342
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
343
|
+
export const SolAddressCriterionType = {
|
|
344
|
+
solAddress: "solAddress",
|
|
345
|
+
} as const;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* The operator to use for the comparison. Each of the addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the addresses field will be on the right-hand side.
|
|
349
|
+
*/
|
|
350
|
+
export type SolAddressCriterionOperator =
|
|
351
|
+
(typeof SolAddressCriterionOperator)[keyof typeof SolAddressCriterionOperator];
|
|
352
|
+
|
|
353
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
354
|
+
export const SolAddressCriterionOperator = {
|
|
355
|
+
in: "in",
|
|
356
|
+
not_in: "not in",
|
|
357
|
+
} as const;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* The criterion for the recipient addresses of a Solana transaction.
|
|
361
|
+
*/
|
|
362
|
+
export interface SolAddressCriterion {
|
|
363
|
+
/** The type of criterion to use. This should be `solAddress`. */
|
|
364
|
+
type: SolAddressCriterionType;
|
|
365
|
+
/** The Solana addresses that are compared to the list of addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array. */
|
|
366
|
+
addresses: string[];
|
|
367
|
+
/** The operator to use for the comparison. Each of the addresses in the transaction's `accountKeys` (for legacy transactions) or `staticAccountKeys` (for V0 transactions) array will be on the left-hand side of the operator, and the addresses field will be on the right-hand side. */
|
|
368
|
+
operator: SolAddressCriterionOperator;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* A schema for specifying the rejection criteria for the SignSolTransaction operation.
|
|
373
|
+
*/
|
|
374
|
+
export type SignSolTransactionCriteria = SolAddressCriterion[];
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Whether matching the rule will cause the request to be rejected or accepted.
|
|
378
|
+
*/
|
|
379
|
+
export type RuleAction = (typeof RuleAction)[keyof typeof RuleAction];
|
|
380
|
+
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
382
|
+
export const RuleAction = {
|
|
383
|
+
reject: "reject",
|
|
384
|
+
accept: "accept",
|
|
385
|
+
} as const;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
|
|
389
|
+
*/
|
|
390
|
+
export type RuleOperation = (typeof RuleOperation)[keyof typeof RuleOperation];
|
|
391
|
+
|
|
392
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
393
|
+
export const RuleOperation = {
|
|
394
|
+
signEvmTransaction: "signEvmTransaction",
|
|
395
|
+
signSolTransaction: "signSolTransaction",
|
|
396
|
+
} as const;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* The set of criteria for the rule. There is a limit of 10 criteria per rule.
|
|
400
|
+
*/
|
|
401
|
+
export type RuleCriteria = SignEvmTransactionCriteria | SignSolTransactionCriteria;
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* A rule that limits the behavior of an account.
|
|
405
|
+
*/
|
|
406
|
+
export interface Rule {
|
|
407
|
+
/** Whether matching the rule will cause the request to be rejected or accepted. */
|
|
408
|
+
action: RuleAction;
|
|
409
|
+
/** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
|
|
410
|
+
operation: RuleOperation;
|
|
411
|
+
/** The set of criteria for the rule. There is a limit of 10 criteria per rule. */
|
|
412
|
+
criteria: RuleCriteria;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* The scope of the policy. Only one project-level policy can exist at any time.
|
|
417
|
+
*/
|
|
418
|
+
export type PolicyScope = (typeof PolicyScope)[keyof typeof PolicyScope];
|
|
419
|
+
|
|
420
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
421
|
+
export const PolicyScope = {
|
|
422
|
+
project: "project",
|
|
423
|
+
account: "account",
|
|
424
|
+
} as const;
|
|
425
|
+
|
|
426
|
+
export interface Policy {
|
|
427
|
+
/**
|
|
428
|
+
* The unique identifier for the policy.
|
|
429
|
+
* @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}$
|
|
430
|
+
*/
|
|
431
|
+
id: string;
|
|
432
|
+
/**
|
|
433
|
+
* An optional human-readable description of the policy.
|
|
434
|
+
Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
|
|
435
|
+
* @pattern ^[A-Za-z0-9 ,.]{1,50}$
|
|
436
|
+
*/
|
|
437
|
+
description?: string;
|
|
438
|
+
/** The scope of the policy. Only one project-level policy can exist at any time. */
|
|
439
|
+
scope: PolicyScope;
|
|
440
|
+
/** A list of rules that comprise the policy. */
|
|
441
|
+
rules: Rule[];
|
|
442
|
+
/** The ISO 8601 timestamp at which the Policy was created. */
|
|
443
|
+
createdAt: string;
|
|
444
|
+
/** The ISO 8601 timestamp at which the Policy was last updated. */
|
|
445
|
+
updatedAt: string;
|
|
446
|
+
}
|
|
447
|
+
|
|
200
448
|
export interface SolanaAccount {
|
|
201
449
|
/**
|
|
202
450
|
* The base58 encoded Solana address.
|
|
@@ -210,6 +458,8 @@ Account names are guaranteed to be unique across all Solana accounts in the deve
|
|
|
210
458
|
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
211
459
|
*/
|
|
212
460
|
name?: string;
|
|
461
|
+
/** The list of policy IDs that apply to the account. This will include both the project-level policy and the account-level policy, if one exists. */
|
|
462
|
+
policies?: string[];
|
|
213
463
|
}
|
|
214
464
|
|
|
215
465
|
/**
|
|
@@ -217,6 +467,16 @@ Account names are guaranteed to be unique across all Solana accounts in the deve
|
|
|
217
467
|
*/
|
|
218
468
|
export type InternalServerErrorResponse = Error;
|
|
219
469
|
|
|
470
|
+
/**
|
|
471
|
+
* Bad gateway.
|
|
472
|
+
*/
|
|
473
|
+
export type BadGatewayErrorResponse = Error;
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Service unavailable.
|
|
477
|
+
*/
|
|
478
|
+
export type ServiceUnavailableErrorResponse = Error;
|
|
479
|
+
|
|
220
480
|
/**
|
|
221
481
|
* Idempotency key conflict.
|
|
222
482
|
*/
|
|
@@ -271,6 +531,21 @@ Account names must be unique across all EVM accounts in the developer's CDP Proj
|
|
|
271
531
|
name?: string;
|
|
272
532
|
};
|
|
273
533
|
|
|
534
|
+
export type UpdateEvmAccountBody = {
|
|
535
|
+
/**
|
|
536
|
+
* An optional name for the account.
|
|
537
|
+
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
|
|
538
|
+
Account names must be unique across all EVM accounts in the developer's CDP Project.
|
|
539
|
+
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
540
|
+
*/
|
|
541
|
+
name?: string;
|
|
542
|
+
/**
|
|
543
|
+
* The ID of the account-level policy to apply to the account.
|
|
544
|
+
* @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}$
|
|
545
|
+
*/
|
|
546
|
+
accountPolicy?: string;
|
|
547
|
+
};
|
|
548
|
+
|
|
274
549
|
/**
|
|
275
550
|
* The network to send the transaction to.
|
|
276
551
|
*/
|
|
@@ -325,6 +600,11 @@ export type SignEvmMessage200 = {
|
|
|
325
600
|
signature: string;
|
|
326
601
|
};
|
|
327
602
|
|
|
603
|
+
export type SignEvmTypedData200 = {
|
|
604
|
+
/** The signature of the typed data, as a 0x-prefixed hex string. */
|
|
605
|
+
signature: string;
|
|
606
|
+
};
|
|
607
|
+
|
|
328
608
|
export type ListEvmSmartAccountsParams = {
|
|
329
609
|
/**
|
|
330
610
|
* The number of accounts to return per page.
|
|
@@ -436,6 +716,72 @@ export type RequestEvmFaucet200 = {
|
|
|
436
716
|
transactionHash: string;
|
|
437
717
|
};
|
|
438
718
|
|
|
719
|
+
export type ListPoliciesParams = {
|
|
720
|
+
/**
|
|
721
|
+
* The number of policies to return per page.
|
|
722
|
+
*/
|
|
723
|
+
pageSize?: number;
|
|
724
|
+
/**
|
|
725
|
+
* The token for the next page of policies, if any.
|
|
726
|
+
*/
|
|
727
|
+
pageToken?: string;
|
|
728
|
+
/**
|
|
729
|
+
* The scope of the policies to return. If `project`, the response will include exactly one policy, which is the project-level policy. If `account`, the response will include all account-level policies for the developer's CDP Project.
|
|
730
|
+
*/
|
|
731
|
+
scope?: ListPoliciesScope;
|
|
732
|
+
};
|
|
733
|
+
|
|
734
|
+
export type ListPoliciesScope = (typeof ListPoliciesScope)[keyof typeof ListPoliciesScope];
|
|
735
|
+
|
|
736
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
737
|
+
export const ListPoliciesScope = {
|
|
738
|
+
project: "project",
|
|
739
|
+
account: "account",
|
|
740
|
+
} as const;
|
|
741
|
+
|
|
742
|
+
export type ListPolicies200AllOf = {
|
|
743
|
+
/** The list of policies. */
|
|
744
|
+
policies: Policy[];
|
|
745
|
+
};
|
|
746
|
+
|
|
747
|
+
export type ListPolicies200 = ListPolicies200AllOf & ListResponse;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* The scope of the policy.
|
|
751
|
+
*/
|
|
752
|
+
export type CreatePolicyBodyScope =
|
|
753
|
+
(typeof CreatePolicyBodyScope)[keyof typeof CreatePolicyBodyScope];
|
|
754
|
+
|
|
755
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
756
|
+
export const CreatePolicyBodyScope = {
|
|
757
|
+
project: "project",
|
|
758
|
+
account: "account",
|
|
759
|
+
} as const;
|
|
760
|
+
|
|
761
|
+
export type CreatePolicyBody = {
|
|
762
|
+
/** The scope of the policy. */
|
|
763
|
+
scope: CreatePolicyBodyScope;
|
|
764
|
+
/**
|
|
765
|
+
* An optional human-readable description for the policy.
|
|
766
|
+
Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
|
|
767
|
+
* @pattern ^[A-Za-z0-9 ,.]{1,50}$
|
|
768
|
+
*/
|
|
769
|
+
description?: string;
|
|
770
|
+
/** A list of rules that comprise the policy. There is a limit of 10 rules per policy. */
|
|
771
|
+
rules: Rule[];
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
export type UpdatePolicyBody = {
|
|
775
|
+
/**
|
|
776
|
+
* An optional human-readable description for the policy.
|
|
777
|
+
Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
|
|
778
|
+
* @pattern ^[A-Za-z0-9 ,.]{1,50}$
|
|
779
|
+
*/
|
|
780
|
+
description?: string;
|
|
781
|
+
/** A list of rules that comprise the policy. There is a limit of 10 rules per policy. */
|
|
782
|
+
rules: Rule[];
|
|
783
|
+
};
|
|
784
|
+
|
|
439
785
|
export type ListSolanaAccountsParams = {
|
|
440
786
|
/**
|
|
441
787
|
* The number of accounts to return per page.
|
|
@@ -464,6 +810,20 @@ Account names must be unique across all Solana accounts in the developer's CDP P
|
|
|
464
810
|
name?: string;
|
|
465
811
|
};
|
|
466
812
|
|
|
813
|
+
export type UpdateSolanaAccountBody = {
|
|
814
|
+
/**
|
|
815
|
+
* An optional name for the account. Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
|
|
816
|
+
Account names must be unique across all Solana accounts in the developer's CDP Project.
|
|
817
|
+
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
818
|
+
*/
|
|
819
|
+
name?: string;
|
|
820
|
+
/**
|
|
821
|
+
* The ID of the account-level policy to apply to the account.
|
|
822
|
+
* @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}$
|
|
823
|
+
*/
|
|
824
|
+
accountPolicy?: string;
|
|
825
|
+
};
|
|
826
|
+
|
|
467
827
|
export type SignSolanaTransactionBody = {
|
|
468
828
|
/** The base64 encoded transaction to sign. */
|
|
469
829
|
transaction: string;
|
|
@@ -16,6 +16,7 @@ import type {
|
|
|
16
16
|
SignEvmHash200,
|
|
17
17
|
SignEvmMessage200,
|
|
18
18
|
SignEvmTransaction200,
|
|
19
|
+
SignEvmTypedData200,
|
|
19
20
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
20
21
|
|
|
21
22
|
export const getListEvmAccountsResponseMock = (): ListEvmAccounts200 => ({
|
|
@@ -27,6 +28,14 @@ export const getListEvmAccountsResponseMock = (): ListEvmAccounts200 => ({
|
|
|
27
28
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
28
29
|
undefined,
|
|
29
30
|
]),
|
|
31
|
+
policies: faker.helpers.arrayElement([
|
|
32
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
33
|
+
faker.helpers.fromRegExp(
|
|
34
|
+
"^[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}$",
|
|
35
|
+
),
|
|
36
|
+
),
|
|
37
|
+
undefined,
|
|
38
|
+
]),
|
|
30
39
|
}),
|
|
31
40
|
),
|
|
32
41
|
},
|
|
@@ -41,6 +50,14 @@ export const getCreateEvmAccountResponseMock = (
|
|
|
41
50
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
42
51
|
undefined,
|
|
43
52
|
]),
|
|
53
|
+
policies: faker.helpers.arrayElement([
|
|
54
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
55
|
+
faker.helpers.fromRegExp(
|
|
56
|
+
"^[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}$",
|
|
57
|
+
),
|
|
58
|
+
),
|
|
59
|
+
undefined,
|
|
60
|
+
]),
|
|
44
61
|
...overrideResponse,
|
|
45
62
|
});
|
|
46
63
|
|
|
@@ -52,6 +69,33 @@ export const getGetEvmAccountResponseMock = (
|
|
|
52
69
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
53
70
|
undefined,
|
|
54
71
|
]),
|
|
72
|
+
policies: faker.helpers.arrayElement([
|
|
73
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
74
|
+
faker.helpers.fromRegExp(
|
|
75
|
+
"^[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}$",
|
|
76
|
+
),
|
|
77
|
+
),
|
|
78
|
+
undefined,
|
|
79
|
+
]),
|
|
80
|
+
...overrideResponse,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const getUpdateEvmAccountResponseMock = (
|
|
84
|
+
overrideResponse: Partial<EvmAccount> = {},
|
|
85
|
+
): EvmAccount => ({
|
|
86
|
+
address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
87
|
+
name: faker.helpers.arrayElement([
|
|
88
|
+
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
89
|
+
undefined,
|
|
90
|
+
]),
|
|
91
|
+
policies: faker.helpers.arrayElement([
|
|
92
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
93
|
+
faker.helpers.fromRegExp(
|
|
94
|
+
"^[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}$",
|
|
95
|
+
),
|
|
96
|
+
),
|
|
97
|
+
undefined,
|
|
98
|
+
]),
|
|
55
99
|
...overrideResponse,
|
|
56
100
|
});
|
|
57
101
|
|
|
@@ -63,6 +107,14 @@ export const getGetEvmAccountByNameResponseMock = (
|
|
|
63
107
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
64
108
|
undefined,
|
|
65
109
|
]),
|
|
110
|
+
policies: faker.helpers.arrayElement([
|
|
111
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
112
|
+
faker.helpers.fromRegExp(
|
|
113
|
+
"^[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}$",
|
|
114
|
+
),
|
|
115
|
+
),
|
|
116
|
+
undefined,
|
|
117
|
+
]),
|
|
66
118
|
...overrideResponse,
|
|
67
119
|
});
|
|
68
120
|
|
|
@@ -82,6 +134,10 @@ export const getSignEvmMessageResponseMock = (
|
|
|
82
134
|
overrideResponse: Partial<SignEvmMessage200> = {},
|
|
83
135
|
): SignEvmMessage200 => ({ signature: faker.string.alpha(20), ...overrideResponse });
|
|
84
136
|
|
|
137
|
+
export const getSignEvmTypedDataResponseMock = (
|
|
138
|
+
overrideResponse: Partial<SignEvmTypedData200> = {},
|
|
139
|
+
): SignEvmTypedData200 => ({ signature: faker.string.alpha(20), ...overrideResponse });
|
|
140
|
+
|
|
85
141
|
export const getListEvmAccountsMockHandler = (
|
|
86
142
|
overrideResponse?:
|
|
87
143
|
| ListEvmAccounts200
|
|
@@ -147,6 +203,27 @@ export const getGetEvmAccountMockHandler = (
|
|
|
147
203
|
});
|
|
148
204
|
};
|
|
149
205
|
|
|
206
|
+
export const getUpdateEvmAccountMockHandler = (
|
|
207
|
+
overrideResponse?:
|
|
208
|
+
| EvmAccount
|
|
209
|
+
| ((info: Parameters<Parameters<typeof http.put>[1]>[0]) => Promise<EvmAccount> | EvmAccount),
|
|
210
|
+
) => {
|
|
211
|
+
return http.put("*/v2/evm/accounts/:address", async info => {
|
|
212
|
+
await delay(0);
|
|
213
|
+
|
|
214
|
+
return new HttpResponse(
|
|
215
|
+
JSON.stringify(
|
|
216
|
+
overrideResponse !== undefined
|
|
217
|
+
? typeof overrideResponse === "function"
|
|
218
|
+
? await overrideResponse(info)
|
|
219
|
+
: overrideResponse
|
|
220
|
+
: getUpdateEvmAccountResponseMock(),
|
|
221
|
+
),
|
|
222
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
223
|
+
);
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
|
|
150
227
|
export const getGetEvmAccountByNameMockHandler = (
|
|
151
228
|
overrideResponse?:
|
|
152
229
|
| EvmAccount
|
|
@@ -259,13 +336,38 @@ export const getSignEvmMessageMockHandler = (
|
|
|
259
336
|
);
|
|
260
337
|
});
|
|
261
338
|
};
|
|
339
|
+
|
|
340
|
+
export const getSignEvmTypedDataMockHandler = (
|
|
341
|
+
overrideResponse?:
|
|
342
|
+
| SignEvmTypedData200
|
|
343
|
+
| ((
|
|
344
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
345
|
+
) => Promise<SignEvmTypedData200> | SignEvmTypedData200),
|
|
346
|
+
) => {
|
|
347
|
+
return http.post("*/v2/evm/accounts/:address/sign/typed-data", async info => {
|
|
348
|
+
await delay(0);
|
|
349
|
+
|
|
350
|
+
return new HttpResponse(
|
|
351
|
+
JSON.stringify(
|
|
352
|
+
overrideResponse !== undefined
|
|
353
|
+
? typeof overrideResponse === "function"
|
|
354
|
+
? await overrideResponse(info)
|
|
355
|
+
: overrideResponse
|
|
356
|
+
: getSignEvmTypedDataResponseMock(),
|
|
357
|
+
),
|
|
358
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
359
|
+
);
|
|
360
|
+
});
|
|
361
|
+
};
|
|
262
362
|
export const getEvmAccountsMock = () => [
|
|
263
363
|
getListEvmAccountsMockHandler(),
|
|
264
364
|
getCreateEvmAccountMockHandler(),
|
|
265
365
|
getGetEvmAccountMockHandler(),
|
|
366
|
+
getUpdateEvmAccountMockHandler(),
|
|
266
367
|
getGetEvmAccountByNameMockHandler(),
|
|
267
368
|
getSendEvmTransactionMockHandler(),
|
|
268
369
|
getSignEvmTransactionMockHandler(),
|
|
269
370
|
getSignEvmHashMockHandler(),
|
|
270
371
|
getSignEvmMessageMockHandler(),
|
|
372
|
+
getSignEvmTypedDataMockHandler(),
|
|
271
373
|
];
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type {
|
|
9
9
|
CreateEvmAccountBody,
|
|
10
|
+
EIP712Message,
|
|
10
11
|
EvmAccount,
|
|
11
12
|
ListEvmAccounts200,
|
|
12
13
|
ListEvmAccountsParams,
|
|
@@ -18,6 +19,8 @@ import type {
|
|
|
18
19
|
SignEvmMessageBody,
|
|
19
20
|
SignEvmTransaction200,
|
|
20
21
|
SignEvmTransactionBody,
|
|
22
|
+
SignEvmTypedData200,
|
|
23
|
+
UpdateEvmAccountBody,
|
|
21
24
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
22
25
|
|
|
23
26
|
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
@@ -63,6 +66,25 @@ export const createEvmAccount = (
|
|
|
63
66
|
export const getEvmAccount = (address: string, options?: SecondParameter<typeof cdpApiClient>) => {
|
|
64
67
|
return cdpApiClient<EvmAccount>({ url: `/v2/evm/accounts/${address}`, method: "GET" }, options);
|
|
65
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Updates an existing EVM account. Use this to update the account's name or account-level policy.
|
|
71
|
+
* @summary Update an EVM account
|
|
72
|
+
*/
|
|
73
|
+
export const updateEvmAccount = (
|
|
74
|
+
address: string,
|
|
75
|
+
updateEvmAccountBody: UpdateEvmAccountBody,
|
|
76
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
77
|
+
) => {
|
|
78
|
+
return cdpApiClient<EvmAccount>(
|
|
79
|
+
{
|
|
80
|
+
url: `/v2/evm/accounts/${address}`,
|
|
81
|
+
method: "PUT",
|
|
82
|
+
headers: { "Content-Type": "application/json" },
|
|
83
|
+
data: updateEvmAccountBody,
|
|
84
|
+
},
|
|
85
|
+
options,
|
|
86
|
+
);
|
|
87
|
+
};
|
|
66
88
|
/**
|
|
67
89
|
* Gets an EVM account by its name.
|
|
68
90
|
* @summary Get an EVM account by name
|
|
@@ -182,9 +204,29 @@ export const signEvmMessage = (
|
|
|
182
204
|
options,
|
|
183
205
|
);
|
|
184
206
|
};
|
|
207
|
+
/**
|
|
208
|
+
* Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given EVM account.
|
|
209
|
+
* @summary Sign EIP-712 typed data
|
|
210
|
+
*/
|
|
211
|
+
export const signEvmTypedData = (
|
|
212
|
+
address: string,
|
|
213
|
+
eIP712Message: EIP712Message,
|
|
214
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
215
|
+
) => {
|
|
216
|
+
return cdpApiClient<SignEvmTypedData200>(
|
|
217
|
+
{
|
|
218
|
+
url: `/v2/evm/accounts/${address}/sign/typed-data`,
|
|
219
|
+
method: "POST",
|
|
220
|
+
headers: { "Content-Type": "application/json" },
|
|
221
|
+
data: eIP712Message,
|
|
222
|
+
},
|
|
223
|
+
options,
|
|
224
|
+
);
|
|
225
|
+
};
|
|
185
226
|
export type ListEvmAccountsResult = NonNullable<Awaited<ReturnType<typeof listEvmAccounts>>>;
|
|
186
227
|
export type CreateEvmAccountResult = NonNullable<Awaited<ReturnType<typeof createEvmAccount>>>;
|
|
187
228
|
export type GetEvmAccountResult = NonNullable<Awaited<ReturnType<typeof getEvmAccount>>>;
|
|
229
|
+
export type UpdateEvmAccountResult = NonNullable<Awaited<ReturnType<typeof updateEvmAccount>>>;
|
|
188
230
|
export type GetEvmAccountByNameResult = NonNullable<
|
|
189
231
|
Awaited<ReturnType<typeof getEvmAccountByName>>
|
|
190
232
|
>;
|
|
@@ -192,3 +234,4 @@ export type SendEvmTransactionResult = NonNullable<Awaited<ReturnType<typeof sen
|
|
|
192
234
|
export type SignEvmTransactionResult = NonNullable<Awaited<ReturnType<typeof signEvmTransaction>>>;
|
|
193
235
|
export type SignEvmHashResult = NonNullable<Awaited<ReturnType<typeof signEvmHash>>>;
|
|
194
236
|
export type SignEvmMessageResult = NonNullable<Awaited<ReturnType<typeof signEvmMessage>>>;
|
|
237
|
+
export type SignEvmTypedDataResult = NonNullable<Awaited<ReturnType<typeof signEvmTypedData>>>;
|
|
@@ -99,7 +99,9 @@ export const getUserOperation = (
|
|
|
99
99
|
};
|
|
100
100
|
/**
|
|
101
101
|
* Sends a user operation with a signature.
|
|
102
|
-
The
|
|
102
|
+
The payload to sign must be the `userOpHash` field of the user operation. This hash should be signed directly (not using `personal_sign` or EIP-191 message hashing).
|
|
103
|
+
The signature must be 65 bytes in length, consisting of: - 32 bytes for the `r` value - 32 bytes for the `s` value - 1 byte for the `v` value (must be 27 or 28)
|
|
104
|
+
If using the CDP Paymaster, the user operation must be signed and sent within 2 minutes of being prepared.
|
|
103
105
|
* @summary Send a user operation
|
|
104
106
|
*/
|
|
105
107
|
export const sendUserOperation = (
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
2
|
-
export * from "./faucets/faucets.msw.js";
|
|
3
|
-
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
4
2
|
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
3
|
+
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
4
|
+
export * from "./faucets/faucets.msw.js";
|
|
5
|
+
export * from "./policy-engine/policy-engine.msw.js";
|
|
5
6
|
export * from "./solana-accounts/solana-accounts.msw.js";
|