relayer-sdk
v1.0.1
Published
mvp relayer package
Downloads
1
Readme
Steps to integrate the package :
1. Create new relayer instance.
2. Install the ethers package to create instance of your wallet.
3. First prepare the data to be passed in Relayer instance.
4. Pass the data to the processTxn method of Relayer instance.
import Relayer from "relayer-sdk";
import ethers from "ethers";
const client = new Relayer({
apiKey:"123",
})
randomWallet = <your wallet instance> // set up your wallet instance
let walletNew = randomWallet.address // your wallet address
let callData0 = "0x40c10f19000000000000000000000000" + walletNew.slice(2, 42) + "00000000000000000000000000000000000000000000001b1ae4d6e2ef500000" // call data to mint 500 tokens on gather network
const data = {
nonce: await token.nonces(walletNew), // create the token instance first to get nonce
verifyingAddress: "0x7173228F7ae6c7e72BDB02c360072c1931426078",
chainId: "356256156"
}
const message = await ethers.utils.solidityKeccak256(["uint256", "address", "uint256", "bytes"], [data.nonce, data.verifyingAddress, data.chainId, callData0])
const messageHash = await ethers.utils.arrayify(message)
const sig = await randomWallet.signMessage(messageHash);
const params: any = {
callData: callData0,
signature: sig,
message: message,
payable: "0",
userAddress: walletNew
}
client.processTxn(params).then(((response) => {
console.log("response - ", response)
}))