@coinbase/cdp-sdk 1.22.0 → 1.24.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 +22 -0
- package/README.md +2 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js +1 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/actions/evm/getUserOperation.js +2 -1
- package/_cjs/actions/evm/getUserOperation.js.map +1 -1
- package/_cjs/client/evm/evm.js +23 -1
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +55 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +14 -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 +51 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +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 +322 -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 +14 -10
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js +34 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_cjs/policies/schema.js +210 -1
- package/_cjs/policies/schema.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +1 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/actions/evm/getUserOperation.js +2 -1
- package/_esm/actions/evm/getUserOperation.js.map +1 -1
- package/_esm/client/evm/evm.js +23 -1
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +53 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +12 -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 +48 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +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 +300 -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 +12 -8
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +31 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -1
- package/_esm/policies/schema.js +209 -0
- package/_esm/policies/schema.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/types.d.ts +2 -0
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/actions/evm/getUserOperation.d.ts.map +1 -1
- package/_types/actions/evm/types.d.ts +2 -2
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +15 -2
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +19 -5
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +222 -3
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +7 -1
- 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/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 +21 -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 +7 -6
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +2 -0
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +4 -10
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/schema.d.ts +7373 -1437
- package/_types/policies/schema.d.ts.map +1 -1
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmSmartAccount.ts +1 -0
- package/accounts/evm/types.ts +2 -0
- package/actions/evm/getUserOperation.ts +4 -1
- package/actions/evm/types.ts +2 -2
- package/client/evm/evm.ts +32 -1
- package/client/evm/evm.types.ts +21 -4
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +301 -3
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +86 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +23 -0
- package/openapi-client/generated/index.msw.ts +5 -5
- package/openapi-client/generated/policy-engine/policy-engine.msw.ts +465 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +51 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.ts +22 -20
- package/package.json +1 -1
- package/policies/schema.ts +257 -0
- package/version.ts +1 -1
|
@@ -135,6 +135,8 @@ Account names are guaranteed to be unique across all Smart Accounts in the devel
|
|
|
135
135
|
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
136
136
|
*/
|
|
137
137
|
name?: string;
|
|
138
|
+
/** The list of policy IDs that apply to the smart account. This will include both the project-level policy and the account-level policy, if one exists. */
|
|
139
|
+
policies?: string[];
|
|
138
140
|
/** The UTC ISO 8601 timestamp at which the account was created. */
|
|
139
141
|
createdAt?: string;
|
|
140
142
|
/** The UTC ISO 8601 timestamp at which the account was last updated. */
|
|
@@ -991,6 +993,194 @@ export interface SignEvmMessageRule {
|
|
|
991
993
|
criteria: SignEvmMessageCriteria;
|
|
992
994
|
}
|
|
993
995
|
|
|
996
|
+
/**
|
|
997
|
+
* The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
|
|
998
|
+
*/
|
|
999
|
+
export type EvmTypedAddressConditionOperator =
|
|
1000
|
+
(typeof EvmTypedAddressConditionOperator)[keyof typeof EvmTypedAddressConditionOperator];
|
|
1001
|
+
|
|
1002
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1003
|
+
export const EvmTypedAddressConditionOperator = {
|
|
1004
|
+
in: "in",
|
|
1005
|
+
not_in: "not in",
|
|
1006
|
+
} as const;
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* A schema for specifying criterion for an address field of an EVM typed message. The address can be deeply nested within the typed data's message.
|
|
1010
|
+
*/
|
|
1011
|
+
export interface EvmTypedAddressCondition {
|
|
1012
|
+
/** A list of 0x-prefixed EVM addresses that the value located at the message's path should be compared to. There is a limit of 100 addresses per criterion. */
|
|
1013
|
+
addresses: string[];
|
|
1014
|
+
/** The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
|
|
1015
|
+
operator: EvmTypedAddressConditionOperator;
|
|
1016
|
+
/** The path to the field to compare against this criterion. To reference deeply nested fields within the message, separate object keys by `.`, and access array values using `[index]`. If the field does not exist or is not an address, the operation will be rejected. */
|
|
1017
|
+
path: string;
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `value` field will be on the right-hand side.
|
|
1022
|
+
*/
|
|
1023
|
+
export type EvmTypedNumericalConditionOperator =
|
|
1024
|
+
(typeof EvmTypedNumericalConditionOperator)[keyof typeof EvmTypedNumericalConditionOperator];
|
|
1025
|
+
|
|
1026
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1027
|
+
export const EvmTypedNumericalConditionOperator = {
|
|
1028
|
+
">": ">",
|
|
1029
|
+
">=": ">=",
|
|
1030
|
+
"<": "<",
|
|
1031
|
+
"<=": "<=",
|
|
1032
|
+
"==": "==",
|
|
1033
|
+
} as const;
|
|
1034
|
+
|
|
1035
|
+
/**
|
|
1036
|
+
* A schema for specifying criterion for a numerical field of an EVM typed message. The value can be deeply nested within the typed data's message.
|
|
1037
|
+
*/
|
|
1038
|
+
export interface EvmTypedNumericalCondition {
|
|
1039
|
+
/**
|
|
1040
|
+
* The amount that the value located at the message's path should be compared to.
|
|
1041
|
+
* @pattern ^[0-9]+$
|
|
1042
|
+
*/
|
|
1043
|
+
value: string;
|
|
1044
|
+
/** The operator to use for the comparison. The value located at the message's path will be on the left-hand side of the operator, and the `value` field will be on the right-hand side. */
|
|
1045
|
+
operator: EvmTypedNumericalConditionOperator;
|
|
1046
|
+
/** The path to the field to compare against this criterion. To reference deeply nested fields within the message, separate object keys by `.`, and access array values using `[index]`. If the field does not exist or is not an address, the operation will be rejected. */
|
|
1047
|
+
path: string;
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* A schema for specifying criterion for a string field of an EVM typed message. The value can be deeply nested within the typed data's message.
|
|
1052
|
+
*/
|
|
1053
|
+
export interface EvmTypedStringCondition {
|
|
1054
|
+
/** A regular expression the field is matched against. */
|
|
1055
|
+
match: string;
|
|
1056
|
+
/** The path to the field to compare against this criterion. To reference deeply nested fields within the message, separate object keys by `.`, and access array values using `[index]`. If the field does not exist or is not an address, the operation will be rejected. */
|
|
1057
|
+
path: string;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* The type of criterion to use. This should be `evmTypedDataField`.
|
|
1062
|
+
*/
|
|
1063
|
+
export type SignEvmTypedDataFieldCriterionType =
|
|
1064
|
+
(typeof SignEvmTypedDataFieldCriterionType)[keyof typeof SignEvmTypedDataFieldCriterionType];
|
|
1065
|
+
|
|
1066
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1067
|
+
export const SignEvmTypedDataFieldCriterionType = {
|
|
1068
|
+
evmTypedDataField: "evmTypedDataField",
|
|
1069
|
+
} as const;
|
|
1070
|
+
|
|
1071
|
+
export type SignEvmTypedDataFieldCriterionTypesTypesItem = {
|
|
1072
|
+
/** The name of a key within an EIP-712 data structure. */
|
|
1073
|
+
name?: string;
|
|
1074
|
+
/** The Solidity type of a value within an EIP-712 data structure. */
|
|
1075
|
+
type?: string;
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
/**
|
|
1079
|
+
* EIP-712 compliant map of model names to model definitions.
|
|
1080
|
+
*/
|
|
1081
|
+
export type SignEvmTypedDataFieldCriterionTypesTypes = {
|
|
1082
|
+
[key: string]: SignEvmTypedDataFieldCriterionTypesTypesItem[];
|
|
1083
|
+
};
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* An object containing EIP-712 type definitions, as well as a primary type for the root message object.
|
|
1087
|
+
*/
|
|
1088
|
+
export type SignEvmTypedDataFieldCriterionTypes = {
|
|
1089
|
+
/** EIP-712 compliant map of model names to model definitions. */
|
|
1090
|
+
types: SignEvmTypedDataFieldCriterionTypesTypes;
|
|
1091
|
+
/** The name of the root EIP-712 type. This value must be included in the `types` object. */
|
|
1092
|
+
primaryType: string;
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
export type SignEvmTypedDataFieldCriterionConditionsItem =
|
|
1096
|
+
| EvmTypedAddressCondition
|
|
1097
|
+
| EvmTypedNumericalCondition
|
|
1098
|
+
| EvmTypedStringCondition;
|
|
1099
|
+
|
|
1100
|
+
export interface SignEvmTypedDataFieldCriterion {
|
|
1101
|
+
/** The type of criterion to use. This should be `evmTypedDataField`. */
|
|
1102
|
+
type: SignEvmTypedDataFieldCriterionType;
|
|
1103
|
+
/** An object containing EIP-712 type definitions, as well as a primary type for the root message object. */
|
|
1104
|
+
types: SignEvmTypedDataFieldCriterionTypes;
|
|
1105
|
+
/** A list of conditions to check against the data being signed. Each condition must be met for the rule to take effect. */
|
|
1106
|
+
conditions: SignEvmTypedDataFieldCriterionConditionsItem[];
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* The type of criterion to use. This should be `evmTypedDataVerifyingContract`.
|
|
1111
|
+
*/
|
|
1112
|
+
export type SignEvmTypedDataVerifyingContractCriterionType =
|
|
1113
|
+
(typeof SignEvmTypedDataVerifyingContractCriterionType)[keyof typeof SignEvmTypedDataVerifyingContractCriterionType];
|
|
1114
|
+
|
|
1115
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1116
|
+
export const SignEvmTypedDataVerifyingContractCriterionType = {
|
|
1117
|
+
evmTypedDataVerifyingContract: "evmTypedDataVerifyingContract",
|
|
1118
|
+
} as const;
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* The operator to use for the comparison. The domain's verifying contract will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side.
|
|
1122
|
+
*/
|
|
1123
|
+
export type SignEvmTypedDataVerifyingContractCriterionOperator =
|
|
1124
|
+
(typeof SignEvmTypedDataVerifyingContractCriterionOperator)[keyof typeof SignEvmTypedDataVerifyingContractCriterionOperator];
|
|
1125
|
+
|
|
1126
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1127
|
+
export const SignEvmTypedDataVerifyingContractCriterionOperator = {
|
|
1128
|
+
in: "in",
|
|
1129
|
+
not_in: "not in",
|
|
1130
|
+
} as const;
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* A schema for specifying criterion for a domain's verifying contract.
|
|
1134
|
+
*/
|
|
1135
|
+
export interface SignEvmTypedDataVerifyingContractCriterion {
|
|
1136
|
+
/** The type of criterion to use. This should be `evmTypedDataVerifyingContract`. */
|
|
1137
|
+
type: SignEvmTypedDataVerifyingContractCriterionType;
|
|
1138
|
+
/** A list of 0x-prefixed EVM addresses that the domain's verifying contract should be compared to. There is a limit of 100 addresses per criterion. */
|
|
1139
|
+
addresses: string[];
|
|
1140
|
+
/** The operator to use for the comparison. The domain's verifying contract will be on the left-hand side of the operator, and the `addresses` field will be on the right-hand side. */
|
|
1141
|
+
operator: SignEvmTypedDataVerifyingContractCriterionOperator;
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
export type SignEvmTypedDataCriteriaItem =
|
|
1145
|
+
| SignEvmTypedDataFieldCriterion
|
|
1146
|
+
| SignEvmTypedDataVerifyingContractCriterion;
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* A schema for specifying criteria for the SignEvmTypedData operation.
|
|
1150
|
+
*/
|
|
1151
|
+
export type SignEvmTypedDataCriteria = SignEvmTypedDataCriteriaItem[];
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Whether matching the rule will cause the request to be rejected or accepted.
|
|
1155
|
+
*/
|
|
1156
|
+
export type SignEvmTypedDataRuleAction =
|
|
1157
|
+
(typeof SignEvmTypedDataRuleAction)[keyof typeof SignEvmTypedDataRuleAction];
|
|
1158
|
+
|
|
1159
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1160
|
+
export const SignEvmTypedDataRuleAction = {
|
|
1161
|
+
reject: "reject",
|
|
1162
|
+
accept: "accept",
|
|
1163
|
+
} as const;
|
|
1164
|
+
|
|
1165
|
+
/**
|
|
1166
|
+
* The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
|
|
1167
|
+
*/
|
|
1168
|
+
export type SignEvmTypedDataRuleOperation =
|
|
1169
|
+
(typeof SignEvmTypedDataRuleOperation)[keyof typeof SignEvmTypedDataRuleOperation];
|
|
1170
|
+
|
|
1171
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1172
|
+
export const SignEvmTypedDataRuleOperation = {
|
|
1173
|
+
signEvmTypedData: "signEvmTypedData",
|
|
1174
|
+
} as const;
|
|
1175
|
+
|
|
1176
|
+
export interface SignEvmTypedDataRule {
|
|
1177
|
+
/** Whether matching the rule will cause the request to be rejected or accepted. */
|
|
1178
|
+
action: SignEvmTypedDataRuleAction;
|
|
1179
|
+
/** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
|
|
1180
|
+
operation: SignEvmTypedDataRuleOperation;
|
|
1181
|
+
criteria: SignEvmTypedDataCriteria;
|
|
1182
|
+
}
|
|
1183
|
+
|
|
994
1184
|
/**
|
|
995
1185
|
* The type of criterion to use. This should be `solAddress`.
|
|
996
1186
|
*/
|
|
@@ -1092,6 +1282,89 @@ export interface SignEvmHashRule {
|
|
|
1092
1282
|
operation: SignEvmHashRuleOperation;
|
|
1093
1283
|
}
|
|
1094
1284
|
|
|
1285
|
+
export type PrepareUserOperationCriteriaItem =
|
|
1286
|
+
| EthValueCriterion
|
|
1287
|
+
| EvmAddressCriterion
|
|
1288
|
+
| EvmNetworkCriterion
|
|
1289
|
+
| EvmDataCriterion;
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* A schema for specifying criteria for the PrepareUserOperation operation.
|
|
1293
|
+
*/
|
|
1294
|
+
export type PrepareUserOperationCriteria = PrepareUserOperationCriteriaItem[];
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* Whether matching the rule will cause the request to be rejected or accepted.
|
|
1298
|
+
*/
|
|
1299
|
+
export type PrepareUserOperationRuleAction =
|
|
1300
|
+
(typeof PrepareUserOperationRuleAction)[keyof typeof PrepareUserOperationRuleAction];
|
|
1301
|
+
|
|
1302
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1303
|
+
export const PrepareUserOperationRuleAction = {
|
|
1304
|
+
reject: "reject",
|
|
1305
|
+
accept: "accept",
|
|
1306
|
+
} as const;
|
|
1307
|
+
|
|
1308
|
+
/**
|
|
1309
|
+
* The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
|
|
1310
|
+
*/
|
|
1311
|
+
export type PrepareUserOperationRuleOperation =
|
|
1312
|
+
(typeof PrepareUserOperationRuleOperation)[keyof typeof PrepareUserOperationRuleOperation];
|
|
1313
|
+
|
|
1314
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1315
|
+
export const PrepareUserOperationRuleOperation = {
|
|
1316
|
+
prepareUserOperation: "prepareUserOperation",
|
|
1317
|
+
} as const;
|
|
1318
|
+
|
|
1319
|
+
export interface PrepareUserOperationRule {
|
|
1320
|
+
/** Whether matching the rule will cause the request to be rejected or accepted. */
|
|
1321
|
+
action: PrepareUserOperationRuleAction;
|
|
1322
|
+
/** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
|
|
1323
|
+
operation: PrepareUserOperationRuleOperation;
|
|
1324
|
+
criteria: PrepareUserOperationCriteria;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
export type SendUserOperationCriteriaItem =
|
|
1328
|
+
| EthValueCriterion
|
|
1329
|
+
| EvmAddressCriterion
|
|
1330
|
+
| EvmDataCriterion;
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* A schema for specifying criteria for the SendUserOperation operation.
|
|
1334
|
+
*/
|
|
1335
|
+
export type SendUserOperationCriteria = SendUserOperationCriteriaItem[];
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* Whether matching the rule will cause the request to be rejected or accepted.
|
|
1339
|
+
*/
|
|
1340
|
+
export type SendUserOperationRuleAction =
|
|
1341
|
+
(typeof SendUserOperationRuleAction)[keyof typeof SendUserOperationRuleAction];
|
|
1342
|
+
|
|
1343
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1344
|
+
export const SendUserOperationRuleAction = {
|
|
1345
|
+
reject: "reject",
|
|
1346
|
+
accept: "accept",
|
|
1347
|
+
} as const;
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* The operation to which the rule applies. Every element of the `criteria` array must match the specified operation.
|
|
1351
|
+
*/
|
|
1352
|
+
export type SendUserOperationRuleOperation =
|
|
1353
|
+
(typeof SendUserOperationRuleOperation)[keyof typeof SendUserOperationRuleOperation];
|
|
1354
|
+
|
|
1355
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1356
|
+
export const SendUserOperationRuleOperation = {
|
|
1357
|
+
sendUserOperation: "sendUserOperation",
|
|
1358
|
+
} as const;
|
|
1359
|
+
|
|
1360
|
+
export interface SendUserOperationRule {
|
|
1361
|
+
/** Whether matching the rule will cause the request to be rejected or accepted. */
|
|
1362
|
+
action: SendUserOperationRuleAction;
|
|
1363
|
+
/** The operation to which the rule applies. Every element of the `criteria` array must match the specified operation. */
|
|
1364
|
+
operation: SendUserOperationRuleOperation;
|
|
1365
|
+
criteria: SendUserOperationCriteria;
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1095
1368
|
/**
|
|
1096
1369
|
* A rule that limits the behavior of an account.
|
|
1097
1370
|
*/
|
|
@@ -1099,8 +1372,11 @@ export type Rule =
|
|
|
1099
1372
|
| SignEvmTransactionRule
|
|
1100
1373
|
| SendEvmTransactionRule
|
|
1101
1374
|
| SignEvmMessageRule
|
|
1375
|
+
| SignEvmTypedDataRule
|
|
1102
1376
|
| SignSolTransactionRule
|
|
1103
|
-
| SignEvmHashRule
|
|
1377
|
+
| SignEvmHashRule
|
|
1378
|
+
| PrepareUserOperationRule
|
|
1379
|
+
| SendUserOperationRule;
|
|
1104
1380
|
|
|
1105
1381
|
/**
|
|
1106
1382
|
* The scope of the policy. Only one project-level policy can exist at any time.
|
|
@@ -1418,7 +1694,7 @@ export type AlreadyExistsErrorResponse = Error;
|
|
|
1418
1694
|
|
|
1419
1695
|
/**
|
|
1420
1696
|
* A JWT signed using your Wallet Secret, encoded in base64. Refer to the
|
|
1421
|
-
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-v2/
|
|
1697
|
+
[Generate Wallet Token](https://docs.cdp.coinbase.com/api-reference/v2/authentication#2-generate-wallet-token)
|
|
1422
1698
|
section of our Authentication docs for more details on how to generate your Wallet Token.
|
|
1423
1699
|
|
|
1424
1700
|
*/
|
|
@@ -1427,7 +1703,7 @@ export type XWalletAuthParameter = string;
|
|
|
1427
1703
|
/**
|
|
1428
1704
|
* An optional [UUID v4](https://www.uuidgenerator.net/version4) request header for making requests safely retryable.
|
|
1429
1705
|
When included, duplicate requests with the same key will return identical responses.
|
|
1430
|
-
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-v2/
|
|
1706
|
+
Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
|
|
1431
1707
|
|
|
1432
1708
|
*/
|
|
1433
1709
|
export type IdempotencyKeyParameter = string;
|
|
@@ -1608,6 +1884,16 @@ export type ExportEvmAccountByName200 = {
|
|
|
1608
1884
|
encryptedPrivateKey: string;
|
|
1609
1885
|
};
|
|
1610
1886
|
|
|
1887
|
+
export type UpdateEvmSmartAccountBody = {
|
|
1888
|
+
/**
|
|
1889
|
+
* An optional name for the smart account.
|
|
1890
|
+
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
|
|
1891
|
+
Account names must be unique across all EVM smart accounts in the developer's CDP Project.
|
|
1892
|
+
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
1893
|
+
*/
|
|
1894
|
+
name?: string;
|
|
1895
|
+
};
|
|
1896
|
+
|
|
1611
1897
|
/**
|
|
1612
1898
|
* The network to prepare the user operation for.
|
|
1613
1899
|
*/
|
|
@@ -1861,6 +2147,18 @@ Account names must be unique across all Solana accounts in the developer's CDP P
|
|
|
1861
2147
|
accountPolicy?: string;
|
|
1862
2148
|
};
|
|
1863
2149
|
|
|
2150
|
+
export type ImportSolanaAccountBody = {
|
|
2151
|
+
/** The base64-encoded, encrypted 32-byte private key of the Solana account. The private key must be encrypted using the CDP SDK's encryption scheme. */
|
|
2152
|
+
encryptedPrivateKey: string;
|
|
2153
|
+
/**
|
|
2154
|
+
* An optional name for the account.
|
|
2155
|
+
Account names can consist of alphanumeric characters and hyphens, and be between 2 and 36 characters long.
|
|
2156
|
+
Account names must be unique across all EVM accounts in the developer's CDP Project.
|
|
2157
|
+
* @pattern ^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$
|
|
2158
|
+
*/
|
|
2159
|
+
name?: string;
|
|
2160
|
+
};
|
|
2161
|
+
|
|
1864
2162
|
export type ExportSolanaAccountBody = {
|
|
1865
2163
|
/** The base64-encoded, public part of the RSA key in DER format used to encrypt the account private key. */
|
|
1866
2164
|
exportEncryptionKey: string;
|
|
@@ -27,6 +27,14 @@ export const getListEvmSmartAccountsResponseMock = (): ListEvmSmartAccounts200 =
|
|
|
27
27
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
28
28
|
undefined,
|
|
29
29
|
]),
|
|
30
|
+
policies: faker.helpers.arrayElement([
|
|
31
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
32
|
+
faker.helpers.fromRegExp(
|
|
33
|
+
"^[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}$",
|
|
34
|
+
),
|
|
35
|
+
),
|
|
36
|
+
undefined,
|
|
37
|
+
]),
|
|
30
38
|
createdAt: faker.helpers.arrayElement([
|
|
31
39
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
32
40
|
undefined,
|
|
@@ -52,6 +60,14 @@ export const getCreateEvmSmartAccountResponseMock = (
|
|
|
52
60
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
53
61
|
undefined,
|
|
54
62
|
]),
|
|
63
|
+
policies: faker.helpers.arrayElement([
|
|
64
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
65
|
+
faker.helpers.fromRegExp(
|
|
66
|
+
"^[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}$",
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
undefined,
|
|
70
|
+
]),
|
|
55
71
|
createdAt: faker.helpers.arrayElement([
|
|
56
72
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
57
73
|
undefined,
|
|
@@ -74,6 +90,14 @@ export const getGetEvmSmartAccountByNameResponseMock = (
|
|
|
74
90
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
75
91
|
undefined,
|
|
76
92
|
]),
|
|
93
|
+
policies: faker.helpers.arrayElement([
|
|
94
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
95
|
+
faker.helpers.fromRegExp(
|
|
96
|
+
"^[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}$",
|
|
97
|
+
),
|
|
98
|
+
),
|
|
99
|
+
undefined,
|
|
100
|
+
]),
|
|
77
101
|
createdAt: faker.helpers.arrayElement([
|
|
78
102
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
79
103
|
undefined,
|
|
@@ -96,6 +120,44 @@ export const getGetEvmSmartAccountResponseMock = (
|
|
|
96
120
|
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
97
121
|
undefined,
|
|
98
122
|
]),
|
|
123
|
+
policies: faker.helpers.arrayElement([
|
|
124
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
125
|
+
faker.helpers.fromRegExp(
|
|
126
|
+
"^[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}$",
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
undefined,
|
|
130
|
+
]),
|
|
131
|
+
createdAt: faker.helpers.arrayElement([
|
|
132
|
+
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
133
|
+
undefined,
|
|
134
|
+
]),
|
|
135
|
+
updatedAt: faker.helpers.arrayElement([
|
|
136
|
+
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
137
|
+
undefined,
|
|
138
|
+
]),
|
|
139
|
+
...overrideResponse,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
export const getUpdateEvmSmartAccountResponseMock = (
|
|
143
|
+
overrideResponse: Partial<EvmSmartAccount> = {},
|
|
144
|
+
): EvmSmartAccount => ({
|
|
145
|
+
address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
146
|
+
owners: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
147
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
148
|
+
),
|
|
149
|
+
name: faker.helpers.arrayElement([
|
|
150
|
+
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
151
|
+
undefined,
|
|
152
|
+
]),
|
|
153
|
+
policies: faker.helpers.arrayElement([
|
|
154
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
155
|
+
faker.helpers.fromRegExp(
|
|
156
|
+
"^[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}$",
|
|
157
|
+
),
|
|
158
|
+
),
|
|
159
|
+
undefined,
|
|
160
|
+
]),
|
|
99
161
|
createdAt: faker.helpers.arrayElement([
|
|
100
162
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
101
163
|
undefined,
|
|
@@ -274,6 +336,29 @@ export const getGetEvmSmartAccountMockHandler = (
|
|
|
274
336
|
});
|
|
275
337
|
};
|
|
276
338
|
|
|
339
|
+
export const getUpdateEvmSmartAccountMockHandler = (
|
|
340
|
+
overrideResponse?:
|
|
341
|
+
| EvmSmartAccount
|
|
342
|
+
| ((
|
|
343
|
+
info: Parameters<Parameters<typeof http.put>[1]>[0],
|
|
344
|
+
) => Promise<EvmSmartAccount> | EvmSmartAccount),
|
|
345
|
+
) => {
|
|
346
|
+
return http.put("*/v2/evm/smart-accounts/:address", async info => {
|
|
347
|
+
await delay(0);
|
|
348
|
+
|
|
349
|
+
return new HttpResponse(
|
|
350
|
+
JSON.stringify(
|
|
351
|
+
overrideResponse !== undefined
|
|
352
|
+
? typeof overrideResponse === "function"
|
|
353
|
+
? await overrideResponse(info)
|
|
354
|
+
: overrideResponse
|
|
355
|
+
: getUpdateEvmSmartAccountResponseMock(),
|
|
356
|
+
),
|
|
357
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
358
|
+
);
|
|
359
|
+
});
|
|
360
|
+
};
|
|
361
|
+
|
|
277
362
|
export const getPrepareUserOperationMockHandler = (
|
|
278
363
|
overrideResponse?:
|
|
279
364
|
| EvmUserOperation
|
|
@@ -350,6 +435,7 @@ export const getEvmSmartAccountsMock = () => [
|
|
|
350
435
|
getCreateEvmSmartAccountMockHandler(),
|
|
351
436
|
getGetEvmSmartAccountByNameMockHandler(),
|
|
352
437
|
getGetEvmSmartAccountMockHandler(),
|
|
438
|
+
getUpdateEvmSmartAccountMockHandler(),
|
|
353
439
|
getPrepareUserOperationMockHandler(),
|
|
354
440
|
getGetUserOperationMockHandler(),
|
|
355
441
|
getSendUserOperationMockHandler(),
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
ListEvmSmartAccountsParams,
|
|
14
14
|
PrepareUserOperationBody,
|
|
15
15
|
SendUserOperationBody,
|
|
16
|
+
UpdateEvmSmartAccountBody,
|
|
16
17
|
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
17
18
|
|
|
18
19
|
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
@@ -77,6 +78,25 @@ export const getEvmSmartAccount = (
|
|
|
77
78
|
options,
|
|
78
79
|
);
|
|
79
80
|
};
|
|
81
|
+
/**
|
|
82
|
+
* Updates an existing EVM smart account. Use this to update the smart account's name.
|
|
83
|
+
* @summary Update an EVM Smart Account
|
|
84
|
+
*/
|
|
85
|
+
export const updateEvmSmartAccount = (
|
|
86
|
+
address: string,
|
|
87
|
+
updateEvmSmartAccountBody: UpdateEvmSmartAccountBody,
|
|
88
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
89
|
+
) => {
|
|
90
|
+
return cdpApiClient<EvmSmartAccount>(
|
|
91
|
+
{
|
|
92
|
+
url: `/v2/evm/smart-accounts/${address}`,
|
|
93
|
+
method: "PUT",
|
|
94
|
+
headers: { "Content-Type": "application/json" },
|
|
95
|
+
data: updateEvmSmartAccountBody,
|
|
96
|
+
},
|
|
97
|
+
options,
|
|
98
|
+
);
|
|
99
|
+
};
|
|
80
100
|
/**
|
|
81
101
|
* Prepares a new user operation on a Smart Account for a specific network.
|
|
82
102
|
* @summary Prepare a user operation
|
|
@@ -143,6 +163,9 @@ export type GetEvmSmartAccountByNameResult = NonNullable<
|
|
|
143
163
|
Awaited<ReturnType<typeof getEvmSmartAccountByName>>
|
|
144
164
|
>;
|
|
145
165
|
export type GetEvmSmartAccountResult = NonNullable<Awaited<ReturnType<typeof getEvmSmartAccount>>>;
|
|
166
|
+
export type UpdateEvmSmartAccountResult = NonNullable<
|
|
167
|
+
Awaited<ReturnType<typeof updateEvmSmartAccount>>
|
|
168
|
+
>;
|
|
146
169
|
export type PrepareUserOperationResult = NonNullable<
|
|
147
170
|
Awaited<ReturnType<typeof prepareUserOperation>>
|
|
148
171
|
>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
2
|
-
export * from "./faucets/faucets.msw.js";
|
|
3
1
|
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
2
|
+
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
4
3
|
export * from "./evm-swaps/evm-swaps.msw.js";
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
4
|
+
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
5
|
+
export * from "./faucets/faucets.msw.js";
|
|
7
6
|
export * from "./payments-alpha/payments-alpha.msw.js";
|
|
8
|
-
export * from "./
|
|
7
|
+
export * from "./policy-engine/policy-engine.msw.js";
|
|
8
|
+
export * from "./solana-accounts/solana-accounts.msw.js";
|