Withdraw ERC20
Withdraw ERC20 from Loopring L2 to Ethereum L1
Withdrawing an ERC20 token will move it from the Loopring Layer2 environment to Ethereum Layer1.
Trade value should with decimals
sdk.toBig(value).times("1e" + TOKEN_INFO.tokenMap.LRC.decimals)
1
const response = await LoopringAPI.userAPI.submitOffchainWithdraw({
2
request: {
3
exchange: LOOPRING_EXPORTED_ACCOUNT.exchangeAddress,
4
accountId: LOOPRING_EXPORTED_ACCOUNT.accountId,
5
counterFactualInfo: undefined,
6
fastWithdrawalMode: false,
7
hashApproved: "",
8
maxFee: {
9
tokenId: TOKEN_INFO.tokenMap["LRC"].tokenId,
10
volume: fee.fees["LRC"].fee ?? "9400000000000000000",
11
},
12
minGas: 0,
13
owner: LOOPRING_EXPORTED_ACCOUNT.address,
14
to: LOOPRING_EXPORTED_ACCOUNT.address,
15
storageId: 0,
16
token: {
17
tokenId: TOKEN_INFO.tokenMap.LRC.tokenId,
18
volume: LOOPRING_EXPORTED_ACCOUNT.tradeLRCValue.toString(),
19
},
20
validUntil: 0,
21
},
22
web3,
23
chainId: sdk.ChainId.GOERLI,
24
walletType: sdk.ConnectorNames.MetaMask,
25
eddsaKey: eddsaKey.sk,
26
apiKey,
27
});
28
console.log("response:", response);
Last modified 6mo ago