@ledgerhq/coin-tron 0.0.1
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/.eslintrc.js +20 -0
- package/.turbo/turbo-build.log +4 -0
- package/.unimportedrc.json +25 -0
- package/LICENSE.txt +21 -0
- package/jest.config.js +8 -0
- package/jest.integ.config.js +7 -0
- package/lib/bridge/broadcast.d.ts +7 -0
- package/lib/bridge/broadcast.d.ts.map +1 -0
- package/lib/bridge/broadcast.js +26 -0
- package/lib/bridge/broadcast.js.map +1 -0
- package/lib/bridge/buildOptimisticOperation.d.ts +5 -0
- package/lib/bridge/buildOptimisticOperation.d.ts.map +1 -0
- package/lib/bridge/buildOptimisticOperation.js +101 -0
- package/lib/bridge/buildOptimisticOperation.js.map +1 -0
- package/lib/bridge/createTransaction.d.ts +4 -0
- package/lib/bridge/createTransaction.d.ts.map +1 -0
- package/lib/bridge/createTransaction.js +19 -0
- package/lib/bridge/createTransaction.js.map +1 -0
- package/lib/bridge/deviceTransactionConfig.d.ts +20 -0
- package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/bridge/deviceTransactionConfig.js +65 -0
- package/lib/bridge/deviceTransactionConfig.js.map +1 -0
- package/lib/bridge/estimateMaxSpendable.d.ts +5 -0
- package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/bridge/estimateMaxSpendable.js +30 -0
- package/lib/bridge/estimateMaxSpendable.js.map +1 -0
- package/lib/bridge/getEstimateFees.d.ts +6 -0
- package/lib/bridge/getEstimateFees.d.ts.map +1 -0
- package/lib/bridge/getEstimateFees.js +52 -0
- package/lib/bridge/getEstimateFees.js.map +1 -0
- package/lib/bridge/getTransactionStatus.d.ts +4 -0
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
- package/lib/bridge/getTransactionStatus.js +218 -0
- package/lib/bridge/getTransactionStatus.js.map +1 -0
- package/lib/bridge/index.d.ts +10 -0
- package/lib/bridge/index.d.ts.map +1 -0
- package/lib/bridge/index.js +60 -0
- package/lib/bridge/index.js.map +1 -0
- package/lib/bridge/preload.d.ts +8 -0
- package/lib/bridge/preload.d.ts.map +1 -0
- package/lib/bridge/preload.js +32 -0
- package/lib/bridge/preload.js.map +1 -0
- package/lib/bridge/prepareTransaction.d.ts +4 -0
- package/lib/bridge/prepareTransaction.d.ts.map +1 -0
- package/lib/bridge/prepareTransaction.js +19 -0
- package/lib/bridge/prepareTransaction.js.map +1 -0
- package/lib/bridge/serialization.d.ts +9 -0
- package/lib/bridge/serialization.d.ts.map +1 -0
- package/lib/bridge/serialization.js +238 -0
- package/lib/bridge/serialization.js.map +1 -0
- package/lib/bridge/signOperation.d.ts +5 -0
- package/lib/bridge/signOperation.d.ts.map +1 -0
- package/lib/bridge/signOperation.js +92 -0
- package/lib/bridge/signOperation.js.map +1 -0
- package/lib/bridge/synchronization.d.ts +5 -0
- package/lib/bridge/synchronization.d.ts.map +1 -0
- package/lib/bridge/synchronization.integ.test.d.ts +3 -0
- package/lib/bridge/synchronization.integ.test.d.ts.map +1 -0
- package/lib/bridge/synchronization.integ.test.js +96 -0
- package/lib/bridge/synchronization.integ.test.js.map +1 -0
- package/lib/bridge/synchronization.js +216 -0
- package/lib/bridge/synchronization.js.map +1 -0
- package/lib/bridge/transaction.d.ts +15 -0
- package/lib/bridge/transaction.d.ts.map +1 -0
- package/lib/bridge/transaction.js +61 -0
- package/lib/bridge/transaction.js.map +1 -0
- package/lib/config.d.ts +10 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +17 -0
- package/lib/config.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +21 -0
- package/lib/index.js.map +1 -0
- package/lib/logic/constants.d.ts +4 -0
- package/lib/logic/constants.d.ts.map +1 -0
- package/lib/logic/constants.js +7 -0
- package/lib/logic/constants.js.map +1 -0
- package/lib/logic/pagination.d.ts +3 -0
- package/lib/logic/pagination.d.ts.map +1 -0
- package/lib/logic/pagination.js +19 -0
- package/lib/logic/pagination.js.map +1 -0
- package/lib/logic/utils.d.ts +12 -0
- package/lib/logic/utils.d.ts.map +1 -0
- package/lib/logic/utils.js +177 -0
- package/lib/logic/utils.js.map +1 -0
- package/lib/network/format.d.ts +9 -0
- package/lib/network/format.d.ts.map +1 -0
- package/lib/network/format.js +127 -0
- package/lib/network/format.js.map +1 -0
- package/lib/network/index.d.ts +30 -0
- package/lib/network/index.d.ts.map +1 -0
- package/lib/network/index.integ.test.d.ts +2 -0
- package/lib/network/index.integ.test.d.ts.map +1 -0
- package/lib/network/index.integ.test.js +38 -0
- package/lib/network/index.integ.test.js.map +1 -0
- package/lib/network/index.js +555 -0
- package/lib/network/index.js.map +1 -0
- package/lib/network/index.test.d.ts +2 -0
- package/lib/network/index.test.d.ts.map +1 -0
- package/lib/network/index.test.js +66 -0
- package/lib/network/index.test.js.map +1 -0
- package/lib/network/superRepresentativesData.mock.d.ts +69 -0
- package/lib/network/superRepresentativesData.mock.d.ts.map +1 -0
- package/lib/network/superRepresentativesData.mock.js +2208 -0
- package/lib/network/superRepresentativesData.mock.js.map +1 -0
- package/lib/network/types.d.ts +122 -0
- package/lib/network/types.d.ts.map +1 -0
- package/lib/network/types.fixture.d.ts +498 -0
- package/lib/network/types.fixture.d.ts.map +1 -0
- package/lib/network/types.fixture.js +4375 -0
- package/lib/network/types.fixture.js.map +1 -0
- package/lib/network/types.js +13 -0
- package/lib/network/types.js.map +1 -0
- package/lib/signer/getAddress.d.ts +6 -0
- package/lib/signer/getAddress.d.ts.map +1 -0
- package/lib/signer/getAddress.js +19 -0
- package/lib/signer/getAddress.js.map +1 -0
- package/lib/signer/index.d.ts +6 -0
- package/lib/signer/index.d.ts.map +1 -0
- package/lib/signer/index.js +11 -0
- package/lib/signer/index.js.map +1 -0
- package/lib/test/bot-deviceActions.d.ts +4 -0
- package/lib/test/bot-deviceActions.d.ts.map +1 -0
- package/lib/test/bot-deviceActions.js +103 -0
- package/lib/test/bot-deviceActions.js.map +1 -0
- package/lib/test/bot-specs.d.ts +7 -0
- package/lib/test/bot-specs.d.ts.map +1 -0
- package/lib/test/bot-specs.js +433 -0
- package/lib/test/bot-specs.js.map +1 -0
- package/lib/test/bridgeDatasetTest.d.ts +4 -0
- package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
- package/lib/test/bridgeDatasetTest.js +1284 -0
- package/lib/test/bridgeDatasetTest.js.map +1 -0
- package/lib/test/cli.d.ts +52 -0
- package/lib/test/cli.d.ts.map +1 -0
- package/lib/test/cli.js +155 -0
- package/lib/test/cli.js.map +1 -0
- package/lib/test/index.d.ts +6 -0
- package/lib/test/index.d.ts.map +1 -0
- package/lib/test/index.js +26 -0
- package/lib/test/index.js.map +1 -0
- package/lib/types/bridge.d.ts +245 -0
- package/lib/types/bridge.d.ts.map +1 -0
- package/lib/types/bridge.js +16 -0
- package/lib/types/bridge.js.map +1 -0
- package/lib/types/errors.d.ts +49 -0
- package/lib/types/errors.d.ts.map +1 -0
- package/lib/types/errors.js +21 -0
- package/lib/types/errors.js.map +1 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +21 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/signer.d.ts +10 -0
- package/lib/types/signer.d.ts.map +1 -0
- package/lib/types/signer.js +3 -0
- package/lib/types/signer.js.map +1 -0
- package/lib-es/bridge/broadcast.d.ts +7 -0
- package/lib-es/bridge/broadcast.d.ts.map +1 -0
- package/lib-es/bridge/broadcast.js +24 -0
- package/lib-es/bridge/broadcast.js.map +1 -0
- package/lib-es/bridge/buildOptimisticOperation.d.ts +5 -0
- package/lib-es/bridge/buildOptimisticOperation.d.ts.map +1 -0
- package/lib-es/bridge/buildOptimisticOperation.js +94 -0
- package/lib-es/bridge/buildOptimisticOperation.js.map +1 -0
- package/lib-es/bridge/createTransaction.d.ts +4 -0
- package/lib-es/bridge/createTransaction.d.ts.map +1 -0
- package/lib-es/bridge/createTransaction.js +14 -0
- package/lib-es/bridge/createTransaction.js.map +1 -0
- package/lib-es/bridge/deviceTransactionConfig.d.ts +20 -0
- package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
- package/lib-es/bridge/deviceTransactionConfig.js +63 -0
- package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.d.ts +5 -0
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
- package/lib-es/bridge/estimateMaxSpendable.js +25 -0
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
- package/lib-es/bridge/getEstimateFees.d.ts +6 -0
- package/lib-es/bridge/getEstimateFees.d.ts.map +1 -0
- package/lib-es/bridge/getEstimateFees.js +47 -0
- package/lib-es/bridge/getEstimateFees.js.map +1 -0
- package/lib-es/bridge/getTransactionStatus.d.ts +4 -0
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/bridge/getTransactionStatus.js +213 -0
- package/lib-es/bridge/getTransactionStatus.js.map +1 -0
- package/lib-es/bridge/index.d.ts +10 -0
- package/lib-es/bridge/index.d.ts.map +1 -0
- package/lib-es/bridge/index.js +53 -0
- package/lib-es/bridge/index.js.map +1 -0
- package/lib-es/bridge/preload.d.ts +8 -0
- package/lib-es/bridge/preload.d.ts.map +1 -0
- package/lib-es/bridge/preload.js +27 -0
- package/lib-es/bridge/preload.js.map +1 -0
- package/lib-es/bridge/prepareTransaction.d.ts +4 -0
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
- package/lib-es/bridge/prepareTransaction.js +15 -0
- package/lib-es/bridge/prepareTransaction.js.map +1 -0
- package/lib-es/bridge/serialization.d.ts +9 -0
- package/lib-es/bridge/serialization.d.ts.map +1 -0
- package/lib-es/bridge/serialization.js +229 -0
- package/lib-es/bridge/serialization.js.map +1 -0
- package/lib-es/bridge/signOperation.d.ts +5 -0
- package/lib-es/bridge/signOperation.d.ts.map +1 -0
- package/lib-es/bridge/signOperation.js +85 -0
- package/lib-es/bridge/signOperation.js.map +1 -0
- package/lib-es/bridge/synchronization.d.ts +5 -0
- package/lib-es/bridge/synchronization.d.ts.map +1 -0
- package/lib-es/bridge/synchronization.integ.test.d.ts +3 -0
- package/lib-es/bridge/synchronization.integ.test.d.ts.map +1 -0
- package/lib-es/bridge/synchronization.integ.test.js +89 -0
- package/lib-es/bridge/synchronization.integ.test.js.map +1 -0
- package/lib-es/bridge/synchronization.js +209 -0
- package/lib-es/bridge/synchronization.js.map +1 -0
- package/lib-es/bridge/transaction.d.ts +15 -0
- package/lib-es/bridge/transaction.d.ts.map +1 -0
- package/lib-es/bridge/transaction.js +55 -0
- package/lib-es/bridge/transaction.js.map +1 -0
- package/lib-es/config.d.ts +10 -0
- package/lib-es/config.d.ts.map +1 -0
- package/lib-es/config.js +12 -0
- package/lib-es/config.js.map +1 -0
- package/lib-es/index.d.ts +3 -0
- package/lib-es/index.d.ts.map +1 -0
- package/lib-es/index.js +3 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/logic/constants.d.ts +4 -0
- package/lib-es/logic/constants.d.ts.map +1 -0
- package/lib-es/logic/constants.js +4 -0
- package/lib-es/logic/constants.js.map +1 -0
- package/lib-es/logic/pagination.d.ts +3 -0
- package/lib-es/logic/pagination.d.ts.map +1 -0
- package/lib-es/logic/pagination.js +15 -0
- package/lib-es/logic/pagination.js.map +1 -0
- package/lib-es/logic/utils.d.ts +12 -0
- package/lib-es/logic/utils.d.ts.map +1 -0
- package/lib-es/logic/utils.js +167 -0
- package/lib-es/logic/utils.js.map +1 -0
- package/lib-es/network/format.d.ts +9 -0
- package/lib-es/network/format.d.ts.map +1 -0
- package/lib-es/network/format.js +117 -0
- package/lib-es/network/format.js.map +1 -0
- package/lib-es/network/index.d.ts +30 -0
- package/lib-es/network/index.d.ts.map +1 -0
- package/lib-es/network/index.integ.test.d.ts +2 -0
- package/lib-es/network/index.integ.test.d.ts.map +1 -0
- package/lib-es/network/index.integ.test.js +36 -0
- package/lib-es/network/index.integ.test.js.map +1 -0
- package/lib-es/network/index.js +524 -0
- package/lib-es/network/index.js.map +1 -0
- package/lib-es/network/index.test.d.ts +2 -0
- package/lib-es/network/index.test.d.ts.map +1 -0
- package/lib-es/network/index.test.js +63 -0
- package/lib-es/network/index.test.js.map +1 -0
- package/lib-es/network/superRepresentativesData.mock.d.ts +69 -0
- package/lib-es/network/superRepresentativesData.mock.d.ts.map +1 -0
- package/lib-es/network/superRepresentativesData.mock.js +2206 -0
- package/lib-es/network/superRepresentativesData.mock.js.map +1 -0
- package/lib-es/network/types.d.ts +122 -0
- package/lib-es/network/types.d.ts.map +1 -0
- package/lib-es/network/types.fixture.d.ts +498 -0
- package/lib-es/network/types.fixture.d.ts.map +1 -0
- package/lib-es/network/types.fixture.js +4371 -0
- package/lib-es/network/types.fixture.js.map +1 -0
- package/lib-es/network/types.js +8 -0
- package/lib-es/network/types.js.map +1 -0
- package/lib-es/signer/getAddress.d.ts +6 -0
- package/lib-es/signer/getAddress.d.ts.map +1 -0
- package/lib-es/signer/getAddress.js +17 -0
- package/lib-es/signer/getAddress.js.map +1 -0
- package/lib-es/signer/index.d.ts +6 -0
- package/lib-es/signer/index.d.ts.map +1 -0
- package/lib-es/signer/index.js +6 -0
- package/lib-es/signer/index.js.map +1 -0
- package/lib-es/test/bot-deviceActions.d.ts +4 -0
- package/lib-es/test/bot-deviceActions.d.ts.map +1 -0
- package/lib-es/test/bot-deviceActions.js +100 -0
- package/lib-es/test/bot-deviceActions.js.map +1 -0
- package/lib-es/test/bot-specs.d.ts +7 -0
- package/lib-es/test/bot-specs.d.ts.map +1 -0
- package/lib-es/test/bot-specs.js +428 -0
- package/lib-es/test/bot-specs.js.map +1 -0
- package/lib-es/test/bridgeDatasetTest.d.ts +4 -0
- package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
- package/lib-es/test/bridgeDatasetTest.js +1278 -0
- package/lib-es/test/bridgeDatasetTest.js.map +1 -0
- package/lib-es/test/cli.d.ts +52 -0
- package/lib-es/test/cli.d.ts.map +1 -0
- package/lib-es/test/cli.js +149 -0
- package/lib-es/test/cli.js.map +1 -0
- package/lib-es/test/index.d.ts +6 -0
- package/lib-es/test/index.d.ts.map +1 -0
- package/lib-es/test/index.js +6 -0
- package/lib-es/test/index.js.map +1 -0
- package/lib-es/types/bridge.d.ts +245 -0
- package/lib-es/types/bridge.d.ts.map +1 -0
- package/lib-es/types/bridge.js +11 -0
- package/lib-es/types/bridge.js.map +1 -0
- package/lib-es/types/errors.d.ts +49 -0
- package/lib-es/types/errors.d.ts.map +1 -0
- package/lib-es/types/errors.js +18 -0
- package/lib-es/types/errors.js.map +1 -0
- package/lib-es/types/index.d.ts +4 -0
- package/lib-es/types/index.d.ts.map +1 -0
- package/lib-es/types/index.js +5 -0
- package/lib-es/types/index.js.map +1 -0
- package/lib-es/types/signer.d.ts +10 -0
- package/lib-es/types/signer.d.ts.map +1 -0
- package/lib-es/types/signer.js +2 -0
- package/lib-es/types/signer.js.map +1 -0
- package/package.json +133 -0
- package/src/bridge/broadcast.ts +24 -0
- package/src/bridge/buildOptimisticOperation.ts +133 -0
- package/src/bridge/createTransaction.ts +16 -0
- package/src/bridge/deviceTransactionConfig.ts +99 -0
- package/src/bridge/estimateMaxSpendable.ts +32 -0
- package/src/bridge/getEstimateFees.ts +52 -0
- package/src/bridge/getTransactionStatus.ts +263 -0
- package/src/bridge/index.ts +78 -0
- package/src/bridge/preload.ts +24 -0
- package/src/bridge/prepareTransaction.ts +12 -0
- package/src/bridge/serialization.ts +288 -0
- package/src/bridge/signOperation.ts +123 -0
- package/src/bridge/synchronization.integ.test.ts +105 -0
- package/src/bridge/synchronization.ts +284 -0
- package/src/bridge/transaction.ts +84 -0
- package/src/config.ts +24 -0
- package/src/index.ts +3 -0
- package/src/logic/constants.ts +4 -0
- package/src/logic/pagination.ts +21 -0
- package/src/logic/utils.ts +231 -0
- package/src/network/format.ts +148 -0
- package/src/network/index.integ.test.ts +33 -0
- package/src/network/index.test.ts +61 -0
- package/src/network/index.ts +747 -0
- package/src/network/superRepresentativesData.mock.ts +2205 -0
- package/src/network/types.fixture.ts +4476 -0
- package/src/network/types.ts +147 -0
- package/src/signer/getAddress.ts +13 -0
- package/src/signer/index.ts +7 -0
- package/src/test/bot-deviceActions.ts +121 -0
- package/src/test/bot-specs.ts +457 -0
- package/src/test/bridgeDatasetTest.ts +1343 -0
- package/src/test/cli.ts +219 -0
- package/src/test/index.ts +6 -0
- package/src/types/bridge.ts +304 -0
- package/src/types/errors.ts +22 -0
- package/src/types/index.ts +4 -0
- package/src/types/signer.ts +9 -0
- package/tsconfig.json +14 -0
- package/types/tronweb/index.d.ts +5 -0
package/src/test/cli.ts
ADDED
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { getAccountCurrency } from "@ledgerhq/coin-framework/account";
|
|
2
|
+
import type { Account, AccountLike, AccountLikeArray } from "@ledgerhq/types-live";
|
|
3
|
+
import invariant from "invariant";
|
|
4
|
+
import flatMap from "lodash/flatMap";
|
|
5
|
+
import zipWith from "lodash/zipWith";
|
|
6
|
+
import { from, Observable } from "rxjs";
|
|
7
|
+
import { map } from "rxjs/operators";
|
|
8
|
+
import { getTronSuperRepresentativeData } from "../network";
|
|
9
|
+
import type {
|
|
10
|
+
SuperRepresentativeData,
|
|
11
|
+
Transaction,
|
|
12
|
+
TronAccount,
|
|
13
|
+
Transaction as TronTransaction,
|
|
14
|
+
Vote,
|
|
15
|
+
} from "../types";
|
|
16
|
+
|
|
17
|
+
const options = [
|
|
18
|
+
{
|
|
19
|
+
name: "token",
|
|
20
|
+
alias: "t",
|
|
21
|
+
type: String,
|
|
22
|
+
desc: "use an token account children of the account",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "mode",
|
|
26
|
+
type: String,
|
|
27
|
+
desc: "mode of transaction: send, freeze, unfreeze, withdrawExpireUnfreeze, unDelegateResource, legacyUnfreeze",
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
name: "duration",
|
|
31
|
+
type: String,
|
|
32
|
+
desc: "duration in day",
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "resource",
|
|
36
|
+
type: String,
|
|
37
|
+
desc: "reward ENERGY or BANDWIDTH",
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "tronVoteAddress",
|
|
41
|
+
type: String,
|
|
42
|
+
multiple: true,
|
|
43
|
+
desc: "address of the super representative voting",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "tronVoteCount",
|
|
47
|
+
type: String,
|
|
48
|
+
multiple: true,
|
|
49
|
+
desc: "number of votes for the vote address",
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
function inferAccounts(account: Account, opts: Record<string, any>): AccountLikeArray {
|
|
54
|
+
invariant(account.currency.family === "tron", "tron family");
|
|
55
|
+
|
|
56
|
+
if (!opts.token) {
|
|
57
|
+
const accounts: Account[] = [account];
|
|
58
|
+
return accounts;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return opts.token.map((token: string) => {
|
|
62
|
+
const subAccounts = account.subAccounts || [];
|
|
63
|
+
|
|
64
|
+
if (token) {
|
|
65
|
+
const subAccount = subAccounts.find(t => {
|
|
66
|
+
const currency = getAccountCurrency(t);
|
|
67
|
+
return (
|
|
68
|
+
token.toLowerCase() === currency.ticker.toLowerCase() ||
|
|
69
|
+
token.toLowerCase() === currency.id
|
|
70
|
+
);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (!subAccount) {
|
|
74
|
+
throw new Error(
|
|
75
|
+
"token account '" +
|
|
76
|
+
token +
|
|
77
|
+
"' not found. Available: " +
|
|
78
|
+
subAccounts.map(t => getAccountCurrency(t).ticker).join(", "),
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return subAccount;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function inferTransactions(
|
|
88
|
+
transactions: Array<{
|
|
89
|
+
account: AccountLike;
|
|
90
|
+
transaction: Transaction;
|
|
91
|
+
}>,
|
|
92
|
+
opts: Record<string, any>,
|
|
93
|
+
): Transaction[] {
|
|
94
|
+
const mode = opts.mode || "send";
|
|
95
|
+
invariant(
|
|
96
|
+
[
|
|
97
|
+
"send",
|
|
98
|
+
"freeze",
|
|
99
|
+
"unfreeze",
|
|
100
|
+
"vote",
|
|
101
|
+
"claimReward",
|
|
102
|
+
"withdrawExpireUnfreeze",
|
|
103
|
+
"unDelegateResource",
|
|
104
|
+
"legacyUnfreeze",
|
|
105
|
+
].includes(mode),
|
|
106
|
+
`Unexpected mode: ${mode}`,
|
|
107
|
+
);
|
|
108
|
+
const resource = opts.resource ? opts.resource.toUpperCase() : undefined;
|
|
109
|
+
|
|
110
|
+
if (resource) {
|
|
111
|
+
invariant(["BANDWIDTH", "ENERGY"].includes(resource), `Unexpected resource: ${resource}`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const voteAddresses: string[] = opts["tronVoteAddress"] || [];
|
|
115
|
+
const voteCounts: number[] = (opts["tronVoteCount"] || []).map((value: string) => {
|
|
116
|
+
invariant(Number.isInteger(Number(value)), `Invalid integer: ${value}`);
|
|
117
|
+
return parseInt(value);
|
|
118
|
+
});
|
|
119
|
+
const votes: Vote[] = zipWith(voteAddresses, voteCounts, (a, c) => ({
|
|
120
|
+
address: a,
|
|
121
|
+
voteCount: c,
|
|
122
|
+
}));
|
|
123
|
+
return flatMap(transactions, ({ transaction, account }) => {
|
|
124
|
+
invariant(transaction.family === "tron", "tron family");
|
|
125
|
+
|
|
126
|
+
if (account.type === "Account") {
|
|
127
|
+
invariant((account as TronAccount).tronResources, "unactivated account");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (account.type === "TokenAccount") {
|
|
131
|
+
const isDelisted = account.token.delisted === true;
|
|
132
|
+
invariant(!isDelisted, "token is delisted");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return {
|
|
136
|
+
...transaction,
|
|
137
|
+
family: "tron",
|
|
138
|
+
subAccountId: account.type === "TokenAccount" ? account.id : null,
|
|
139
|
+
mode,
|
|
140
|
+
resource,
|
|
141
|
+
votes,
|
|
142
|
+
} as TronTransaction;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const formatOptStr = (str: string | null | undefined): string => str || "";
|
|
147
|
+
|
|
148
|
+
const superRepresentativesFormatters = {
|
|
149
|
+
json: (srData: SuperRepresentativeData): string => JSON.stringify(srData),
|
|
150
|
+
default: (srData: SuperRepresentativeData): string => {
|
|
151
|
+
const headerList = 'address "name" url voteCount brokerage isJobs';
|
|
152
|
+
const strList = srData.list.map(
|
|
153
|
+
sr =>
|
|
154
|
+
`${sr.address} "${formatOptStr(sr.name)}" ${formatOptStr(sr.url)} ${sr.voteCount} ${
|
|
155
|
+
sr.brokerage
|
|
156
|
+
} ${sr.isJobs}`,
|
|
157
|
+
);
|
|
158
|
+
const metaData = [
|
|
159
|
+
`nextVotingDate: ${srData.nextVotingDate}`,
|
|
160
|
+
`totalVotes: ${srData.totalVotes}`,
|
|
161
|
+
];
|
|
162
|
+
return [headerList].concat(strList).concat(metaData).join("\n");
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const tronSuperRepresentative = {
|
|
167
|
+
args: [
|
|
168
|
+
{
|
|
169
|
+
name: "max",
|
|
170
|
+
desc: "max number of super representatives to return",
|
|
171
|
+
type: Number,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: "format",
|
|
175
|
+
desc: Object.keys(superRepresentativesFormatters).join(" | "),
|
|
176
|
+
type: String,
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
job: ({
|
|
180
|
+
max,
|
|
181
|
+
format,
|
|
182
|
+
}: Partial<{
|
|
183
|
+
max: number | null | undefined;
|
|
184
|
+
format: "json" | "default";
|
|
185
|
+
}>): Observable<string> =>
|
|
186
|
+
from(getTronSuperRepresentativeData(max)).pipe(
|
|
187
|
+
map((srData: SuperRepresentativeData) => {
|
|
188
|
+
const f = format
|
|
189
|
+
? superRepresentativesFormatters[format]
|
|
190
|
+
: superRepresentativesFormatters.default;
|
|
191
|
+
return f(srData);
|
|
192
|
+
}),
|
|
193
|
+
),
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export type CliTools = {
|
|
197
|
+
options: typeof options;
|
|
198
|
+
inferAccounts: typeof inferAccounts;
|
|
199
|
+
inferTransactions: (
|
|
200
|
+
transactions: Array<{
|
|
201
|
+
account: AccountLike;
|
|
202
|
+
transaction: Transaction;
|
|
203
|
+
}>,
|
|
204
|
+
opts: Record<string, any>,
|
|
205
|
+
{ inferAmount }: any,
|
|
206
|
+
) => Transaction[];
|
|
207
|
+
commands: { tronSuperRepresentative: typeof tronSuperRepresentative };
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
export default function makeCliTools(): CliTools {
|
|
211
|
+
return {
|
|
212
|
+
options,
|
|
213
|
+
inferAccounts,
|
|
214
|
+
inferTransactions,
|
|
215
|
+
commands: {
|
|
216
|
+
tronSuperRepresentative,
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Account,
|
|
3
|
+
AccountRaw,
|
|
4
|
+
Operation,
|
|
5
|
+
OperationExtra,
|
|
6
|
+
OperationExtraRaw,
|
|
7
|
+
OperationRaw,
|
|
8
|
+
TransactionCommon,
|
|
9
|
+
TransactionCommonRaw,
|
|
10
|
+
TransactionStatusCommon,
|
|
11
|
+
TransactionStatusCommonRaw,
|
|
12
|
+
} from "@ledgerhq/types-live";
|
|
13
|
+
import { BigNumber } from "bignumber.js";
|
|
14
|
+
|
|
15
|
+
export type TronOperationMode =
|
|
16
|
+
| "send"
|
|
17
|
+
| "freeze"
|
|
18
|
+
| "unfreeze"
|
|
19
|
+
| "vote"
|
|
20
|
+
| "claimReward"
|
|
21
|
+
| "withdrawExpireUnfreeze"
|
|
22
|
+
| "unDelegateResource"
|
|
23
|
+
| "legacyUnfreeze";
|
|
24
|
+
|
|
25
|
+
export type TronResource = "BANDWIDTH" | "ENERGY";
|
|
26
|
+
export type NetworkInfo = {
|
|
27
|
+
family: "tron";
|
|
28
|
+
freeNetUsed: BigNumber;
|
|
29
|
+
freeNetLimit: BigNumber;
|
|
30
|
+
netUsed: BigNumber;
|
|
31
|
+
netLimit: BigNumber;
|
|
32
|
+
energyUsed: BigNumber;
|
|
33
|
+
energyLimit: BigNumber;
|
|
34
|
+
};
|
|
35
|
+
export type NetworkInfoRaw = {
|
|
36
|
+
family: "tron";
|
|
37
|
+
freeNetUsed: string;
|
|
38
|
+
freeNetLimit: string;
|
|
39
|
+
netUsed: string;
|
|
40
|
+
netLimit: string;
|
|
41
|
+
energyUsed: string;
|
|
42
|
+
energyLimit: string;
|
|
43
|
+
};
|
|
44
|
+
export type Transaction = TransactionCommon & {
|
|
45
|
+
family: "tron";
|
|
46
|
+
mode: TronOperationMode;
|
|
47
|
+
resource: TronResource | null | undefined;
|
|
48
|
+
networkInfo: NetworkInfo | null | undefined;
|
|
49
|
+
duration: number | null | undefined;
|
|
50
|
+
votes: Vote[];
|
|
51
|
+
};
|
|
52
|
+
export type TransactionRaw = TransactionCommonRaw & {
|
|
53
|
+
mode: TronOperationMode;
|
|
54
|
+
family: "tron";
|
|
55
|
+
resource: TronResource | null | undefined;
|
|
56
|
+
networkInfo: NetworkInfoRaw | null | undefined;
|
|
57
|
+
duration: number | null | undefined;
|
|
58
|
+
votes: Vote[];
|
|
59
|
+
};
|
|
60
|
+
export type TrongridTxType =
|
|
61
|
+
| "TransferContract"
|
|
62
|
+
| "TransferAssetContract"
|
|
63
|
+
| "FreezeBalanceContract"
|
|
64
|
+
| "UnfreezeBalanceContract"
|
|
65
|
+
| "VoteWitnessContract"
|
|
66
|
+
| "TriggerSmartContract"
|
|
67
|
+
| "WithdrawBalanceContract"
|
|
68
|
+
| "ExchangeTransactionContract"
|
|
69
|
+
| "FreezeBalanceV2Contract"
|
|
70
|
+
| "UnfreezeBalanceV2Contract"
|
|
71
|
+
| "WithdrawExpireUnfreezeContract"
|
|
72
|
+
| "UnDelegateResourceContract";
|
|
73
|
+
|
|
74
|
+
export type TrongridTxInfo = {
|
|
75
|
+
txID: string;
|
|
76
|
+
date: Date;
|
|
77
|
+
type: TrongridTxType;
|
|
78
|
+
tokenId?: string;
|
|
79
|
+
from: string;
|
|
80
|
+
to?: string;
|
|
81
|
+
value?: BigNumber;
|
|
82
|
+
fee?: BigNumber;
|
|
83
|
+
resource?: TronResource;
|
|
84
|
+
blockHeight?: number;
|
|
85
|
+
extra?: TrongridExtraTxInfo;
|
|
86
|
+
hasFailed: boolean;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export type TronOperation = Operation<TrongridExtraTxInfo>;
|
|
90
|
+
export type TronOperationRaw = OperationRaw<TrongridExtraTxInfoRaw>;
|
|
91
|
+
|
|
92
|
+
export type TrongridExtraTxInfo = OperationExtra & {
|
|
93
|
+
frozenAmount?: BigNumber;
|
|
94
|
+
unfreezeAmount?: BigNumber;
|
|
95
|
+
votes?: Vote[];
|
|
96
|
+
unDelegatedAmount?: BigNumber;
|
|
97
|
+
receiverAddress?: string;
|
|
98
|
+
};
|
|
99
|
+
export function isTrongridExtraTxInfo(op: OperationExtra): op is TrongridExtraTxInfo {
|
|
100
|
+
return (
|
|
101
|
+
op !== null &&
|
|
102
|
+
typeof op === "object" &&
|
|
103
|
+
("frozenAmount" in op || "unfreezeAmount" in op || "votes" in op)
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
export type TrongridExtraTxInfoRaw = OperationExtraRaw & {
|
|
107
|
+
frozenAmount?: string;
|
|
108
|
+
unfreezeAmount?: string;
|
|
109
|
+
votes?: Vote[];
|
|
110
|
+
unDelegatedAmount?: string;
|
|
111
|
+
receiverAddress?: string;
|
|
112
|
+
};
|
|
113
|
+
export function isTrongridExtraTxInfoRaw(op: OperationExtraRaw): op is TrongridExtraTxInfoRaw {
|
|
114
|
+
return (
|
|
115
|
+
op !== null &&
|
|
116
|
+
typeof op === "object" &&
|
|
117
|
+
("frozenAmount" in op || "unfreezeAmount" in op || "votes" in op)
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Payload types to send to trongrid */
|
|
122
|
+
export type SendTransactionData = {
|
|
123
|
+
to_address: string;
|
|
124
|
+
owner_address: string;
|
|
125
|
+
amount: number;
|
|
126
|
+
asset_name: string | null | undefined;
|
|
127
|
+
};
|
|
128
|
+
export type SmartContractFunction = "transfer(address,uint256)";
|
|
129
|
+
export type SmartContractTransactionData = {
|
|
130
|
+
function_selector: SmartContractFunction;
|
|
131
|
+
fee_limit: number;
|
|
132
|
+
call_value: number;
|
|
133
|
+
contract_address: string;
|
|
134
|
+
parameter: string;
|
|
135
|
+
owner_address: string;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export type FreezeTransactionData = {
|
|
139
|
+
owner_address: string;
|
|
140
|
+
frozen_balance: number;
|
|
141
|
+
resource: TronResource | null | undefined;
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export type UnFreezeTransactionData = {
|
|
145
|
+
owner_address: string;
|
|
146
|
+
resource: TronResource | null | undefined;
|
|
147
|
+
unfreeze_balance: number;
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
export type LegacyUnfreezeTransactionData = {
|
|
151
|
+
receiver_address?: string;
|
|
152
|
+
owner_address: string;
|
|
153
|
+
resource: TronResource | null | undefined;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export type WithdrawExpireUnfreezeTransactionData = {
|
|
157
|
+
owner_address: string;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export type UnDelegateResourceTransactionData = {
|
|
161
|
+
owner_address: string;
|
|
162
|
+
resource: TronResource | null | undefined;
|
|
163
|
+
receiver_address: string;
|
|
164
|
+
balance: number;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export type SendTransactionDataSuccess = {
|
|
168
|
+
raw_data_hex?: string;
|
|
169
|
+
raw_data: Record<string, any> | undefined;
|
|
170
|
+
txID: string;
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
export type SuperRepresentativeData = {
|
|
174
|
+
list: SuperRepresentative[];
|
|
175
|
+
totalVotes: number;
|
|
176
|
+
nextVotingDate: Date;
|
|
177
|
+
};
|
|
178
|
+
export type SuperRepresentative = {
|
|
179
|
+
address: string;
|
|
180
|
+
name: string | null | undefined;
|
|
181
|
+
url: string | null | undefined;
|
|
182
|
+
isJobs: boolean;
|
|
183
|
+
brokerage: number;
|
|
184
|
+
voteCount: number;
|
|
185
|
+
totalProduced: number | null | undefined;
|
|
186
|
+
totalMissed: number | null | undefined;
|
|
187
|
+
latestBlockNum: number | null | undefined;
|
|
188
|
+
latestSlotNum: number | null | undefined;
|
|
189
|
+
};
|
|
190
|
+
export type TronResources = {
|
|
191
|
+
frozen: {
|
|
192
|
+
bandwidth: FrozenInfo | null | undefined;
|
|
193
|
+
energy: FrozenInfo | null | undefined;
|
|
194
|
+
};
|
|
195
|
+
unFrozen: {
|
|
196
|
+
bandwidth: UnFrozenInfo[] | null | undefined;
|
|
197
|
+
energy: UnFrozenInfo[] | null | undefined;
|
|
198
|
+
};
|
|
199
|
+
delegatedFrozen: {
|
|
200
|
+
bandwidth: DelegatedFrozenInfo | null | undefined;
|
|
201
|
+
energy: DelegatedFrozenInfo | null | undefined;
|
|
202
|
+
};
|
|
203
|
+
legacyFrozen: {
|
|
204
|
+
bandwidth: LegacyFrozenInfo | null | undefined;
|
|
205
|
+
energy: LegacyFrozenInfo | null | undefined;
|
|
206
|
+
};
|
|
207
|
+
votes: Vote[];
|
|
208
|
+
tronPower: number;
|
|
209
|
+
energy: BigNumber;
|
|
210
|
+
bandwidth: BandwidthInfo;
|
|
211
|
+
unwithdrawnReward: BigNumber;
|
|
212
|
+
lastWithdrawnRewardDate: Date | null | undefined;
|
|
213
|
+
lastVotedDate: Date | null | undefined;
|
|
214
|
+
cacheTransactionInfoById: Record<string, TronTransactionInfo> | undefined;
|
|
215
|
+
};
|
|
216
|
+
export type TronResourcesRaw = {
|
|
217
|
+
frozen: {
|
|
218
|
+
bandwidth: FrozenInfoRaw | null | undefined;
|
|
219
|
+
energy: FrozenInfoRaw | null | undefined;
|
|
220
|
+
};
|
|
221
|
+
unFrozen: {
|
|
222
|
+
bandwidth: UnFrozenInfoRaw[] | null | undefined;
|
|
223
|
+
energy: UnFrozenInfoRaw[] | null | undefined;
|
|
224
|
+
};
|
|
225
|
+
delegatedFrozen: {
|
|
226
|
+
bandwidth: DelegatedFrozenInfoRaw | null | undefined;
|
|
227
|
+
energy: DelegatedFrozenInfoRaw | null | undefined;
|
|
228
|
+
};
|
|
229
|
+
legacyFrozen: {
|
|
230
|
+
bandwidth: LegacyFrozenInfoRaw | null | undefined;
|
|
231
|
+
energy: LegacyFrozenInfoRaw | null | undefined;
|
|
232
|
+
};
|
|
233
|
+
votes: Vote[];
|
|
234
|
+
tronPower: number;
|
|
235
|
+
energy: string;
|
|
236
|
+
bandwidth: BandwidthInfoRaw;
|
|
237
|
+
unwithdrawnReward: string;
|
|
238
|
+
lastWithdrawnRewardDate: string | null | undefined;
|
|
239
|
+
lastVotedDate: string | null | undefined;
|
|
240
|
+
cacheTransactionInfoById: Record<string, TronTransactionInfoRaw> | undefined;
|
|
241
|
+
};
|
|
242
|
+
export type Vote = {
|
|
243
|
+
address: string;
|
|
244
|
+
voteCount: number;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export type DelegatedFrozenInfo = {
|
|
248
|
+
amount: BigNumber;
|
|
249
|
+
};
|
|
250
|
+
export type DelegatedFrozenInfoRaw = {
|
|
251
|
+
amount: string;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export type FrozenInfo = {
|
|
255
|
+
amount: BigNumber;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
export type FrozenInfoRaw = {
|
|
259
|
+
amount: string;
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
export type LegacyFrozenInfo = {
|
|
263
|
+
amount: BigNumber;
|
|
264
|
+
expiredAt: Date;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export type LegacyFrozenInfoRaw = {
|
|
268
|
+
amount: string;
|
|
269
|
+
expiredAt: string;
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export type UnFrozenInfo = {
|
|
273
|
+
amount: BigNumber;
|
|
274
|
+
expireTime: Date;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
export type UnFrozenInfoRaw = {
|
|
278
|
+
amount: string;
|
|
279
|
+
expireTime: string;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export type BandwidthInfo = {
|
|
283
|
+
freeUsed: BigNumber;
|
|
284
|
+
freeLimit: BigNumber;
|
|
285
|
+
gainedUsed: BigNumber;
|
|
286
|
+
gainedLimit: BigNumber;
|
|
287
|
+
};
|
|
288
|
+
export type BandwidthInfoRaw = {
|
|
289
|
+
freeUsed: string;
|
|
290
|
+
freeLimit: string;
|
|
291
|
+
gainedUsed: string;
|
|
292
|
+
gainedLimit: string;
|
|
293
|
+
};
|
|
294
|
+
export type TronTransactionInfo = {
|
|
295
|
+
fee: number;
|
|
296
|
+
blockNumber: number;
|
|
297
|
+
withdraw_amount?: number;
|
|
298
|
+
unfreeze_amount?: number;
|
|
299
|
+
};
|
|
300
|
+
export type TronTransactionInfoRaw = [number, number, number?, number?];
|
|
301
|
+
export type TronAccount = Account & { tronResources: TronResources };
|
|
302
|
+
export type TronAccountRaw = AccountRaw & { tronResources: TronResourcesRaw };
|
|
303
|
+
export type TransactionStatus = TransactionStatusCommon;
|
|
304
|
+
export type TransactionStatusRaw = TransactionStatusCommonRaw;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createCustomErrorClass } from "@ledgerhq/errors";
|
|
2
|
+
|
|
3
|
+
export const TronNoFrozenForBandwidth = createCustomErrorClass("TronNoFrozenForBandwidth");
|
|
4
|
+
export const TronNoFrozenForEnergy = createCustomErrorClass("TronNoFrozenForEnergy");
|
|
5
|
+
export const TronUnfreezeNotExpired = createCustomErrorClass("TronUnfreezeNotExpired");
|
|
6
|
+
export const TronLegacyUnfreezeNotExpired = createCustomErrorClass("TronLegacyUnfreezeNotExpired");
|
|
7
|
+
export const TronVoteRequired = createCustomErrorClass("TronVoteRequired");
|
|
8
|
+
export const TronInvalidVoteCount = createCustomErrorClass("TronInvalidVoteCount");
|
|
9
|
+
export const TronRewardNotAvailable = createCustomErrorClass("TronRewardNotAvailable");
|
|
10
|
+
export const TronNoReward = createCustomErrorClass("TronNoReward");
|
|
11
|
+
export const TronInvalidFreezeAmount = createCustomErrorClass("TronInvalidFreezeAmount");
|
|
12
|
+
export const TronSendTrc20ToNewAccountForbidden = createCustomErrorClass(
|
|
13
|
+
"TronSendTrc20ToNewAccountForbidden",
|
|
14
|
+
);
|
|
15
|
+
export const TronUnexpectedFees = createCustomErrorClass("TronUnexpectedFees");
|
|
16
|
+
export const TronNotEnoughTronPower = createCustomErrorClass("TronNotEnoughTronPower");
|
|
17
|
+
export const TronTransactionExpired = createCustomErrorClass("TronTransactionExpired");
|
|
18
|
+
export const TronNotEnoughEnergy = createCustomErrorClass("TronNotEnoughEnergy");
|
|
19
|
+
export const TronNoUnfrozenResource = createCustomErrorClass("TronNoUnfrozenResource");
|
|
20
|
+
export const TronInvalidUnDelegateResourceAmount = createCustomErrorClass(
|
|
21
|
+
"TronInvalidUnDelegateResourceAmount",
|
|
22
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type TronAddress = {
|
|
2
|
+
publicKey: string;
|
|
3
|
+
address: string;
|
|
4
|
+
};
|
|
5
|
+
export type TronSignature = string;
|
|
6
|
+
export interface TronSigner {
|
|
7
|
+
getAddress(path: string, boolDisplay?: boolean): Promise<TronAddress>;
|
|
8
|
+
sign(path: string, rawTxHex: string, tokenSignatures: string[]): Promise<TronSignature>;
|
|
9
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../tsconfig.base",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"declarationMap": true,
|
|
6
|
+
"module": "commonjs",
|
|
7
|
+
"downlevelIteration": true,
|
|
8
|
+
"lib": ["es2020", "dom"],
|
|
9
|
+
"outDir": "lib",
|
|
10
|
+
"typeRoots": ["./types", "./node_modules/@types"]
|
|
11
|
+
},
|
|
12
|
+
"include": ["src/**/*"],
|
|
13
|
+
"exclude": ["src/api/subscan.ts", "src/api/websocket.ts"]
|
|
14
|
+
}
|