edge-currency-accountbased 2.2.3 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/android/src/main/assets/edge-currency-accountbased/234.chunk.js +35 -0
- package/android/src/main/assets/edge-currency-accountbased/248.chunk.js +35 -0
- package/android/src/main/assets/edge-currency-accountbased/336.chunk.js +9 -0
- package/android/src/main/assets/edge-currency-accountbased/612.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/{945.chunk.js → 814.chunk.js} +8 -8
- package/android/src/main/assets/edge-currency-accountbased/935.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/94.chunk.js +8 -0
- package/android/src/main/assets/edge-currency-accountbased/algorand.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/bnb.chunk.js +4 -4
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +10 -10
- package/android/src/main/assets/edge-currency-accountbased/eos.chunk.js +12 -12
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +5 -5
- package/android/src/main/assets/edge-currency-accountbased/filecoin.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/fio.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/hedera.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/polkadot.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/ripple.chunk.js +5 -5
- package/android/src/main/assets/edge-currency-accountbased/solana.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/stellar.chunk.js +4 -4
- package/android/src/main/assets/edge-currency-accountbased/tezos.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/tron.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/zcash.chunk.js +2 -2
- package/lib/algorand/AlgorandEngine.js +46 -24
- package/lib/algorand/algorandInfo.js +8 -7
- package/lib/algorand/algorandTestnetInfo.js +8 -7
- package/lib/binance/BinanceEngine.js +19 -17
- package/lib/binance/binanceInfo.js +10 -7
- package/lib/common/types.js +10 -0
- package/lib/common/upgradeMemos.js +52 -0
- package/lib/common/utf8.js +32 -0
- package/lib/common/validateMemos.js +107 -0
- package/lib/eos/EosEngine.js +42 -41
- package/lib/eos/info/eosCommonInfo.js +10 -0
- package/lib/eos/info/eosInfo.js +15 -17
- package/lib/eos/info/telosInfo.js +15 -15
- package/lib/eos/info/waxInfo.js +15 -16
- package/lib/ethereum/EthereumEngine.js +13 -12
- package/lib/ethereum/EthereumNetwork.js +16 -14
- package/lib/ethereum/info/avalancheInfo.js +17 -7
- package/lib/ethereum/info/binancesmartchainInfo.js +9 -7
- package/lib/ethereum/info/celoInfo.js +9 -7
- package/lib/ethereum/info/ethDevInfo.js +9 -7
- package/lib/ethereum/info/ethereumCommonInfo.js +10 -0
- package/lib/ethereum/info/ethereumInfo.js +17 -7
- package/lib/ethereum/info/ethereumclassicInfo.js +9 -7
- package/lib/ethereum/info/ethereumpowInfo.js +9 -7
- package/lib/ethereum/info/fantomInfo.js +9 -7
- package/lib/ethereum/info/goerliInfo.js +9 -7
- package/lib/ethereum/info/kovanInfo.js +9 -7
- package/lib/ethereum/info/optimismInfo.js +9 -7
- package/lib/ethereum/info/polygonInfo.js +9 -7
- package/lib/ethereum/info/pulsechainInfo.js +9 -7
- package/lib/ethereum/info/rinkebyInfo.js +9 -7
- package/lib/ethereum/info/ropstenInfo.js +9 -7
- package/lib/ethereum/info/rskInfo.js +9 -7
- package/lib/ethereum/info/zksyncInfo.js +9 -7
- package/lib/filecoin/FilecoinEngine.js +125 -87
- package/lib/filecoin/Filfox.js +68 -1
- package/lib/filecoin/filecoinInfo.js +5 -7
- package/lib/fio/FioEngine.js +25 -17
- package/lib/fio/fioInfo.js +8 -6
- package/lib/hedera/HederaEngine.js +22 -18
- package/lib/hedera/hederaInfo.js +11 -8
- package/lib/hedera/hederaTestnetInfo.js +6 -6
- package/lib/polkadot/PolkadotEngine.js +15 -9
- package/lib/polkadot/info/liberlandInfo.js +3 -2
- package/lib/polkadot/info/liberlandTestnetInfo.js +3 -2
- package/lib/polkadot/info/polkadotInfo.js +8 -5
- package/lib/ripple/RippleEngine.js +53 -75
- package/lib/ripple/rippleInfo.js +16 -8
- package/lib/solana/SolanaEngine.js +17 -12
- package/lib/solana/solanaInfo.js +9 -5
- package/lib/stellar/StellarEngine.js +31 -22
- package/lib/stellar/stellarInfo.js +16 -7
- package/lib/tezos/TezosEngine.js +17 -11
- package/lib/tezos/tezosInfo.js +8 -5
- package/lib/tron/TronEngine.js +85 -68
- package/lib/tron/tronInfo.js +8 -7
- package/lib/zcash/ZcashEngine.js +23 -23
- package/lib/zcash/piratechainInfo.js +8 -6
- package/lib/zcash/zcashInfo.js +7 -6
- package/package.json +2 -2
- package/android/src/main/assets/edge-currency-accountbased/124.chunk.js +0 -35
- package/android/src/main/assets/edge-currency-accountbased/223.chunk.js +0 -9
- package/android/src/main/assets/edge-currency-accountbased/650.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/689.chunk.js +0 -8
- package/android/src/main/assets/edge-currency-accountbased/826.chunk.js +0 -35
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _biggystring = require('biggystring');
|
|
2
|
+
var _cleaners = require('cleaners');
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _types3 = require('./types');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Validates the memos on an spend request.
|
|
14
|
+
* Throws an error if any of the memos are wrong.
|
|
15
|
+
*/
|
|
16
|
+
function validateMemos(
|
|
17
|
+
spendInfo,
|
|
18
|
+
currencyInfo
|
|
19
|
+
) {
|
|
20
|
+
const { memos = [] } = spendInfo
|
|
21
|
+
const {
|
|
22
|
+
displayName,
|
|
23
|
+
memoMaxLength,
|
|
24
|
+
memoMaxValue,
|
|
25
|
+
memoOptions = [],
|
|
26
|
+
multipleMemos = false,
|
|
27
|
+
memoType
|
|
28
|
+
} = currencyInfo
|
|
29
|
+
|
|
30
|
+
// Not all coins keep the legacy memo type in the modern list,
|
|
31
|
+
// but we still need to validate the legacy type if present:
|
|
32
|
+
const allOptions = [...memoOptions]
|
|
33
|
+
if (memoType === 'text') {
|
|
34
|
+
allOptions.push({ type: 'text', maxLength: memoMaxLength })
|
|
35
|
+
}
|
|
36
|
+
if (memoType === 'number') {
|
|
37
|
+
allOptions.push({ type: 'number', maxValue: memoMaxValue })
|
|
38
|
+
}
|
|
39
|
+
if (memoType === 'hex') {
|
|
40
|
+
allOptions.push({
|
|
41
|
+
type: 'hex',
|
|
42
|
+
maxBytes: memoMaxLength == null ? undefined : memoMaxLength / 2
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// What we should call a "memo" in our error messages:
|
|
47
|
+
const { memoName = 'memo' } = _nullishCoalesce(memoOptions[0], () => ( {}))
|
|
48
|
+
|
|
49
|
+
// Now validate our memos:
|
|
50
|
+
for (const memo of memos) {
|
|
51
|
+
const options = allOptions.filter(option => memo.type === option.type)
|
|
52
|
+
if (options.length < 1) {
|
|
53
|
+
throw new Error(`${displayName} ${memoName}: cannot be type ${memo.type}`)
|
|
54
|
+
}
|
|
55
|
+
const problem = options
|
|
56
|
+
.map(option => getMemoError(memo, option))
|
|
57
|
+
.find(problem => problem != null)
|
|
58
|
+
if (problem != null) {
|
|
59
|
+
throw new Error(`${displayName} {memoName}: ${problem}`)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Validate the number of memos:
|
|
64
|
+
if (!multipleMemos && memos.length > 1) {
|
|
65
|
+
throw new Error(`${displayName} only supports one ${memoName}`)
|
|
66
|
+
}
|
|
67
|
+
} exports.validateMemos = validateMemos;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Checks a memo against a memo option.
|
|
71
|
+
* Returns `undefined` if valid, or an error string if invalid.
|
|
72
|
+
*/
|
|
73
|
+
function getMemoError(
|
|
74
|
+
memo,
|
|
75
|
+
option
|
|
76
|
+
) {
|
|
77
|
+
if (
|
|
78
|
+
option.type === 'text' &&
|
|
79
|
+
option.maxLength != null &&
|
|
80
|
+
memo.value.length > option.maxLength
|
|
81
|
+
) {
|
|
82
|
+
return `cannot be longer than ${option.maxLength}`
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (option.type === 'number') {
|
|
86
|
+
const value = _cleaners.asMaybe.call(void 0, (0, _types3.asIntegerString))(memo.value)
|
|
87
|
+
if (value == null) {
|
|
88
|
+
return `is not a valid number`
|
|
89
|
+
}
|
|
90
|
+
if (option.maxValue != null && _biggystring.gt.call(void 0, value, option.maxValue)) {
|
|
91
|
+
return `cannot be greater than ${option.maxValue}`
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (option.type === 'hex') {
|
|
96
|
+
const value = _cleaners.asMaybe.call(void 0, (0, _types3.asBase16))(memo.value)
|
|
97
|
+
if (value == null) {
|
|
98
|
+
return `is not valid hexadecimal`
|
|
99
|
+
}
|
|
100
|
+
if (option.maxBytes != null && value.length > option.maxBytes) {
|
|
101
|
+
return `cannot be longer than ${option.maxBytes} bytes`
|
|
102
|
+
}
|
|
103
|
+
if (option.minBytes != null && value.length < option.minBytes) {
|
|
104
|
+
return `cannot be shorter than ${option.minBytes} bytes`
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
package/lib/eos/EosEngine.js
CHANGED
|
@@ -27,6 +27,7 @@ var _urlparse = require('url-parse'); var _urlparse2 = _interopRequireDefault(_u
|
|
|
27
27
|
|
|
28
28
|
var _CurrencyEngine = require('../common/CurrencyEngine');
|
|
29
29
|
|
|
30
|
+
var _upgradeMemos = require('../common/upgradeMemos');
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
|
|
@@ -258,21 +259,22 @@ const bogusAccounts = {
|
|
|
258
259
|
}
|
|
259
260
|
|
|
260
261
|
const edgeTransaction = {
|
|
261
|
-
txid: trxId,
|
|
262
|
-
date: Date.parse(blockTime) / 1000,
|
|
263
|
-
currencyCode,
|
|
264
262
|
blockHeight: blockNum > 0 ? blockNum : 0,
|
|
265
|
-
|
|
263
|
+
currencyCode,
|
|
264
|
+
date: Date.parse(blockTime) / 1000,
|
|
266
265
|
isSend: nativeAmount.startsWith('-'),
|
|
267
|
-
|
|
268
|
-
parentNetworkFee: '0',
|
|
269
|
-
ourReceiveAddresses,
|
|
270
|
-
signedTx: '',
|
|
271
|
-
otherParams: {},
|
|
266
|
+
memos: [],
|
|
272
267
|
metadata: {
|
|
273
268
|
name,
|
|
274
269
|
notes: memo
|
|
275
270
|
},
|
|
271
|
+
nativeAmount,
|
|
272
|
+
networkFee: '0',
|
|
273
|
+
otherParams: {},
|
|
274
|
+
ourReceiveAddresses,
|
|
275
|
+
parentNetworkFee: '0',
|
|
276
|
+
signedTx: '',
|
|
277
|
+
txid: trxId,
|
|
276
278
|
walletId: this.walletId
|
|
277
279
|
}
|
|
278
280
|
|
|
@@ -339,20 +341,21 @@ const bogusAccounts = {
|
|
|
339
341
|
}
|
|
340
342
|
|
|
341
343
|
const edgeTransaction = {
|
|
342
|
-
txid,
|
|
343
|
-
date,
|
|
344
|
-
currencyCode,
|
|
345
344
|
blockHeight,
|
|
346
|
-
|
|
345
|
+
currencyCode,
|
|
346
|
+
date,
|
|
347
347
|
isSend: nativeAmount.startsWith('-'),
|
|
348
|
-
|
|
349
|
-
parentNetworkFee: '0',
|
|
350
|
-
ourReceiveAddresses,
|
|
351
|
-
signedTx: '',
|
|
348
|
+
memos: [],
|
|
352
349
|
metadata: {
|
|
353
350
|
notes: memo
|
|
354
351
|
},
|
|
352
|
+
nativeAmount,
|
|
353
|
+
networkFee: '0',
|
|
355
354
|
otherParams: { fromAddress: from, toAddress: to },
|
|
355
|
+
ourReceiveAddresses,
|
|
356
|
+
parentNetworkFee: '0',
|
|
357
|
+
signedTx: '',
|
|
358
|
+
txid,
|
|
356
359
|
walletId: this.walletId
|
|
357
360
|
}
|
|
358
361
|
|
|
@@ -870,19 +873,20 @@ const bogusAccounts = {
|
|
|
870
873
|
}
|
|
871
874
|
]
|
|
872
875
|
const edgeTransaction = {
|
|
873
|
-
txid: '',
|
|
874
|
-
date: 0,
|
|
875
|
-
currencyCode: this.currencyInfo.currencyCode,
|
|
876
876
|
blockHeight: 0,
|
|
877
|
-
|
|
877
|
+
currencyCode: this.currencyInfo.currencyCode,
|
|
878
|
+
date: 0,
|
|
878
879
|
isSend: true,
|
|
880
|
+
memos: [],
|
|
881
|
+
nativeAmount: '-3',
|
|
879
882
|
networkFee: '0',
|
|
880
|
-
ourReceiveAddresses: [],
|
|
881
|
-
signedTx: '',
|
|
882
883
|
otherParams: {
|
|
883
884
|
actions: transferActions,
|
|
884
885
|
signatures: []
|
|
885
886
|
},
|
|
887
|
+
ourReceiveAddresses: [],
|
|
888
|
+
signedTx: '',
|
|
889
|
+
txid: '',
|
|
886
890
|
walletId: this.walletId
|
|
887
891
|
}
|
|
888
892
|
const signedTx = await this.signTx(edgeTransaction, privateKeys)
|
|
@@ -949,8 +953,11 @@ const bogusAccounts = {
|
|
|
949
953
|
}
|
|
950
954
|
|
|
951
955
|
async makeSpend(edgeSpendInfoIn) {
|
|
956
|
+
edgeSpendInfoIn = _upgradeMemos.upgradeMemos.call(void 0, edgeSpendInfoIn, this.currencyInfo)
|
|
952
957
|
const { edgeSpendInfo, currencyCode, nativeBalance, denom } =
|
|
953
958
|
this.makeSpendCheck(edgeSpendInfoIn)
|
|
959
|
+
const { memos = [] } = edgeSpendInfo
|
|
960
|
+
|
|
954
961
|
const tokenInfo = this.getTokenInfo(currencyCode)
|
|
955
962
|
if (tokenInfo == null) throw new Error('Unable to find token info')
|
|
956
963
|
const { contractAddress = 'eosio.token' } = tokenInfo
|
|
@@ -1010,14 +1017,7 @@ const bogusAccounts = {
|
|
|
1010
1017
|
|
|
1011
1018
|
const quantity =
|
|
1012
1019
|
_biggystring.toFixed.call(void 0, exchangeAmount, nativePrecision) + ` ${currencyCode}`
|
|
1013
|
-
|
|
1014
|
-
if (
|
|
1015
|
-
edgeSpendInfo.spendTargets[0].otherParams != null &&
|
|
1016
|
-
typeof edgeSpendInfo.spendTargets[0].otherParams.uniqueIdentifier ===
|
|
1017
|
-
'string'
|
|
1018
|
-
) {
|
|
1019
|
-
memo = edgeSpendInfo.spendTargets[0].otherParams.uniqueIdentifier
|
|
1020
|
-
}
|
|
1020
|
+
const memo = _optionalChain([memos, 'access', _6 => _6[0], 'optionalAccess', _7 => _7.type]) === 'text' ? memos[0].value : undefined
|
|
1021
1021
|
|
|
1022
1022
|
const transferActions = [
|
|
1023
1023
|
{
|
|
@@ -1041,19 +1041,20 @@ const bogusAccounts = {
|
|
|
1041
1041
|
nativeAmount = `-${nativeAmount}`
|
|
1042
1042
|
|
|
1043
1043
|
const edgeTransaction = {
|
|
1044
|
-
txid: '', // txid
|
|
1045
|
-
date: 0, // date
|
|
1046
|
-
currencyCode, // currencyCode
|
|
1047
1044
|
blockHeight: 0, // blockHeight
|
|
1048
|
-
|
|
1045
|
+
currencyCode, // currencyCode
|
|
1046
|
+
date: 0, // date
|
|
1049
1047
|
isSend: nativeAmount.startsWith('-'),
|
|
1048
|
+
memos,
|
|
1049
|
+
nativeAmount, // nativeAmount
|
|
1050
1050
|
networkFee, // networkFee
|
|
1051
|
-
ourReceiveAddresses: [], // ourReceiveAddresses
|
|
1052
|
-
signedTx: '', // signedTx
|
|
1053
1051
|
otherParams: {
|
|
1054
1052
|
actions: transferActions,
|
|
1055
1053
|
signatures: []
|
|
1056
1054
|
},
|
|
1055
|
+
ourReceiveAddresses: [], // ourReceiveAddresses
|
|
1056
|
+
signedTx: '', // signedTx
|
|
1057
|
+
txid: '', // txid
|
|
1057
1058
|
walletId: this.walletId
|
|
1058
1059
|
}
|
|
1059
1060
|
this.warn(
|
|
@@ -1100,7 +1101,7 @@ const bogusAccounts = {
|
|
|
1100
1101
|
edgeTransaction,
|
|
1101
1102
|
opts
|
|
1102
1103
|
) {
|
|
1103
|
-
const eosPrivateKeys = _eosTypes.asEosPrivateKeys.call(void 0, _optionalChain([opts, 'optionalAccess',
|
|
1104
|
+
const eosPrivateKeys = _eosTypes.asEosPrivateKeys.call(void 0, _optionalChain([opts, 'optionalAccess', _8 => _8.privateKeys]))
|
|
1104
1105
|
await this.getResources(eosPrivateKeys)
|
|
1105
1106
|
|
|
1106
1107
|
const otherParams = _utils.getOtherParams(edgeTransaction)
|
|
@@ -1132,13 +1133,13 @@ const bogusAccounts = {
|
|
|
1132
1133
|
} catch (e2) {
|
|
1133
1134
|
throw e
|
|
1134
1135
|
}
|
|
1135
|
-
if (_optionalChain([err, 'access',
|
|
1136
|
+
if (_optionalChain([err, 'access', _9 => _9.error, 'optionalAccess', _10 => _10.name]) === 'tx_net_usage_exceeded') {
|
|
1136
1137
|
err = new Error('Insufficient NET available to send EOS transaction')
|
|
1137
1138
|
err.name = 'ErrorEosInsufficientNet'
|
|
1138
|
-
} else if (_optionalChain([err, 'access',
|
|
1139
|
+
} else if (_optionalChain([err, 'access', _11 => _11.error, 'optionalAccess', _12 => _12.name]) === 'tx_cpu_usage_exceeded') {
|
|
1139
1140
|
err = new Error('Insufficient CPU available to send EOS transaction')
|
|
1140
1141
|
err.name = 'ErrorEosInsufficientCpu'
|
|
1141
|
-
} else if (_optionalChain([err, 'access',
|
|
1142
|
+
} else if (_optionalChain([err, 'access', _13 => _13.error, 'optionalAccess', _14 => _14.name]) === 'ram_usage_exceeded') {
|
|
1142
1143
|
err = new Error('Insufficient RAM available to send EOS transaction')
|
|
1143
1144
|
err.name = 'ErrorEosInsufficientRam'
|
|
1144
1145
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
// https://developers.eos.io/manuals/eos/v2.1/cleos/command-reference/transfer
|
|
4
|
+
const eosMemoOptions = [
|
|
5
|
+
{
|
|
6
|
+
type: 'text',
|
|
7
|
+
memoName: 'memo',
|
|
8
|
+
maxLength: 256
|
|
9
|
+
}
|
|
10
|
+
]; exports.eosMemoOptions = eosMemoOptions
|
package/lib/eos/info/eosInfo.js
CHANGED
|
@@ -4,6 +4,7 @@ var _innerPlugin = require('../../common/innerPlugin');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _eosTypes = require('../eosTypes');
|
|
7
|
+
var _eosCommonInfo = require('./eosCommonInfo');
|
|
7
8
|
|
|
8
9
|
// ----EOSIO MAIN NET----
|
|
9
10
|
const eosNetworkInfo = {
|
|
@@ -27,33 +28,30 @@ var _eosTypes = require('../eosTypes');
|
|
|
27
28
|
uriProtocol: 'eos'
|
|
28
29
|
}; exports.eosNetworkInfo = eosNetworkInfo
|
|
29
30
|
|
|
30
|
-
const denominations = [
|
|
31
|
-
// An array of Objects of the possible denominations for this currency
|
|
32
|
-
{
|
|
33
|
-
name: 'EOS',
|
|
34
|
-
multiplier: '10000',
|
|
35
|
-
symbol: 'E'
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
|
|
39
31
|
const eosCurrencyInfo = {
|
|
40
|
-
// Basic currency information:
|
|
41
32
|
currencyCode: 'EOS',
|
|
42
33
|
displayName: 'EOS',
|
|
34
|
+
memoOptions: _eosCommonInfo.eosMemoOptions,
|
|
43
35
|
pluginId: 'eos',
|
|
36
|
+
unsafeBroadcastTx: true,
|
|
44
37
|
walletType: 'wallet:eos',
|
|
45
38
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
memoMaxLength: 256,
|
|
49
|
-
|
|
39
|
+
// Explorers:
|
|
50
40
|
addressExplorer: 'https://bloks.io/account/%s',
|
|
51
41
|
transactionExplorer: 'https://bloks.io/transaction/%s',
|
|
52
42
|
|
|
53
|
-
denominations
|
|
54
|
-
|
|
43
|
+
denominations: [
|
|
44
|
+
{
|
|
45
|
+
name: 'EOS',
|
|
46
|
+
multiplier: '10000',
|
|
47
|
+
symbol: 'E'
|
|
48
|
+
}
|
|
49
|
+
],
|
|
55
50
|
|
|
56
|
-
|
|
51
|
+
// Deprecated:
|
|
52
|
+
defaultSettings: {},
|
|
53
|
+
memoMaxLength: 256,
|
|
54
|
+
metaTokens: []
|
|
57
55
|
}; exports.eosCurrencyInfo = eosCurrencyInfo
|
|
58
56
|
|
|
59
57
|
const eos = _innerPlugin.makeOuterPlugin({
|
|
@@ -4,6 +4,7 @@ var _innerPlugin = require('../../common/innerPlugin');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _eosTypes = require('../eosTypes');
|
|
7
|
+
var _eosCommonInfo = require('./eosCommonInfo');
|
|
7
8
|
|
|
8
9
|
// ----TELOS MAIN NET----
|
|
9
10
|
const telosNetworkInfo = {
|
|
@@ -20,30 +21,29 @@ var _eosTypes = require('../eosTypes');
|
|
|
20
21
|
uriProtocol: 'telos'
|
|
21
22
|
}; exports.telosNetworkInfo = telosNetworkInfo
|
|
22
23
|
|
|
23
|
-
const denominations = [
|
|
24
|
-
{
|
|
25
|
-
name: 'TLOS',
|
|
26
|
-
multiplier: '10000',
|
|
27
|
-
symbol: 'T'
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
|
|
31
24
|
const telosCurrencyInfo = {
|
|
32
|
-
// Basic currency information:
|
|
33
25
|
currencyCode: 'TLOS',
|
|
34
26
|
displayName: 'Telos',
|
|
27
|
+
memoOptions: _eosCommonInfo.eosMemoOptions,
|
|
35
28
|
pluginId: 'telos',
|
|
36
29
|
walletType: 'wallet:telos',
|
|
37
30
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
memoMaxLength: 256,
|
|
41
|
-
|
|
31
|
+
// Explorers:
|
|
42
32
|
addressExplorer: 'https://telos.bloks.io/account/%s',
|
|
43
33
|
transactionExplorer: 'https://telos.bloks.io/transaction/%s',
|
|
44
34
|
|
|
45
|
-
denominations
|
|
46
|
-
|
|
35
|
+
denominations: [
|
|
36
|
+
{
|
|
37
|
+
name: 'TLOS',
|
|
38
|
+
multiplier: '10000',
|
|
39
|
+
symbol: 'T'
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
|
|
43
|
+
// Deprecated:
|
|
44
|
+
defaultSettings: {},
|
|
45
|
+
memoMaxLength: 256,
|
|
46
|
+
metaTokens: []
|
|
47
47
|
}; exports.telosCurrencyInfo = telosCurrencyInfo
|
|
48
48
|
|
|
49
49
|
const telos = _innerPlugin.makeOuterPlugin({
|
package/lib/eos/info/waxInfo.js
CHANGED
|
@@ -4,6 +4,7 @@ var _innerPlugin = require('../../common/innerPlugin');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _eosTypes = require('../eosTypes');
|
|
7
|
+
var _eosCommonInfo = require('./eosCommonInfo');
|
|
7
8
|
|
|
8
9
|
// ----WAX MAIN NET----
|
|
9
10
|
const waxNetworkInfo = {
|
|
@@ -16,31 +17,29 @@ var _eosTypes = require('../eosTypes');
|
|
|
16
17
|
uriProtocol: 'wax'
|
|
17
18
|
}; exports.waxNetworkInfo = waxNetworkInfo
|
|
18
19
|
|
|
19
|
-
const denominations = [
|
|
20
|
-
// An array of Objects of the possible denominations for this currency
|
|
21
|
-
{
|
|
22
|
-
name: 'WAX',
|
|
23
|
-
multiplier: '100000000',
|
|
24
|
-
symbol: 'W'
|
|
25
|
-
}
|
|
26
|
-
]
|
|
27
|
-
|
|
28
20
|
const waxCurrencyInfo = {
|
|
29
|
-
// Basic currency information:
|
|
30
21
|
currencyCode: 'WAX',
|
|
31
22
|
displayName: 'Wax',
|
|
23
|
+
memoOptions: _eosCommonInfo.eosMemoOptions,
|
|
32
24
|
pluginId: 'wax',
|
|
33
25
|
walletType: 'wallet:wax',
|
|
34
26
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
memoMaxLength: 256,
|
|
38
|
-
|
|
27
|
+
// Explorers:
|
|
39
28
|
addressExplorer: 'https://wax.bloks.io/account/%s',
|
|
40
29
|
transactionExplorer: 'https://wax.bloks.io/transaction/%s',
|
|
41
30
|
|
|
42
|
-
denominations
|
|
43
|
-
|
|
31
|
+
denominations: [
|
|
32
|
+
{
|
|
33
|
+
name: 'WAX',
|
|
34
|
+
multiplier: '100000000',
|
|
35
|
+
symbol: 'W'
|
|
36
|
+
}
|
|
37
|
+
],
|
|
38
|
+
|
|
39
|
+
// Deprecated:
|
|
40
|
+
defaultSettings: {},
|
|
41
|
+
memoMaxLength: 256,
|
|
42
|
+
metaTokens: []
|
|
44
43
|
}; exports.waxCurrencyInfo = waxCurrencyInfo
|
|
45
44
|
|
|
46
45
|
const wax = _innerPlugin.makeOuterPlugin({
|
|
@@ -25,6 +25,7 @@ var _ethereumjswallet = require('ethereumjs-wallet'); var _ethereumjswallet2 = _
|
|
|
25
25
|
|
|
26
26
|
var _CurrencyEngine = require('../common/CurrencyEngine');
|
|
27
27
|
|
|
28
|
+
var _upgradeMemos = require('../common/upgradeMemos');
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
@@ -716,6 +717,7 @@ var _feeProviders = require('./fees/feeProviders');
|
|
|
716
717
|
}
|
|
717
718
|
|
|
718
719
|
async getMaxSpendable(spendInfo) {
|
|
720
|
+
spendInfo = _upgradeMemos.upgradeMemos.call(void 0, spendInfo, this.currencyInfo)
|
|
719
721
|
const { edgeSpendInfo, currencyCode } = this.makeSpendCheck(spendInfo)
|
|
720
722
|
|
|
721
723
|
const balance = this.getBalance({
|
|
@@ -809,17 +811,13 @@ var _feeProviders = require('./fees/feeProviders');
|
|
|
809
811
|
currencyCode,
|
|
810
812
|
currencyInfo
|
|
811
813
|
) {
|
|
814
|
+
const { memos = [] } = edgeSpendInfo
|
|
812
815
|
const { spendTargets } = edgeSpendInfo
|
|
813
816
|
const spendTarget = spendTargets[0]
|
|
814
817
|
const { publicAddress, nativeAmount } = spendTarget
|
|
815
818
|
|
|
816
819
|
// Get data:
|
|
817
|
-
let data =
|
|
818
|
-
_nullishCoalesce(spendTarget.memo, () => ( _optionalChain([spendTarget, 'access', _18 => _18.otherParams, 'optionalAccess', _19 => _19.data])))
|
|
819
|
-
if (data != null && data.length > 0 && !_utils.isHex.call(void 0, data)) {
|
|
820
|
-
throw new Error(`Memo/data field must be of type 'hex'`)
|
|
821
|
-
}
|
|
822
|
-
if (data === '') data = undefined
|
|
820
|
+
let data = _optionalChain([memos, 'access', _18 => _18[0], 'optionalAccess', _19 => _19.type]) === 'hex' ? memos[0].value : undefined
|
|
823
821
|
|
|
824
822
|
// Get contractAddress and/or value:
|
|
825
823
|
let value
|
|
@@ -865,8 +863,10 @@ var _feeProviders = require('./fees/feeProviders');
|
|
|
865
863
|
|
|
866
864
|
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
867
865
|
async makeSpend(edgeSpendInfoIn) {
|
|
866
|
+
edgeSpendInfoIn = _upgradeMemos.upgradeMemos.call(void 0, edgeSpendInfoIn, this.currencyInfo)
|
|
868
867
|
const { edgeSpendInfo, currencyCode, skipChecks } =
|
|
869
868
|
this.makeSpendCheck(edgeSpendInfoIn)
|
|
869
|
+
const { memos = [] } = edgeSpendInfo
|
|
870
870
|
|
|
871
871
|
const { pendingTxs = [] } = edgeSpendInfo
|
|
872
872
|
|
|
@@ -1020,17 +1020,18 @@ var _feeProviders = require('./fees/feeProviders');
|
|
|
1020
1020
|
//
|
|
1021
1021
|
|
|
1022
1022
|
const edgeTransaction = {
|
|
1023
|
-
txid: '', // txid
|
|
1024
|
-
date: 0, // date
|
|
1025
|
-
currencyCode, // currencyCode
|
|
1026
1023
|
blockHeight: 0, // blockHeight
|
|
1027
|
-
|
|
1024
|
+
currencyCode, // currencyCode
|
|
1025
|
+
date: 0, // date
|
|
1026
|
+
feeRateUsed: _EthereumNetwork.getFeeRateUsed.call(void 0, miningFees.gasPrice, otherParams.gas),
|
|
1028
1027
|
isSend: nativeAmount.startsWith('-'),
|
|
1028
|
+
memos,
|
|
1029
|
+
nativeAmount, // nativeAmount
|
|
1029
1030
|
networkFee: nativeNetworkFee, // networkFee
|
|
1030
|
-
|
|
1031
|
+
otherParams, // otherParams
|
|
1031
1032
|
ourReceiveAddresses: [], // ourReceiveAddresses
|
|
1032
1033
|
signedTx: '', // signedTx
|
|
1033
|
-
|
|
1034
|
+
txid: '', // txid
|
|
1034
1035
|
walletId: this.walletId
|
|
1035
1036
|
}
|
|
1036
1037
|
|
|
@@ -344,21 +344,22 @@ async function broadcastWrapper(promise, server) {
|
|
|
344
344
|
if (blockHeight < 0) blockHeight = 0
|
|
345
345
|
|
|
346
346
|
const edgeTransaction = {
|
|
347
|
-
txid,
|
|
348
|
-
date: parseInt(tx.timeStamp),
|
|
349
|
-
currencyCode,
|
|
350
347
|
blockHeight,
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
networkFee,
|
|
348
|
+
currencyCode,
|
|
349
|
+
date: parseInt(tx.timeStamp),
|
|
354
350
|
feeRateUsed:
|
|
355
351
|
gasPrice != null
|
|
356
352
|
? exports.getFeeRateUsed.call(void 0, gasPrice, tx.gas, tx.gasUsed)
|
|
357
353
|
: undefined,
|
|
358
|
-
|
|
354
|
+
isSend: nativeAmount.startsWith('-'),
|
|
355
|
+
memos: [],
|
|
356
|
+
nativeAmount,
|
|
357
|
+
networkFee,
|
|
358
|
+
otherParams,
|
|
359
359
|
ourReceiveAddresses,
|
|
360
|
+
parentNetworkFee,
|
|
360
361
|
signedTx: '',
|
|
361
|
-
|
|
362
|
+
txid,
|
|
362
363
|
walletId: this.walletId
|
|
363
364
|
}
|
|
364
365
|
|
|
@@ -440,17 +441,18 @@ async function broadcastWrapper(promise, server) {
|
|
|
440
441
|
}
|
|
441
442
|
|
|
442
443
|
const edgeTransaction = {
|
|
443
|
-
txid: tokenTransfer.relationships.transaction.data.id,
|
|
444
|
-
date: tokenTransfer.attributes.blockCreationTime,
|
|
445
|
-
currencyCode,
|
|
446
444
|
blockHeight,
|
|
447
|
-
|
|
445
|
+
currencyCode,
|
|
446
|
+
date: tokenTransfer.attributes.blockCreationTime,
|
|
448
447
|
isSend: netNativeAmount.startsWith('-'),
|
|
448
|
+
memos: [],
|
|
449
|
+
nativeAmount: netNativeAmount,
|
|
449
450
|
networkFee,
|
|
451
|
+
otherParams,
|
|
450
452
|
ourReceiveAddresses,
|
|
451
|
-
signedTx: '',
|
|
452
453
|
parentNetworkFee,
|
|
453
|
-
|
|
454
|
+
signedTx: '',
|
|
455
|
+
txid: tokenTransfer.relationships.transaction.data.id,
|
|
454
456
|
walletId: this.walletId
|
|
455
457
|
}
|
|
456
458
|
|
|
@@ -4,6 +4,7 @@ var _innerPlugin = require('../../common/innerPlugin');
|
|
|
4
4
|
var _tokenHelpers = require('../../common/tokenHelpers');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _ethereumCommonInfo = require('./ethereumCommonInfo');
|
|
7
8
|
|
|
8
9
|
const builtinTokens = {
|
|
9
10
|
'60781c2586d68229fde47564546784ab3faca982': {
|
|
@@ -118,6 +119,14 @@ const builtinTokens = {
|
|
|
118
119
|
contractAddress: '0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664'
|
|
119
120
|
}
|
|
120
121
|
},
|
|
122
|
+
'9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7': {
|
|
123
|
+
currencyCode: 'USDT',
|
|
124
|
+
displayName: 'Tether USD',
|
|
125
|
+
denominations: [{ name: 'USDT', multiplier: '1000000' }],
|
|
126
|
+
networkLocation: {
|
|
127
|
+
contractAddress: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7'
|
|
128
|
+
}
|
|
129
|
+
},
|
|
121
130
|
c7198437980c041c805a1edcba50c1ce5db95118: {
|
|
122
131
|
currencyCode: 'USDT.e',
|
|
123
132
|
displayName: 'Tether USD',
|
|
@@ -199,28 +208,29 @@ const defaultSettings = {
|
|
|
199
208
|
}
|
|
200
209
|
|
|
201
210
|
const currencyInfo = {
|
|
202
|
-
|
|
211
|
+
canReplaceByFee: true,
|
|
203
212
|
currencyCode: 'AVAX',
|
|
204
213
|
displayName: 'Avalanche',
|
|
214
|
+
memoOptions: _ethereumCommonInfo.evmMemoOptions,
|
|
205
215
|
pluginId: 'avalanche', // matching mnemonic here
|
|
206
216
|
walletType: 'wallet:avalanche',
|
|
207
|
-
memoType: 'hex',
|
|
208
|
-
|
|
209
|
-
canReplaceByFee: true,
|
|
210
|
-
defaultSettings,
|
|
211
217
|
|
|
218
|
+
// Explorers:
|
|
212
219
|
addressExplorer: 'https://snowtrace.io/address/%s',
|
|
213
220
|
transactionExplorer: 'https://snowtrace.io/tx/%s',
|
|
214
221
|
|
|
215
222
|
denominations: [
|
|
216
|
-
// An array of Objects of the possible denominations for this currency
|
|
217
223
|
{
|
|
218
224
|
name: 'AVAX',
|
|
219
225
|
multiplier: '1000000000000000000',
|
|
220
226
|
symbol: 'AVAX'
|
|
221
227
|
}
|
|
222
228
|
],
|
|
223
|
-
|
|
229
|
+
|
|
230
|
+
// Deprecated:
|
|
231
|
+
defaultSettings,
|
|
232
|
+
memoType: 'hex',
|
|
233
|
+
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
224
234
|
}; exports.currencyInfo = currencyInfo
|
|
225
235
|
|
|
226
236
|
const avalanche = _innerPlugin.makeOuterPlugin({
|
|
@@ -4,6 +4,7 @@ var _innerPlugin = require('../../common/innerPlugin');
|
|
|
4
4
|
var _tokenHelpers = require('../../common/tokenHelpers');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
var _ethereumCommonInfo = require('./ethereumCommonInfo');
|
|
7
8
|
|
|
8
9
|
const builtinTokens = {
|
|
9
10
|
e9e7cea3dedca5984780bafc599bd69add087d56: {
|
|
@@ -82,28 +83,29 @@ const defaultSettings = {
|
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
const currencyInfo = {
|
|
85
|
-
|
|
86
|
+
canReplaceByFee: true,
|
|
86
87
|
currencyCode: 'BNB',
|
|
87
88
|
displayName: 'BNB Smart Chain',
|
|
89
|
+
memoOptions: _ethereumCommonInfo.evmMemoOptions,
|
|
88
90
|
pluginId: 'binancesmartchain',
|
|
89
91
|
walletType: 'wallet:binancesmartchain',
|
|
90
|
-
memoType: 'hex',
|
|
91
|
-
|
|
92
|
-
canReplaceByFee: true,
|
|
93
|
-
defaultSettings,
|
|
94
92
|
|
|
93
|
+
// Explorers:
|
|
95
94
|
addressExplorer: 'https://bscscan.com/address/%s',
|
|
96
95
|
transactionExplorer: 'https://bscscan.com/tx/%s',
|
|
97
96
|
|
|
98
97
|
denominations: [
|
|
99
|
-
// An array of Objects of the possible denominations for this currency
|
|
100
98
|
{
|
|
101
99
|
name: 'BNB',
|
|
102
100
|
multiplier: '1000000000000000000',
|
|
103
101
|
symbol: 'BNB'
|
|
104
102
|
}
|
|
105
103
|
],
|
|
106
|
-
|
|
104
|
+
|
|
105
|
+
// Deprecated:
|
|
106
|
+
defaultSettings,
|
|
107
|
+
memoType: 'hex',
|
|
108
|
+
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
107
109
|
}; exports.currencyInfo = currencyInfo
|
|
108
110
|
|
|
109
111
|
const binancesmartchain = _innerPlugin.makeOuterPlugin
|