@ledgerhq/coin-vechain 2.27.0 → 2.28.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/.unimportedrc.json +3 -21
- package/CHANGELOG.md +34 -0
- package/jest.config.js +39 -13
- package/lib/api/index.d.ts +4 -0
- package/lib/api/index.d.ts.map +1 -0
- package/lib/api/index.js +45 -0
- package/lib/api/index.js.map +1 -0
- package/lib/bridge/getTransactionStatus.js +1 -1
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/logic/account/getBalance.d.ts +5 -0
- package/lib/logic/account/getBalance.d.ts.map +1 -0
- package/lib/logic/account/getBalance.js +25 -0
- package/lib/logic/account/getBalance.js.map +1 -0
- package/lib/logic/history/getBlock.d.ts +3 -0
- package/lib/logic/history/getBlock.d.ts.map +1 -0
- package/lib/logic/history/getBlock.js +35 -0
- package/lib/logic/history/getBlock.js.map +1 -0
- package/lib/logic/history/getBlockInfo.d.ts +6 -0
- package/lib/logic/history/getBlockInfo.d.ts.map +1 -0
- package/lib/logic/history/getBlockInfo.js +23 -0
- package/lib/logic/history/getBlockInfo.js.map +1 -0
- package/lib/logic/history/lastBlock.d.ts +3 -0
- package/lib/logic/history/lastBlock.d.ts.map +1 -0
- package/lib/logic/history/lastBlock.js +11 -0
- package/lib/logic/history/lastBlock.js.map +1 -0
- package/lib/logic/history/listOperations.d.ts +3 -0
- package/lib/logic/history/listOperations.d.ts.map +1 -0
- package/lib/logic/history/listOperations.js +50 -0
- package/lib/logic/history/listOperations.js.map +1 -0
- package/lib/logic/index.d.ts +12 -0
- package/lib/logic/index.d.ts.map +1 -0
- package/lib/logic/index.js +28 -0
- package/lib/logic/index.js.map +1 -0
- package/lib/logic/transaction/broadcast.d.ts +3 -0
- package/lib/logic/transaction/broadcast.d.ts.map +1 -0
- package/lib/logic/transaction/broadcast.js +10 -0
- package/lib/logic/transaction/broadcast.js.map +1 -0
- package/lib/logic/transaction/combine.d.ts +2 -0
- package/lib/logic/transaction/combine.d.ts.map +1 -0
- package/lib/logic/transaction/combine.js +11 -0
- package/lib/logic/transaction/combine.js.map +1 -0
- package/lib/logic/transaction/craftTransaction.d.ts +3 -0
- package/lib/logic/transaction/craftTransaction.d.ts.map +1 -0
- package/lib/logic/transaction/craftTransaction.js +99 -0
- package/lib/logic/transaction/craftTransaction.js.map +1 -0
- package/lib/logic/transaction/estimateFees.d.ts +3 -0
- package/lib/logic/transaction/estimateFees.d.ts.map +1 -0
- package/lib/logic/transaction/estimateFees.js +23 -0
- package/lib/logic/transaction/estimateFees.js.map +1 -0
- package/lib/logic/validateAddress.d.ts +4 -0
- package/lib/logic/validateAddress.d.ts.map +1 -0
- package/lib/logic/validateAddress.js +14 -0
- package/lib/logic/validateAddress.js.map +1 -0
- package/lib/logic/validateIntent.d.ts +3 -0
- package/lib/logic/validateIntent.d.ts.map +1 -0
- package/lib/logic/validateIntent.js +65 -0
- package/lib/logic/validateIntent.js.map +1 -0
- package/lib/network/getBlock.d.ts +3 -0
- package/lib/network/getBlock.d.ts.map +1 -0
- package/lib/network/getBlock.js +23 -0
- package/lib/network/getBlock.js.map +1 -0
- package/lib/network/getFees.d.ts.map +1 -1
- package/lib/network/getFees.js +2 -3
- package/lib/network/getFees.js.map +1 -1
- package/lib/network/index.d.ts +1 -0
- package/lib/network/index.d.ts.map +1 -1
- package/lib/network/index.js +1 -0
- package/lib/network/index.js.map +1 -1
- package/lib/network/sdk.d.ts.map +1 -1
- package/lib/network/sdk.js +14 -8
- package/lib/network/sdk.js.map +1 -1
- package/lib/test/bridgeDatasetTest.js +1 -1
- package/lib/test/bridgeDatasetTest.js.map +1 -1
- package/lib/test/msw-setup.d.ts +2 -0
- package/lib/test/msw-setup.d.ts.map +1 -0
- package/lib/test/msw-setup.js +9 -0
- package/lib/test/msw-setup.js.map +1 -0
- package/lib/test/msw.mock.d.ts +3 -0
- package/lib/test/msw.mock.d.ts.map +1 -0
- package/lib/test/msw.mock.js +9 -0
- package/lib/test/msw.mock.js.map +1 -0
- package/lib/types/network.d.ts +30 -0
- package/lib/types/network.d.ts.map +1 -1
- package/lib-es/api/index.d.ts +4 -0
- package/lib-es/api/index.d.ts.map +1 -0
- package/lib-es/api/index.js +42 -0
- package/lib-es/api/index.js.map +1 -0
- package/lib-es/bridge/getTransactionStatus.js +1 -1
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/logic/account/getBalance.d.ts +5 -0
- package/lib-es/logic/account/getBalance.d.ts.map +1 -0
- package/lib-es/logic/account/getBalance.js +20 -0
- package/lib-es/logic/account/getBalance.js.map +1 -0
- package/lib-es/logic/history/getBlock.d.ts +3 -0
- package/lib-es/logic/history/getBlock.d.ts.map +1 -0
- package/lib-es/logic/history/getBlock.js +32 -0
- package/lib-es/logic/history/getBlock.js.map +1 -0
- package/lib-es/logic/history/getBlockInfo.d.ts +6 -0
- package/lib-es/logic/history/getBlockInfo.d.ts.map +1 -0
- package/lib-es/logic/history/getBlockInfo.js +19 -0
- package/lib-es/logic/history/getBlockInfo.js.map +1 -0
- package/lib-es/logic/history/lastBlock.d.ts +3 -0
- package/lib-es/logic/history/lastBlock.d.ts.map +1 -0
- package/lib-es/logic/history/lastBlock.js +8 -0
- package/lib-es/logic/history/lastBlock.js.map +1 -0
- package/lib-es/logic/history/listOperations.d.ts +3 -0
- package/lib-es/logic/history/listOperations.d.ts.map +1 -0
- package/lib-es/logic/history/listOperations.js +47 -0
- package/lib-es/logic/history/listOperations.js.map +1 -0
- package/lib-es/logic/index.d.ts +12 -0
- package/lib-es/logic/index.d.ts.map +1 -0
- package/lib-es/logic/index.js +12 -0
- package/lib-es/logic/index.js.map +1 -0
- package/lib-es/logic/transaction/broadcast.d.ts +3 -0
- package/lib-es/logic/transaction/broadcast.d.ts.map +1 -0
- package/lib-es/logic/transaction/broadcast.js +7 -0
- package/lib-es/logic/transaction/broadcast.js.map +1 -0
- package/lib-es/logic/transaction/combine.d.ts +2 -0
- package/lib-es/logic/transaction/combine.d.ts.map +1 -0
- package/lib-es/logic/transaction/combine.js +8 -0
- package/lib-es/logic/transaction/combine.js.map +1 -0
- package/lib-es/logic/transaction/craftTransaction.d.ts +3 -0
- package/lib-es/logic/transaction/craftTransaction.d.ts.map +1 -0
- package/lib-es/logic/transaction/craftTransaction.js +96 -0
- package/lib-es/logic/transaction/craftTransaction.js.map +1 -0
- package/lib-es/logic/transaction/estimateFees.d.ts +3 -0
- package/lib-es/logic/transaction/estimateFees.d.ts.map +1 -0
- package/lib-es/logic/transaction/estimateFees.js +20 -0
- package/lib-es/logic/transaction/estimateFees.js.map +1 -0
- package/lib-es/logic/validateAddress.d.ts +4 -0
- package/lib-es/logic/validateAddress.d.ts.map +1 -0
- package/lib-es/logic/validateAddress.js +10 -0
- package/lib-es/logic/validateAddress.js.map +1 -0
- package/lib-es/logic/validateIntent.d.ts +3 -0
- package/lib-es/logic/validateIntent.d.ts.map +1 -0
- package/lib-es/logic/validateIntent.js +62 -0
- package/lib-es/logic/validateIntent.js.map +1 -0
- package/lib-es/network/getBlock.d.ts +3 -0
- package/lib-es/network/getBlock.d.ts.map +1 -0
- package/lib-es/network/getBlock.js +16 -0
- package/lib-es/network/getBlock.js.map +1 -0
- package/lib-es/network/getFees.d.ts.map +1 -1
- package/lib-es/network/getFees.js +1 -2
- package/lib-es/network/getFees.js.map +1 -1
- package/lib-es/network/index.d.ts +1 -0
- package/lib-es/network/index.d.ts.map +1 -1
- package/lib-es/network/index.js +1 -0
- package/lib-es/network/index.js.map +1 -1
- package/lib-es/network/sdk.d.ts.map +1 -1
- package/lib-es/network/sdk.js +8 -2
- package/lib-es/network/sdk.js.map +1 -1
- package/lib-es/test/bridgeDatasetTest.js +1 -1
- package/lib-es/test/bridgeDatasetTest.js.map +1 -1
- package/lib-es/test/msw-setup.d.ts +2 -0
- package/lib-es/test/msw-setup.d.ts.map +1 -0
- package/lib-es/test/msw-setup.js +7 -0
- package/lib-es/test/msw-setup.js.map +1 -0
- package/lib-es/test/msw.mock.d.ts +3 -0
- package/lib-es/test/msw.mock.d.ts.map +1 -0
- package/lib-es/test/msw.mock.js +6 -0
- package/lib-es/test/msw.mock.js.map +1 -0
- package/lib-es/types/network.d.ts +30 -0
- package/lib-es/types/network.d.ts.map +1 -1
- package/package.json +7 -8
- package/src/api/index.integ.test.ts +123 -0
- package/src/api/index.ts +89 -0
- package/src/api/index.unit.test.ts +234 -0
- package/src/bridge/getTransactionStatus.test.ts +1 -1
- package/src/bridge/getTransactionStatus.ts +1 -1
- package/src/bridge/synchronisation.test.ts +7 -3
- package/src/logic/account/getBalance.ts +24 -0
- package/src/logic/account/getBalance.unit.test.ts +50 -0
- package/src/logic/history/getBlock.ts +47 -0
- package/src/logic/history/getBlock.unit.test.ts +106 -0
- package/src/logic/history/getBlockInfo.ts +24 -0
- package/src/logic/history/getBlockInfo.unit.test.ts +30 -0
- package/src/logic/history/lastBlock.ts +9 -0
- package/src/logic/history/lastBlock.unit.test.ts +30 -0
- package/src/logic/history/listOperations.ts +64 -0
- package/src/logic/history/listOperations.unit.test.ts +129 -0
- package/src/logic/index.ts +11 -0
- package/src/logic/transaction/broadcast.msw.test.ts +23 -0
- package/src/logic/transaction/broadcast.ts +10 -0
- package/src/logic/transaction/broadcast.unit.test.ts +26 -0
- package/src/logic/transaction/combine.ts +10 -0
- package/src/logic/transaction/combine.unit.test.ts +37 -0
- package/src/logic/transaction/craftTransaction.ts +137 -0
- package/src/logic/transaction/craftTransaction.unit.test.ts +217 -0
- package/src/logic/transaction/estimateFees.ts +32 -0
- package/src/logic/transaction/estimateFees.unit.test.ts +102 -0
- package/src/logic/validateAddress.ts +15 -0
- package/src/logic/validateAddress.unit.test.ts +15 -0
- package/src/logic/validateIntent.ts +96 -0
- package/src/logic/validateIntent.unit.test.ts +156 -0
- package/src/network/getBlock.ts +23 -0
- package/src/network/getBlock.unit.test.ts +58 -0
- package/src/network/getFees.ts +1 -3
- package/src/network/index.ts +1 -0
- package/src/network/sdk.test.ts +32 -1
- package/src/network/sdk.ts +9 -2
- package/src/test/bridgeDatasetTest.ts +1 -1
- package/src/test/msw-setup.ts +7 -0
- package/src/test/msw.mock.ts +6 -0
- package/src/types/network.ts +34 -0
package/.unimportedrc.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entry": [
|
|
3
|
+
"src/api/index.ts",
|
|
3
4
|
"src/deviceTransactionConfig.ts",
|
|
4
5
|
"src/errors.ts",
|
|
5
6
|
"src/hw-getAddress.ts",
|
|
@@ -30,40 +31,21 @@
|
|
|
30
31
|
"src/bridge/signOperation.ts",
|
|
31
32
|
"src/bridge/synchronisation.ts",
|
|
32
33
|
"src/bridge/transaction.ts",
|
|
33
|
-
"src/common-logic/calculateClauses.ts",
|
|
34
|
-
"src/common-logic/calculateGasFees.ts",
|
|
35
34
|
"src/common-logic/calculateTransactionInfo.ts",
|
|
36
|
-
"src/common-logic/estimateGas.ts",
|
|
37
35
|
"src/common-logic/fixPrefixCase.ts",
|
|
38
|
-
"src/common-logic/generateNonce.ts",
|
|
39
|
-
"src/common-logic/getThorClient.ts",
|
|
40
|
-
"src/common-logic/index.ts",
|
|
41
|
-
"src/common-logic/mapTransfersToOperations.ts",
|
|
42
|
-
"src/common-logic/padAddress.ts",
|
|
43
|
-
"src/common-logic/parseAddress.ts",
|
|
44
36
|
"src/common-logic/validateAddress.ts",
|
|
45
|
-
"src/config.ts",
|
|
46
|
-
"src/constants/address.ts",
|
|
47
|
-
"src/constants/env.ts",
|
|
48
|
-
"src/constants/index.ts",
|
|
49
37
|
"src/datasets/index.ts",
|
|
50
38
|
"src/datasets/vechain.scanAccounts.1.ts",
|
|
51
39
|
"src/datasets/vechain.ts",
|
|
52
40
|
"src/index.ts",
|
|
53
41
|
"src/mock.ts",
|
|
54
|
-
"src/network/getFees.ts",
|
|
55
|
-
"src/network/index.ts",
|
|
56
|
-
"src/network/sdk.ts",
|
|
57
42
|
"src/signer/getAddress.ts",
|
|
58
43
|
"src/signer/index.ts",
|
|
59
44
|
"src/signer/signMessage.ts",
|
|
60
45
|
"src/test/bridgeDatasetTest.ts",
|
|
61
46
|
"src/test/index.ts",
|
|
62
|
-
"src/
|
|
63
|
-
"src/
|
|
64
|
-
"src/types/index.ts",
|
|
65
|
-
"src/types/network.ts",
|
|
66
|
-
"src/types/signer.ts",
|
|
47
|
+
"src/test/msw-setup.ts",
|
|
48
|
+
"src/test/msw.mock.ts",
|
|
67
49
|
"src/supportedFeatures.ts"
|
|
68
50
|
],
|
|
69
51
|
"ignoreUnused": [
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @ledgerhq/coin-evm
|
|
2
2
|
|
|
3
|
+
## 2.28.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#20280](https://github.com/LedgerHQ/ledger-live/pull/20280) [`9fcbe39`](https://github.com/LedgerHQ/ledger-live/commit/9fcbe39689ff122568ffb031a30dc3805ebb6add) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Stop depending on `@ledgerhq/errors` (LIVE-32915).
|
|
8
|
+
|
|
9
|
+
No workspace package declares it anymore, and none may again: `enforce-boundaries` now fails CI on any manifest that does. The classes it held live in the package that owns them, with `@ledgerhq/ledger-wallet-framework/errors` as the shared home below the coin layer.
|
|
10
|
+
|
|
11
|
+
The package itself stays in the repo so it keeps being published for external consumers, and is bridged to the external coin packages that still peer-depend on it via `pnpm.packageExtensions` using `workspace:*` (which reuses the single in-repo copy, so the dependency graph keeps exactly the physical copies it had before). [LedgerHQ/coin-modules#752](https://github.com/LedgerHQ/coin-modules/pull/752) removes that peerDependency upstream; once it is released the bridge can be dropped, but the package still needs publishing.
|
|
12
|
+
|
|
13
|
+
- [#20018](https://github.com/LedgerHQ/ledger-live/pull/20018) [`b5df122`](https://github.com/LedgerHQ/ledger-live/commit/b5df1223ce9e09766d6f3fecf7e44e2ec3bd3a00) Thanks [@pawell24](https://github.com/pawell24)! - Add the CoinModuleApi (Alpaca) implementation for VET + VTHO to coin-vechain (getBalance, listOperations, lastBlock, getBlock, getBlockInfo, craftTransaction, estimateFees, combine, broadcast, validateIntent), registered in live-common alongside the existing account bridge.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [[`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152), [`635fa12`](https://github.com/LedgerHQ/ledger-live/commit/635fa12d47f5a98858326f4dd68962dffe82eda9)]:
|
|
18
|
+
- @ledgerhq/ledger-wallet-framework@2.7.0
|
|
19
|
+
|
|
20
|
+
## 2.28.0-next.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- [#20280](https://github.com/LedgerHQ/ledger-live/pull/20280) [`9fcbe39`](https://github.com/LedgerHQ/ledger-live/commit/9fcbe39689ff122568ffb031a30dc3805ebb6add) Thanks [@gre-ledger](https://github.com/gre-ledger)! - Stop depending on `@ledgerhq/errors` (LIVE-32915).
|
|
25
|
+
|
|
26
|
+
No workspace package declares it anymore, and none may again: `enforce-boundaries` now fails CI on any manifest that does. The classes it held live in the package that owns them, with `@ledgerhq/ledger-wallet-framework/errors` as the shared home below the coin layer.
|
|
27
|
+
|
|
28
|
+
The package itself stays in the repo so it keeps being published for external consumers, and is bridged to the external coin packages that still peer-depend on it via `pnpm.packageExtensions` using `workspace:*` (which reuses the single in-repo copy, so the dependency graph keeps exactly the physical copies it had before). [LedgerHQ/coin-modules#752](https://github.com/LedgerHQ/coin-modules/pull/752) removes that peerDependency upstream; once it is released the bridge can be dropped, but the package still needs publishing.
|
|
29
|
+
|
|
30
|
+
- [#20018](https://github.com/LedgerHQ/ledger-live/pull/20018) [`b5df122`](https://github.com/LedgerHQ/ledger-live/commit/b5df1223ce9e09766d6f3fecf7e44e2ec3bd3a00) Thanks [@pawell24](https://github.com/pawell24)! - Add the CoinModuleApi (Alpaca) implementation for VET + VTHO to coin-vechain (getBalance, listOperations, lastBlock, getBlock, getBlockInfo, craftTransaction, estimateFees, combine, broadcast, validateIntent), registered in live-common alongside the existing account bridge.
|
|
31
|
+
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- Updated dependencies [[`53c3431`](https://github.com/LedgerHQ/ledger-live/commit/53c3431e01b3139ef689cb589bab0adee4ed6152), [`635fa12`](https://github.com/LedgerHQ/ledger-live/commit/635fa12d47f5a98858326f4dd68962dffe82eda9)]:
|
|
35
|
+
- @ledgerhq/ledger-wallet-framework@2.7.0-next.0
|
|
36
|
+
|
|
3
37
|
## 2.27.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/jest.config.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
passWithNoTests: true,
|
|
3
|
-
collectCoverageFrom: [
|
|
4
|
-
"src/**/*.ts",
|
|
5
|
-
"!src/**/*.test.ts",
|
|
6
|
-
"!src/**/*.spec.ts",
|
|
7
|
-
"!src/test/**/*.ts",
|
|
8
|
-
"!src/datasets/**/*.ts",
|
|
9
|
-
"!src/__snapshots__/**/*.ts",
|
|
10
|
-
],
|
|
11
|
-
coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../../" }], "text"],
|
|
1
|
+
const sharedConfig = {
|
|
12
2
|
testEnvironment: "node",
|
|
13
3
|
transform: {
|
|
14
4
|
"^.+\\.(ts|tsx)$": [
|
|
@@ -20,11 +10,47 @@ module.exports = {
|
|
|
20
10
|
},
|
|
21
11
|
],
|
|
22
12
|
},
|
|
23
|
-
testPathIgnorePatterns: ["lib/", "lib-es/", "
|
|
13
|
+
testPathIgnorePatterns: ["lib/", "lib-es/", "\\.integration\\.test\\.ts", "\\.integ\\.test\\.ts"],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
// Two projects: `unit` runs with @ledgerhq/disable-network-setup (nock blocks all net connect),
|
|
17
|
+
// while `msw` runs the `.msw.test.ts` suites WITHOUT it — nock and MSW both build on
|
|
18
|
+
// @mswjs/interceptors, so they cannot share the same run. Mirrors coin-kaspa.
|
|
19
|
+
module.exports = {
|
|
20
|
+
passWithNoTests: true,
|
|
21
|
+
// MSW suites make mocked network calls that are fast locally but can be starved past jest's 5s
|
|
22
|
+
// default under CI parallelism; give them headroom so the run stays deterministic.
|
|
23
|
+
testTimeout: 30_000,
|
|
24
|
+
collectCoverageFrom: [
|
|
25
|
+
"src/**/*.ts",
|
|
26
|
+
"!src/**/*.test.ts",
|
|
27
|
+
"!src/**/*.spec.ts",
|
|
28
|
+
"!src/test/**/*.ts",
|
|
29
|
+
"!src/datasets/**/*.ts",
|
|
30
|
+
"!src/__snapshots__/**/*.ts",
|
|
31
|
+
],
|
|
32
|
+
coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../../" }], "text"],
|
|
33
|
+
coveragePathIgnorePatterns: ["src/test", "src/types", "src/index.ts"],
|
|
24
34
|
reporters: [
|
|
25
35
|
"default",
|
|
26
36
|
...(process.env.CI ? ["github-actions"] : []),
|
|
27
37
|
["jest-sonar", { outputName: "sonar-executionTests-report.xml", reportedFilePath: "absolute" }],
|
|
28
38
|
],
|
|
29
|
-
|
|
39
|
+
projects: [
|
|
40
|
+
{
|
|
41
|
+
...sharedConfig,
|
|
42
|
+
displayName: "unit",
|
|
43
|
+
testPathIgnorePatterns: [...sharedConfig.testPathIgnorePatterns, "\\.msw\\.test\\.ts"],
|
|
44
|
+
setupFilesAfterEnv: [
|
|
45
|
+
"@ledgerhq/wallet-framework-test-setup",
|
|
46
|
+
"@ledgerhq/disable-network-setup",
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
...sharedConfig,
|
|
51
|
+
displayName: "msw",
|
|
52
|
+
testMatch: ["**/*.msw.test.ts"],
|
|
53
|
+
setupFiles: ["@ledgerhq/wallet-framework-test-setup", "./src/test/msw-setup.ts"],
|
|
54
|
+
},
|
|
55
|
+
],
|
|
30
56
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAIV,aAAa,EAUd,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAgBlE,wBAAgB,SAAS,CAAC,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,GAAG,aAAa,CAuDvF"}
|
package/lib/api/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApi = createApi;
|
|
4
|
+
const rejectBalanceOptions_1 = require("@ledgerhq/coin-module-framework/api/getBalance/rejectBalanceOptions");
|
|
5
|
+
const craftTransactionData_1 = require("@ledgerhq/coin-module-framework/logic/craftTransactionData");
|
|
6
|
+
const config_1 = require("../config");
|
|
7
|
+
const logic_1 = require("../logic");
|
|
8
|
+
// CoinModuleApi (Alpaca) factory for VET + VTHO. `config` is re-wrapped to force `status: active`.
|
|
9
|
+
function createApi(config, _currencyId) {
|
|
10
|
+
(0, config_1.setCoinConfig)(() => ({ ...config(), status: { type: "active" } }));
|
|
11
|
+
return {
|
|
12
|
+
lastBlock: logic_1.lastBlock,
|
|
13
|
+
getBlockInfo: logic_1.getBlockInfo,
|
|
14
|
+
getBlock: logic_1.getBlock,
|
|
15
|
+
getBalance: (address, options) => (0, rejectBalanceOptions_1.rejectBalanceOptions)(() => (0, logic_1.getBalance)(address), options),
|
|
16
|
+
listOperations: logic_1.listOperations,
|
|
17
|
+
craftTransaction: (transactionIntent, customFees) => (0, logic_1.craftTransaction)(transactionIntent, customFees),
|
|
18
|
+
estimateFees: (transactionIntent, customFeesParameters) => (0, logic_1.estimateFees)(transactionIntent, customFeesParameters),
|
|
19
|
+
combine: logic_1.combine,
|
|
20
|
+
broadcast: logic_1.broadcast,
|
|
21
|
+
validateIntent: (transactionIntent, balances, customFees) => (0, logic_1.validateIntent)(transactionIntent, balances, customFees),
|
|
22
|
+
craftTransactionData: craftTransactionData_1.craftTransactionData,
|
|
23
|
+
validateAddress: (address, parameters) => (0, logic_1.validateAddress)(address, parameters),
|
|
24
|
+
// --- Not applicable / not supported for VeChain ---
|
|
25
|
+
getNextSequence: (_address) => {
|
|
26
|
+
throw new Error("getNextSequence is not applicable for Vechain");
|
|
27
|
+
},
|
|
28
|
+
craftRawTransaction: (_transaction, _sender, _publicKey, _sequence) => {
|
|
29
|
+
throw new Error("craftRawTransaction is not supported");
|
|
30
|
+
},
|
|
31
|
+
call: () => {
|
|
32
|
+
throw new Error("call is not supported");
|
|
33
|
+
},
|
|
34
|
+
getStakes: (_address, _cursor) => {
|
|
35
|
+
throw new Error("getStakes is not supported");
|
|
36
|
+
},
|
|
37
|
+
getRewards: (_address, _cursor) => {
|
|
38
|
+
throw new Error("getRewards is not supported");
|
|
39
|
+
},
|
|
40
|
+
getValidators: (_cursor) => {
|
|
41
|
+
throw new Error("getValidators is not supported");
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,8GAA2G;AAC3G,qGAAkG;AAgBlG,sCAAkE;AAClE,oCAYkB;AAElB,mGAAmG;AACnG,mBAA0B,MAAyB,EAAE,WAAmB;IACtE,IAAA,sBAAa,EAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAEnE,OAAO;QACL,SAAS,EAAT,iBAAS;QACT,YAAY,EAAZ,oBAAY;QACZ,QAAQ,EAAR,gBAAQ;QACR,UAAU,EAAE,CAAC,OAAe,EAAE,OAAwB,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CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,aAAa,EAAE,CAAC,OAAgB,EAA4B,EAAE;YAC5D,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getTransactionStatus = void 0;
|
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
-
const errors_1 = require("@ledgerhq/errors");
|
|
8
|
+
const errors_1 = require("@ledgerhq/ledger-wallet-framework/errors");
|
|
9
9
|
const common_logic_1 = require("../common-logic");
|
|
10
10
|
const errors_2 = require("../errors");
|
|
11
11
|
const getTransactionStatus = async (account, transaction) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,qEAOkD;AAElD,kDAAyE;AAEzE,sCAA0C;AAEnC,MAAM,oBAAoB,GAAuD,KAAK,EAC3F,OAAO,EACP,WAAW,EACX,EAAE;IACF,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC;IAChD,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAC3C,MAAM,EAAE,cAAc,EAAE,gBAAgB,EAAE,GAAG,MAAM,IAAA,uCAAwB,EACzE,OAAO,EACP,WAAW,EACX;QACE,YAAY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AAE,CAAC;YACpB,MAAM;YACN,MAAM,WAAW,GAAG,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;YAC7C,IAAI,aAAa,CAAC,EAAE,CAAC,WAAW,IAAI,CAAC,CAAC,EAAE,CAAC;gBACvC,MAAM,CAAC,MAAM,GAAG,IAAI,sBAAa,EAAE,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,UAAU,GAAG,MAAM,CAAC;IACxB,IAAI,cAAc,EAAE,CAAC;QACnB,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,OAAO,CAAC,OAAO,CAAC;QACrB,MAAM;QACN,QAAQ;QACR,aAAa;QACb,MAAM;QACN,UAAU;KACX,CAAC,CAAC;AACL,CAAC,CAAC;AA7DW,QAAA,oBAAoB,GAApB,oBAAoB,CA6D/B;kBAEa,QAAA,oBAAoB"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AssetInfo, Balance } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
export declare const NATIVE_ASSET: AssetInfo;
|
|
3
|
+
export declare const vthoAsset: (address: string) => AssetInfo;
|
|
4
|
+
export declare function getBalance(address: string): Promise<Balance[]>;
|
|
5
|
+
//# sourceMappingURL=getBalance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBalance.d.ts","sourceRoot":"","sources":["../../../src/logic/account/getBalance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAIpF,eAAO,MAAM,YAAY,EAAE,SAA2C,CAAC;AAIvE,eAAO,MAAM,SAAS,YAAa,MAAM,KAAG,SAK1C,CAAC;AAGH,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAOpE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.vthoAsset = exports.NATIVE_ASSET = void 0;
|
|
4
|
+
exports.getBalance = getBalance;
|
|
5
|
+
const sdk_core_1 = require("@vechain/sdk-core");
|
|
6
|
+
const network_1 = require("../../network");
|
|
7
|
+
exports.NATIVE_ASSET = { type: "native", name: "VET" };
|
|
8
|
+
// `assetOwner` lets the generic coin-framework adapter attach the VTHO balance to its sub-account
|
|
9
|
+
// (buildSubAccounts filters by `extra.assetReference` + `extra.assetOwner`). Mirrors coin-tron.
|
|
10
|
+
const vthoAsset = (address) => ({
|
|
11
|
+
type: "token",
|
|
12
|
+
assetReference: sdk_core_1.VTHO_ADDRESS,
|
|
13
|
+
assetOwner: address,
|
|
14
|
+
name: "VTHO",
|
|
15
|
+
});
|
|
16
|
+
exports.vthoAsset = vthoAsset;
|
|
17
|
+
// VET + VTHO balances from Thor's /accounts/{address} (both returned in one call); 0 if absent.
|
|
18
|
+
async function getBalance(address) {
|
|
19
|
+
const { balance, energy } = await (0, network_1.getAccount)(address);
|
|
20
|
+
return [
|
|
21
|
+
{ value: BigInt(balance || "0"), asset: exports.NATIVE_ASSET },
|
|
22
|
+
{ value: BigInt(energy || "0"), asset: (0, exports.vthoAsset)(address) },
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=getBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../../src/logic/account/getBalance.ts"],"names":[],"mappings":";;;;AACA,gDAAiD;AACjD,2CAA2C;AAE9B,QAAA,YAAY,GAAc,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;AAEvE,kGAAkG;AAClG,gGAAgG;AACzF,MAAM,SAAS,GAAG,CAAC,OAAe,EAAa,EAAE,CAAC,CAAC;IACxD,IAAI,EAAE,OAAO;IACb,cAAc,EAAE,uBAAY;IAC5B,UAAU,EAAE,OAAO;IACnB,IAAI,EAAE,MAAM;CACb,CAAC,CAAC;AALU,QAAA,SAAS,GAAT,SAAS,CAKnB;AAEH,gGAAgG;AACzF,KAAK,qBAAqB,OAAe;IAC9C,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,oBAAU,EAAC,OAAO,CAAC,CAAC;IAEtD,OAAO;QACL,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,QAAA,YAAY,EAAE;QACtD,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE,KAAK,EAAE,IAAA,QAAA,SAAS,EAAC,OAAO,CAAC,EAAE;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBlock.d.ts","sourceRoot":"","sources":["../../../src/logic/history/getBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EAGN,MAAM,2CAA2C,CAAC;AAOnD,wBAAsB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAa7D"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBlock = getBlock;
|
|
4
|
+
const network_1 = require("../../network");
|
|
5
|
+
const getBlockInfo_1 = require("./getBlockInfo");
|
|
6
|
+
// Full expanded block; block info is derived from it (no separate fetch). Only native VET transfers
|
|
7
|
+
// map to operations; VTHO (VIP-180) movements are ABI-encoded events, not decoded here.
|
|
8
|
+
async function getBlock(height) {
|
|
9
|
+
const block = await (0, network_1.getBlock)(height, true);
|
|
10
|
+
if (!block) {
|
|
11
|
+
throw new Error(`vechain: no block at height ${height}`);
|
|
12
|
+
}
|
|
13
|
+
const transactions = block.transactions;
|
|
14
|
+
return {
|
|
15
|
+
info: (0, getBlockInfo_1.toBlockInfo)(block),
|
|
16
|
+
transactions: transactions.map(toBlockTransaction),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function toBlockTransaction(tx) {
|
|
20
|
+
const operations = tx.outputs.flatMap(output => output.transfers.map((transfer) => ({
|
|
21
|
+
type: "transfer",
|
|
22
|
+
address: transfer.recipient,
|
|
23
|
+
peer: transfer.sender,
|
|
24
|
+
asset: { type: "native" },
|
|
25
|
+
amount: BigInt(transfer.amount || "0"),
|
|
26
|
+
})));
|
|
27
|
+
return {
|
|
28
|
+
hash: tx.id,
|
|
29
|
+
failed: tx.reverted,
|
|
30
|
+
operations,
|
|
31
|
+
fees: BigInt(tx.paid || "0"),
|
|
32
|
+
feesPayer: tx.gasPayer ?? tx.origin,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=getBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBlock.js","sourceRoot":"","sources":["../../../src/logic/history/getBlock.ts"],"names":[],"mappings":";;;AAKA,2CAAgE;AAEhE,iDAA6C;AAE7C,oGAAoG;AACpG,wFAAwF;AACjF,KAAK,mBAAmB,MAAc;IAC3C,MAAM,KAAK,GAAG,MAAM,IAAA,kBAAmB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAEtD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,YAA6C,CAAC;IAEzE,OAAO;QACL,IAAI,EAAE,IAAA,0BAAW,EAAC,KAAK,CAAC;QACxB,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,kBAAkB,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,EAA+B;IACzD,MAAM,UAAU,GAAqB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAC/D,MAAM,CAAC,SAAS,CAAC,GAAG,CAClB,CAAC,QAAQ,EAAkB,EAAE,CAAC,CAAC;QAC7B,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,QAAQ,CAAC,SAAS;QAC3B,IAAI,EAAE,QAAQ,CAAC,MAAM;QACrB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,IAAI,GAAG,CAAC;KACvC,CAAC,CACH,CACF,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,EAAE,CAAC,EAAE;QACX,MAAM,EAAE,EAAE,CAAC,QAAQ;QACnB,UAAU;QACV,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,GAAG,CAAC;QAC5B,SAAS,EAAE,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,MAAM;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BlockInfo } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
import type { ApiResponseBlock } from "../../types";
|
|
3
|
+
export declare function toBlockInfo(block: ApiResponseBlock): BlockInfo;
|
|
4
|
+
/** Block metadata (height/hash/time) at a given block height, via Thor `GET /blocks/{height}`. */
|
|
5
|
+
export declare function getBlockInfo(height: number): Promise<BlockInfo>;
|
|
6
|
+
//# sourceMappingURL=getBlockInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBlockInfo.d.ts","sourceRoot":"","sources":["../../../src/logic/history/getBlockInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAO9D;AAED,kGAAkG;AAClG,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAQrE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toBlockInfo = toBlockInfo;
|
|
4
|
+
exports.getBlockInfo = getBlockInfo;
|
|
5
|
+
const network_1 = require("../../network");
|
|
6
|
+
// Map a Thor block to BlockInfo (id/number/timestamp are present regardless of `expanded`).
|
|
7
|
+
function toBlockInfo(block) {
|
|
8
|
+
return {
|
|
9
|
+
height: block.number,
|
|
10
|
+
hash: block.id,
|
|
11
|
+
// Thor block timestamps are unix seconds.
|
|
12
|
+
time: new Date(block.timestamp * 1000),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Block metadata (height/hash/time) at a given block height, via Thor `GET /blocks/{height}`. */
|
|
16
|
+
async function getBlockInfo(height) {
|
|
17
|
+
const block = await (0, network_1.getBlock)(height);
|
|
18
|
+
if (!block) {
|
|
19
|
+
throw new Error(`vechain: no block at height ${height}`);
|
|
20
|
+
}
|
|
21
|
+
return toBlockInfo(block);
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=getBlockInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getBlockInfo.js","sourceRoot":"","sources":["../../../src/logic/history/getBlockInfo.ts"],"names":[],"mappings":";;;;AACA,2CAAgE;AAGhE,4FAA4F;AAC5F,qBAA4B,KAAuB;IACjD,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,IAAI,EAAE,KAAK,CAAC,EAAE;QACd,0CAA0C;QAC1C,IAAI,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC;KACvC,CAAC;AACJ,CAAC;AAED,kGAAkG;AAC3F,KAAK,uBAAuB,MAAc;IAC/C,MAAM,KAAK,GAAG,MAAM,IAAA,kBAAmB,EAAC,MAAM,CAAC,CAAC;IAEhD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,+BAA+B,MAAM,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lastBlock.d.ts","sourceRoot":"","sources":["../../../src/logic/history/lastBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAK3E,wBAAsB,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAGpD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.lastBlock = lastBlock;
|
|
4
|
+
const network_1 = require("../../network");
|
|
5
|
+
const getBlockInfo_1 = require("./getBlockInfo");
|
|
6
|
+
// Latest block; /blocks/best exposes only the height, so hash/time come from getBlockInfo.
|
|
7
|
+
async function lastBlock() {
|
|
8
|
+
const height = await (0, network_1.getLastBlockHeight)();
|
|
9
|
+
return (0, getBlockInfo_1.getBlockInfo)(height);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=lastBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lastBlock.js","sourceRoot":"","sources":["../../../src/logic/history/lastBlock.ts"],"names":[],"mappings":";;;AACA,2CAAmD;AACnD,iDAA8C;AAE9C,2FAA2F;AACpF,KAAK;IACV,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAkB,GAAE,CAAC;IAC1C,OAAO,IAAA,2BAAY,EAAC,MAAM,CAAC,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ListOperationsOptions, MemoNotSupported, Operation, Page } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
export declare function listOperations(address: string, options: ListOperationsOptions): Promise<Page<Operation<MemoNotSupported>>>;
|
|
3
|
+
//# sourceMappingURL=listOperations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listOperations.d.ts","sourceRoot":"","sources":["../../../src/logic/history/listOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,qBAAqB,EACrB,gBAAgB,EAChB,SAAS,EACT,IAAI,EACL,MAAM,2CAA2C,CAAC;AAgCnD,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAsB5C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listOperations = listOperations;
|
|
4
|
+
const sdk_core_1 = require("@vechain/sdk-core");
|
|
5
|
+
const network_1 = require("../../network");
|
|
6
|
+
const getBalance_1 = require("../account/getBalance");
|
|
7
|
+
function toFrameworkOperation(op, asset) {
|
|
8
|
+
return {
|
|
9
|
+
id: op.id,
|
|
10
|
+
type: op.type,
|
|
11
|
+
senders: op.senders,
|
|
12
|
+
recipients: op.recipients,
|
|
13
|
+
value: BigInt(op.value.toFixed(0)),
|
|
14
|
+
asset,
|
|
15
|
+
details: { ledgerOpType: op.type },
|
|
16
|
+
tx: {
|
|
17
|
+
hash: op.hash,
|
|
18
|
+
block: { height: op.blockHeight ?? 0, hash: op.blockHash ?? "", time: op.date },
|
|
19
|
+
fees: asset.type === "native" ? 0n : BigInt((op.fee ?? 0).toFixed(0)),
|
|
20
|
+
date: op.date,
|
|
21
|
+
failed: op.hasFailed ?? false,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function parseCursor(options) {
|
|
26
|
+
const parsed = options.cursor ? Number.parseInt(options.cursor, 10) : Number.NaN;
|
|
27
|
+
const fromCursor = !Number.isNaN(parsed) && parsed >= 1 ? parsed : 1;
|
|
28
|
+
return Math.max(fromCursor, options.minHeight || 0);
|
|
29
|
+
}
|
|
30
|
+
// Merged VET + VTHO operations; `next` is one block past the current head for incremental resume.
|
|
31
|
+
async function listOperations(address, options) {
|
|
32
|
+
const startAt = parseCursor(options);
|
|
33
|
+
const stopAt = await (0, network_1.getLastBlockHeight)();
|
|
34
|
+
if (startAt > stopAt) {
|
|
35
|
+
return { items: [], next: String(startAt) };
|
|
36
|
+
}
|
|
37
|
+
const [vetOps, vthoOps] = await Promise.all([
|
|
38
|
+
(0, network_1.getOperations)(address, address, startAt, stopAt),
|
|
39
|
+
(0, network_1.getTokenOperations)(address, address, sdk_core_1.VTHO_ADDRESS, startAt, stopAt),
|
|
40
|
+
]);
|
|
41
|
+
const items = [
|
|
42
|
+
...vetOps.map(op => toFrameworkOperation(op, getBalance_1.NATIVE_ASSET)),
|
|
43
|
+
...vthoOps.map(op => toFrameworkOperation(op, (0, getBalance_1.vthoAsset)(address))),
|
|
44
|
+
].sort((a, b) => b.tx.date.getTime() - a.tx.date.getTime());
|
|
45
|
+
return {
|
|
46
|
+
items,
|
|
47
|
+
next: String(stopAt + 1),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=listOperations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listOperations.js","sourceRoot":"","sources":["../../../src/logic/history/listOperations.ts"],"names":[],"mappings":";;;AAQA,gDAAiD;AACjD,2CAAsF;AACtF,sDAAgE;AAEhE,SAAS,oBAAoB,CAAC,EAAmB,EAAE,KAAgB;IACjE,OAAO;QACL,EAAE,EAAE,EAAE,CAAC,EAAE;QACT,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,OAAO,EAAE,EAAE,CAAC,OAAO;QACnB,UAAU,EAAE,EAAE,CAAC,UAAU;QACzB,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC,K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OAAO,GAAG,MAAM,EAAE,CAAC;QACrB,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC1C,IAAA,uBAAa,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC;QAChD,IAAA,4BAAkB,EAAC,OAAO,EAAE,OAAO,EAAE,uBAAY,EAAE,OAAO,EAAE,MAAM,CAAC;KACpE,CAAC,CAAC;IAEH,MAAM,KAAK,GAAG;QACZ,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,oBAAoB,CAAC,EAAE,EAAE,yBAAY,CAAC,CAAC;QAC3D,GAAG,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,oBAAoB,CAAC,EAAE,EAAE,IAAA,sBAAS,EAAC,OAAO,CAAC,CAAC,CAAC;KACnE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAE5D,OAAO;QACL,KAAK;QACL,IAAI,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;KACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./account/getBalance";
|
|
2
|
+
export * from "./history/getBlock";
|
|
3
|
+
export * from "./history/getBlockInfo";
|
|
4
|
+
export * from "./history/lastBlock";
|
|
5
|
+
export * from "./history/listOperations";
|
|
6
|
+
export * from "./transaction/broadcast";
|
|
7
|
+
export * from "./transaction/combine";
|
|
8
|
+
export * from "./transaction/craftTransaction";
|
|
9
|
+
export * from "./transaction/estimateFees";
|
|
10
|
+
export * from "./validateAddress";
|
|
11
|
+
export * from "./validateIntent";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logic/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./account/getBalance"), exports);
|
|
18
|
+
__exportStar(require("./history/getBlock"), exports);
|
|
19
|
+
__exportStar(require("./history/getBlockInfo"), exports);
|
|
20
|
+
__exportStar(require("./history/lastBlock"), exports);
|
|
21
|
+
__exportStar(require("./history/listOperations"), exports);
|
|
22
|
+
__exportStar(require("./transaction/broadcast"), exports);
|
|
23
|
+
__exportStar(require("./transaction/combine"), exports);
|
|
24
|
+
__exportStar(require("./transaction/craftTransaction"), exports);
|
|
25
|
+
__exportStar(require("./transaction/estimateFees"), exports);
|
|
26
|
+
__exportStar(require("./validateAddress"), exports);
|
|
27
|
+
__exportStar(require("./validateIntent"), exports);
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logic/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,qDAAmC;AACnC,yDAAuC;AACvC,sDAAoC;AACpC,2DAAyC;AACzC,0DAAwC;AACxC,wDAAsC;AACtC,iEAA+C;AAC/C,6DAA2C;AAC3C,oDAAkC;AAClC,mDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../../src/logic/transaction/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAKjF,wBAAsB,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/F"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.broadcast = broadcast;
|
|
4
|
+
const network_1 = require("../../network");
|
|
5
|
+
// Submit a signed tx (hex from combine) via Thor POST /transactions.
|
|
6
|
+
async function broadcast(tx, _broadcastConfig) {
|
|
7
|
+
const encoded = Uint8Array.from(Buffer.from(tx.replace(/^0x/, ""), "hex"));
|
|
8
|
+
return (0, network_1.submit)({ encoded });
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=broadcast.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../src/logic/transaction/broadcast.ts"],"names":[],"mappings":";;;AACA,2CAAuC;AAGvC,qEAAqE;AAC9D,KAAK,oBAAoB,EAAU,EAAE,gBAAkC;IAC5E,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAE3E,OAAO,IAAA,gBAAM,EAAC,EAAE,OAAO,EAA2B,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combine.d.ts","sourceRoot":"","sources":["../../../src/logic/transaction/combine.ts"],"names":[],"mappings":"AAIA,wBAAgB,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAK7D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.combine = combine;
|
|
4
|
+
const types_1 = require("../../types");
|
|
5
|
+
// Attach the signature to the crafted body and return the signed, hex-encoded tx for broadcast.
|
|
6
|
+
function combine(tx, signature) {
|
|
7
|
+
const body = JSON.parse(tx);
|
|
8
|
+
const signed = types_1.VechainSDKTransaction.of(body, Buffer.from(signature, "hex"));
|
|
9
|
+
return `0x${Buffer.from(signed.encoded).toString("hex")}`;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=combine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../../../src/logic/transaction/combine.ts"],"names":[],"mappings":";;;AACA,uCAAoD;AAEpD,gGAAgG;AAChG,iBAAwB,EAAU,EAAE,SAAiB;IACnD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAA8B,CAAC;IACzD,MAAM,MAAM,GAAG,6BAAqB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,CAAC;IAE7E,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CraftedTransaction, FeeEstimation, TransactionIntent } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
export declare function craftTransaction(intent: TransactionIntent, customFees?: FeeEstimation): Promise<CraftedTransaction>;
|
|
3
|
+
//# sourceMappingURL=craftTransaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"craftTransaction.d.ts","sourceRoot":"","sources":["../../../src/logic/transaction/craftTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAClB,MAAM,2CAA2C,CAAC;AAuEnD,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,iBAAiB,EACzB,UAAU,CAAC,EAAE,aAAa,GACzB,OAAO,CAAC,kBAAkB,CAAC,CAyD7B"}
|