feat: base for USDT support
This commit is contained in:
parent
c94d043506
commit
1dd16c2220
5 changed files with 14 additions and 5 deletions
1
lib/plugins/erc20/abi/usdt.json
Normal file
1
lib/plugins/erc20/abi/usdt.json
Normal file
File diff suppressed because one or more lines are too long
3
lib/plugins/erc20/index.js
Normal file
3
lib/plugins/erc20/index.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
const usdt = require('./abi/usdt.json')
|
||||
|
||||
module.exports = { usdt }
|
||||
|
|
@ -5,8 +5,10 @@ const web3 = new Web3()
|
|||
const hdkey = require('ethereumjs-wallet/hdkey')
|
||||
const Tx = require('ethereumjs-tx')
|
||||
const util = require('ethereumjs-util')
|
||||
const coins = require('lamassu-coins')
|
||||
const pify = require('pify')
|
||||
const BN = require('../../../bn')
|
||||
const erc20ABIs = require('../../erc20')
|
||||
|
||||
const NAME = 'geth'
|
||||
exports.SUPPORTED_MODULES = ['wallet']
|
||||
|
|
@ -15,6 +17,9 @@ const paymentPrefixPath = "m/44'/60'/0'/0'"
|
|||
const defaultPrefixPath = "m/44'/60'/1'/0'"
|
||||
let lastUsedNonces = {}
|
||||
|
||||
const contract = web3.eth.contract(erc20ABIs.usdt, coins.utils.getErc20Token('USDT').contractAddress)
|
||||
// console.log(contract)
|
||||
|
||||
module.exports = {
|
||||
NAME,
|
||||
balance,
|
||||
|
|
@ -63,7 +68,7 @@ function sendCoins (account, tx, settings, operatorId) {
|
|||
}
|
||||
|
||||
function checkCryptoCode (cryptoCode) {
|
||||
if (cryptoCode === 'ETH') return Promise.resolve()
|
||||
if (cryptoCode === 'ETH' || coins.utils.isErc20Token(cryptoCode)) return Promise.resolve()
|
||||
return Promise.reject(new Error('cryptoCode must be ETH'))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue