feat: base for USDT support
This commit is contained in:
parent
c94d043506
commit
1dd16c2220
5 changed files with 14 additions and 5 deletions
|
|
@ -3,7 +3,7 @@ const _ = require('lodash/fp')
|
|||
|
||||
const { ALL } = require('../../plugins/common/ccxt')
|
||||
|
||||
const { BTC, BCH, DASH, ETH, LTC, ZEC } = COINS
|
||||
const { BTC, BCH, DASH, ETH, LTC, ZEC, USDT } = COINS
|
||||
const { bitpay, coinbase, itbit, bitstamp, kraken } = ALL
|
||||
|
||||
const TICKER = 'ticker'
|
||||
|
|
@ -24,7 +24,7 @@ const ALL_ACCOUNTS = [
|
|||
{ code: 'mock-ticker', display: 'Mock (Caution!)', class: TICKER, cryptos: ALL_CRYPTOS, dev: true },
|
||||
{ code: 'bitcoind', display: 'bitcoind', class: WALLET, cryptos: [BTC] },
|
||||
{ code: 'no-layer2', display: 'No Layer 2', class: LAYER_2, cryptos: ALL_CRYPTOS },
|
||||
{ code: 'infura', display: 'Infura', class: WALLET, cryptos: [ETH] },
|
||||
{ code: 'infura', display: 'Infura', class: WALLET, cryptos: [ETH, USDT] },
|
||||
{ code: 'geth', display: 'geth (DEPRECATED)', class: WALLET, cryptos: [ETH], deprecated: true },
|
||||
{ code: 'zcashd', display: 'zcashd', class: WALLET, cryptos: [ZEC] },
|
||||
{ code: 'litecoind', display: 'litecoind', class: WALLET, cryptos: [LTC] },
|
||||
|
|
@ -43,7 +43,7 @@ const ALL_ACCOUNTS = [
|
|||
{ code: 'mailgun', display: 'Mailgun', class: EMAIL },
|
||||
{ code: 'none', display: 'None', class: ZERO_CONF, cryptos: [BTC, ZEC, LTC, DASH, BCH, ETH] },
|
||||
{ code: 'blockcypher', display: 'Blockcypher', class: ZERO_CONF, cryptos: [BTC] },
|
||||
{ code: 'mock-zero-conf', display: 'Mock 0-conf', class: ZERO_CONF, cryptos: [BTC, ZEC, LTC, DASH, BCH, ETH], dev: true }
|
||||
{ code: 'mock-zero-conf', display: 'Mock 0-conf', class: ZERO_CONF, cryptos: ALL_CRYPTOS, dev: true }
|
||||
]
|
||||
|
||||
const devMode = require('minimist')(process.argv.slice(2)).dev
|
||||
|
|
|
|||
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'))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ const getLogo = code => {
|
|||
case 'ZEC':
|
||||
return ZCashLogo
|
||||
default:
|
||||
return null
|
||||
return EthereumLogo
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue