edge-currency-accountbased 2.2.4 → 2.4.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 +11 -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/504.chunk.js +2 -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 +11 -9
- 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/index.js +1 -1
- package/lib/piratechain/PiratechainEngine.js +469 -0
- package/lib/piratechain/PiratechainTools.js +239 -0
- package/lib/{zcash → piratechain}/piratechainInfo.js +13 -9
- package/lib/piratechain/piratechainTypes.js +177 -0
- 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/react-native.js +93 -69
- 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 +86 -48
- package/lib/zcash/ZcashTools.js +10 -34
- package/lib/zcash/zcashInfo.js +8 -7
- package/lib/zcash/zcashTypes.js +2 -13
- package/package.json +4 -6
- 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
|
@@ -14,41 +14,45 @@ const networkInfo = {
|
|
|
14
14
|
},
|
|
15
15
|
defaultBirthday: 2040000,
|
|
16
16
|
defaultNetworkFee: '10000',
|
|
17
|
-
nativeSdk: 'piratechain',
|
|
18
17
|
transactionQueryLimit: 999
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
const currencyInfo = {
|
|
22
|
-
// Basic currency information:
|
|
23
21
|
currencyCode: 'ARRR',
|
|
24
22
|
displayName: 'Pirate Chain',
|
|
25
23
|
pluginId: 'piratechain',
|
|
26
24
|
requiredConfirmations: 10,
|
|
25
|
+
unsafeBroadcastTx: true,
|
|
27
26
|
walletType: 'wallet:piratechain',
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
// Explorers:
|
|
31
29
|
addressExplorer: '',
|
|
32
30
|
transactionExplorer: 'https://explorer.pirate.black/tx/%s',
|
|
33
31
|
|
|
34
32
|
denominations: [
|
|
35
|
-
// An array of Objects of the possible denominations for this currency
|
|
36
33
|
{
|
|
37
34
|
name: 'ARRR',
|
|
38
35
|
multiplier: '100000000',
|
|
39
36
|
symbol: 'P'
|
|
40
37
|
}
|
|
41
38
|
],
|
|
42
|
-
metaTokens: [], // Deprecated
|
|
43
39
|
|
|
44
|
-
|
|
40
|
+
// Copied from Zcash:
|
|
41
|
+
memoOptions: [{ type: 'text', maxLength: 512 }],
|
|
42
|
+
|
|
43
|
+
// Deprecated:
|
|
44
|
+
defaultSettings: {},
|
|
45
|
+
metaTokens: []
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
const piratechain = _innerPlugin.makeOuterPlugin
|
|
48
|
+
const piratechain = _innerPlugin.makeOuterPlugin
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
({
|
|
48
52
|
currencyInfo,
|
|
49
53
|
networkInfo,
|
|
50
54
|
|
|
51
55
|
async getInnerPlugin() {
|
|
52
|
-
return await Promise.resolve().then(() => require('./
|
|
56
|
+
return await Promise.resolve().then(() => require('./PiratechainTools'))
|
|
53
57
|
}
|
|
54
58
|
}); exports.piratechain = piratechain
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _cleaners = require('cleaners');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _types = require('../common/types');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
// Block range is inclusive
|
|
92
|
+
const asPiratechainBlockRange = _cleaners.asObject.call(void 0, {
|
|
93
|
+
first: _cleaners.asNumber,
|
|
94
|
+
last: _cleaners.asNumber
|
|
95
|
+
}); exports.asPiratechainBlockRange = asPiratechainBlockRange
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const asPiratechainWalletOtherData = _cleaners.asObject.call(void 0, {
|
|
100
|
+
alias: _cleaners.asMaybe.call(void 0, _cleaners.asString),
|
|
101
|
+
blockRange: _cleaners.asMaybe.call(void 0, exports.asPiratechainBlockRange, {
|
|
102
|
+
first: 0,
|
|
103
|
+
last: 0
|
|
104
|
+
})
|
|
105
|
+
}); exports.asPiratechainWalletOtherData = asPiratechainWalletOtherData
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
const asArrrPublicKey = _cleaners.asObject.call(void 0, {
|
|
133
|
+
birthdayHeight: _cleaners.asNumber,
|
|
134
|
+
publicKey: _cleaners.asString,
|
|
135
|
+
unifiedViewingKeys: _cleaners.asObject.call(void 0, {
|
|
136
|
+
extfvk: _cleaners.asString,
|
|
137
|
+
extpub: _cleaners.asString
|
|
138
|
+
})
|
|
139
|
+
}); exports.asArrrPublicKey = asArrrPublicKey
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
const asSafePiratechainWalletInfo = _types.asWalletInfo.call(void 0, exports.asArrrPublicKey); exports.asSafePiratechainWalletInfo = asSafePiratechainWalletInfo
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
const asPiratechainPrivateKeys = (
|
|
152
|
+
pluginId
|
|
153
|
+
) => {
|
|
154
|
+
const asKeys = _cleaners.asObject.call(void 0, {
|
|
155
|
+
[`${pluginId}Mnemonic`]: _cleaners.asString,
|
|
156
|
+
[`${pluginId}SpendKey`]: _cleaners.asString,
|
|
157
|
+
[`${pluginId}BirthdayHeight`]: _cleaners.asNumber
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
return _cleaners.asCodec.call(void 0,
|
|
161
|
+
raw => {
|
|
162
|
+
const clean = asKeys(raw)
|
|
163
|
+
return {
|
|
164
|
+
mnemonic: clean[`${pluginId}Mnemonic`] ,
|
|
165
|
+
spendKey: clean[`${pluginId}SpendKey`] ,
|
|
166
|
+
birthdayHeight: clean[`${pluginId}BirthdayHeight`]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
clean => {
|
|
170
|
+
return {
|
|
171
|
+
[`${pluginId}Mnemonic`]: clean.mnemonic,
|
|
172
|
+
[`${pluginId}SpendKey`]: clean.spendKey,
|
|
173
|
+
[`${pluginId}BirthdayHeight`]: clean.birthdayHeight
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
)
|
|
177
|
+
}; exports.asPiratechainPrivateKeys = asPiratechainPrivateKeys
|
|
@@ -20,6 +20,7 @@ var _rfc4648 = require('rfc4648');
|
|
|
20
20
|
var _CurrencyEngine = require('../common/CurrencyEngine');
|
|
21
21
|
|
|
22
22
|
var _tokenHelpers = require('../common/tokenHelpers');
|
|
23
|
+
var _upgradeMemos = require('../common/upgradeMemos');
|
|
23
24
|
|
|
24
25
|
|
|
25
26
|
|
|
@@ -189,15 +190,16 @@ const queryTxMutex = _utils.makeMutex.call(void 0, )
|
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
const edgeTransaction = {
|
|
192
|
-
txid: hash,
|
|
193
|
-
date,
|
|
194
|
-
currencyCode: this.currencyInfo.currencyCode,
|
|
195
193
|
blockHeight,
|
|
196
|
-
|
|
194
|
+
currencyCode: this.currencyInfo.currencyCode,
|
|
195
|
+
date,
|
|
197
196
|
isSend: nativeAmount.startsWith('-'),
|
|
197
|
+
memos: [],
|
|
198
|
+
nativeAmount,
|
|
198
199
|
networkFee: fee,
|
|
199
200
|
ourReceiveAddresses,
|
|
200
201
|
signedTx: '',
|
|
202
|
+
txid: hash,
|
|
201
203
|
walletId: this.walletId
|
|
202
204
|
}
|
|
203
205
|
this.addTransaction(this.currencyInfo.currencyCode, edgeTransaction)
|
|
@@ -320,6 +322,7 @@ const queryTxMutex = _utils.makeMutex.call(void 0, )
|
|
|
320
322
|
}
|
|
321
323
|
|
|
322
324
|
async getMaxSpendable(spendInfo) {
|
|
325
|
+
spendInfo = _upgradeMemos.upgradeMemos.call(void 0, spendInfo, this.currencyInfo)
|
|
323
326
|
if (
|
|
324
327
|
spendInfo.spendTargets.length === 0 ||
|
|
325
328
|
spendInfo.spendTargets[0].publicAddress == null
|
|
@@ -385,7 +388,9 @@ const queryTxMutex = _utils.makeMutex.call(void 0, )
|
|
|
385
388
|
}
|
|
386
389
|
|
|
387
390
|
async makeSpend(edgeSpendInfoIn) {
|
|
391
|
+
edgeSpendInfoIn = _upgradeMemos.upgradeMemos.call(void 0, edgeSpendInfoIn, this.currencyInfo)
|
|
388
392
|
const { edgeSpendInfo, currencyCode } = this.makeSpendCheck(edgeSpendInfoIn)
|
|
393
|
+
const { memos = [] } = edgeSpendInfo
|
|
389
394
|
|
|
390
395
|
if (edgeSpendInfo.spendTargets.length !== 1) {
|
|
391
396
|
throw new Error('Error: only one output allowed')
|
|
@@ -482,16 +487,17 @@ const queryTxMutex = _utils.makeMutex.call(void 0, )
|
|
|
482
487
|
// **********************************
|
|
483
488
|
// Create the unsigned EdgeTransaction
|
|
484
489
|
const edgeTransaction = {
|
|
485
|
-
txid: '',
|
|
486
|
-
date: 0,
|
|
487
|
-
currencyCode,
|
|
488
490
|
blockHeight: 0,
|
|
489
|
-
|
|
491
|
+
currencyCode,
|
|
492
|
+
date: 0,
|
|
490
493
|
isSend: true,
|
|
494
|
+
memos,
|
|
495
|
+
nativeAmount: _biggystring.mul.call(void 0, totalTxAmount, '-1'),
|
|
491
496
|
networkFee: nativeNetworkFee,
|
|
497
|
+
otherParams,
|
|
492
498
|
ourReceiveAddresses: [],
|
|
493
499
|
signedTx: '',
|
|
494
|
-
|
|
500
|
+
txid: '',
|
|
495
501
|
walletId: this.walletId
|
|
496
502
|
}
|
|
497
503
|
|
|
@@ -30,6 +30,7 @@ const networkInfo = {
|
|
|
30
30
|
pluginId: 'liberland',
|
|
31
31
|
walletType: 'wallet:liberland',
|
|
32
32
|
|
|
33
|
+
// Explorers:
|
|
33
34
|
addressExplorer: '',
|
|
34
35
|
transactionExplorer:
|
|
35
36
|
'https://polkadot.js.org/apps/?rpc=wss%%3A%%2F%%2Fmainnet.liberland.org%%2F#/explorer/query/%s',
|
|
@@ -42,9 +43,9 @@ const networkInfo = {
|
|
|
42
43
|
}
|
|
43
44
|
],
|
|
44
45
|
|
|
45
|
-
// Deprecated
|
|
46
|
+
// Deprecated:
|
|
46
47
|
defaultSettings: {},
|
|
47
|
-
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
48
|
+
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
48
49
|
}; exports.currencyInfo = currencyInfo
|
|
49
50
|
|
|
50
51
|
const liberland = _innerPlugin.makeOuterPlugin({
|
|
@@ -30,6 +30,7 @@ const networkInfo = {
|
|
|
30
30
|
pluginId: 'liberlandtestnet',
|
|
31
31
|
walletType: 'wallet:liberlandtestnet',
|
|
32
32
|
|
|
33
|
+
// Explorers:
|
|
33
34
|
addressExplorer: '',
|
|
34
35
|
transactionExplorer:
|
|
35
36
|
'https://polkadot.js.org/apps/?rpc=wss%%3A%%2F%%2Ftestchain.liberland.org%%2F#/explorer/query/%s',
|
|
@@ -42,9 +43,9 @@ const networkInfo = {
|
|
|
42
43
|
}
|
|
43
44
|
],
|
|
44
45
|
|
|
45
|
-
// Deprecated
|
|
46
|
+
// Deprecated:
|
|
46
47
|
defaultSettings: {},
|
|
47
|
-
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
48
|
+
metaTokens: _tokenHelpers.makeMetaTokens.call(void 0, builtinTokens)
|
|
48
49
|
}; exports.currencyInfo = currencyInfo
|
|
49
50
|
|
|
50
51
|
const liberlandtestnet = _innerPlugin.makeOuterPlugin
|
|
@@ -13,26 +13,29 @@ const networkInfo = {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
const currencyInfo = {
|
|
16
|
-
// Basic currency information:
|
|
17
16
|
currencyCode: 'DOT',
|
|
18
17
|
displayName: 'Polkadot',
|
|
19
18
|
pluginId: 'polkadot',
|
|
20
19
|
walletType: 'wallet:polkadot',
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
// Explorers:
|
|
24
22
|
addressExplorer: 'https://polkadot.subscan.io/account/%s',
|
|
25
23
|
transactionExplorer: 'https://polkadot.subscan.io/extrinsic/%s',
|
|
26
24
|
|
|
27
25
|
denominations: [
|
|
28
|
-
// An array of Objects of the possible denominations for this currency
|
|
29
26
|
{
|
|
30
27
|
name: 'DOT',
|
|
31
28
|
multiplier: '10000000000',
|
|
32
29
|
symbol: ''
|
|
33
30
|
}
|
|
34
31
|
],
|
|
35
|
-
|
|
32
|
+
|
|
33
|
+
// No memo support:
|
|
34
|
+
memoOptions: [],
|
|
35
|
+
|
|
36
|
+
// Deprecated:
|
|
37
|
+
defaultSettings: {},
|
|
38
|
+
metaTokens: []
|
|
36
39
|
}; exports.currencyInfo = currencyInfo
|
|
37
40
|
|
|
38
41
|
const polkadot = _innerPlugin.makeOuterPlugin({
|
package/lib/react-native.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
var _reactnative = require('react-native');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
// import {
|
|
4
|
+
// AddressTool as PiratechainAddressTool,
|
|
5
|
+
// KeyTool as PiratechainKeyTool,
|
|
6
|
+
// makeSynchronizer as PiratechainMakeSynchronizer,
|
|
7
|
+
// Synchronizer as PirateSynchronizer
|
|
8
|
+
// } from 'react-native-piratechain'
|
|
10
9
|
|
|
11
10
|
|
|
12
11
|
|
|
@@ -14,6 +13,7 @@ var _reactnativepiratechain = require('react-native-piratechain');
|
|
|
14
13
|
var _reactnativezcash = require('react-native-zcash');
|
|
15
14
|
var _yaob = require('yaob');
|
|
16
15
|
|
|
16
|
+
// import { PiratechainInitializerConfig } from './piratechain/piratechainTypes'
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
const { EdgeCurrencyAccountbasedModule } = _reactnative.NativeModules
|
|
@@ -22,63 +22,88 @@ const { sourceUri } = EdgeCurrencyAccountbasedModule.getConstants()
|
|
|
22
22
|
const pluginUri = sourceUri; exports.pluginUri = pluginUri
|
|
23
23
|
const debugUri = 'http://localhost:8082/edge-currency-accountbased.js'; exports.debugUri = debugUri
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
25
|
+
// const makePiratechainSynchronizer = async (
|
|
26
|
+
// config: PiratechainInitializerConfig
|
|
27
|
+
// ): Promise<PirateSynchronizer> => {
|
|
28
|
+
// const realSynchronizer = await PiratechainMakeSynchronizer(config)
|
|
29
|
+
|
|
30
|
+
// realSynchronizer.subscribe({
|
|
31
|
+
// onStatusChanged(status): void {
|
|
32
|
+
// emit(out, 'statusChanged', status)
|
|
33
|
+
// },
|
|
34
|
+
// onUpdate(event): void {
|
|
35
|
+
// emit(out, 'update', event)
|
|
36
|
+
// }
|
|
37
|
+
// })
|
|
38
|
+
|
|
39
|
+
// const out: PirateSynchronizer = bridgifyObject({
|
|
40
|
+
// // @ts-expect-error
|
|
41
|
+
// on: onMethod,
|
|
42
|
+
// start: async () => {
|
|
43
|
+
// return await realSynchronizer.start()
|
|
44
|
+
// },
|
|
45
|
+
// getTransactions: async blockRange => {
|
|
46
|
+
// return await realSynchronizer.getTransactions(blockRange)
|
|
47
|
+
// },
|
|
48
|
+
// rescan: height => {
|
|
49
|
+
// return realSynchronizer.rescan(height)
|
|
50
|
+
// },
|
|
51
|
+
// sendToAddress: async spendInfo => {
|
|
52
|
+
// return await realSynchronizer.sendToAddress(spendInfo)
|
|
53
|
+
// },
|
|
54
|
+
// getShieldedBalance: async () => {
|
|
55
|
+
// return await realSynchronizer.getShieldedBalance()
|
|
56
|
+
// },
|
|
57
|
+
// stop: async () => {
|
|
58
|
+
// return await realSynchronizer.stop()
|
|
59
|
+
// }
|
|
60
|
+
// })
|
|
61
|
+
// return out
|
|
62
|
+
// }
|
|
63
|
+
|
|
64
|
+
const makeZcashSynchronizer = async (
|
|
65
|
+
config
|
|
66
|
+
) => {
|
|
67
|
+
const realSynchronizer = await _reactnativezcash.makeSynchronizer.call(void 0, config)
|
|
68
|
+
|
|
69
|
+
realSynchronizer.subscribe({
|
|
70
|
+
onStatusChanged(status) {
|
|
71
|
+
_yaob.emit.call(void 0, out, 'statusChanged', status)
|
|
72
|
+
},
|
|
73
|
+
onUpdate(event) {
|
|
74
|
+
_yaob.emit.call(void 0, out, 'update', event)
|
|
40
75
|
}
|
|
76
|
+
})
|
|
41
77
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
getShieldedBalance: async () => {
|
|
67
|
-
return await realSynchronizer.getShieldedBalance()
|
|
68
|
-
},
|
|
69
|
-
stop: async () => {
|
|
70
|
-
return await realSynchronizer.stop()
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
return out
|
|
74
|
-
}
|
|
78
|
+
const out = _yaob.bridgifyObject.call(void 0, {
|
|
79
|
+
// @ts-expect-error
|
|
80
|
+
on: _yaob.onMethod,
|
|
81
|
+
deriveUnifiedAddress: async () => {
|
|
82
|
+
return await realSynchronizer.deriveUnifiedAddress()
|
|
83
|
+
},
|
|
84
|
+
getTransactions: async blockRange => {
|
|
85
|
+
return await realSynchronizer.getTransactions(blockRange)
|
|
86
|
+
},
|
|
87
|
+
rescan: () => {
|
|
88
|
+
return realSynchronizer.rescan()
|
|
89
|
+
},
|
|
90
|
+
sendToAddress: async spendInfo => {
|
|
91
|
+
return await realSynchronizer.sendToAddress(spendInfo)
|
|
92
|
+
},
|
|
93
|
+
getBalance: async () => {
|
|
94
|
+
return await realSynchronizer.getBalance()
|
|
95
|
+
},
|
|
96
|
+
stop: async () => {
|
|
97
|
+
return await realSynchronizer.stop()
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
return out
|
|
75
101
|
}
|
|
76
102
|
|
|
77
103
|
function makePluginIo() {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
_yaob.bridgifyObject.call(void 0, _reactnativezcash.
|
|
81
|
-
_yaob.bridgifyObject.call(void 0, _reactnativezcash.AddressTool)
|
|
104
|
+
// bridgifyObject(PiratechainKeyTool)
|
|
105
|
+
// bridgifyObject(PiratechainAddressTool)
|
|
106
|
+
_yaob.bridgifyObject.call(void 0, _reactnativezcash.Tools)
|
|
82
107
|
|
|
83
108
|
return {
|
|
84
109
|
async fetchText(uri, opts) {
|
|
@@ -93,18 +118,17 @@ const makePluginSynchronizer = (pluginId) => {
|
|
|
93
118
|
}))
|
|
94
119
|
)
|
|
95
120
|
},
|
|
96
|
-
piratechain:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}),
|
|
121
|
+
// piratechain: bridgifyObject({
|
|
122
|
+
// KeyTool: PiratechainKeyTool,
|
|
123
|
+
// AddressTool: PiratechainAddressTool,
|
|
124
|
+
// async makeSynchronizer(config: PiratechainInitializerConfig) {
|
|
125
|
+
// return await makePiratechainSynchronizer(config)
|
|
126
|
+
// }
|
|
127
|
+
// }),
|
|
103
128
|
zcash: _yaob.bridgifyObject.call(void 0, {
|
|
104
|
-
|
|
105
|
-
AddressTool: _reactnativezcash.AddressTool,
|
|
129
|
+
Tools: _reactnativezcash.Tools,
|
|
106
130
|
async makeSynchronizer(config) {
|
|
107
|
-
return await
|
|
131
|
+
return await makeZcashSynchronizer(config)
|
|
108
132
|
}
|
|
109
133
|
})
|
|
110
134
|
}
|