@ledgerhq/coin-icon 0.4.1-next.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/.eslintrc.js +20 -0
- package/.turbo/turbo-build.log +4 -0
- package/.unimportedrc.json +41 -0
- package/CHANGELOG.md +495 -0
- package/LICENSE.txt +21 -0
- package/jest.config.js +11 -0
- package/lib/__test__/api/index.unit.test.d.ts +2 -0
- package/lib/__test__/api/index.unit.test.d.ts.map +1 -0
- package/lib/__test__/api/index.unit.test.js +173 -0
- package/lib/__test__/api/index.unit.test.js.map +1 -0
- package/lib/__test__/unit/buildTransaction.test.d.ts +2 -0
- package/lib/__test__/unit/buildTransaction.test.d.ts.map +1 -0
- package/lib/__test__/unit/buildTransaction.test.js +76 -0
- package/lib/__test__/unit/buildTransaction.test.js.map +1 -0
- package/lib/__test__/unit/getFeesForTransaction.unit.test.d.ts +2 -0
- package/lib/__test__/unit/getFeesForTransaction.unit.test.d.ts.map +1 -0
- package/lib/__test__/unit/getFeesForTransaction.unit.test.js +101 -0
- package/lib/__test__/unit/getFeesForTransaction.unit.test.js.map +1 -0
- package/lib/__test__/unit/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib/__test__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib/__test__/unit/getTransactionStatus.unit.test.js +178 -0
- package/lib/__test__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib/__test__/unit/logic.unit.test.d.ts +2 -0
- package/lib/__test__/unit/logic.unit.test.d.ts.map +1 -0
- package/lib/__test__/unit/logic.unit.test.js +112 -0
- package/lib/__test__/unit/logic.unit.test.js.map +1 -0
- package/lib/__test__/unit/serializations.unit.test.d.ts +2 -0
- package/lib/__test__/unit/serializations.unit.test.d.ts.map +1 -0
- package/lib/__test__/unit/serializations.unit.test.js +73 -0
- package/lib/__test__/unit/serializations.unit.test.js.map +1 -0
- package/lib/__test__/unit/transaction.unit.test.d.ts +2 -0
- package/lib/__test__/unit/transaction.unit.test.d.ts.map +1 -0
- package/lib/__test__/unit/transaction.unit.test.js +130 -0
- package/lib/__test__/unit/transaction.unit.test.js.map +1 -0
- package/lib/account.d.ts +7 -0
- package/lib/account.d.ts.map +1 -0
- package/lib/account.js +26 -0
- package/lib/account.js.map +1 -0
- package/lib/api/api-type.d.ts +62 -0
- package/lib/api/api-type.d.ts.map +1 -0
- package/lib/api/api-type.js +3 -0
- package/lib/api/api-type.js.map +1 -0
- package/lib/api/index.d.ts +13 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +134 -0
- package/lib/api/index.js.map +1 -0
- package/lib/api/node.d.ts +31 -0
- package/lib/api/node.d.ts.map +1 -0
- package/lib/api/node.js +112 -0
- package/lib/api/node.js.map +1 -0
- package/lib/bridge/index.d.ts +13 -0
- package/lib/bridge/index.d.ts.map +1 -0
- package/lib/bridge/index.js +71 -0
- package/lib/bridge/index.js.map +1 -0
- package/lib/bridge.integration.test.d.ts +4 -0
- package/lib/bridge.integration.test.d.ts.map +1 -0
- package/lib/bridge.integration.test.js +105 -0
- package/lib/bridge.integration.test.js.map +1 -0
- package/lib/broadcast.d.ts +9 -0
- package/lib/broadcast.d.ts.map +1 -0
- package/lib/broadcast.js +25 -0
- package/lib/broadcast.js.map +1 -0
- package/lib/buildTransaction.d.ts +12 -0
- package/lib/buildTransaction.d.ts.map +1 -0
- package/lib/buildTransaction.js +55 -0
- package/lib/buildTransaction.js.map +1 -0
- package/lib/cli-transaction.d.ts +16 -0
- package/lib/cli-transaction.d.ts.map +1 -0
- package/lib/cli-transaction.js +35 -0
- package/lib/cli-transaction.js.map +1 -0
- package/lib/config.d.ts +15 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +17 -0
- package/lib/config.js.map +1 -0
- package/lib/constants.d.ts +14 -0
- package/lib/constants.d.ts.map +1 -0
- package/lib/constants.js +17 -0
- package/lib/constants.js.map +1 -0
- package/lib/createTransaction.d.ts +8 -0
- package/lib/createTransaction.d.ts.map +1 -0
- package/lib/createTransaction.js +19 -0
- package/lib/createTransaction.js.map +1 -0
- package/lib/deviceTransactionConfig.d.ts +15 -0
- package/lib/deviceTransactionConfig.d.ts.map +1 -0
- package/lib/deviceTransactionConfig.js +24 -0
- package/lib/deviceTransactionConfig.js.map +1 -0
- package/lib/errors.d.ts +10 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +8 -0
- package/lib/errors.js.map +1 -0
- package/lib/estimateMaxSpendable.d.ts +14 -0
- package/lib/estimateMaxSpendable.d.ts.map +1 -0
- package/lib/estimateMaxSpendable.js +38 -0
- package/lib/estimateMaxSpendable.js.map +1 -0
- package/lib/getFeesForTransaction.d.ts +14 -0
- package/lib/getFeesForTransaction.d.ts.map +1 -0
- package/lib/getFeesForTransaction.js +44 -0
- package/lib/getFeesForTransaction.js.map +1 -0
- package/lib/getTransactionStatus.d.ts +4 -0
- package/lib/getTransactionStatus.d.ts.map +1 -0
- package/lib/getTransactionStatus.js +114 -0
- package/lib/getTransactionStatus.js.map +1 -0
- package/lib/hw-getAddress.d.ts +6 -0
- package/lib/hw-getAddress.d.ts.map +1 -0
- package/lib/hw-getAddress.js +23 -0
- package/lib/hw-getAddress.js.map +1 -0
- package/lib/initAccount.d.ts +3 -0
- package/lib/initAccount.d.ts.map +1 -0
- package/lib/initAccount.js +13 -0
- package/lib/initAccount.js.map +1 -0
- package/lib/logic.d.ts +55 -0
- package/lib/logic.d.ts.map +1 -0
- package/lib/logic.js +124 -0
- package/lib/logic.js.map +1 -0
- package/lib/prepareTransaction.d.ts +9 -0
- package/lib/prepareTransaction.d.ts.map +1 -0
- package/lib/prepareTransaction.js +33 -0
- package/lib/prepareTransaction.js.map +1 -0
- package/lib/serialization.d.ts +7 -0
- package/lib/serialization.d.ts.map +1 -0
- package/lib/serialization.js +36 -0
- package/lib/serialization.js.map +1 -0
- package/lib/signOperation.d.ts +10 -0
- package/lib/signOperation.d.ts.map +1 -0
- package/lib/signOperation.js +96 -0
- package/lib/signOperation.js.map +1 -0
- package/lib/signer.d.ts +14 -0
- package/lib/signer.d.ts.map +1 -0
- package/lib/signer.js +3 -0
- package/lib/signer.js.map +1 -0
- package/lib/specs.d.ts +7 -0
- package/lib/specs.d.ts.map +1 -0
- package/lib/specs.js +100 -0
- package/lib/specs.js.map +1 -0
- package/lib/speculos-deviceActions.d.ts +4 -0
- package/lib/speculos-deviceActions.d.ts.map +1 -0
- package/lib/speculos-deviceActions.js +44 -0
- package/lib/speculos-deviceActions.js.map +1 -0
- package/lib/synchronization.d.ts +3 -0
- package/lib/synchronization.d.ts.map +1 -0
- package/lib/synchronization.js +76 -0
- package/lib/synchronization.js.map +1 -0
- package/lib/transaction.d.ts +15 -0
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js +39 -0
- package/lib/transaction.js.map +1 -0
- package/lib/types/bridge.fixture.d.ts +5 -0
- package/lib/types/bridge.fixture.d.ts.map +1 -0
- package/lib/types/bridge.fixture.js +77 -0
- package/lib/types/bridge.fixture.js.map +1 -0
- package/lib/types/index.d.ts +46 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js +3 -0
- package/lib/types/index.js.map +1 -0
- package/lib-es/__test__/api/index.unit.test.d.ts +2 -0
- package/lib-es/__test__/api/index.unit.test.d.ts.map +1 -0
- package/lib-es/__test__/api/index.unit.test.js +145 -0
- package/lib-es/__test__/api/index.unit.test.js.map +1 -0
- package/lib-es/__test__/unit/buildTransaction.test.d.ts +2 -0
- package/lib-es/__test__/unit/buildTransaction.test.d.ts.map +1 -0
- package/lib-es/__test__/unit/buildTransaction.test.js +71 -0
- package/lib-es/__test__/unit/buildTransaction.test.js.map +1 -0
- package/lib-es/__test__/unit/getFeesForTransaction.unit.test.d.ts +2 -0
- package/lib-es/__test__/unit/getFeesForTransaction.unit.test.d.ts.map +1 -0
- package/lib-es/__test__/unit/getFeesForTransaction.unit.test.js +73 -0
- package/lib-es/__test__/unit/getFeesForTransaction.unit.test.js.map +1 -0
- package/lib-es/__test__/unit/getTransactionStatus.unit.test.d.ts +2 -0
- package/lib-es/__test__/unit/getTransactionStatus.unit.test.d.ts.map +1 -0
- package/lib-es/__test__/unit/getTransactionStatus.unit.test.js +153 -0
- package/lib-es/__test__/unit/getTransactionStatus.unit.test.js.map +1 -0
- package/lib-es/__test__/unit/logic.unit.test.d.ts +2 -0
- package/lib-es/__test__/unit/logic.unit.test.d.ts.map +1 -0
- package/lib-es/__test__/unit/logic.unit.test.js +107 -0
- package/lib-es/__test__/unit/logic.unit.test.js.map +1 -0
- package/lib-es/__test__/unit/serializations.unit.test.d.ts +2 -0
- package/lib-es/__test__/unit/serializations.unit.test.d.ts.map +1 -0
- package/lib-es/__test__/unit/serializations.unit.test.js +71 -0
- package/lib-es/__test__/unit/serializations.unit.test.js.map +1 -0
- package/lib-es/__test__/unit/transaction.unit.test.d.ts +2 -0
- package/lib-es/__test__/unit/transaction.unit.test.d.ts.map +1 -0
- package/lib-es/__test__/unit/transaction.unit.test.js +128 -0
- package/lib-es/__test__/unit/transaction.unit.test.js.map +1 -0
- package/lib-es/account.d.ts +7 -0
- package/lib-es/account.d.ts.map +1 -0
- package/lib-es/account.js +24 -0
- package/lib-es/account.js.map +1 -0
- package/lib-es/api/api-type.d.ts +62 -0
- package/lib-es/api/api-type.d.ts.map +1 -0
- package/lib-es/api/api-type.js +2 -0
- package/lib-es/api/api-type.js.map +1 -0
- package/lib-es/api/index.d.ts +13 -0
- package/lib-es/api/index.d.ts.map +1 -0
- package/lib-es/api/index.js +123 -0
- package/lib-es/api/index.js.map +1 -0
- package/lib-es/api/node.d.ts +31 -0
- package/lib-es/api/node.d.ts.map +1 -0
- package/lib-es/api/node.js +99 -0
- package/lib-es/api/node.js.map +1 -0
- package/lib-es/bridge/index.d.ts +13 -0
- package/lib-es/bridge/index.d.ts.map +1 -0
- package/lib-es/bridge/index.js +62 -0
- package/lib-es/bridge/index.js.map +1 -0
- package/lib-es/bridge.integration.test.d.ts +4 -0
- package/lib-es/bridge.integration.test.d.ts.map +1 -0
- package/lib-es/bridge.integration.test.js +99 -0
- package/lib-es/bridge.integration.test.js.map +1 -0
- package/lib-es/broadcast.d.ts +9 -0
- package/lib-es/broadcast.d.ts.map +1 -0
- package/lib-es/broadcast.js +21 -0
- package/lib-es/broadcast.js.map +1 -0
- package/lib-es/buildTransaction.d.ts +12 -0
- package/lib-es/buildTransaction.d.ts.map +1 -0
- package/lib-es/buildTransaction.js +48 -0
- package/lib-es/buildTransaction.js.map +1 -0
- package/lib-es/cli-transaction.d.ts +16 -0
- package/lib-es/cli-transaction.d.ts.map +1 -0
- package/lib-es/cli-transaction.js +29 -0
- package/lib-es/cli-transaction.js.map +1 -0
- package/lib-es/config.d.ts +15 -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/constants.d.ts +14 -0
- package/lib-es/constants.d.ts.map +1 -0
- package/lib-es/constants.js +14 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/createTransaction.d.ts +8 -0
- package/lib-es/createTransaction.d.ts.map +1 -0
- package/lib-es/createTransaction.js +15 -0
- package/lib-es/createTransaction.js.map +1 -0
- package/lib-es/deviceTransactionConfig.d.ts +15 -0
- package/lib-es/deviceTransactionConfig.d.ts.map +1 -0
- package/lib-es/deviceTransactionConfig.js +22 -0
- package/lib-es/deviceTransactionConfig.js.map +1 -0
- package/lib-es/errors.d.ts +10 -0
- package/lib-es/errors.d.ts.map +1 -0
- package/lib-es/errors.js +5 -0
- package/lib-es/errors.js.map +1 -0
- package/lib-es/estimateMaxSpendable.d.ts +14 -0
- package/lib-es/estimateMaxSpendable.d.ts.map +1 -0
- package/lib-es/estimateMaxSpendable.js +31 -0
- package/lib-es/estimateMaxSpendable.js.map +1 -0
- package/lib-es/getFeesForTransaction.d.ts +14 -0
- package/lib-es/getFeesForTransaction.d.ts.map +1 -0
- package/lib-es/getFeesForTransaction.js +42 -0
- package/lib-es/getFeesForTransaction.js.map +1 -0
- package/lib-es/getTransactionStatus.d.ts +4 -0
- package/lib-es/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/getTransactionStatus.js +109 -0
- package/lib-es/getTransactionStatus.js.map +1 -0
- package/lib-es/hw-getAddress.d.ts +6 -0
- package/lib-es/hw-getAddress.d.ts.map +1 -0
- package/lib-es/hw-getAddress.js +21 -0
- package/lib-es/hw-getAddress.js.map +1 -0
- package/lib-es/initAccount.d.ts +3 -0
- package/lib-es/initAccount.d.ts.map +1 -0
- package/lib-es/initAccount.js +9 -0
- package/lib-es/initAccount.js.map +1 -0
- package/lib-es/logic.d.ts +55 -0
- package/lib-es/logic.d.ts.map +1 -0
- package/lib-es/logic.js +109 -0
- package/lib-es/logic.js.map +1 -0
- package/lib-es/prepareTransaction.d.ts +9 -0
- package/lib-es/prepareTransaction.d.ts.map +1 -0
- package/lib-es/prepareTransaction.js +26 -0
- package/lib-es/prepareTransaction.js.map +1 -0
- package/lib-es/serialization.d.ts +7 -0
- package/lib-es/serialization.d.ts.map +1 -0
- package/lib-es/serialization.js +29 -0
- package/lib-es/serialization.js.map +1 -0
- package/lib-es/signOperation.d.ts +10 -0
- package/lib-es/signOperation.d.ts.map +1 -0
- package/lib-es/signOperation.js +89 -0
- package/lib-es/signOperation.js.map +1 -0
- package/lib-es/signer.d.ts +14 -0
- package/lib-es/signer.d.ts.map +1 -0
- package/lib-es/signer.js +2 -0
- package/lib-es/signer.js.map +1 -0
- package/lib-es/specs.d.ts +7 -0
- package/lib-es/specs.d.ts.map +1 -0
- package/lib-es/specs.js +95 -0
- package/lib-es/specs.js.map +1 -0
- package/lib-es/speculos-deviceActions.d.ts +4 -0
- package/lib-es/speculos-deviceActions.d.ts.map +1 -0
- package/lib-es/speculos-deviceActions.js +41 -0
- package/lib-es/speculos-deviceActions.js.map +1 -0
- package/lib-es/synchronization.d.ts +3 -0
- package/lib-es/synchronization.d.ts.map +1 -0
- package/lib-es/synchronization.js +69 -0
- package/lib-es/synchronization.js.map +1 -0
- package/lib-es/transaction.d.ts +15 -0
- package/lib-es/transaction.d.ts.map +1 -0
- package/lib-es/transaction.js +33 -0
- package/lib-es/transaction.js.map +1 -0
- package/lib-es/types/bridge.fixture.d.ts +5 -0
- package/lib-es/types/bridge.fixture.d.ts.map +1 -0
- package/lib-es/types/bridge.fixture.js +68 -0
- package/lib-es/types/bridge.fixture.js.map +1 -0
- package/lib-es/types/index.d.ts +46 -0
- package/lib-es/types/index.d.ts.map +1 -0
- package/lib-es/types/index.js +2 -0
- package/lib-es/types/index.js.map +1 -0
- package/package.json +85 -0
- package/src/__test__/api/index.unit.test.ts +151 -0
- package/src/__test__/unit/buildTransaction.test.ts +76 -0
- package/src/__test__/unit/getFeesForTransaction.unit.test.ts +76 -0
- package/src/__test__/unit/getTransactionStatus.unit.test.ts +172 -0
- package/src/__test__/unit/logic.unit.test.ts +145 -0
- package/src/__test__/unit/serializations.unit.test.ts +92 -0
- package/src/__test__/unit/transaction.unit.test.ts +144 -0
- package/src/account.ts +30 -0
- package/src/api/api-type.ts +65 -0
- package/src/api/index.ts +156 -0
- package/src/api/node.ts +115 -0
- package/src/bridge/index.ts +76 -0
- package/src/bridge.integration.test.ts +107 -0
- package/src/broadcast.ts +18 -0
- package/src/buildTransaction.ts +53 -0
- package/src/cli-transaction.ts +49 -0
- package/src/config.ts +29 -0
- package/src/constants.ts +14 -0
- package/src/createTransaction.ts +16 -0
- package/src/deviceTransactionConfig.ts +44 -0
- package/src/errors.ts +5 -0
- package/src/estimateMaxSpendable.ts +34 -0
- package/src/getFeesForTransaction.ts +46 -0
- package/src/getTransactionStatus.ts +139 -0
- package/src/hw-getAddress.ts +19 -0
- package/src/initAccount.ts +11 -0
- package/src/logic.ts +132 -0
- package/src/prepareTransaction.ts +24 -0
- package/src/serialization.ts +34 -0
- package/src/signOperation.ts +140 -0
- package/src/signer.ts +14 -0
- package/src/specs.ts +124 -0
- package/src/speculos-deviceActions.ts +46 -0
- package/src/synchronization.ts +70 -0
- package/src/transaction.ts +60 -0
- package/src/types/bridge.fixture.ts +75 -0
- package/src/types/index.ts +61 -0
- package/tsconfig.json +12 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
import type { IcxTransaction } from "icon-sdk-js";
|
|
3
|
+
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
|
|
4
|
+
import { IconAccount } from "../types/index";
|
|
5
|
+
import { SignedOperation } from "@ledgerhq/types-live";
|
|
6
|
+
import { IconDelegationType } from "./api-type";
|
|
7
|
+
/**
|
|
8
|
+
* Returns Testnet RPC URL if the current currency is testnet
|
|
9
|
+
* @param {currency} currency
|
|
10
|
+
*/
|
|
11
|
+
export declare function getRpcUrl(currency: CryptoCurrency): string;
|
|
12
|
+
export declare function getDebugRpcUrl(currency: CryptoCurrency): string;
|
|
13
|
+
/**
|
|
14
|
+
* Broadcast blob to blockchain
|
|
15
|
+
*/
|
|
16
|
+
export declare const broadcastTransaction: (signedOperation: SignedOperation, currency: CryptoCurrency) => Promise<{
|
|
17
|
+
hash: string;
|
|
18
|
+
}>;
|
|
19
|
+
export declare const submit: (signedOperation: SignedOperation, currency: CryptoCurrency) => Promise<{
|
|
20
|
+
hash: string;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Obtain fees from blockchain
|
|
24
|
+
*/
|
|
25
|
+
export declare const getFees: (unsigned: IcxTransaction, account: IconAccount) => Promise<BigNumber>;
|
|
26
|
+
/**
|
|
27
|
+
* Get step price from governance contract
|
|
28
|
+
*/
|
|
29
|
+
export declare const getStepPrice: (account: IconAccount) => Promise<BigNumber>;
|
|
30
|
+
export declare const getDelegation: (address: string, currency: CryptoCurrency) => Promise<IconDelegationType>;
|
|
31
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/api/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAMhD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAO1D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,cAAc,GAAG,MAAM,CAO/D;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,oBACd,eAAe,YACtB,cAAc;;EAIzB,CAAC;AAEF,eAAO,MAAM,MAAM,oBAA2B,eAAe,YAAY,cAAc;;EAiBtF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,aACR,cAAc,WACf,WAAW,KACnB,QAAQ,SAAS,CAMnB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,YAAmB,WAAW,KAAG,QAAQ,SAAS,CAQ1E,CAAC;AAEF,eAAO,MAAM,aAAa,YACf,MAAM,YACL,cAAc,KACvB,QAAQ,kBAAkB,CAkB5B,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { BigNumber } from "bignumber.js";
|
|
11
|
+
import IconService from "icon-sdk-js";
|
|
12
|
+
import { isTestnet } from "../logic";
|
|
13
|
+
import { GOVERNANCE_SCORE_ADDRESS, IISS_SCORE_ADDRESS } from "../constants";
|
|
14
|
+
import { getCoinConfig } from "../config";
|
|
15
|
+
const { HttpProvider } = IconService;
|
|
16
|
+
const { IconBuilder } = IconService;
|
|
17
|
+
/**
|
|
18
|
+
* Returns Testnet RPC URL if the current currency is testnet
|
|
19
|
+
* @param {currency} currency
|
|
20
|
+
*/
|
|
21
|
+
export function getRpcUrl(currency) {
|
|
22
|
+
const currencyConfig = getCoinConfig();
|
|
23
|
+
let rpcUrl = currencyConfig.infra.node_endpoint;
|
|
24
|
+
if (isTestnet(currency)) {
|
|
25
|
+
rpcUrl = currencyConfig.infra.node_testnet_endpoint;
|
|
26
|
+
}
|
|
27
|
+
return rpcUrl;
|
|
28
|
+
}
|
|
29
|
+
export function getDebugRpcUrl(currency) {
|
|
30
|
+
const currencyConfig = getCoinConfig();
|
|
31
|
+
let rpcUrl = currencyConfig.infra.debug_endpoint;
|
|
32
|
+
if (isTestnet(currency)) {
|
|
33
|
+
rpcUrl = currencyConfig.infra.debug_testnet_endpoint;
|
|
34
|
+
}
|
|
35
|
+
return rpcUrl;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Broadcast blob to blockchain
|
|
39
|
+
*/
|
|
40
|
+
export const broadcastTransaction = (signedOperation, currency) => __awaiter(void 0, void 0, void 0, function* () {
|
|
41
|
+
const { hash } = yield submit(signedOperation, currency);
|
|
42
|
+
return { hash };
|
|
43
|
+
});
|
|
44
|
+
export const submit = (signedOperation, currency) => __awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
+
const rpcURL = getRpcUrl(currency);
|
|
46
|
+
const httpProvider = new HttpProvider(rpcURL);
|
|
47
|
+
const iconService = new IconService(httpProvider);
|
|
48
|
+
const signedTransaction = {
|
|
49
|
+
getProperties: () => signedOperation.rawData,
|
|
50
|
+
getSignature: () => signedOperation.signature,
|
|
51
|
+
};
|
|
52
|
+
const response = yield iconService
|
|
53
|
+
.sendTransaction(signedTransaction)
|
|
54
|
+
.execute();
|
|
55
|
+
return {
|
|
56
|
+
hash: response,
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Obtain fees from blockchain
|
|
61
|
+
*/
|
|
62
|
+
export const getFees = (unsigned, account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
const debugRpcUrl = getDebugRpcUrl(account.currency);
|
|
64
|
+
const httpProvider = new HttpProvider(debugRpcUrl);
|
|
65
|
+
const iconService = new IconService(httpProvider);
|
|
66
|
+
const res = yield iconService.estimateStep(unsigned).execute();
|
|
67
|
+
return new BigNumber(res);
|
|
68
|
+
});
|
|
69
|
+
/**
|
|
70
|
+
* Get step price from governance contract
|
|
71
|
+
*/
|
|
72
|
+
export const getStepPrice = (account) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
const rpcURL = getRpcUrl(account.currency);
|
|
74
|
+
const httpProvider = new HttpProvider(rpcURL);
|
|
75
|
+
const iconService = new IconService(httpProvider);
|
|
76
|
+
const txBuilder = new IconBuilder.CallBuilder();
|
|
77
|
+
const stepPriceTx = txBuilder.to(GOVERNANCE_SCORE_ADDRESS).method("getStepPrice").build();
|
|
78
|
+
const res = yield iconService.call(stepPriceTx).execute();
|
|
79
|
+
return new BigNumber(res);
|
|
80
|
+
});
|
|
81
|
+
export const getDelegation = (address, currency) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
const rpcURL = getRpcUrl(currency);
|
|
83
|
+
const httpProvider = new HttpProvider(rpcURL);
|
|
84
|
+
const iconService = new IconService(httpProvider);
|
|
85
|
+
const delegationTx = new IconBuilder.CallBuilder()
|
|
86
|
+
.to(IISS_SCORE_ADDRESS)
|
|
87
|
+
.method("getDelegation")
|
|
88
|
+
.params({
|
|
89
|
+
address,
|
|
90
|
+
})
|
|
91
|
+
.build();
|
|
92
|
+
const res = yield iconService.call(delegationTx).execute();
|
|
93
|
+
return {
|
|
94
|
+
delegations: res.delegations,
|
|
95
|
+
totalDelegated: new BigNumber(res.totalDelegated),
|
|
96
|
+
votingPower: new BigNumber(res.votingPower),
|
|
97
|
+
};
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/api/node.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAI5E,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,EAAE,YAAY,EAAE,GAAG,WAAW,CAAC;AACrC,MAAM,EAAE,WAAW,EAAE,GAAG,WAAW,CAAC;AAEpC;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,QAAwB;IAChD,MAAM,cAAc,GAAG,aAAa,EAAE,CAAC;IACvC,IAAI,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,aAAa,CAAC;IAChD,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,qBAAqB,CAAC;IACtD,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAwB;IACrD,MAAM,cAAc,GAAG,aAAa,EAAE,CAAC;IACvC,IAAI,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC;IACjD,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,MAAM,GAAG,cAAc,CA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AAW,EAAE,GAAG,CAAC,WAAW;QAC5B,cAAc,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;QACjD,WAAW,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;KAC5C,CAAC;AACJ,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { SignerContext } from "@ledgerhq/coin-framework/signer";
|
|
2
|
+
import { CoinConfig } from "@ledgerhq/coin-framework/config";
|
|
3
|
+
import type { AccountBridge, CurrencyBridge } from "@ledgerhq/types-live";
|
|
4
|
+
import type { Transaction } from "../types/index";
|
|
5
|
+
import { IconSigner } from "../signer";
|
|
6
|
+
import { IconCoinConfig } from "../config";
|
|
7
|
+
export declare function buildCurrencyBridge(signerContext: SignerContext<IconSigner>): CurrencyBridge;
|
|
8
|
+
export declare function buildAccountBridge(signerContext: SignerContext<IconSigner>): AccountBridge<Transaction>;
|
|
9
|
+
export declare function createBridges(signerContext: SignerContext<IconSigner>, coinConfig: CoinConfig<IconCoinConfig>): {
|
|
10
|
+
currencyBridge: CurrencyBridge;
|
|
11
|
+
accountBridge: AccountBridge<Transaction, import("@ledgerhq/types-live").Account, import("@ledgerhq/types-live").TransactionStatusCommon, import("@ledgerhq/types-live").AccountRaw>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAE7D,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAW1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,cAAc,EAAiB,MAAM,WAAW,CAAC;AAE1D,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,cAAc,CAa5F;AAED,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,GACvC,aAAa,CAAC,WAAW,CAAC,CAqB5B;AAED,wBAAgB,aAAa,CAC3B,aAAa,EAAE,aAAa,CAAC,UAAU,CAAC,EACxC,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC;;;EAQvC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import getAddressWrapper from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
|
|
11
|
+
import { defaultUpdateTransaction, makeAccountBridgeReceive, makeScanAccounts, makeSync, } from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
|
12
|
+
import resolver from "../hw-getAddress";
|
|
13
|
+
import { initAccount } from "../initAccount";
|
|
14
|
+
import { broadcast } from "../broadcast";
|
|
15
|
+
import { createTransaction } from "../createTransaction";
|
|
16
|
+
import { estimateMaxSpendable } from "../estimateMaxSpendable";
|
|
17
|
+
import { getTransactionStatus } from "../getTransactionStatus";
|
|
18
|
+
import { prepareTransaction } from "../prepareTransaction";
|
|
19
|
+
import { buildSignOperation } from "../signOperation";
|
|
20
|
+
import { getAccountShape } from "../synchronization";
|
|
21
|
+
import { assignFromAccountRaw, assignToAccountRaw } from "../serialization";
|
|
22
|
+
import { setCoinConfig } from "../config";
|
|
23
|
+
export function buildCurrencyBridge(signerContext) {
|
|
24
|
+
const getAddress = resolver(signerContext);
|
|
25
|
+
const scanAccounts = makeScanAccounts({
|
|
26
|
+
getAccountShape,
|
|
27
|
+
getAddressFn: getAddress,
|
|
28
|
+
});
|
|
29
|
+
return {
|
|
30
|
+
preload: () => __awaiter(this, void 0, void 0, function* () { return Promise.resolve({}); }),
|
|
31
|
+
hydrate: () => { },
|
|
32
|
+
scanAccounts,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function buildAccountBridge(signerContext) {
|
|
36
|
+
const getAddress = resolver(signerContext);
|
|
37
|
+
const receive = makeAccountBridgeReceive(getAddressWrapper(getAddress));
|
|
38
|
+
const signOperation = buildSignOperation(signerContext);
|
|
39
|
+
const sync = makeSync({ getAccountShape });
|
|
40
|
+
return {
|
|
41
|
+
createTransaction,
|
|
42
|
+
updateTransaction: defaultUpdateTransaction,
|
|
43
|
+
prepareTransaction,
|
|
44
|
+
getTransactionStatus,
|
|
45
|
+
sync,
|
|
46
|
+
receive,
|
|
47
|
+
assignToAccountRaw,
|
|
48
|
+
assignFromAccountRaw,
|
|
49
|
+
initAccount,
|
|
50
|
+
signOperation,
|
|
51
|
+
broadcast,
|
|
52
|
+
estimateMaxSpendable,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function createBridges(signerContext, coinConfig) {
|
|
56
|
+
setCoinConfig(coinConfig);
|
|
57
|
+
return {
|
|
58
|
+
currencyBridge: buildCurrencyBridge(signerContext),
|
|
59
|
+
accountBridge: buildAccountBridge(signerContext),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridge/index.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wB,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,kBAAkB,CAAC,aAAa,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC;IAE3C,OAAO;QACL,iBAAiB;QACjB,iBAAiB,EAAE,wBAAwB;QAC3C,kBAAkB;QAClB,oBAAoB;QACpB,IAAI;QACJ,OAAO;QACP,kBAAkB;QAClB,oBAAoB;QACpB,WAAW;QACX,aAAa;QACb,SAAS;QACT,oBAAoB;KACrB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,aAAa,CAC3B,aAAwC,EACxC,UAAsC;IAEtC,aAAa,CAAC,UAAU,CAAC,CAAC;IAE1B,OAAO;QACL,cAAc,EAAE,mBAAmB,CAAC,aAAa,CAAC;QAClD,aAAa,EAAE,kBAAkB,CAAC,aAAa,CAAC;KACjD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.integration.test.d.ts","sourceRoot":"","sources":["../src/bridge.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAoG3C,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CAK5C,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { fromTransactionRaw } from "./transaction";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import { InvalidAddressBecauseDestinationIsAlsoSource, InvalidAddress, NotEnoughBalance, } from "@ledgerhq/errors";
|
|
4
|
+
const TEST_ADDRESS = "hxe52720d9125586e64c745bf3c2c1917dbb46f9ba";
|
|
5
|
+
const icon = {
|
|
6
|
+
scanAccounts: [
|
|
7
|
+
{
|
|
8
|
+
name: "icon seed 1",
|
|
9
|
+
apdus: `
|
|
10
|
+
=> e00200010d038000002c8049435880000000
|
|
11
|
+
<= 410426dd3cdd69f3604e9c1d8f3021b20e133524f12894b9ef8e35d3f1f5244516d18b7bb0d1fee7b7c2972d5cde08190d66cf932d0addd5ac87f53198d050940ccb2a6878626232396531313463626434303939346136346462303137626363323233616661353135363966669fd5109b2b2077b50f18fee878efef03cef0cfb5c3256ea9e55f44fa0e9ae5289000
|
|
12
|
+
=> e002000115058000002c80494358800000008000000080000000
|
|
13
|
+
<= 4104c1142d5b765d3026e801fd3946d9673051c7e3c3bd0eecd8ca27b6be079c9ee6b7b9f311b9eecb2995efd7e4a7ef9287a7f8878751d3227689c25a324270e8082a687863663465326339346235323631396637326161346461313333373061613663316333646164303064ff4e5e0cebe9462a469955997216658ce22953f79d272a6a1ecf3b3cdcb3549a9000
|
|
14
|
+
=> e002000115058000002c80494358800000008000000080000001
|
|
15
|
+
<= 410429e40c4a50f96a32b622e218114c9204f66763c997dadb8c719a95d3a2d98fda3b00ccc9f3d491906d453fa2a63298817eb6af94c77a47f5eb4baa43cbb73a832a6878666330343962346365363063633539363834383764313830643963343236336536333138313733392ed566d1841e629d6f3040a23918ee84015fb60b99824d7dcadde65bcb01bb089000
|
|
16
|
+
=> e002000115058000002c80494358800000008000000080000002
|
|
17
|
+
<= 41040310ab9742ae76a33cfb81fbb90f7d2c16af8dbe543cea73dc62dda4eb79eea4363cabad566329103dc8c6d1f29d6e005d608e35d97d80337e1ca5fd07f3da5b2a6878303139393332346162343038343733313565633339373264313738316239646363643136323061650ce87de91bb446401889398f585fc09a525bf7841dc254d94def7023b40523069000
|
|
18
|
+
`,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
accounts: [
|
|
22
|
+
{
|
|
23
|
+
FIXME_tests: ["balance is sum of ops"],
|
|
24
|
+
raw: {
|
|
25
|
+
id: `js:2:icon:${TEST_ADDRESS}:`,
|
|
26
|
+
seedIdentifier: `${TEST_ADDRESS}`,
|
|
27
|
+
name: "ICON 1",
|
|
28
|
+
derivationMode: "",
|
|
29
|
+
index: 0,
|
|
30
|
+
freshAddress: `${TEST_ADDRESS}`,
|
|
31
|
+
freshAddressPath: "44'/4801368'/0'/0'/0'",
|
|
32
|
+
blockHeight: 0,
|
|
33
|
+
operations: [],
|
|
34
|
+
pendingOperations: [],
|
|
35
|
+
currencyId: "icon",
|
|
36
|
+
lastSyncDate: "",
|
|
37
|
+
balance: "299569965",
|
|
38
|
+
},
|
|
39
|
+
transactions: [
|
|
40
|
+
{
|
|
41
|
+
name: "recipient and sender must not be the same",
|
|
42
|
+
transaction: fromTransactionRaw({
|
|
43
|
+
family: "icon",
|
|
44
|
+
recipient: `${TEST_ADDRESS}`,
|
|
45
|
+
amount: "100000000",
|
|
46
|
+
mode: "send",
|
|
47
|
+
fees: "0.00125",
|
|
48
|
+
}),
|
|
49
|
+
expectedStatus: {
|
|
50
|
+
amount: new BigNumber("100000000"),
|
|
51
|
+
errors: {
|
|
52
|
+
recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
|
|
53
|
+
},
|
|
54
|
+
warnings: {},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: "Not a valid address",
|
|
59
|
+
transaction: fromTransactionRaw({
|
|
60
|
+
family: "icon",
|
|
61
|
+
recipient: "iconinv",
|
|
62
|
+
amount: "100000000",
|
|
63
|
+
mode: "send",
|
|
64
|
+
fees: null,
|
|
65
|
+
}),
|
|
66
|
+
expectedStatus: {
|
|
67
|
+
errors: {
|
|
68
|
+
recipient: new InvalidAddress(),
|
|
69
|
+
},
|
|
70
|
+
warnings: {},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "Not enough balance",
|
|
75
|
+
transaction: fromTransactionRaw({
|
|
76
|
+
family: "icon",
|
|
77
|
+
recipient: "hxedaf3b2027fbbc0a31f589299c0b34533cd8edac",
|
|
78
|
+
amount: "1000000000000000000000000",
|
|
79
|
+
mode: "send",
|
|
80
|
+
fees: null,
|
|
81
|
+
}),
|
|
82
|
+
expectedStatus: {
|
|
83
|
+
errors: {
|
|
84
|
+
amount: new NotEnoughBalance(),
|
|
85
|
+
},
|
|
86
|
+
warnings: {},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
export const dataset = {
|
|
94
|
+
implementations: ["js"],
|
|
95
|
+
currencies: {
|
|
96
|
+
icon,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=bridge.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bridge.integration.test.js","sourceRoot":"","sources":["../src/bridge.integration.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EACL,4CAA4C,EAC5C,cAAc,EACd,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,YAAY,GAAG,4CAA4C,CAAC;AAElE,MAAM,IAAI,GAAgC;IACxC,YAAY,EAAE;QACZ;YACE,IAAI,EAAE,aAAa;YACnB,KAAK,EAAE;;;;;;;;;OASN;SACF;KACF;IACD,QAAQ,EAAE;QACR;YACE,WAAW,EAAE,CAAC,uBAAuB,CAAC;YACtC,GAAG,EAAE;gBACH,EAAE,EAAE,aAAa,YAAY,GAAG;gBAChC,cAAc,EAAE,GAAG,YAAY,EAAE;gBACjC,IAAI,EAAE,QAAQ;gBACd,cAAc,EAAE,EAAE;gBAClB,KAAK,EAAE,CAAC;gBACR,YAAY,EAAE,GAAG,YAAY,EAAE;gBAC/B,gBAAgB,EAAE,uBAAuB;gBACzC,WAAW,EAAE,CAAC;gBACd,UAAU,EAAE,EAAE;gBACd,iBAAiB,EAAE,EAAE;gBACrB,UAAU,EAAE,MAAM;gBAClB,YAAY,EAAE,EAAE;gBAChB,OAAO,EAA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,0 +1,9 @@
|
|
|
1
|
+
import { Account, Operation, SignedOperation } from "@ledgerhq/types-live";
|
|
2
|
+
/**
|
|
3
|
+
* Broadcast the signed transaction
|
|
4
|
+
*/
|
|
5
|
+
export declare function broadcast({ account, signedOperation, }: {
|
|
6
|
+
account: Account;
|
|
7
|
+
signedOperation: SignedOperation;
|
|
8
|
+
}): Promise<Operation>;
|
|
9
|
+
//# sourceMappingURL=broadcast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../src/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAK3E;;GAEG;AACH,wBAAsB,SAAS,CAAC,EAC9B,OAAO,EACP,eAAe,GAChB,EAAE;IACD,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,eAAe,CAAC;CAClC,GAAG,OAAO,CAAC,SAAS,CAAC,CAGrB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { patchOperationWithHash } from "@ledgerhq/coin-framework/operation";
|
|
11
|
+
import { broadcastTransaction } from "./api/node";
|
|
12
|
+
/**
|
|
13
|
+
* Broadcast the signed transaction
|
|
14
|
+
*/
|
|
15
|
+
export function broadcast(_a) {
|
|
16
|
+
return __awaiter(this, arguments, void 0, function* ({ account, signedOperation, }) {
|
|
17
|
+
const { hash } = yield broadcastTransaction(signedOperation, account.currency);
|
|
18
|
+
return patchOperationWithHash(signedOperation.operation, hash);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=broadcast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../src/broadcast.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElD;;GAEG;AACH,MAAM,UAAgB,SAAS;yDAAC,EAC9B,OAAO,EACP,eAAe,GAIhB;QACC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,oBAAoB,CAAC,eAAe,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC/E,OAAO,sBAAsB,CAAC,eAAe,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACjE,CAAC;CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IconAccount, Transaction } from "./types";
|
|
2
|
+
import type { IcxTransaction } from "icon-sdk-js";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {Account} account
|
|
7
|
+
* @param {Transaction} transaction
|
|
8
|
+
*/
|
|
9
|
+
export declare const buildTransaction: (account: IconAccount, transaction: Transaction, stepLimit?: BigNumber | undefined) => Promise<{
|
|
10
|
+
unsigned: IcxTransaction;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=buildTransaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTransaction.d.ts","sourceRoot":"","sources":["../src/buildTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,SAAS,MAAM,cAAc,CAAC;AA2BrC;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,YAClB,WAAW,eACP,WAAW,cACZ,SAAS,GAAG,SAAS;;EAalC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import IconService from "icon-sdk-js";
|
|
11
|
+
import { getNid, getNonce } from "./logic";
|
|
12
|
+
import { RPC_VERSION } from "./constants";
|
|
13
|
+
const { IconBuilder, IconConverter } = IconService;
|
|
14
|
+
const buildTransferTransaction = (account, transaction, stepLimit) => {
|
|
15
|
+
const address = account.freshAddress;
|
|
16
|
+
const icxTransactionBuilder = new IconBuilder.IcxTransactionBuilder();
|
|
17
|
+
const icxTransferData = icxTransactionBuilder
|
|
18
|
+
.from(address)
|
|
19
|
+
.to(transaction.recipient)
|
|
20
|
+
.value(IconConverter.toHexNumber(transaction.amount))
|
|
21
|
+
.nid(IconConverter.toHexNumber(getNid(account.currency)))
|
|
22
|
+
.nonce(IconConverter.toHexNumber(getNonce(account)))
|
|
23
|
+
.timestamp(IconConverter.toHexNumber(new Date().getTime() * 1000))
|
|
24
|
+
.version(IconConverter.toHexNumber(RPC_VERSION));
|
|
25
|
+
if (stepLimit) {
|
|
26
|
+
icxTransferData.stepLimit(IconConverter.toHexNumber(stepLimit));
|
|
27
|
+
}
|
|
28
|
+
return icxTransferData.build();
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param {Account} account
|
|
33
|
+
* @param {Transaction} transaction
|
|
34
|
+
*/
|
|
35
|
+
export const buildTransaction = (account, transaction, stepLimit) => __awaiter(void 0, void 0, void 0, function* () {
|
|
36
|
+
let unsigned;
|
|
37
|
+
switch (transaction.mode) {
|
|
38
|
+
case "send":
|
|
39
|
+
unsigned = buildTransferTransaction(account, transaction, stepLimit);
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
throw new Error(`Unsupported transaction mode: ${transaction.mode}`);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
unsigned,
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=buildTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildTransaction.js","sourceRoot":"","sources":["../src/buildTransaction.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,WAAW,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,GAAG,WAAW,CAAC;AAEnD,MAAM,wBAAwB,GAAG,CAC/B,OAAoB,EACpB,WAAwB,EACxB,SAAiC,EACjB,EAAE;IAClB,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC;IACrC,MAAM,qBAAqB,GAAG,IAAI,WAAW,CAAC,qBAAqB,EAAE,CAAC;IACtE,MAAM,eAAe,GAAG,qBAAqB;SAC1C,IAAI,CAAC,OAAO,CAAC;SACb,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC;SACzB,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;SACpD,GAAG,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;SACxD,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;SACnD,SAAS,CAAC,aAAa,CAAC,WAAW,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;SACjE,OAAO,CAAC,aAAa,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC;IACnD,IAAI,SAAS,EAAE,CAAC;QACd,eAAe,CAAC,SAAS,CAAC,aAAa,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,eAAe,CAAC,KAAK,EAAE,CAAC;AACjC,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAAoB,EACpB,WAAwB,EACxB,SAAiC,EACjC,EAAE;IACF,IAAI,QAAoC,CAAC;IACzC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC;QACzB,KAAK,MAAM;YACT,QAAQ,GAAG,wBAAwB,CAAC,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;YACrE,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,iCAAiC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,OAAO;QACL,QAAQ;KACT,CAAC;AACJ,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AccountLike } from "@ledgerhq/types-live";
|
|
2
|
+
import type { Transaction } from "./types";
|
|
3
|
+
declare function inferTransactions(transactions: Array<{
|
|
4
|
+
account: AccountLike;
|
|
5
|
+
transaction: Transaction;
|
|
6
|
+
}>, opts: Record<string, any>): Transaction[];
|
|
7
|
+
export default function makeCliTools(): {
|
|
8
|
+
options: {
|
|
9
|
+
name: string;
|
|
10
|
+
type: StringConstructor;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
inferTransactions: typeof inferTransactions;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=cli-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-transaction.d.ts","sourceRoot":"","sources":["../src/cli-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGxD,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AAUxD,iBAAS,iBAAiB,CACxB,YAAY,EAAE,KAAK,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;CAC1B,CAAC,EACF,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACxB,WAAW,EAAE,CAsBf;AAED,MAAM,CAAC,OAAO,UAAU,YAAY;;;;;;;EAKnC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import invariant from "invariant";
|
|
2
|
+
import flatMap from "lodash/flatMap";
|
|
3
|
+
const options = [
|
|
4
|
+
{
|
|
5
|
+
name: "mode",
|
|
6
|
+
type: String,
|
|
7
|
+
desc: "mode of transaction: send, stake, unstake",
|
|
8
|
+
},
|
|
9
|
+
];
|
|
10
|
+
function inferTransactions(transactions, opts) {
|
|
11
|
+
return flatMap(transactions, ({ transaction, account }) => {
|
|
12
|
+
invariant(transaction.family === "icon", "[cli-transaction] inferTransactions expects icon family transaction");
|
|
13
|
+
if (account.type === "Account") {
|
|
14
|
+
invariant(account.iconResources, "unactivated account");
|
|
15
|
+
}
|
|
16
|
+
if (account.type === "TokenAccount") {
|
|
17
|
+
const isDelisted = account.token.delisted === true;
|
|
18
|
+
invariant(!isDelisted, "token is delisted");
|
|
19
|
+
}
|
|
20
|
+
return Object.assign(Object.assign({}, transaction), { family: "icon", mode: opts.mode || "send" });
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
export default function makeCliTools() {
|
|
24
|
+
return {
|
|
25
|
+
options,
|
|
26
|
+
inferTransactions,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=cli-transaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-transaction.js","sourceRoot":"","sources":["../src/cli-transaction.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,WAAW,CAAC;AAClC,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAGrC,MAAM,OAAO,GAAG;IACd;QACE,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,MAAM;QACZ,IAAI,EAAE,2CAA2C;KAClD;CACF,CAAC;AAEF,SAAS,iBAAiB,CACxB,YAGE,EACF,IAAyB;IAEzB,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE;QACxD,SAAS,CACP,WAAW,CAAC,MAAM,KAAK,MAAM,EAC7B,qEAAqE,CACtE,CAAC;QAEF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC/B,SAAS,CAAE,OAAuB,CAAC,aAAa,EAAE,qBAAqB,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;YACpC,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,KAAK,IAAI,CAAC;YACnD,SAAS,CAAC,CAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO,gCACF,WAAW,KACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,MAAM,GACX,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,OAAO,UAAU,YAAY;IAClC,OAAO;QACL,OAAO;QACP,iBAAiB;KAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CurrencyConfig, CoinConfig } from "@ledgerhq/coin-framework/config";
|
|
2
|
+
export type IconConfig = {
|
|
3
|
+
infra: {
|
|
4
|
+
indexer: string;
|
|
5
|
+
indexer_testnet: string;
|
|
6
|
+
node_endpoint: string;
|
|
7
|
+
node_testnet_endpoint: string;
|
|
8
|
+
debug_endpoint: string;
|
|
9
|
+
debug_testnet_endpoint: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type IconCoinConfig = CurrencyConfig & IconConfig;
|
|
13
|
+
export declare const setCoinConfig: (config: CoinConfig<IconCoinConfig>) => void;
|
|
14
|
+
export declare const getCoinConfig: () => IconCoinConfig;
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAG7E,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE;QACL,OAAO,EAAE,MAAM,CAAC;QAChB,eAAe,EAAE,MAAM,CAAC;QACxB,aAAa,EAAE,MAAM,CAAC;QACtB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,cAAc,EAAE,MAAM,CAAC;QACvB,sBAAsB,EAAE,MAAM,CAAC;KAChC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,UAAU,CAAC;AAIzD,eAAO,MAAM,aAAa,WAAY,WAAW,cAAc,CAAC,KAAG,IAElE,CAAC;AAEF,eAAO,MAAM,aAAa,QAAO,cAMhC,CAAC"}
|
package/lib-es/config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MissingCoinConfig } from "@ledgerhq/coin-framework/errors";
|
|
2
|
+
let coinConfig;
|
|
3
|
+
export const setCoinConfig = (config) => {
|
|
4
|
+
coinConfig = config;
|
|
5
|
+
};
|
|
6
|
+
export const getCoinConfig = () => {
|
|
7
|
+
if (!coinConfig) {
|
|
8
|
+
throw new MissingCoinConfig();
|
|
9
|
+
}
|
|
10
|
+
return coinConfig();
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAepE,IAAI,UAAkD,CAAC;AAEvD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAkC,EAAQ,EAAE;IACxE,UAAU,GAAG,MAAM,CAAC;AACtB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAmB,EAAE;IAChD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,iBAAiB,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const GOVERNANCE_SCORE_ADDRESS = "cx0000000000000000000000000000000000000001";
|
|
2
|
+
export declare const IISS_SCORE_ADDRESS = "cx0000000000000000000000000000000000000000";
|
|
3
|
+
export declare const LIMIT = 100;
|
|
4
|
+
export declare const BERLIN_TESTNET_NID = 7;
|
|
5
|
+
export declare const MAINNET_NID = 1;
|
|
6
|
+
export declare const I_SCORE_UNIT = 1000;
|
|
7
|
+
export declare const RPC_VERSION = 3;
|
|
8
|
+
export declare const DEFAULT_STEP_LIMIT = 200000;
|
|
9
|
+
export declare const PREP_TYPE: {
|
|
10
|
+
MAIN: string;
|
|
11
|
+
SUB: string;
|
|
12
|
+
CANDIDATE: string;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,+CAA+C,CAAC;AACrF,eAAO,MAAM,kBAAkB,+CAA+C,CAAC;AAC/E,eAAO,MAAM,KAAK,MAAM,CAAC;AACzB,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,YAAY,OAAO,CAAC;AACjC,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,kBAAkB,SAAS,CAAC;AAEzC,eAAO,MAAM,SAAS;;;;CAIrB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const GOVERNANCE_SCORE_ADDRESS = "cx0000000000000000000000000000000000000001";
|
|
2
|
+
export const IISS_SCORE_ADDRESS = "cx0000000000000000000000000000000000000000";
|
|
3
|
+
export const LIMIT = 100;
|
|
4
|
+
export const BERLIN_TESTNET_NID = 7;
|
|
5
|
+
export const MAINNET_NID = 1;
|
|
6
|
+
export const I_SCORE_UNIT = 1000;
|
|
7
|
+
export const RPC_VERSION = 3;
|
|
8
|
+
export const DEFAULT_STEP_LIMIT = 200000;
|
|
9
|
+
export const PREP_TYPE = {
|
|
10
|
+
MAIN: "Main P-Rep",
|
|
11
|
+
SUB: "Sub P-Rep",
|
|
12
|
+
CANDIDATE: "Candidate",
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,4CAA4C,CAAC;AACrF,MAAM,CAAC,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;AAC/E,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAC;AACzB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAEzC,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,WAAW;IAChB,SAAS,EAAE,WAAW;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAO,WAOnC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BigNumber } from "bignumber.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create an empty transaction
|
|
4
|
+
*
|
|
5
|
+
* @returns {Transaction}
|
|
6
|
+
*/
|
|
7
|
+
export const createTransaction = () => ({
|
|
8
|
+
family: "icon",
|
|
9
|
+
mode: "send",
|
|
10
|
+
amount: new BigNumber(0),
|
|
11
|
+
recipient: "",
|
|
12
|
+
useAllAmount: false,
|
|
13
|
+
fees: null,
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=createTransaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAgB,EAAE,CAAC,CAAC;IACnD,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,KAAK;IACnB,IAAI,EAAE,IAAI;CACX,CAAC,CAAC"}
|