# Signer
- generatePseudoRandomSalt
- processEthTxOptions
- revokeAllowance
- sendApproveAndSwapByRelayer
- sendBuyback
- sendOrder
- sendOrderBySelf
- sendRageExit
- sendRedeem
- sendStake
- sendStakeWithPermit
- sendTransaction
- sendUnstake
- setUnlimitedAllowance
- signApproval
- signAuthToken
- signOrder
# generatePseudoRandomSalt
To generate pseudo random transaction salt
# Code sample:
const salt = tokenlonSigner.generatePseudoRandomSalt()
# Response:
'112771833890440886162596856022819852665939977776308559303632270479160982705198'
# processEthTxOptions
To process Eth transaction options
# Parameters:
Name | Type | Optional |
---|---|---|
rawTransaction | TransactionRequest | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const rawTx = await tokenlonSigner.processEthTxOptions({})
# Response:
{
gasLimit: 1000000,
type: 2,
maxFeePerGas: '0xd693a400',
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true }
}
# revokeAllowance
To revoke allowance from a contract address
# Parameters:
Name | Type | Optional |
---|---|---|
address | string | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const rawTx = await tokenlonSigner.revokeAllowance('0x0000000000095413afc295d19edeb1ad7b71c952')
# Response:
{
type: 2,
from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
gasPrice: BigNumber { _hex: '0x5f5226f1', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0xa96e1d21', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x8944', _isBigNumber: true },
to: '0x0000000000095413afC295d19EDeb1Ad7B71c952',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x095ea7b30000000000000000000000008a42d311d282bfcaa5133b2de0a8bcdbecea30730000000000000000000000000000000000000000000000000000000000000000',
}
# sendApproveAndSwapByRelayer
To send approve and swap transaction by relayer
# Parameters:
Name | Type | Optional |
---|---|---|
signOrderResult | SignResult | |
signApproveTxResult | string | |
signingOption | SigningOption | |
approvalTx | ApprovalTx | true |
# Code sample:
const response = await tokenlonSigner.sendApproveAndSwapByRelayer(
{
eip712SignDigest: '0x9ac54d3f21b5a694a4c98de6f84a264e74f1e41d0800585083533958012632b6',
executeTxHash: '0xa4fcdce812b6d573e35131e5b959078ad25fb6e0425674e1de424a1b34f466f9',
userSalt: '49258662446567206635031478659078665711461000596110214782219081105343190965421',
signature:
'0x6875848d2464e48aa0e2b75e6a215ed4ac7f8b207132bbc51812834e5bd3f4a915f78f72cd32dac4a1d96f990ec9442b2d566baed71a6631a1b3d3ee016fd92f1b000000000000000000000000000000000000000000000000000000000000000002',
order: {
makerAddress: '0xf17eea4E6928f7F66cb6C41Fd5EffeDEB1BD17E2',
makerAssetAmount: '19334251544165314',
makerAssetData: '0xf47261b00000000000000000000000000000000000095413afC295d19EDeb1Ad7B71c952',
makerAssetAddress: '0x0000000000095413afC295d19EDeb1Ad7B71c952',
makerFee: '0',
takerAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
takerAssetAmount: '10000000000000000000',
takerAssetData:
'0xf47261b00000000000000000000000000xdac17f958d2ee523a2206206994597c13d831ec7',
takerAssetAddress: '0x0000000000095413afC295d19EDeb1Ad7B71c952',
takerFee: '0',
senderAddress: '0xc23dc48e847ea67cde9a93d0df242f9584abc90d',
feeRecipientAddress: '0xb9e29984fe50602e7a619662ebed4f90d93824c7',
expirationTimeSeconds: '1635853652',
exchangeAddress: '0xb17dfecab333cae320fed9b84d8caddc61f9a687',
salt: '88479787230934574388095955767213123490436285185958724036774848762786588513038',
makerWalletSignature: '8fb2c3fae71633b386a2c23ca231dd4d1385916e',
quoteId: '22--d6c292c8-9bd7-459a-bbfd-a8a5fbaf9458',
feeFactor: 30,
feeDetail: {
stdFee: 30,
tokenlonFee: 30,
gasFee: 0,
refuelSendETH: 0,
refuelApprove: 0,
vendorFee: 0,
},
protocol: 'AMMV2',
takerAssetAddr: '0xdac17f958d2ee523a2206206994597c13d831ec7',
payload:
'eyJwYXRoIjpbIjB4ZGFjMTdmOTU4ZDJlZTUyM2EyMjA2MjA2OTk0NTk3YzEzZDgzMWVjNyIsbnVsbF0sIm1ha2VyU3BlY2lmaWNEYXRhIjoiIn0=',
},
},
'0x02f8af0180843b9aca00845746707782d8cf940000000000095413afc295d19edeb1ad7b71c95280b844095ea7b30000000000000000000000000000000000095413afc295d19edeb1ad7b71c9520000000000000000000000000000000000000000000000008ac7230489e80000c001a0dac3c5240691a3cd5a7699aab914ffd19edfdfd1f241763b4d5412fe90dcbad0a044e38c78b11ac21ea74fbc499816b7182f2be65e68bdb86b0a89d47cd50294c7',
{
receiverAddress: '0xf17eea4E6928f7F66cb6C41Fd5EffeDEB1BD17E2',
slippagePercent: 1,
},
{
rawTx:
'0x02f8af0180843b9aca00845746707782d8cf940000000000095413afc295d19edeb1ad7b71c95280b844095ea7b30000000000000000000000000000000000095413afc295d19edeb1ad7b71c9520000000000000000000000000000000000000000000000008ac7230489e80000c001a0dac3c5240691a3cd5a7699aab914ffd19edfdfd1f241763b4d5412fe90dcbad0a044e38c78b11ac21ea74fbc499816b7182f2be65e68bdb86b0a89d47cd50294c7',
refuel: false,
},
)
# Response:
{
success: true
}
# sendBuyback
To send buyback with LON
# Parameters:
Name | Type | Optional |
---|---|---|
tokenAddress | string | |
feeAmountForBuyback | string | |
minLonAmount | string | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const rawTx = await tokenlonSigner.sendBuyback(
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
'4997850924',
'0',
)
# Response:
{
type: 2,
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0x4ac35c33', _isBigNumber: true },
gasPrice: null,
gasLimit: BigNumber { _hex: '0x0668fa', _isBigNumber: true },
to: '0xbF1C2c17CC77e7Dec3466B96F46f93c09f02aB07',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x6671ce1f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb480000000000000000000000000000000000000000000000000000000129e5272c0000000000000000000000000000000000000000000000000000000000000000',
from: '0xf17eea4E6928f7F66cb6C41Fd5EffeDEB1BD17E2',
}
# sendOrder
To send a transaction order
# Parameters:
Name | Type | Optional |
---|---|---|
signResult | SignResult | |
option | SigningOption | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const result = await tokenlonSigner.sendOrder(
{
eip712SignDigest: '0xd47a8b274a03bad7ec645e0de4f7e54e8c2fd5e47a48d7f1ad14f2bd3a3b00c1',
executeTxHash: '0x26a43cedfa699b3838153def2c85e23f9412972aaf484646ad4bbf1a59937be7',
userSalt: '88479787230934574388095955767213123490436285185958724036774848762786588513038',
signature:
'0xb91b9ca87198a913b3f5a1ed6bc31179c81141ae26ceadbd149de81ae95354527ac3f99b13c4b5b4e19215228f3896ebad7fab46045218fc6cf97c612875d6641c000000000000000000000000000000000000000000000000000000000000000002',
order: {
makerAddress: '0xf17eea4E6928f7F66cb6C41Fd5EffeDEB1BD17E2',
makerAssetAmount: '19588311950158875',
makerAssetData: '0xf47261b0000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
makerAssetAddress: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
makerFee: '0',
takerAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
takerAssetAmount: '10000000000000000000',
takerAssetData: '0xf47261b00000000000000000000000000000000000095413afC295d19EDeb1Ad7B71c952',
takerAssetAddress: '0x0000000000095413afC295d19EDeb1Ad7B71c952',
takerFee: '0',
senderAddress: '0xc23dc48e847ea67cde9a93d0df242f9584abc90d',
feeRecipientAddress: '0xb9e29984fe50602e7a619662ebed4f90d93824c7',
expirationTimeSeconds: '1635853652',
exchangeAddress: '0xb17dfecab333cae320fed9b84d8caddc61f9a687',
salt: '88479787230934574388095955767213123490436285185958724036774848762786588513038',
makerWalletSignature: '8fb2c3fae71633b386a2c23ca231dd4d1385916e',
quoteId: '22--d6c292c8-9bd7-459a-bbfd-a8a5fbaf9458',
feeFactor: 30,
feeDetail: {
stdFee: 30,
tokenlonFee: 30,
gasFee: 0,
refuelSendETH: 0,
refuelApprove: 0,
vendorFee: 0,
},
protocol: 'RFQV1',
},
},
{
receiverAddress: '0xf17eea4E6928f7F66cb6C41Fd5EffeDEB1BD17E2',
slippagePercent: 1,
},
)
# Response:
{ onlyRelayer: true, relayerResult: { success: true } }
# sendOrderBySelf
To send a transaction order by self
# Parameters:
Name | Type | Optional |
---|---|---|
signResult | SignResult | |
option | SigningOption | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const signResult = {
eip712SignDigest: '0x4ef70e111a026ce343c9935d98a0ee940e9b503d1d3799c789e0a8fbbac306f2',
executeTxHash: '0xf7cf81834acf83db332d2e993dfc367e9b8eec821495281364f9658591568093',
userSalt: '36159854989501351525396559940247699029973999078567552556289768028336984426816',
signature:
'0xf6b40fca785f1ddf7c3f30aba222e16ec66f4aa034963c1c2ceb2b98a8944b0831f40d232cf20583999cbd1d768a96bafe638110a86a4b48ed2ab7f210fee6501c000000000000000000000000000000000000000000000000000000000000000002',
order: {
makerAddress: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
makerAssetAmount: '20106492021000000',
makerAssetData: '0xf47261b00000000000000000000000000000000000095413afC295d19EDeb1Ad7B71c952',
makerAssetAddress: '0x0000000000095413afC295d19EDeb1Ad7B71c952',
makerFee: '0',
takerAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
takerAssetAmount: '10000000000000000000',
takerAssetData: '0xf47261b00000000000000000000000000000000000000000000000000000000000000000',
takerAssetAddress: '0x0000000000000000000000000000000000000000',
takerFee: '0',
senderAddress: '0xc23dc48e847ea67cde9a93d0df242f9584abc90d',
feeRecipientAddress: '0xb9e29984fe50602e7a619662ebed4f90d93824c7',
expirationTimeSeconds: '1635853652',
exchangeAddress: '0xb17dfecab333cae320fed9b84d8caddc61f9a687',
salt: '88479787230934574388095955767213123490436285185958724036774848762786588513038',
makerWalletSignature: '8fb2c3fae71633b386a2c23ca231dd4d1385916e',
quoteId: '22--d6c292c8-9bd7-459a-bbfd-a8a5fbaf9458',
feeFactor: 30,
feeDetail: {
stdFee: 30,
tokenlonFee: 30,
gasFee: 0,
refuelSendETH: 0,
refuelApprove: 0,
vendorFee: 0,
},
protocol: 'AMMV1',
},
}
const result = await tokenlonSigner.sendOrderBySelf(
signResult,
{
receiverAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
slippagePercent: 1,
},
{ gasPrice: ethers.BigNumber.from(9 * 10 ** 9) },
)
# Response:
{
onlyRelayer: false,
relayerResult: { success: true },
tx: {
hash: '0x220667bd7bb5c1e9945b9435d2e03031baf1b5ad6cf15246b5e13004e2afccc7',
type: 0,
accessList: null,
blockHash: '0xd66e39806b2c89e28bacd74018e8345e4cd6d9aad99423d6d562c178effcbc07',
blockNumber: 13530980,
transactionIndex: 0,
confirmations: 1,
from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
gasPrice: BigNumber { _hex: '0x0218711a00', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x04df97', _isBigNumber: true },
to: '0x03f34bE1BF910116595dB1b11E9d1B2cA5D59659',
value: BigNumber { _hex: '0x8ac7230489e80000', _isBigNumber: true },
nonce: 79,
data: '0xe47d166c0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000020403ad2aa00000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000095413afc295d19edeb1ad7b71c9520000000000000000000000000000000000000000000000008ac7230489e8000000000000000000000000000000000000000000000000000000476ebf7a974740000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb922664ff1c0ad59a91a70e8336cc225880dfb70a0a813ee32390a52c1314206c80940000000000000000000000000000000000000000000000000000000006181255400000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000062f6b40fca785f1ddf7c3f30aba222e16ec66f4aa034963c1c2ceb2b98a8944b0831f40d232cf20583999cbd1d768a96bafe638110a86a4b48ed2ab7f210fee6501c00000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
r: '0x25ea559b2922ee6388d2991ff758a9ed4c47ec52ede8fe1399b3e1d83ef25512',
s: '0x72b2e20ad886b465e5bf0c29c18fbdf5c31b6cb4f3f1d66c43eee3070f1304e3',
v: 37,
creates: null,
chainId: 1,
wait: [Function (anonymous)]
}
}
# sendRageExit
To send a rage exit request
# Parameters:
Name | Type | Optional |
---|---|---|
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const rawTx = await tokenlonSigner.sendRageExit()
# Response:
{
type: 2,
from: '0x9aFc226Dc049B99342Ad6774Eeb08BfA2F874465',
gasPrice: BigNumber { _hex: '0x3cf420c0', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0x4b37dde2', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x0172a2', _isBigNumber: true },
to: '0xf88506B0F1d30056B9e5580668D5875b9cd30F23',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x822cb39c',
}
# sendRedeem
To send a redeem request
# Parameters:
Name | Type | Optional |
---|---|---|
amount | string | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const rawTx = await tokenlonSigner.sendRedeem('1')
# Response:
{
type: 2,
from: '0x9aFc226Dc049B99342Ad6774Eeb08BfA2F874465',
gasPrice: BigNumber { _hex: '0x3d24ac1e', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0x4bbd927a', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x01b650', _isBigNumber: true },
to: '0xf88506B0F1d30056B9e5580668D5875b9cd30F23',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0xdb006a750000000000000000000000000000000000000000000000000de0b6b3a7640000',
}
# sendStake
To send a staking request
# Parameters:
Name | Type | Optional |
---|---|---|
amount | string | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const rawTx = await tokenlonSigner.sendStake('129.926789198738209506')
# Response:
{
type: 2,
from: '0x9aFc226Dc049B99342Ad6774Eeb08BfA2F874465',
gasPrice: BigNumber { _hex: '0x3d9bd5fb', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0x4d044421', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x017cbf', _isBigNumber: true },
to: '0xf88506B0F1d30056B9e5580668D5875b9cd30F23',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0xa694fc3a0000000000000000000000000000000000000000000000070b18ae6505d9bae2',
}
# sendStakeWithPermit
To send a staking request with permit
# Parameters:
Name | Type | Optional |
---|---|---|
amount | string | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const rawTx = await tokenlonSigner.sendStakeWithPermit('129.926789198738209506')
# Response:
{
type: 2,
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0x55600f33', _isBigNumber: true },
gasPrice: null,
gasLimit: BigNumber { _hex: '0x02b678', _isBigNumber: true },
to: '0xf88506B0F1d30056B9e5580668D5875b9cd30F23',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0xecd9ba820000000000000000000000000000000000000000000000070b18ae6505d9bae200000000000000000000000000000000000000000000000000000000618276e5000000000000000000000000000000000000000000000000000000000000001bc769b244f730a69caf93ee7195694134e880b2eaf20dc1734791f659d5fbf935505f1742c873b73713f990265673f34775b92053296b6450c5c3d17b438b7391',
from: '0xf17eea4E6928f7F66cb6C41Fd5EffeDEB1BD17E2',
}
# sendTransaction
To send a transaction request
# Parameters:
Name | Type |
---|---|
rawTransaction | TransactionRequest |
# Code sample:
const rawTransaction = {
to: '0x6da0e6abd44175f50c563cd8b860dd988a7c3433',
from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
data: '0x095ea7b30000000000000000000000006f1ee33e23a33ef690c6c0cd9b7dc4a666e072e5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
value: 0,
gasLimit: 1000000,
type: 2,
maxFeePerGas: '0xd693a400',
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true }
}
const tx = await tokenlonSigner.sendTransaction(rawTx)
# Response:
{
hash: '0x0e2193bb20c3a022c766c7a221629b32d8b9b7f93f98db423bcfd037fb4fa79e',
type: 2,
accessList: [],
blockHash: '0x1daa519bc1db8466158612828af69c2f80fbe8ca3aee96fa42afc22fb369161d',
blockNumber: 5873944,
transactionIndex: 0,
confirmations: 1,
from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
gasPrice: BigNumber { _hex: '0x70cdaed8', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0xd693a400', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0x0f4240', _isBigNumber: true },
to: '0x6dA0e6ABd44175f50C563cd8b860DD988A7C3433',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
nonce: 721,
data: '0x095ea7b30000000000000000000000006f1ee33e23a33ef690c6c0cd9b7dc4a666e072e5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
r: '0x5a219eaa20a357d40ca1666293a00476f6ac26887541ddc8b7cba51ce6a15aff',
s: '0x5aa50ce561f07a43ed882e1f517d670ae5aa0695ff7db401be1d74df676e020b',
v: 0,
creates: null,
chainId: 5,
wait: [Function (anonymous)]
}
# sendUnstake
To send a unstaking request
# Parameters:
Name | Type | Optional |
---|---|---|
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
let rawTx = await tokenlonSigner.sendUnstake()
# Response:
{
type: 2,
from: '0x9aFc226Dc049B99342Ad6774Eeb08BfA2F874465',
gasPrice: BigNumber { _hex: '0x3d5c6208', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0x4c55dbf4', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0xffae', _isBigNumber: true },
to: '0xf88506B0F1d30056B9e5580668D5875b9cd30F23',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x2def6620',
}
# setUnlimitedAllowance
To authorize unlimited allowance to a contract address
# Parameters:
Name | Type |
---|---|
contractAddress | string |
# Code sample:
const rawTx = await tokenlonSigner.setUnlimitedAllowance('0x6da0e6abd44175f50c563cd8b860dd988a7c3433')
# Response:
{
type: 2,
from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
gasPrice: BigNumber { _hex: '0x6a2d106d', _isBigNumber: true },
maxPriorityFeePerGas: BigNumber { _hex: '0x3b9aca00', _isBigNumber: true },
maxFeePerGas: BigNumber { _hex: '0xa60093b0', _isBigNumber: true },
gasLimit: BigNumber { _hex: '0xda35', _isBigNumber: true },
to: '0x6dA0e6ABd44175f50C563cd8b860DD988A7C3433',
value: BigNumber { _hex: '0x00', _isBigNumber: true },
data: '0x095ea7b30000000000000000000000006f1ee33e23a33ef690c6c0cd9b7dc4a666e072e5ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff',
}
# signApproval
To sign a approval transaction
# Parameters:
Name | Type | Optional |
---|---|---|
tokenAddress | string | |
spenderAddress | string | |
amount | string | |
ethTxOptions | EthereumTransactionOptions | true |
# Code sample:
const approvalTx = await tokenlonSigner.signApproval(
'0x0000000000095413afC295d19EDeb1Ad7B71c952',
'0x0000000000095413afC295d19EDeb1Ad7B71c952',
'10000000000000000000',
)
# Response:
'0x02f8af0180843b9aca00845746707782d8cf940000000000095413afc295d19edeb1ad7b71c95280b844095ea7b30000000000000000000000000000000000095413afc295d19edeb1ad7b71c9520000000000000000000000000000000000000000000000008ac7230489e80000c001a0dac3c5240691a3cd5a7699aab914ffd19edfdfd1f241763b4d5412fe90dcbad0a044e38c78b11ac21ea74fbc499816b7182f2be65e68bdb86b0a89d47cd50294c7'
# signAuthToken
To get the sign auth Token
# Parameters:
Name | Type | Optional |
---|---|---|
timestamp | number | true |
# Code sample:
const authInfo = await tokenlonSigner.signAuthToken()
# Response:
{
timestamp: 1635132861,
signature: '0x4d9bb8c90f66be925bc264cebdcc146c7ddc7c144ec875983f404fa0dcb4022b703cec383e1a5219218b2bac8ff0ea6c04afcdf7da0b8097250bb128e03fcbba1b'
}
# signOrder
To sign a transaction order
# Parameters:
Name | Type |
---|---|
order | Order |
option | SigningOption |
# Code sample:
const order = {
makerAddress: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
makerAssetAmount: '20370700000000000',
makerAssetData: '0xf47261b00000000000000000000000000000000000095413afC295d19EDeb1Ad7B71c952',
makerAssetAddress: '0x0000000000095413afC295d19EDeb1Ad7B71c952',
makerFee: '0',
takerAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
takerAssetAmount: '10000000000000000000',
takerAssetData: '0xf47261b00000000000000000000000000000000000000000000000000000000000000000',
takerAssetAddress: '0x0000000000000000000000000000000000000000',
takerFee: '0',
senderAddress: '0xc23dc48e847ea67cde9a93d0df242f9584abc90d',
feeRecipientAddress: '0xb9e29984fe50602e7a619662ebed4f90d93824c7',
expirationTimeSeconds: '1635853652',
exchangeAddress: '0xb17dfecab333cae320fed9b84d8caddc61f9a687',
salt: '88479787230934574388095955767213123490436285185958724036774848762786588513038',
makerWalletSignature: '8fb2c3fae71633b386a2c23ca231dd4d1385916e',
quoteId: '22--d6c292c8-9bd7-459a-bbfd-a8a5fbaf9458',
feeFactor: 30,
feeDetail: {
stdFee: 30,
tokenlonFee: 30,
gasFee: 0,
refuelSendETH: 0,
refuelApprove: 0,
vendorFee: 0,
},
protocol: 'AMMV1',
}
const signResult = await tokenlonSigner.signOrder(order, {
receiverAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
slippagePercent: 1,
})
# Response:
{
eip712SignDigest: '0x4ef70e111a026ce343c9935d98a0ee940e9b503d1d3799c789e0a8fbbac306f2',
executeTxHash: '0xf7cf81834acf83db332d2e993dfc367e9b8eec821495281364f9658591568093',
userSalt: '36159854989501351525396559940247699029973999078567552556289768028336984426816',
signature: '0xf6b40fca785f1ddf7c3f30aba222e16ec66f4aa034963c1c2ceb2b98a8944b0831f40d232cf20583999cbd1d768a96bafe638110a86a4b48ed2ab7f210fee6501c000000000000000000000000000000000000000000000000000000000000000002',
order: {
makerAddress: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
makerAssetAmount: '20106492021000000',
makerAssetData: '0xf47261b00000000000000000000000000000000000095413afC295d19EDeb1Ad7B71c952',
makerAssetAddress: '0x0000000000095413afC295d19EDeb1Ad7B71c952',
makerFee: '0',
takerAddress: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
takerAssetAmount: '10000000000000000000',
takerAssetData: '0xf47261b00000000000000000000000000000000000000000000000000000000000000000',
takerAssetAddress: '0x0000000000000000000000000000000000000000',
takerFee: '0',
senderAddress: '0xc23dc48e847ea67cde9a93d0df242f9584abc90d',
feeRecipientAddress: '0xb9e29984fe50602e7a619662ebed4f90d93824c7',
expirationTimeSeconds: '1635853652',
exchangeAddress: '0xb17dfecab333cae320fed9b84d8caddc61f9a687',
salt: '88479787230934574388095955767213123490436285185958724036774848762786588513038',
makerWalletSignature: '8fb2c3fae71633b386a2c23ca231dd4d1385916e',
quoteId: '22--d6c292c8-9bd7-459a-bbfd-a8a5fbaf9458',
feeFactor: 30,
feeDetail: {
stdFee: 30,
tokenlonFee: 30,
gasFee: 0,
refuelSendETH: 0,
refuelApprove: 0,
vendorFee: 0
},
protocol: 'AMMV1'
}
}