@chainsafe/gts-client-dev
v1.0.0-dev.3
Published
ChainSafe Gasless Transaction as a Service client
Downloads
19
Readme
Gasless Transaction as a Service - Client
GTS javascript client to send meta transaction using user smart contract wallet.
Install
npm install gts-client-dev
yarn add gts-client-dev
Usage
import { GTS } from "gts-client-dev";
// Log in to GTS
const gts = new GTS("username", "password");
await gts.init();
// Add user to the whitelist
await gts.whitelist("USER_EOA");
// Get user smart contract wallet address
const wallet = await gts.userWallet("USER_EOA");
// Build GnosisSafe transaction (e.g. ERC20 transfer)
const safeTx = gts.buildSafeTx(
"transfer",
erc20ABI,
tokenAddress,
["TO_ADDRESS", "1000000000000000000"], // params: transfer(recipient, amount)
0, // value,
2500000, // gas limit
1000000000, // gas price
provider,
signer,
wallet, // user smart contract wallet address
);
// Send transaction
const tx = await gts.sendTx(safeTx);
console.log(tx.hash);
const receipt = await tx.wait();
console.log(receipt);
Build & Publish
yarn install
yarn build
yarn publish