edge-currency-accountbased 0.7.72

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +713 -0
  2. package/LICENSE +29 -0
  3. package/README.md +63 -0
  4. package/index.js +3 -0
  5. package/lib/binance/bnbEngine.js +591 -0
  6. package/lib/binance/bnbInfo.js +43 -0
  7. package/lib/binance/bnbPlugin.js +168 -0
  8. package/lib/binance/bnbSchema.js +83 -0
  9. package/lib/binance/bnbTypes.js +39 -0
  10. package/lib/common/engine.js +918 -0
  11. package/lib/common/plugin.js +152 -0
  12. package/lib/common/schema.js +108 -0
  13. package/lib/common/types.js +85 -0
  14. package/lib/common/utils.js +378 -0
  15. package/lib/eos/eosEngine.js +1216 -0
  16. package/lib/eos/eosInfo.js +98 -0
  17. package/lib/eos/eosPlugin.js +314 -0
  18. package/lib/eos/eosSchema.js +190 -0
  19. package/lib/eos/eosTypes.js +88 -0
  20. package/lib/eos/telosInfo.js +94 -0
  21. package/lib/eos/waxInfo.js +95 -0
  22. package/lib/ethereum/etcInfo.js +121 -0
  23. package/lib/ethereum/ethEngine.js +832 -0
  24. package/lib/ethereum/ethInfo.js +1300 -0
  25. package/lib/ethereum/ethMiningFees.js +157 -0
  26. package/lib/ethereum/ethNetwork.js +2195 -0
  27. package/lib/ethereum/ethPlugin.js +377 -0
  28. package/lib/ethereum/ethSchema.js +61 -0
  29. package/lib/ethereum/ethTypes.js +461 -0
  30. package/lib/ethereum/ftminfo.js +102 -0
  31. package/lib/ethereum/rskInfo.js +101 -0
  32. package/lib/fio/fioConst.js +38 -0
  33. package/lib/fio/fioEngine.js +1250 -0
  34. package/lib/fio/fioError.js +38 -0
  35. package/lib/fio/fioInfo.js +72 -0
  36. package/lib/fio/fioPlugin.js +486 -0
  37. package/lib/fio/fioSchema.js +56 -0
  38. package/lib/index.js +44 -0
  39. package/lib/pluginError.js +32 -0
  40. package/lib/react-native/edge-currency-accountbased.js +239635 -0
  41. package/lib/react-native/edge-currency-accountbased.js.map +1 -0
  42. package/lib/react-native-io.js +41 -0
  43. package/lib/stellar/stellarEngine.js +563 -0
  44. package/lib/stellar/stellarInfo.js +37 -0
  45. package/lib/stellar/stellarPlugin.js +215 -0
  46. package/lib/stellar/stellarSchema.js +54 -0
  47. package/lib/stellar/stellarTypes.js +66 -0
  48. package/lib/tezos/tezosEngine.js +497 -0
  49. package/lib/tezos/tezosInfo.js +60 -0
  50. package/lib/tezos/tezosPlugin.js +174 -0
  51. package/lib/tezos/tezosTypes.js +110 -0
  52. package/lib/xrp/xrpEngine.js +583 -0
  53. package/lib/xrp/xrpInfo.js +47 -0
  54. package/lib/xrp/xrpPlugin.js +229 -0
  55. package/lib/xrp/xrpSchema.js +74 -0
  56. package/lib/xrp/xrpTypes.js +38 -0
  57. package/package.json +139 -0
  58. package/postinstall.sh +7 -0
@@ -0,0 +1,461 @@
1
+ /**
2
+ * Created by paul on 8/26/17.
3
+ */
4
+ //
5
+
6
+ import {
7
+ asArray,
8
+ asBoolean,
9
+ asEither,
10
+ asMap,
11
+ asNumber,
12
+ asObject,
13
+ asOptional,
14
+ asString,
15
+ asUnknown
16
+ } from 'cleaners'
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
+ export const asEthereumFeesGasLimit = asObject({
63
+ regularTransaction: asString,
64
+ tokenTransaction: asString
65
+ })
66
+
67
+
68
+
69
+ export const asEthereumFeesGasPrice = asObject({
70
+ lowFee: asString,
71
+ standardFeeLow: asString,
72
+ standardFeeHigh: asString,
73
+
74
+ // The amount of wei which will be charged the standardFeeLow
75
+ standardFeeLowAmount: asString,
76
+
77
+ // The amount of wei which will be charged the standardFeeHigh
78
+ standardFeeHighAmount: asString,
79
+ highFee: asString
80
+ })
81
+
82
+
83
+
84
+ export const asEthereumBaseFeeMultiplier = asObject({
85
+ lowFee: asString,
86
+ standardFeeLow: asString,
87
+ standardFeeHigh: asString,
88
+ highFee: asString
89
+ })
90
+
91
+
92
+
93
+ export const asEthereumFee = asObject({
94
+ baseFeeMultiplier: asOptional(asEthereumBaseFeeMultiplier),
95
+ gasLimit: asEthereumFeesGasLimit,
96
+ gasPrice: asOptional(asEthereumFeesGasPrice),
97
+ minPriorityFee: asOptional(asString)
98
+ })
99
+
100
+
101
+
102
+ export const asEthereumFees = asObject(asEthereumFee)
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ export const asEtherscanTokenTransaction = asObject({
119
+ blockNumber: asString,
120
+ timeStamp: asString,
121
+ hash: asOptional(asString),
122
+ transactionHash: asOptional(asString),
123
+ to: asString,
124
+ from: asString,
125
+ value: asString,
126
+ nonce: asString,
127
+ gasPrice: asString,
128
+ gas: asString,
129
+ cumulativeGasUsed: asString,
130
+ gasUsed: asString,
131
+ confirmations: asString,
132
+ contractAddress: asString,
133
+ tokenName: asString,
134
+ tokenSymbol: asString,
135
+ tokenDecimal: asString
136
+ })
137
+
138
+
139
+
140
+
141
+
142
+ export const asEtherscanTransaction = asObject({
143
+ hash: asOptional(asString),
144
+ transactionHash: asOptional(asString),
145
+ blockNumber: asString,
146
+ timeStamp: asString,
147
+ gasPrice: asString,
148
+ gasUsed: asString,
149
+ value: asString,
150
+ nonce: asString,
151
+ from: asString,
152
+ to: asString,
153
+ gas: asString,
154
+ isError: asString,
155
+ cumulativeGasUsed: asString,
156
+ confirmations: asOptional(asString)
157
+ })
158
+
159
+
160
+
161
+ export const asEtherscanInternalTransaction = asObject({
162
+ hash: asOptional(asString),
163
+ transactionHash: asOptional(asString),
164
+ blockNumber: asString,
165
+ timeStamp: asString,
166
+ gasUsed: asString,
167
+ value: asString,
168
+ from: asString,
169
+ to: asString,
170
+ gas: asString,
171
+ isError: asString,
172
+ contractAddress: asOptional(asString)
173
+ })
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+ export const asBlockbookBlockHeight = asObject({
226
+ blockbook: asObject({
227
+ bestHeight: asNumber
228
+ })
229
+ })
230
+
231
+
232
+
233
+ export const asBlockbookTokenTransfer = asObject({
234
+ from: asString,
235
+ to: asString,
236
+ symbol: asString,
237
+ value: asString,
238
+ token: asString
239
+ })
240
+
241
+
242
+
243
+ export const asBlockbookTx = asObject({
244
+ txid: asString,
245
+ vin: asArray(asObject({ addresses: asArray(asString) })),
246
+ vout: asArray(asObject({ addresses: asArray(asString) })),
247
+ blockHeight: asNumber,
248
+ value: asString,
249
+ blockTime: asNumber,
250
+ tokenTransfers: asOptional(asArray(asBlockbookTokenTransfer)),
251
+ ethereumSpecific: asObject({
252
+ status: asNumber,
253
+ gasLimit: asNumber,
254
+ gasUsed: asNumber,
255
+ gasPrice: asString
256
+ })
257
+ })
258
+
259
+
260
+
261
+ export const asBlockbookTokenBalance = asObject({
262
+ symbol: asString,
263
+ contract: asString,
264
+ balance: asString
265
+ })
266
+
267
+
268
+
269
+ export const asBlockbookAddress = asObject({
270
+ page: asNumber,
271
+ totalPages: asNumber,
272
+ itemsOnPage: asNumber,
273
+ balance: asString,
274
+ unconfirmedBalance: asString,
275
+ unconfirmedTxs: asNumber,
276
+ transactions: asUnknown,
277
+ nonce: asString,
278
+ tokens: asUnknown
279
+ })
280
+
281
+
282
+
283
+ export const asAlethioAccountsTokenTransfer = asObject({
284
+ type: asString,
285
+ attributes: asObject({
286
+ fee: asOptional(asString),
287
+ value: asString,
288
+ blockCreationTime: asNumber,
289
+ symbol: asString,
290
+ globalRank: asArray(asNumber)
291
+ }),
292
+ relationships: asObject({
293
+ token: asObject({
294
+ data: asObject({
295
+ id: asString
296
+ }),
297
+ links: asObject({
298
+ related: asString
299
+ })
300
+ }),
301
+ from: asObject({
302
+ data: asObject({
303
+ id: asString
304
+ }),
305
+ links: asObject({
306
+ related: asString
307
+ })
308
+ }),
309
+ to: asObject({
310
+ data: asObject({
311
+ id: asString
312
+ }),
313
+ links: asObject({
314
+ related: asString
315
+ })
316
+ }),
317
+ transaction: asObject({
318
+ data: asObject({
319
+ id: asString
320
+ }),
321
+ links: asObject({
322
+ related: asString
323
+ })
324
+ })
325
+ }),
326
+ links: asObject({
327
+ next: asString
328
+ }),
329
+ meta: asObject({
330
+ page: asObject({
331
+ hasNext: asBoolean
332
+ })
333
+ })
334
+ })
335
+
336
+
337
+
338
+
339
+
340
+ export const asFetchGetAlethio = asObject({
341
+ data: asArray(asAlethioAccountsTokenTransfer),
342
+ links: asObject({
343
+ next: asString
344
+ }),
345
+ meta: asObject({
346
+ page: asObject({
347
+ hasNext: asBoolean
348
+ })
349
+ })
350
+ })
351
+
352
+
353
+
354
+ export const asBlockChairAddress = asObject({
355
+ balance: asString,
356
+ token_address: asString,
357
+ token_symbol: asString
358
+ })
359
+
360
+
361
+
362
+ export const asCheckTokenBalBlockchair = asObject({
363
+ data: asMap(
364
+ asObject({
365
+ address: asObject({
366
+ balance: asString
367
+ }),
368
+ layer_2: asObject({
369
+ erc_20: asArray(asOptional(asString))
370
+ })
371
+ })
372
+ )
373
+ })
374
+
375
+
376
+
377
+
378
+
379
+
380
+
381
+
382
+
383
+
384
+
385
+
386
+
387
+
388
+
389
+
390
+
391
+ export const asAmberdataAccountsTx = asObject({
392
+ hash: asString,
393
+ timestamp: asString,
394
+ blockNumber: asString,
395
+ value: asString,
396
+ fee: asString,
397
+ gasLimit: asString,
398
+ gasPrice: asString,
399
+ gasUsed: asString,
400
+ cumulativeGasUsed: asString,
401
+ from: asArray(
402
+ asObject({
403
+ address: asString
404
+ })
405
+ ),
406
+ to: asArray(
407
+ asObject({
408
+ address: asString
409
+ })
410
+ )
411
+ })
412
+
413
+
414
+
415
+ export const asAmberdataAccountsFuncs = asObject({
416
+ transactionHash: asString,
417
+ timestamp: asString,
418
+ blockNumber: asString,
419
+ value: asString,
420
+ initialGas: asString,
421
+ leftOverGas: asString,
422
+ from: asObject({ address: asString }),
423
+ to: asArray(asObject({ address: asString }))
424
+ })
425
+
426
+
427
+
428
+ export const asFetchGetAmberdataApiResponse = asObject({
429
+ payload: asObject({
430
+ records: asArray(asEither(asAmberdataAccountsTx, asAmberdataAccountsFuncs))
431
+ })
432
+ })
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+ export const asEtherscanGetAccountBalance = asObject({
450
+ result: asString
451
+ })
452
+
453
+
454
+
455
+
456
+
457
+ export const asCheckTokenBalRpc = asObject({
458
+ result: asString
459
+ })
460
+
461
+
@@ -0,0 +1,102 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+ import { makeEthereumBasedPluginInner } from './ethPlugin'
10
+
11
+
12
+ const defaultNetworkFees = {
13
+ default: {
14
+ baseFeeMultiplier: undefined,
15
+ gasLimit: {
16
+ regularTransaction: '21000',
17
+ tokenTransaction: '200000',
18
+ minGasLimit: '21000'
19
+ },
20
+ gasPrice: {
21
+ lowFee: '1000000001',
22
+ standardFeeLow: '40000000001',
23
+ standardFeeHigh: '300000000001',
24
+ standardFeeLowAmount: '100000000000000000',
25
+ standardFeeHighAmount: '10000000000000000000',
26
+ highFee: '40000000001',
27
+ minGasPrice: '1000000000'
28
+ },
29
+ minPriorityFee: undefined
30
+ }
31
+ }
32
+
33
+ const otherSettings = {
34
+ rpcServers: ['https://rpcapi.fantom.network'],
35
+ etherscanApiServers: ['https://api.ftmscan.com/'],
36
+ blockcypherApiServers: [],
37
+ blockbookServers: [],
38
+ uriNetworks: ['fantom'],
39
+ ercTokenStandard: 'ERC20',
40
+ chainParams: {
41
+ chainId: 250,
42
+ name: 'Fantom Opera'
43
+ },
44
+ hdPathCoinType: 60,
45
+ checkUnconfirmedTransactions: false,
46
+ iosAllowedTokens: {},
47
+ blockchairApiServers: [],
48
+ alethioApiServers: [],
49
+ alethioCurrencies: null, // object or null
50
+ amberdataRpcServers: [],
51
+ amberdataApiServers: [],
52
+ amberDataBlockchainId: '', // ETH mainnet
53
+ pluginMnemonicKeyName: 'fantomMnemonic',
54
+ pluginRegularKeyName: 'fantomKey',
55
+ ethGasStationUrl: null,
56
+ defaultNetworkFees
57
+ }
58
+
59
+ const defaultSettings = {
60
+ customFeeSettings: ['gasLimit', 'gasPrice'],
61
+ otherSettings
62
+ }
63
+
64
+ export const currencyInfo = {
65
+ // Basic currency information:
66
+ currencyCode: 'FTM',
67
+ displayName: 'Fantom',
68
+ pluginId: 'fantom',
69
+ walletType: 'wallet:fantom',
70
+
71
+ defaultSettings,
72
+
73
+ addressExplorer: 'https://ftmscan.com/address/%s',
74
+ transactionExplorer: 'https://ftmscan.com/tx/%s',
75
+
76
+ denominations: [
77
+ // An array of Objects of the possible denominations for this currency
78
+ {
79
+ name: 'FTM',
80
+ multiplier: '1000000000000000000',
81
+ symbol: 'F'
82
+ }
83
+ ],
84
+ metaTokens: [
85
+ // Array of objects describing the supported metatokens
86
+ {
87
+ currencyCode: 'FUSDT',
88
+ currencyName: 'Frapped Tether',
89
+ denominations: [
90
+ {
91
+ name: 'FUSDT',
92
+ multiplier: '1000000'
93
+ }
94
+ ],
95
+ contractAddress: '0x049d68029688eabf473097a2fc38ef61633a3c7a'
96
+ }
97
+ ]
98
+ }
99
+
100
+ export const makeFantomPlugin = (opts) => {
101
+ return makeEthereumBasedPluginInner(opts, currencyInfo)
102
+ }
@@ -0,0 +1,101 @@
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+ import { makeEthereumBasedPluginInner } from './ethPlugin'
10
+
11
+
12
+ const defaultNetworkFees = {
13
+ default: {
14
+ baseFeeMultiplier: undefined,
15
+ gasLimit: {
16
+ regularTransaction: '21000',
17
+ tokenTransaction: '200000',
18
+ minGasLimit: '21000'
19
+ },
20
+ gasPrice: {
21
+ lowFee: '59240000',
22
+ standardFeeLow: '59240000', // TODO: check this values
23
+ standardFeeHigh: '59240000',
24
+ standardFeeLowAmount: '59240000',
25
+ standardFeeHighAmount: '59240000',
26
+ highFee: '59240000',
27
+ minGasPrice: '59240000'
28
+ },
29
+ minPriorityFee: undefined
30
+ }
31
+ }
32
+
33
+ const otherSettings = {
34
+ rpcServers: ['https://public-node.rsk.co'],
35
+ etherscanApiServers: ['https://blockscout.com/rsk/mainnet'],
36
+ blockcypherApiServers: [],
37
+ blockbookServers: [],
38
+ blockchairApiServers: [],
39
+ alethioApiServers: [],
40
+ alethioCurrencies: null,
41
+ amberdataRpcServers: [],
42
+ amberdataApiServers: [],
43
+ amberDataBlockchainId: '', // Only used for ETH right now
44
+ uriNetworks: ['rsk', 'rbtc'],
45
+ ercTokenStandard: 'RRC20',
46
+ chainParams: {
47
+ chainId: 30,
48
+ name: 'RSK Mainnet'
49
+ },
50
+ checkUnconfirmedTransactions: false,
51
+ iosAllowedTokens: { RIF: true },
52
+ hdPathCoinType: 137,
53
+ pluginMnemonicKeyName: 'rskMnemonic',
54
+ pluginRegularKeyName: 'rskKey',
55
+ ethGasStationUrl: null,
56
+ defaultNetworkFees
57
+ }
58
+
59
+ const defaultSettings = {
60
+ customFeeSettings: ['gasLimit', 'gasPrice'],
61
+ otherSettings
62
+ }
63
+
64
+ export const currencyInfo = {
65
+ // Basic currency information:
66
+ currencyCode: 'RBTC',
67
+ displayName: 'RSK',
68
+ pluginId: 'rsk',
69
+ walletType: 'wallet:rsk',
70
+
71
+ defaultSettings,
72
+
73
+ addressExplorer: 'https://explorer.rsk.co/address/%s',
74
+ transactionExplorer: 'https://explorer.rsk.co/tx/%s',
75
+
76
+ denominations: [
77
+ // An array of Objects of the possible denominations for this currency
78
+ {
79
+ name: 'RBTC',
80
+ multiplier: '1000000000000000000',
81
+ symbol: 'RBTC'
82
+ }
83
+ ],
84
+ metaTokens: [
85
+ // Array of objects describing the supported metatokens
86
+ {
87
+ currencyCode: 'RIF',
88
+ currencyName: 'RIF Token',
89
+ denominations: [
90
+ {
91
+ name: 'RIF',
92
+ multiplier: '1000000000000000000'
93
+ }
94
+ ],
95
+ contractAddress: '0x2acc95758f8b5f583470ba265eb685a8f45fc9d5'
96
+ }
97
+ ]
98
+ }
99
+ export const makeRskPlugin = (opts) => {
100
+ return makeEthereumBasedPluginInner(opts, currencyInfo)
101
+ }
@@ -0,0 +1,38 @@
1
+ export const FIO_REG_API_ENDPOINTS = {
2
+ buyAddress: 'buy-address',
3
+ getDomains: 'get-domains',
4
+ isDomainPublic: 'is-domain-public'
5
+ }
6
+ export const HISTORY_NODE_ACTIONS = {
7
+ getActions: 'get_actions'
8
+ }
9
+ export const HISTORY_NODE_OFFSET = 20
10
+
11
+ export const BROADCAST_ACTIONS = {
12
+ recordObtData: true,
13
+ requestFunds: true,
14
+ registerFioAddress: true,
15
+ registerFioDomain: true,
16
+ renewFioAddress: true,
17
+ renewFioDomain: true,
18
+ transferTokens: true,
19
+ addPublicAddresses: true,
20
+ transferFioAddress: true,
21
+ transferFioDomain: true
22
+ }
23
+
24
+ export const ACTIONS_TO_END_POINT_KEYS = {
25
+ requestFunds: 'newFundsRequest',
26
+ registerFioAddress: 'registerFioAddress',
27
+ registerFioDomain: 'registerFioDomain',
28
+ renewFioDomain: 'renewFioDomain',
29
+ renewFioAddress: 'renewFioAddress',
30
+ addPublicAddresses: 'addPubAddress',
31
+ setFioDomainPublic: 'setFioDomainPublic',
32
+ rejectFundsRequest: 'rejectFundsRequest',
33
+ recordObtData: 'recordObtData',
34
+ transferTokens: 'transferTokens',
35
+ pushTransaction: 'pushTransaction',
36
+ transferFioAddress: 'transferFioAddress',
37
+ transferFioDomain: 'transferFioDomain'
38
+ }