@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
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PoliciesClient = void 0;
|
|
4
|
+
const index_js_1 = require("../../openapi-client/index.js");
|
|
5
|
+
const schema_js_1 = require("../../policies/schema.js");
|
|
6
|
+
/**
|
|
7
|
+
* The namespace containing all Policy methods.
|
|
8
|
+
*/
|
|
9
|
+
class PoliciesClient {
|
|
10
|
+
/**
|
|
11
|
+
* Lists policies belonging to the developer's CDP Project.
|
|
12
|
+
* Can be filtered by scope (project or account).
|
|
13
|
+
*
|
|
14
|
+
* @param {ListPoliciesOptions} [options] - Options for filtering and paginating the results
|
|
15
|
+
* @param {string} [options.scope] - Filter policies by scope ('project' or 'account')
|
|
16
|
+
* @param {number} [options.pageSize] - Maximum number of policies to return
|
|
17
|
+
* @param {string} [options.pageToken] - Pagination cursor for fetching next page of results
|
|
18
|
+
*
|
|
19
|
+
* @returns {Promise<ListPoliciesResult>} A paginated list of policies
|
|
20
|
+
*
|
|
21
|
+
* @example **List all policies**
|
|
22
|
+
* ```ts
|
|
23
|
+
* const { policies } = await cdp.policies.listPolicies();
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example **Filter by scope**
|
|
27
|
+
* ```ts
|
|
28
|
+
* const { policies } = await cdp.policies.listPolicies({
|
|
29
|
+
* scope: 'project'
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example **With pagination**
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Get first page
|
|
36
|
+
* const firstPage = await cdp.policies.listPolicies({
|
|
37
|
+
* pageSize: 10
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // Get next page using cursor
|
|
41
|
+
* const nextPage = await cdp.policies.listPolicies({
|
|
42
|
+
* pageSize: 10,
|
|
43
|
+
* pageToken: firstPage.pageToken
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
async listPolicies(options = {}) {
|
|
48
|
+
return index_js_1.CdpOpenApiClient.listPolicies(options);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new policy that can be used to govern the behavior of projects and accounts.
|
|
52
|
+
*
|
|
53
|
+
* @param {CreatePolicyOptions} options - Options for creating the policy
|
|
54
|
+
* @param {CreatePolicyBody} options.policy - The policy configuration to create
|
|
55
|
+
* @param {string} [options.policy.description] - Description of the policy's purpose
|
|
56
|
+
* @param {Rule[]} options.policy.rules - Rules that define the policy behavior
|
|
57
|
+
* @param {string} [options.idempotencyKey] - An idempotency key to prevent duplicate policy creation
|
|
58
|
+
*
|
|
59
|
+
* @returns {Promise<Policy>} The created policy
|
|
60
|
+
* @throws {ZodError<typeof CreatePolicyBodySchema>} When the policy is invalid
|
|
61
|
+
*
|
|
62
|
+
* @example **Creating a new policy**
|
|
63
|
+
* ```ts
|
|
64
|
+
* const policy = await cdp.policies.createPolicy({
|
|
65
|
+
* policy: {
|
|
66
|
+
* scope: "account",
|
|
67
|
+
* description: "Limits the amount of ETH in transaction",
|
|
68
|
+
* rules: [
|
|
69
|
+
* {
|
|
70
|
+
* action: "reject",
|
|
71
|
+
* operation: "signEvmTransaction",
|
|
72
|
+
* criteria: [
|
|
73
|
+
* {
|
|
74
|
+
* type: "ethValue",
|
|
75
|
+
* ethValue: "1000000000000000000",
|
|
76
|
+
* operator: ">",
|
|
77
|
+
* },
|
|
78
|
+
* ],
|
|
79
|
+
* },
|
|
80
|
+
* ],
|
|
81
|
+
* }
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example **With idempotency key**
|
|
86
|
+
* ```ts
|
|
87
|
+
* const idempotencyKey = uuidv4();
|
|
88
|
+
*
|
|
89
|
+
* // First call creates the policy
|
|
90
|
+
* const policy = await cdp.policies.createPolicy({
|
|
91
|
+
* policy: {
|
|
92
|
+
* scope: "account",
|
|
93
|
+
* description: "Limits the amount of ETH in transaction",
|
|
94
|
+
* rules: [
|
|
95
|
+
* {
|
|
96
|
+
* action: "reject",
|
|
97
|
+
* operation: "signEvmTransaction",
|
|
98
|
+
* criteria: [
|
|
99
|
+
* {
|
|
100
|
+
* type: "ethValue",
|
|
101
|
+
* ethValue: "1000000000000000000",
|
|
102
|
+
* operator: ">",
|
|
103
|
+
* },
|
|
104
|
+
* ],
|
|
105
|
+
* },
|
|
106
|
+
* ],
|
|
107
|
+
* },
|
|
108
|
+
* idempotencyKey
|
|
109
|
+
* });
|
|
110
|
+
*
|
|
111
|
+
* // Second call with same key returns the same policy
|
|
112
|
+
* const samePolicy = await cdp.policies.createPolicy({
|
|
113
|
+
* policy: { ... },
|
|
114
|
+
* idempotencyKey
|
|
115
|
+
* });
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
async createPolicy(options) {
|
|
119
|
+
schema_js_1.CreatePolicyBodySchema.parse(options.policy);
|
|
120
|
+
return index_js_1.CdpOpenApiClient.createPolicy(options.policy, options.idempotencyKey);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Retrieves a policy by its unique identifier.
|
|
124
|
+
*
|
|
125
|
+
* @param {GetPolicyByIdOptions} options - Options containing the policy ID to retrieve
|
|
126
|
+
* @param {string} options.id - The unique identifier of the policy to retrieve
|
|
127
|
+
*
|
|
128
|
+
* @returns {Promise<Policy>} The requested policy
|
|
129
|
+
*
|
|
130
|
+
* @example **Retrieving a policy by ID**
|
|
131
|
+
* ```ts
|
|
132
|
+
* const policy = await cdp.policies.getPolicyById({
|
|
133
|
+
* id: "__ID__"
|
|
134
|
+
* });
|
|
135
|
+
*
|
|
136
|
+
* console.log(policy.name);
|
|
137
|
+
* console.log(policy.rules);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
async getPolicyById(options) {
|
|
141
|
+
return index_js_1.CdpOpenApiClient.getPolicyById(options.id);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Deletes a policy by its unique identifier.
|
|
145
|
+
* If a policy is referenced by an active project or account, this operation will fail.
|
|
146
|
+
*
|
|
147
|
+
* @param {DeletePolicyOptions} options - Options containing the policy ID to delete
|
|
148
|
+
* @param {string} options.id - The unique identifier of the policy to delete
|
|
149
|
+
* @param {string} [options.idempotencyKey] - An idempotency key to prevent duplicate deletion
|
|
150
|
+
*
|
|
151
|
+
* @returns {Promise<void>} Void on successful deletion
|
|
152
|
+
*
|
|
153
|
+
* @example **Deleting a policy**
|
|
154
|
+
* ```ts
|
|
155
|
+
* await cdp.policies.deletePolicy({
|
|
156
|
+
* id: "__ID__"
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
159
|
+
*
|
|
160
|
+
* @example **With idempotency key**
|
|
161
|
+
* ```ts
|
|
162
|
+
* const idempotencyKey = uuidv4();
|
|
163
|
+
*
|
|
164
|
+
* // This operation is idempotent with the key
|
|
165
|
+
* await cdp.policies.deletePolicy({
|
|
166
|
+
* id: "__ID__",
|
|
167
|
+
* idempotencyKey
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
async deletePolicy(options) {
|
|
172
|
+
return index_js_1.CdpOpenApiClient.deletePolicy(options.id, options.idempotencyKey);
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Updates an existing policy by its unique identifier.
|
|
176
|
+
* This will apply the updated policy to any project or accounts that are currently using it.
|
|
177
|
+
*
|
|
178
|
+
* @param {UpdatePolicyOptions} options - Options containing the policy ID and updated policy data
|
|
179
|
+
* @param {string} options.id - The unique identifier of the policy to update
|
|
180
|
+
* @param {UpdatePolicyBody} options.policy - The updated policy configuration
|
|
181
|
+
* @param {string} [options.policy.description] - Updated description of the policy's purpose
|
|
182
|
+
* @param {Rule[]} [options.policy.rules] - Updated rules that define the policy behavior
|
|
183
|
+
* @param {string} [options.idempotencyKey] - An idempotency key to prevent duplicate updates
|
|
184
|
+
*
|
|
185
|
+
* @returns {Promise<Policy>} The updated policy
|
|
186
|
+
* @throws {ZodError<typeof UpdatePolicyBodySchema>} When the updated policy is invalid
|
|
187
|
+
*
|
|
188
|
+
* @example **Updating a policy**
|
|
189
|
+
* ```ts
|
|
190
|
+
* const updatedPolicy = await cdp.policies.updatePolicy({
|
|
191
|
+
* id: "__ID__",
|
|
192
|
+
* policy: {
|
|
193
|
+
* description: "Now with lower transaction limits",
|
|
194
|
+
* rules: [
|
|
195
|
+
* {
|
|
196
|
+
* action: "reject",
|
|
197
|
+
* operation: "signEvmTransaction",
|
|
198
|
+
* criteria: [
|
|
199
|
+
* {
|
|
200
|
+
* type: "ethValue",
|
|
201
|
+
* ethValue: "1000000000",
|
|
202
|
+
* operator: ">",
|
|
203
|
+
* },
|
|
204
|
+
* ],
|
|
205
|
+
* },
|
|
206
|
+
* ],
|
|
207
|
+
* },
|
|
208
|
+
* });
|
|
209
|
+
* ```
|
|
210
|
+
*
|
|
211
|
+
* @example **With idempotency key**
|
|
212
|
+
* ```ts
|
|
213
|
+
* const idempotencyKey = uuidv4();
|
|
214
|
+
*
|
|
215
|
+
* // This operation is idempotent with the key
|
|
216
|
+
* await cdp.policies.updatePolicy({
|
|
217
|
+
* id: "__ID__",
|
|
218
|
+
* policy: {
|
|
219
|
+
* description: "Modified Policy",
|
|
220
|
+
* rules: { ... }
|
|
221
|
+
* },
|
|
222
|
+
* idempotencyKey
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
async updatePolicy(options) {
|
|
227
|
+
schema_js_1.UpdatePolicyBodySchema.parse(options.policy);
|
|
228
|
+
return index_js_1.CdpOpenApiClient.updatePolicy(options.id, options.policy, options.idempotencyKey);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
exports.PoliciesClient = PoliciesClient;
|
|
232
|
+
//# sourceMappingURL=policies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../../client/policies/policies.ts"],"names":[],"mappings":";;;AASA,4DAAiE;AACjE,wDAA0F;AAG1F;;GAEG;AACH,MAAa,cAAc;IACzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,KAAK,CAAC,YAAY,CAAC,UAA+B,EAAE;QAClD,OAAO,2BAAgB,CAAC,YAAY,CAAC,OAAO,CAAgC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmEG;IACH,KAAK,CAAC,YAAY,CAAC,OAA4B;QAC7C,kCAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,2BAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,cAAc,CAAoB,CAAC;IAClG,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,aAAa,CAAC,OAA6B;QAC/C,OAAO,2BAAgB,CAAC,aAAa,CAAC,OAAO,CAAC,EAAE,CAAoB,CAAC;IACvE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,YAAY,CAAC,OAA4B;QAC7C,OAAO,2BAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3E,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmDG;IACH,KAAK,CAAC,YAAY,CAAC,OAA4B;QAC7C,kCAAsB,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7C,OAAO,2BAAgB,CAAC,YAAY,CAClC,OAAO,CAAC,EAAE,EACV,OAAO,CAAC,MAAM,EACd,OAAO,CAAC,cAAc,CACJ,CAAC;IACvB,CAAC;CACF;AArOD,wCAqOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policies.types.js","sourceRoot":"","sources":["../../../client/policies/policies.types.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SolanaClient = void 0;
|
|
4
|
+
const toSolanaAccount_js_1 = require("../../accounts/solana/toSolanaAccount.js");
|
|
5
|
+
const requestFaucet_js_1 = require("../../actions/solana/requestFaucet.js");
|
|
6
|
+
const signMessage_js_1 = require("../../actions/solana/signMessage.js");
|
|
7
|
+
const signTransaction_js_1 = require("../../actions/solana/signTransaction.js");
|
|
8
|
+
const analytics_js_1 = require("../../analytics.js");
|
|
4
9
|
const errors_js_1 = require("../../openapi-client/errors.js");
|
|
5
10
|
const index_js_1 = require("../../openapi-client/index.js");
|
|
6
11
|
/**
|
|
@@ -38,7 +43,12 @@ class SolanaClient {
|
|
|
38
43
|
* ```
|
|
39
44
|
*/
|
|
40
45
|
async createAccount(options = {}) {
|
|
41
|
-
|
|
46
|
+
const openApiAccount = await index_js_1.CdpOpenApiClient.createSolanaAccount(options, options.idempotencyKey);
|
|
47
|
+
const account = (0, toSolanaAccount_js_1.toSolanaAccount)(index_js_1.CdpOpenApiClient, {
|
|
48
|
+
account: openApiAccount,
|
|
49
|
+
});
|
|
50
|
+
analytics_js_1.Analytics.wrapObjectMethodsWithErrorTracking(account);
|
|
51
|
+
return account;
|
|
42
52
|
}
|
|
43
53
|
/**
|
|
44
54
|
* Gets a Solana account by its address.
|
|
@@ -66,13 +76,20 @@ class SolanaClient {
|
|
|
66
76
|
* ```
|
|
67
77
|
*/
|
|
68
78
|
async getAccount(options) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
const openApiAccount = await (() => {
|
|
80
|
+
if (options.address) {
|
|
81
|
+
return index_js_1.CdpOpenApiClient.getSolanaAccount(options.address);
|
|
82
|
+
}
|
|
83
|
+
if (options.name) {
|
|
84
|
+
return index_js_1.CdpOpenApiClient.getSolanaAccountByName(options.name);
|
|
85
|
+
}
|
|
86
|
+
throw new Error("Either address or name must be provided");
|
|
87
|
+
})();
|
|
88
|
+
const account = (0, toSolanaAccount_js_1.toSolanaAccount)(index_js_1.CdpOpenApiClient, {
|
|
89
|
+
account: openApiAccount,
|
|
90
|
+
});
|
|
91
|
+
analytics_js_1.Analytics.wrapObjectMethodsWithErrorTracking(account);
|
|
92
|
+
return account;
|
|
76
93
|
}
|
|
77
94
|
/**
|
|
78
95
|
* Gets a Solana account by its address.
|
|
@@ -149,7 +166,13 @@ class SolanaClient {
|
|
|
149
166
|
pageToken: options.pageToken,
|
|
150
167
|
});
|
|
151
168
|
return {
|
|
152
|
-
accounts: solAccounts.accounts
|
|
169
|
+
accounts: solAccounts.accounts.map(account => {
|
|
170
|
+
const solanaAccount = (0, toSolanaAccount_js_1.toSolanaAccount)(index_js_1.CdpOpenApiClient, {
|
|
171
|
+
account,
|
|
172
|
+
});
|
|
173
|
+
analytics_js_1.Analytics.wrapObjectMethodsWithErrorTracking(solanaAccount);
|
|
174
|
+
return solanaAccount;
|
|
175
|
+
}),
|
|
153
176
|
nextPageToken: solAccounts.nextPageToken,
|
|
154
177
|
};
|
|
155
178
|
}
|
|
@@ -172,10 +195,7 @@ class SolanaClient {
|
|
|
172
195
|
* ```
|
|
173
196
|
*/
|
|
174
197
|
async requestFaucet(options) {
|
|
175
|
-
|
|
176
|
-
return {
|
|
177
|
-
signature: signature.transactionSignature,
|
|
178
|
-
};
|
|
198
|
+
return (0, requestFaucet_js_1.requestFaucet)(index_js_1.CdpOpenApiClient, options);
|
|
179
199
|
}
|
|
180
200
|
/**
|
|
181
201
|
* Signs a message.
|
|
@@ -200,9 +220,7 @@ class SolanaClient {
|
|
|
200
220
|
* ```
|
|
201
221
|
*/
|
|
202
222
|
async signMessage(options) {
|
|
203
|
-
return index_js_1.CdpOpenApiClient
|
|
204
|
-
message: options.message,
|
|
205
|
-
}, options.idempotencyKey);
|
|
223
|
+
return (0, signMessage_js_1.signMessage)(index_js_1.CdpOpenApiClient, options);
|
|
206
224
|
}
|
|
207
225
|
/**
|
|
208
226
|
* Signs a transaction.
|
|
@@ -238,12 +256,56 @@ class SolanaClient {
|
|
|
238
256
|
* ```
|
|
239
257
|
*/
|
|
240
258
|
async signTransaction(options) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
259
|
+
return (0, signTransaction_js_1.signTransaction)(index_js_1.CdpOpenApiClient, options);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Updates a CDP Solana account.
|
|
263
|
+
*
|
|
264
|
+
* @param {UpdateSolanaAccountOptions} [options] - Optional parameters for creating the account.
|
|
265
|
+
* @param {string} options.address - The address of the account to update
|
|
266
|
+
* @param {UpdateSolanaAccountBody} options.update - An object containing account fields to update.
|
|
267
|
+
* @param {string} [options.update.name] - The new name for the account.
|
|
268
|
+
* @param {string} [options.update.accountPolicy] - The ID of a Policy to apply to the account.
|
|
269
|
+
* @param {string} [options.idempotencyKey] - An idempotency key.
|
|
270
|
+
*
|
|
271
|
+
* @returns A promise that resolves to the updated account.
|
|
272
|
+
*
|
|
273
|
+
* @example **With a name**
|
|
274
|
+
* ```ts
|
|
275
|
+
* const account = await cdp.sol.updateAccount({ address: "...", update: { name: "New Name" } });
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @example **With an account policy**
|
|
279
|
+
* ```ts
|
|
280
|
+
* const account = await cdp.sol.updateAccount({ address: "...", update: { accountPolicy: "73bcaeeb-d7af-4615-b064-42b5fe83a31e" } });
|
|
281
|
+
* ```
|
|
282
|
+
*
|
|
283
|
+
* @example **With an idempotency key**
|
|
284
|
+
* ```ts
|
|
285
|
+
* const idempotencyKey = uuidv4();
|
|
286
|
+
*
|
|
287
|
+
* // First call
|
|
288
|
+
* await cdp.sol.updateAccount({
|
|
289
|
+
* address: "0x...",
|
|
290
|
+
* update: { accountPolicy: "73bcaeeb-d7af-4615-b064-42b5fe83a31e" },
|
|
291
|
+
* idempotencyKey,
|
|
292
|
+
* });
|
|
293
|
+
*
|
|
294
|
+
* // Second call with the same idempotency key will not update
|
|
295
|
+
* await cdp.sol.updateAccount({
|
|
296
|
+
* address: '0x...',
|
|
297
|
+
* update: { name: "" },
|
|
298
|
+
* idempotencyKey,
|
|
299
|
+
* });
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
async updateAccount(options) {
|
|
303
|
+
const openApiAccount = await index_js_1.CdpOpenApiClient.updateSolanaAccount(options.address, options.update, options.idempotencyKey);
|
|
304
|
+
const account = (0, toSolanaAccount_js_1.toSolanaAccount)(index_js_1.CdpOpenApiClient, {
|
|
305
|
+
account: openApiAccount,
|
|
306
|
+
});
|
|
307
|
+
analytics_js_1.Analytics.wrapObjectMethodsWithErrorTracking(account);
|
|
308
|
+
return account;
|
|
247
309
|
}
|
|
248
310
|
}
|
|
249
311
|
exports.SolanaClient = SolanaClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.js","sourceRoot":"","sources":["../../../client/solana/solana.ts"],"names":[],"mappings":";;;AAaA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ACjB,CAAC;CACF;AAnUD,oCAmUC"}
|
package/_cjs/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CdpClient = void 0;
|
|
3
|
+
exports.UpdatePolicyBodySchema = exports.CreatePolicyBodySchema = exports.CdpClient = void 0;
|
|
4
4
|
var cdp_js_1 = require("./client/cdp.js");
|
|
5
5
|
Object.defineProperty(exports, "CdpClient", { enumerable: true, get: function () { return cdp_js_1.CdpClient; } });
|
|
6
|
+
var schema_js_1 = require("./policies/schema.js");
|
|
7
|
+
Object.defineProperty(exports, "CreatePolicyBodySchema", { enumerable: true, get: function () { return schema_js_1.CreatePolicyBodySchema; } });
|
|
8
|
+
Object.defineProperty(exports, "UpdatePolicyBodySchema", { enumerable: true, get: function () { return schema_js_1.UpdatePolicyBodySchema; } });
|
|
6
9
|
//# sourceMappingURL=index.js.map
|
package/_cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,0CAA4C;AAAnC,mGAAA,SAAS,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;AAAA,0CAA4C;AAAnC,mGAAA,SAAS,OAAA;AAGlB,kDAK8B;AAJ5B,mHAAA,sBAAsB,OAAA;AACtB,mHAAA,sBAAsB,OAAA"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RequestSolanaFaucetBodyToken = exports.RequestEvmFaucetBodyToken = exports.RequestEvmFaucetBodyNetwork = exports.PrepareUserOperationBodyNetwork = exports.SendEvmTransactionBodyNetwork = exports.ListEvmTokenBalancesNetwork = exports.EvmUserOperationStatus = exports.EvmUserOperationNetwork = exports.ErrorType = void 0;
|
|
3
|
+
exports.RequestSolanaFaucetBodyToken = exports.CreatePolicyBodyScope = exports.ListPoliciesScope = exports.RequestEvmFaucetBodyToken = exports.RequestEvmFaucetBodyNetwork = exports.PrepareUserOperationBodyNetwork = exports.SendEvmTransactionBodyNetwork = exports.PolicyScope = exports.RuleOperation = exports.RuleAction = exports.SolAddressCriterionOperator = exports.SolAddressCriterionType = exports.EvmAddressCriterionOperator = exports.EvmAddressCriterionType = exports.EthValueCriterionOperator = exports.EthValueCriterionType = exports.ListEvmTokenBalancesNetwork = exports.EvmUserOperationStatus = exports.EvmUserOperationNetwork = exports.ErrorType = void 0;
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
5
5
|
exports.ErrorType = {
|
|
6
6
|
already_exists: "already_exists",
|
|
7
|
+
bad_gateway: "bad_gateway",
|
|
7
8
|
faucet_limit_exceeded: "faucet_limit_exceeded",
|
|
8
9
|
forbidden: "forbidden",
|
|
9
10
|
idempotency_error: "idempotency_error",
|
|
@@ -14,9 +15,11 @@ exports.ErrorType = {
|
|
|
14
15
|
not_found: "not_found",
|
|
15
16
|
rate_limit_exceeded: "rate_limit_exceeded",
|
|
16
17
|
request_canceled: "request_canceled",
|
|
18
|
+
service_unavailable: "service_unavailable",
|
|
17
19
|
timed_out: "timed_out",
|
|
18
20
|
unauthorized: "unauthorized",
|
|
19
21
|
policy_violation: "policy_violation",
|
|
22
|
+
policy_in_use: "policy_in_use",
|
|
20
23
|
};
|
|
21
24
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
22
25
|
exports.EvmUserOperationNetwork = {
|
|
@@ -37,6 +40,51 @@ exports.ListEvmTokenBalancesNetwork = {
|
|
|
37
40
|
"base-sepolia": "base-sepolia",
|
|
38
41
|
};
|
|
39
42
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
43
|
+
exports.EthValueCriterionType = {
|
|
44
|
+
ethValue: "ethValue",
|
|
45
|
+
};
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
47
|
+
exports.EthValueCriterionOperator = {
|
|
48
|
+
">": ">",
|
|
49
|
+
">=": ">=",
|
|
50
|
+
"<": "<",
|
|
51
|
+
"<=": "<=",
|
|
52
|
+
"==": "==",
|
|
53
|
+
};
|
|
54
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
55
|
+
exports.EvmAddressCriterionType = {
|
|
56
|
+
evmAddress: "evmAddress",
|
|
57
|
+
};
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
59
|
+
exports.EvmAddressCriterionOperator = {
|
|
60
|
+
in: "in",
|
|
61
|
+
not_in: "not in",
|
|
62
|
+
};
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
64
|
+
exports.SolAddressCriterionType = {
|
|
65
|
+
solAddress: "solAddress",
|
|
66
|
+
};
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
68
|
+
exports.SolAddressCriterionOperator = {
|
|
69
|
+
in: "in",
|
|
70
|
+
not_in: "not in",
|
|
71
|
+
};
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
73
|
+
exports.RuleAction = {
|
|
74
|
+
reject: "reject",
|
|
75
|
+
accept: "accept",
|
|
76
|
+
};
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
78
|
+
exports.RuleOperation = {
|
|
79
|
+
signEvmTransaction: "signEvmTransaction",
|
|
80
|
+
signSolTransaction: "signSolTransaction",
|
|
81
|
+
};
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
83
|
+
exports.PolicyScope = {
|
|
84
|
+
project: "project",
|
|
85
|
+
account: "account",
|
|
86
|
+
};
|
|
87
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
40
88
|
exports.SendEvmTransactionBodyNetwork = {
|
|
41
89
|
base: "base",
|
|
42
90
|
"base-sepolia": "base-sepolia",
|
|
@@ -59,6 +107,16 @@ exports.RequestEvmFaucetBodyToken = {
|
|
|
59
107
|
cbbtc: "cbbtc",
|
|
60
108
|
};
|
|
61
109
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
110
|
+
exports.ListPoliciesScope = {
|
|
111
|
+
project: "project",
|
|
112
|
+
account: "account",
|
|
113
|
+
};
|
|
114
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
115
|
+
exports.CreatePolicyBodyScope = {
|
|
116
|
+
project: "project",
|
|
117
|
+
account: "account",
|
|
118
|
+
};
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
62
120
|
exports.RequestSolanaFaucetBodyToken = {
|
|
63
121
|
sol: "sol",
|
|
64
122
|
usdc: "usdc",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coinbaseDeveloperPlatformAPIs.schemas.js","sourceRoot":"","sources":["../../../openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"coinbaseDeveloperPlatformAPIs.schemas.js","sourceRoot":"","sources":["../../../openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts"],"names":[],"mappings":";;;AAkCA,2DAA2D;AAC9C,QAAA,SAAS,GAAG;IACvB,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;IAC1B,qBAAqB,EAAE,uBAAuB;IAC9C,SAAS,EAAE,WAAW;IACtB,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,eAAe,EAAE,iBAAiB;IAClC,iBAAiB,EAAE,mBAAmB;IACtC,qBAAqB,EAAE,uBAAuB;IAC9C,SAAS,EAAE,WAAW;IACtB,mBAAmB,EAAE,qBAAqB;IAC1C,gBAAgB,EAAE,kBAAkB;IACpC,mBAAmB,EAAE,qBAAqB;IAC1C,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,gBAAgB,EAA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E,oBAAoB;CAChC,CAAC;AAwBX,2DAA2D;AAC9C,QAAA,WAAW,GAAG;IACzB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AAmIX,2DAA2D;AAC9C,QAAA,6BAA6B,GAAG;IAC3C,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,cAAc;CACtB,CAAC;AA8EX,2DAA2D;AAC9C,QAAA,+BAA+B,GAAG;IAC7C,cAAc,EAAE,cAAc;IAC9B,IAAI,EAAE,MAAM;CACJ,CAAC;AAwCX,2DAA2D;AAC9C,QAAA,2BAA2B,GAAG;IACzC,cAAc,EAAE,cAAc;IAC9B,kBAAkB,EAAE,kBAAkB;CAC9B,CAAC;AAQX,2DAA2D;AAC9C,QAAA,yBAAyB,GAAG;IACvC,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;CACN,CAAC;AAqCX,2DAA2D;AAC9C,QAAA,iBAAiB,GAAG;IAC/B,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AAeX,2DAA2D;AAC9C,QAAA,qBAAqB,GAAG;IACnC,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AA8FX,2DAA2D;AAC9C,QAAA,4BAA4B,GAAG;IAC1C,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.signEvmMessage = exports.signEvmHash = exports.signEvmTransaction = exports.sendEvmTransaction = exports.getEvmAccountByName = exports.getEvmAccount = exports.createEvmAccount = exports.listEvmAccounts = void 0;
|
|
3
|
+
exports.signEvmTypedData = exports.signEvmMessage = exports.signEvmHash = exports.signEvmTransaction = exports.sendEvmTransaction = exports.getEvmAccountByName = exports.updateEvmAccount = exports.getEvmAccount = exports.createEvmAccount = exports.listEvmAccounts = void 0;
|
|
4
4
|
const cdpApiClient_js_1 = require("../../cdpApiClient.js");
|
|
5
5
|
/**
|
|
6
6
|
* Lists the EVM accounts belonging to the developer's CDP Project.
|
|
@@ -32,6 +32,19 @@ const getEvmAccount = (address, options) => {
|
|
|
32
32
|
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/evm/accounts/${address}`, method: "GET" }, options);
|
|
33
33
|
};
|
|
34
34
|
exports.getEvmAccount = getEvmAccount;
|
|
35
|
+
/**
|
|
36
|
+
* Updates an existing EVM account. Use this to update the account's name or account-level policy.
|
|
37
|
+
* @summary Update an EVM account
|
|
38
|
+
*/
|
|
39
|
+
const updateEvmAccount = (address, updateEvmAccountBody, options) => {
|
|
40
|
+
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
41
|
+
url: `/v2/evm/accounts/${address}`,
|
|
42
|
+
method: "PUT",
|
|
43
|
+
headers: { "Content-Type": "application/json" },
|
|
44
|
+
data: updateEvmAccountBody,
|
|
45
|
+
}, options);
|
|
46
|
+
};
|
|
47
|
+
exports.updateEvmAccount = updateEvmAccount;
|
|
35
48
|
/**
|
|
36
49
|
* Gets an EVM account by its name.
|
|
37
50
|
* @summary Get an EVM account by name
|
|
@@ -122,4 +135,17 @@ const signEvmMessage = (address, signEvmMessageBody, options) => {
|
|
|
122
135
|
}, options);
|
|
123
136
|
};
|
|
124
137
|
exports.signEvmMessage = signEvmMessage;
|
|
138
|
+
/**
|
|
139
|
+
* Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given EVM account.
|
|
140
|
+
* @summary Sign EIP-712 typed data
|
|
141
|
+
*/
|
|
142
|
+
const signEvmTypedData = (address, eIP712Message, options) => {
|
|
143
|
+
return (0, cdpApiClient_js_1.cdpApiClient)({
|
|
144
|
+
url: `/v2/evm/accounts/${address}/sign/typed-data`,
|
|
145
|
+
method: "POST",
|
|
146
|
+
headers: { "Content-Type": "application/json" },
|
|
147
|
+
data: eIP712Message,
|
|
148
|
+
}, options);
|
|
149
|
+
};
|
|
150
|
+
exports.signEvmTypedData = signEvmTypedData;
|
|
125
151
|
//# sourceMappingURL=evm-accounts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evm-accounts.js","sourceRoot":"","sources":["../../../../openapi-client/generated/evm-accounts/evm-accounts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"evm-accounts.js","sourceRoot":"","sources":["../../../../openapi-client/generated/evm-accounts/evm-accounts.ts"],"names":[],"mappings":";;;AAyBA,2DAAqD;AAIrD;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAC7B,MAA8B,EAC9B,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB,EAAE,GAAG,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAClD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B;AACF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAC9B,oBAA2C,EAC3C,OAA8C,EAC9C,EAAE;IACF,OAAO,IAAA,8BAAY,EACjB;QACE,GAAG,EAAE,kBAAkB;QACvB,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,oBAAoB;KAC3B,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,gBAAgB,oBAa3B;AACF;;;GAGG;AACI,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,OAA8C,EAAE,EAAE;IAC/F,OAAO,IAAA,8BAAY,EAAa,EAAE,GAAG,EAAE,oBAAoB,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;AAClG,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB;AACF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAC9B,OAAe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