Wallet Integration
Overview
Ramper supports many standardized methods, including: signMessage
, signTransaction
, sendTransaction
, sendToken
Example
import {
sendToken,
sendTransaction,
signMessage,
signTransaction,
} from "@ramper-v2/multi";
import { CHAIN } from "@ramper-v2/core";
...
// Initialize Chain
const chain = CHAIN.VICION;
// Sign Message
const handleSignMessage = async () => {
const result = await signMessage({
message: abc,
chain,
});
};
// Sign Transaction
const handleSignTransaction = async () => {
// Please use your own nonce and estimateGas function
const nonce = await getNonce(publicKey);
const gasLimit = await estimateGas({
to: receiver,
value: //,
});
const transaction = {
from: publicKey,
data: "0x",
gasLimit: gasLimit.toString(),
nonce,
to: receiver,
value: amount,
};
const result = await signTransaction({
transaction,
chain,
});
};
// Send Transaction
const handleSendTransaction = async () => {
// Please use your own nonce and estimateGas function
const nonce = await getNonce(publicKey);
const gasLimit = await estimateGas({
to: receiver,
value: amount,
});
const transaction = {
from: publicKey,
data: "0x",
gasLimit: gasLimit.toString(),
nonce,
to: receiver,
value: amount,
};
const result = await sendTransaction({
transaction,
chain,
});
};
// Send Token
const handleSendToken = async () => {
const result = await sendToken({
transaction: {
from: publicKey,
to: receiver,
value: amount,
},
symbol: "c98",
chain,
});
};
Last updated