@coinbase/cdp-sdk 1.20.0 → 1.22.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 +32 -0
- package/README.md +8 -0
- package/_cjs/accounts/evm/chainToNetworkMapper.js +33 -0
- package/_cjs/accounts/evm/chainToNetworkMapper.js.map +1 -0
- package/_cjs/accounts/evm/getBaseNodeRpcUrl.js +38 -0
- package/_cjs/accounts/evm/getBaseNodeRpcUrl.js.map +1 -0
- package/_cjs/accounts/evm/networkCapabilities.js +91 -0
- package/_cjs/accounts/evm/networkCapabilities.js.map +1 -0
- package/_cjs/accounts/evm/resolveViemClients.js +2 -35
- package/_cjs/accounts/evm/resolveViemClients.js.map +1 -1
- package/_cjs/accounts/evm/toEvmServerAccount.js +1 -1
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +2 -2
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js +86 -32
- package/_cjs/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js +126 -2
- package/_cjs/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_cjs/actions/evm/sendUserOperation.js +8 -1
- package/_cjs/actions/evm/sendUserOperation.js.map +1 -1
- package/_cjs/actions/evm/transfer/transferWithViem.js +2 -1
- package/_cjs/actions/evm/transfer/transferWithViem.js.map +1 -1
- package/_cjs/auth/utils/hash.js +17 -0
- package/_cjs/auth/utils/hash.js.map +1 -0
- package/_cjs/auth/utils/jwt.js +20 -55
- package/_cjs/auth/utils/jwt.js.map +1 -1
- package/_cjs/client/cdp.js +6 -0
- package/_cjs/client/cdp.js.map +1 -1
- package/_cjs/client/evm/evm.js +2 -2
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/solana/solana.js +74 -0
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/constants.js +18 -1
- package/_cjs/constants.js.map +1 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js +10 -1
- package/_cjs/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/chainToNetworkMapper.js +30 -0
- package/_esm/accounts/evm/chainToNetworkMapper.js.map +1 -0
- package/_esm/accounts/evm/getBaseNodeRpcUrl.js +35 -0
- package/_esm/accounts/evm/getBaseNodeRpcUrl.js.map +1 -0
- package/_esm/accounts/evm/networkCapabilities.js +86 -0
- package/_esm/accounts/evm/networkCapabilities.js.map +1 -0
- package/_esm/accounts/evm/resolveViemClients.js +1 -34
- package/_esm/accounts/evm/resolveViemClients.js.map +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 +2 -2
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js +87 -33
- package/_esm/accounts/evm/toNetworkScopedEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js +126 -2
- package/_esm/accounts/evm/toNetworkScopedEvmSmartAccount.js.map +1 -1
- package/_esm/actions/evm/sendUserOperation.js +8 -1
- package/_esm/actions/evm/sendUserOperation.js.map +1 -1
- package/_esm/actions/evm/transfer/transferWithViem.js +2 -1
- package/_esm/actions/evm/transfer/transferWithViem.js.map +1 -1
- package/_esm/auth/utils/hash.js +13 -0
- package/_esm/auth/utils/hash.js.map +1 -0
- package/_esm/auth/utils/jwt.js +20 -22
- package/_esm/auth/utils/jwt.js.map +1 -1
- package/_esm/client/cdp.js +6 -0
- package/_esm/client/cdp.js.map +1 -1
- package/_esm/client/evm/evm.js +2 -2
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/solana/solana.js +71 -0
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/constants.js +17 -0
- package/_esm/constants.js.map +1 -1
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js +8 -0
- package/_esm/openapi-client/generated/solana-accounts/solana-accounts.js.map +1 -1
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/chainToNetworkMapper.d.ts +11 -0
- package/_types/accounts/evm/chainToNetworkMapper.d.ts.map +1 -0
- package/_types/accounts/evm/getBaseNodeRpcUrl.d.ts +8 -0
- package/_types/accounts/evm/getBaseNodeRpcUrl.d.ts.map +1 -0
- package/_types/accounts/evm/networkCapabilities.d.ts +103 -0
- package/_types/accounts/evm/networkCapabilities.d.ts.map +1 -0
- package/_types/accounts/evm/resolveViemClients.d.ts.map +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts +3 -3
- package/_types/accounts/evm/toNetworkScopedEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts +9 -6
- package/_types/accounts/evm/toNetworkScopedEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/evm/types.d.ts +109 -14
- package/_types/accounts/evm/types.d.ts.map +1 -1
- package/_types/actions/evm/fund/fund.d.ts +1 -1
- package/_types/actions/evm/fund/fund.d.ts.map +1 -1
- package/_types/actions/evm/fund/quoteFund.d.ts +1 -1
- package/_types/actions/evm/fund/quoteFund.d.ts.map +1 -1
- package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/evm/transfer/transferWithViem.d.ts +1 -1
- package/_types/actions/evm/transfer/transferWithViem.d.ts.map +1 -1
- package/_types/auth/utils/hash.d.ts +9 -0
- package/_types/auth/utils/hash.d.ts.map +1 -0
- package/_types/auth/utils/jwt.d.ts.map +1 -1
- package/_types/client/cdp.d.ts.map +1 -1
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +1 -1
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +40 -1
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +15 -1
- package/_types/client/solana/solana.types.d.ts.map +1 -1
- package/_types/constants.d.ts +4 -0
- package/_types/constants.d.ts.map +1 -1
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts +5 -0
- package/_types/openapi-client/generated/solana-accounts/solana-accounts.d.ts.map +1 -1
- package/_types/openapi-client/index.d.ts +10 -0
- package/_types/openapi-client/index.d.ts.map +1 -1
- package/_types/policies/schema.d.ts +24 -24
- package/_types/version.d.ts +1 -1
- package/accounts/evm/chainToNetworkMapper.ts +37 -0
- package/accounts/evm/getBaseNodeRpcUrl.ts +40 -0
- package/accounts/evm/networkCapabilities.ts +117 -0
- package/accounts/evm/resolveViemClients.ts +1 -38
- package/accounts/evm/toEvmServerAccount.ts +3 -3
- package/accounts/evm/toEvmSmartAccount.ts +3 -3
- package/accounts/evm/toNetworkScopedEvmServerAccount.ts +116 -44
- package/accounts/evm/toNetworkScopedEvmSmartAccount.ts +178 -11
- package/accounts/evm/types.ts +253 -25
- package/actions/evm/fund/fund.ts +1 -1
- package/actions/evm/fund/quoteFund.ts +1 -1
- package/actions/evm/sendUserOperation.ts +9 -1
- package/actions/evm/transfer/transferWithViem.ts +4 -3
- package/auth/utils/hash.ts +13 -0
- package/auth/utils/jwt.ts +21 -24
- package/client/cdp.ts +9 -0
- package/client/evm/evm.ts +2 -2
- package/client/evm/evm.types.ts +1 -1
- package/client/solana/solana.ts +89 -0
- package/client/solana/solana.types.ts +16 -0
- package/constants.ts +18 -0
- package/openapi-client/generated/solana-accounts/solana-accounts.ts +20 -0
- package/package.json +2 -1
- package/version.ts +1 -1
- package/_cjs/client/evm/constants.js +0 -21
- package/_cjs/client/evm/constants.js.map +0 -1
- package/_esm/client/evm/constants.js +0 -18
- package/_esm/client/evm/constants.js.map +0 -1
- package/_types/client/evm/constants.d.ts +0 -5
- package/_types/client/evm/constants.d.ts.map +0 -1
- package/client/evm/constants.ts +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateAccountOptions, ExportAccountOptions, GetAccountOptions, GetOrCreateAccountOptions, ListAccountsOptions, ListAccountsResult, RequestFaucetOptions, SignatureResult, SignMessageOptions, SignTransactionOptions, SolanaClientInterface, UpdateSolanaAccountOptions } from "./solana.types.js";
|
|
1
|
+
import { CreateAccountOptions, ExportAccountOptions, GetAccountOptions, GetOrCreateAccountOptions, ImportAccountOptions, ListAccountsOptions, ListAccountsResult, RequestFaucetOptions, SignatureResult, SignMessageOptions, SignTransactionOptions, SolanaClientInterface, UpdateSolanaAccountOptions } from "./solana.types.js";
|
|
2
2
|
import { SolanaAccount } from "../../accounts/solana/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* The namespace containing all Solana methods.
|
|
@@ -60,6 +60,45 @@ export declare class SolanaClient implements SolanaClientInterface {
|
|
|
60
60
|
* ```
|
|
61
61
|
*/
|
|
62
62
|
exportAccount(options: ExportAccountOptions): Promise<string>;
|
|
63
|
+
/**
|
|
64
|
+
* Imports a Solana account using a private key.
|
|
65
|
+
* The private key will be encrypted before being stored securely.
|
|
66
|
+
*
|
|
67
|
+
* @param {ImportAccountOptions} options - Parameters for importing the Solana account.
|
|
68
|
+
* @param {string} options.privateKey - The private key to import (32 or 64 bytes). Can be a base58 encoded string or raw bytes.
|
|
69
|
+
* @param {string} [options.name] - The name of the account.
|
|
70
|
+
* @param {string} [options.encryptionPublicKey] - The RSA public key for encrypting the private key.
|
|
71
|
+
* @param {string} [options.idempotencyKey] - An idempotency key.
|
|
72
|
+
*
|
|
73
|
+
* @returns A promise that resolves to the imported account.
|
|
74
|
+
*
|
|
75
|
+
* @example **Import with private key only**
|
|
76
|
+
* ```ts
|
|
77
|
+
* const account = await cdp.solana.importAccount({
|
|
78
|
+
* privateKey: "3Kzjw8qSxx8bQkV7EHrVFWYiPyNLbBVxtVe1Q5h2zKZY8DdcuT2dKxyz9kU5vQrP",
|
|
79
|
+
* });
|
|
80
|
+
* ```
|
|
81
|
+
*
|
|
82
|
+
* @example **Import with name**
|
|
83
|
+
* ```ts
|
|
84
|
+
* const account = await cdp.solana.importAccount({
|
|
85
|
+
* privateKey: "3Kzjw8qSxx8bQkV7EHrVFWYiPyNLbBVxtVe1Q5h2zKZY8DdcuT2dKxyz9kU5vQrP",
|
|
86
|
+
* name: "ImportedAccount",
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @example **Import with idempotency key**
|
|
91
|
+
* ```ts
|
|
92
|
+
* const idempotencyKey = uuidv4();
|
|
93
|
+
*
|
|
94
|
+
* const account = await cdp.solana.importAccount({
|
|
95
|
+
* privateKey: "3Kzjw8qSxx8bQkV7EHrVFWYiPyNLbBVxtVe1Q5h2zKZY8DdcuT2dKxyz9kU5vQrP",
|
|
96
|
+
* name: "ImportedAccount",
|
|
97
|
+
* idempotencyKey,
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
importAccount(options: ImportAccountOptions): Promise<SolanaAccount>;
|
|
63
102
|
/**
|
|
64
103
|
* Gets a Solana account by its address.
|
|
65
104
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../client/solana/solana.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"solana.d.ts","sourceRoot":"","sources":["../../../client/solana/solana.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,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C,aAAa,CAAC;CAejF"}
|
|
@@ -3,9 +3,10 @@ import { OpenApiSolanaMethods, UpdateSolanaAccountBody } from "../../openapi-cli
|
|
|
3
3
|
/**
|
|
4
4
|
* The SolanaClient type, where all OpenApiSolanaMethods methods are wrapped.
|
|
5
5
|
*/
|
|
6
|
-
export type SolanaClientInterface = Omit<typeof OpenApiSolanaMethods, "createSolanaAccount" | "getSolanaAccount" | "getSolanaAccountByName" | "updateSolanaAccount" | "listSolanaAccounts" | "requestSolanaFaucet" | "signSolanaMessage" | "signSolanaTransaction" | "updateSolanaAccount" | "exportSolanaAccount" | "exportSolanaAccountByName"> & {
|
|
6
|
+
export type SolanaClientInterface = Omit<typeof OpenApiSolanaMethods, "createSolanaAccount" | "getSolanaAccount" | "getSolanaAccountByName" | "updateSolanaAccount" | "listSolanaAccounts" | "requestSolanaFaucet" | "signSolanaMessage" | "signSolanaTransaction" | "updateSolanaAccount" | "exportSolanaAccount" | "exportSolanaAccountByName" | "importSolanaAccount"> & {
|
|
7
7
|
createAccount: (options: CreateAccountOptions) => Promise<Account>;
|
|
8
8
|
exportAccount: (options: ExportAccountOptions) => Promise<string>;
|
|
9
|
+
importAccount: (options: ImportAccountOptions) => Promise<SolanaAccount>;
|
|
9
10
|
getAccount: (options: GetAccountOptions) => Promise<Account>;
|
|
10
11
|
getOrCreateAccount: (options: GetOrCreateAccountOptions) => Promise<Account>;
|
|
11
12
|
updateAccount: (options: UpdateSolanaAccountOptions) => Promise<Account>;
|
|
@@ -123,4 +124,17 @@ export interface SignTransactionOptions {
|
|
|
123
124
|
/** The idempotency key. */
|
|
124
125
|
idempotencyKey?: string;
|
|
125
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Options for importing a Solana account.
|
|
129
|
+
*/
|
|
130
|
+
export interface ImportAccountOptions {
|
|
131
|
+
/** The public RSA key used to encrypt the private key when importing a Solana account. */
|
|
132
|
+
encryptionPublicKey?: string;
|
|
133
|
+
/** The name of the account. */
|
|
134
|
+
name?: string;
|
|
135
|
+
/** The idempotency key. */
|
|
136
|
+
idempotencyKey?: string;
|
|
137
|
+
/** The private key of the account - can be a base58 encoded string or raw bytes. */
|
|
138
|
+
privateKey: string | Uint8Array;
|
|
139
|
+
}
|
|
126
140
|
//# sourceMappingURL=solana.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana.types.d.ts","sourceRoot":"","sources":["../../../client/solana/solana.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,OAAO,oBAAoB,EACzB,qBAAqB,GACrB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,uBAAuB,GACvB,qBAAqB,GACrB,qBAAqB,GACrB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"solana.types.d.ts","sourceRoot":"","sources":["../../../client/solana/solana.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAE9F;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,OAAO,oBAAoB,EACzB,qBAAqB,GACrB,kBAAkB,GAClB,wBAAwB,GACxB,qBAAqB,GACrB,oBAAoB,GACpB,qBAAqB,GACrB,mBAAmB,GACnB,uBAAuB,GACvB,qBAAqB,GACrB,qBAAqB,GACrB,2BAA2B,GAC3B,qBAAqB,CACxB,GAAG;IACF,aAAa,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,aAAa,EAAE,CAAC,O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AM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,0FAA0F;IAC1F,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2BAA2B;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACjC"}
|
package/_types/constants.d.ts
CHANGED
|
@@ -2,4 +2,8 @@
|
|
|
2
2
|
* The URL to the Coinbase CDP API error docs page.
|
|
3
3
|
*/
|
|
4
4
|
export declare const ERROR_DOCS_PAGE_URL = "https://docs.cdp.coinbase.com/api-v2/docs/errors";
|
|
5
|
+
/**
|
|
6
|
+
* The public RSA key used to encrypt the private key when importing an EVM or Solana account.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ImportAccountPublicRSAKey = "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA2Fxydgm/ryYk0IexQIuL\n9DKyiIk2WmS36AZ83a9Z0QX53qdveg08b05g1Qr+o+COoYOT/FDi8anRGAs7rIyS\nuigrjHR6VrmFjnGrrTr3MINwC9cYQFHwET8YVGRq+BB3iFTB1kIb9XJ/vT2sk1xP\nhJ6JihEwSl4DgbeVjqw59wYqrNg355oa8EdFqkmfGU2tpbM56F8iv1F+shwkGo3y\nGhW/UOQ5OLauXvsqo8ranwsK+lqFblLEMlNtn1VSJeO2vMxryeKFrY2ob8VqGchC\nftPJiLWs2Du6juw4C1rOWwSMlXzZ6cNMHkxdTcEHMr3C2TEHgzjZY41whMwNTB8q\n/pxXnIbH77caaviRs4R/POe8cSsznalXj85LULvFWOIHp0w+jEYSii9Rp9XtHWAH\nnrK/O/SVDtT1ohp2F+Zg1mojTgKfLOyGdOUXTi95naDTuG770rSjHdL80tJBz1Fd\n+1pzGTGXGHLZQLX5YZm5iuy2cebWfF09VjIoCIlDB2++tr4M+O0Z1X1ZE0J5Ackq\nrOluAFalaKynyH3KMyRg+NuLmibu5OmcMjCLK3D4X1YLiN2OK8/bbpEL8JYroDwb\nEXIUW5mGS06YxfSUsxHzL9Tj00+GMm/Gvl0+4/+Vn8IXVHjQOSPNEy3EnqCiH/OW\n8v0IMC32CeGrX7mGbU+MzlsCAwEAAQ==\n-----END PUBLIC KEY-----";
|
|
5
9
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,qDAAqD,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,qDAAqD,CAAC;AAEtF;;GAEG;AACH,eAAO,MAAM,yBAAyB,izBAab,CAAC"}
|
|
@@ -67,6 +67,11 @@ export declare const signSolanaTransaction: (address: string, signSolanaTransact
|
|
|
67
67
|
* @summary Sign a message
|
|
68
68
|
*/
|
|
69
69
|
export declare const signSolanaMessage: (address: string, signSolanaMessageBody: SignSolanaMessageBody, options?: SecondParameter<typeof cdpApiClient>) => Promise<SignSolanaMessage200>;
|
|
70
|
+
export declare const importSolanaAccount: (importSolanaAccountBody: {
|
|
71
|
+
name?: string;
|
|
72
|
+
encryptedPrivateKey: string;
|
|
73
|
+
idempotencyKey?: string;
|
|
74
|
+
}, options?: SecondParameter<typeof cdpApiClient>) => Promise<SolanaAccount>;
|
|
70
75
|
export type ListSolanaAccountsResult = NonNullable<Awaited<ReturnType<typeof listSolanaAccounts>>>;
|
|
71
76
|
export type CreateSolanaAccountResult = NonNullable<Awaited<ReturnType<typeof createSolanaAccount>>>;
|
|
72
77
|
export type GetSolanaAccountResult = NonNullable<Awaited<ReturnType<typeof getSolanaAccount>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"solana-accounts.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/solana-accounts/solana-accounts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,uBAAuB,EACxB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,wBAAwB,EACjC,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,mCAM/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,0BAA0B,uBAAuB,EACjD,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,2BAW/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,SAAS,MAAM,EACf,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,2BAM/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,EACf,yBAAyB,uBAAuB,EAChD,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,2BAW/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GACjC,MAAM,MAAM,EACZ,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,2BAM/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,EACf,yBAAyB,uBAAuB,EAChD,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,oCAW/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,GACpC,MAAM,MAAM,EACZ,+BAA+B,6BAA6B,EAC5D,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,0CAW/C,CAAC;AACF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAChC,SAAS,MAAM,EACf,2BAA2B,yBAAyB,EACpD,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,sCAW/C,CAAC;AACF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,EACf,uBAAuB,qBAAqB,EAC5C,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,kCAW/C,CAAC;
|
|
1
|
+
{"version":3,"file":"solana-accounts.d.ts","sourceRoot":"","sources":["../../../../openapi-client/generated/solana-accounts/solana-accounts.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,aAAa,EACb,uBAAuB,EACxB,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,KAAK,eAAe,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,wBAAwB,EACjC,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,mCAM/C,CAAC;AACF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,0BAA0B,uBAAuB,EACjD,UAAU,eAAe,CAAC,OAAO,YAAY,CAAC,2BAW/C,C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C,CAAC;AACnG,MAAM,MAAM,yBAAyB,GAAG,WAAW,CACjD,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAChD,CAAC;AACF,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC;AAC/F,MAAM,MAAM,yBAAyB,GAAG,WAAW,CACjD,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAChD,CAAC;AACF,MAAM,MAAM,4BAA4B,GAAG,WAAW,CACpD,OAAO,CAAC,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CACnD,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG,WAAW,CACjD,OAAO,CAAC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAChD,CAAC;AACF,MAAM,MAAM,+BAA+B,GAAG,WAAW,CACvD,OAAO,CAAC,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CACtD,CAAC;AACF,MAAM,MAAM,2BAA2B,GAAG,WAAW,CACnD,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAClD,CAAC;AACF,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -30,6 +30,11 @@ export declare const CdpOpenApiClient: {
|
|
|
30
30
|
exportSolanaAccountByName: (name: string, exportSolanaAccountByNameBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ExportSolanaAccountByNameBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ExportSolanaAccountByName200>;
|
|
31
31
|
signSolanaTransaction: (address: string, signSolanaTransactionBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaTransactionBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaTransaction200>;
|
|
32
32
|
signSolanaMessage: (address: string, signSolanaMessageBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaMessageBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaMessage200>;
|
|
33
|
+
importSolanaAccount: (importSolanaAccountBody: {
|
|
34
|
+
name?: string;
|
|
35
|
+
encryptedPrivateKey: string;
|
|
36
|
+
idempotencyKey?: string;
|
|
37
|
+
}, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SolanaAccount>;
|
|
33
38
|
listEvmTokenBalances: (network: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalancesNetwork, address: string, params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalancesParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListEvmTokenBalances200>;
|
|
34
39
|
getEvmSwapPrice: (params: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").GetEvmSwapPriceParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").GetSwapPriceResponseWrapper>;
|
|
35
40
|
createEvmSwapQuote: (createEvmSwapQuoteBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateEvmSwapQuoteBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").CreateSwapQuoteResponseWrapper>;
|
|
@@ -91,6 +96,11 @@ export declare const OpenApiSolanaMethods: {
|
|
|
91
96
|
exportSolanaAccountByName: (name: string, exportSolanaAccountByNameBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ExportSolanaAccountByNameBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ExportSolanaAccountByName200>;
|
|
92
97
|
signSolanaTransaction: (address: string, signSolanaTransactionBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaTransactionBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaTransaction200>;
|
|
93
98
|
signSolanaMessage: (address: string, signSolanaMessageBody: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaMessageBody, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SignSolanaMessage200>;
|
|
99
|
+
importSolanaAccount: (importSolanaAccountBody: {
|
|
100
|
+
name?: string;
|
|
101
|
+
encryptedPrivateKey: string;
|
|
102
|
+
idempotencyKey?: string;
|
|
103
|
+
}, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").SolanaAccount>;
|
|
94
104
|
};
|
|
95
105
|
export declare const OpenApiPoliciesMethods: {
|
|
96
106
|
listPolicies: (params?: import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListPoliciesParams, options?: string | undefined) => Promise<import("./generated/coinbaseDeveloperPlatformAPIs.schemas.js").ListPolicies200>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../openapi-client/index.ts"],"names":[],"mappings":"AAAA,cAAc,sDAAsD,CAAC;AACrE,cAAc,0CAA0C,CAAC;AACzD,cAAc,sDAAsD,CAAC;AACrE,cAAc,oCAAoC,CAAC;AACnD,cAAc,sDAAsD,CAAC;AACrE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4CAA4C,CAAC;AAC3D,cAAc,8CAA8C,CAAC;AAY7D,eAAO,MAAM,gBAAgB;;wBAPH,4BAClB;qBAGyD,4FACxC,EAAC,4BAE1B;iCAsByC,6HAI/B,EAAC,4BAG8B;kCACuX,kBAAqB,EAAC,4BAAiD;yBAAkP,kBAAqB,EAAC,4BAAiD;mBArCpxB,0FAA8B,EAAC,4BACf;mBAIrB,iGAAoC,EAAC,4BAE1B;oBAo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AC,4BAAiD;gCAA8e,YAAe,EAAC,2HAA+D,EAAC,4BAAiD;4BAAk4B,eAAkB,EAAC,mHAAuD,EAAC,4BAAiD;wBAAijB,eAAkB,EAAC,2GAA+C,EAAC,4BAAiD;0BAAuS;YAAsC,CAAC;;sBAA6D,CAAC;KAAa,EAAC,4BAAiD;CAPxsI,CAAC;AAEF,eAAO,MAAM,sBAAsB;mBAhCvB,0FAA8B,EAAC,4BACf;mBAIrB,iGAAoC,EAAC,4BAE1B;oBAoBjB,gBAAgB,EAAC,4BAEJ;mBAQiJ,gBAAgB,EAAC,4BAA+C;mBAAwU,gBAAmB,EAAC,iGAAqC,EAAC,4BAAiD;CAHjpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,gBAAgB,CAAC"}
|
|
@@ -133,11 +133,11 @@ export declare const EvmMessageCriterionSchema: z.ZodObject<{
|
|
|
133
133
|
*/
|
|
134
134
|
match: z.ZodString;
|
|
135
135
|
}, "strip", z.ZodTypeAny, {
|
|
136
|
-
type: "evmMessage";
|
|
137
136
|
match: string;
|
|
138
|
-
}, {
|
|
139
137
|
type: "evmMessage";
|
|
138
|
+
}, {
|
|
140
139
|
match: string;
|
|
140
|
+
type: "evmMessage";
|
|
141
141
|
}>;
|
|
142
142
|
export type EvmMessageCriterion = z.infer<typeof EvmMessageCriterionSchema>;
|
|
143
143
|
/**
|
|
@@ -910,11 +910,11 @@ export declare const SignEvmMessageCriteriaSchema: z.ZodArray<z.ZodDiscriminated
|
|
|
910
910
|
*/
|
|
911
911
|
match: z.ZodString;
|
|
912
912
|
}, "strip", z.ZodTypeAny, {
|
|
913
|
-
type: "evmMessage";
|
|
914
913
|
match: string;
|
|
915
|
-
}, {
|
|
916
914
|
type: "evmMessage";
|
|
915
|
+
}, {
|
|
917
916
|
match: string;
|
|
917
|
+
type: "evmMessage";
|
|
918
918
|
}>]>, "many">;
|
|
919
919
|
/**
|
|
920
920
|
* Type representing a set of criteria for the signEvmMessage operation.
|
|
@@ -1773,25 +1773,25 @@ export declare const SignEvmMessageRuleSchema: z.ZodObject<{
|
|
|
1773
1773
|
*/
|
|
1774
1774
|
match: z.ZodString;
|
|
1775
1775
|
}, "strip", z.ZodTypeAny, {
|
|
1776
|
-
type: "evmMessage";
|
|
1777
1776
|
match: string;
|
|
1778
|
-
}, {
|
|
1779
1777
|
type: "evmMessage";
|
|
1778
|
+
}, {
|
|
1780
1779
|
match: string;
|
|
1780
|
+
type: "evmMessage";
|
|
1781
1781
|
}>]>, "many">;
|
|
1782
1782
|
}, "strip", z.ZodTypeAny, {
|
|
1783
1783
|
action: "reject" | "accept";
|
|
1784
1784
|
operation: "signEvmMessage";
|
|
1785
1785
|
criteria: {
|
|
1786
|
-
type: "evmMessage";
|
|
1787
1786
|
match: string;
|
|
1787
|
+
type: "evmMessage";
|
|
1788
1788
|
}[];
|
|
1789
1789
|
}, {
|
|
1790
1790
|
action: "reject" | "accept";
|
|
1791
1791
|
operation: "signEvmMessage";
|
|
1792
1792
|
criteria: {
|
|
1793
|
-
type: "evmMessage";
|
|
1794
1793
|
match: string;
|
|
1794
|
+
type: "evmMessage";
|
|
1795
1795
|
}[];
|
|
1796
1796
|
}>;
|
|
1797
1797
|
export type SignEvmMessageRule = z.infer<typeof SignEvmMessageRuleSchema>;
|
|
@@ -2745,25 +2745,25 @@ export declare const RuleSchema: z.ZodDiscriminatedUnion<"operation", [z.ZodObje
|
|
|
2745
2745
|
*/
|
|
2746
2746
|
match: z.ZodString;
|
|
2747
2747
|
}, "strip", z.ZodTypeAny, {
|
|
2748
|
-
type: "evmMessage";
|
|
2749
2748
|
match: string;
|
|
2750
|
-
}, {
|
|
2751
2749
|
type: "evmMessage";
|
|
2750
|
+
}, {
|
|
2752
2751
|
match: string;
|
|
2752
|
+
type: "evmMessage";
|
|
2753
2753
|
}>]>, "many">;
|
|
2754
2754
|
}, "strip", z.ZodTypeAny, {
|
|
2755
2755
|
action: "reject" | "accept";
|
|
2756
2756
|
operation: "signEvmMessage";
|
|
2757
2757
|
criteria: {
|
|
2758
|
-
type: "evmMessage";
|
|
2759
2758
|
match: string;
|
|
2759
|
+
type: "evmMessage";
|
|
2760
2760
|
}[];
|
|
2761
2761
|
}, {
|
|
2762
2762
|
action: "reject" | "accept";
|
|
2763
2763
|
operation: "signEvmMessage";
|
|
2764
2764
|
criteria: {
|
|
2765
|
-
type: "evmMessage";
|
|
2766
2765
|
match: string;
|
|
2766
|
+
type: "evmMessage";
|
|
2767
2767
|
}[];
|
|
2768
2768
|
}>, z.ZodObject<{
|
|
2769
2769
|
/**
|
|
@@ -3733,25 +3733,25 @@ export declare const CreatePolicyBodySchema: z.ZodObject<{
|
|
|
3733
3733
|
*/
|
|
3734
3734
|
match: z.ZodString;
|
|
3735
3735
|
}, "strip", z.ZodTypeAny, {
|
|
3736
|
-
type: "evmMessage";
|
|
3737
3736
|
match: string;
|
|
3738
|
-
}, {
|
|
3739
3737
|
type: "evmMessage";
|
|
3738
|
+
}, {
|
|
3740
3739
|
match: string;
|
|
3740
|
+
type: "evmMessage";
|
|
3741
3741
|
}>]>, "many">;
|
|
3742
3742
|
}, "strip", z.ZodTypeAny, {
|
|
3743
3743
|
action: "reject" | "accept";
|
|
3744
3744
|
operation: "signEvmMessage";
|
|
3745
3745
|
criteria: {
|
|
3746
|
-
type: "evmMessage";
|
|
3747
3746
|
match: string;
|
|
3747
|
+
type: "evmMessage";
|
|
3748
3748
|
}[];
|
|
3749
3749
|
}, {
|
|
3750
3750
|
action: "reject" | "accept";
|
|
3751
3751
|
operation: "signEvmMessage";
|
|
3752
3752
|
criteria: {
|
|
3753
|
-
type: "evmMessage";
|
|
3754
3753
|
match: string;
|
|
3754
|
+
type: "evmMessage";
|
|
3755
3755
|
}[];
|
|
3756
3756
|
}>, z.ZodObject<{
|
|
3757
3757
|
/**
|
|
@@ -4309,8 +4309,8 @@ export declare const CreatePolicyBodySchema: z.ZodObject<{
|
|
|
4309
4309
|
action: "reject" | "accept";
|
|
4310
4310
|
operation: "signEvmMessage";
|
|
4311
4311
|
criteria: {
|
|
4312
|
-
type: "evmMessage";
|
|
4313
4312
|
match: string;
|
|
4313
|
+
type: "evmMessage";
|
|
4314
4314
|
}[];
|
|
4315
4315
|
} | {
|
|
4316
4316
|
action: "reject" | "accept";
|
|
@@ -4419,8 +4419,8 @@ export declare const CreatePolicyBodySchema: z.ZodObject<{
|
|
|
4419
4419
|
action: "reject" | "accept";
|
|
4420
4420
|
operation: "signEvmMessage";
|
|
4421
4421
|
criteria: {
|
|
4422
|
-
type: "evmMessage";
|
|
4423
4422
|
match: string;
|
|
4423
|
+
type: "evmMessage";
|
|
4424
4424
|
}[];
|
|
4425
4425
|
} | {
|
|
4426
4426
|
action: "reject" | "accept";
|
|
@@ -4925,25 +4925,25 @@ export declare const UpdatePolicyBodySchema: z.ZodObject<{
|
|
|
4925
4925
|
*/
|
|
4926
4926
|
match: z.ZodString;
|
|
4927
4927
|
}, "strip", z.ZodTypeAny, {
|
|
4928
|
-
type: "evmMessage";
|
|
4929
4928
|
match: string;
|
|
4930
|
-
}, {
|
|
4931
4929
|
type: "evmMessage";
|
|
4930
|
+
}, {
|
|
4932
4931
|
match: string;
|
|
4932
|
+
type: "evmMessage";
|
|
4933
4933
|
}>]>, "many">;
|
|
4934
4934
|
}, "strip", z.ZodTypeAny, {
|
|
4935
4935
|
action: "reject" | "accept";
|
|
4936
4936
|
operation: "signEvmMessage";
|
|
4937
4937
|
criteria: {
|
|
4938
|
-
type: "evmMessage";
|
|
4939
4938
|
match: string;
|
|
4939
|
+
type: "evmMessage";
|
|
4940
4940
|
}[];
|
|
4941
4941
|
}, {
|
|
4942
4942
|
action: "reject" | "accept";
|
|
4943
4943
|
operation: "signEvmMessage";
|
|
4944
4944
|
criteria: {
|
|
4945
|
-
type: "evmMessage";
|
|
4946
4945
|
match: string;
|
|
4946
|
+
type: "evmMessage";
|
|
4947
4947
|
}[];
|
|
4948
4948
|
}>, z.ZodObject<{
|
|
4949
4949
|
/**
|
|
@@ -5500,8 +5500,8 @@ export declare const UpdatePolicyBodySchema: z.ZodObject<{
|
|
|
5500
5500
|
action: "reject" | "accept";
|
|
5501
5501
|
operation: "signEvmMessage";
|
|
5502
5502
|
criteria: {
|
|
5503
|
-
type: "evmMessage";
|
|
5504
5503
|
match: string;
|
|
5504
|
+
type: "evmMessage";
|
|
5505
5505
|
}[];
|
|
5506
5506
|
} | {
|
|
5507
5507
|
action: "reject" | "accept";
|
|
@@ -5609,8 +5609,8 @@ export declare const UpdatePolicyBodySchema: z.ZodObject<{
|
|
|
5609
5609
|
action: "reject" | "accept";
|
|
5610
5610
|
operation: "signEvmMessage";
|
|
5611
5611
|
criteria: {
|
|
5612
|
-
type: "evmMessage";
|
|
5613
5612
|
match: string;
|
|
5613
|
+
type: "evmMessage";
|
|
5614
5614
|
}[];
|
|
5615
5615
|
} | {
|
|
5616
5616
|
action: "reject" | "accept";
|
package/_types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.22.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { KnownEvmNetworks } from "./types.js";
|
|
2
|
+
import type { Chain } from "viem";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Maps a viem chain to a Coinbase network identifier.
|
|
6
|
+
* This function only supports the networks defined in KnownEvmNetworks.
|
|
7
|
+
*
|
|
8
|
+
* @param chain - The viem chain object
|
|
9
|
+
* @returns The Coinbase network identifier, or undefined if the chain is not supported
|
|
10
|
+
*/
|
|
11
|
+
export function mapChainToNetwork(chain: Chain): KnownEvmNetworks | undefined {
|
|
12
|
+
// Map chain IDs to Coinbase network identifiers
|
|
13
|
+
const chainIdToNetwork: Record<number, KnownEvmNetworks> = {
|
|
14
|
+
// Ethereum networks
|
|
15
|
+
1: "ethereum",
|
|
16
|
+
11155111: "ethereum-sepolia",
|
|
17
|
+
17000: "ethereum-hoodi", // Holesky
|
|
18
|
+
|
|
19
|
+
// Base networks
|
|
20
|
+
8453: "base",
|
|
21
|
+
84532: "base-sepolia",
|
|
22
|
+
|
|
23
|
+
// Polygon networks
|
|
24
|
+
137: "polygon",
|
|
25
|
+
80001: "polygon-mumbai",
|
|
26
|
+
|
|
27
|
+
// Arbitrum networks
|
|
28
|
+
42161: "arbitrum",
|
|
29
|
+
421614: "arbitrum-sepolia",
|
|
30
|
+
|
|
31
|
+
// Optimism networks
|
|
32
|
+
10: "optimism",
|
|
33
|
+
11155420: "optimism-sepolia",
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return chainIdToNetwork[chain.id];
|
|
37
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { generateJwt } from "../../auth/utils/jwt.js";
|
|
2
|
+
import { config } from "../../openapi-client/cdpApiClient.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the base node RPC URL for a given network. Can also be used as a Paymaster URL
|
|
6
|
+
*
|
|
7
|
+
* @param network - The network identifier
|
|
8
|
+
* @returns The base node RPC URL or undefined if the network is not supported
|
|
9
|
+
*/
|
|
10
|
+
export async function getBaseNodeRpcUrl(
|
|
11
|
+
network: "base" | "base-sepolia",
|
|
12
|
+
): Promise<string | undefined> {
|
|
13
|
+
if (!config) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
const basePath = config.basePath?.replace("/platform", "");
|
|
19
|
+
|
|
20
|
+
const jwt = await generateJwt({
|
|
21
|
+
apiKeyId: config.apiKeyId,
|
|
22
|
+
apiKeySecret: config.apiKeySecret,
|
|
23
|
+
requestMethod: "GET",
|
|
24
|
+
requestHost: basePath.replace("https://", ""),
|
|
25
|
+
requestPath: "/apikeys/v1/tokens/active",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const response = await fetch(`${basePath}/apikeys/v1/tokens/active`, {
|
|
29
|
+
headers: {
|
|
30
|
+
Authorization: `Bearer ${jwt}`,
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const json = await response.json();
|
|
36
|
+
return `${basePath}/rpc/v1/${network}/${json.id}`;
|
|
37
|
+
} catch {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized configuration for network capabilities.
|
|
3
|
+
* This defines which methods are available on which networks.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Network capabilities configuration.
|
|
8
|
+
* Each network has a set of boolean flags indicating which methods are supported.
|
|
9
|
+
*/
|
|
10
|
+
export const NETWORK_CAPABILITIES = {
|
|
11
|
+
base: {
|
|
12
|
+
listTokenBalances: true,
|
|
13
|
+
requestFaucet: false,
|
|
14
|
+
quoteFund: true,
|
|
15
|
+
fund: true,
|
|
16
|
+
waitForFundOperationReceipt: true,
|
|
17
|
+
transfer: true,
|
|
18
|
+
sendTransaction: true,
|
|
19
|
+
quoteSwap: true,
|
|
20
|
+
swap: true,
|
|
21
|
+
},
|
|
22
|
+
"base-sepolia": {
|
|
23
|
+
listTokenBalances: true,
|
|
24
|
+
requestFaucet: true,
|
|
25
|
+
quoteFund: false,
|
|
26
|
+
fund: false,
|
|
27
|
+
waitForFundOperationReceipt: false,
|
|
28
|
+
transfer: true,
|
|
29
|
+
sendTransaction: true,
|
|
30
|
+
quoteSwap: false,
|
|
31
|
+
swap: false,
|
|
32
|
+
},
|
|
33
|
+
ethereum: {
|
|
34
|
+
listTokenBalances: true,
|
|
35
|
+
requestFaucet: false,
|
|
36
|
+
quoteFund: false, // Only base is supported for quoteFund
|
|
37
|
+
fund: false, // Only base is supported for fund
|
|
38
|
+
waitForFundOperationReceipt: false,
|
|
39
|
+
transfer: true,
|
|
40
|
+
sendTransaction: true,
|
|
41
|
+
quoteSwap: true,
|
|
42
|
+
swap: true,
|
|
43
|
+
},
|
|
44
|
+
"ethereum-sepolia": {
|
|
45
|
+
listTokenBalances: false,
|
|
46
|
+
requestFaucet: true,
|
|
47
|
+
quoteFund: false,
|
|
48
|
+
fund: false,
|
|
49
|
+
waitForFundOperationReceipt: false,
|
|
50
|
+
transfer: true,
|
|
51
|
+
sendTransaction: true,
|
|
52
|
+
quoteSwap: false,
|
|
53
|
+
swap: false,
|
|
54
|
+
},
|
|
55
|
+
"ethereum-hoodi": {
|
|
56
|
+
listTokenBalances: false,
|
|
57
|
+
requestFaucet: true,
|
|
58
|
+
quoteFund: false,
|
|
59
|
+
fund: false,
|
|
60
|
+
waitForFundOperationReceipt: false,
|
|
61
|
+
transfer: false,
|
|
62
|
+
sendTransaction: true, // Always available (uses wallet client for non-base networks)
|
|
63
|
+
quoteSwap: false,
|
|
64
|
+
swap: false,
|
|
65
|
+
},
|
|
66
|
+
} as const;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Type for a network name from the capabilities configuration
|
|
70
|
+
*/
|
|
71
|
+
export type NetworkName = keyof typeof NETWORK_CAPABILITIES;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Type for method names
|
|
75
|
+
*/
|
|
76
|
+
export type MethodName = keyof (typeof NETWORK_CAPABILITIES)[NetworkName];
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Helper to get networks that support a specific method
|
|
80
|
+
*
|
|
81
|
+
* @param method - The method name to check support for
|
|
82
|
+
* @returns An array of network names that support the method
|
|
83
|
+
*/
|
|
84
|
+
export function getNetworksSupportingMethod(method: MethodName): NetworkName[] {
|
|
85
|
+
return (Object.keys(NETWORK_CAPABILITIES) as NetworkName[]).filter(
|
|
86
|
+
network => NETWORK_CAPABILITIES[network][method],
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Helper to check if a network supports a method
|
|
92
|
+
*
|
|
93
|
+
* @param method - The method name to check
|
|
94
|
+
* @param network - The network name to check
|
|
95
|
+
* @returns True if the network supports the method, false otherwise
|
|
96
|
+
*/
|
|
97
|
+
export function isMethodSupportedOnNetwork(method: MethodName, network: string): boolean {
|
|
98
|
+
const networkConfig = NETWORK_CAPABILITIES[network as NetworkName];
|
|
99
|
+
return networkConfig ? networkConfig[method] : false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Type helper to extract networks supporting a specific method
|
|
104
|
+
*/
|
|
105
|
+
export type NetworksSupporting<M extends MethodName> = {
|
|
106
|
+
[N in NetworkName]: (typeof NETWORK_CAPABILITIES)[N][M] extends true ? N : never;
|
|
107
|
+
}[NetworkName];
|
|
108
|
+
|
|
109
|
+
// Export specific network types for each method
|
|
110
|
+
export type ListTokenBalancesNetworks = NetworksSupporting<"listTokenBalances">;
|
|
111
|
+
export type RequestFaucetNetworks = NetworksSupporting<"requestFaucet">;
|
|
112
|
+
export type QuoteFundNetworks = NetworksSupporting<"quoteFund">;
|
|
113
|
+
export type FundNetworks = NetworksSupporting<"fund">;
|
|
114
|
+
export type TransferNetworks = NetworksSupporting<"transfer">;
|
|
115
|
+
export type SendTransactionNetworks = NetworksSupporting<"sendTransaction">;
|
|
116
|
+
export type QuoteSwapNetworks = NetworksSupporting<"quoteSwap">;
|
|
117
|
+
export type SwapNetworks = NetworksSupporting<"swap">;
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
import { toAccount } from "viem/accounts";
|
|
12
12
|
import * as chains from "viem/chains";
|
|
13
13
|
|
|
14
|
-
import {
|
|
15
|
-
import { config } from "../../openapi-client/cdpApiClient.js";
|
|
14
|
+
import { getBaseNodeRpcUrl } from "./getBaseNodeRpcUrl.js";
|
|
16
15
|
|
|
17
16
|
import type { EvmAccount } from "./types.js";
|
|
18
17
|
|
|
@@ -135,42 +134,6 @@ export type ResolvedViemClients = {
|
|
|
135
134
|
walletClient: WalletClient<Transport, Chain, Account>;
|
|
136
135
|
};
|
|
137
136
|
|
|
138
|
-
/**
|
|
139
|
-
* Get the base node RPC URL for a given network
|
|
140
|
-
*
|
|
141
|
-
* @param network - The network identifier
|
|
142
|
-
* @returns The base node RPC URL or undefined if the network is not supported
|
|
143
|
-
*/
|
|
144
|
-
async function getBaseNodeRpcUrl(network: "base" | "base-sepolia"): Promise<string | undefined> {
|
|
145
|
-
if (!config) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
try {
|
|
150
|
-
const basePath = config.basePath?.replace("/platform", "");
|
|
151
|
-
|
|
152
|
-
const jwt = await generateJwt({
|
|
153
|
-
apiKeyId: config.apiKeyId,
|
|
154
|
-
apiKeySecret: config.apiKeySecret,
|
|
155
|
-
requestMethod: "GET",
|
|
156
|
-
requestHost: basePath.replace("https://", ""),
|
|
157
|
-
requestPath: "/apikeys/v1/tokens/active",
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
const response = await fetch(`${basePath}/apikeys/v1/tokens/active`, {
|
|
161
|
-
headers: {
|
|
162
|
-
Authorization: `Bearer ${jwt}`,
|
|
163
|
-
"Content-Type": "application/json",
|
|
164
|
-
},
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
const json = await response.json();
|
|
168
|
-
return `${basePath}/rpc/v1/${network}/${json.id}`;
|
|
169
|
-
} catch {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
137
|
/**
|
|
175
138
|
* Resolves viem clients based on a network identifier or Node URL.
|
|
176
139
|
*
|
|
@@ -33,7 +33,7 @@ import { sendSwapTransaction } from "../../actions/evm/swap/sendSwapTransaction.
|
|
|
33
33
|
import { accountTransferStrategy } from "../../actions/evm/transfer/accountTransferStrategy.js";
|
|
34
34
|
import { transfer } from "../../actions/evm/transfer/transfer.js";
|
|
35
35
|
|
|
36
|
-
import type { EvmServerAccount } from "./types.js";
|
|
36
|
+
import type { EvmServerAccount, NetworkOrRpcUrl } from "./types.js";
|
|
37
37
|
import type {
|
|
38
38
|
SendTransactionOptions,
|
|
39
39
|
TransactionResult,
|
|
@@ -169,8 +169,8 @@ export function toEvmServerAccount(
|
|
|
169
169
|
name: options.account.name,
|
|
170
170
|
type: "evm-server",
|
|
171
171
|
policies: options.account.policies,
|
|
172
|
-
useNetwork: async (networkOrRpcUrl:
|
|
173
|
-
return toNetworkScopedEvmServerAccount(
|
|
172
|
+
useNetwork: async <Network extends NetworkOrRpcUrl>(networkOrRpcUrl: Network) => {
|
|
173
|
+
return toNetworkScopedEvmServerAccount({
|
|
174
174
|
account,
|
|
175
175
|
network: networkOrRpcUrl,
|
|
176
176
|
});
|