@coinbase/cdp-sdk 1.6.0 → 1.7.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.
Files changed (161) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +62 -0
  3. package/_cjs/accounts/evm/toEvmSmartAccount.js +7 -0
  4. package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
  5. package/_cjs/accounts/{types.js.map → evm/types.js.map} +1 -1
  6. package/_cjs/accounts/solana/toSolanaAccount.js +41 -0
  7. package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -0
  8. package/_cjs/accounts/solana/types.js +3 -0
  9. package/_cjs/accounts/solana/types.js.map +1 -0
  10. package/_cjs/actions/evm/getUserOperation.js +36 -0
  11. package/_cjs/actions/evm/getUserOperation.js.map +1 -0
  12. package/_cjs/actions/evm/transfer/accountTransferStrategy.js +11 -7
  13. package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  14. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +9 -6
  15. package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  16. package/_cjs/actions/evm/transfer/transfer.js +7 -3
  17. package/_cjs/actions/evm/transfer/transfer.js.map +1 -1
  18. package/_cjs/actions/solana/requestFaucet.js +29 -0
  19. package/_cjs/actions/solana/requestFaucet.js.map +1 -0
  20. package/_cjs/actions/solana/signMessage.js +29 -0
  21. package/_cjs/actions/solana/signMessage.js.map +1 -0
  22. package/_cjs/actions/solana/signTransaction.js +46 -0
  23. package/_cjs/actions/solana/signTransaction.js.map +1 -0
  24. package/_cjs/actions/solana/types.js +3 -0
  25. package/_cjs/actions/solana/types.js.map +1 -0
  26. package/_cjs/client/evm/evm.js +2 -12
  27. package/_cjs/client/evm/evm.js.map +1 -1
  28. package/_cjs/client/solana/solana.js +22 -17
  29. package/_cjs/client/solana/solana.js.map +1 -1
  30. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +59 -1
  31. package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  32. package/_cjs/openapi-client/generated/index.msw.js +3 -2
  33. package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
  34. package/_cjs/openapi-client/generated/policy-engine/policy-engine.js +56 -0
  35. package/_cjs/openapi-client/generated/policy-engine/policy-engine.js.map +1 -0
  36. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +284 -0
  37. package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -0
  38. package/_cjs/openapi-client/index.js +1 -0
  39. package/_cjs/openapi-client/index.js.map +1 -1
  40. package/_cjs/version.js +1 -1
  41. package/_esm/accounts/evm/toEvmSmartAccount.js +7 -0
  42. package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
  43. package/_esm/accounts/{types.js.map → evm/types.js.map} +1 -1
  44. package/_esm/accounts/solana/toSolanaAccount.js +38 -0
  45. package/_esm/accounts/solana/toSolanaAccount.js.map +1 -0
  46. package/_esm/accounts/solana/types.js +2 -0
  47. package/_esm/accounts/solana/types.js.map +1 -0
  48. package/_esm/actions/evm/getUserOperation.js +33 -0
  49. package/_esm/actions/evm/getUserOperation.js.map +1 -0
  50. package/_esm/actions/evm/transfer/accountTransferStrategy.js +11 -7
  51. package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
  52. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +9 -6
  53. package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
  54. package/_esm/actions/evm/transfer/transfer.js +7 -3
  55. package/_esm/actions/evm/transfer/transfer.js.map +1 -1
  56. package/_esm/actions/solana/requestFaucet.js +26 -0
  57. package/_esm/actions/solana/requestFaucet.js.map +1 -0
  58. package/_esm/actions/solana/signMessage.js +26 -0
  59. package/_esm/actions/solana/signMessage.js.map +1 -0
  60. package/_esm/actions/solana/signTransaction.js +43 -0
  61. package/_esm/actions/solana/signTransaction.js.map +1 -0
  62. package/_esm/actions/solana/types.js +2 -0
  63. package/_esm/actions/solana/types.js.map +1 -0
  64. package/_esm/client/evm/evm.js +2 -12
  65. package/_esm/client/evm/evm.js.map +1 -1
  66. package/_esm/client/solana/solana.js +22 -17
  67. package/_esm/client/solana/solana.js.map +1 -1
  68. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +58 -0
  69. package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
  70. package/_esm/openapi-client/generated/index.msw.js +3 -2
  71. package/_esm/openapi-client/generated/index.msw.js.map +1 -1
  72. package/_esm/openapi-client/generated/policy-engine/policy-engine.js +48 -0
  73. package/_esm/openapi-client/generated/policy-engine/policy-engine.js.map +1 -0
  74. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +259 -0
  75. package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -0
  76. package/_esm/openapi-client/index.js +1 -0
  77. package/_esm/openapi-client/index.js.map +1 -1
  78. package/_esm/version.js +1 -1
  79. package/_types/accounts/evm/toEvmServerAccount.d.ts +1 -1
  80. package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
  81. package/_types/accounts/evm/toEvmSmartAccount.d.ts +1 -1
  82. package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
  83. package/_types/accounts/{types.d.ts → evm/types.d.ts} +5 -5
  84. package/_types/accounts/evm/types.d.ts.map +1 -0
  85. package/_types/accounts/solana/toSolanaAccount.d.ts +20 -0
  86. package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -0
  87. package/_types/accounts/solana/types.d.ts +12 -0
  88. package/_types/accounts/solana/types.d.ts.map +1 -0
  89. package/_types/actions/evm/getUserOperation.d.ts +22 -0
  90. package/_types/actions/evm/getUserOperation.d.ts.map +1 -0
  91. package/_types/actions/evm/sendUserOperation.d.ts +1 -1
  92. package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
  93. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts +1 -1
  94. package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
  95. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts +1 -1
  96. package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -1
  97. package/_types/actions/evm/transfer/transfer.d.ts +3 -3
  98. package/_types/actions/evm/transfer/transfer.d.ts.map +1 -1
  99. package/_types/actions/evm/transfer/types.d.ts +41 -7
  100. package/_types/actions/evm/transfer/types.d.ts.map +1 -1
  101. package/_types/actions/evm/types.d.ts +28 -5
  102. package/_types/actions/evm/types.d.ts.map +1 -1
  103. package/_types/actions/solana/requestFaucet.d.ts +23 -0
  104. package/_types/actions/solana/requestFaucet.d.ts.map +1 -0
  105. package/_types/actions/solana/signMessage.d.ts +23 -0
  106. package/_types/actions/solana/signMessage.d.ts.map +1 -0
  107. package/_types/actions/solana/signTransaction.d.ts +38 -0
  108. package/_types/actions/solana/signTransaction.d.ts.map +1 -0
  109. package/_types/actions/solana/types.d.ts +80 -0
  110. package/_types/actions/solana/types.d.ts.map +1 -0
  111. package/_types/client/evm/evm.d.ts.map +1 -1
  112. package/_types/client/evm/evm.types.d.ts +3 -3
  113. package/_types/client/evm/evm.types.d.ts.map +1 -1
  114. package/_types/client/solana/solana.d.ts +5 -4
  115. package/_types/client/solana/solana.d.ts.map +1 -1
  116. package/_types/client/solana/solana.types.d.ts +8 -11
  117. package/_types/client/solana/solana.types.d.ts.map +1 -1
  118. package/_types/index.d.ts +1 -1
  119. package/_types/index.d.ts.map +1 -1
  120. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +218 -0
  121. package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
  122. package/_types/openapi-client/generated/index.msw.d.ts +3 -2
  123. package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
  124. package/_types/openapi-client/generated/policy-engine/policy-engine.d.ts +43 -0
  125. package/_types/openapi-client/generated/policy-engine/policy-engine.d.ts.map +1 -0
  126. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +25 -0
  127. package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -0
  128. package/_types/openapi-client/index.d.ts +1 -0
  129. package/_types/openapi-client/index.d.ts.map +1 -1
  130. package/_types/version.d.ts +1 -1
  131. package/accounts/evm/toEvmServerAccount.ts +1 -1
  132. package/accounts/evm/toEvmSmartAccount.ts +11 -1
  133. package/accounts/{types.ts → evm/types.ts} +5 -5
  134. package/accounts/solana/toSolanaAccount.ts +59 -0
  135. package/accounts/solana/types.ts +13 -0
  136. package/actions/evm/getUserOperation.ts +40 -0
  137. package/actions/evm/sendUserOperation.ts +1 -1
  138. package/actions/evm/transfer/accountTransferStrategy.ts +12 -8
  139. package/actions/evm/transfer/smartAccountTransferStrategy.ts +10 -7
  140. package/actions/evm/transfer/transfer.ts +17 -6
  141. package/actions/evm/transfer/types.ts +55 -12
  142. package/actions/evm/types.ts +37 -5
  143. package/actions/solana/requestFaucet.ts +35 -0
  144. package/actions/solana/signMessage.ts +36 -0
  145. package/actions/solana/signTransaction.ts +53 -0
  146. package/actions/solana/types.ts +87 -0
  147. package/client/evm/evm.ts +3 -16
  148. package/client/evm/evm.types.ts +4 -3
  149. package/client/solana/solana.ts +32 -37
  150. package/client/solana/solana.types.ts +10 -15
  151. package/index.ts +1 -1
  152. package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +274 -0
  153. package/openapi-client/generated/index.msw.ts +3 -2
  154. package/openapi-client/generated/policy-engine/policy-engine.msw.ts +404 -0
  155. package/openapi-client/generated/policy-engine/policy-engine.ts +95 -0
  156. package/openapi-client/index.ts +1 -0
  157. package/package.json +1 -1
  158. package/version.ts +1 -1
  159. package/_types/accounts/types.d.ts.map +0 -1
  160. /package/_cjs/accounts/{types.js → evm/types.js} +0 -0
  161. /package/_esm/accounts/{types.js → evm/types.js} +0 -0
@@ -1,16 +1,20 @@
1
1
  import {
2
- SolanaClientInterface,
3
- Account,
4
2
  CreateAccountOptions,
5
3
  GetAccountOptions,
4
+ GetOrCreateAccountOptions,
6
5
  ListAccountsOptions,
7
- RequestFaucetOptions,
8
6
  ListAccountsResult,
7
+ RequestFaucetOptions,
9
8
  SignatureResult,
10
9
  SignMessageOptions,
11
10
  SignTransactionOptions,
12
- GetOrCreateAccountOptions,
11
+ SolanaClientInterface,
13
12
  } from "./solana.types.js";
13
+ import { toSolanaAccount } from "../../accounts/solana/toSolanaAccount.js";
14
+ import { SolanaAccount } from "../../accounts/solana/types.js";
15
+ import { requestFaucet } from "../../actions/solana/requestFaucet.js";
16
+ import { signMessage } from "../../actions/solana/signMessage.js";
17
+ import { signTransaction } from "../../actions/solana/signTransaction.js";
14
18
  import { APIError } from "../../openapi-client/errors.js";
15
19
  import { CdpOpenApiClient } from "../../openapi-client/index.js";
16
20
 
@@ -48,8 +52,12 @@ export class SolanaClient implements SolanaClientInterface {
48
52
  * await cdp.solana.createAccount({ idempotencyKey });
49
53
  * ```
50
54
  */
51
- async createAccount(options: CreateAccountOptions = {}): Promise<Account> {
52
- return CdpOpenApiClient.createSolanaAccount(options, options.idempotencyKey);
55
+ async createAccount(options: CreateAccountOptions = {}): Promise<SolanaAccount> {
56
+ const account = await CdpOpenApiClient.createSolanaAccount(options, options.idempotencyKey);
57
+
58
+ return toSolanaAccount(CdpOpenApiClient, {
59
+ account,
60
+ });
53
61
  }
54
62
 
55
63
  /**
@@ -77,13 +85,19 @@ export class SolanaClient implements SolanaClientInterface {
77
85
  * });
78
86
  * ```
79
87
  */
80
- async getAccount(options: GetAccountOptions): Promise<Account> {
88
+ async getAccount(options: GetAccountOptions): Promise<SolanaAccount> {
81
89
  if (options.address) {
82
- return CdpOpenApiClient.getSolanaAccount(options.address);
90
+ const account = await CdpOpenApiClient.getSolanaAccount(options.address);
91
+ return toSolanaAccount(CdpOpenApiClient, {
92
+ account,
93
+ });
83
94
  }
84
95
 
85
96
  if (options.name) {
86
- return CdpOpenApiClient.getSolanaAccountByName(options.name);
97
+ const account = await CdpOpenApiClient.getSolanaAccountByName(options.name);
98
+ return toSolanaAccount(CdpOpenApiClient, {
99
+ account,
100
+ });
87
101
  }
88
102
 
89
103
  throw new Error("Either address or name must be provided");
@@ -104,7 +118,7 @@ export class SolanaClient implements SolanaClientInterface {
104
118
  * });
105
119
  * ```
106
120
  */
107
- async getOrCreateAccount(options: GetOrCreateAccountOptions): Promise<Account> {
121
+ async getOrCreateAccount(options: GetOrCreateAccountOptions): Promise<SolanaAccount> {
108
122
  try {
109
123
  const account = await this.getAccount(options);
110
124
  return account;
@@ -165,7 +179,11 @@ export class SolanaClient implements SolanaClientInterface {
165
179
  });
166
180
 
167
181
  return {
168
- accounts: solAccounts.accounts,
182
+ accounts: solAccounts.accounts.map(account =>
183
+ toSolanaAccount(CdpOpenApiClient, {
184
+ account,
185
+ }),
186
+ ),
169
187
  nextPageToken: solAccounts.nextPageToken,
170
188
  };
171
189
  }
@@ -189,14 +207,7 @@ export class SolanaClient implements SolanaClientInterface {
189
207
  * ```
190
208
  */
191
209
  async requestFaucet(options: RequestFaucetOptions): Promise<SignatureResult> {
192
- const signature = await CdpOpenApiClient.requestSolanaFaucet(
193
- { address: options.address, token: options.token },
194
- options.idempotencyKey,
195
- );
196
-
197
- return {
198
- signature: signature.transactionSignature,
199
- };
210
+ return requestFaucet(CdpOpenApiClient, options);
200
211
  }
201
212
 
202
213
  /**
@@ -222,13 +233,7 @@ export class SolanaClient implements SolanaClientInterface {
222
233
  * ```
223
234
  */
224
235
  async signMessage(options: SignMessageOptions): Promise<SignatureResult> {
225
- return CdpOpenApiClient.signSolanaMessage(
226
- options.address,
227
- {
228
- message: options.message,
229
- },
230
- options.idempotencyKey,
231
- );
236
+ return signMessage(CdpOpenApiClient, options);
232
237
  }
233
238
 
234
239
  /**
@@ -265,16 +270,6 @@ export class SolanaClient implements SolanaClientInterface {
265
270
  * ```
266
271
  */
267
272
  async signTransaction(options: SignTransactionOptions): Promise<SignatureResult> {
268
- const signature = await CdpOpenApiClient.signSolanaTransaction(
269
- options.address,
270
- {
271
- transaction: options.transaction,
272
- },
273
- options.idempotencyKey,
274
- );
275
-
276
- return {
277
- signature: signature.signedTransaction,
278
- };
273
+ return signTransaction(CdpOpenApiClient, options);
279
274
  }
280
275
  }
@@ -1,7 +1,6 @@
1
- import {
2
- OpenApiSolanaMethods,
3
- SolanaAccount as OpenAPISolanaAccount,
4
- } from "../../openapi-client/index.js";
1
+ import { Account, SolanaAccount } from "../../accounts/solana/types.js";
2
+ import { OpenApiSolanaMethods } from "../../openapi-client/index.js";
3
+
5
4
  /**
6
5
  * The SolanaClient type, where all OpenApiSolanaMethods methods are wrapped.
7
6
  */
@@ -23,10 +22,14 @@ export type SolanaClientInterface = Omit<
23
22
  signMessage: (options: SignMessageOptions) => Promise<SignatureResult>;
24
23
  signTransaction: (options: SignTransactionOptions) => Promise<SignatureResult>;
25
24
  };
25
+
26
26
  /**
27
- * A Solana account.
27
+ * A Solana signature result.
28
28
  */
29
- export type Account = OpenAPISolanaAccount;
29
+ export interface SignatureResult {
30
+ /** The signature. */
31
+ signature: string;
32
+ }
30
33
 
31
34
  /**
32
35
  * Options for creating a Solana account.
@@ -71,7 +74,7 @@ export interface ListAccountsOptions {
71
74
  */
72
75
  export interface ListAccountsResult {
73
76
  /** The accounts. */
74
- accounts: Account[];
77
+ accounts: SolanaAccount[];
75
78
  /**
76
79
  * The token for the next page of accounts, if any.
77
80
  */
@@ -113,11 +116,3 @@ export interface SignTransactionOptions {
113
116
  /** The idempotency key. */
114
117
  idempotencyKey?: string;
115
118
  }
116
-
117
- /**
118
- * A Solana signature result.
119
- */
120
- export interface SignatureResult {
121
- /** The signature. */
122
- signature: string;
123
- }
package/index.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { CdpClient } from "./client/cdp.js";
2
- export type { EvmServerAccount, EvmSmartAccount } from "./accounts/types.js";
2
+ export type { EvmServerAccount, EvmSmartAccount } from "./accounts/evm/types.js";
@@ -33,6 +33,7 @@ export type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];
33
33
  // eslint-disable-next-line @typescript-eslint/no-redeclare
34
34
  export const ErrorType = {
35
35
  already_exists: "already_exists",
36
+ bad_gateway: "bad_gateway",
36
37
  faucet_limit_exceeded: "faucet_limit_exceeded",
37
38
  forbidden: "forbidden",
38
39
  idempotency_error: "idempotency_error",
@@ -43,9 +44,11 @@ export const ErrorType = {
43
44
  not_found: "not_found",
44
45
  rate_limit_exceeded: "rate_limit_exceeded",
45
46
  request_canceled: "request_canceled",
47
+ service_unavailable: "service_unavailable",
46
48
  timed_out: "timed_out",
47
49
  unauthorized: "unauthorized",
48
50
  policy_violation: "policy_violation",
51
+ policy_in_use: "policy_in_use",
49
52
  } as const;
50
53
 
51
54
  /**
@@ -197,6 +200,201 @@ export interface TokenBalance {
197
200
  token: Token;
198
201
  }
199
202
 
203
+ /**
204
+ * The type of criterion to use. This should be `ethValue`.
205
+ */
206
+ export type EthValueCriterionType =
207
+ (typeof EthValueCriterionType)[keyof typeof EthValueCriterionType];
208
+
209
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
210
+ export const EthValueCriterionType = {
211
+ ethValue: "ethValue",
212
+ } as const;
213
+
214
+ /**
215
+ * 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.
216
+ */
217
+ export type EthValueCriterionOperator =
218
+ (typeof EthValueCriterionOperator)[keyof typeof EthValueCriterionOperator];
219
+
220
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
221
+ export const EthValueCriterionOperator = {
222
+ ">": ">",
223
+ ">=": ">=",
224
+ "<": "<",
225
+ "<=": "<=",
226
+ "==": "==",
227
+ } as const;
228
+
229
+ /**
230
+ * A schema for specifying a criterion for the `value` field of an EVM transaction.
231
+ */
232
+ export interface EthValueCriterion {
233
+ /** The type of criterion to use. This should be `ethValue`. */
234
+ type: EthValueCriterionType;
235
+ /**
236
+ * The amount of ETH, in wei, that the transaction's `value` field should be compared to.
237
+ * @pattern ^[0-9]+$
238
+ */
239
+ ethValue: string;
240
+ /** 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. */
241
+ operator: EthValueCriterionOperator;
242
+ }
243
+
244
+ /**
245
+ * The type of criterion to use. This should be `evmAddress`.
246
+ */
247
+ export type EvmAddressCriterionType =
248
+ (typeof EvmAddressCriterionType)[keyof typeof EvmAddressCriterionType];
249
+
250
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
251
+ export const EvmAddressCriterionType = {
252
+ evmAddress: "evmAddress",
253
+ } as const;
254
+
255
+ /**
256
+ * 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.
257
+ */
258
+ export type EvmAddressCriterionOperator =
259
+ (typeof EvmAddressCriterionOperator)[keyof typeof EvmAddressCriterionOperator];
260
+
261
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
262
+ export const EvmAddressCriterionOperator = {
263
+ in: "in",
264
+ not_in: "not in",
265
+ } as const;
266
+
267
+ /**
268
+ * A schema for specifying a criterion for the `to` field of an EVM transaction.
269
+ */
270
+ export interface EvmAddressCriterion {
271
+ /** The type of criterion to use. This should be `evmAddress`. */
272
+ type: EvmAddressCriterionType;
273
+ /** 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. */
274
+ addresses: string[];
275
+ /** 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. */
276
+ operator: EvmAddressCriterionOperator;
277
+ }
278
+
279
+ export type SignEvmTransactionCriteriaItem = EthValueCriterion | EvmAddressCriterion;
280
+
281
+ /**
282
+ * A schema for specifying the rejection criteria for the SignEvmTransaction operation.
283
+ */
284
+ export type SignEvmTransactionCriteria = SignEvmTransactionCriteriaItem[];
285
+
286
+ /**
287
+ * The type of criterion to use. This should be `solAddress`.
288
+ */
289
+ export type SolAddressCriterionType =
290
+ (typeof SolAddressCriterionType)[keyof typeof SolAddressCriterionType];
291
+
292
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
293
+ export const SolAddressCriterionType = {
294
+ solAddress: "solAddress",
295
+ } as const;
296
+
297
+ /**
298
+ * 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.
299
+ */
300
+ export type SolAddressCriterionOperator =
301
+ (typeof SolAddressCriterionOperator)[keyof typeof SolAddressCriterionOperator];
302
+
303
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
304
+ export const SolAddressCriterionOperator = {
305
+ in: "in",
306
+ not_in: "not in",
307
+ } as const;
308
+
309
+ /**
310
+ * The criterion for the recipient addresses of a Solana transaction.
311
+ */
312
+ export interface SolAddressCriterion {
313
+ /** The type of criterion to use. This should be `solAddress`. */
314
+ type: SolAddressCriterionType;
315
+ /** 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. */
316
+ addresses: string[];
317
+ /** 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. */
318
+ operator: SolAddressCriterionOperator;
319
+ }
320
+
321
+ /**
322
+ * A schema for specifying the rejection criteria for the SignSolTransaction operation.
323
+ */
324
+ export type SignSolTransactionCriteria = SolAddressCriterion[];
325
+
326
+ /**
327
+ * Whether matching the rule will cause the request to be rejected or accepted.
328
+ */
329
+ export type RuleAction = (typeof RuleAction)[keyof typeof RuleAction];
330
+
331
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
332
+ export const RuleAction = {
333
+ reject: "reject",
334
+ accept: "accept",
335
+ } as const;
336
+
337
+ /**
338
+ * The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
339
+ */
340
+ export type RuleOperation = (typeof RuleOperation)[keyof typeof RuleOperation];
341
+
342
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
343
+ export const RuleOperation = {
344
+ signEvmTransaction: "signEvmTransaction",
345
+ signSolTransaction: "signSolTransaction",
346
+ } as const;
347
+
348
+ /**
349
+ * The set of criteria for the rule. There is a limit of 10 criteria per rule.
350
+ */
351
+ export type RuleCriteria = SignEvmTransactionCriteria | SignSolTransactionCriteria;
352
+
353
+ /**
354
+ * A rule that limits the behavior of an account.
355
+ */
356
+ export interface Rule {
357
+ /** Whether matching the rule will cause the request to be rejected or accepted. */
358
+ action: RuleAction;
359
+ /** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
360
+ operation: RuleOperation;
361
+ /** The set of criteria for the rule. There is a limit of 10 criteria per rule. */
362
+ criteria: RuleCriteria;
363
+ }
364
+
365
+ /**
366
+ * The scope of the policy. Only one project-level policy can exist at any time.
367
+ */
368
+ export type PolicyScope = (typeof PolicyScope)[keyof typeof PolicyScope];
369
+
370
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
371
+ export const PolicyScope = {
372
+ project: "project",
373
+ account: "account",
374
+ } as const;
375
+
376
+ export interface Policy {
377
+ /**
378
+ * The unique identifier for the policy.
379
+ * @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}$
380
+ */
381
+ id: string;
382
+ /**
383
+ * An optional human-readable description of the policy.
384
+ Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
385
+ * @pattern ^[A-Za-z0-9 ,.]{1,50}$
386
+ */
387
+ description?: string;
388
+ /** The scope of the policy. Only one project-level policy can exist at any time. */
389
+ scope: PolicyScope;
390
+ /** A list of rules that comprise the policy. */
391
+ rules: Rule[];
392
+ /** The ISO 8601 timestamp at which the Policy was created. */
393
+ createdAt: string;
394
+ /** The ISO 8601 timestamp at which the Policy was last updated. */
395
+ updatedAt: string;
396
+ }
397
+
200
398
  export interface SolanaAccount {
201
399
  /**
202
400
  * The base58 encoded Solana address.
@@ -217,6 +415,16 @@ Account names are guaranteed to be unique across all Solana accounts in the deve
217
415
  */
218
416
  export type InternalServerErrorResponse = Error;
219
417
 
418
+ /**
419
+ * Bad gateway.
420
+ */
421
+ export type BadGatewayErrorResponse = Error;
422
+
423
+ /**
424
+ * Service unavailable.
425
+ */
426
+ export type ServiceUnavailableErrorResponse = Error;
427
+
220
428
  /**
221
429
  * Idempotency key conflict.
222
430
  */
@@ -436,6 +644,72 @@ export type RequestEvmFaucet200 = {
436
644
  transactionHash: string;
437
645
  };
438
646
 
647
+ export type ListPoliciesParams = {
648
+ /**
649
+ * The number of policies to return per page.
650
+ */
651
+ pageSize?: number;
652
+ /**
653
+ * The token for the next page of policies, if any.
654
+ */
655
+ pageToken?: string;
656
+ /**
657
+ * 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.
658
+ */
659
+ scope?: ListPoliciesScope;
660
+ };
661
+
662
+ export type ListPoliciesScope = (typeof ListPoliciesScope)[keyof typeof ListPoliciesScope];
663
+
664
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
665
+ export const ListPoliciesScope = {
666
+ project: "project",
667
+ account: "account",
668
+ } as const;
669
+
670
+ export type ListPolicies200AllOf = {
671
+ /** The list of policies. */
672
+ policies: Policy[];
673
+ };
674
+
675
+ export type ListPolicies200 = ListPolicies200AllOf & ListResponse;
676
+
677
+ /**
678
+ * The scope of the policy.
679
+ */
680
+ export type CreatePolicyBodyScope =
681
+ (typeof CreatePolicyBodyScope)[keyof typeof CreatePolicyBodyScope];
682
+
683
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
684
+ export const CreatePolicyBodyScope = {
685
+ project: "project",
686
+ account: "account",
687
+ } as const;
688
+
689
+ export type CreatePolicyBody = {
690
+ /** The scope of the policy. */
691
+ scope: CreatePolicyBodyScope;
692
+ /**
693
+ * An optional human-readable description for the policy.
694
+ Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
695
+ * @pattern ^[A-Za-z0-9 ,.]{1,50}$
696
+ */
697
+ description?: string;
698
+ /** A list of rules that comprise the policy. There is a limit of 10 rules per policy. */
699
+ rules: Rule[];
700
+ };
701
+
702
+ export type UpdatePolicyBody = {
703
+ /**
704
+ * An optional human-readable description for the policy.
705
+ Policy descriptions can consist of alphanumeric characters, spaces, commas, and periods, and be 50 characters or less.
706
+ * @pattern ^[A-Za-z0-9 ,.]{1,50}$
707
+ */
708
+ description?: string;
709
+ /** A list of rules that comprise the policy. There is a limit of 10 rules per policy. */
710
+ rules: Rule[];
711
+ };
712
+
439
713
  export type ListSolanaAccountsParams = {
440
714
  /**
441
715
  * The number of accounts to return per page.
@@ -1,5 +1,6 @@
1
- export * from "./evm-accounts/evm-accounts.msw.js";
2
1
  export * from "./faucets/faucets.msw.js";
3
- export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
2
+ export * from "./evm-accounts/evm-accounts.msw.js";
4
3
  export * from "./evm-token-balances/evm-token-balances.msw.js";
4
+ export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
5
+ export * from "./policy-engine/policy-engine.msw.js";
5
6
  export * from "./solana-accounts/solana-accounts.msw.js";