@coinbase/cdp-sdk 1.1.2 → 1.3.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 +91 -0
- package/LICENSE +21 -0
- package/README.md +88 -1
- package/{dist → _cjs}/accounts/evm/toEvmServerAccount.js +1 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -0
- package/{dist → _cjs}/accounts/evm/toEvmSmartAccount.js +1 -0
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -0
- package/{dist → _cjs}/accounts/types.js +1 -0
- package/_cjs/accounts/types.js.map +1 -0
- package/{dist → _cjs}/actions/evm/sendUserOperation.js +1 -0
- package/_cjs/actions/evm/sendUserOperation.js.map +1 -0
- package/{dist → _cjs}/actions/evm/waitForUserOperation.js +10 -9
- package/_cjs/actions/evm/waitForUserOperation.js.map +1 -0
- package/{dist → _cjs}/analytics.js +32 -12
- package/_cjs/analytics.js.map +1 -0
- package/{dist → _cjs}/auth/errors.js +1 -0
- package/_cjs/auth/errors.js.map +1 -0
- package/{dist → _cjs}/auth/hooks/axios/index.js +2 -1
- package/_cjs/auth/hooks/axios/index.js.map +1 -0
- package/{dist → _cjs}/auth/hooks/axios/withAuth.js +4 -2
- package/_cjs/auth/hooks/axios/withAuth.js.map +1 -0
- package/{dist → _cjs}/auth/index.js +4 -3
- package/_cjs/auth/index.js.map +1 -0
- package/{dist → _cjs}/auth/utils/http.js +6 -5
- package/_cjs/auth/utils/http.js.map +1 -0
- package/{dist → _cjs}/auth/utils/index.js +3 -2
- package/_cjs/auth/utils/index.js.map +1 -0
- package/{dist → _cjs}/auth/utils/jwt.js +4 -3
- package/_cjs/auth/utils/jwt.js.map +1 -0
- package/_cjs/client/cdp.js +101 -0
- package/_cjs/client/cdp.js.map +1 -0
- package/_cjs/client/evm/evm.js +641 -0
- package/_cjs/client/evm/evm.js.map +1 -0
- package/{dist → _cjs}/client/evm/evm.types.js +1 -0
- package/_cjs/client/evm/evm.types.js.map +1 -0
- package/{dist → _cjs}/client/solana/index.js +3 -2
- package/_cjs/client/solana/index.js.map +1 -0
- package/{dist → _cjs}/client/solana/solana.js +9 -8
- package/_cjs/client/solana/solana.js.map +1 -0
- package/{dist → _cjs}/client/solana/solana.types.js +1 -0
- package/_cjs/client/solana/solana.types.js.map +1 -0
- package/{dist → _cjs}/constants.js +1 -0
- package/_cjs/constants.js.map +1 -0
- package/{dist → _cjs}/errors.js +1 -0
- package/_cjs/errors.js.map +1 -0
- package/{dist → _cjs}/index.js +4 -3
- package/_cjs/index.js.map +1 -0
- package/_cjs/openapi-client/cdpApiClient.js +116 -0
- package/_cjs/openapi-client/cdpApiClient.js.map +1 -0
- package/{dist → _cjs}/openapi-client/errors.js +44 -3
- package/_cjs/openapi-client/errors.js.map +1 -0
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +66 -0
- package/_cjs/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -0
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js +125 -0
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -0
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js +160 -0
- package/_cjs/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -0
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +70 -0
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -0
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +188 -0
- package/_cjs/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -0
- package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.js +15 -0
- package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.js.map +1 -0
- package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js +45 -0
- package/_cjs/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js.map +1 -0
- package/{dist → _cjs}/openapi-client/generated/faucets/faucets.js +20 -14
- package/_cjs/openapi-client/generated/faucets/faucets.js.map +1 -0
- package/{dist → _cjs}/openapi-client/generated/faucets/faucets.msw.js +16 -12
- package/_cjs/openapi-client/generated/faucets/faucets.msw.js.map +1 -0
- package/{dist → _cjs}/openapi-client/generated/index.msw.js +6 -4
- package/_cjs/openapi-client/generated/index.msw.js.map +1 -0
- package/{dist → _cjs}/openapi-client/generated/solana-accounts/solana-accounts.js +38 -35
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -0
- package/{dist → _cjs}/openapi-client/generated/solana-accounts/solana-accounts.msw.js +68 -35
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -0
- package/{dist → _cjs}/openapi-client/index.js +16 -11
- package/_cjs/openapi-client/index.js.map +1 -0
- package/_cjs/package.json +1 -0
- package/{dist → _cjs}/types/calls.js +1 -0
- package/_cjs/types/calls.js.map +1 -0
- package/{dist → _cjs}/types/contract.js +1 -0
- package/_cjs/types/contract.js.map +1 -0
- package/{dist → _cjs}/types/misc.js +1 -0
- package/_cjs/types/misc.js.map +1 -0
- package/{dist → _cjs}/types/multicall.js +1 -0
- package/_cjs/types/multicall.js.map +1 -0
- package/{dist → _cjs}/types/utils.js +1 -0
- package/_cjs/types/utils.js.map +1 -0
- package/{dist → _cjs}/utils/wait.js +3 -2
- package/_cjs/utils/wait.js.map +1 -0
- package/_cjs/version.js +5 -0
- package/_cjs/version.js.map +1 -0
- package/_esm/accounts/evm/toEvmServerAccount.js +40 -0
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js +22 -0
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -0
- package/_esm/accounts/types.js +2 -0
- package/_esm/accounts/types.js.map +1 -0
- package/_esm/actions/evm/sendUserOperation.js +85 -0
- package/_esm/actions/evm/sendUserOperation.js.map +1 -0
- package/_esm/actions/evm/waitForUserOperation.js +58 -0
- package/_esm/actions/evm/waitForUserOperation.js.map +1 -0
- package/_esm/analytics.js +101 -0
- package/_esm/analytics.js.map +1 -0
- package/_esm/auth/errors.js +57 -0
- package/_esm/auth/errors.js.map +1 -0
- package/_esm/auth/hooks/axios/index.js +2 -0
- package/_esm/auth/hooks/axios/index.js.map +1 -0
- package/_esm/auth/hooks/axios/withAuth.js +72 -0
- package/_esm/auth/hooks/axios/withAuth.js.map +1 -0
- package/_esm/auth/index.js +5 -0
- package/_esm/auth/index.js.map +1 -0
- package/_esm/auth/utils/http.js +70 -0
- package/_esm/auth/utils/http.js.map +1 -0
- package/_esm/auth/utils/index.js +3 -0
- package/_esm/auth/utils/index.js.map +1 -0
- package/_esm/auth/utils/jwt.js +199 -0
- package/_esm/auth/utils/jwt.js.map +1 -0
- package/{dist → _esm}/client/cdp.js +16 -13
- package/_esm/client/cdp.js.map +1 -0
- package/{dist → _esm}/client/evm/evm.js +146 -30
- package/_esm/client/evm/evm.js.map +1 -0
- package/_esm/client/evm/evm.types.js +2 -0
- package/_esm/client/evm/evm.types.js.map +1 -0
- package/_esm/client/solana/index.js +2 -0
- package/_esm/client/solana/index.js.map +1 -0
- package/_esm/client/solana/solana.js +204 -0
- package/_esm/client/solana/solana.js.map +1 -0
- package/_esm/client/solana/solana.types.js +2 -0
- package/_esm/client/solana/solana.types.js.map +1 -0
- package/_esm/constants.js +5 -0
- package/_esm/constants.js.map +1 -0
- package/_esm/errors.js +18 -0
- package/_esm/errors.js.map +1 -0
- package/_esm/index.js +3 -0
- package/_esm/index.js.map +1 -0
- package/_esm/openapi-client/cdpApiClient.js +108 -0
- package/_esm/openapi-client/cdpApiClient.js.map +1 -0
- package/_esm/openapi-client/errors.js +104 -0
- package/_esm/openapi-client/errors.js.map +1 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +63 -0
- package/_esm/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js.map +1 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js +114 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.js.map +1 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js +140 -0
- package/_esm/openapi-client/generated/evm-accounts/evm-accounts.msw.js.map +1 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +61 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js.map +1 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +172 -0
- package/_esm/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js.map +1 -0
- package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.js +11 -0
- package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.js.map +1 -0
- package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js +39 -0
- package/_esm/openapi-client/generated/evm-token-balances/evm-token-balances.msw.js.map +1 -0
- package/_esm/openapi-client/generated/faucets/faucets.js +52 -0
- package/_esm/openapi-client/generated/faucets/faucets.js.map +1 -0
- package/_esm/openapi-client/generated/faucets/faucets.msw.js +39 -0
- package/_esm/openapi-client/generated/faucets/faucets.msw.js.map +1 -0
- package/_esm/openapi-client/generated/index.msw.js +6 -0
- package/_esm/openapi-client/generated/index.msw.js.map +1 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +73 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js +116 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.msw.js.map +1 -0
- package/_esm/openapi-client/index.js +31 -0
- package/_esm/openapi-client/index.js.map +1 -0
- package/_esm/package.json +1 -0
- package/_esm/types/calls.js +4 -0
- package/_esm/types/calls.js.map +1 -0
- package/_esm/types/contract.js +4 -0
- package/_esm/types/contract.js.map +1 -0
- package/_esm/types/misc.js +3 -0
- package/_esm/types/misc.js.map +1 -0
- package/_esm/types/multicall.js +2 -0
- package/_esm/types/multicall.js.map +1 -0
- package/_esm/types/utils.js +4 -0
- package/_esm/types/utils.js.map +1 -0
- package/_esm/utils/wait.js +32 -0
- package/_esm/utils/wait.js.map +1 -0
- package/_esm/version.js +2 -0
- package/_esm/version.js.map +1 -0
- package/{dist → _types}/accounts/evm/toEvmServerAccount.d.ts +3 -2
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -0
- package/{dist → _types}/accounts/evm/toEvmSmartAccount.d.ts +3 -2
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -0
- package/{dist → _types}/accounts/types.d.ts +3 -2
- package/_types/accounts/types.d.ts.map +1 -0
- package/{dist → _types}/actions/evm/sendUserOperation.d.ts +5 -5
- package/_types/actions/evm/sendUserOperation.d.ts.map +1 -0
- package/{dist → _types}/actions/evm/waitForUserOperation.d.ts +4 -3
- package/_types/actions/evm/waitForUserOperation.d.ts.map +1 -0
- package/{dist → _types}/analytics.d.ts +16 -0
- package/_types/analytics.d.ts.map +1 -0
- package/{dist → _types}/auth/errors.d.ts +1 -0
- package/_types/auth/errors.d.ts.map +1 -0
- package/_types/auth/hooks/axios/index.d.ts +2 -0
- package/_types/auth/hooks/axios/index.d.ts.map +1 -0
- package/{dist → _types}/auth/hooks/axios/withAuth.d.ts +1 -0
- package/_types/auth/hooks/axios/withAuth.d.ts.map +1 -0
- package/_types/auth/index.d.ts +5 -0
- package/_types/auth/index.d.ts.map +1 -0
- package/{dist → _types}/auth/utils/http.d.ts +1 -0
- package/_types/auth/utils/http.d.ts.map +1 -0
- package/_types/auth/utils/index.d.ts +3 -0
- package/_types/auth/utils/index.d.ts.map +1 -0
- package/{dist → _types}/auth/utils/jwt.d.ts +1 -0
- package/_types/auth/utils/jwt.d.ts.map +1 -0
- package/{dist → _types}/client/cdp.d.ts +3 -2
- package/_types/client/cdp.d.ts.map +1 -0
- package/{dist → _types}/client/evm/evm.d.ts +86 -3
- package/_types/client/evm/evm.d.ts.map +1 -0
- package/{dist → _types}/client/evm/evm.types.d.ts +104 -7
- package/_types/client/evm/evm.types.d.ts.map +1 -0
- package/_types/client/solana/index.d.ts +2 -0
- package/_types/client/solana/index.d.ts.map +1 -0
- package/{dist → _types}/client/solana/solana.d.ts +2 -1
- package/_types/client/solana/solana.d.ts.map +1 -0
- package/{dist → _types}/client/solana/solana.types.d.ts +2 -1
- package/_types/client/solana/solana.types.d.ts.map +1 -0
- package/{dist → _types}/constants.d.ts +1 -0
- package/_types/constants.d.ts.map +1 -0
- package/{dist → _types}/errors.d.ts +1 -0
- package/_types/errors.d.ts.map +1 -0
- package/_types/index.d.ts +4 -0
- package/_types/index.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/cdpApiClient.d.ts +1 -0
- package/_types/openapi-client/cdpApiClient.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/errors.d.ts +30 -2
- package/_types/openapi-client/errors.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts +100 -14
- package/_types/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.d.ts.map +1 -0
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts +91 -0
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts +5 -2
- package/_types/openapi-client/generated/evm-accounts/evm-accounts.msw.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts +22 -20
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts +3 -2
- package/_types/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.d.ts.map +1 -0
- package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.d.ts +20 -0
- package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.d.ts.map +1 -0
- package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.msw.d.ts +6 -0
- package/_types/openapi-client/generated/evm-token-balances/evm-token-balances.msw.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/faucets/faucets.d.ts +11 -9
- package/_types/openapi-client/generated/faucets/faucets.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/faucets/faucets.msw.d.ts +3 -2
- package/_types/openapi-client/generated/faucets/faucets.msw.d.ts.map +1 -0
- package/_types/openapi-client/generated/index.msw.d.ts +6 -0
- package/_types/openapi-client/generated/index.msw.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/solana-accounts/solana-accounts.d.ts +21 -20
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -0
- package/{dist → _types}/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts +3 -2
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.msw.d.ts.map +1 -0
- package/_types/openapi-client/index.d.ts +61 -0
- package/_types/openapi-client/index.d.ts.map +1 -0
- package/{dist → _types}/types/calls.d.ts +4 -3
- package/_types/types/calls.d.ts.map +1 -0
- package/{dist → _types}/types/contract.d.ts +3 -2
- package/_types/types/contract.d.ts.map +1 -0
- package/_types/types/misc.d.ts +41 -0
- package/_types/types/misc.d.ts.map +1 -0
- package/{dist → _types}/types/multicall.d.ts +2 -1
- package/_types/types/multicall.d.ts.map +1 -0
- package/{dist → _types}/types/utils.d.ts +1 -0
- package/_types/types/utils.d.ts.map +1 -0
- package/{dist → _types}/utils/wait.d.ts +1 -0
- package/_types/utils/wait.d.ts.map +1 -0
- package/_types/version.d.ts +2 -0
- package/_types/version.d.ts.map +1 -0
- package/accounts/evm/toEvmServerAccount.ts +60 -0
- package/accounts/evm/toEvmSmartAccount.ts +37 -0
- package/accounts/types.ts +53 -0
- package/actions/evm/sendUserOperation.ts +163 -0
- package/actions/evm/waitForUserOperation.ts +115 -0
- package/analytics.ts +142 -0
- package/auth/README.md +145 -0
- package/auth/errors.ts +59 -0
- package/auth/hooks/axios/index.ts +1 -0
- package/auth/hooks/axios/withAuth.ts +121 -0
- package/auth/index.ts +5 -0
- package/auth/utils/http.ts +146 -0
- package/auth/utils/index.ts +2 -0
- package/auth/utils/jwt.ts +324 -0
- package/client/cdp.ts +116 -0
- package/client/evm/evm.ts +739 -0
- package/client/evm/evm.types.ts +408 -0
- package/client/solana/index.ts +1 -0
- package/client/solana/solana.ts +237 -0
- package/client/solana/solana.types.ts +114 -0
- package/constants.ts +4 -0
- package/errors.ts +17 -0
- package/index.ts +4 -0
- package/openapi-client/cdpApiClient.ts +221 -0
- package/openapi-client/errors.ts +132 -0
- package/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.ts +512 -0
- package/openapi-client/generated/evm-accounts/evm-accounts.msw.ts +271 -0
- package/openapi-client/generated/evm-accounts/evm-accounts.ts +194 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.ts +283 -0
- package/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.ts +132 -0
- package/openapi-client/generated/evm-token-balances/evm-token-balances.msw.ts +57 -0
- package/openapi-client/generated/evm-token-balances/evm-token-balances.ts +37 -0
- package/openapi-client/generated/faucets/faucets.msw.ts +76 -0
- package/openapi-client/generated/faucets/faucets.ts +84 -0
- package/openapi-client/generated/index.msw.ts +5 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.msw.ts +219 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.ts +143 -0
- package/openapi-client/index.ts +36 -0
- package/package.json +31 -66
- package/types/calls.ts +40 -0
- package/types/contract.ts +126 -0
- package/types/misc.ts +44 -0
- package/types/multicall.ts +29 -0
- package/types/utils.ts +288 -0
- package/utils/wait.ts +52 -0
- package/version.ts +1 -0
- package/dist/auth/hooks/axios/index.d.ts +0 -1
- package/dist/auth/index.d.ts +0 -4
- package/dist/auth/utils/index.d.ts +0 -2
- package/dist/client/evm/index.d.ts +0 -1
- package/dist/client/evm/index.js +0 -5
- package/dist/client/solana/index.d.ts +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/openapi-client/cdpApiClient.js +0 -146
- package/dist/openapi-client/generated/coinbaseDeveloperPlatformAPIs.schemas.js +0 -54
- package/dist/openapi-client/generated/evm-accounts/evm-accounts.d.ts +0 -62
- package/dist/openapi-client/generated/evm-accounts/evm-accounts.js +0 -85
- package/dist/openapi-client/generated/evm-accounts/evm-accounts.msw.js +0 -113
- package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.js +0 -66
- package/dist/openapi-client/generated/evm-smart-accounts/evm-smart-accounts.msw.js +0 -99
- package/dist/openapi-client/generated/index.msw.d.ts +0 -4
- package/dist/openapi-client/index.d.ts +0 -55
- package/dist/types/misc.d.ts +0 -3
|
@@ -0,0 +1,283 @@
|
|
|
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 type {
|
|
13
|
+
EvmSmartAccount,
|
|
14
|
+
EvmUserOperation,
|
|
15
|
+
ListEvmSmartAccounts200,
|
|
16
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
17
|
+
|
|
18
|
+
export const getListEvmSmartAccountsResponseMock = (): ListEvmSmartAccounts200 => ({
|
|
19
|
+
...{
|
|
20
|
+
accounts: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
|
|
21
|
+
() => ({
|
|
22
|
+
address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
23
|
+
owners: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
|
|
24
|
+
() => faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
25
|
+
),
|
|
26
|
+
name: faker.helpers.arrayElement([
|
|
27
|
+
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
28
|
+
undefined,
|
|
29
|
+
]),
|
|
30
|
+
}),
|
|
31
|
+
),
|
|
32
|
+
},
|
|
33
|
+
...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) },
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export const getCreateEvmSmartAccountResponseMock = (
|
|
37
|
+
overrideResponse: Partial<EvmSmartAccount> = {},
|
|
38
|
+
): EvmSmartAccount => ({
|
|
39
|
+
address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
40
|
+
owners: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
41
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
42
|
+
),
|
|
43
|
+
name: faker.helpers.arrayElement([
|
|
44
|
+
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
45
|
+
undefined,
|
|
46
|
+
]),
|
|
47
|
+
...overrideResponse,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const getGetEvmSmartAccountResponseMock = (
|
|
51
|
+
overrideResponse: Partial<EvmSmartAccount> = {},
|
|
52
|
+
): EvmSmartAccount => ({
|
|
53
|
+
address: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
54
|
+
owners: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() =>
|
|
55
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
56
|
+
),
|
|
57
|
+
name: faker.helpers.arrayElement([
|
|
58
|
+
faker.helpers.fromRegExp("^[A-Za-z0-9][A-Za-z0-9-]{0,34}[A-Za-z0-9]$"),
|
|
59
|
+
undefined,
|
|
60
|
+
]),
|
|
61
|
+
...overrideResponse,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const getPrepareUserOperationResponseMock = (
|
|
65
|
+
overrideResponse: Partial<EvmUserOperation> = {},
|
|
66
|
+
): EvmUserOperation => ({
|
|
67
|
+
network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
|
|
68
|
+
userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
|
|
69
|
+
calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
70
|
+
to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
71
|
+
value: faker.string.alpha(20),
|
|
72
|
+
data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"),
|
|
73
|
+
})),
|
|
74
|
+
status: faker.helpers.arrayElement([
|
|
75
|
+
"pending",
|
|
76
|
+
"signed",
|
|
77
|
+
"broadcast",
|
|
78
|
+
"complete",
|
|
79
|
+
"failed",
|
|
80
|
+
] as const),
|
|
81
|
+
transactionHash: faker.helpers.arrayElement([
|
|
82
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
83
|
+
undefined,
|
|
84
|
+
]),
|
|
85
|
+
...overrideResponse,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
export const getGetUserOperationResponseMock = (
|
|
89
|
+
overrideResponse: Partial<EvmUserOperation> = {},
|
|
90
|
+
): EvmUserOperation => ({
|
|
91
|
+
network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
|
|
92
|
+
userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
|
|
93
|
+
calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
94
|
+
to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
95
|
+
value: faker.string.alpha(20),
|
|
96
|
+
data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"),
|
|
97
|
+
})),
|
|
98
|
+
status: faker.helpers.arrayElement([
|
|
99
|
+
"pending",
|
|
100
|
+
"signed",
|
|
101
|
+
"broadcast",
|
|
102
|
+
"complete",
|
|
103
|
+
"failed",
|
|
104
|
+
] as const),
|
|
105
|
+
transactionHash: faker.helpers.arrayElement([
|
|
106
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
107
|
+
undefined,
|
|
108
|
+
]),
|
|
109
|
+
...overrideResponse,
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
export const getSendUserOperationResponseMock = (
|
|
113
|
+
overrideResponse: Partial<EvmUserOperation> = {},
|
|
114
|
+
): EvmUserOperation => ({
|
|
115
|
+
network: faker.helpers.arrayElement(["base-sepolia", "base"] as const),
|
|
116
|
+
userOpHash: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$"),
|
|
117
|
+
calls: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(() => ({
|
|
118
|
+
to: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
119
|
+
value: faker.string.alpha(20),
|
|
120
|
+
data: faker.helpers.fromRegExp("^0x[0-9a-fA-F]*$"),
|
|
121
|
+
})),
|
|
122
|
+
status: faker.helpers.arrayElement([
|
|
123
|
+
"pending",
|
|
124
|
+
"signed",
|
|
125
|
+
"broadcast",
|
|
126
|
+
"complete",
|
|
127
|
+
"failed",
|
|
128
|
+
] as const),
|
|
129
|
+
transactionHash: faker.helpers.arrayElement([
|
|
130
|
+
faker.helpers.fromRegExp("^0x[0-9a-fA-F]{64}$|^$"),
|
|
131
|
+
undefined,
|
|
132
|
+
]),
|
|
133
|
+
...overrideResponse,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
export const getListEvmSmartAccountsMockHandler = (
|
|
137
|
+
overrideResponse?:
|
|
138
|
+
| ListEvmSmartAccounts200
|
|
139
|
+
| ((
|
|
140
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
141
|
+
) => Promise<ListEvmSmartAccounts200> | ListEvmSmartAccounts200),
|
|
142
|
+
) => {
|
|
143
|
+
return http.get("*/v2/evm/smart-accounts", 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
|
+
: getListEvmSmartAccountsResponseMock(),
|
|
153
|
+
),
|
|
154
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
155
|
+
);
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export const getCreateEvmSmartAccountMockHandler = (
|
|
160
|
+
overrideResponse?:
|
|
161
|
+
| EvmSmartAccount
|
|
162
|
+
| ((
|
|
163
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
164
|
+
) => Promise<EvmSmartAccount> | EvmSmartAccount),
|
|
165
|
+
) => {
|
|
166
|
+
return http.post("*/v2/evm/smart-accounts", 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
|
+
: getCreateEvmSmartAccountResponseMock(),
|
|
176
|
+
),
|
|
177
|
+
{ status: 201, headers: { "Content-Type": "application/json" } },
|
|
178
|
+
);
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const getGetEvmSmartAccountMockHandler = (
|
|
183
|
+
overrideResponse?:
|
|
184
|
+
| EvmSmartAccount
|
|
185
|
+
| ((
|
|
186
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
187
|
+
) => Promise<EvmSmartAccount> | EvmSmartAccount),
|
|
188
|
+
) => {
|
|
189
|
+
return http.get("*/v2/evm/smart-accounts/:address", async info => {
|
|
190
|
+
await delay(0);
|
|
191
|
+
|
|
192
|
+
return new HttpResponse(
|
|
193
|
+
JSON.stringify(
|
|
194
|
+
overrideResponse !== undefined
|
|
195
|
+
? typeof overrideResponse === "function"
|
|
196
|
+
? await overrideResponse(info)
|
|
197
|
+
: overrideResponse
|
|
198
|
+
: getGetEvmSmartAccountResponseMock(),
|
|
199
|
+
),
|
|
200
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
201
|
+
);
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export const getPrepareUserOperationMockHandler = (
|
|
206
|
+
overrideResponse?:
|
|
207
|
+
| EvmUserOperation
|
|
208
|
+
| ((
|
|
209
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
210
|
+
) => Promise<EvmUserOperation> | EvmUserOperation),
|
|
211
|
+
) => {
|
|
212
|
+
return http.post("*/v2/evm/smart-accounts/:address/user-operations", async info => {
|
|
213
|
+
await delay(0);
|
|
214
|
+
|
|
215
|
+
return new HttpResponse(
|
|
216
|
+
JSON.stringify(
|
|
217
|
+
overrideResponse !== undefined
|
|
218
|
+
? typeof overrideResponse === "function"
|
|
219
|
+
? await overrideResponse(info)
|
|
220
|
+
: overrideResponse
|
|
221
|
+
: getPrepareUserOperationResponseMock(),
|
|
222
|
+
),
|
|
223
|
+
{ status: 201, headers: { "Content-Type": "application/json" } },
|
|
224
|
+
);
|
|
225
|
+
});
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const getGetUserOperationMockHandler = (
|
|
229
|
+
overrideResponse?:
|
|
230
|
+
| EvmUserOperation
|
|
231
|
+
| ((
|
|
232
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
233
|
+
) => Promise<EvmUserOperation> | EvmUserOperation),
|
|
234
|
+
) => {
|
|
235
|
+
return http.get("*/v2/evm/smart-accounts/:address/user-operations/:userOpHash", async info => {
|
|
236
|
+
await delay(0);
|
|
237
|
+
|
|
238
|
+
return new HttpResponse(
|
|
239
|
+
JSON.stringify(
|
|
240
|
+
overrideResponse !== undefined
|
|
241
|
+
? typeof overrideResponse === "function"
|
|
242
|
+
? await overrideResponse(info)
|
|
243
|
+
: overrideResponse
|
|
244
|
+
: getGetUserOperationResponseMock(),
|
|
245
|
+
),
|
|
246
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
247
|
+
);
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export const getSendUserOperationMockHandler = (
|
|
252
|
+
overrideResponse?:
|
|
253
|
+
| EvmUserOperation
|
|
254
|
+
| ((
|
|
255
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
256
|
+
) => Promise<EvmUserOperation> | EvmUserOperation),
|
|
257
|
+
) => {
|
|
258
|
+
return http.post(
|
|
259
|
+
"*/v2/evm/smart-accounts/:address/user-operations/:userOpHash/send",
|
|
260
|
+
async info => {
|
|
261
|
+
await delay(0);
|
|
262
|
+
|
|
263
|
+
return new HttpResponse(
|
|
264
|
+
JSON.stringify(
|
|
265
|
+
overrideResponse !== undefined
|
|
266
|
+
? typeof overrideResponse === "function"
|
|
267
|
+
? await overrideResponse(info)
|
|
268
|
+
: overrideResponse
|
|
269
|
+
: getSendUserOperationResponseMock(),
|
|
270
|
+
),
|
|
271
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
272
|
+
);
|
|
273
|
+
},
|
|
274
|
+
);
|
|
275
|
+
};
|
|
276
|
+
export const getEvmSmartAccountsMock = () => [
|
|
277
|
+
getListEvmSmartAccountsMockHandler(),
|
|
278
|
+
getCreateEvmSmartAccountMockHandler(),
|
|
279
|
+
getGetEvmSmartAccountMockHandler(),
|
|
280
|
+
getPrepareUserOperationMockHandler(),
|
|
281
|
+
getGetUserOperationMockHandler(),
|
|
282
|
+
getSendUserOperationMockHandler(),
|
|
283
|
+
];
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
CreateEvmSmartAccountBody,
|
|
10
|
+
EvmSmartAccount,
|
|
11
|
+
EvmUserOperation,
|
|
12
|
+
ListEvmSmartAccounts200,
|
|
13
|
+
ListEvmSmartAccountsParams,
|
|
14
|
+
PrepareUserOperationBody,
|
|
15
|
+
SendUserOperationBody,
|
|
16
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
17
|
+
|
|
18
|
+
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
19
|
+
|
|
20
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Lists the Smart Accounts belonging to the developer's CDP Project.
|
|
24
|
+
The response is paginated, and by default, returns 20 accounts per page.
|
|
25
|
+
* @summary List Smart Accounts
|
|
26
|
+
*/
|
|
27
|
+
export const listEvmSmartAccounts = (
|
|
28
|
+
params?: ListEvmSmartAccountsParams,
|
|
29
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
30
|
+
) => {
|
|
31
|
+
return cdpApiClient<ListEvmSmartAccounts200>(
|
|
32
|
+
{ url: `/v2/evm/smart-accounts`, method: "GET", params },
|
|
33
|
+
options,
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new Smart Account.
|
|
38
|
+
* @summary Create a Smart Account
|
|
39
|
+
*/
|
|
40
|
+
export const createEvmSmartAccount = (
|
|
41
|
+
createEvmSmartAccountBody: CreateEvmSmartAccountBody,
|
|
42
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
43
|
+
) => {
|
|
44
|
+
return cdpApiClient<EvmSmartAccount>(
|
|
45
|
+
{
|
|
46
|
+
url: `/v2/evm/smart-accounts`,
|
|
47
|
+
method: "POST",
|
|
48
|
+
headers: { "Content-Type": "application/json" },
|
|
49
|
+
data: createEvmSmartAccountBody,
|
|
50
|
+
},
|
|
51
|
+
options,
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Gets a Smart Account by its address.
|
|
56
|
+
* @summary Get a Smart Account by address
|
|
57
|
+
*/
|
|
58
|
+
export const getEvmSmartAccount = (
|
|
59
|
+
address: string,
|
|
60
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
61
|
+
) => {
|
|
62
|
+
return cdpApiClient<EvmSmartAccount>(
|
|
63
|
+
{ url: `/v2/evm/smart-accounts/${address}`, method: "GET" },
|
|
64
|
+
options,
|
|
65
|
+
);
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Prepares a new user operation on a Smart Account for a specific network.
|
|
69
|
+
* @summary Prepare a user operation
|
|
70
|
+
*/
|
|
71
|
+
export const prepareUserOperation = (
|
|
72
|
+
address: string,
|
|
73
|
+
prepareUserOperationBody: PrepareUserOperationBody,
|
|
74
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
75
|
+
) => {
|
|
76
|
+
return cdpApiClient<EvmUserOperation>(
|
|
77
|
+
{
|
|
78
|
+
url: `/v2/evm/smart-accounts/${address}/user-operations`,
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: { "Content-Type": "application/json" },
|
|
81
|
+
data: prepareUserOperationBody,
|
|
82
|
+
},
|
|
83
|
+
options,
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Gets a user operation by its hash.
|
|
88
|
+
* @summary Get a user operation
|
|
89
|
+
*/
|
|
90
|
+
export const getUserOperation = (
|
|
91
|
+
address: string,
|
|
92
|
+
userOpHash: string,
|
|
93
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
94
|
+
) => {
|
|
95
|
+
return cdpApiClient<EvmUserOperation>(
|
|
96
|
+
{ url: `/v2/evm/smart-accounts/${address}/user-operations/${userOpHash}`, method: "GET" },
|
|
97
|
+
options,
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Sends a user operation with a signature.
|
|
102
|
+
The signature that is sent should be 65 bytes, consisting of the `r`, `s`, and `v` values of the ECDSA signature. Note that the `v` value should conform to the `personal_sign` standard, which means it should be 27 or 28.
|
|
103
|
+
* @summary Send a user operation
|
|
104
|
+
*/
|
|
105
|
+
export const sendUserOperation = (
|
|
106
|
+
address: string,
|
|
107
|
+
userOpHash: string,
|
|
108
|
+
sendUserOperationBody: SendUserOperationBody,
|
|
109
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
110
|
+
) => {
|
|
111
|
+
return cdpApiClient<EvmUserOperation>(
|
|
112
|
+
{
|
|
113
|
+
url: `/v2/evm/smart-accounts/${address}/user-operations/${userOpHash}/send`,
|
|
114
|
+
method: "POST",
|
|
115
|
+
headers: { "Content-Type": "application/json" },
|
|
116
|
+
data: sendUserOperationBody,
|
|
117
|
+
},
|
|
118
|
+
options,
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
export type ListEvmSmartAccountsResult = NonNullable<
|
|
122
|
+
Awaited<ReturnType<typeof listEvmSmartAccounts>>
|
|
123
|
+
>;
|
|
124
|
+
export type CreateEvmSmartAccountResult = NonNullable<
|
|
125
|
+
Awaited<ReturnType<typeof createEvmSmartAccount>>
|
|
126
|
+
>;
|
|
127
|
+
export type GetEvmSmartAccountResult = NonNullable<Awaited<ReturnType<typeof getEvmSmartAccount>>>;
|
|
128
|
+
export type PrepareUserOperationResult = NonNullable<
|
|
129
|
+
Awaited<ReturnType<typeof prepareUserOperation>>
|
|
130
|
+
>;
|
|
131
|
+
export type GetUserOperationResult = NonNullable<Awaited<ReturnType<typeof getUserOperation>>>;
|
|
132
|
+
export type SendUserOperationResult = NonNullable<Awaited<ReturnType<typeof sendUserOperation>>>;
|
|
@@ -0,0 +1,57 @@
|
|
|
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 { ListEvmTokenBalances200 } from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
14
|
+
|
|
15
|
+
export const getListEvmTokenBalancesResponseMock = (): ListEvmTokenBalances200 => ({
|
|
16
|
+
...{
|
|
17
|
+
balances: Array.from({ length: faker.number.int({ min: 1, max: 10 }) }, (_, i) => i + 1).map(
|
|
18
|
+
() => ({
|
|
19
|
+
amount: {
|
|
20
|
+
amount: faker.helpers.fromRegExp("^[0-9]+$"),
|
|
21
|
+
decimals: faker.number.int({ min: undefined, max: undefined }),
|
|
22
|
+
},
|
|
23
|
+
token: {
|
|
24
|
+
network: faker.helpers.arrayElement(Object.values(ListEvmTokenBalancesNetwork)),
|
|
25
|
+
symbol: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
26
|
+
name: faker.helpers.arrayElement([faker.string.alpha(20), undefined]),
|
|
27
|
+
contractAddress: faker.helpers.fromRegExp("^0x[0-9a-fA-F]{40}$"),
|
|
28
|
+
},
|
|
29
|
+
}),
|
|
30
|
+
),
|
|
31
|
+
},
|
|
32
|
+
...{ nextPageToken: faker.helpers.arrayElement([faker.string.alpha(20), undefined]) },
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const getListEvmTokenBalancesMockHandler = (
|
|
36
|
+
overrideResponse?:
|
|
37
|
+
| ListEvmTokenBalances200
|
|
38
|
+
| ((
|
|
39
|
+
info: Parameters<Parameters<typeof http.get>[1]>[0],
|
|
40
|
+
) => Promise<ListEvmTokenBalances200> | ListEvmTokenBalances200),
|
|
41
|
+
) => {
|
|
42
|
+
return http.get("*/v2/evm/token-balances/:network/:address", async info => {
|
|
43
|
+
await delay(0);
|
|
44
|
+
|
|
45
|
+
return new HttpResponse(
|
|
46
|
+
JSON.stringify(
|
|
47
|
+
overrideResponse !== undefined
|
|
48
|
+
? typeof overrideResponse === "function"
|
|
49
|
+
? await overrideResponse(info)
|
|
50
|
+
: overrideResponse
|
|
51
|
+
: getListEvmTokenBalancesResponseMock(),
|
|
52
|
+
),
|
|
53
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
54
|
+
);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
export const getEvmTokenBalancesMock = () => [getListEvmTokenBalancesMockHandler()];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
ListEvmTokenBalances200,
|
|
10
|
+
ListEvmTokenBalancesNetwork,
|
|
11
|
+
ListEvmTokenBalancesParams,
|
|
12
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
13
|
+
|
|
14
|
+
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
15
|
+
|
|
16
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
17
|
+
|
|
18
|
+
/**
|
|
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.
|
|
22
|
+
* @summary List EVM token balances
|
|
23
|
+
*/
|
|
24
|
+
export const listEvmTokenBalances = (
|
|
25
|
+
network: ListEvmTokenBalancesNetwork,
|
|
26
|
+
address: string,
|
|
27
|
+
params?: ListEvmTokenBalancesParams,
|
|
28
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
29
|
+
) => {
|
|
30
|
+
return cdpApiClient<ListEvmTokenBalances200>(
|
|
31
|
+
{ url: `/v2/evm/token-balances/${network}/${address}`, method: "GET", params },
|
|
32
|
+
options,
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
export type ListEvmTokenBalancesResult = NonNullable<
|
|
36
|
+
Awaited<ReturnType<typeof listEvmTokenBalances>>
|
|
37
|
+
>;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 type {
|
|
13
|
+
RequestEvmFaucet200,
|
|
14
|
+
RequestSolanaFaucet200,
|
|
15
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
16
|
+
|
|
17
|
+
export const getRequestEvmFaucetResponseMock = (
|
|
18
|
+
overrideResponse: Partial<RequestEvmFaucet200> = {},
|
|
19
|
+
): RequestEvmFaucet200 => ({ transactionHash: faker.string.alpha(20), ...overrideResponse });
|
|
20
|
+
|
|
21
|
+
export const getRequestSolanaFaucetResponseMock = (
|
|
22
|
+
overrideResponse: Partial<RequestSolanaFaucet200> = {},
|
|
23
|
+
): RequestSolanaFaucet200 => ({
|
|
24
|
+
transactionSignature: faker.string.alpha(20),
|
|
25
|
+
...overrideResponse,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const getRequestEvmFaucetMockHandler = (
|
|
29
|
+
overrideResponse?:
|
|
30
|
+
| RequestEvmFaucet200
|
|
31
|
+
| ((
|
|
32
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
33
|
+
) => Promise<RequestEvmFaucet200> | RequestEvmFaucet200),
|
|
34
|
+
) => {
|
|
35
|
+
return http.post("*/v2/evm/faucet", async info => {
|
|
36
|
+
await delay(0);
|
|
37
|
+
|
|
38
|
+
return new HttpResponse(
|
|
39
|
+
JSON.stringify(
|
|
40
|
+
overrideResponse !== undefined
|
|
41
|
+
? typeof overrideResponse === "function"
|
|
42
|
+
? await overrideResponse(info)
|
|
43
|
+
: overrideResponse
|
|
44
|
+
: getRequestEvmFaucetResponseMock(),
|
|
45
|
+
),
|
|
46
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const getRequestSolanaFaucetMockHandler = (
|
|
52
|
+
overrideResponse?:
|
|
53
|
+
| RequestSolanaFaucet200
|
|
54
|
+
| ((
|
|
55
|
+
info: Parameters<Parameters<typeof http.post>[1]>[0],
|
|
56
|
+
) => Promise<RequestSolanaFaucet200> | RequestSolanaFaucet200),
|
|
57
|
+
) => {
|
|
58
|
+
return http.post("*/v2/solana/faucet", async info => {
|
|
59
|
+
await delay(0);
|
|
60
|
+
|
|
61
|
+
return new HttpResponse(
|
|
62
|
+
JSON.stringify(
|
|
63
|
+
overrideResponse !== undefined
|
|
64
|
+
? typeof overrideResponse === "function"
|
|
65
|
+
? await overrideResponse(info)
|
|
66
|
+
: overrideResponse
|
|
67
|
+
: getRequestSolanaFaucetResponseMock(),
|
|
68
|
+
),
|
|
69
|
+
{ status: 200, headers: { "Content-Type": "application/json" } },
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
export const getFaucetsMock = () => [
|
|
74
|
+
getRequestEvmFaucetMockHandler(),
|
|
75
|
+
getRequestSolanaFaucetMockHandler(),
|
|
76
|
+
];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.6.0 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* Coinbase Developer Platform APIs
|
|
5
|
+
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
|
|
6
|
+
* OpenAPI spec version: 2.0.0
|
|
7
|
+
*/
|
|
8
|
+
import type {
|
|
9
|
+
RequestEvmFaucet200,
|
|
10
|
+
RequestEvmFaucetBody,
|
|
11
|
+
RequestSolanaFaucet200,
|
|
12
|
+
RequestSolanaFaucetBody,
|
|
13
|
+
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
|
|
14
|
+
|
|
15
|
+
import { cdpApiClient } from "../../cdpApiClient.js";
|
|
16
|
+
|
|
17
|
+
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Request funds from the CDP Faucet on supported EVM test networks.
|
|
21
|
+
|
|
22
|
+
Faucets are available for ETH, USDC, EURC, and cbBTC on Base Sepolia and Ethereum Sepolia.
|
|
23
|
+
|
|
24
|
+
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
|
|
25
|
+
These limits are applied at both the CDP User level and the blockchain address level.
|
|
26
|
+
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
|
|
27
|
+
|
|
28
|
+
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|
|
29
|
+
|:-----:|:-------------------------:|:--------------------------------:|
|
|
30
|
+
| ETH | 0.0001 ETH | 0.1 ETH |
|
|
31
|
+
| USDC | 1 USDC | 10 USDC |
|
|
32
|
+
| EURC | 1 EURC | 10 EURC |
|
|
33
|
+
| cbBTC | 0.0001 cbBTC | 0.001 cbBTC |
|
|
34
|
+
|
|
35
|
+
* @summary Request funds on EVM test networks
|
|
36
|
+
*/
|
|
37
|
+
export const requestEvmFaucet = (
|
|
38
|
+
requestEvmFaucetBody: RequestEvmFaucetBody,
|
|
39
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
40
|
+
) => {
|
|
41
|
+
return cdpApiClient<RequestEvmFaucet200>(
|
|
42
|
+
{
|
|
43
|
+
url: `/v2/evm/faucet`,
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: { "Content-Type": "application/json" },
|
|
46
|
+
data: requestEvmFaucetBody,
|
|
47
|
+
},
|
|
48
|
+
options,
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Request funds from the CDP Faucet on Solana devnet.
|
|
53
|
+
|
|
54
|
+
Faucets are available for SOL.
|
|
55
|
+
|
|
56
|
+
To prevent abuse, we enforce rate limits within a rolling 24-hour window to control the amount of funds that can be requested.
|
|
57
|
+
These limits are applied at both the CDP User level and the blockchain address level.
|
|
58
|
+
A single blockchain address cannot exceed the specified limits, even if multiple users submit requests to the same address.
|
|
59
|
+
|
|
60
|
+
| Token | Amount per Faucet Request |Rolling 24-hour window Rate Limits|
|
|
61
|
+
|:-----:|:-------------------------:|:--------------------------------:|
|
|
62
|
+
| SOL | 0.00125 SOL | 0.0125 SOL |
|
|
63
|
+
| USDC | 1 USDC | 10 USDC |
|
|
64
|
+
|
|
65
|
+
* @summary Request funds on Solana devnet
|
|
66
|
+
*/
|
|
67
|
+
export const requestSolanaFaucet = (
|
|
68
|
+
requestSolanaFaucetBody: RequestSolanaFaucetBody,
|
|
69
|
+
options?: SecondParameter<typeof cdpApiClient>,
|
|
70
|
+
) => {
|
|
71
|
+
return cdpApiClient<RequestSolanaFaucet200>(
|
|
72
|
+
{
|
|
73
|
+
url: `/v2/solana/faucet`,
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: { "Content-Type": "application/json" },
|
|
76
|
+
data: requestSolanaFaucetBody,
|
|
77
|
+
},
|
|
78
|
+
options,
|
|
79
|
+
);
|
|
80
|
+
};
|
|
81
|
+
export type RequestEvmFaucetResult = NonNullable<Awaited<ReturnType<typeof requestEvmFaucet>>>;
|
|
82
|
+
export type RequestSolanaFaucetResult = NonNullable<
|
|
83
|
+
Awaited<ReturnType<typeof requestSolanaFaucet>>
|
|
84
|
+
>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from "./evm-accounts/evm-accounts.msw.js";
|
|
2
|
+
export * from "./faucets/faucets.msw.js";
|
|
3
|
+
export * from "./evm-smart-accounts/evm-smart-accounts.msw.js";
|
|
4
|
+
export * from "./evm-token-balances/evm-token-balances.msw.js";
|
|
5
|
+
export * from "./solana-accounts/solana-accounts.msw.js";
|