L
L
Loopring Dev Docs
Search…
⌃K

Fees

Each Loopring L2 transaction requires a fee to be paid (L2 transactions are packed, batched, and submitted to Ethereum L1 which has a gas fee).
As the gasPrice changes, the fee is changed every 15 minutes.

Pay Fee ERC20 Token :

  • Mainnet: ETH、LRC、USDT、USDC、DAI
  • GOERLI: ETH、LRC、USDT、DAI
Loopring has 2 get Fee APIs:
  • getOffchainFeeAmt:
    • ORDER,
    • FFCHAIN_WITHDRAWAL,
    • UPDATE_ACCOUNT,
    • TRANSFER,
    • FAST_OFFCHAIN_WITHDRAWAL,
    • OPEN_ACCOUNT,
    • AMM_EXIT,
    • DEPOSIT,
    • AMM_JOIN,
  • getNFTOffchainFeeAmt:
    • NFT_MINT,
    • NFT_WITHDRAWAL,
    • NFT_TRANSFER,
    • NFT_DEPLOY,

Fee: updateAccount

// Step 1. get account info
console.log(LoopringAPI.exchangeAPI.getAccount);
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getOffchainFeeAmt(
{
accountId: accInfo.accountId,
requestType: sdk.OffchainFeeReqType.UPDATE_ACCOUNT,
},
apiKey
);
console.log("updateAccount:", response);

Fee: transfer

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getOffchainFeeAmt(
{
accountId: accInfo.accountId,
requestType: sdk.OffchainFeeReqType.TRANSFER,
},
apiKey
);
console.log("transfer:", response);

Fee: withdraw

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getOffchainFeeAmt(
{
accountId: accInfo.accountId,
tokenSymbol: TOKEN_INFO.tokenMap.LRC.symbol,
requestType: sdk.OffchainFeeReqType.OFFCHAIN_WITHDRAWAL,
},
apiKey
);
console.log("withdraw:", response);

Fee: fastWithdraw

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getOffchainFeeAmt(
{
accountId: accInfo.accountId,
requestType: sdk.OffchainFeeReqType.FAST_OFFCHAIN_WITHDRAWAL,
tokenSymbol: TOKEN_INFO.tokenMap.LRC.symbol,
},
apiKey
);
console.log("fastWithdraw:", response);

Fee: order

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getOffchainFeeAmt(
{
accountId: accInfo.accountId,
requestType: sdk.OffchainFeeReqType.ORDER,
tokenSymbol: TOKEN_INFO.tokenMap.LRC.symbol,
},
apiKey
);
console.log("order:", response);

Fee: amm_exit

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getOffchainFeeAmt(
{
accountId: accInfo.accountId,
requestType: sdk.OffchainFeeReqType.AMM_EXIT,
},
apiKey
);
console.log("amm_exit:", response);

Fee: amm_join

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getOffchainFeeAmt(
{
accountId: accInfo.accountId,
requestType: sdk.OffchainFeeReqType.AMM_JOIN,
},
apiKey
);
console.log("amm_join:", response);

Fee: NFTTransfer

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getNFTOffchainFeeAmt(
{
accountId: accInfo.accountId,
requestType: sdk.OffchainNFTFeeReqType.NFT_TRANSFER,
},
apiKey
);
console.log("NFTTransfer:", response);

Fee: NFTWithdrawal

// Step 1. get account info
const {accInfo} = await LoopringAPI.exchangeAPI.getAccount({
owner: LOOPRING_EXPORTED_ACCOUNT.address,
});
console.log("accInfo:", accInfo);
// Step 2. eddsaKey
const eddsaKey = await signatureKeyPairMock(accInfo);
console.log("eddsaKey:", eddsaKey.sk);
// Step 3. get apikey
const {apiKey} = await LoopringAPI.userAPI.getUserApiKey(
{
accountId: accInfo.accountId,
},
eddsaKey.sk
);
console.log("apiKey:", apiKey);
return {accInfo, eddsaKey, apiKey};
const response = await LoopringAPI.userAPI.getNFTOffchainFeeAmt(
{
accountId: accInfo.accountId,
tokenAddress: LOOPRING_EXPORTED_ACCOUNT.nftTokenAddress,
requestType: sdk.OffchainNFTFeeReqType.NFT_WITHDRAWAL,
},
apiKey
);
console.log("NFTWithdrawal:", response);

getActiveFeeInfo without apikey & accountId

const response = await LoopringAPI.globalAPI.getActiveFeeInfo({});

getActiveFeeInfo without apikey with accountId

const response = await LoopringAPI.globalAPI.getActiveFeeInfo({ accountId: LOOPRING_EXPORTED_ACCOUNT.accountId });