@coinbase/cdp-sdk 1.12.0 → 1.14.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 +24 -0
- package/README.md +20 -2
- package/_cjs/accounts/evm/toEvmServerAccount.js +6 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/actions/evm/listTokenBalances.js +1 -1
- package/_cjs/actions/evm/listTokenBalances.js.map +1 -1
- package/_cjs/analytics.js +1 -1
- package/_cjs/analytics.js.map +1 -1
- package/_cjs/client/evm/evm.js +59 -2
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/openapi-client/cdpApiClient.js +15 -2
- package/_cjs/openapi-client/cdpApiClient.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +24 -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 +32 -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 +9 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +23 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/faucets/faucets.js +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +5 -5
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +59 -1
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +27 -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 +32 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_cjs/policies/schema.js +59 -1
- package/_cjs/policies/schema.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +7 -1
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/actions/evm/listTokenBalances.js +1 -1
- package/_esm/actions/evm/listTokenBalances.js.map +1 -1
- package/_esm/analytics.js +2 -2
- package/_esm/analytics.js.map +1 -1
- package/_esm/client/evm/evm.js +59 -2
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/openapi-client/cdpApiClient.js +15 -2
- package/_esm/openapi-client/cdpApiClient.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +23 -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 +27 -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 +7 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +20 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/faucets/faucets.js +1 -1
- package/_esm/openapi-client/generated/index.msw.js +5 -5
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +54 -0
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +24 -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 +27 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_esm/policies/schema.js +58 -0
- package/_esm/policies/schema.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/actions/evm/listTokenBalances.d.ts +1 -1
- package/_types/actions/evm/swap/types.d.ts +40 -1
- package/_types/actions/evm/swap/types.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +25 -2
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +15 -2
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +1 -1
- package/_types/client/solana/solana.types.d.ts.map +1 -1
- package/_types/openapi-client/cdpApiClient.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +108 -5
- 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 +6 -0
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +2 -0
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/faucets/faucets.d.ts +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +5 -5
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts +5 -1
- package/_types/openapi-client/generated/policy-engine/policy-engine.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +13 -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 +5 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +10 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/schema.d.ts +338 -0
- package/_types/policies/schema.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmServerAccount.ts +8 -3
- package/actions/evm/listTokenBalances.ts +2 -2
- package/actions/evm/swap/types.ts +44 -1
- package/analytics.ts +2 -2
- package/client/evm/evm.ts +59 -2
- package/client/evm/evm.types.ts +18 -1
- package/client/solana/solana.types.ts +2 -0
- package/openapi-client/cdpApiClient.ts +17 -2
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +145 -5
- package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +61 -0
- package/openapi-client/generated/evm-accounts/evm-accounts.ts +46 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +38 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +16 -0
- package/openapi-client/generated/faucets/faucets.ts +1 -1
- package/openapi-client/generated/index.msw.ts +5 -5
- package/openapi-client/generated/policy-engine/policy-engine.msw.ts +87 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +61 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.ts +48 -0
- package/package.json +1 -1
- package/policies/schema.ts +70 -0
- package/version.ts +1 -1
|
@@ -121,6 +121,25 @@ export declare const EvmNetworkCriterionSchema: z.ZodObject<{
|
|
|
121
121
|
networks: ("base-sepolia" | "base")[];
|
|
122
122
|
}>;
|
|
123
123
|
export type EvmNetworkCriterion = z.infer<typeof EvmNetworkCriterionSchema>;
|
|
124
|
+
/**
|
|
125
|
+
* Schema for EVM message criterions
|
|
126
|
+
*/
|
|
127
|
+
export declare const EvmMessageCriterionSchema: z.ZodObject<{
|
|
128
|
+
/** The type of criterion, must be "evmMessage" for EVM message-based rules. */
|
|
129
|
+
type: z.ZodLiteral<"evmMessage">;
|
|
130
|
+
/**
|
|
131
|
+
* A regular expression the message is matched against.
|
|
132
|
+
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
|
|
133
|
+
*/
|
|
134
|
+
match: z.ZodString;
|
|
135
|
+
}, "strip", z.ZodTypeAny, {
|
|
136
|
+
type: "evmMessage";
|
|
137
|
+
match: string;
|
|
138
|
+
}, {
|
|
139
|
+
type: "evmMessage";
|
|
140
|
+
match: string;
|
|
141
|
+
}>;
|
|
142
|
+
export type EvmMessageCriterion = z.infer<typeof EvmMessageCriterionSchema>;
|
|
124
143
|
/**
|
|
125
144
|
* Schema for Solana address criterions
|
|
126
145
|
*/
|
|
@@ -198,6 +217,29 @@ export declare const SignEvmTransactionCriteriaSchema: z.ZodArray<z.ZodDiscrimin
|
|
|
198
217
|
* Can contain up to 10 individual criterion objects of ETH value or EVM address types.
|
|
199
218
|
*/
|
|
200
219
|
export type SignEvmTransactionCriteria = z.infer<typeof SignEvmTransactionCriteriaSchema>;
|
|
220
|
+
/**
|
|
221
|
+
* Schema for criteria used in SignEvmMessage operations
|
|
222
|
+
*/
|
|
223
|
+
export declare const SignEvmMessageCriteriaSchema: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
224
|
+
/** The type of criterion, must be "evmMessage" for EVM message-based rules. */
|
|
225
|
+
type: z.ZodLiteral<"evmMessage">;
|
|
226
|
+
/**
|
|
227
|
+
* A regular expression the message is matched against.
|
|
228
|
+
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
|
|
229
|
+
*/
|
|
230
|
+
match: z.ZodString;
|
|
231
|
+
}, "strip", z.ZodTypeAny, {
|
|
232
|
+
type: "evmMessage";
|
|
233
|
+
match: string;
|
|
234
|
+
}, {
|
|
235
|
+
type: "evmMessage";
|
|
236
|
+
match: string;
|
|
237
|
+
}>]>, "many">;
|
|
238
|
+
/**
|
|
239
|
+
* Type representing a set of criteria for the signEvmMessage operation.
|
|
240
|
+
* Can contain up to 10 individual EVM message criterion objects.
|
|
241
|
+
*/
|
|
242
|
+
export type SignEvmMessageCriteria = z.infer<typeof SignEvmMessageCriteriaSchema>;
|
|
201
243
|
/**
|
|
202
244
|
* Schema for criteria used in SendEvmTransaction operations
|
|
203
245
|
*/
|
|
@@ -415,6 +457,79 @@ export declare const SignEvmTransactionRuleSchema: z.ZodObject<{
|
|
|
415
457
|
})[];
|
|
416
458
|
}>;
|
|
417
459
|
export type SignEvmTransactionRule = z.infer<typeof SignEvmTransactionRuleSchema>;
|
|
460
|
+
/**
|
|
461
|
+
* Type representing a 'signEvmHash' policy rule that can accept or reject specific operations
|
|
462
|
+
* based on a set of criteria.
|
|
463
|
+
*/
|
|
464
|
+
export declare const SignEvmHashRuleSchema: z.ZodObject<{
|
|
465
|
+
/**
|
|
466
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
467
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
468
|
+
*/
|
|
469
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
470
|
+
/**
|
|
471
|
+
* The operation to which this rule applies.
|
|
472
|
+
* Must be "signEvmHash".
|
|
473
|
+
*/
|
|
474
|
+
operation: z.ZodLiteral<"signEvmHash">;
|
|
475
|
+
}, "strip", z.ZodTypeAny, {
|
|
476
|
+
action: "reject" | "accept";
|
|
477
|
+
operation: "signEvmHash";
|
|
478
|
+
}, {
|
|
479
|
+
action: "reject" | "accept";
|
|
480
|
+
operation: "signEvmHash";
|
|
481
|
+
}>;
|
|
482
|
+
export type SignEvmHashRule = z.infer<typeof SignEvmHashRuleSchema>;
|
|
483
|
+
/**
|
|
484
|
+
* Type representing a 'signEvmMessage' policy rule that can accept or reject specific operations
|
|
485
|
+
* based on a set of criteria.
|
|
486
|
+
*/
|
|
487
|
+
export declare const SignEvmMessageRuleSchema: z.ZodObject<{
|
|
488
|
+
/**
|
|
489
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
490
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
491
|
+
*/
|
|
492
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
493
|
+
/**
|
|
494
|
+
* The operation to which this rule applies.
|
|
495
|
+
* Must be "signEvmMessage".
|
|
496
|
+
*/
|
|
497
|
+
operation: z.ZodLiteral<"signEvmMessage">;
|
|
498
|
+
/**
|
|
499
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
500
|
+
* Must be compatible with the specified operation type.
|
|
501
|
+
*/
|
|
502
|
+
criteria: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
503
|
+
/** The type of criterion, must be "evmMessage" for EVM message-based rules. */
|
|
504
|
+
type: z.ZodLiteral<"evmMessage">;
|
|
505
|
+
/**
|
|
506
|
+
* A regular expression the message is matched against.
|
|
507
|
+
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
|
|
508
|
+
*/
|
|
509
|
+
match: z.ZodString;
|
|
510
|
+
}, "strip", z.ZodTypeAny, {
|
|
511
|
+
type: "evmMessage";
|
|
512
|
+
match: string;
|
|
513
|
+
}, {
|
|
514
|
+
type: "evmMessage";
|
|
515
|
+
match: string;
|
|
516
|
+
}>]>, "many">;
|
|
517
|
+
}, "strip", z.ZodTypeAny, {
|
|
518
|
+
action: "reject" | "accept";
|
|
519
|
+
operation: "signEvmMessage";
|
|
520
|
+
criteria: {
|
|
521
|
+
type: "evmMessage";
|
|
522
|
+
match: string;
|
|
523
|
+
}[];
|
|
524
|
+
}, {
|
|
525
|
+
action: "reject" | "accept";
|
|
526
|
+
operation: "signEvmMessage";
|
|
527
|
+
criteria: {
|
|
528
|
+
type: "evmMessage";
|
|
529
|
+
match: string;
|
|
530
|
+
}[];
|
|
531
|
+
}>;
|
|
532
|
+
export type SignEvmMessageRule = z.infer<typeof SignEvmMessageRuleSchema>;
|
|
418
533
|
/**
|
|
419
534
|
* Type representing a 'sendEvmTransaction' policy rule that can accept or reject specific operations
|
|
420
535
|
* based on a set of criteria.
|
|
@@ -676,6 +791,67 @@ export declare const RuleSchema: z.ZodDiscriminatedUnion<"operation", [z.ZodObje
|
|
|
676
791
|
operator: "in" | "not in";
|
|
677
792
|
addresses: string[];
|
|
678
793
|
})[];
|
|
794
|
+
}>, z.ZodObject<{
|
|
795
|
+
/**
|
|
796
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
797
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
798
|
+
*/
|
|
799
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
800
|
+
/**
|
|
801
|
+
* The operation to which this rule applies.
|
|
802
|
+
* Must be "signEvmHash".
|
|
803
|
+
*/
|
|
804
|
+
operation: z.ZodLiteral<"signEvmHash">;
|
|
805
|
+
}, "strip", z.ZodTypeAny, {
|
|
806
|
+
action: "reject" | "accept";
|
|
807
|
+
operation: "signEvmHash";
|
|
808
|
+
}, {
|
|
809
|
+
action: "reject" | "accept";
|
|
810
|
+
operation: "signEvmHash";
|
|
811
|
+
}>, z.ZodObject<{
|
|
812
|
+
/**
|
|
813
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
814
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
815
|
+
*/
|
|
816
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
817
|
+
/**
|
|
818
|
+
* The operation to which this rule applies.
|
|
819
|
+
* Must be "signEvmMessage".
|
|
820
|
+
*/
|
|
821
|
+
operation: z.ZodLiteral<"signEvmMessage">;
|
|
822
|
+
/**
|
|
823
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
824
|
+
* Must be compatible with the specified operation type.
|
|
825
|
+
*/
|
|
826
|
+
criteria: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
827
|
+
/** The type of criterion, must be "evmMessage" for EVM message-based rules. */
|
|
828
|
+
type: z.ZodLiteral<"evmMessage">;
|
|
829
|
+
/**
|
|
830
|
+
* A regular expression the message is matched against.
|
|
831
|
+
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
|
|
832
|
+
*/
|
|
833
|
+
match: z.ZodString;
|
|
834
|
+
}, "strip", z.ZodTypeAny, {
|
|
835
|
+
type: "evmMessage";
|
|
836
|
+
match: string;
|
|
837
|
+
}, {
|
|
838
|
+
type: "evmMessage";
|
|
839
|
+
match: string;
|
|
840
|
+
}>]>, "many">;
|
|
841
|
+
}, "strip", z.ZodTypeAny, {
|
|
842
|
+
action: "reject" | "accept";
|
|
843
|
+
operation: "signEvmMessage";
|
|
844
|
+
criteria: {
|
|
845
|
+
type: "evmMessage";
|
|
846
|
+
match: string;
|
|
847
|
+
}[];
|
|
848
|
+
}, {
|
|
849
|
+
action: "reject" | "accept";
|
|
850
|
+
operation: "signEvmMessage";
|
|
851
|
+
criteria: {
|
|
852
|
+
type: "evmMessage";
|
|
853
|
+
match: string;
|
|
854
|
+
}[];
|
|
679
855
|
}>, z.ZodObject<{
|
|
680
856
|
/**
|
|
681
857
|
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
@@ -955,6 +1131,67 @@ export declare const CreatePolicyBodySchema: z.ZodObject<{
|
|
|
955
1131
|
operator: "in" | "not in";
|
|
956
1132
|
addresses: string[];
|
|
957
1133
|
})[];
|
|
1134
|
+
}>, z.ZodObject<{
|
|
1135
|
+
/**
|
|
1136
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
1137
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
1138
|
+
*/
|
|
1139
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
1140
|
+
/**
|
|
1141
|
+
* The operation to which this rule applies.
|
|
1142
|
+
* Must be "signEvmHash".
|
|
1143
|
+
*/
|
|
1144
|
+
operation: z.ZodLiteral<"signEvmHash">;
|
|
1145
|
+
}, "strip", z.ZodTypeAny, {
|
|
1146
|
+
action: "reject" | "accept";
|
|
1147
|
+
operation: "signEvmHash";
|
|
1148
|
+
}, {
|
|
1149
|
+
action: "reject" | "accept";
|
|
1150
|
+
operation: "signEvmHash";
|
|
1151
|
+
}>, z.ZodObject<{
|
|
1152
|
+
/**
|
|
1153
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
1154
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
1155
|
+
*/
|
|
1156
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
1157
|
+
/**
|
|
1158
|
+
* The operation to which this rule applies.
|
|
1159
|
+
* Must be "signEvmMessage".
|
|
1160
|
+
*/
|
|
1161
|
+
operation: z.ZodLiteral<"signEvmMessage">;
|
|
1162
|
+
/**
|
|
1163
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
1164
|
+
* Must be compatible with the specified operation type.
|
|
1165
|
+
*/
|
|
1166
|
+
criteria: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1167
|
+
/** The type of criterion, must be "evmMessage" for EVM message-based rules. */
|
|
1168
|
+
type: z.ZodLiteral<"evmMessage">;
|
|
1169
|
+
/**
|
|
1170
|
+
* A regular expression the message is matched against.
|
|
1171
|
+
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
|
|
1172
|
+
*/
|
|
1173
|
+
match: z.ZodString;
|
|
1174
|
+
}, "strip", z.ZodTypeAny, {
|
|
1175
|
+
type: "evmMessage";
|
|
1176
|
+
match: string;
|
|
1177
|
+
}, {
|
|
1178
|
+
type: "evmMessage";
|
|
1179
|
+
match: string;
|
|
1180
|
+
}>]>, "many">;
|
|
1181
|
+
}, "strip", z.ZodTypeAny, {
|
|
1182
|
+
action: "reject" | "accept";
|
|
1183
|
+
operation: "signEvmMessage";
|
|
1184
|
+
criteria: {
|
|
1185
|
+
type: "evmMessage";
|
|
1186
|
+
match: string;
|
|
1187
|
+
}[];
|
|
1188
|
+
}, {
|
|
1189
|
+
action: "reject" | "accept";
|
|
1190
|
+
operation: "signEvmMessage";
|
|
1191
|
+
criteria: {
|
|
1192
|
+
type: "evmMessage";
|
|
1193
|
+
match: string;
|
|
1194
|
+
}[];
|
|
958
1195
|
}>, z.ZodObject<{
|
|
959
1196
|
/**
|
|
960
1197
|
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
@@ -1135,6 +1372,16 @@ export declare const CreatePolicyBodySchema: z.ZodObject<{
|
|
|
1135
1372
|
operator: "in" | "not in";
|
|
1136
1373
|
addresses: `0x${string}`[];
|
|
1137
1374
|
})[];
|
|
1375
|
+
} | {
|
|
1376
|
+
action: "reject" | "accept";
|
|
1377
|
+
operation: "signEvmHash";
|
|
1378
|
+
} | {
|
|
1379
|
+
action: "reject" | "accept";
|
|
1380
|
+
operation: "signEvmMessage";
|
|
1381
|
+
criteria: {
|
|
1382
|
+
type: "evmMessage";
|
|
1383
|
+
match: string;
|
|
1384
|
+
}[];
|
|
1138
1385
|
} | {
|
|
1139
1386
|
action: "reject" | "accept";
|
|
1140
1387
|
operation: "sendEvmTransaction";
|
|
@@ -1175,6 +1422,16 @@ export declare const CreatePolicyBodySchema: z.ZodObject<{
|
|
|
1175
1422
|
operator: "in" | "not in";
|
|
1176
1423
|
addresses: string[];
|
|
1177
1424
|
})[];
|
|
1425
|
+
} | {
|
|
1426
|
+
action: "reject" | "accept";
|
|
1427
|
+
operation: "signEvmHash";
|
|
1428
|
+
} | {
|
|
1429
|
+
action: "reject" | "accept";
|
|
1430
|
+
operation: "signEvmMessage";
|
|
1431
|
+
criteria: {
|
|
1432
|
+
type: "evmMessage";
|
|
1433
|
+
match: string;
|
|
1434
|
+
}[];
|
|
1178
1435
|
} | {
|
|
1179
1436
|
action: "reject" | "accept";
|
|
1180
1437
|
operation: "sendEvmTransaction";
|
|
@@ -1298,6 +1555,67 @@ export declare const UpdatePolicyBodySchema: z.ZodObject<{
|
|
|
1298
1555
|
operator: "in" | "not in";
|
|
1299
1556
|
addresses: string[];
|
|
1300
1557
|
})[];
|
|
1558
|
+
}>, z.ZodObject<{
|
|
1559
|
+
/**
|
|
1560
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
1561
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
1562
|
+
*/
|
|
1563
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
1564
|
+
/**
|
|
1565
|
+
* The operation to which this rule applies.
|
|
1566
|
+
* Must be "signEvmHash".
|
|
1567
|
+
*/
|
|
1568
|
+
operation: z.ZodLiteral<"signEvmHash">;
|
|
1569
|
+
}, "strip", z.ZodTypeAny, {
|
|
1570
|
+
action: "reject" | "accept";
|
|
1571
|
+
operation: "signEvmHash";
|
|
1572
|
+
}, {
|
|
1573
|
+
action: "reject" | "accept";
|
|
1574
|
+
operation: "signEvmHash";
|
|
1575
|
+
}>, z.ZodObject<{
|
|
1576
|
+
/**
|
|
1577
|
+
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
1578
|
+
* "accept" will allow the signing, "reject" will block it.
|
|
1579
|
+
*/
|
|
1580
|
+
action: z.ZodEnum<["reject", "accept"]>;
|
|
1581
|
+
/**
|
|
1582
|
+
* The operation to which this rule applies.
|
|
1583
|
+
* Must be "signEvmMessage".
|
|
1584
|
+
*/
|
|
1585
|
+
operation: z.ZodLiteral<"signEvmMessage">;
|
|
1586
|
+
/**
|
|
1587
|
+
* The set of criteria that must be matched for this rule to apply.
|
|
1588
|
+
* Must be compatible with the specified operation type.
|
|
1589
|
+
*/
|
|
1590
|
+
criteria: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
1591
|
+
/** The type of criterion, must be "evmMessage" for EVM message-based rules. */
|
|
1592
|
+
type: z.ZodLiteral<"evmMessage">;
|
|
1593
|
+
/**
|
|
1594
|
+
* A regular expression the message is matched against.
|
|
1595
|
+
* Accepts valid regular expression syntax described by [RE2](https://github.com/google/re2/wiki/Syntax).
|
|
1596
|
+
*/
|
|
1597
|
+
match: z.ZodString;
|
|
1598
|
+
}, "strip", z.ZodTypeAny, {
|
|
1599
|
+
type: "evmMessage";
|
|
1600
|
+
match: string;
|
|
1601
|
+
}, {
|
|
1602
|
+
type: "evmMessage";
|
|
1603
|
+
match: string;
|
|
1604
|
+
}>]>, "many">;
|
|
1605
|
+
}, "strip", z.ZodTypeAny, {
|
|
1606
|
+
action: "reject" | "accept";
|
|
1607
|
+
operation: "signEvmMessage";
|
|
1608
|
+
criteria: {
|
|
1609
|
+
type: "evmMessage";
|
|
1610
|
+
match: string;
|
|
1611
|
+
}[];
|
|
1612
|
+
}, {
|
|
1613
|
+
action: "reject" | "accept";
|
|
1614
|
+
operation: "signEvmMessage";
|
|
1615
|
+
criteria: {
|
|
1616
|
+
type: "evmMessage";
|
|
1617
|
+
match: string;
|
|
1618
|
+
}[];
|
|
1301
1619
|
}>, z.ZodObject<{
|
|
1302
1620
|
/**
|
|
1303
1621
|
* Determines whether matching the rule will cause a request to be rejected or accepted.
|
|
@@ -1477,6 +1795,16 @@ export declare const UpdatePolicyBodySchema: z.ZodObject<{
|
|
|
1477
1795
|
operator: "in" | "not in";
|
|
1478
1796
|
addresses: `0x${string}`[];
|
|
1479
1797
|
})[];
|
|
1798
|
+
} | {
|
|
1799
|
+
action: "reject" | "accept";
|
|
1800
|
+
operation: "signEvmHash";
|
|
1801
|
+
} | {
|
|
1802
|
+
action: "reject" | "accept";
|
|
1803
|
+
operation: "signEvmMessage";
|
|
1804
|
+
criteria: {
|
|
1805
|
+
type: "evmMessage";
|
|
1806
|
+
match: string;
|
|
1807
|
+
}[];
|
|
1480
1808
|
} | {
|
|
1481
1809
|
action: "reject" | "accept";
|
|
1482
1810
|
operation: "sendEvmTransaction";
|
|
@@ -1516,6 +1844,16 @@ export declare const UpdatePolicyBodySchema: z.ZodObject<{
|
|
|
1516
1844
|
operator: "in" | "not in";
|
|
1517
1845
|
addresses: string[];
|
|
1518
1846
|
})[];
|
|
1847
|
+
} | {
|
|
1848
|
+
action: "reject" | "accept";
|
|
1849
|
+
operation: "signEvmHash";
|
|
1850
|
+
} | {
|
|
1851
|
+
action: "reject" | "accept";
|
|
1852
|
+
operation: "signEvmMessage";
|
|
1853
|
+
criteria: {
|
|
1854
|
+
type: "evmMessage";
|
|
1855
|
+
match: string;
|
|
1856
|
+
}[];
|
|
1519
1857
|
} | {
|
|
1520
1858
|
action: "reject" | "accept";
|
|
1521
1859
|
operation: "sendEvmTransaction";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../policies/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,eAAO,MAAM,oBAAoB,yCAAuC,CAAC;AACzE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,sBAAsB,6BAA2B,CAAC;AAC/D;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,sBAAsB,6BAA2B,CAAC;AAC/D;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,sBAAsB,6BAA2B,CAAC;AAC/D;;;GAGG;AACH,MAAM,MA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkRH,CAAC;AACH;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
|
package/_types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.14.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TransactionSerializable, serializeTransaction } from "viem";
|
|
1
|
+
import { type TransactionSerializable, getTypesForEIP712Domain, serializeTransaction } from "viem";
|
|
2
2
|
|
|
3
3
|
import { FundOptions, fund } from "../../actions/evm/fund/fund.js";
|
|
4
4
|
import { Quote } from "../../actions/evm/fund/Quote.js";
|
|
@@ -31,7 +31,6 @@ import type {
|
|
|
31
31
|
TransactionResult,
|
|
32
32
|
} from "../../actions/evm/sendTransaction.js";
|
|
33
33
|
import type {
|
|
34
|
-
SendSwapTransactionOptions,
|
|
35
34
|
SwapOptions,
|
|
36
35
|
SwapResult,
|
|
37
36
|
QuoteSwapOptions,
|
|
@@ -85,6 +84,11 @@ export function toEvmServerAccount(
|
|
|
85
84
|
},
|
|
86
85
|
|
|
87
86
|
async signTypedData(message: EIP712Message) {
|
|
87
|
+
if (!message.types.EIP712Domain) {
|
|
88
|
+
message.types.EIP712Domain = getTypesForEIP712Domain({
|
|
89
|
+
domain: message.domain,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
88
92
|
const result = await apiClient.signEvmTypedData(options.account.address, message);
|
|
89
93
|
return result.signature as Hex;
|
|
90
94
|
},
|
|
@@ -140,7 +144,8 @@ export function toEvmServerAccount(
|
|
|
140
144
|
return sendSwapTransaction(apiClient, {
|
|
141
145
|
...options,
|
|
142
146
|
address: this.address,
|
|
143
|
-
|
|
147
|
+
taker: this.address, // Always use account's address as taker
|
|
148
|
+
});
|
|
144
149
|
},
|
|
145
150
|
name: options.account.name,
|
|
146
151
|
type: "evm-server",
|
|
@@ -32,7 +32,7 @@ export interface EvmTokenAmount {
|
|
|
32
32
|
/** The amount of the token in the smallest indivisible unit of the token. */
|
|
33
33
|
amount: bigint;
|
|
34
34
|
/** The number of decimals in the token. */
|
|
35
|
-
decimals:
|
|
35
|
+
decimals: number;
|
|
36
36
|
}
|
|
37
37
|
/**
|
|
38
38
|
* An EVM token balance.
|
|
@@ -95,7 +95,7 @@ export async function listTokenBalances(
|
|
|
95
95
|
},
|
|
96
96
|
amount: {
|
|
97
97
|
amount: BigInt(balance.amount.amount),
|
|
98
|
-
decimals:
|
|
98
|
+
decimals: balance.amount.decimals,
|
|
99
99
|
},
|
|
100
100
|
};
|
|
101
101
|
});
|
|
@@ -83,10 +83,53 @@ export type QuoteSwapOptions = Omit<CreateSwapQuoteOptions, "taker">;
|
|
|
83
83
|
*/
|
|
84
84
|
export type QuoteSwapResult = CreateSwapQuoteResult | SwapUnavailableResult;
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Options when providing an already created swap quote (account-level).
|
|
88
|
+
*/
|
|
89
|
+
interface AccountQuoteBasedSwapOptions {
|
|
90
|
+
/**
|
|
91
|
+
* The swap quote returned by the createSwapQuote method.
|
|
92
|
+
*/
|
|
93
|
+
swapQuote: CreateSwapQuoteResult;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Optional idempotency key for the request.
|
|
97
|
+
*/
|
|
98
|
+
idempotencyKey?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Options when creating a swap quote inline (account-level).
|
|
103
|
+
*/
|
|
104
|
+
interface AccountInlineSwapOptions {
|
|
105
|
+
/**
|
|
106
|
+
* The network to execute the swap on (e.g., "ethereum", "base").
|
|
107
|
+
*/
|
|
108
|
+
network: SendEvmTransactionBodyNetwork;
|
|
109
|
+
/** The token to receive (destination token). */
|
|
110
|
+
toToken: Address;
|
|
111
|
+
/** The token to send (source token). */
|
|
112
|
+
fromToken: Address;
|
|
113
|
+
/** The amount to send in atomic units of the token. */
|
|
114
|
+
fromAmount: bigint;
|
|
115
|
+
/** The signer address (only needed if taker is a smart contract). */
|
|
116
|
+
signerAddress?: Address;
|
|
117
|
+
/** The gas price in Wei. */
|
|
118
|
+
gasPrice?: bigint;
|
|
119
|
+
/** The slippage tolerance in basis points (0-10000). */
|
|
120
|
+
slippageBps?: number;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Optional idempotency key for the request.
|
|
124
|
+
*/
|
|
125
|
+
idempotencyKey?: string;
|
|
126
|
+
}
|
|
127
|
+
|
|
86
128
|
/**
|
|
87
129
|
* Options for executing a token swap (account-level).
|
|
130
|
+
* The taker is automatically set to the account's address.
|
|
88
131
|
*/
|
|
89
|
-
export type SwapOptions =
|
|
132
|
+
export type SwapOptions = AccountQuoteBasedSwapOptions | AccountInlineSwapOptions;
|
|
90
133
|
|
|
91
134
|
/**
|
|
92
135
|
* Result of executing a token swap (account-level).
|
package/analytics.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import md5 from "md5";
|
|
2
2
|
|
|
3
|
-
import { APIError } from "./openapi-client/errors.js";
|
|
3
|
+
import { APIError, HttpErrorType } from "./openapi-client/errors.js";
|
|
4
4
|
import { version } from "./version.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -184,7 +184,7 @@ function shouldTrackError(error: unknown): boolean {
|
|
|
184
184
|
return false;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
if (error instanceof APIError) {
|
|
187
|
+
if (error instanceof APIError && error.errorType !== HttpErrorType.unexpected_error) {
|
|
188
188
|
return false;
|
|
189
189
|
}
|
|
190
190
|
|
package/client/evm/evm.ts
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
GetSwapPriceResult,
|
|
33
33
|
CreateSwapQuoteResult,
|
|
34
34
|
SwapUnavailableResult,
|
|
35
|
+
GetOrCreateSmartAccountOptions,
|
|
35
36
|
} from "./evm.types.js";
|
|
36
37
|
import { toEvmServerAccount } from "../../accounts/evm/toEvmServerAccount.js";
|
|
37
38
|
import { toEvmSmartAccount } from "../../accounts/evm/toEvmSmartAccount.js";
|
|
@@ -261,6 +262,7 @@ export class EvmClient implements EvmClientInterface {
|
|
|
261
262
|
const openApiSmartAccount = await CdpOpenApiClient.createEvmSmartAccount(
|
|
262
263
|
{
|
|
263
264
|
owners: [options.owner.address],
|
|
265
|
+
name: options.name,
|
|
264
266
|
},
|
|
265
267
|
options.idempotencyKey,
|
|
266
268
|
);
|
|
@@ -326,7 +328,10 @@ export class EvmClient implements EvmClientInterface {
|
|
|
326
328
|
* Gets a CDP EVM smart account.
|
|
327
329
|
*
|
|
328
330
|
* @param {GetSmartAccountOptions} options - Parameters for getting the smart account.
|
|
329
|
-
*
|
|
331
|
+
* Either `address` or `name` must be provided.
|
|
332
|
+
* If both are provided, lookup will be done by `address` and `name` will be ignored.
|
|
333
|
+
* @param {string} [options.address] - The address of the smart account to get.
|
|
334
|
+
* @param {string} [options.name] - The name of the smart account to get.
|
|
330
335
|
* @param {Account} options.owner - The owner of the smart account.
|
|
331
336
|
* You must pass the signing-capable owner of the smart account so that the returned smart account
|
|
332
337
|
* can be functional.
|
|
@@ -342,7 +347,14 @@ export class EvmClient implements EvmClientInterface {
|
|
|
342
347
|
* ```
|
|
343
348
|
*/
|
|
344
349
|
async getSmartAccount(options: GetSmartAccountOptions): Promise<SmartAccount> {
|
|
345
|
-
const openApiSmartAccount = await
|
|
350
|
+
const openApiSmartAccount = await (async () => {
|
|
351
|
+
if (options.address) {
|
|
352
|
+
return CdpOpenApiClient.getEvmSmartAccount(options.address);
|
|
353
|
+
} else if (options.name) {
|
|
354
|
+
return CdpOpenApiClient.getEvmSmartAccountByName(options.name);
|
|
355
|
+
}
|
|
356
|
+
throw new Error("Either address or name must be provided");
|
|
357
|
+
})();
|
|
346
358
|
|
|
347
359
|
const smartAccount = toEvmSmartAccount(CdpOpenApiClient, {
|
|
348
360
|
smartAccount: openApiSmartAccount,
|
|
@@ -395,6 +407,51 @@ export class EvmClient implements EvmClientInterface {
|
|
|
395
407
|
}
|
|
396
408
|
}
|
|
397
409
|
|
|
410
|
+
/**
|
|
411
|
+
* Gets a CDP EVM smart account, or creates one if it doesn't exist.
|
|
412
|
+
* This method first attempts to retrieve an existing smart account with the given parameters.
|
|
413
|
+
* If no account exists, it creates a new one with the specified owner.
|
|
414
|
+
*
|
|
415
|
+
* @param {GetOrCreateSmartAccountOptions} options - Configuration options for getting or creating the smart account.
|
|
416
|
+
* @param {string} [options.name] - The name of the smart account to get or create.
|
|
417
|
+
* @param {Account} options.owner - The owner of the smart account.
|
|
418
|
+
*
|
|
419
|
+
* @returns {Promise<SmartAccount>} A promise that resolves to the retrieved or newly created smart account.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* ```ts
|
|
423
|
+
* const smartAccount = await cdp.evm.getOrCreateSmartAccount({
|
|
424
|
+
* name: "MySmartAccount",
|
|
425
|
+
* owner: account,
|
|
426
|
+
* });
|
|
427
|
+
* ```
|
|
428
|
+
*/
|
|
429
|
+
async getOrCreateSmartAccount(options: GetOrCreateSmartAccountOptions): Promise<SmartAccount> {
|
|
430
|
+
try {
|
|
431
|
+
const account = await this.getSmartAccount(options);
|
|
432
|
+
return account;
|
|
433
|
+
} catch (error) {
|
|
434
|
+
// If it failed because the account doesn't exist, create it
|
|
435
|
+
const doesAccountNotExist = error instanceof APIError && error.statusCode === 404;
|
|
436
|
+
if (doesAccountNotExist) {
|
|
437
|
+
try {
|
|
438
|
+
const account = await this.createSmartAccount(options);
|
|
439
|
+
return account;
|
|
440
|
+
} catch (error) {
|
|
441
|
+
// If it failed because the account already exists, throw an error
|
|
442
|
+
const doesAccountAlreadyExist = error instanceof APIError && error.statusCode === 409;
|
|
443
|
+
if (doesAccountAlreadyExist) {
|
|
444
|
+
const account = await this.getSmartAccount(options);
|
|
445
|
+
return account;
|
|
446
|
+
}
|
|
447
|
+
throw error;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
throw error;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
|
|
398
455
|
/**
|
|
399
456
|
* Gets the price for a swap between two tokens on an EVM network.
|
|
400
457
|
*
|