Adapter

zkSync Transaction Fees

zkSync Lite is a ZK-Rollup that supports transfers of any token

Sub-Adapters 1

Preview and test each sub adapter.

zkSync Lite (zksync-v1)

Metadata

ID
zksync-v1
icon
category

"l2"

name

"zkSync Lite"

description

"zkSync Lite is a ZK-Rollup that supports transfers of any token"

l2BeatSlug

"zksync-lite"

website

"https://zksync.io"

Queries

Adapter Code

Check the entire code written for the Adapter.

Source code

Showing TS source.
1export const name = 'zkSync Transaction Fees';
2export const version = '0.1.2';
3export const license = 'MIT';
4
5export function setup(sdk: Context) {
6  const getFeeForTransfer = async () => {
7    const feeData = await sdk.http.post('https://api.zksync.io/jsrpc', {
8      jsonrpc: '2.0',
9      id: 1,
10      method: 'get_tx_fee',
11      params: ['Transfer', '0x4353b45f148b9a095c015a8afe42b46af2c94757', 'DAI'],
12    });
13
14    return feeData.result.totalFee / 1e18;
15  };
16
17  const getFeeForSwap = async () => {
18    const feeData = await sdk.http.post('https://api.zksync.io/api/v0.2/fee', {
19      txType: 'Swap',
20      address: '0x88d23a44d07f86b2342b4b06bd88b1ea313b6976',
21      tokenLike: 'USDC',
22    });
23
24    return feeData.result.totalFee / 1e6;
25  }
26
27  sdk.register({
28    id: 'zksync-v1',
29    queries: {
30      feeTransferEth: getFeeForTransfer,
31      feeTransferERC20: getFeeForTransfer,
32      feeSwap: getFeeForSwap,
33    },
34    metadata: {
35      icon: sdk.ipfs.getDataURILoader('QmXeCkZTkG8nuNAMbNykxfu1ybJHyDsu8EgVJ7RKuza5WA', 'image/svg+xml'),
36      category: 'l2',
37      name: 'zkSync Lite',
38      description: 'zkSync Lite is a ZK-Rollup that supports transfers of any token',
39      l2BeatSlug: 'zksync-lite',
40      website: 'https://zksync.io',
41    },
42  });
43}

It's something off?

Report it to the discussion board on Discord, we will take care of it.

Adapter Info

Version

0.1.2

License

MIT

IPFS CID

Qmc4FP8n9b2dR5v8pwKtyzgAMWA96ramRXg5kXaHsho9B7

CID (source)

QmdsascHGtnbydMVMteS19VtqygLwmnGDFKdreKtpeqppr

Collections

Author

9tails.eth