Skip to content

zkSync Lite - paying for a transfer with a different fee token #618

Answered by JackHamer09
jtolio asked this question in SDKs
Discussion options

You must be logged in to vote

Regarding transfer and paying fee in a different token:

This basically means making 2 transfers in a batch, where one of the transaction is your main transfer with 0 fee, and the other one is 0 amount transfer to yourself with fee token of your choice.

import { Wallet, getDefaultRestProvider, submitSignedTransactionsBatch, closestPackableTransactionFee } from "zksync";
import { BatchBuilder } from "zksync/build/batch-builder";

const provider = getDefaultRestProvider(network);
const wallet = Wallet.fromEthSigner(ethWallet, syncProvider);

// Transfer data
const transfer = {
  to: "0x...",
  token: "Storj",
  amount: "10000"
}
const feeTokenSymbol = "ETH";

// Getting batch transaction fee
l…

Replies: 2 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
9 replies
@bxpana
Comment options

@jtolio
Comment options

@JackHamer09
Comment options

Answer selected by bxpana
@jtolio
Comment options

@bxpana
Comment options

@jtolio
Comment options

@jtolio
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
SDKs
Labels
zksync-lite Discussions related to zkSync Lite (v1.0)
3 participants