Transactions
Send Token
Currently, Ramper SDK supports sendToken which is a simple way to send a token to another address from the current logged in wallet.
const sendToken = async (params: Partial<{
from: string
to: string
value: string
decimal: number
symbol: string
network: string
theme: string
}>) => Promise<boolean>Example Usage:
import { sendToken } from '@ramper/ethereum'
await sendToken({
to: '0xa419dfa199Df8651c3f4476546AF5E4CC4E0F73F',
value: '0.00001',
network: 'mainnet'
})RamperSigner
Ramper SDK allows you to request a signed transaction from the user for subsequent broadcasting to the network. Ramper SDK is built around Ether.js and Alchemy but if you'd like to see Ramper SDK support other use cases, let us know on Discord, or email us at [email protected]. In order to broadcast a transaction, you must first set up an Alchemy Provider.
After the user is logged in through Ramper SDK, you can set up a RamperSigner object with the alchemy provider that will eventually collect the user's authorization to sign the requested transaction.
Sign Transaction
Example usage:
Send Transaction
Example usage:
Sign Message
Example usage:
Sign TypedData
Example usage:
eip712.ts
Send Token
Currently, Ramper Connect SDK supports sendToken which is a simple way to send a token to another address from the current logged in wallet.
Example Usage:
Custom Transactions
Ramper Connect SDK supports custom Near transactions by supporting interactions with near-api-js. You can find an overview of near-api-js here and their TypeDocs here.
You can find a list of supported actions here.
The result type is below. You can see more details about the FinalExecutionOutcome here.
Note. If you sign in with NEAR Wallet, you can get transaction hashes only.
Sign Transaction
You can sign a transaction with signTransaction from the current logged in wallet. It is same as signer.signMessage of near-api-js. Look at the code here.
Example Usage:
Sign Message
You can sign a message with signMessage from the current logged in wallet. It is same as signer.signMessage of near-api-js. Look at the code here.
Example Usage:
Send Token
Currently, Ramper Connect SDK supports sendToken which is a simple way to send a token to another address from the current logged in wallet.
status and connectedWallet are used in case you want to support with Terra Station and Wallet Connect.
Example Usage:
Custom Transactions
Ramper Connect SDK supports all the custom transaction all the custom transactions that Terra Station supports with the post method. Provide the same txOption that is commonly used in Terra.js createAndSignTx method - more details can be found here: https://terra-money.github.io/terra.js/.
Error Handling
Use a try/catch block to detect if the user canceled the transaction or the transaction failed to be broadcasted successfully.
Last updated