edge-currency-accountbased 2.2.4 → 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 +4 -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 +9 -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 +9 -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 +21 -15
- 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 +17 -19
- 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
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': {
|
|
@@ -207,28 +208,29 @@ const defaultSettings = {
|
|
|
207
208
|
}
|
|
208
209
|
|
|
209
210
|
const currencyInfo = {
|
|
210
|
-
|
|
211
|
+
canReplaceByFee: true,
|
|
211
212
|
currencyCode: 'AVAX',
|
|
212
213
|
displayName: 'Avalanche',
|
|
214
|
+
memoOptions: _ethereumCommonInfo.evmMemoOptions,
|
|
213
215
|
pluginId: 'avalanche', // matching mnemonic here
|
|
214
216
|
walletType: 'wallet:avalanche',
|
|
215
|
-
memoType: 'hex',
|
|
216
|
-
|
|
217
|
-
canReplaceByFee: true,
|
|
218
|
-
defaultSettings,
|
|
219
217
|
|
|
218
|
+
// Explorers:
|
|
220
219
|
addressExplorer: 'https://snowtrace.io/address/%s',
|
|
221
220
|
transactionExplorer: 'https://snowtrace.io/tx/%s',
|
|
222
221
|
|
|
223
222
|
denominations: [
|
|
224
|
-
// An array of Objects of the possible denominations for this currency
|
|
225
223
|
{
|
|
226
224
|
name: 'AVAX',
|
|
227
225
|
multiplier: '1000000000000000000',
|
|
228
226
|
symbol: 'AVAX'
|
|
229
227
|
}
|
|
230
228
|
],
|
|
231
|
-
|
|
229
|
+
|
|
230
|
+
// Deprecated:
|
|
231
|
+
defaultSettings,
|
|
232
|
+
memoType: 'hex',
|
|
233
|
+
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
232
234
|
}; exports.currencyInfo = currencyInfo
|
|
233
235
|
|
|
234
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
|
|
@@ -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
|
'765de816845861e75a25fca122bb6898b8b1282a': {
|
|
@@ -87,28 +88,29 @@ const defaultSettings = {
|
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
const currencyInfo = {
|
|
90
|
-
|
|
91
|
+
canReplaceByFee: true,
|
|
91
92
|
currencyCode: 'CELO',
|
|
92
93
|
displayName: 'Celo',
|
|
94
|
+
memoOptions: _ethereumCommonInfo.evmMemoOptions,
|
|
93
95
|
pluginId: 'celo',
|
|
94
96
|
walletType: 'wallet:celo',
|
|
95
|
-
memoType: 'hex',
|
|
96
|
-
|
|
97
|
-
canReplaceByFee: true,
|
|
98
|
-
defaultSettings,
|
|
99
97
|
|
|
98
|
+
// Explorers:
|
|
100
99
|
addressExplorer: 'https://explorer.celo.org/address/%s',
|
|
101
100
|
transactionExplorer: 'https://explorer.celo.org/tx/%s',
|
|
102
101
|
|
|
103
102
|
denominations: [
|
|
104
|
-
// An array of Objects of the possible denominations for this currency
|
|
105
103
|
{
|
|
106
104
|
name: 'CELO',
|
|
107
105
|
multiplier: '1000000000000000000',
|
|
108
106
|
symbol: 'CELO'
|
|
109
107
|
}
|
|
110
108
|
],
|
|
111
|
-
|
|
109
|
+
|
|
110
|
+
// Deprecated:
|
|
111
|
+
defaultSettings,
|
|
112
|
+
memoType: 'hex',
|
|
113
|
+
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
112
114
|
}; exports.currencyInfo = currencyInfo
|
|
113
115
|
|
|
114
116
|
const celo = _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
|
ff795577d9ac8bd7d90ee22b6c1703490b6512fd: {
|
|
@@ -130,21 +131,18 @@ const defaultSettings = {
|
|
|
130
131
|
}
|
|
131
132
|
|
|
132
133
|
const currencyInfo = {
|
|
133
|
-
|
|
134
|
+
canReplaceByFee: true,
|
|
134
135
|
currencyCode: 'ETH',
|
|
135
136
|
displayName: 'Dev Ethereum',
|
|
137
|
+
memoOptions: _ethereumCommonInfo.evmMemoOptions,
|
|
136
138
|
pluginId: 'ethDev',
|
|
137
139
|
walletType: 'wallet:ethDev',
|
|
138
|
-
memoType: 'hex',
|
|
139
|
-
|
|
140
|
-
canReplaceByFee: true,
|
|
141
|
-
defaultSettings,
|
|
142
140
|
|
|
141
|
+
// Explorers:
|
|
143
142
|
addressExplorer: 'https://etherscan.io/address/%s',
|
|
144
143
|
transactionExplorer: 'https://etherscan.io/tx/%s',
|
|
145
144
|
|
|
146
145
|
denominations: [
|
|
147
|
-
// An array of Objects of the possible denominations for this currency
|
|
148
146
|
{
|
|
149
147
|
name: 'ETH',
|
|
150
148
|
multiplier: '1000000000000000000',
|
|
@@ -156,7 +154,11 @@ const defaultSettings = {
|
|
|
156
154
|
symbol: 'mΞ'
|
|
157
155
|
}
|
|
158
156
|
],
|
|
159
|
-
|
|
157
|
+
|
|
158
|
+
// Deprecated:
|
|
159
|
+
defaultSettings,
|
|
160
|
+
memoType: 'hex',
|
|
161
|
+
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
160
162
|
}; exports.currencyInfo = currencyInfo
|
|
161
163
|
|
|
162
164
|
const ethDev = _innerPlugin.makeOuterPlugin({
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
// We are using the memo to pass Ethereum contract calls:
|
|
4
|
+
const evmMemoOptions = [
|
|
5
|
+
{
|
|
6
|
+
type: 'hex',
|
|
7
|
+
hidden: true,
|
|
8
|
+
memoName: 'data'
|
|
9
|
+
}
|
|
10
|
+
]; exports.evmMemoOptions = evmMemoOptions
|