@coinbase/cdp-sdk 1.36.0 → 1.37.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 +12 -0
- package/_cjs/accounts/evm/types.js +3 -0
- package/_cjs/accounts/evm/types.js.map +1 -1
- package/_cjs/accounts/solana/types.js +3 -0
- package/_cjs/accounts/solana/types.js.map +1 -1
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js +0 -11
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
- package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +0 -8
- package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
- package/_cjs/actions/evm/types.js +3 -0
- package/_cjs/actions/evm/types.js.map +1 -1
- package/_cjs/actions/solana/types.js +3 -0
- package/_cjs/actions/solana/types.js.map +1 -1
- package/_cjs/auth/errors.js +3 -0
- package/_cjs/auth/errors.js.map +1 -1
- package/_cjs/auth/hooks/axios/withAuth.js +3 -0
- package/_cjs/auth/hooks/axios/withAuth.js.map +1 -1
- package/_cjs/auth/utils/hash.js +3 -0
- package/_cjs/auth/utils/hash.js.map +1 -1
- package/_cjs/auth/utils/http.js +3 -0
- package/_cjs/auth/utils/http.js.map +1 -1
- package/_cjs/auth/utils/jwt.js +3 -0
- package/_cjs/auth/utils/jwt.js.map +1 -1
- package/_cjs/auth/utils/ws.js +3 -0
- package/_cjs/auth/utils/ws.js.map +1 -1
- package/_cjs/client/evm/evm.js +3 -0
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/evm/evm.types.js +3 -0
- package/_cjs/client/evm/evm.types.js.map +1 -1
- package/_cjs/client/policies/policies.js +3 -0
- package/_cjs/client/policies/policies.js.map +1 -1
- package/_cjs/client/policies/policies.types.js +3 -0
- package/_cjs/client/policies/policies.types.js.map +1 -1
- package/_cjs/client/solana/solana.js +3 -0
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/client/solana/solana.types.js +3 -0
- package/_cjs/client/solana/solana.types.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +73 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/onchain-data/onchain-data.js +1 -39
- package/_cjs/openapi-client/generated/onchain-data/onchain-data.js.map +1 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js +29 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +43 -0
- package/_cjs/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -0
- package/_cjs/openapi-client/index.js +1 -0
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/policies/solanaSchema.js +92 -2
- package/_cjs/policies/solanaSchema.js.map +1 -1
- package/_cjs/policies/types.js +1 -0
- package/_cjs/policies/types.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/types.js +3 -0
- package/_esm/accounts/evm/types.js.map +1 -1
- package/_esm/accounts/solana/types.js +3 -0
- package/_esm/accounts/solana/types.js.map +1 -1
- package/_esm/actions/evm/transfer/accountTransferStrategy.js +0 -11
- package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -1
- package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +0 -8
- package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -1
- package/_esm/actions/evm/types.js +3 -0
- package/_esm/actions/evm/types.js.map +1 -1
- package/_esm/actions/solana/types.js +3 -0
- package/_esm/actions/solana/types.js.map +1 -1
- package/_esm/auth/errors.js +3 -0
- package/_esm/auth/errors.js.map +1 -1
- package/_esm/auth/hooks/axios/withAuth.js +3 -0
- package/_esm/auth/hooks/axios/withAuth.js.map +1 -1
- package/_esm/auth/utils/hash.js +3 -0
- package/_esm/auth/utils/hash.js.map +1 -1
- package/_esm/auth/utils/http.js +3 -0
- package/_esm/auth/utils/http.js.map +1 -1
- package/_esm/auth/utils/jwt.js +3 -0
- package/_esm/auth/utils/jwt.js.map +1 -1
- package/_esm/auth/utils/ws.js +3 -0
- package/_esm/auth/utils/ws.js.map +1 -1
- package/_esm/client/evm/evm.js +3 -0
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/evm/evm.types.js +3 -0
- package/_esm/client/evm/evm.types.js.map +1 -1
- package/_esm/client/policies/policies.js +3 -0
- package/_esm/client/policies/policies.js.map +1 -1
- package/_esm/client/policies/policies.types.js +3 -0
- package/_esm/client/policies/policies.types.js.map +1 -1
- package/_esm/client/solana/solana.js +3 -0
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/client/solana/solana.types.js +3 -0
- package/_esm/client/solana/solana.types.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +71 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/onchain-data/onchain-data.js +0 -37
- package/_esm/openapi-client/generated/onchain-data/onchain-data.js.map +1 -1
- package/_esm/openapi-client/generated/onramp/onramp.js +27 -0
- package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js +39 -0
- package/_esm/openapi-client/generated/sql-api-alpha/sql-api-alpha.js.map +1 -0
- package/_esm/openapi-client/index.js +1 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/policies/solanaSchema.js +91 -1
- package/_esm/policies/solanaSchema.js.map +1 -1
- package/_esm/policies/types.js +2 -1
- package/_esm/policies/types.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/types.d.ts +16 -0
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/accounts/solana/types.d.ts +8 -0
- package/_types/accounts/solana/types.d.ts.map +1 -1
- package/_types/actions/evm/spend-permissions/types.d.ts +1 -1
- package/_types/actions/evm/spend-permissions/types.d.ts.map +1 -1
- package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -1
- package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -1
- package/_types/actions/evm/types.d.ts +3 -0
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/actions/solana/types.d.ts +3 -0
- package/_types/actions/solana/types.d.ts.map +1 -1
- package/_types/auth/errors.d.ts +3 -0
- package/_types/auth/errors.d.ts.map +1 -1
- package/_types/auth/hooks/axios/withAuth.d.ts +3 -0
- package/_types/auth/hooks/axios/withAuth.d.ts.map +1 -1
- package/_types/auth/utils/hash.d.ts +3 -0
- package/_types/auth/utils/hash.d.ts.map +1 -1
- package/_types/auth/utils/http.d.ts +3 -0
- package/_types/auth/utils/http.d.ts.map +1 -1
- package/_types/auth/utils/jwt.d.ts +3 -0
- package/_types/auth/utils/jwt.d.ts.map +1 -1
- package/_types/auth/utils/ws.d.ts +3 -0
- package/_types/auth/utils/ws.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +3 -0
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +3 -0
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/policies/policies.d.ts +3 -0
- package/_types/client/policies/policies.d.ts.map +1 -1
- package/_types/client/policies/policies.types.d.ts +3 -0
- package/_types/client/policies/policies.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +3 -0
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +3 -0
- package/_types/client/solana/solana.types.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +224 -4
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/onchain-data/onchain-data.d.ts +1 -32
- package/_types/openapi-client/generated/onchain-data/onchain-data.d.ts.map +1 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts +22 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -1
- package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts +43 -0
- package/_types/openapi-client/generated/sql-api-alpha/sql-api-alpha.d.ts.map +1 -0
- package/_types/openapi-client/index.d.ts +1 -1
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/solanaSchema.d.ts +325 -3
- package/_types/policies/solanaSchema.d.ts.map +1 -1
- package/_types/policies/types.d.ts +337 -0
- package/_types/policies/types.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/types.ts +18 -2
- package/accounts/solana/types.ts +9 -0
- package/actions/evm/spend-permissions/types.ts +1 -1
- package/actions/evm/transfer/accountTransferStrategy.ts +0 -12
- package/actions/evm/transfer/smartAccountTransferStrategy.ts +0 -8
- package/actions/evm/types.ts +4 -0
- package/actions/solana/types.ts +4 -0
- package/auth/errors.ts +4 -0
- package/auth/hooks/axios/withAuth.ts +4 -0
- package/auth/utils/hash.ts +4 -0
- package/auth/utils/http.ts +4 -0
- package/auth/utils/jwt.ts +4 -0
- package/auth/utils/ws.ts +4 -0
- package/client/evm/evm.ts +4 -0
- package/client/evm/evm.types.ts +4 -0
- package/client/policies/policies.ts +4 -0
- package/client/policies/policies.types.ts +4 -0
- package/client/solana/solana.ts +4 -0
- package/client/solana/solana.types.ts +4 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +291 -3
- package/openapi-client/generated/onchain-data/onchain-data.ts +0 -46
- package/openapi-client/generated/onramp/onramp.ts +38 -0
- package/openapi-client/generated/sql-api-alpha/sql-api-alpha.ts +60 -0
- package/openapi-client/index.ts +1 -0
- package/package.json +1 -1
- package/policies/solanaSchema.ts +124 -3
- package/policies/types.ts +6 -1
- package/version.ts +1 -1
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import type {
|
|
9
9
|
CreateOnrampOrder201,
|
|
10
10
|
CreateOnrampOrderBody,
|
|
11
|
+
CreateOnrampSession201,
|
|
12
|
+
CreateOnrampSessionBody,
|
|
11
13
|
GetOnrampOrderById200,
|
|
12
14
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
13
15
|
|
|
@@ -50,5 +52,41 @@ export const getOnrampOrderById = (
|
|
|
50
52
|
options,
|
|
51
53
|
);
|
|
52
54
|
};
|
|
55
|
+
/**
|
|
56
|
+
* Returns a single-use URL for an Onramp session. This API provides flexible functionality based on the parameters provided, supporting three cases:
|
|
57
|
+
|
|
58
|
+
**Important**: The returned URL is single-use only. Once a user visits the URL, no one else can access it.
|
|
59
|
+
## Use Cases
|
|
60
|
+
### 1. Basic Session (Minimum Parameters)
|
|
61
|
+
**Required**: `destinationAddress`, `purchaseCurrency`, `destinationNetwork`
|
|
62
|
+
|
|
63
|
+
**Returns**: Basic single-use onramp URL. The `quote` object will not be included in the response.
|
|
64
|
+
### 2. One-Click Onramp URL
|
|
65
|
+
**Required**: Basic parameters + `paymentAmount`, `paymentCurrency`
|
|
66
|
+
|
|
67
|
+
**Returns**: One-click onramp URL for streamlined checkout. The `quote` object will not be included in the response.
|
|
68
|
+
### 3. One-Click Onramp URL with Quote
|
|
69
|
+
**Required**: One-Click Onramp parameters + `paymentMethod`, `country`, `subdivision`
|
|
70
|
+
|
|
71
|
+
**Returns**: Complete pricing quote and one-click onramp URL. Both `session` and `quote` objects will be included in the response.
|
|
72
|
+
* @summary Create an onramp session
|
|
73
|
+
*/
|
|
74
|
+
export const createOnrampSession = (
|
|
75
|
+
createOnrampSessionBody: CreateOnrampSessionBody,
|
|
76
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
77
|
+
) => {
|
|
78
|
+
return cdpApiClient<CreateOnrampSession201>(
|
|
79
|
+
{
|
|
80
|
+
url: `/v2/onramp/sessions`,
|
|
81
|
+
method: "POST",
|
|
82
|
+
headers: { "Content-Type": "application/json" },
|
|
83
|
+
data: createOnrampSessionBody,
|
|
84
|
+
},
|
|
85
|
+
options,
|
|
86
|
+
);
|
|
87
|
+
};
|
|
53
88
|
export type CreateOnrampOrderResult = NonNullable<Awaited<ReturnType<typeof createOnrampOrder>>>;
|
|
54
89
|
export type GetOnrampOrderByIdResult = NonNullable<Awaited<ReturnType<typeof getOnrampOrderById>>>;
|
|
90
|
+
export type CreateOnrampSessionResult = NonNullable<
|
|
91
|
+
Awaited<ReturnType<typeof createOnrampSession>>
|
|
92
|
+
>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
OnchainDataQuery,
|
|
10
|
+
OnchainDataResult,
|
|
11
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
12
|
+
|
|
13
|
+
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
14
|
+
|
|
15
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Run a read-only SQL query against indexed blockchain data including transactions, events, and decoded logs.
|
|
19
|
+
|
|
20
|
+
This endpoint provides direct SQL access to comprehensive blockchain data across supported networks.
|
|
21
|
+
Queries are executed against optimized data structures for high-performance analytics.
|
|
22
|
+
|
|
23
|
+
### Allowed Queries
|
|
24
|
+
|
|
25
|
+
- Standard SQL syntax (ClickHouse dialect)
|
|
26
|
+
- Read-only queries (SELECT statements)
|
|
27
|
+
- No DDL or DML operations
|
|
28
|
+
- No cartesian products
|
|
29
|
+
|
|
30
|
+
### Supported Tables
|
|
31
|
+
|
|
32
|
+
- `base.events` - Base mainnet decoded event logs with parameters, event signature, topics, and more.
|
|
33
|
+
- `base.transactions` - Base mainnet transaction data including hash, block number, gas usage.
|
|
34
|
+
- `base.blocks` - Base mainnet block information.
|
|
35
|
+
- `base.encoded_logs` - Encoded log data of event logs that aren't able to be decoded by our event decoder (ex: log0 opcode).
|
|
36
|
+
- `base.transfers` - All event logs with event signature `Transfer(address,address,uint256)`. ERC-20, ERC-721, and ERC-1155 transfers are all included.
|
|
37
|
+
|
|
38
|
+
### Query Limits
|
|
39
|
+
|
|
40
|
+
- Maximum result set: 10,000 rows
|
|
41
|
+
- Query timeout: 30 seconds
|
|
42
|
+
- Maximum JOINs: 5
|
|
43
|
+
|
|
44
|
+
* @summary Run SQL Query
|
|
45
|
+
*/
|
|
46
|
+
export const runSQLQuery = (
|
|
47
|
+
onchainDataQuery: OnchainDataQuery,
|
|
48
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
49
|
+
) => {
|
|
50
|
+
return cdpApiClient<OnchainDataResult>(
|
|
51
|
+
{
|
|
52
|
+
url: `/v2/data/query/run`,
|
|
53
|
+
method: "POST",
|
|
54
|
+
headers: { "Content-Type": "application/json" },
|
|
55
|
+
data: onchainDataQuery,
|
|
56
|
+
},
|
|
57
|
+
options,
|
|
58
|
+
);
|
|
59
|
+
};
|
|
60
|
+
export type RunSQLQueryResult = NonNullable<Awaited<ReturnType<typeof runSQLQuery>>>;
|
package/openapi-client/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from "./generated/onramp/onramp.js";
|
|
|
12
12
|
export * from "./generated/onchain-data/onchain-data.js";
|
|
13
13
|
export * from "./generated/end-user-accounts/end-user-accounts.js";
|
|
14
14
|
export * from "./generated/x402-facilitator/x402-facilitator.js";
|
|
15
|
+
export * from "./generated/sql-api-alpha/sql-api-alpha.js";
|
|
15
16
|
|
|
16
17
|
import { configure } from "./cdpApiClient.js";
|
|
17
18
|
import * as endUserAccounts from "./generated/end-user-accounts/end-user-accounts.js";
|
package/package.json
CHANGED
package/policies/solanaSchema.ts
CHANGED
|
@@ -60,6 +60,35 @@ export const MintAddressOperatorEnum = z.enum(["in", "not in"]);
|
|
|
60
60
|
*/
|
|
61
61
|
export type MintAddressOperator = z.infer<typeof MintAddressOperatorEnum>;
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Enum for ProgramIdOperator values
|
|
65
|
+
*/
|
|
66
|
+
export const ProgramIdOperatorEnum = z.enum(["in", "not in"]);
|
|
67
|
+
/**
|
|
68
|
+
* Type representing the operators that can be used for program ID comparisons.
|
|
69
|
+
* These operators determine how transaction program IDs are evaluated against a list.
|
|
70
|
+
*/
|
|
71
|
+
export type ProgramIdOperator = z.infer<typeof ProgramIdOperatorEnum>;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Enum for SolNetworkOperator values
|
|
75
|
+
*/
|
|
76
|
+
export const SolNetworkOperatorEnum = z.enum(["in", "not in"]);
|
|
77
|
+
/**
|
|
78
|
+
* Type representing the operators that can be used for Solana network comparisons.
|
|
79
|
+
* These operators determine how transaction networks are evaluated against a list.
|
|
80
|
+
*/
|
|
81
|
+
export type SolNetworkOperator = z.infer<typeof SolNetworkOperatorEnum>;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Enum for supported Solana networks
|
|
85
|
+
*/
|
|
86
|
+
export const SolNetworkEnum = z.enum(["solana-devnet", "solana"]);
|
|
87
|
+
/**
|
|
88
|
+
* Type representing the supported Solana networks.
|
|
89
|
+
*/
|
|
90
|
+
export type SolNetwork = z.infer<typeof SolNetworkEnum>;
|
|
91
|
+
|
|
63
92
|
/**
|
|
64
93
|
* Enum for KnownIdlType values
|
|
65
94
|
*/
|
|
@@ -250,6 +279,58 @@ export const SolDataCriterionSchema = z.object({
|
|
|
250
279
|
});
|
|
251
280
|
export type SolDataCriterion = z.infer<typeof SolDataCriterionSchema>;
|
|
252
281
|
|
|
282
|
+
/**
|
|
283
|
+
* Schema for program ID criterions
|
|
284
|
+
*/
|
|
285
|
+
export const ProgramIdCriterionSchema = z.object({
|
|
286
|
+
/** The type of criterion, must be "programId" for program ID-based rules. */
|
|
287
|
+
type: z.literal("programId"),
|
|
288
|
+
/**
|
|
289
|
+
* Array of Solana program IDs to compare against.
|
|
290
|
+
* Each program ID must be a valid Base58-encoded Solana address (32-44 characters).
|
|
291
|
+
*/
|
|
292
|
+
programIds: z.array(z.string().regex(/^[1-9A-HJ-NP-Za-km-z]{32,44}$/)),
|
|
293
|
+
/**
|
|
294
|
+
* The operator to use for evaluating transaction program IDs.
|
|
295
|
+
* "in" checks if a program ID is in the provided list.
|
|
296
|
+
* "not in" checks if a program ID is not in the provided list.
|
|
297
|
+
*/
|
|
298
|
+
operator: ProgramIdOperatorEnum,
|
|
299
|
+
});
|
|
300
|
+
export type ProgramIdCriterion = z.infer<typeof ProgramIdCriterionSchema>;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Schema for Solana network criterions
|
|
304
|
+
*/
|
|
305
|
+
export const SolNetworkCriterionSchema = z.object({
|
|
306
|
+
/** The type of criterion, must be "solNetwork" for network-based rules. */
|
|
307
|
+
type: z.literal("solNetwork"),
|
|
308
|
+
/**
|
|
309
|
+
* Array of Solana networks to compare against.
|
|
310
|
+
*/
|
|
311
|
+
networks: z.array(SolNetworkEnum),
|
|
312
|
+
/**
|
|
313
|
+
* The operator to use for evaluating transaction network.
|
|
314
|
+
* "in" checks if the network is in the provided list.
|
|
315
|
+
* "not in" checks if the network is not in the provided list.
|
|
316
|
+
*/
|
|
317
|
+
operator: SolNetworkOperatorEnum,
|
|
318
|
+
});
|
|
319
|
+
export type SolNetworkCriterion = z.infer<typeof SolNetworkCriterionSchema>;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Schema for Solana message criterions
|
|
323
|
+
*/
|
|
324
|
+
export const SolMessageCriterionSchema = z.object({
|
|
325
|
+
/** The type of criterion, must be "solMessage" for message-based rules. */
|
|
326
|
+
type: z.literal("solMessage"),
|
|
327
|
+
/**
|
|
328
|
+
* A regular expression pattern to match against the message.
|
|
329
|
+
*/
|
|
330
|
+
match: z.string(),
|
|
331
|
+
});
|
|
332
|
+
export type SolMessageCriterion = z.infer<typeof SolMessageCriterionSchema>;
|
|
333
|
+
|
|
253
334
|
/**
|
|
254
335
|
* Schema for criteria used in SignSolTransaction operations
|
|
255
336
|
*/
|
|
@@ -262,13 +343,14 @@ export const SignSolTransactionCriteriaSchema = z
|
|
|
262
343
|
SplValueCriterionSchema,
|
|
263
344
|
MintAddressCriterionSchema,
|
|
264
345
|
SolDataCriterionSchema,
|
|
346
|
+
ProgramIdCriterionSchema,
|
|
265
347
|
]),
|
|
266
348
|
)
|
|
267
349
|
.max(10)
|
|
268
350
|
.min(1);
|
|
269
351
|
/**
|
|
270
352
|
* Type representing a set of criteria for the signSolTransaction operation.
|
|
271
|
-
* Can contain up to 10 individual criterion objects for Solana addresses, SOL values, SPL addresses, SPL values, and
|
|
353
|
+
* Can contain up to 10 individual criterion objects for Solana addresses, SOL values, SPL addresses, SPL values, mint addresses, Solana data, and program IDs.
|
|
272
354
|
*/
|
|
273
355
|
export type SignSolTransactionCriteria = z.infer<typeof SignSolTransactionCriteriaSchema>;
|
|
274
356
|
|
|
@@ -284,20 +366,26 @@ export const SendSolTransactionCriteriaSchema = z
|
|
|
284
366
|
SplValueCriterionSchema,
|
|
285
367
|
MintAddressCriterionSchema,
|
|
286
368
|
SolDataCriterionSchema,
|
|
369
|
+
ProgramIdCriterionSchema,
|
|
370
|
+
SolNetworkCriterionSchema,
|
|
287
371
|
]),
|
|
288
372
|
)
|
|
289
373
|
.max(10)
|
|
290
374
|
.min(1);
|
|
291
375
|
/**
|
|
292
376
|
* Type representing a set of criteria for the sendSolTransaction operation.
|
|
293
|
-
* Can contain up to 10 individual criterion objects for Solana addresses, SOL values, SPL addresses, SPL values, and
|
|
377
|
+
* Can contain up to 10 individual criterion objects for Solana addresses, SOL values, SPL addresses, SPL values, mint addresses, Solana data, program IDs, and network restrictions.
|
|
294
378
|
*/
|
|
295
379
|
export type SendSolTransactionCriteria = z.infer<typeof SendSolTransactionCriteriaSchema>;
|
|
296
380
|
|
|
297
381
|
/**
|
|
298
382
|
* Enum for Solana Operation types
|
|
299
383
|
*/
|
|
300
|
-
export const SolOperationEnum = z.enum([
|
|
384
|
+
export const SolOperationEnum = z.enum([
|
|
385
|
+
"signSolTransaction",
|
|
386
|
+
"sendSolTransaction",
|
|
387
|
+
"signSolMessage",
|
|
388
|
+
]);
|
|
301
389
|
/**
|
|
302
390
|
* Type representing the operations that can be governed by a policy.
|
|
303
391
|
* Defines what Solana operations the policy applies to.
|
|
@@ -349,3 +437,36 @@ export const SendSolTransactionRuleSchema = z.object({
|
|
|
349
437
|
criteria: SendSolTransactionCriteriaSchema,
|
|
350
438
|
});
|
|
351
439
|
export type SendSolTransactionRule = z.infer<typeof SendSolTransactionRuleSchema>;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* Schema for criteria used in SignSolMessage operations
|
|
443
|
+
*/
|
|
444
|
+
export const SignSolMessageCriteriaSchema = z.array(SolMessageCriterionSchema).max(10).min(1);
|
|
445
|
+
/**
|
|
446
|
+
* Type representing a set of criteria for the signSolMessage operation.
|
|
447
|
+
* Can contain up to 10 individual criterion objects for Solana message matching.
|
|
448
|
+
*/
|
|
449
|
+
export type SignSolMessageCriteria = z.infer<typeof SignSolMessageCriteriaSchema>;
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Type representing a 'signSolMessage' policy rule that can accept or reject specific operations
|
|
453
|
+
* based on a set of criteria.
|
|
454
|
+
*/
|
|
455
|
+
export const SignSolMessageRuleSchema = z.object({
|
|
456
|
+
/**
|
|
457
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
458
|
+
* "accept" will allow the message signing, "reject" will block it.
|
|
459
|
+
*/
|
|
460
|
+
action: ActionEnum,
|
|
461
|
+
/**
|
|
462
|
+
* The operation to which this rule applies.
|
|
463
|
+
* Must be "signSolMessage".
|
|
464
|
+
*/
|
|
465
|
+
operation: z.literal("signSolMessage"),
|
|
466
|
+
/**
|
|
467
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
468
|
+
* Must be compatible with the specified operation type.
|
|
469
|
+
*/
|
|
470
|
+
criteria: SignSolMessageCriteriaSchema,
|
|
471
|
+
});
|
|
472
|
+
export type SignSolMessageRule = z.infer<typeof SignSolMessageRuleSchema>;
|
package/policies/types.ts
CHANGED
|
@@ -9,7 +9,11 @@ import {
|
|
|
9
9
|
SignEvmTypedDataRuleSchema,
|
|
10
10
|
SendUserOperationRuleSchema,
|
|
11
11
|
} from "./evmSchema.js";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
SendSolTransactionRuleSchema,
|
|
14
|
+
SignSolTransactionRuleSchema,
|
|
15
|
+
SignSolMessageRuleSchema,
|
|
16
|
+
} from "./solanaSchema.js";
|
|
13
17
|
|
|
14
18
|
/**
|
|
15
19
|
* A single Policy that can be used to govern the behavior of projects and accounts.
|
|
@@ -50,6 +54,7 @@ export const RuleSchema = z.discriminatedUnion("operation", [
|
|
|
50
54
|
SendEvmTransactionRuleSchema,
|
|
51
55
|
SignSolTransactionRuleSchema,
|
|
52
56
|
SendSolTransactionRuleSchema,
|
|
57
|
+
SignSolMessageRuleSchema,
|
|
53
58
|
PrepareUserOperationRuleSchema,
|
|
54
59
|
SendUserOperationRuleSchema,
|
|
55
60
|
]);
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.37.0";
|