@coinbase/cdp-sdk 1.4.0 → 1.6.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 +20 -0
- package/README.md +123 -2
- package/_cjs/accounts/evm/toEvmServerAccount.js +26 -0
- package/_cjs/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_cjs/accounts/evm/toEvmSmartAccount.js +35 -2
- package/_cjs/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_cjs/actions/evm/listTokenBalances.js +33 -0
- package/_cjs/actions/evm/listTokenBalances.js.map +1 -0
- package/_cjs/actions/evm/requestFaucet.js +18 -0
- package/_cjs/actions/evm/requestFaucet.js.map +1 -0
- package/_cjs/actions/evm/sendTransaction.js +29 -0
- package/_cjs/actions/evm/sendTransaction.js.map +1 -0
- package/_cjs/actions/evm/sendUserOperation.js +5 -6
- package/_cjs/actions/evm/sendUserOperation.js.map +1 -1
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js +72 -0
- package/_cjs/actions/evm/transfer/accountTransferStrategy.js.map +1 -0
- package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js +67 -0
- package/_cjs/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -0
- package/_cjs/actions/evm/transfer/transfer.js +59 -0
- package/_cjs/actions/evm/transfer/transfer.js.map +1 -0
- package/_cjs/actions/evm/transfer/types.js +3 -0
- package/_cjs/actions/evm/transfer/types.js.map +1 -0
- package/_cjs/actions/evm/transfer/utils.js +39 -0
- package/_cjs/actions/evm/transfer/utils.js.map +1 -0
- package/_cjs/actions/evm/types.js +3 -0
- package/_cjs/actions/evm/types.js.map +1 -0
- package/_cjs/client/evm/evm.js +52 -42
- package/_cjs/client/evm/evm.js.map +1 -1
- package/_cjs/client/solana/solana.js +42 -0
- package/_cjs/client/solana/solana.js.map +1 -1
- package/_cjs/utils/serializeTransaction.js +18 -0
- package/_cjs/utils/serializeTransaction.js.map +1 -0
- package/_cjs/version.js +1 -1
- package/_esm/accounts/evm/toEvmServerAccount.js +26 -0
- package/_esm/accounts/evm/toEvmServerAccount.js.map +1 -1
- package/_esm/accounts/evm/toEvmSmartAccount.js +35 -2
- package/_esm/accounts/evm/toEvmSmartAccount.js.map +1 -1
- package/_esm/actions/evm/listTokenBalances.js +30 -0
- package/_esm/actions/evm/listTokenBalances.js.map +1 -0
- package/_esm/actions/evm/requestFaucet.js +15 -0
- package/_esm/actions/evm/requestFaucet.js.map +1 -0
- package/_esm/actions/evm/sendTransaction.js +26 -0
- package/_esm/actions/evm/sendTransaction.js.map +1 -0
- package/_esm/actions/evm/sendUserOperation.js +5 -6
- package/_esm/actions/evm/sendUserOperation.js.map +1 -1
- package/_esm/actions/evm/transfer/accountTransferStrategy.js +69 -0
- package/_esm/actions/evm/transfer/accountTransferStrategy.js.map +1 -0
- package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js +64 -0
- package/_esm/actions/evm/transfer/smartAccountTransferStrategy.js.map +1 -0
- package/_esm/actions/evm/transfer/transfer.js +56 -0
- package/_esm/actions/evm/transfer/transfer.js.map +1 -0
- package/_esm/actions/evm/transfer/types.js +2 -0
- package/_esm/actions/evm/transfer/types.js.map +1 -0
- package/_esm/actions/evm/transfer/utils.js +35 -0
- package/_esm/actions/evm/transfer/utils.js.map +1 -0
- package/_esm/actions/evm/types.js +2 -0
- package/_esm/actions/evm/types.js.map +1 -0
- package/_esm/client/evm/evm.js +52 -42
- package/_esm/client/evm/evm.js.map +1 -1
- package/_esm/client/solana/solana.js +42 -0
- package/_esm/client/solana/solana.js.map +1 -1
- package/_esm/utils/serializeTransaction.js +15 -0
- package/_esm/utils/serializeTransaction.js.map +1 -0
- package/_esm/version.js +1 -1
- package/_types/accounts/evm/toEvmServerAccount.d.ts +2 -2
- package/_types/accounts/evm/toEvmServerAccount.d.ts.map +1 -1
- package/_types/accounts/evm/toEvmSmartAccount.d.ts +4 -4
- package/_types/accounts/evm/toEvmSmartAccount.d.ts.map +1 -1
- package/_types/accounts/types.d.ts +4 -3
- package/_types/accounts/types.d.ts.map +1 -1
- package/_types/actions/evm/listTokenBalances.d.ts +76 -0
- package/_types/actions/evm/listTokenBalances.d.ts.map +1 -0
- package/_types/actions/evm/requestFaucet.d.ts +34 -0
- package/_types/actions/evm/requestFaucet.d.ts.map +1 -0
- package/_types/actions/evm/sendTransaction.d.ts +42 -0
- package/_types/actions/evm/sendTransaction.d.ts.map +1 -0
- package/_types/actions/evm/sendUserOperation.d.ts +3 -2
- package/_types/actions/evm/sendUserOperation.d.ts.map +1 -1
- package/_types/actions/evm/transfer/accountTransferStrategy.d.ts +4 -0
- package/_types/actions/evm/transfer/accountTransferStrategy.d.ts.map +1 -0
- package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts +4 -0
- package/_types/actions/evm/transfer/smartAccountTransferStrategy.d.ts.map +1 -0
- package/_types/actions/evm/transfer/transfer.d.ts +14 -0
- package/_types/actions/evm/transfer/transfer.d.ts.map +1 -0
- package/_types/actions/evm/transfer/types.d.ts +71 -0
- package/_types/actions/evm/transfer/types.d.ts.map +1 -0
- package/_types/actions/evm/transfer/utils.d.ts +631 -0
- package/_types/actions/evm/transfer/utils.d.ts.map +1 -0
- package/_types/actions/evm/types.d.ts +230 -0
- package/_types/actions/evm/types.d.ts.map +1 -0
- package/_types/client/evm/evm.d.ts +22 -3
- package/_types/client/evm/evm.d.ts.map +1 -1
- package/_types/client/evm/evm.types.d.ts +20 -137
- package/_types/client/evm/evm.types.d.ts.map +1 -1
- package/_types/client/solana/solana.d.ts +17 -1
- package/_types/client/solana/solana.d.ts.map +1 -1
- package/_types/client/solana/solana.types.d.ts +8 -0
- package/_types/client/solana/solana.types.d.ts.map +1 -1
- package/_types/utils/serializeTransaction.d.ts +9 -0
- package/_types/utils/serializeTransaction.d.ts.map +1 -0
- package/_types/version.d.ts +1 -1
- package/accounts/evm/toEvmServerAccount.ts +46 -6
- package/accounts/evm/toEvmSmartAccount.ts +68 -4
- package/accounts/types.ts +20 -16
- package/actions/evm/listTokenBalances.ts +107 -0
- package/actions/evm/requestFaucet.ts +46 -0
- package/actions/evm/sendTransaction.ts +73 -0
- package/actions/evm/sendUserOperation.ts +6 -6
- package/actions/evm/transfer/accountTransferStrategy.ts +84 -0
- package/actions/evm/transfer/smartAccountTransferStrategy.ts +72 -0
- package/actions/evm/transfer/transfer.ts +71 -0
- package/actions/evm/transfer/types.ts +81 -0
- package/actions/evm/transfer/utils.ts +39 -0
- package/actions/evm/types.ts +244 -0
- package/client/evm/evm.ts +70 -63
- package/client/evm/evm.types.ts +32 -149
- package/client/solana/solana.ts +43 -0
- package/client/solana/solana.types.ts +9 -0
- package/package.json +1 -1
- package/utils/serializeTransaction.ts +17 -0
- package/version.ts +1 -1
package/client/evm/evm.types.ts
CHANGED
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
EvmAccount as Account,
|
|
3
3
|
EvmServerAccount as ServerAccount,
|
|
4
4
|
EvmSmartAccount as SmartAccount,
|
|
5
5
|
} from "../../accounts/types.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import type {
|
|
7
|
+
ListTokenBalancesOptions,
|
|
8
|
+
ListTokenBalancesResult,
|
|
9
|
+
} from "../../actions/evm/listTokenBalances.js";
|
|
10
|
+
import type { RequestFaucetOptions, RequestFaucetResult } from "../../actions/evm/requestFaucet.js";
|
|
11
|
+
import type {
|
|
12
|
+
TransactionResult,
|
|
13
|
+
SendTransactionOptions,
|
|
14
|
+
} from "../../actions/evm/sendTransaction.js";
|
|
15
|
+
import type {
|
|
16
|
+
SendUserOperationOptions,
|
|
17
|
+
SendUserOperationReturnType,
|
|
18
|
+
} from "../../actions/evm/sendUserOperation.js";
|
|
19
|
+
import type { Actions } from "../../actions/evm/types.js";
|
|
20
|
+
import type {
|
|
8
21
|
EvmUserOperationNetwork,
|
|
9
22
|
EvmUserOperationStatus,
|
|
10
23
|
OpenApiEvmMethods,
|
|
11
|
-
ListEvmTokenBalancesNetwork,
|
|
12
|
-
SendEvmTransactionBodyNetwork,
|
|
13
24
|
} from "../../openapi-client/index.js";
|
|
14
|
-
import {
|
|
15
|
-
import { Address, Hex
|
|
16
|
-
import { WaitOptions } from "../../utils/wait.js";
|
|
25
|
+
import type { Calls } from "../../types/calls.js";
|
|
26
|
+
import type { Address, Hex } from "../../types/misc.js";
|
|
27
|
+
import type { WaitOptions } from "../../utils/wait.js";
|
|
17
28
|
|
|
18
29
|
/**
|
|
19
30
|
* The EvmClient type, where all OpenApiEvmMethods methods are wrapped.
|
|
@@ -41,6 +52,7 @@ export type EvmClientInterface = Omit<
|
|
|
41
52
|
createSmartAccount: (options: CreateSmartAccountOptions) => Promise<SmartAccount>;
|
|
42
53
|
getAccount: (options: GetServerAccountOptions) => Promise<ServerAccount>;
|
|
43
54
|
getSmartAccount: (options: GetSmartAccountOptions) => Promise<SmartAccount>;
|
|
55
|
+
getOrCreateAccount: (options: GetOrCreateServerAccountOptions) => Promise<ServerAccount>;
|
|
44
56
|
getUserOperation: (options: GetUserOperationOptions) => Promise<UserOperation>;
|
|
45
57
|
listAccounts: (options: ListServerAccountsOptions) => Promise<ListServerAccountResult>;
|
|
46
58
|
listSmartAccounts: (options: ListSmartAccountsOptions) => Promise<ListSmartAccountResult>;
|
|
@@ -48,7 +60,9 @@ export type EvmClientInterface = Omit<
|
|
|
48
60
|
prepareUserOperation: (options: PrepareUserOperationOptions) => Promise<UserOperation>;
|
|
49
61
|
requestFaucet: (options: RequestFaucetOptions) => Promise<RequestFaucetResult>;
|
|
50
62
|
sendTransaction: (options: SendTransactionOptions) => Promise<TransactionResult>;
|
|
51
|
-
sendUserOperation: (
|
|
63
|
+
sendUserOperation: (
|
|
64
|
+
options: SendUserOperationOptions<unknown[]>,
|
|
65
|
+
) => Promise<SendUserOperationReturnType>;
|
|
52
66
|
signHash: (options: SignHashOptions) => Promise<SignatureResult>;
|
|
53
67
|
signMessage: (options: SignMessageOptions) => Promise<SignatureResult>;
|
|
54
68
|
signTransaction: (options: SignTransactionOptions) => Promise<SignatureResult>;
|
|
@@ -146,6 +160,14 @@ export interface GetSmartAccountOptions {
|
|
|
146
160
|
owner: Account;
|
|
147
161
|
}
|
|
148
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Options for getting an EVM account, or creating one if it doesn't exist.
|
|
165
|
+
*/
|
|
166
|
+
export interface GetOrCreateServerAccountOptions {
|
|
167
|
+
/** The name of the account. */
|
|
168
|
+
name: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
149
171
|
/**
|
|
150
172
|
* Options for listing EVM accounts.
|
|
151
173
|
*/
|
|
@@ -159,7 +181,7 @@ export interface ListServerAccountsOptions {
|
|
|
159
181
|
/**
|
|
160
182
|
* A smart account that only contains the owner address.
|
|
161
183
|
*/
|
|
162
|
-
export interface ReadonlySmartAccount extends Omit<SmartAccount, "owners"> {
|
|
184
|
+
export interface ReadonlySmartAccount extends Omit<SmartAccount, "owners" | keyof Actions> {
|
|
163
185
|
/** The owners of the smart account. */
|
|
164
186
|
owners: Address[];
|
|
165
187
|
}
|
|
@@ -212,67 +234,6 @@ export interface CreateSmartAccountOptions {
|
|
|
212
234
|
idempotencyKey?: string;
|
|
213
235
|
}
|
|
214
236
|
|
|
215
|
-
/**
|
|
216
|
-
* Options for requesting funds from an EVM faucet.
|
|
217
|
-
*/
|
|
218
|
-
export interface RequestFaucetOptions {
|
|
219
|
-
/** The address of the account. */
|
|
220
|
-
address: string;
|
|
221
|
-
/** The network to request funds from. */
|
|
222
|
-
network: "base-sepolia" | "ethereum-sepolia";
|
|
223
|
-
/** The token to request funds for. */
|
|
224
|
-
token: "eth" | "usdc" | "eurc" | "cbbtc";
|
|
225
|
-
/** The idempotency key. */
|
|
226
|
-
idempotencyKey?: string;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* The result of requesting funds from an EVM faucet.
|
|
231
|
-
*/
|
|
232
|
-
export interface RequestFaucetResult {
|
|
233
|
-
/** The transaction hash. */
|
|
234
|
-
transactionHash: Hex;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
/**
|
|
238
|
-
* Options for sending an EVM transaction.
|
|
239
|
-
*/
|
|
240
|
-
export interface SendTransactionOptions {
|
|
241
|
-
/** The address of the account. */
|
|
242
|
-
address: Address;
|
|
243
|
-
/**
|
|
244
|
-
* The transaction to send. The chainId is ignored in favor of the `network` field.
|
|
245
|
-
*
|
|
246
|
-
* This can be either:
|
|
247
|
-
* - An RLP-encoded transaction to sign and send, as a 0x-prefixed hex string, or
|
|
248
|
-
* - An EIP-1559 transaction request object.
|
|
249
|
-
*/
|
|
250
|
-
transaction: Hex | TransactionRequestEIP1559;
|
|
251
|
-
/**
|
|
252
|
-
* The network to send the transaction to.
|
|
253
|
-
* The chainId in the `transaction` field is ignored in favor of this field.
|
|
254
|
-
*/
|
|
255
|
-
network: SendEvmTransactionBodyNetwork;
|
|
256
|
-
/** The idempotency key. */
|
|
257
|
-
idempotencyKey?: string;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
/**
|
|
261
|
-
* Options for sending a user operation.
|
|
262
|
-
*/
|
|
263
|
-
export interface SendUserOperationOptions {
|
|
264
|
-
/** The smart account. */
|
|
265
|
-
smartAccount: SmartAccount;
|
|
266
|
-
/** The network. */
|
|
267
|
-
network: EvmUserOperationNetwork;
|
|
268
|
-
/** The calls. */
|
|
269
|
-
calls: Call[];
|
|
270
|
-
/** The paymaster URL. */
|
|
271
|
-
paymasterUrl?: string;
|
|
272
|
-
/** The idempotency key. */
|
|
273
|
-
idempotencyKey?: string;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
237
|
/**
|
|
277
238
|
* Options for signing an EVM hash.
|
|
278
239
|
*/
|
|
@@ -317,14 +278,6 @@ export interface SignatureResult {
|
|
|
317
278
|
signature: Hex;
|
|
318
279
|
}
|
|
319
280
|
|
|
320
|
-
/**
|
|
321
|
-
* Result of a transaction
|
|
322
|
-
*/
|
|
323
|
-
export interface TransactionResult {
|
|
324
|
-
/** The hash of the transaction. */
|
|
325
|
-
transactionHash: Hex;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
281
|
/**
|
|
329
282
|
* Options for waiting for a user operation.
|
|
330
283
|
*/
|
|
@@ -336,73 +289,3 @@ export interface WaitForUserOperationOptions {
|
|
|
336
289
|
/** The wait options. */
|
|
337
290
|
waitOptions?: WaitOptions;
|
|
338
291
|
}
|
|
339
|
-
|
|
340
|
-
/**
|
|
341
|
-
* Options for listing EVM token balances.
|
|
342
|
-
*/
|
|
343
|
-
export interface ListTokenBalancesOptions {
|
|
344
|
-
/** The address of the account. */
|
|
345
|
-
address: Address;
|
|
346
|
-
/** The network. */
|
|
347
|
-
network: ListEvmTokenBalancesNetwork;
|
|
348
|
-
/** The page size to paginate through the token balances. */
|
|
349
|
-
pageSize?: number;
|
|
350
|
-
/** The page token to paginate through the token balances. */
|
|
351
|
-
pageToken?: string;
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
/**
|
|
355
|
-
* A token on an EVM network, which is either an ERC-20 or a native token (i.e. ETH).
|
|
356
|
-
*/
|
|
357
|
-
export interface EvmToken {
|
|
358
|
-
/**
|
|
359
|
-
* The contract address of the token. For Ether, the contract address is 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
|
|
360
|
-
* per EIP-7528. For ERC-20 tokens, this is the contract address where the token is deployed.
|
|
361
|
-
*/
|
|
362
|
-
contractAddress: Address;
|
|
363
|
-
/** The network the token is on. */
|
|
364
|
-
network: ListEvmTokenBalancesNetwork;
|
|
365
|
-
/**
|
|
366
|
-
* The symbol of the token, which is optional and non-unique. Note: This field
|
|
367
|
-
* may not be present for most tokens while the API is still under development.
|
|
368
|
-
*/
|
|
369
|
-
symbol?: string;
|
|
370
|
-
/**
|
|
371
|
-
* The name of the token, which is optional and non-unique. Note: This field
|
|
372
|
-
* may not be present for most tokens while the API is still under development.
|
|
373
|
-
*/
|
|
374
|
-
name?: string;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* A token amount on an EVM network.
|
|
379
|
-
*/
|
|
380
|
-
export interface EvmTokenAmount {
|
|
381
|
-
/** The amount of the token in the smallest indivisible unit of the token. */
|
|
382
|
-
amount: bigint;
|
|
383
|
-
/** The number of decimals in the token. */
|
|
384
|
-
decimals: bigint;
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
/**
|
|
388
|
-
* An EVM token balance.
|
|
389
|
-
*/
|
|
390
|
-
export interface EvmTokenBalance {
|
|
391
|
-
/** The token. */
|
|
392
|
-
token: EvmToken;
|
|
393
|
-
/** The amount of the token. */
|
|
394
|
-
amount: EvmTokenAmount;
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
/**
|
|
398
|
-
* The result of listing EVM token balances.
|
|
399
|
-
*/
|
|
400
|
-
export interface ListTokenBalancesResult {
|
|
401
|
-
/** The token balances. */
|
|
402
|
-
balances: EvmTokenBalance[];
|
|
403
|
-
/**
|
|
404
|
-
* The next page token to paginate through the token balances.
|
|
405
|
-
* If undefined, there are no more token balances to paginate through.
|
|
406
|
-
*/
|
|
407
|
-
nextPageToken?: string;
|
|
408
|
-
}
|
package/client/solana/solana.ts
CHANGED
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
SignatureResult,
|
|
10
10
|
SignMessageOptions,
|
|
11
11
|
SignTransactionOptions,
|
|
12
|
+
GetOrCreateAccountOptions,
|
|
12
13
|
} from "./solana.types.js";
|
|
14
|
+
import { APIError } from "../../openapi-client/errors.js";
|
|
13
15
|
import { CdpOpenApiClient } from "../../openapi-client/index.js";
|
|
14
16
|
|
|
15
17
|
/**
|
|
@@ -87,6 +89,47 @@ export class SolanaClient implements SolanaClientInterface {
|
|
|
87
89
|
throw new Error("Either address or name must be provided");
|
|
88
90
|
}
|
|
89
91
|
|
|
92
|
+
/**
|
|
93
|
+
* Gets a Solana account by its address.
|
|
94
|
+
*
|
|
95
|
+
* @param {GetOrCreateAccountOptions} options - Parameters for getting or creating the Solana account.
|
|
96
|
+
* @param {string} options.name - The name of the account.
|
|
97
|
+
*
|
|
98
|
+
* @returns A promise that resolves to the account.
|
|
99
|
+
*
|
|
100
|
+
* @example
|
|
101
|
+
* ```ts
|
|
102
|
+
* const account = await cdp.solana.getOrCreateAccount({
|
|
103
|
+
* name: "MyAccount",
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
async getOrCreateAccount(options: GetOrCreateAccountOptions): Promise<Account> {
|
|
108
|
+
try {
|
|
109
|
+
const account = await this.getAccount(options);
|
|
110
|
+
return account;
|
|
111
|
+
} catch (error) {
|
|
112
|
+
// If it failed because the account doesn't exist, create it
|
|
113
|
+
const doesAccountNotExist = error instanceof APIError && error.statusCode === 404;
|
|
114
|
+
if (doesAccountNotExist) {
|
|
115
|
+
try {
|
|
116
|
+
const account = await this.createAccount(options);
|
|
117
|
+
return account;
|
|
118
|
+
} catch (error) {
|
|
119
|
+
// If it failed because the account already exists, throw an error
|
|
120
|
+
const doesAccountAlreadyExist = error instanceof APIError && error.statusCode === 409;
|
|
121
|
+
if (doesAccountAlreadyExist) {
|
|
122
|
+
const account = await this.getAccount(options);
|
|
123
|
+
return account;
|
|
124
|
+
}
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
90
133
|
/**
|
|
91
134
|
* Lists all Solana accounts.
|
|
92
135
|
*
|
|
@@ -17,6 +17,7 @@ export type SolanaClientInterface = Omit<
|
|
|
17
17
|
> & {
|
|
18
18
|
createAccount: (options: CreateAccountOptions) => Promise<Account>;
|
|
19
19
|
getAccount: (options: GetAccountOptions) => Promise<Account>;
|
|
20
|
+
getOrCreateAccount: (options: GetOrCreateAccountOptions) => Promise<Account>;
|
|
20
21
|
listAccounts: (options: ListAccountsOptions) => Promise<ListAccountsResult>;
|
|
21
22
|
requestFaucet: (options: RequestFaucetOptions) => Promise<SignatureResult>;
|
|
22
23
|
signMessage: (options: SignMessageOptions) => Promise<SignatureResult>;
|
|
@@ -47,6 +48,14 @@ export interface GetAccountOptions {
|
|
|
47
48
|
name?: string;
|
|
48
49
|
}
|
|
49
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Options for getting a Solana account.
|
|
53
|
+
*/
|
|
54
|
+
export interface GetOrCreateAccountOptions {
|
|
55
|
+
/** The name of the account. */
|
|
56
|
+
name: string;
|
|
57
|
+
}
|
|
58
|
+
|
|
50
59
|
/**
|
|
51
60
|
* Options for listing Solana accounts.
|
|
52
61
|
*/
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { serializeTransaction } from "viem";
|
|
2
|
+
|
|
3
|
+
import { TransactionRequestEIP1559 } from "../types/misc.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Serializes a transaction for the Coinbase API.
|
|
7
|
+
*
|
|
8
|
+
* @param transaction - The transaction to serialize.
|
|
9
|
+
* @returns The serialized transaction.
|
|
10
|
+
*/
|
|
11
|
+
export function serializeEIP1559Transaction(transaction: TransactionRequestEIP1559) {
|
|
12
|
+
return serializeTransaction({
|
|
13
|
+
...transaction,
|
|
14
|
+
chainId: 1, // ignored by Coinbase API
|
|
15
|
+
type: "eip1559",
|
|
16
|
+
});
|
|
17
|
+
}
|
package/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = "1.
|
|
1
|
+
export const version = "1.6.0";
|