@coinbase/cdp-sdk 1.32.0 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +9 -7
- package/_cjs/accounts/evm/toEvmServerAccount.js +1 -1
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +2 -2
- package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +2 -2
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_cjs/actions/evm/listSpendPermissions.js +19 -1
- package/_cjs/actions/evm/listSpendPermissions.js.map +1 -1
- package/_cjs/actions/evm/spend-permissions/resolveSpendPermission.js +64 -0
- package/_cjs/actions/evm/spend-permissions/resolveSpendPermission.js.map +1 -0
- package/_cjs/client/evm/evm.js +12 -11
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/index.js.map +1 -1
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +57 -2
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +79 -20
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.js +1 -2
- package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.js.map +1 -1
- package/_cjs/openapi-client/generated/index.msw.js +1 -0
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -1
- package/_cjs/openapi-client/generated/onchain-data/onchain-data.js +63 -0
- package/_cjs/openapi-client/generated/onchain-data/onchain-data.js.map +1 -0
- package/_cjs/openapi-client/generated/onchain-data/onchain-data.msw.js +139 -0
- package/_cjs/openapi-client/generated/onchain-data/onchain-data.msw.js.map +1 -0
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js +94 -6
- package/_cjs/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_cjs/openapi-client/index.js +1 -0
- package/_cjs/openapi-client/index.js.map +1 -1
- package/_cjs/policies/evmSchema.js +18 -1
- package/_cjs/policies/evmSchema.js.map +1 -1
- package/_cjs/spend-permissions/utils.js +26 -0
- package/_cjs/spend-permissions/utils.js.map +1 -0
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +2 -2
- package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +2 -2
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_esm/actions/evm/listSpendPermissions.js +19 -1
- package/_esm/actions/evm/listSpendPermissions.js.map +1 -1
- package/_esm/actions/evm/spend-permissions/resolveSpendPermission.js +61 -0
- package/_esm/actions/evm/spend-permissions/resolveSpendPermission.js.map +1 -0
- package/_esm/client/evm/evm.js +13 -12
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/index.js.map +1 -1
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +55 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -1
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +79 -20
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -1
- package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.js +1 -2
- package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.js.map +1 -1
- package/_esm/openapi-client/generated/index.msw.js +1 -0
- package/_esm/openapi-client/generated/index.msw.js.map +1 -1
- package/_esm/openapi-client/generated/onchain-data/onchain-data.js +57 -0
- package/_esm/openapi-client/generated/onchain-data/onchain-data.js.map +1 -0
- package/_esm/openapi-client/generated/onchain-data/onchain-data.msw.js +129 -0
- package/_esm/openapi-client/generated/onchain-data/onchain-data.msw.js.map +1 -0
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js +88 -4
- package/_esm/openapi-client/generated/policy-engine/policy-engine.msw.js.map +1 -1
- package/_esm/openapi-client/index.js +1 -0
- package/_esm/openapi-client/index.js.map +1 -1
- package/_esm/policies/evmSchema.js +17 -0
- package/_esm/policies/evmSchema.js.map +1 -1
- package/_esm/spend-permissions/utils.js +23 -0
- package/_esm/spend-permissions/utils.js.map +1 -0
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/types.d.ts +5 -5
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/actions/evm/listSpendPermissions.d.ts +10 -2
- package/_types/actions/evm/listSpendPermissions.d.ts.map +1 -1
- package/_types/actions/evm/spend-permissions/resolveSpendPermission.d.ts +12 -0
- package/_types/actions/evm/spend-permissions/resolveSpendPermission.d.ts.map +1 -0
- package/_types/actions/evm/spend-permissions/types.d.ts +3 -2
- package/_types/actions/evm/spend-permissions/types.d.ts.map +1 -1
- package/_types/actions/evm/types.d.ts +4 -8
- package/_types/actions/evm/types.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts +3 -2
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +7 -44
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/index.d.ts +2 -1
- package/_types/index.d.ts.map +1 -1
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +198 -22
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.d.ts +1 -2
- package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.d.ts.map +1 -1
- package/_types/openapi-client/generated/index.msw.d.ts +1 -0
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -1
- package/_types/openapi-client/generated/onchain-data/onchain-data.d.ts +59 -0
- package/_types/openapi-client/generated/onchain-data/onchain-data.d.ts.map +1 -0
- package/_types/openapi-client/generated/onchain-data/onchain-data.msw.d.ts +10 -0
- package/_types/openapi-client/generated/onchain-data/onchain-data.msw.d.ts.map +1 -0
- 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/index.d.ts +1 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/evmSchema.d.ts +170 -18
- package/_types/policies/evmSchema.d.ts.map +1 -1
- package/_types/policies/types.d.ts +152 -0
- package/_types/policies/types.d.ts.map +1 -1
- package/_types/spend-permissions/types.d.ts +40 -5
- package/_types/spend-permissions/types.d.ts.map +1 -1
- package/_types/spend-permissions/utils.d.ts +12 -0
- package/_types/spend-permissions/utils.d.ts.map +1 -0
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmServerAccount.ts +1 -3
- package/accounts/evm/toEvmSmartAccount.ts +1 -1
- package/accounts/evm/toNetworkScopedEvmServerAccount.ts +4 -4
- package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +4 -4
- package/accounts/evm/types.ts +5 -5
- package/actions/evm/listSpendPermissions.ts +42 -3
- package/actions/evm/spend-permissions/resolveSpendPermission.ts +85 -0
- package/actions/evm/spend-permissions/types.ts +3 -2
- package/actions/evm/types.ts +4 -12
- package/client/evm/evm.ts +25 -16
- package/client/evm/evm.types.ts +6 -48
- package/index.ts +2 -1
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +227 -22
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +79 -20
- package/openapi-client/generated/evm-token-balances/evm-token-balances.ts +1 -2
- package/openapi-client/generated/index.msw.ts +1 -0
- package/openapi-client/generated/onchain-data/onchain-data.msw.ts +185 -0
- package/openapi-client/generated/onchain-data/onchain-data.ts +103 -0
- package/openapi-client/generated/policy-engine/policy-engine.msw.ts +101 -4
- package/openapi-client/index.ts +1 -0
- package/package.json +1 -1
- package/policies/evmSchema.ts +19 -0
- package/spend-permissions/types.ts +46 -16
- package/spend-permissions/utils.ts +35 -0
- package/version.ts +1 -1
|
@@ -45,6 +45,7 @@ export const ErrorType = {
|
|
|
45
45
|
idempotency_error: "idempotency_error",
|
|
46
46
|
internal_server_error: "internal_server_error",
|
|
47
47
|
invalid_request: "invalid_request",
|
|
48
|
+
invalid_sql_query: "invalid_sql_query",
|
|
48
49
|
invalid_signature: "invalid_signature",
|
|
49
50
|
malformed_transaction: "malformed_transaction",
|
|
50
51
|
not_found: "not_found",
|
|
@@ -202,6 +203,20 @@ export interface UserOperationReceiptRevert {
|
|
|
202
203
|
*/
|
|
203
204
|
export interface UserOperationReceipt {
|
|
204
205
|
revert?: UserOperationReceiptRevert;
|
|
206
|
+
/**
|
|
207
|
+
* The hash of this transaction as 0x-prefixed string.
|
|
208
|
+
* @pattern ^0x[a-fA-F0-9]{64}$
|
|
209
|
+
*/
|
|
210
|
+
transactionHash?: string;
|
|
211
|
+
/**
|
|
212
|
+
* The block hash of the block including the transaction as 0x-prefixed string.
|
|
213
|
+
* @pattern ^0x[0-9a-fA-F]{64}$|^$
|
|
214
|
+
*/
|
|
215
|
+
blockHash?: string;
|
|
216
|
+
/** The block height (number) of the block including the transaction. */
|
|
217
|
+
blockNumber?: number;
|
|
218
|
+
/** The gas used for landing this user operation. */
|
|
219
|
+
gasUsed?: string;
|
|
205
220
|
}
|
|
206
221
|
|
|
207
222
|
/**
|
|
@@ -240,21 +255,33 @@ export interface EvmUserOperation {
|
|
|
240
255
|
receipts?: UserOperationReceipt[];
|
|
241
256
|
}
|
|
242
257
|
|
|
258
|
+
/**
|
|
259
|
+
* The network the spend permission is on.
|
|
260
|
+
*/
|
|
261
|
+
export type SpendPermissionNetwork =
|
|
262
|
+
(typeof SpendPermissionNetwork)[keyof typeof SpendPermissionNetwork];
|
|
263
|
+
|
|
264
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
265
|
+
export const SpendPermissionNetwork = {
|
|
266
|
+
base: "base",
|
|
267
|
+
"base-sepolia": "base-sepolia",
|
|
268
|
+
ethereum: "ethereum",
|
|
269
|
+
"ethereum-sepolia": "ethereum-sepolia",
|
|
270
|
+
optimism: "optimism",
|
|
271
|
+
arbitrum: "arbitrum",
|
|
272
|
+
avalanche: "avalanche",
|
|
273
|
+
polygon: "polygon",
|
|
274
|
+
} as const;
|
|
275
|
+
|
|
243
276
|
export interface CreateSpendPermissionRequest {
|
|
244
|
-
|
|
245
|
-
network: string;
|
|
246
|
-
/**
|
|
247
|
-
* Smart account this spend permission is valid for.
|
|
248
|
-
* @pattern ^0x[a-fA-F0-9]{40}$
|
|
249
|
-
*/
|
|
250
|
-
account: string;
|
|
277
|
+
network: SpendPermissionNetwork;
|
|
251
278
|
/**
|
|
252
|
-
* Entity that can spend account's tokens.
|
|
279
|
+
* Entity that can spend account's tokens. Can be either a Smart Account or an EOA.
|
|
253
280
|
* @pattern ^0x[a-fA-F0-9]{40}$
|
|
254
281
|
*/
|
|
255
282
|
spender: string;
|
|
256
283
|
/**
|
|
257
|
-
*
|
|
284
|
+
* ERC-7528 native token address (e.g. "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE" for native ETH), or an ERC-20 contract address.
|
|
258
285
|
* @pattern ^0x[a-fA-F0-9]{40}$
|
|
259
286
|
*/
|
|
260
287
|
token: string;
|
|
@@ -296,32 +323,31 @@ export interface SpendPermission {
|
|
|
296
323
|
/** Maximum allowed value to spend, in atomic units for the specified token, within each period. */
|
|
297
324
|
allowance: string;
|
|
298
325
|
/** Time duration for resetting used allowance on a recurring basis (seconds). */
|
|
299
|
-
period
|
|
326
|
+
period: string;
|
|
300
327
|
/** The start time for this spend permission, in Unix seconds. */
|
|
301
|
-
start
|
|
328
|
+
start: string;
|
|
302
329
|
/** The expiration time for this spend permission, in Unix seconds. */
|
|
303
|
-
end
|
|
330
|
+
end: string;
|
|
304
331
|
/** An arbitrary salt to differentiate unique spend permissions with otherwise identical data. */
|
|
305
|
-
salt
|
|
332
|
+
salt: string;
|
|
306
333
|
/** Arbitrary data to include in the permission. */
|
|
307
|
-
extraData
|
|
334
|
+
extraData: string;
|
|
308
335
|
}
|
|
309
336
|
|
|
310
337
|
export interface SpendPermissionResponseObject {
|
|
311
|
-
permission
|
|
338
|
+
permission: SpendPermission;
|
|
312
339
|
/** Unique hash identifier for this permission. */
|
|
313
|
-
permissionHash
|
|
340
|
+
permissionHash: string;
|
|
314
341
|
/** Whether this permission has been revoked. */
|
|
315
|
-
revoked
|
|
342
|
+
revoked: boolean;
|
|
316
343
|
/** The UTC ISO 8601 timestamp when the permission was revoked (if applicable). */
|
|
317
344
|
revokedAt?: string;
|
|
318
345
|
/** The UTC ISO 8601 timestamp when the permission was created. */
|
|
319
|
-
createdAt
|
|
346
|
+
createdAt: string;
|
|
320
347
|
}
|
|
321
348
|
|
|
322
349
|
export interface RevokeSpendPermissionRequest {
|
|
323
|
-
|
|
324
|
-
network: string;
|
|
350
|
+
network: SpendPermissionNetwork;
|
|
325
351
|
/** The hash of the spend permission to revoke. */
|
|
326
352
|
permissionHash: string;
|
|
327
353
|
/** The paymaster URL of the spend permission. */
|
|
@@ -931,10 +957,49 @@ export interface EvmDataCriterion {
|
|
|
931
957
|
conditions: EvmDataCondition[];
|
|
932
958
|
}
|
|
933
959
|
|
|
960
|
+
/**
|
|
961
|
+
* The type of criterion to use. This should be `netUSDChange`.
|
|
962
|
+
*/
|
|
963
|
+
export type NetUSDChangeCriterionType =
|
|
964
|
+
(typeof NetUSDChangeCriterionType)[keyof typeof NetUSDChangeCriterionType];
|
|
965
|
+
|
|
966
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
967
|
+
export const NetUSDChangeCriterionType = {
|
|
968
|
+
netUSDChange: "netUSDChange",
|
|
969
|
+
} as const;
|
|
970
|
+
|
|
971
|
+
/**
|
|
972
|
+
* The operator to use for the comparison. The total value of a transaction's asset transfer will be on the left-hand side of the operator, and the `changeCents` field will be on the right-hand side.
|
|
973
|
+
*/
|
|
974
|
+
export type NetUSDChangeCriterionOperator =
|
|
975
|
+
(typeof NetUSDChangeCriterionOperator)[keyof typeof NetUSDChangeCriterionOperator];
|
|
976
|
+
|
|
977
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
978
|
+
export const NetUSDChangeCriterionOperator = {
|
|
979
|
+
">": ">",
|
|
980
|
+
">=": ">=",
|
|
981
|
+
"<": "<",
|
|
982
|
+
"<=": "<=",
|
|
983
|
+
"==": "==",
|
|
984
|
+
} as const;
|
|
985
|
+
|
|
986
|
+
/**
|
|
987
|
+
* A schema for specifying a criterion for the USD denominated asset transfer or exposure for a transaction. This includes native transfers, as well as token transfers.
|
|
988
|
+
*/
|
|
989
|
+
export interface NetUSDChangeCriterion {
|
|
990
|
+
/** The type of criterion to use. This should be `netUSDChange`. */
|
|
991
|
+
type: NetUSDChangeCriterionType;
|
|
992
|
+
/** The amount of USD, in cents, that the total value of a transaction's asset transfer should be compared to. */
|
|
993
|
+
changeCents: number;
|
|
994
|
+
/** The operator to use for the comparison. The total value of a transaction's asset transfer will be on the left-hand side of the operator, and the `changeCents` field will be on the right-hand side. */
|
|
995
|
+
operator: NetUSDChangeCriterionOperator;
|
|
996
|
+
}
|
|
997
|
+
|
|
934
998
|
export type SignEvmTransactionCriteriaItem =
|
|
935
999
|
| EthValueCriterion
|
|
936
1000
|
| EvmAddressCriterion
|
|
937
|
-
| EvmDataCriterion
|
|
1001
|
+
| EvmDataCriterion
|
|
1002
|
+
| NetUSDChangeCriterion;
|
|
938
1003
|
|
|
939
1004
|
/**
|
|
940
1005
|
* A schema for specifying criteria for the SignEvmTransaction operation.
|
|
@@ -993,6 +1058,14 @@ export type EvmNetworkCriterionNetworksItem =
|
|
|
993
1058
|
export const EvmNetworkCriterionNetworksItem = {
|
|
994
1059
|
"base-sepolia": "base-sepolia",
|
|
995
1060
|
base: "base",
|
|
1061
|
+
ethereum: "ethereum",
|
|
1062
|
+
"ethereum-sepolia": "ethereum-sepolia",
|
|
1063
|
+
avalanche: "avalanche",
|
|
1064
|
+
polygon: "polygon",
|
|
1065
|
+
optimism: "optimism",
|
|
1066
|
+
arbitrum: "arbitrum",
|
|
1067
|
+
zora: "zora",
|
|
1068
|
+
bnb: "bnb",
|
|
996
1069
|
} as const;
|
|
997
1070
|
|
|
998
1071
|
/**
|
|
@@ -1023,7 +1096,8 @@ export type SendEvmTransactionCriteriaItem =
|
|
|
1023
1096
|
| EthValueCriterion
|
|
1024
1097
|
| EvmAddressCriterion
|
|
1025
1098
|
| EvmNetworkCriterion
|
|
1026
|
-
| EvmDataCriterion
|
|
1099
|
+
| EvmDataCriterion
|
|
1100
|
+
| NetUSDChangeCriterion;
|
|
1027
1101
|
|
|
1028
1102
|
/**
|
|
1029
1103
|
* A schema for specifying criteria for the SignEvmTransaction operation.
|
|
@@ -1807,6 +1881,109 @@ export interface SolanaTokenBalance {
|
|
|
1807
1881
|
token: SolanaToken;
|
|
1808
1882
|
}
|
|
1809
1883
|
|
|
1884
|
+
/**
|
|
1885
|
+
* Request to execute a SQL query against indexed blockchain data.
|
|
1886
|
+
*/
|
|
1887
|
+
export interface OnchainDataQuery {
|
|
1888
|
+
/**
|
|
1889
|
+
* SQL query to execute against the indexed blockchain data.
|
|
1890
|
+
* @minLength 1
|
|
1891
|
+
* @maxLength 10000
|
|
1892
|
+
*/
|
|
1893
|
+
sql: string;
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/**
|
|
1897
|
+
* Row data with column names as keys.
|
|
1898
|
+
*/
|
|
1899
|
+
export type OnchainDataResultResultItem = { [key: string]: unknown };
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* Column data type (ClickHouse types).
|
|
1903
|
+
*/
|
|
1904
|
+
export type OnchainDataResultSchemaColumnsItemType =
|
|
1905
|
+
(typeof OnchainDataResultSchemaColumnsItemType)[keyof typeof OnchainDataResultSchemaColumnsItemType];
|
|
1906
|
+
|
|
1907
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
1908
|
+
export const OnchainDataResultSchemaColumnsItemType = {
|
|
1909
|
+
String: "String",
|
|
1910
|
+
UInt8: "UInt8",
|
|
1911
|
+
UInt16: "UInt16",
|
|
1912
|
+
UInt32: "UInt32",
|
|
1913
|
+
UInt64: "UInt64",
|
|
1914
|
+
UInt128: "UInt128",
|
|
1915
|
+
UInt256: "UInt256",
|
|
1916
|
+
Int8: "Int8",
|
|
1917
|
+
Int16: "Int16",
|
|
1918
|
+
Int32: "Int32",
|
|
1919
|
+
Int64: "Int64",
|
|
1920
|
+
Int128: "Int128",
|
|
1921
|
+
Int256: "Int256",
|
|
1922
|
+
Float32: "Float32",
|
|
1923
|
+
Float64: "Float64",
|
|
1924
|
+
Bool: "Bool",
|
|
1925
|
+
Date: "Date",
|
|
1926
|
+
DateTime: "DateTime",
|
|
1927
|
+
DateTime64: "DateTime64",
|
|
1928
|
+
UUID: "UUID",
|
|
1929
|
+
} as const;
|
|
1930
|
+
|
|
1931
|
+
export type OnchainDataResultSchemaColumnsItem = {
|
|
1932
|
+
/** Column name. */
|
|
1933
|
+
name?: string;
|
|
1934
|
+
/** Column data type (ClickHouse types). */
|
|
1935
|
+
type?: OnchainDataResultSchemaColumnsItemType;
|
|
1936
|
+
};
|
|
1937
|
+
|
|
1938
|
+
/**
|
|
1939
|
+
* Schema information for the query result. This is a derived schema from the query result, so types may not match the underlying table.
|
|
1940
|
+
|
|
1941
|
+
*/
|
|
1942
|
+
export type OnchainDataResultSchema = {
|
|
1943
|
+
/** Column definitions. */
|
|
1944
|
+
columns?: OnchainDataResultSchemaColumnsItem[];
|
|
1945
|
+
};
|
|
1946
|
+
|
|
1947
|
+
/**
|
|
1948
|
+
* Metadata about query execution.
|
|
1949
|
+
*/
|
|
1950
|
+
export type OnchainDataResultMetadata = {
|
|
1951
|
+
/** Whether the result was served from cache. */
|
|
1952
|
+
cached?: boolean;
|
|
1953
|
+
/** Query execution time in milliseconds. */
|
|
1954
|
+
executionTimeMs?: number;
|
|
1955
|
+
/** Number of rows returned. */
|
|
1956
|
+
rowCount?: number;
|
|
1957
|
+
};
|
|
1958
|
+
|
|
1959
|
+
/**
|
|
1960
|
+
* Result of executing a SQL query.
|
|
1961
|
+
*/
|
|
1962
|
+
export interface OnchainDataResult {
|
|
1963
|
+
/** Query result as an array of objects representing rows. */
|
|
1964
|
+
result?: OnchainDataResultResultItem[];
|
|
1965
|
+
/** Schema information for the query result. This is a derived schema from the query result, so types may not match the underlying table.
|
|
1966
|
+
*/
|
|
1967
|
+
schema?: OnchainDataResultSchema;
|
|
1968
|
+
/** Metadata about query execution. */
|
|
1969
|
+
metadata?: OnchainDataResultMetadata;
|
|
1970
|
+
}
|
|
1971
|
+
|
|
1972
|
+
/**
|
|
1973
|
+
* Response containing token addresses that an account has received.
|
|
1974
|
+
*/
|
|
1975
|
+
export interface AccountTokenAddressesResponse {
|
|
1976
|
+
/** The account address that was queried. */
|
|
1977
|
+
accountAddress?: string;
|
|
1978
|
+
/** List of token contract addresses that the account has received. */
|
|
1979
|
+
tokenAddresses?: string[];
|
|
1980
|
+
/**
|
|
1981
|
+
* Total number of unique token addresses discovered.
|
|
1982
|
+
* @minimum 0
|
|
1983
|
+
*/
|
|
1984
|
+
totalCount?: number;
|
|
1985
|
+
}
|
|
1986
|
+
|
|
1810
1987
|
/**
|
|
1811
1988
|
* The action of the payment method.
|
|
1812
1989
|
*/
|
|
@@ -2171,11 +2348,21 @@ export type IdempotencyErrorResponse = Error;
|
|
|
2171
2348
|
*/
|
|
2172
2349
|
export type AlreadyExistsErrorResponse = Error;
|
|
2173
2350
|
|
|
2351
|
+
/**
|
|
2352
|
+
* The underlying SQL string is invalid.
|
|
2353
|
+
*/
|
|
2354
|
+
export type InvalidSQLQueryErrorResponse = Error;
|
|
2355
|
+
|
|
2174
2356
|
/**
|
|
2175
2357
|
* Unauthorized.
|
|
2176
2358
|
*/
|
|
2177
2359
|
export type UnauthorizedErrorResponse = Error;
|
|
2178
2360
|
|
|
2361
|
+
/**
|
|
2362
|
+
* The request timed out.
|
|
2363
|
+
*/
|
|
2364
|
+
export type TimedOutErrorResponse = Error;
|
|
2365
|
+
|
|
2179
2366
|
/**
|
|
2180
2367
|
* Rate limit exceeded.
|
|
2181
2368
|
*/
|
|
@@ -2766,6 +2953,24 @@ export type ListSolanaTokenBalances200AllOf = {
|
|
|
2766
2953
|
|
|
2767
2954
|
export type ListSolanaTokenBalances200 = ListSolanaTokenBalances200AllOf & ListResponse;
|
|
2768
2955
|
|
|
2956
|
+
export type ListDataTokenBalancesParams = {
|
|
2957
|
+
/**
|
|
2958
|
+
* The number of balances to return per page.
|
|
2959
|
+
*/
|
|
2960
|
+
pageSize?: number;
|
|
2961
|
+
/**
|
|
2962
|
+
* The token for the next page of balances. Will be empty if there are no more balances to fetch.
|
|
2963
|
+
*/
|
|
2964
|
+
pageToken?: string;
|
|
2965
|
+
};
|
|
2966
|
+
|
|
2967
|
+
export type ListDataTokenBalances200AllOf = {
|
|
2968
|
+
/** The list of EVM token balances. */
|
|
2969
|
+
balances: TokenBalance[];
|
|
2970
|
+
};
|
|
2971
|
+
|
|
2972
|
+
export type ListDataTokenBalances200 = ListDataTokenBalances200AllOf & ListResponse;
|
|
2973
|
+
|
|
2769
2974
|
export type GetCryptoRailsParams = {
|
|
2770
2975
|
/**
|
|
2771
2976
|
* Comma separated list of networks to filter the rails by.
|
|
@@ -199,6 +199,19 @@ export const getPrepareUserOperationResponseMock = (
|
|
|
199
199
|
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
200
200
|
undefined,
|
|
201
201
|
]),
|
|
202
|
+
transactionHash: faker.helpers.arrayElement([
|
|
203
|
+
faker.helpers.fromRegExp("^0x[a-fA-F0-9]{64}$"),
|
|
204
|
+
undefined,
|
|
205
|
+
]),
|
|
206
|
+
blockHash: faker.helpers.arrayElement([
|
|
207
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
208
|
+
undefined,
|
|
209
|
+
]),
|
|
210
|
+
blockNumber: faker.helpers.arrayElement([
|
|
211
|
+
faker.number.int({ min: undefined, max: undefined }),
|
|
212
|
+
undefined,
|
|
213
|
+
]),
|
|
214
|
+
gasUsed: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
202
215
|
})),
|
|
203
216
|
undefined,
|
|
204
217
|
]),
|
|
@@ -233,6 +246,19 @@ export const getGetUserOperationResponseMock = (
|
|
|
233
246
|
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
234
247
|
undefined,
|
|
235
248
|
]),
|
|
249
|
+
transactionHash: faker.helpers.arrayElement([
|
|
250
|
+
faker.helpers.fromRegExp("^0x[a-fA-F0-9]{64}$"),
|
|
251
|
+
undefined,
|
|
252
|
+
]),
|
|
253
|
+
blockHash: faker.helpers.arrayElement([
|
|
254
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
255
|
+
undefined,
|
|
256
|
+
]),
|
|
257
|
+
blockNumber: faker.helpers.arrayElement([
|
|
258
|
+
faker.number.int({ min: undefined, max: undefined }),
|
|
259
|
+
undefined,
|
|
260
|
+
]),
|
|
261
|
+
gasUsed: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
236
262
|
})),
|
|
237
263
|
undefined,
|
|
238
264
|
]),
|
|
@@ -267,6 +293,19 @@ export const getSendUserOperationResponseMock = (
|
|
|
267
293
|
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
268
294
|
undefined,
|
|
269
295
|
]),
|
|
296
|
+
transactionHash: faker.helpers.arrayElement([
|
|
297
|
+
faker.helpers.fromRegExp("^0x[a-fA-F0-9]{64}$"),
|
|
298
|
+
undefined,
|
|
299
|
+
]),
|
|
300
|
+
blockHash: faker.helpers.arrayElement([
|
|
301
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
302
|
+
undefined,
|
|
303
|
+
]),
|
|
304
|
+
blockNumber: faker.helpers.arrayElement([
|
|
305
|
+
faker.number.int({ min: undefined, max: undefined }),
|
|
306
|
+
undefined,
|
|
307
|
+
]),
|
|
308
|
+
gasUsed: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
270
309
|
})),
|
|
271
310
|
undefined,
|
|
272
311
|
]),
|
|
@@ -301,6 +340,19 @@ export const getCreateSpendPermissionResponseMock = (
|
|
|
301
340
|
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
302
341
|
undefined,
|
|
303
342
|
]),
|
|
343
|
+
transactionHash: faker.helpers.arrayElement([
|
|
344
|
+
faker.helpers.fromRegExp("^0x[a-fA-F0-9]{64}$"),
|
|
345
|
+
undefined,
|
|
346
|
+
]),
|
|
347
|
+
blockHash: faker.helpers.arrayElement([
|
|
348
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
349
|
+
undefined,
|
|
350
|
+
]),
|
|
351
|
+
blockNumber: faker.helpers.arrayElement([
|
|
352
|
+
faker.number.int({ min: undefined, max: undefined }),
|
|
353
|
+
undefined,
|
|
354
|
+
]),
|
|
355
|
+
gasUsed: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
304
356
|
})),
|
|
305
357
|
undefined,
|
|
306
358
|
]),
|
|
@@ -313,30 +365,24 @@ export const getListSpendPermissionsResponseMock = (): ListSpendPermissions200 =
|
|
|
313
365
|
{ length: faker.number.int({ min: 1, max: 10 }) },
|
|
314
366
|
(_, i) => i + 1,
|
|
315
367
|
).map(() => ({
|
|
316
|
-
permission:
|
|
317
|
-
{
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
]),
|
|
330
|
-
permissionHash: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
331
|
-
revoked: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
|
|
368
|
+
permission: {
|
|
369
|
+
account: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}$"),
|
|
370
|
+
spender: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}$"),
|
|
371
|
+
token: faker.helpers.fromRegExp("^0x[a-fA-F0-9]{40}$"),
|
|
372
|
+
allowance: faker.string.alpha(20),
|
|
373
|
+
period: faker.string.alpha(20),
|
|
374
|
+
start: faker.string.alpha(20),
|
|
375
|
+
end: faker.string.alpha(20),
|
|
376
|
+
salt: faker.string.alpha(20),
|
|
377
|
+
extraData: faker.string.alpha(20),
|
|
378
|
+
},
|
|
379
|
+
permissionHash: faker.string.alpha(20),
|
|
380
|
+
revoked: faker.datatype.boolean(),
|
|
332
381
|
revokedAt: faker.helpers.arrayElement([
|
|
333
382
|
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
334
383
|
undefined,
|
|
335
384
|
]),
|
|
336
|
-
createdAt: faker.
|
|
337
|
-
`${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
338
|
-
undefined,
|
|
339
|
-
]),
|
|
385
|
+
createdAt: `${faker.date.past().toISOString().split(".")[0]}Z`,
|
|
340
386
|
})),
|
|
341
387
|
},
|
|
342
388
|
...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) },
|
|
@@ -370,6 +416,19 @@ export const getRevokeSpendPermissionResponseMock = (
|
|
|
370
416
|
{ data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"), message: faker.string.alpha(20) },
|
|
371
417
|
undefined,
|
|
372
418
|
]),
|
|
419
|
+
transactionHash: faker.helpers.arrayElement([
|
|
420
|
+
faker.helpers.fromRegExp("^0x[a-fA-F0-9]{64}$"),
|
|
421
|
+
undefined,
|
|
422
|
+
]),
|
|
423
|
+
blockHash: faker.helpers.arrayElement([
|
|
424
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
425
|
+
undefined,
|
|
426
|
+
]),
|
|
427
|
+
blockNumber: faker.helpers.arrayElement([
|
|
428
|
+
faker.number.int({ min: undefined, max: undefined }),
|
|
429
|
+
undefined,
|
|
430
|
+
]),
|
|
431
|
+
gasUsed: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
373
432
|
})),
|
|
374
433
|
undefined,
|
|
375
434
|
]),
|
|
@@ -17,8 +17,7 @@ type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Lists the token balances of an EVM address on a given network. The balances include ERC-20 tokens and the native gas token (usually ETH). The response is paginated, and by default, returns 20 balances per page.
|
|
20
|
-
|
|
21
|
-
**Note:** This endpoint is still under development and does not yet provide strong freshness guarantees. Specifically, balances of new tokens can, on occasion, take up to ~30 seconds to appear, while balances of tokens already belonging to an address will generally be close to chain tip. Freshness of new token balances will improve over the coming weeks.
|
|
20
|
+
**Note:** This endpoint is still under development and does not yet provide strong freshness guarantees. Specifically, balances of new tokens can, on occasion, take up to ~30 seconds to appear, while balances of tokens already belonging to an address will generally be close to chain tip. Freshness of new token balances will improve over the coming weeks.
|
|
22
21
|
* @summary List EVM token balances
|
|
23
22
|
*/
|
|
24
23
|
export const listEvmTokenBalances = (
|
|
@@ -3,6 +3,7 @@ export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
|
3
3
|
export * from "./evm-swaps/evm-swaps.msw.js";
|
|
4
4
|
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
5
5
|
export * from "./faucets/faucets.msw.js";
|
|
6
|
+
export * from "./onchain-data/onchain-data.msw.js";
|
|
6
7
|
export * from "./onramp/onramp.msw.js";
|
|
7
8
|
export * from "./payments-alpha/payments-alpha.msw.js";
|
|
8
9
|
export * from "./policy-engine/policy-engine.msw.js";
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import { faker } from "@faker-js/faker";
|
|
9
|
+
|
|
10
|
+
import { HttpResponse, delay, http } from "msw";
|
|
11
|
+
|
|
12
|
+
import { ListEvmTokenBalancesNetwork } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
13
|
+
import type {
|
|
14
|
+
AccountTokenAddressesResponse,
|
|
15
|
+
ListDataTokenBalances200,
|
|
16
|
+
OnchainDataResult,
|
|
17
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
18
|
+
|
|
19
|
+
export const getRunSQLQueryResponseMock = (
|
|
20
|
+
overrideResponse: Partial<OnchainDataResult> = {},
|
|
21
|
+
): OnchainDataResult => ({
|
|
22
|
+
result: faker.helpers.arrayElement([
|
|
23
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({})),
|
|
24
|
+
undefined,
|
|
25
|
+
]),
|
|
26
|
+
schema: faker.helpers.arrayElement([
|
|
27
|
+
{
|
|
28
|
+
columns: faker.helpers.arrayElement([
|
|
29
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
30
|
+
name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
31
|
+
type: faker.helpers.arrayElement([
|
|
32
|
+
faker.helpers.arrayElement([
|
|
33
|
+
"String",
|
|
34
|
+
"UInt8",
|
|
35
|
+
"UInt16",
|
|
36
|
+
"UInt32",
|
|
37
|
+
"UInt64",
|
|
38
|
+
"UInt128",
|
|
39
|
+
"UInt256",
|
|
40
|
+
"Int8",
|
|
41
|
+
"Int16",
|
|
42
|
+
"Int32",
|
|
43
|
+
"Int64",
|
|
44
|
+
"Int128",
|
|
45
|
+
"Int256",
|
|
46
|
+
"Float32",
|
|
47
|
+
"Float64",
|
|
48
|
+
"Bool",
|
|
49
|
+
"Date",
|
|
50
|
+
"DateTime",
|
|
51
|
+
"DateTime64",
|
|
52
|
+
"UUID",
|
|
53
|
+
] as const),
|
|
54
|
+
undefined,
|
|
55
|
+
]),
|
|
56
|
+
})),
|
|
57
|
+
undefined,
|
|
58
|
+
]),
|
|
59
|
+
},
|
|
60
|
+
undefined,
|
|
61
|
+
]),
|
|
62
|
+
metadata: faker.helpers.arrayElement([
|
|
63
|
+
{
|
|
64
|
+
cached: faker.helpers.arrayElement([faker.datatype.boolean(), undefined]),
|
|
65
|
+
executionTimeMs: faker.helpers.arrayElement([
|
|
66
|
+
faker.number.int({ min: undefined, max: undefined }),
|
|
67
|
+
undefined,
|
|
68
|
+
]),
|
|
69
|
+
rowCount: faker.helpers.arrayElement([
|
|
70
|
+
faker.number.int({ min: undefined, max: undefined }),
|
|
71
|
+
undefined,
|
|
72
|
+
]),
|
|
73
|
+
},
|
|
74
|
+
undefined,
|
|
75
|
+
]),
|
|
76
|
+
...overrideResponse,
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const getListTokensForAccountResponseMock = (
|
|
80
|
+
overrideResponse: Partial<AccountTokenAddressesResponse> = {},
|
|
81
|
+
): AccountTokenAddressesResponse => ({
|
|
82
|
+
accountAddress: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
83
|
+
tokenAddresses: faker.helpers.arrayElement([
|
|
84
|
+
Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
85
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
86
|
+
),
|
|
87
|
+
undefined,
|
|
88
|
+
]),
|
|
89
|
+
totalCount: faker.helpers.arrayElement([faker.number.int({ min: 0, max: undefined }), undefined]),
|
|
90
|
+
...overrideResponse,
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const getListDataTokenBalancesResponseMock = (): ListDataTokenBalances200 => ({
|
|
94
|
+
...{
|
|
95
|
+
balances: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
|
|
96
|
+
() => ({
|
|
97
|
+
amount: {
|
|
98
|
+
amount: faker.helpers.fromRegExp("^[0-9]+$"),
|
|
99
|
+
decimals: faker.number.int({ min: undefined, max: undefined }),
|
|
100
|
+
},
|
|
101
|
+
token: {
|
|
102
|
+
network: faker.helpers.arrayElement(Object.values(ListEvmTokenBalancesNetwork)),
|
|
103
|
+
symbol: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
104
|
+
name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
105
|
+
contractAddress: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
106
|
+
},
|
|
107
|
+
}),
|
|
108
|
+
),
|
|
109
|
+
},
|
|
110
|
+
...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) },
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
export const getRunSQLQueryMockHandler = (
|
|
114
|
+
overrideResponse?:
|
|
115
|
+
| OnchainDataResult
|
|
116
|
+
| ((
|
|
117
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
118
|
+
) => Promise<OnchainDataResult> | OnchainDataResult),
|
|
119
|
+
) => {
|
|
120
|
+
return http.post("*/v2/data/query/run", async info => {
|
|
121
|
+
await delay(0);
|
|
122
|
+
|
|
123
|
+
return new HttpResponse(
|
|
124
|
+
JSON.stringify(
|
|
125
|
+
overrideResponse !== undefined
|
|
126
|
+
? typeof overrideResponse === "function"
|
|
127
|
+
? await overrideResponse(info)
|
|
128
|
+
: overrideResponse
|
|
129
|
+
: getRunSQLQueryResponseMock(),
|
|
130
|
+
),
|
|
131
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
132
|
+
);
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const getListTokensForAccountMockHandler = (
|
|
137
|
+
overrideResponse?:
|
|
138
|
+
| AccountTokenAddressesResponse
|
|
139
|
+
| ((
|
|
140
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
141
|
+
) => Promise<AccountTokenAddressesResponse> | AccountTokenAddressesResponse),
|
|
142
|
+
) => {
|
|
143
|
+
return http.get("*/v2/data/evm/token-ownership/:network/:address", async info => {
|
|
144
|
+
await delay(0);
|
|
145
|
+
|
|
146
|
+
return new HttpResponse(
|
|
147
|
+
JSON.stringify(
|
|
148
|
+
overrideResponse !== undefined
|
|
149
|
+
? typeof overrideResponse === "function"
|
|
150
|
+
? await overrideResponse(info)
|
|
151
|
+
: overrideResponse
|
|
152
|
+
: getListTokensForAccountResponseMock(),
|
|
153
|
+
),
|
|
154
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const getListDataTokenBalancesMockHandler = (
|
|
160
|
+
overrideResponse?:
|
|
161
|
+
| ListDataTokenBalances200
|
|
162
|
+
| ((
|
|
163
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
164
|
+
) => Promise<ListDataTokenBalances200> | ListDataTokenBalances200),
|
|
165
|
+
) => {
|
|
166
|
+
return http.get("*/v2/data/evm/token-balances/:network/:address", async info => {
|
|
167
|
+
await delay(0);
|
|
168
|
+
|
|
169
|
+
return new HttpResponse(
|
|
170
|
+
JSON.stringify(
|
|
171
|
+
overrideResponse !== undefined
|
|
172
|
+
? typeof overrideResponse === "function"
|
|
173
|
+
? await overrideResponse(info)
|
|
174
|
+
: overrideResponse
|
|
175
|
+
: getListDataTokenBalancesResponseMock(),
|
|
176
|
+
),
|
|
177
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
export const getOnchainDataMock = () => [
|
|
182
|
+
getRunSQLQueryMockHandler(),
|
|
183
|
+
getListTokensForAccountMockHandler(),
|
|
184
|
+
getListDataTokenBalancesMockHandler(),
|
|
185
|
+
];
|