Deposit
⏱️ 2 min read
Overview
Method 1: Using the API
Implementation
const vaultAddress = 'CAQ6PAG4X6L7LJVGOKSQ6RU2LADWK4EQXRJGMUWL7SECS7LXUEQLM5U7';
async function deposit(
amount: number,
user: string,
apiClient: ApiClient,
signerFunction: (tx: string) => string
) {
// Step 1: Request an unsigned transaction from the API
const { xdr: unsignedTx } = await apiClient.postData("deposit", vaultAddress, {
amounts: [amount],
from: user
});
// Step 2: Sign the transaction (implement your own signer)
const signedTx = signerFunction(unsignedTx);
// Step 3: Send the signed transaction back to the API
const response = await apiClient.postData("send", vaultAddress, {
xdr: signedTx
});
return response;
}API Request Parameters
Method 2: Direct Smart Contract Interaction
Rust Contract Function
Parameters
Implementation Example
Return Values
Last updated