new CrossChainE20Lock(input, config)
Parameters:
| Name | Type | Description |
|---|---|---|
input |
Object | input of final users.(gas, gasPrice, value and so on) |
config |
Object | config of cross chain used. |
- Source:
- trans/cross-chain/erc20/CrossChainE20Lock.js
Extends
Members
-
input :Object
-
Input representing the input data from final users. Example is as followings:
{ from: '0xf47a8bb5c9ff814d39509591281ae31c0c7c2f38', storeman: '0x41623962c5d44565de623d53eb677e0f300467d2', txFeeRatio: '1', to: '0x393e86756d8d4cf38493ce6881eb3a8f2966bb27', amount: '0.01', gasPrice: '10', gasLimit: '470000', password: '*******' }Type:
- Object
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
-
config :Object
-
Final configuration computed by SDK .(computed by src chain, dst chain and so on. Example is as followings:
{ srcChain: 'ZRX', dstChain: 'WAN', tokenSymbol: 'ZRX', tokenStand: 'E20', useLocalNode: false, tokenDecimals: '18', srcSCAddr: '0x00f58d6d585f84b2d7267940cede30ce2fe6eae8', srcSCAddrKey: '0x00f58d6d585f84b2d7267940cede30ce2fe6eae8', midSCAddr: '0x4a8f5dd531e4cd1993b79b23dbda21faacb9c731', dstSCAddr: '0xfc0eba261b49763decb6c911146e3cf524fa7ebc', dstSCAddrKey: 'WAN', srcAbi: midSCAbi: srcKeystorePath: '/home/jacob/.ethereum/testnet/keystore/', dstKeyStorePath: '/home/jacob/.wanchain/testnet/keystore/', approveClass: 'CrossChainE20Approve', lockClass: 'CrossChainE20Lock', redeemClass: 'CrossChainE20Redeem', revokeClass: 'CrossChainE20Revoke', normalTransClass: 'NormalChainE20', approveScFunc: 'approve', transferScFunc: 'transfer', lockScFunc: 'inboundLock', redeemScFunc: 'inboundRedeem', revokeScFunc: 'inboundRevoke', srcChainType: 'ETH', dstChainType: 'WAN', crossCollection: 'crossTrans', normalCollection: 'normalTrans', token2WanRatio: '3000' }Type:
- Object
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
-
trans :Transaction
-
Type:
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
-
dataSign :DataSign
-
Type:
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
-
txDataCreator :TxDataCreator
-
Type:
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
-
chainType :enum
-
Type:
- enum
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
Methods
-
checkPreCondition()
-
used for revoke and redeem, to check whether the status and time is ok or not.
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
Returns:
ret.code: true function success ret.result result of the function when ret.code equals true. ret.code: false function failure ret.result error message of the function when ret.code equals false- Type
- Object | transUtil.this.retResult | Object
-
createTrans()
-
create empty trans , system will fulfill the data later.
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
Returns:
ret.code: true function success ret.result result of the function when ret.code equals true. ret.code: false function failure ret.result error message of the function when ret.code equals false- Type
- Object | transUtil.this.retResult | Object
-
sendTrans(data)
-
Parameters:
Name Type Description dataObject signed data to be sent.See result of DataSign#sign - Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
Returns:
ret.code: true function success ret.result result of the function when ret.code equals true. ret.code: false function failure ret.result error message of the function when ret.code equals false- Type
- *
-
setCommonData(commonData)
-
Fulfill the common data of transaction.
Parameters:
Name Type Description commonDataObject see result of TxDataCreator#createCommonData - Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
Returns:
ret.code: true function success ret.result result of the function when ret.code equals true. ret.code: false function failure ret.result error message of the function when ret.code equals false- Type
- Object | transUtil.this.retResult | Object
-
setContractData(contractData)
-
Fulfill the contract data of transaction.
Parameters:
Name Type Description contractDataObject see result of TxDataCreator#createContractData - Inherited From:
- Overrides:
- Source:
- trans/cross-chain/common/CrossChain.js
Returns:
ret.code: true function success ret.result result of the function when ret.code equals true. ret.code: false function failure ret.result error message of the function when ret.code equals false- Type
- Object | transUtil.this.retResult | Object
-
createDataCreator()
-
Generate a creator to create common transaction data and custom data.
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/erc20/CrossChainE20Lock.js
Returns:
- Type
- Object | transUtil.this.retResult | Object
-
createDataSign()
-
Generate a signer used to sign the transaction data.
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/erc20/CrossChainE20Lock.js
Returns:
- Type
- Object | transUtil.this.retResult | Object
-
preSendTrans()
-
First insert transaction info. to db before send transaction.
Parameters:
Name Type Description signedData.Object See result of DataSign#sign - Inherited From:
- Overrides:
- Source:
- trans/cross-chain/erc20/CrossChainE20Lock.js
Returns:
- Type
- Object | transUtil.this.retResult | Object
-
transFailed()
-
Send transaction failed. update transaction status.
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/erc20/CrossChainE20Lock.js
-
postSendTrans(resultSendTrans)
-
After send transaction, insert transaction information into database.
Parameters:
Name Type Description resultSendTransstring see result of CrossChain#sendTrans - Inherited From:
- Overrides:
- Source:
- trans/cross-chain/erc20/CrossChainE20Lock.js
Returns:
- Type
- Object | transUtil.this.retResult | Object
-
<async> run()
-
Main process of cross chain process
- Inherited From:
- Overrides:
- Source:
- trans/cross-chain/erc20/CrossChainE20Lock.js
Returns:
- Type
- Promise.<*>