@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
446 lines (430 loc) • 28.9 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.sendSolanaAssetWithEndUserAccount = exports.sendSolanaTransactionWithEndUserAccount = exports.signSolanaX402PaymentWithEndUserAccount = exports.signSolanaTransactionWithEndUserAccount = exports.signSolanaMessageWithEndUserAccount = exports.closeBorrowPositionWithEndUserAccount = exports.adjustBorrowPositionWithEndUserAccount = exports.createBorrowPositionWithEndUserAccount = exports.listBorrowPositionsWithEndUserAccount = exports.sendUserOperationWithEndUserAccount = exports.getUserOperationWithEndUserAccount = exports.createEvmEip7702DelegationWithEndUserAccount = exports.revokeDelegationForEndUserAccount = exports.revokeDelegationForEndUserAccountDeprecated = exports.getDelegationForEndUserAccount = exports.createDelegationForEndUserAccount = exports.revokeDelegationForEndUser = exports.revokeDelegationForEndUserDeprecated = exports.getDelegationForEndUser = exports.signEvmTypedDataWithEndUserAccount = exports.signEvmMessageWithEndUserAccount = exports.sendEvmAssetWithEndUserAccount = exports.sendEvmTransactionWithEndUserAccount = exports.signEvmTransactionWithEndUserAccount = exports.getEvmBorrowProduct = exports.listEvmBorrowProducts = void 0;
const cdpApiClient_js_1 = require("../../cdpApiClient.js");
/**
* Lists the borrow products available across all supported networks and protocols. If a network and/or protocol query parameter is supplied, then borrow products are filtered and returned accordingly.
A borrow product is a protocol-native representation of a borrowable market, describing the venue that hosts it, the assets that can be borrowed or posted as collateral, and their collateral and debt capabilities. For example, a Morpho Blue market that lends USDC against cbBTC.
* @summary List borrow products
*/
const listEvmBorrowProducts = (params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/embedded-wallet-api/evm/borrow-products`, method: "GET", params }, options);
};
exports.listEvmBorrowProducts = listEvmBorrowProducts;
/**
* Gets a single borrow product by its ID.
The ID is a stable identifier that uniquely identifies a single borrow product based on the product's onchain parameters. A borrow product is a protocol-native representation of a borrowable market, describing the venue that hosts it and the assets that participate in it together with their collateral and debt capabilities.
* @summary Get a borrow product
*/
const getEvmBorrowProduct = (borrowProductId, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/evm/borrow-products/${borrowProductId}`,
method: "GET",
params,
}, options);
};
exports.getEvmBorrowProduct = getEvmBorrowProduct;
/**
* Signs a transaction with the given end user EVM account.
The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md). The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
* @summary Sign transaction via end user EVM account
*/
const signEvmTransactionWithEndUserAccount = (userId, signEvmTransactionWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/sign/transaction`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: signEvmTransactionWithEndUserAccountBody,
params,
}, options);
};
exports.signEvmTransactionWithEndUserAccount = signEvmTransactionWithEndUserAccount;
/**
* Signs a transaction with the given end user EVM account and sends it to the indicated supported network. This API handles nonce management and gas estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction. The transaction should be serialized as a hex string using [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/).
The transaction must be an [EIP-1559 dynamic fee transaction](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1559.md).
**Transaction fields and API behavior**
- `to` *(Required)*: The address of the contract or account to send the transaction to.
- `chainId` *(Ignored)*: The value of the `chainId` field in the transaction is ignored.
The transaction will be sent to the network indicated by the `network` field in the request body.
- `nonce` *(Optional)*: The nonce to use for the transaction. If not provided, the API will assign
a nonce to the transaction based on the current state of the account.
- `maxPriorityFeePerGas` *(Optional)*: The maximum priority fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `maxFeePerGas` *(Optional)*: The maximum fee per gas to use for the transaction.
If not provided, the API will estimate a value based on current network conditions.
- `gasLimit` *(Optional)*: The gas limit to use for the transaction. If not provided, the API will estimate a value
based on the `to` and `data` fields of the transaction.
- `value` *(Optional)*: The amount of ETH, in wei, to send with the transaction.
- `data` *(Optional)*: The data to send with the transaction; only used for contract calls.
- `accessList` *(Optional)*: The access list to use for the transaction.
* @summary Send transaction via end user EVM account
*/
const sendEvmTransactionWithEndUserAccount = (userId, sendEvmTransactionWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/send/transaction`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: sendEvmTransactionWithEndUserAccountBody,
params,
}, options);
};
exports.sendEvmTransactionWithEndUserAccount = sendEvmTransactionWithEndUserAccount;
/**
* Sends USDC from an end user's EVM account (EOA or Smart Account) to a recipient address on a supported EVM network. This endpoint simplifies USDC transfers by automatically handling contract resolution, decimal conversion, gas estimation, and transaction encoding.
The `amount` field accepts human-readable amounts as decimal strings (e.g., "1.5", "25.50").
* @summary Send USDC on EVM
*/
const sendEvmAssetWithEndUserAccount = (userId, address, asset, sendEvmAssetWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/${address}/send/${asset}`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: sendEvmAssetWithEndUserAccountBody,
params,
}, options);
};
exports.sendEvmAssetWithEndUserAccount = sendEvmAssetWithEndUserAccount;
/**
* Signs an [EIP-191](https://eips.ethereum.org/EIPS/eip-191) message with the given end user EVM account.
Per the specification, the message in the request body is prepended with `0x19 <0x45 (E)> <thereum Signed Message:\n" + len(message)>` before being signed.
* @summary Sign EIP-191 message via end user EVM account
*/
const signEvmMessageWithEndUserAccount = (userId, signEvmMessageWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/sign/message`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: signEvmMessageWithEndUserAccountBody,
params,
}, options);
};
exports.signEvmMessageWithEndUserAccount = signEvmMessageWithEndUserAccount;
/**
* Signs [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data with the given end user EVM account.
* @summary Sign EIP-712 typed data via end user EVM account
*/
const signEvmTypedDataWithEndUserAccount = (userId, signEvmTypedDataWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/sign/typed-data`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: signEvmTypedDataWithEndUserAccountBody,
params,
}, options);
};
exports.signEvmTypedDataWithEndUserAccount = signEvmTypedDataWithEndUserAccount;
/**
* Returns the active delegation for the specified end user, if one exists. This operation can be performed by the end user themselves or by a developer using their API key.
* @summary Get delegation for end user
*/
const getDelegationForEndUser = (userId, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/embedded-wallet-api/end-users/${userId}/delegation`, method: "GET", params }, options);
};
exports.getDelegationForEndUser = getDelegationForEndUser;
/**
* > **Deprecation Notice:** Prefer
> [Revoke delegation for end user](#operation/revokeDelegationForEndUser)
> (`POST /v2/embedded-wallet-api/end-users/{userId}/delegation/revoke`), which takes the
> same request body. This `DELETE` path will be removed on **2026-10-22**.
Revokes all active delegations for the specified end user. This operation
can be performed by the end user themselves or by a developer using their
API key.
* @deprecated
* @summary Revoke delegation for end user (deprecated)
*/
const revokeDelegationForEndUserDeprecated = (userId, revokeDelegationRequest, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/delegation`,
method: "DELETE",
headers: { "Content-Type": "application/json" },
data: revokeDelegationRequest,
params,
}, options);
};
exports.revokeDelegationForEndUserDeprecated = revokeDelegationForEndUserDeprecated;
/**
* Revokes all active delegations for the specified end user. This operation can be performed by the end user themselves or by a developer using their API key.
* @summary Revoke delegation for end user
*/
const revokeDelegationForEndUser = (userId, revokeDelegationRequest, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/delegation/revoke`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: revokeDelegationRequest,
params,
}, options);
};
exports.revokeDelegationForEndUser = revokeDelegationForEndUser;
/**
* Creates an account-scoped delegation that allows a developer to sign on behalf of an end user for a single blockchain account (identified by its address) for the specified duration. The end user must be authenticated to authorize this delegation.
Multiple account-scoped delegations may exist concurrently for a single end user (one per canonical account address). Account-scoped and user-scoped delegations cannot coexist for the same user.
When the address corresponds to an EVM Smart Account, the delegation is scoped to the Smart Account's owner EOA rather than the Smart Account address itself. This means `/address/{smartAccountAddress}/delegation` and `/address/{ownerEoaAddress}/delegation` resolve to the same delegation, and the 409 `account_scoped_delegation_active` error may be returned when creating via either address if one already exists for the canonical owner.
* @summary Create account-scoped delegation for end user
*/
const createDelegationForEndUserAccount = (userId, address, createDelegationForEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/address/${address}/delegation`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createDelegationForEndUserAccountBody,
params,
}, options);
};
exports.createDelegationForEndUserAccount = createDelegationForEndUserAccount;
/**
* Returns the active account-scoped delegation for the specified end user account, if one exists. Useful for showing delegation status in a UI.
When the address corresponds to an EVM Smart Account, this returns the delegation for the Smart Account's owner EOA.
* @summary Get account-scoped delegation for end user
*/
const getDelegationForEndUserAccount = (userId, address, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/address/${address}/delegation`,
method: "GET",
params,
}, options);
};
exports.getDelegationForEndUserAccount = getDelegationForEndUserAccount;
/**
* > **Deprecation Notice:** Prefer
> [Revoke account-scoped delegation for end user](#operation/revokeDelegationForEndUserAccount)
> (`POST /v2/embedded-wallet-api/end-users/{userId}/address/{address}/delegation/revoke`),
> which takes the same request body. This `DELETE` path will be removed on **2026-10-22**.
Revokes the active account-scoped delegation for the specified end user account.
Other account-scoped delegations for the same user are unaffected. This operation
can be performed by the end user themselves or by a developer using their API key.
When the address corresponds to an EVM Smart Account, this revokes the delegation for the
Smart Account's owner EOA.
* @deprecated
* @summary Revoke account-scoped delegation for end user (deprecated)
*/
const revokeDelegationForEndUserAccountDeprecated = (userId, address, revokeDelegationRequest, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/address/${address}/delegation`,
method: "DELETE",
headers: { "Content-Type": "application/json" },
data: revokeDelegationRequest,
params,
}, options);
};
exports.revokeDelegationForEndUserAccountDeprecated = revokeDelegationForEndUserAccountDeprecated;
/**
* Revokes the active account-scoped delegation for the specified end user account. Other account-scoped delegations for the same user are unaffected. This operation can be performed by the end user themselves or by a developer using their API key.
When the address corresponds to an EVM Smart Account, this revokes the delegation for the Smart Account's owner EOA.
* @summary Revoke account-scoped delegation for end user
*/
const revokeDelegationForEndUserAccount = (userId, address, revokeDelegationRequest, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/address/${address}/delegation/revoke`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: revokeDelegationRequest,
params,
}, options);
};
exports.revokeDelegationForEndUserAccount = revokeDelegationForEndUserAccount;
/**
* Creates an EIP-7702 delegation for an end user's EVM EOA account, upgrading it with smart account capabilities.
This endpoint:
- Retrieves delegation artifacts from onchain
- Signs the EIP-7702 authorization for delegation
- Assembles and submits a Type 4 transaction
- Creates an associated smart account object
The delegation allows the EVM EOA to be used as a smart account, which enables batched transactions and gas sponsorship via paymaster.
* @summary Create EIP-7702 delegation for end user EVM account
*/
const createEvmEip7702DelegationWithEndUserAccount = (userId, createEvmEip7702DelegationWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/eip7702/delegation`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createEvmEip7702DelegationWithEndUserAccountBody,
params,
}, options);
};
exports.createEvmEip7702DelegationWithEndUserAccount = createEvmEip7702DelegationWithEndUserAccount;
/**
* Gets a user operation by its hash for an end user's EVM Smart Account.
* @summary Get a user operation for end user EVM Smart Account
*/
const getUserOperationWithEndUserAccount = (userId, address, userOpHash, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/smart-accounts/${address}/user-operations/${userOpHash}`,
method: "GET",
params,
}, options);
};
exports.getUserOperationWithEndUserAccount = getUserOperationWithEndUserAccount;
/**
* Prepares, signs, and sends a user operation for an end user's Smart Account.
* @summary Send user operation for end user Smart Account
*/
const sendUserOperationWithEndUserAccount = (userId, address, sendUserOperationWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/smart-accounts/${address}/send`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: sendUserOperationWithEndUserAccountBody,
params,
}, options);
};
exports.sendUserOperationWithEndUserAccount = sendUserOperationWithEndUserAccount;
/**
* Lists the borrow positions held by an end user smart account, with the live onchain state of each position read at a point-in-time snapshot.
A borrow position represents collateral posted and a loan borrowed against it in a borrow product, such as a Morpho Blue market that lends USDC against cbBTC. Each position reports its current collateral and debt balances, its health factor, and its health status. Returns an empty list if the smart account has no borrow positions.
* @summary List borrow positions for an end user smart account
*/
const listBorrowPositionsWithEndUserAccount = (userId, address, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/smart-accounts/${address}/borrow-positions`,
method: "GET",
params,
}, options);
};
exports.listBorrowPositionsWithEndUserAccount = listBorrowPositionsWithEndUserAccount;
/**
* Creates a borrow position for a specific borrow product, by posting collateral from an end user smart account and borrowing a loan against it. One position can be opened per borrow product for a given smart account.
A borrow product is a protocol-native representation of a borrowable market, such as a Morpho Blue market that lends USDC against cbBTC. The `borrowProductId` identifies the product to borrow against, and the `collateralAmount` and `loanAmount` specify the collateral to post and the loan to take, both expressed as decimal strings in standard unit denomination of their respective tokens.
A user operation is broadcast to open the position onchain. Poll `getUserOperationWithEndUserAccount` with the returned `userOpHash` until it reaches a terminal state. Once the user operation succeeds onchain, use the borrow positions list endpoint to view the user's active positions.
* @summary Create a borrow position for an end user smart account
*/
const createBorrowPositionWithEndUserAccount = (userId, address, createBorrowPositionRequest, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/smart-accounts/${address}/borrow-positions`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createBorrowPositionRequest,
params,
}, options);
};
exports.createBorrowPositionWithEndUserAccount = createBorrowPositionWithEndUserAccount;
/**
* Adjusts an existing borrow position for a specific borrow product by supplying collateral, withdrawing collateral, repaying debt, and/or borrowing more of the loan asset from an end user smart account.
The `borrowProductId` identifies the product whose position to adjust, and the `addCollateralAmount`, `removeCollateralAmount`, `repayLoanAmount`, and `borrowLoanAmount` fields specify the changes to apply, each expressed as a decimal string in standard unit denomination of the respective token.
A single request must not combine `addCollateralAmount` with `removeCollateralAmount` or `repayLoanAmount`, and must not combine `borrowLoanAmount` with `repayLoanAmount` or `removeCollateralAmount`. Otherwise any subset of the four amount fields may be supplied; at least one is required.
A user operation is broadcast to adjust the position onchain. Poll `getUserOperationWithEndUserAccount` with the returned `userOpHash` until it reaches a terminal state. Once the user operation succeeds onchain, use the borrow positions list endpoint to view the user's adjusted positions.
* @summary Adjust a borrow position for an end user smart account
*/
const adjustBorrowPositionWithEndUserAccount = (userId, address, adjustBorrowPositionRequest, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/smart-accounts/${address}/borrow-positions/adjust`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: adjustBorrowPositionRequest,
params,
}, options);
};
exports.adjustBorrowPositionWithEndUserAccount = adjustBorrowPositionWithEndUserAccount;
/**
* Closes an end user smart account's borrow position by fully repaying its outstanding loan and withdrawing all remaining collateral back to the smart account, in a single user operation.
A borrow position is identified by the smart account `address` and the `borrowProductId` in the request body, since a smart account holds at most one position per borrow product. Closing repays the entire accrued debt and withdraws the full collateral balance; there is no partial close. To adjust a position without closing it, use `adjustBorrowPositionWithEndUserAccount` instead.
A user operation is broadcast to close the position onchain. Poll `getUserOperationWithEndUserAccount` with the returned `userOpHash` until it reaches a terminal state. Once the user operation succeeds onchain, the position is closed and no longer appears in the borrow positions list.
* @summary Close a borrow position for an end user smart account
*/
const closeBorrowPositionWithEndUserAccount = (userId, address, closeBorrowPositionRequest, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/evm/smart-accounts/${address}/borrow-positions/close`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: closeBorrowPositionRequest,
params,
}, options);
};
exports.closeBorrowPositionWithEndUserAccount = closeBorrowPositionWithEndUserAccount;
/**
* Signs an arbitrary Base64 encoded message with the given Solana account.
**WARNING:** Never sign a message that you didn't generate as it may put your funds at risk.
* @summary Sign Base64-encoded message
*/
const signSolanaMessageWithEndUserAccount = (userId, signSolanaMessageWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/sign/message`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: signSolanaMessageWithEndUserAccountBody,
params,
}, options);
};
exports.signSolanaMessageWithEndUserAccount = signSolanaMessageWithEndUserAccount;
/**
* Signs a transaction with the given end user Solana account.
The unsigned transaction should be serialized into a byte array and then encoded as base64.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana-labs.github.io/solana-web3.js/classes/Transaction.html)
* [Versioned transactions](https://solana-labs.github.io/solana-web3.js/classes/VersionedTransaction.html)
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
* @summary Sign transaction via end user Solana account
*/
const signSolanaTransactionWithEndUserAccount = (userId, signSolanaTransactionWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/sign/transaction`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: signSolanaTransactionWithEndUserAccountBody,
params,
}, options);
};
exports.signSolanaTransactionWithEndUserAccount = signSolanaTransactionWithEndUserAccount;
/**
* Signs an x402 payment payload using the end user's given Solana account.
Accepts the full x402 payment required response body from a resource server plus an index into the accepts array selecting which payment option to sign. The paymentRequired envelope's x402Version, resource, and extensions are carried through into the signed payment payload; only the selected accept entry becomes paymentPayload.accepted.
Returns a signed payment payload that can be base64-encoded and sent in the PAYMENT-SIGNATURE header of the resource request.
If acceptsIndex is out of range for paymentRequired.accepts, or the selected accept is not a Solana network payment option, the request fails with 422.
* @summary Sign x402 payment via end user Solana account
*/
const signSolanaX402PaymentWithEndUserAccount = (userId, signSolanaX402PaymentWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/sign/x402-payment`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: signSolanaX402PaymentWithEndUserAccountBody,
params,
}, options);
};
exports.signSolanaX402PaymentWithEndUserAccount = signSolanaX402PaymentWithEndUserAccount;
/**
* Signs a transaction with the given end user Solana account and sends it to the indicated supported network.
The API handles recent blockhash management and fee estimation, leaving the developer to provide only the minimal set of fields necessary to send the transaction.
The unsigned transaction should be serialized into a byte array and then encoded as base64.
**Transaction types**
The following transaction types are supported:
* [Legacy transactions](https://solana.com/developers/guides/advanced/versions#current-transaction-versions)
* [Versioned transactions](https://solana.com/developers/guides/advanced/versions)
**Instruction Batching**
To batch multiple operations, include multiple instructions within a single transaction. All instructions within a transaction are executed atomically - if any instruction fails, the entire transaction fails and is rolled back.
**Network Support**
The following Solana networks are supported:
* `solana` - Solana Mainnet
* `solana-devnet` - Solana Devnet
The developer is responsible for ensuring that the unsigned transaction is valid, as the API will not validate the transaction.
* @summary Send transaction via end user Solana account
*/
const sendSolanaTransactionWithEndUserAccount = (userId, sendSolanaTransactionWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/send/transaction`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: sendSolanaTransactionWithEndUserAccountBody,
params,
}, options);
};
exports.sendSolanaTransactionWithEndUserAccount = sendSolanaTransactionWithEndUserAccount;
/**
* Sends USDC from an end user's Solana account to a recipient address on the Solana network. This endpoint simplifies USDC transfers by automatically handling mint resolution, Associated Token Account (ATA) creation, decimal conversion, and transaction encoding.
The `amount` field accepts human-readable amounts as decimal strings (e.g., "1.5", "25.50").
Use the optional `createRecipientAta` parameter to control whether the sender pays for creating the recipient's Associated Token Account if it doesn't exist.
* @summary Send USDC on Solana
*/
const sendSolanaAssetWithEndUserAccount = (userId, address, asset, sendSolanaAssetWithEndUserAccountBody, params, options) => {
return (0, cdpApiClient_js_1.cdpApiClient)({
url: `/v2/embedded-wallet-api/end-users/${userId}/solana/${address}/send/${asset}`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: sendSolanaAssetWithEndUserAccountBody,
params,
}, options);
};
exports.sendSolanaAssetWithEndUserAccount = sendSolanaAssetWithEndUserAccount;
//# sourceMappingURL=end-user-accounts.js.map