@coinbase/cdp-sdk 1.44.1 → 1.45.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 +14 -0
- package/README.md +117 -0
- package/_cjs/accounts/evm/toEvmDelegatedAccount.js +27 -0
- package/_cjs/accounts/evm/toEvmDelegatedAccount.js.map +1 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js +127 -55
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +111 -45
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/solana/toSolanaAccount.js +49 -19
- package/_cjs/accounts/solana/toSolanaAccount.js.map +1 -1
- package/_cjs/actions/evm/waitForEvmEip7702DelegationStatus.js +37 -0
- package/_cjs/actions/evm/waitForEvmEip7702DelegationStatus.js.map +1 -0
- package/_cjs/analytics.js +10 -228
- package/_cjs/analytics.js.map +1 -1
- package/_cjs/client/cdp.js +0 -6
- package/_cjs/client/cdp.js.map +1 -1
- package/_cjs/client/evm/evm.js +482 -227
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/policies/policies.js +41 -11
- package/_cjs/client/policies/policies.js.map +1 -1
- package/_cjs/client/solana/solana.js +177 -106
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/index.js +3 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +137 -5
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +30 -1
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js +15 -1
- package/_cjs/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_cjs/policies/evmSchema.js +127 -1
- package/_cjs/policies/evmSchema.js.map +1 -1
- package/_cjs/policies/solanaSchema.js +102 -1
- package/_cjs/policies/solanaSchema.js.map +1 -1
- package/_cjs/policies/types.js +7 -0
- package/_cjs/policies/types.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmDelegatedAccount.js +24 -0
- package/_esm/accounts/evm/toEvmDelegatedAccount.js.map +1 -0
- package/_esm/accounts/evm/toEvmServerAccount.js +127 -55
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +111 -45
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/solana/toSolanaAccount.js +49 -19
- package/_esm/accounts/solana/toSolanaAccount.js.map +1 -1
- package/_esm/actions/evm/waitForEvmEip7702DelegationStatus.js +34 -0
- package/_esm/actions/evm/waitForEvmEip7702DelegationStatus.js.map +1 -0
- package/_esm/analytics.js +9 -227
- package/_esm/analytics.js.map +1 -1
- package/_esm/client/cdp.js +0 -6
- package/_esm/client/cdp.js.map +1 -1
- package/_esm/client/evm/evm.js +482 -227
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/policies/policies.js +41 -11
- package/_esm/client/policies/policies.js.map +1 -1
- package/_esm/client/solana/solana.js +177 -106
- 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 +134 -3
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +27 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/onramp/onramp.js +13 -0
- package/_esm/openapi-client/generated/onramp/onramp.js.map +1 -1
- package/_esm/policies/evmSchema.js +126 -0
- package/_esm/policies/evmSchema.js.map +1 -1
- package/_esm/policies/solanaSchema.js +101 -0
- package/_esm/policies/solanaSchema.js.map +1 -1
- package/_esm/policies/types.js +9 -2
- package/_esm/policies/types.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmDelegatedAccount.d.ts +13 -0
- package/_types/accounts/evm/toEvmDelegatedAccount.d.ts.map +1 -0
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/solana/toSolanaAccount.d.ts.map +1 -1
- package/_types/actions/evm/waitForEvmEip7702DelegationStatus.d.ts +32 -0
- package/_types/actions/evm/waitForEvmEip7702DelegationStatus.d.ts.map +1 -0
- package/_types/analytics.d.ts +5 -38
- package/_types/analytics.d.ts.map +1 -1
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +54 -1
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +29 -2
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/policies/policies.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/index.d.ts +2 -0
- package/_types/index.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +436 -10
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +21 -1
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts +8 -1
- package/_types/openapi-client/generated/onramp/onramp.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +4 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/evmSchema.d.ts +2717 -601
- package/_types/policies/evmSchema.d.ts.map +1 -1
- package/_types/policies/solanaSchema.d.ts +1411 -47
- package/_types/policies/solanaSchema.d.ts.map +1 -1
- package/_types/policies/types.d.ts +8427 -2942
- package/_types/policies/types.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmDelegatedAccount.ts +26 -0
- package/accounts/evm/toEvmServerAccount.ts +115 -67
- package/accounts/evm/toEvmSmartAccount.ts +100 -56
- package/accounts/solana/toSolanaAccount.ts +44 -24
- package/actions/evm/waitForEvmEip7702DelegationStatus.ts +57 -0
- package/analytics.ts +8 -294
- package/client/cdp.ts +0 -7
- package/client/evm/evm.ts +517 -282
- package/client/evm/evm.types.ts +41 -0
- package/client/policies/policies.ts +41 -16
- package/client/solana/solana.ts +195 -141
- package/index.ts +5 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +580 -11
- package/openapi-client/generated/evm-accounts/evm-accounts.ts +49 -0
- package/openapi-client/generated/onramp/onramp.ts +24 -0
- package/package.json +1 -1
- package/policies/evmSchema.ts +164 -0
- package/policies/solanaSchema.ts +130 -0
- package/policies/types.ts +14 -0
- package/version.ts +1 -1
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type {
|
|
9
9
|
CreateEvmAccountBody,
|
|
10
|
+
CreateEvmEip7702Delegation201,
|
|
11
|
+
CreateEvmEip7702DelegationBody,
|
|
10
12
|
EIP712Message,
|
|
11
13
|
EvmAccount,
|
|
14
|
+
EvmEip7702DelegationOperation,
|
|
12
15
|
ExportEvmAccount200,
|
|
13
16
|
ExportEvmAccountBody,
|
|
14
17
|
ExportEvmAccountByName200,
|
|
@@ -228,6 +231,46 @@ export const signEvmTypedData = (
|
|
|
228
231
|
options,
|
|
229
232
|
);
|
|
230
233
|
};
|
|
234
|
+
/**
|
|
235
|
+
* Creates an EIP-7702 delegation for an EVM EOA account, upgrading it with smart account capabilities.
|
|
236
|
+
|
|
237
|
+
This endpoint:
|
|
238
|
+
- Retrieves delegation artifacts from onchain
|
|
239
|
+
- Signs the EIP-7702 authorization for delegation
|
|
240
|
+
- Assembles and submits a Type 4 transaction
|
|
241
|
+
- Creates an associated smart account object
|
|
242
|
+
|
|
243
|
+
The delegation allows the EVM EOA to be used as a smart account, which enables batched transactions and gas sponsorship via paymaster.
|
|
244
|
+
* @summary Create EIP-7702 delegation
|
|
245
|
+
*/
|
|
246
|
+
export const createEvmEip7702Delegation = (
|
|
247
|
+
address: string,
|
|
248
|
+
createEvmEip7702DelegationBody: CreateEvmEip7702DelegationBody,
|
|
249
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
250
|
+
) => {
|
|
251
|
+
return cdpApiClient<CreateEvmEip7702Delegation201>(
|
|
252
|
+
{
|
|
253
|
+
url: `/v2/evm/accounts/${address}/eip7702/delegation`,
|
|
254
|
+
method: "POST",
|
|
255
|
+
headers: { "Content-Type": "application/json" },
|
|
256
|
+
data: createEvmEip7702DelegationBody,
|
|
257
|
+
},
|
|
258
|
+
options,
|
|
259
|
+
);
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Returns the EIP-7702 delegation operation. Use the delegationOperationId returned by the Create EIP-7702 delegation endpoint to poll for operation completion.
|
|
263
|
+
* @summary Get EIP-7702 delegation operation for an operationID
|
|
264
|
+
*/
|
|
265
|
+
export const getEvmEip7702DelegationOperationById = (
|
|
266
|
+
delegationOperationId: string,
|
|
267
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
268
|
+
) => {
|
|
269
|
+
return cdpApiClient<EvmEip7702DelegationOperation>(
|
|
270
|
+
{ url: `/v2/evm/eip7702/delegation-operations/${delegationOperationId}`, method: "GET" },
|
|
271
|
+
options,
|
|
272
|
+
);
|
|
273
|
+
};
|
|
231
274
|
/**
|
|
232
275
|
* Import an existing EVM account into the developer's CDP Project. This API should be called from the [CDP SDK](https://github.com/coinbase/cdp-sdk) to ensure that the associated private key is properly encrypted.
|
|
233
276
|
* @summary Import an EVM account
|
|
@@ -296,6 +339,12 @@ export type SignEvmTransactionResult = NonNullable<Awaited<ReturnType<typeof sig
|
|
|
296
339
|
export type SignEvmHashResult = NonNullable<Awaited<ReturnType<typeof signEvmHash>>>;
|
|
297
340
|
export type SignEvmMessageResult = NonNullable<Awaited<ReturnType<typeof signEvmMessage>>>;
|
|
298
341
|
export type SignEvmTypedDataResult = NonNullable<Awaited<ReturnType<typeof signEvmTypedData>>>;
|
|
342
|
+
export type CreateEvmEip7702DelegationResult = NonNullable<
|
|
343
|
+
Awaited<ReturnType<typeof createEvmEip7702Delegation>>
|
|
344
|
+
>;
|
|
345
|
+
export type GetEvmEip7702DelegationOperationByIdResult = NonNullable<
|
|
346
|
+
Awaited<ReturnType<typeof getEvmEip7702DelegationOperationById>>
|
|
347
|
+
>;
|
|
299
348
|
export type ImportEvmAccountResult = NonNullable<Awaited<ReturnType<typeof importEvmAccount>>>;
|
|
300
349
|
export type ExportEvmAccountResult = NonNullable<Awaited<ReturnType<typeof exportEvmAccount>>>;
|
|
301
350
|
export type ExportEvmAccountByNameResult = NonNullable<
|
|
@@ -11,6 +11,8 @@ import type {
|
|
|
11
11
|
CreateOnrampSession201,
|
|
12
12
|
CreateOnrampSessionBody,
|
|
13
13
|
GetOnrampOrderById200,
|
|
14
|
+
GetOnrampUserLimits200,
|
|
15
|
+
GetOnrampUserLimitsBody,
|
|
14
16
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
15
17
|
|
|
16
18
|
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
@@ -87,8 +89,30 @@ export const createOnrampSession = (
|
|
|
87
89
|
options,
|
|
88
90
|
);
|
|
89
91
|
};
|
|
92
|
+
/**
|
|
93
|
+
* Returns the transaction limits for an onramp user based on their payment method and user identifier. Use this API to show users their remaining purchase capacity before initiating an onramp transaction.
|
|
94
|
+
Currently supports `GUEST_CHECKOUT_APPLE_PAY` payment method with phone number identification. The phone number must have been previously verified via OTP.
|
|
95
|
+
* @summary Get onramp user limits
|
|
96
|
+
*/
|
|
97
|
+
export const getOnrampUserLimits = (
|
|
98
|
+
getOnrampUserLimitsBody: GetOnrampUserLimitsBody,
|
|
99
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
100
|
+
) => {
|
|
101
|
+
return cdpApiClient<GetOnrampUserLimits200>(
|
|
102
|
+
{
|
|
103
|
+
url: `/v2/onramp/limits`,
|
|
104
|
+
method: "POST",
|
|
105
|
+
headers: { "Content-Type": "application/json" },
|
|
106
|
+
data: getOnrampUserLimitsBody,
|
|
107
|
+
},
|
|
108
|
+
options,
|
|
109
|
+
);
|
|
110
|
+
};
|
|
90
111
|
export type CreateOnrampOrderResult = NonNullable<Awaited<ReturnType<typeof createOnrampOrder>>>;
|
|
91
112
|
export type GetOnrampOrderByIdResult = NonNullable<Awaited<ReturnType<typeof getOnrampOrderById>>>;
|
|
92
113
|
export type CreateOnrampSessionResult = NonNullable<
|
|
93
114
|
Awaited<ReturnType<typeof createOnrampSession>>
|
|
94
115
|
>;
|
|
116
|
+
export type GetOnrampUserLimitsResult = NonNullable<
|
|
117
|
+
Awaited<ReturnType<typeof getOnrampUserLimits>>
|
|
118
|
+
>;
|
package/package.json
CHANGED
package/policies/evmSchema.ts
CHANGED
|
@@ -508,6 +508,78 @@ export const SendUserOperationCriteriaSchema = z
|
|
|
508
508
|
*/
|
|
509
509
|
export type SendUserOperationCriteria = z.infer<typeof SendUserOperationCriteriaSchema>;
|
|
510
510
|
|
|
511
|
+
/**
|
|
512
|
+
* Schema for criteria used in SignEndUserEvmTransaction operations
|
|
513
|
+
*/
|
|
514
|
+
export const SignEndUserEvmTransactionCriteriaSchema = z
|
|
515
|
+
.array(
|
|
516
|
+
z.discriminatedUnion("type", [
|
|
517
|
+
EthValueCriterionSchema,
|
|
518
|
+
EvmAddressCriterionSchema,
|
|
519
|
+
EvmDataCriterionSchema,
|
|
520
|
+
NetUSDChangeCriterionSchema,
|
|
521
|
+
]),
|
|
522
|
+
)
|
|
523
|
+
.max(10)
|
|
524
|
+
.min(1);
|
|
525
|
+
/**
|
|
526
|
+
* Type representing a set of criteria for the signEndUserEvmTransaction operation.
|
|
527
|
+
*/
|
|
528
|
+
export type SignEndUserEvmTransactionCriteria = z.infer<
|
|
529
|
+
typeof SignEndUserEvmTransactionCriteriaSchema
|
|
530
|
+
>;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Schema for criteria used in SendEndUserEvmTransaction operations
|
|
534
|
+
*/
|
|
535
|
+
export const SendEndUserEvmTransactionCriteriaSchema = z
|
|
536
|
+
.array(
|
|
537
|
+
z.discriminatedUnion("type", [
|
|
538
|
+
EthValueCriterionSchema,
|
|
539
|
+
EvmAddressCriterionSchema,
|
|
540
|
+
PrepareUserOperationEvmNetworkCriterionSchema,
|
|
541
|
+
EvmDataCriterionSchema,
|
|
542
|
+
NetUSDChangeCriterionSchema,
|
|
543
|
+
]),
|
|
544
|
+
)
|
|
545
|
+
.max(10)
|
|
546
|
+
.min(1);
|
|
547
|
+
/**
|
|
548
|
+
* Type representing a set of criteria for the sendEndUserEvmTransaction operation.
|
|
549
|
+
*/
|
|
550
|
+
export type SendEndUserEvmTransactionCriteria = z.infer<
|
|
551
|
+
typeof SendEndUserEvmTransactionCriteriaSchema
|
|
552
|
+
>;
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* Schema for criteria used in SignEndUserEvmMessage operations
|
|
556
|
+
*/
|
|
557
|
+
export const SignEndUserEvmMessageCriteriaSchema = z
|
|
558
|
+
.array(z.discriminatedUnion("type", [EvmMessageCriterionSchema]))
|
|
559
|
+
.max(10)
|
|
560
|
+
.min(1);
|
|
561
|
+
/**
|
|
562
|
+
* Type representing a set of criteria for the signEndUserEvmMessage operation.
|
|
563
|
+
*/
|
|
564
|
+
export type SignEndUserEvmMessageCriteria = z.infer<typeof SignEndUserEvmMessageCriteriaSchema>;
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Schema for criteria used in SignEndUserEvmTypedData operations
|
|
568
|
+
*/
|
|
569
|
+
export const SignEndUserEvmTypedDataCriteriaSchema = z
|
|
570
|
+
.array(
|
|
571
|
+
z.discriminatedUnion("type", [
|
|
572
|
+
SignEvmTypedDataFieldCriterionSchema,
|
|
573
|
+
SignEvmTypedDataVerifyingContractCriterionSchema,
|
|
574
|
+
]),
|
|
575
|
+
)
|
|
576
|
+
.max(10)
|
|
577
|
+
.min(1);
|
|
578
|
+
/**
|
|
579
|
+
* Type representing a set of criteria for the signEndUserEvmTypedData operation.
|
|
580
|
+
*/
|
|
581
|
+
export type SignEndUserEvmTypedDataCriteria = z.infer<typeof SignEndUserEvmTypedDataCriteriaSchema>;
|
|
582
|
+
|
|
511
583
|
/**
|
|
512
584
|
* Enum for Evm Operation types
|
|
513
585
|
*/
|
|
@@ -691,3 +763,95 @@ export const SendUserOperationRuleSchema = z.object({
|
|
|
691
763
|
criteria: SendUserOperationCriteriaSchema,
|
|
692
764
|
});
|
|
693
765
|
export type SendUserOperationRule = z.infer<typeof SendUserOperationRuleSchema>;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Type representing a 'signEndUserEvmTransaction' policy rule that can accept or reject specific operations
|
|
769
|
+
* based on a set of criteria.
|
|
770
|
+
*/
|
|
771
|
+
export const SignEndUserEvmTransactionRuleSchema = z.object({
|
|
772
|
+
/**
|
|
773
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
774
|
+
* "accept" will allow the transaction, "reject" will block it.
|
|
775
|
+
*/
|
|
776
|
+
action: ActionEnum,
|
|
777
|
+
/**
|
|
778
|
+
* The operation to which this rule applies.
|
|
779
|
+
* Must be "signEndUserEvmTransaction".
|
|
780
|
+
*/
|
|
781
|
+
operation: z.literal("signEndUserEvmTransaction"),
|
|
782
|
+
/**
|
|
783
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
784
|
+
* Must be compatible with the specified operation type.
|
|
785
|
+
*/
|
|
786
|
+
criteria: SignEndUserEvmTransactionCriteriaSchema,
|
|
787
|
+
});
|
|
788
|
+
export type SignEndUserEvmTransactionRule = z.infer<typeof SignEndUserEvmTransactionRuleSchema>;
|
|
789
|
+
|
|
790
|
+
/**
|
|
791
|
+
* Type representing a 'sendEndUserEvmTransaction' policy rule that can accept or reject specific operations
|
|
792
|
+
* based on a set of criteria.
|
|
793
|
+
*/
|
|
794
|
+
export const SendEndUserEvmTransactionRuleSchema = z.object({
|
|
795
|
+
/**
|
|
796
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
797
|
+
* "accept" will allow the transaction, "reject" will block it.
|
|
798
|
+
*/
|
|
799
|
+
action: ActionEnum,
|
|
800
|
+
/**
|
|
801
|
+
* The operation to which this rule applies.
|
|
802
|
+
* Must be "sendEndUserEvmTransaction".
|
|
803
|
+
*/
|
|
804
|
+
operation: z.literal("sendEndUserEvmTransaction"),
|
|
805
|
+
/**
|
|
806
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
807
|
+
* Must be compatible with the specified operation type.
|
|
808
|
+
*/
|
|
809
|
+
criteria: SendEndUserEvmTransactionCriteriaSchema,
|
|
810
|
+
});
|
|
811
|
+
export type SendEndUserEvmTransactionRule = z.infer<typeof SendEndUserEvmTransactionRuleSchema>;
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Type representing a 'signEndUserEvmMessage' policy rule that can accept or reject specific operations
|
|
815
|
+
* based on a set of criteria.
|
|
816
|
+
*/
|
|
817
|
+
export const SignEndUserEvmMessageRuleSchema = z.object({
|
|
818
|
+
/**
|
|
819
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
820
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
821
|
+
*/
|
|
822
|
+
action: ActionEnum,
|
|
823
|
+
/**
|
|
824
|
+
* The operation to which this rule applies.
|
|
825
|
+
* Must be "signEndUserEvmMessage".
|
|
826
|
+
*/
|
|
827
|
+
operation: z.literal("signEndUserEvmMessage"),
|
|
828
|
+
/**
|
|
829
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
830
|
+
* Must be compatible with the specified operation type.
|
|
831
|
+
*/
|
|
832
|
+
criteria: SignEndUserEvmMessageCriteriaSchema,
|
|
833
|
+
});
|
|
834
|
+
export type SignEndUserEvmMessageRule = z.infer<typeof SignEndUserEvmMessageRuleSchema>;
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Type representing a 'signEndUserEvmTypedData' policy rule that can accept or reject specific operations
|
|
838
|
+
* based on a set of criteria.
|
|
839
|
+
*/
|
|
840
|
+
export const SignEndUserEvmTypedDataRuleSchema = z.object({
|
|
841
|
+
/**
|
|
842
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
843
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
844
|
+
*/
|
|
845
|
+
action: ActionEnum,
|
|
846
|
+
/**
|
|
847
|
+
* The operation to which this rule applies.
|
|
848
|
+
* Must be "signEndUserEvmTypedData".
|
|
849
|
+
*/
|
|
850
|
+
operation: z.literal("signEndUserEvmTypedData"),
|
|
851
|
+
/**
|
|
852
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
853
|
+
* Must be compatible with the specified operation type.
|
|
854
|
+
*/
|
|
855
|
+
criteria: SignEndUserEvmTypedDataCriteriaSchema,
|
|
856
|
+
});
|
|
857
|
+
export type SignEndUserEvmTypedDataRule = z.infer<typeof SignEndUserEvmTypedDataRuleSchema>;
|
package/policies/solanaSchema.ts
CHANGED
|
@@ -378,6 +378,67 @@ export const SendSolTransactionCriteriaSchema = z
|
|
|
378
378
|
*/
|
|
379
379
|
export type SendSolTransactionCriteria = z.infer<typeof SendSolTransactionCriteriaSchema>;
|
|
380
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Schema for criteria used in SignEndUserSolTransaction operations
|
|
383
|
+
*/
|
|
384
|
+
export const SignEndUserSolTransactionCriteriaSchema = z
|
|
385
|
+
.array(
|
|
386
|
+
z.discriminatedUnion("type", [
|
|
387
|
+
SolAddressCriterionSchema,
|
|
388
|
+
SolValueCriterionSchema,
|
|
389
|
+
SplAddressCriterionSchema,
|
|
390
|
+
SplValueCriterionSchema,
|
|
391
|
+
MintAddressCriterionSchema,
|
|
392
|
+
SolDataCriterionSchema,
|
|
393
|
+
ProgramIdCriterionSchema,
|
|
394
|
+
]),
|
|
395
|
+
)
|
|
396
|
+
.max(10)
|
|
397
|
+
.min(1);
|
|
398
|
+
/**
|
|
399
|
+
* Type representing a set of criteria for the signEndUserSolTransaction operation.
|
|
400
|
+
*/
|
|
401
|
+
export type SignEndUserSolTransactionCriteria = z.infer<
|
|
402
|
+
typeof SignEndUserSolTransactionCriteriaSchema
|
|
403
|
+
>;
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* Schema for criteria used in SendEndUserSolTransaction operations
|
|
407
|
+
*/
|
|
408
|
+
export const SendEndUserSolTransactionCriteriaSchema = z
|
|
409
|
+
.array(
|
|
410
|
+
z.discriminatedUnion("type", [
|
|
411
|
+
SolAddressCriterionSchema,
|
|
412
|
+
SolValueCriterionSchema,
|
|
413
|
+
SplAddressCriterionSchema,
|
|
414
|
+
SplValueCriterionSchema,
|
|
415
|
+
MintAddressCriterionSchema,
|
|
416
|
+
SolDataCriterionSchema,
|
|
417
|
+
ProgramIdCriterionSchema,
|
|
418
|
+
SolNetworkCriterionSchema,
|
|
419
|
+
]),
|
|
420
|
+
)
|
|
421
|
+
.max(10)
|
|
422
|
+
.min(1);
|
|
423
|
+
/**
|
|
424
|
+
* Type representing a set of criteria for the sendEndUserSolTransaction operation.
|
|
425
|
+
*/
|
|
426
|
+
export type SendEndUserSolTransactionCriteria = z.infer<
|
|
427
|
+
typeof SendEndUserSolTransactionCriteriaSchema
|
|
428
|
+
>;
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Schema for criteria used in SignEndUserSolMessage operations
|
|
432
|
+
*/
|
|
433
|
+
export const SignEndUserSolMessageCriteriaSchema = z
|
|
434
|
+
.array(SolMessageCriterionSchema)
|
|
435
|
+
.max(10)
|
|
436
|
+
.min(1);
|
|
437
|
+
/**
|
|
438
|
+
* Type representing a set of criteria for the signEndUserSolMessage operation.
|
|
439
|
+
*/
|
|
440
|
+
export type SignEndUserSolMessageCriteria = z.infer<typeof SignEndUserSolMessageCriteriaSchema>;
|
|
441
|
+
|
|
381
442
|
/**
|
|
382
443
|
* Enum for Solana Operation types
|
|
383
444
|
*/
|
|
@@ -470,3 +531,72 @@ export const SignSolMessageRuleSchema = z.object({
|
|
|
470
531
|
criteria: SignSolMessageCriteriaSchema,
|
|
471
532
|
});
|
|
472
533
|
export type SignSolMessageRule = z.infer<typeof SignSolMessageRuleSchema>;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Type representing a 'signEndUserSolTransaction' policy rule that can accept or reject specific operations
|
|
537
|
+
* based on a set of criteria.
|
|
538
|
+
*/
|
|
539
|
+
export const SignEndUserSolTransactionRuleSchema = z.object({
|
|
540
|
+
/**
|
|
541
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
542
|
+
* "accept" will allow the transaction, "reject" will block it.
|
|
543
|
+
*/
|
|
544
|
+
action: ActionEnum,
|
|
545
|
+
/**
|
|
546
|
+
* The operation to which this rule applies.
|
|
547
|
+
* Must be "signEndUserSolTransaction".
|
|
548
|
+
*/
|
|
549
|
+
operation: z.literal("signEndUserSolTransaction"),
|
|
550
|
+
/**
|
|
551
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
552
|
+
* Must be compatible with the specified operation type.
|
|
553
|
+
*/
|
|
554
|
+
criteria: SignEndUserSolTransactionCriteriaSchema,
|
|
555
|
+
});
|
|
556
|
+
export type SignEndUserSolTransactionRule = z.infer<typeof SignEndUserSolTransactionRuleSchema>;
|
|
557
|
+
|
|
558
|
+
/**
|
|
559
|
+
* Type representing a 'sendEndUserSolTransaction' policy rule that can accept or reject specific operations
|
|
560
|
+
* based on a set of criteria.
|
|
561
|
+
*/
|
|
562
|
+
export const SendEndUserSolTransactionRuleSchema = z.object({
|
|
563
|
+
/**
|
|
564
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
565
|
+
* "accept" will allow the transaction, "reject" will block it.
|
|
566
|
+
*/
|
|
567
|
+
action: ActionEnum,
|
|
568
|
+
/**
|
|
569
|
+
* The operation to which this rule applies.
|
|
570
|
+
* Must be "sendEndUserSolTransaction".
|
|
571
|
+
*/
|
|
572
|
+
operation: z.literal("sendEndUserSolTransaction"),
|
|
573
|
+
/**
|
|
574
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
575
|
+
* Must be compatible with the specified operation type.
|
|
576
|
+
*/
|
|
577
|
+
criteria: SendEndUserSolTransactionCriteriaSchema,
|
|
578
|
+
});
|
|
579
|
+
export type SendEndUserSolTransactionRule = z.infer<typeof SendEndUserSolTransactionRuleSchema>;
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* Type representing a 'signEndUserSolMessage' policy rule that can accept or reject specific operations
|
|
583
|
+
* based on a set of criteria.
|
|
584
|
+
*/
|
|
585
|
+
export const SignEndUserSolMessageRuleSchema = z.object({
|
|
586
|
+
/**
|
|
587
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
588
|
+
* "accept" will allow the message signing, "reject" will block it.
|
|
589
|
+
*/
|
|
590
|
+
action: ActionEnum,
|
|
591
|
+
/**
|
|
592
|
+
* The operation to which this rule applies.
|
|
593
|
+
* Must be "signEndUserSolMessage".
|
|
594
|
+
*/
|
|
595
|
+
operation: z.literal("signEndUserSolMessage"),
|
|
596
|
+
/**
|
|
597
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
598
|
+
* Must be compatible with the specified operation type.
|
|
599
|
+
*/
|
|
600
|
+
criteria: SignEndUserSolMessageCriteriaSchema,
|
|
601
|
+
});
|
|
602
|
+
export type SignEndUserSolMessageRule = z.infer<typeof SignEndUserSolMessageRuleSchema>;
|
package/policies/types.ts
CHANGED
|
@@ -8,11 +8,18 @@ import {
|
|
|
8
8
|
SignEvmTransactionRuleSchema,
|
|
9
9
|
SignEvmTypedDataRuleSchema,
|
|
10
10
|
SendUserOperationRuleSchema,
|
|
11
|
+
SignEndUserEvmTransactionRuleSchema,
|
|
12
|
+
SendEndUserEvmTransactionRuleSchema,
|
|
13
|
+
SignEndUserEvmMessageRuleSchema,
|
|
14
|
+
SignEndUserEvmTypedDataRuleSchema,
|
|
11
15
|
} from "./evmSchema.js";
|
|
12
16
|
import {
|
|
13
17
|
SendSolTransactionRuleSchema,
|
|
14
18
|
SignSolTransactionRuleSchema,
|
|
15
19
|
SignSolMessageRuleSchema,
|
|
20
|
+
SignEndUserSolTransactionRuleSchema,
|
|
21
|
+
SendEndUserSolTransactionRuleSchema,
|
|
22
|
+
SignEndUserSolMessageRuleSchema,
|
|
16
23
|
} from "./solanaSchema.js";
|
|
17
24
|
|
|
18
25
|
/**
|
|
@@ -57,6 +64,13 @@ export const RuleSchema = z.discriminatedUnion("operation", [
|
|
|
57
64
|
SignSolMessageRuleSchema,
|
|
58
65
|
PrepareUserOperationRuleSchema,
|
|
59
66
|
SendUserOperationRuleSchema,
|
|
67
|
+
SignEndUserEvmTransactionRuleSchema,
|
|
68
|
+
SendEndUserEvmTransactionRuleSchema,
|
|
69
|
+
SignEndUserEvmMessageRuleSchema,
|
|
70
|
+
SignEndUserEvmTypedDataRuleSchema,
|
|
71
|
+
SignEndUserSolTransactionRuleSchema,
|
|
72
|
+
SendEndUserSolTransactionRuleSchema,
|
|
73
|
+
SignEndUserSolMessageRuleSchema,
|
|
60
74
|
]);
|
|
61
75
|
|
|
62
76
|
/**
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.45.0";
|