@ledgerhq/coin-vechain 3.0.0 → 4.0.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 +2 -1
- package/CHANGELOG.md +42 -2699
- package/lib/api/index.d.ts +2 -2
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +25 -22
- package/lib/api/index.js.map +1 -1
- package/lib/bridge/broadcast.d.ts.map +1 -1
- package/lib/bridge/broadcast.js +2 -1
- package/lib/bridge/broadcast.js.map +1 -1
- package/lib/bridge/createTransaction.js +1 -1
- package/lib/bridge/createTransaction.js.map +1 -1
- package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/estimateMaxSpendable.js +2 -1
- package/lib/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/getTransactionStatus.js +2 -1
- package/lib/bridge/getTransactionStatus.js.map +1 -1
- package/lib/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/prepareTransaction.js +4 -2
- package/lib/bridge/prepareTransaction.js.map +1 -1
- package/lib/bridge/synchronisation.d.ts.map +1 -1
- package/lib/bridge/synchronisation.js +6 -4
- package/lib/bridge/synchronisation.js.map +1 -1
- package/lib/common-logic/calculateGasFees.d.ts +2 -1
- package/lib/common-logic/calculateGasFees.d.ts.map +1 -1
- package/lib/common-logic/calculateGasFees.js +3 -3
- package/lib/common-logic/calculateGasFees.js.map +1 -1
- package/lib/common-logic/calculateTransactionInfo.d.ts +2 -1
- package/lib/common-logic/calculateTransactionInfo.d.ts.map +1 -1
- package/lib/common-logic/calculateTransactionInfo.js +2 -2
- package/lib/common-logic/calculateTransactionInfo.js.map +1 -1
- package/lib/common-logic/estimateGas.d.ts +2 -1
- package/lib/common-logic/estimateGas.d.ts.map +1 -1
- package/lib/common-logic/estimateGas.js +2 -2
- package/lib/common-logic/estimateGas.js.map +1 -1
- package/lib/common-logic/getThorClient.d.ts +2 -1
- package/lib/common-logic/getThorClient.d.ts.map +1 -1
- package/lib/common-logic/getThorClient.js +2 -2
- package/lib/common-logic/getThorClient.js.map +1 -1
- package/lib/common-logic/mapTransfersToOperations.d.ts +3 -2
- package/lib/common-logic/mapTransfersToOperations.d.ts.map +1 -1
- package/lib/common-logic/mapTransfersToOperations.js +4 -4
- package/lib/common-logic/mapTransfersToOperations.js.map +1 -1
- package/lib/config.d.ts +10 -4
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +9 -5
- package/lib/config.js.map +1 -1
- package/lib/logic/account/getBalance.d.ts +2 -1
- package/lib/logic/account/getBalance.d.ts.map +1 -1
- package/lib/logic/account/getBalance.js +3 -2
- package/lib/logic/account/getBalance.js.map +1 -1
- package/lib/logic/history/getBlock.d.ts +2 -1
- package/lib/logic/history/getBlock.d.ts.map +1 -1
- package/lib/logic/history/getBlock.js +3 -2
- package/lib/logic/history/getBlock.js.map +1 -1
- package/lib/logic/history/getBlockInfo.d.ts +2 -1
- package/lib/logic/history/getBlockInfo.d.ts.map +1 -1
- package/lib/logic/history/getBlockInfo.js +3 -2
- package/lib/logic/history/getBlockInfo.js.map +1 -1
- package/lib/logic/history/lastBlock.d.ts +2 -1
- package/lib/logic/history/lastBlock.d.ts.map +1 -1
- package/lib/logic/history/lastBlock.js +4 -3
- package/lib/logic/history/lastBlock.js.map +1 -1
- package/lib/logic/history/listOperations.d.ts +2 -1
- package/lib/logic/history/listOperations.d.ts.map +1 -1
- package/lib/logic/history/listOperations.js +5 -4
- package/lib/logic/history/listOperations.js.map +1 -1
- package/lib/logic/transaction/broadcast.d.ts +2 -1
- package/lib/logic/transaction/broadcast.d.ts.map +1 -1
- package/lib/logic/transaction/broadcast.js +3 -2
- package/lib/logic/transaction/broadcast.js.map +1 -1
- package/lib/logic/transaction/combine.d.ts +1 -1
- package/lib/logic/transaction/combine.d.ts.map +1 -1
- package/lib/logic/transaction/combine.js +4 -1
- package/lib/logic/transaction/combine.js.map +1 -1
- package/lib/logic/transaction/craftTransaction.d.ts +2 -1
- package/lib/logic/transaction/craftTransaction.d.ts.map +1 -1
- package/lib/logic/transaction/craftTransaction.js +11 -10
- package/lib/logic/transaction/craftTransaction.js.map +1 -1
- package/lib/logic/transaction/estimateFees.d.ts +2 -1
- package/lib/logic/transaction/estimateFees.d.ts.map +1 -1
- package/lib/logic/transaction/estimateFees.js +2 -2
- package/lib/logic/transaction/estimateFees.js.map +1 -1
- package/lib/network/getBlock.d.ts +2 -1
- package/lib/network/getBlock.d.ts.map +1 -1
- package/lib/network/getBlock.js +2 -2
- package/lib/network/getBlock.js.map +1 -1
- package/lib/network/getFees.d.ts +2 -1
- package/lib/network/getFees.d.ts.map +1 -1
- package/lib/network/getFees.js +2 -2
- package/lib/network/getFees.js.map +1 -1
- package/lib/network/sdk.d.ts +7 -6
- package/lib/network/sdk.d.ts.map +1 -1
- package/lib/network/sdk.js +18 -18
- package/lib/network/sdk.js.map +1 -1
- package/lib/test/context.d.ts +6 -0
- package/lib/test/context.d.ts.map +1 -0
- package/lib/test/context.js +15 -0
- package/lib/test/context.js.map +1 -0
- package/lib-es/api/index.d.ts +2 -2
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +25 -22
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/bridge/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/broadcast.js +2 -1
- package/lib-es/bridge/broadcast.js.map +1 -1
- package/lib-es/bridge/createTransaction.js +2 -2
- package/lib-es/bridge/createTransaction.js.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/estimateMaxSpendable.js +2 -1
- package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/getTransactionStatus.js +2 -1
- package/lib-es/bridge/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/prepareTransaction.js +4 -2
- package/lib-es/bridge/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/synchronisation.d.ts.map +1 -1
- package/lib-es/bridge/synchronisation.js +6 -4
- package/lib-es/bridge/synchronisation.js.map +1 -1
- package/lib-es/common-logic/calculateGasFees.d.ts +2 -1
- package/lib-es/common-logic/calculateGasFees.d.ts.map +1 -1
- package/lib-es/common-logic/calculateGasFees.js +3 -3
- package/lib-es/common-logic/calculateGasFees.js.map +1 -1
- package/lib-es/common-logic/calculateTransactionInfo.d.ts +2 -1
- package/lib-es/common-logic/calculateTransactionInfo.d.ts.map +1 -1
- package/lib-es/common-logic/calculateTransactionInfo.js +2 -2
- package/lib-es/common-logic/calculateTransactionInfo.js.map +1 -1
- package/lib-es/common-logic/estimateGas.d.ts +2 -1
- package/lib-es/common-logic/estimateGas.d.ts.map +1 -1
- package/lib-es/common-logic/estimateGas.js +2 -2
- package/lib-es/common-logic/estimateGas.js.map +1 -1
- package/lib-es/common-logic/getThorClient.d.ts +2 -1
- package/lib-es/common-logic/getThorClient.d.ts.map +1 -1
- package/lib-es/common-logic/getThorClient.js +2 -2
- package/lib-es/common-logic/getThorClient.js.map +1 -1
- package/lib-es/common-logic/mapTransfersToOperations.d.ts +3 -2
- package/lib-es/common-logic/mapTransfersToOperations.d.ts.map +1 -1
- package/lib-es/common-logic/mapTransfersToOperations.js +4 -4
- package/lib-es/common-logic/mapTransfersToOperations.js.map +1 -1
- package/lib-es/config.d.ts +10 -4
- package/lib-es/config.d.ts.map +1 -1
- package/lib-es/config.js +9 -5
- package/lib-es/config.js.map +1 -1
- package/lib-es/logic/account/getBalance.d.ts +2 -1
- package/lib-es/logic/account/getBalance.d.ts.map +1 -1
- package/lib-es/logic/account/getBalance.js +3 -2
- package/lib-es/logic/account/getBalance.js.map +1 -1
- package/lib-es/logic/history/getBlock.d.ts +2 -1
- package/lib-es/logic/history/getBlock.d.ts.map +1 -1
- package/lib-es/logic/history/getBlock.js +3 -2
- package/lib-es/logic/history/getBlock.js.map +1 -1
- package/lib-es/logic/history/getBlockInfo.d.ts +2 -1
- package/lib-es/logic/history/getBlockInfo.d.ts.map +1 -1
- package/lib-es/logic/history/getBlockInfo.js +3 -2
- package/lib-es/logic/history/getBlockInfo.js.map +1 -1
- package/lib-es/logic/history/lastBlock.d.ts +2 -1
- package/lib-es/logic/history/lastBlock.d.ts.map +1 -1
- package/lib-es/logic/history/lastBlock.js +4 -3
- package/lib-es/logic/history/lastBlock.js.map +1 -1
- package/lib-es/logic/history/listOperations.d.ts +2 -1
- package/lib-es/logic/history/listOperations.d.ts.map +1 -1
- package/lib-es/logic/history/listOperations.js +5 -4
- package/lib-es/logic/history/listOperations.js.map +1 -1
- package/lib-es/logic/transaction/broadcast.d.ts +2 -1
- package/lib-es/logic/transaction/broadcast.d.ts.map +1 -1
- package/lib-es/logic/transaction/broadcast.js +3 -2
- package/lib-es/logic/transaction/broadcast.js.map +1 -1
- package/lib-es/logic/transaction/combine.d.ts +1 -1
- package/lib-es/logic/transaction/combine.d.ts.map +1 -1
- package/lib-es/logic/transaction/combine.js +4 -1
- package/lib-es/logic/transaction/combine.js.map +1 -1
- package/lib-es/logic/transaction/craftTransaction.d.ts +2 -1
- package/lib-es/logic/transaction/craftTransaction.d.ts.map +1 -1
- package/lib-es/logic/transaction/craftTransaction.js +11 -10
- package/lib-es/logic/transaction/craftTransaction.js.map +1 -1
- package/lib-es/logic/transaction/estimateFees.d.ts +2 -1
- package/lib-es/logic/transaction/estimateFees.d.ts.map +1 -1
- package/lib-es/logic/transaction/estimateFees.js +2 -2
- package/lib-es/logic/transaction/estimateFees.js.map +1 -1
- package/lib-es/network/getBlock.d.ts +2 -1
- package/lib-es/network/getBlock.d.ts.map +1 -1
- package/lib-es/network/getBlock.js +2 -2
- package/lib-es/network/getBlock.js.map +1 -1
- package/lib-es/network/getFees.d.ts +2 -1
- package/lib-es/network/getFees.d.ts.map +1 -1
- package/lib-es/network/getFees.js +2 -2
- package/lib-es/network/getFees.js.map +1 -1
- package/lib-es/network/sdk.d.ts +7 -6
- package/lib-es/network/sdk.d.ts.map +1 -1
- package/lib-es/network/sdk.js +18 -18
- package/lib-es/network/sdk.js.map +1 -1
- package/lib-es/test/context.d.ts +6 -0
- package/lib-es/test/context.d.ts.map +1 -0
- package/lib-es/test/context.js +11 -0
- package/lib-es/test/context.js.map +1 -0
- package/package.json +6 -6
- package/src/api/index.integ.test.ts +21 -24
- package/src/api/index.ts +74 -27
- package/src/api/index.unit.test.ts +68 -48
- package/src/bridge/broadcast.integ.test.ts +2 -1
- package/src/bridge/broadcast.test.ts +1 -1
- package/src/bridge/broadcast.ts +2 -1
- package/src/bridge/createTransaction.ts +2 -2
- package/src/bridge/estimateMaxSpendable.test.ts +19 -3
- package/src/bridge/estimateMaxSpendable.ts +2 -0
- package/src/bridge/getTransactionStatus.test.ts +11 -6
- package/src/bridge/getTransactionStatus.ts +2 -0
- package/src/bridge/prepareTransaction.test.ts +5 -1
- package/src/bridge/prepareTransaction.ts +4 -2
- package/src/bridge/synchronisation.ts +7 -3
- package/src/common-logic/calculateGasFees.test.ts +101 -27
- package/src/common-logic/calculateGasFees.ts +4 -2
- package/src/common-logic/calculateTransactionInfo.test.ts +71 -16
- package/src/common-logic/calculateTransactionInfo.ts +3 -1
- package/src/common-logic/estimateGas.test.ts +13 -10
- package/src/common-logic/estimateGas.ts +3 -1
- package/src/common-logic/getThorClient.test.ts +7 -7
- package/src/common-logic/getThorClient.ts +3 -3
- package/src/common-logic/mapTransfersToOperations.test.ts +48 -13
- package/src/common-logic/mapTransfersToOperations.ts +5 -2
- package/src/config.test.ts +3 -3
- package/src/config.ts +13 -6
- package/src/logic/account/getBalance.ts +4 -2
- package/src/logic/account/getBalance.unit.test.ts +6 -4
- package/src/logic/history/getBlock.ts +4 -2
- package/src/logic/history/getBlock.unit.test.ts +8 -5
- package/src/logic/history/getBlockInfo.ts +4 -2
- package/src/logic/history/getBlockInfo.unit.test.ts +6 -3
- package/src/logic/history/lastBlock.ts +5 -3
- package/src/logic/history/lastBlock.unit.test.ts +6 -3
- package/src/logic/history/listOperations.ts +6 -3
- package/src/logic/history/listOperations.unit.test.ts +10 -6
- package/src/logic/transaction/broadcast.msw.test.ts +7 -2
- package/src/logic/transaction/broadcast.ts +8 -2
- package/src/logic/transaction/broadcast.unit.test.ts +6 -3
- package/src/logic/transaction/combine.ts +6 -2
- package/src/logic/transaction/combine.unit.test.ts +3 -3
- package/src/logic/transaction/craftTransaction.ts +16 -9
- package/src/logic/transaction/craftTransaction.unit.test.ts +29 -28
- package/src/logic/transaction/estimateFees.ts +3 -0
- package/src/logic/transaction/estimateFees.unit.test.ts +15 -12
- package/src/network/getBlock.ts +3 -2
- package/src/network/getBlock.unit.test.ts +11 -6
- package/src/network/getFees.ts +6 -3
- package/src/network/sdk.integ.test.ts +8 -1
- package/src/network/sdk.test.ts +18 -7
- package/src/network/sdk.ts +25 -15
- package/src/test/context.ts +15 -0
package/lib/api/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CoinModuleApi } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
-
import { type
|
|
3
|
-
export declare function createApi(
|
|
2
|
+
import { type VechainCurrencyConfig } from "../config";
|
|
3
|
+
export declare function createApi(): CoinModuleApi<VechainCurrencyConfig>;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAOV,aAAa,EAad,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAuB,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAkB5E,wBAAgB,SAAS,IAAI,aAAa,CAAC,qBAAqB,CAAC,CA8FhE"}
|
package/lib/api/index.js
CHANGED
|
@@ -3,41 +3,44 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createApi = createApi;
|
|
4
4
|
const rejectBalanceOptions_1 = require("@ledgerhq/coin-module-framework/api/getBalance/rejectBalanceOptions");
|
|
5
5
|
const craftTransactionData_1 = require("@ledgerhq/coin-module-framework/logic/craftTransactionData");
|
|
6
|
-
const config_1 = require("../config");
|
|
7
6
|
const logic_1 = require("../logic");
|
|
8
|
-
// CoinModuleApi (Alpaca) factory for VET + VTHO.
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
// CoinModuleApi (Alpaca) factory for VET + VTHO. Each method resolves its config from
|
|
8
|
+
// `context.config()` and threads it explicitly to the logic/network layers — the module never
|
|
9
|
+
// seeds or reads the coin-config singleton on this path (the classic bridge still does).
|
|
10
|
+
function createApi() {
|
|
11
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,
|
|
18
|
-
estimateFees: (transactionIntent,
|
|
19
|
-
combine: logic_1.combine,
|
|
20
|
-
broadcast: logic_1.broadcast,
|
|
21
|
-
validateIntent: (transactionIntent, balances,
|
|
22
|
-
craftTransactionData: craftTransactionData_1.craftTransactionData,
|
|
23
|
-
validateAddress: (address, parameters) => (0, logic_1.validateAddress)(address, parameters),
|
|
12
|
+
lastBlock: (context) => (0, logic_1.lastBlock)(context),
|
|
13
|
+
getBlockInfo: (context, height) => (0, logic_1.getBlockInfo)(context, height),
|
|
14
|
+
getBlock: (context, height) => (0, logic_1.getBlock)(context, height),
|
|
15
|
+
getBalance: (context, address, options) => (0, rejectBalanceOptions_1.rejectBalanceOptions)(() => (0, logic_1.getBalance)(context, address), options),
|
|
16
|
+
listOperations: (context, address, options) => (0, logic_1.listOperations)(context, address, options),
|
|
17
|
+
craftTransaction: (context, transactionIntent, options) => (0, logic_1.craftTransaction)(context, transactionIntent, options?.customFees),
|
|
18
|
+
estimateFees: (context, transactionIntent, options) => (0, logic_1.estimateFees)(context, transactionIntent, options?.customFeesParameters),
|
|
19
|
+
combine: (_context, tx, signature, _options) => (0, logic_1.combine)(tx, signature),
|
|
20
|
+
broadcast: (context, signedTx, options) => (0, logic_1.broadcast)(context, signedTx, options?.broadcastConfig),
|
|
21
|
+
validateIntent: (_context, transactionIntent, balances, options) => (0, logic_1.validateIntent)(transactionIntent, balances, options?.customFees),
|
|
22
|
+
craftTransactionData: (_context, intent) => (0, craftTransactionData_1.craftTransactionData)(intent),
|
|
23
|
+
validateAddress: (_context, address, parameters) => (0, logic_1.validateAddress)(address, parameters),
|
|
24
24
|
// --- Not applicable / not supported for VeChain ---
|
|
25
|
-
getNextSequence: (_address) => {
|
|
25
|
+
getNextSequence: (_context, _address) => {
|
|
26
26
|
throw new Error("getNextSequence is not applicable for Vechain");
|
|
27
27
|
},
|
|
28
|
-
craftRawTransaction: (_transaction, _sender, _publicKey, _sequence) => {
|
|
28
|
+
craftRawTransaction: (_context, _transaction, _sender, _publicKey, _sequence) => {
|
|
29
29
|
throw new Error("craftRawTransaction is not supported");
|
|
30
30
|
},
|
|
31
|
-
call: () => {
|
|
31
|
+
call: (_context) => {
|
|
32
32
|
throw new Error("call is not supported");
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
async register() {
|
|
35
|
+
throw new Error("register is not supported");
|
|
36
|
+
},
|
|
37
|
+
getStakes: (_context, _address, _options) => {
|
|
35
38
|
throw new Error("getStakes is not supported");
|
|
36
39
|
},
|
|
37
|
-
getRewards: (_address,
|
|
40
|
+
getRewards: (_context, _address, _options) => {
|
|
38
41
|
throw new Error("getRewards is not supported");
|
|
39
42
|
},
|
|
40
|
-
getValidators: (
|
|
43
|
+
getValidators: (_context, _options) => {
|
|
41
44
|
throw new Error("getValidators is not supported");
|
|
42
45
|
},
|
|
43
46
|
};
|
package/lib/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,8GAA2G;AAC3G,qGAAkG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,8GAA2G;AAC3G,qGAAkG;AAuBlG,oCAYkB;AAElB,sFAAsF;AACtF,8FAA8F;AAC9F,yFAAyF;AACzF;IACE,OAAO;QACL,SAAS,EAAE,CAAC,OAAuB,EAAsB,EAAE,CAAC,IAAA,iBAAS,EAAC,OAAO,CAAC;QAC9E,YAAY,EAAE,CAAC,OAAuB,EAAE,MAAc,EAAsB,EAAE,CAC5E,IAAA,oBAAY,EAAC,OAAO,EAAE,MAAM,CAAC;QAC/B,QAAQ,EAAE,CAAC,OAAuB,EAAE,MAAc,EAAkB,EAAE,CACpE,IAAA,gBAAQ,EAAC,OAAO,EAAE,MAAM,CAAC;QAC3B,UAAU,EAAE,CACV,OAAuB,EACvB,OAAe,EACf,OAAwB,EACJ,EAAE,CAAC,IAAA,2CAAoB,EAAC,GAAG,EAAE,CAAC,IAAA,kBAAU,EAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAC1F,cAAc,EAAE,CACd,OAAuB,EACvB,OAAe,EACf,OAA8B,EACJ,EAAE,CAAC,IAAA,sBAAc,EAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;QACxE,gBAAgB,EAAE,CAChB,OAAuB,EACvB,iBAA+D,EAC/D,OAAwC,EACX,EAAE,CAC/B,IAAA,wBAAgB,EAAC,OAAO,EAAE,iBAAsC,EAAE,OAAO,EAAE,UAAU,CAAC;QACxF,YAAY,EAAE,CACZ,OAAuB,EACvB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,CAAC;QAC/C,CAAC;QACD,SAAS,EAAE,CACT,QAAwB,EACxB,QAAgB,EAChB,QAA8B,EACR,EAAE;YACxB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,UAAU,EAAE,CACV,QAAwB,EACxB,QAAgB,EAChB,QAA8B,EACP,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,aAAa,EAAE,CACb,QAAwB,EACxB,QAA8B,EACJ,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAyB,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,WAAW,EAAyB,MAAM,UAAU,CAAC;AAI9D;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAU7D,CAAC;eAEa,SAAS"}
|
package/lib/bridge/broadcast.js
CHANGED
|
@@ -4,12 +4,13 @@ exports.broadcast = void 0;
|
|
|
4
4
|
const operation_1 = require("@ledgerhq/ledger-wallet-framework/operation");
|
|
5
5
|
const types_1 = require("../types");
|
|
6
6
|
const network_1 = require("../network");
|
|
7
|
+
const config_1 = require("../config");
|
|
7
8
|
/**
|
|
8
9
|
* Broadcast the signed transaction
|
|
9
10
|
*/
|
|
10
11
|
const broadcast = async ({ signedOperation: { signature, operation, rawData }, }) => {
|
|
11
12
|
const transaction = types_1.VechainSDKTransaction.of(rawData.body, Buffer.from(signature, "hex"));
|
|
12
|
-
const hash = await (0, network_1.submit)(transaction);
|
|
13
|
+
const hash = await (0, network_1.submit)((0, config_1.getCoinConfig)(), transaction);
|
|
13
14
|
return (0, operation_1.patchOperationWithHash)(operation, hash);
|
|
14
15
|
};
|
|
15
16
|
exports.broadcast = broadcast;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":";;;AACA,2EAAqF;AAErF,oCAA8D;AAC9D,wCAAoC;
|
|
1
|
+
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":";;;AACA,2EAAqF;AAErF,oCAA8D;AAC9D,wCAAoC;AACpC,sCAA0C;AAE1C;;GAEG;AACI,MAAM,SAAS,GAA4C,KAAK,EAAE,EACvE,eAAe,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,GACnD,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,6BAAqB,CAAC,EAAE,CACzC,OAA4C,CAAC,IAAI,EAClD,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,CAC9B,CAAC;IACF,MAAM,IAAI,GAAG,MAAM,IAAA,gBAAM,EAAC,IAAA,sBAAa,GAAE,EAAE,WAAW,CAAC,CAAC;IAExD,OAAO,IAAA,kCAAsB,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC,CAAC;AAVW,QAAA,SAAS,GAAT,SAAS,CAUpB;kBAEa,QAAA,SAAS"}
|
|
@@ -13,7 +13,7 @@ const config_1 = require("../config");
|
|
|
13
13
|
* @returns {Transaction}
|
|
14
14
|
*/
|
|
15
15
|
const createTransaction = () => {
|
|
16
|
-
const chainTag = (0, config_1.getChainTag)();
|
|
16
|
+
const chainTag = (0, config_1.getChainTag)((0, config_1.getCoinConfig)());
|
|
17
17
|
return {
|
|
18
18
|
family: "vechain",
|
|
19
19
|
body: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../../src/bridge/createTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAErC,kDAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../../src/bridge/createTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAErC,kDAAgD;AAChD,sCAAuD;AAGvD;;;;GAIG;AACI,MAAM,iBAAiB,GAAoD,GAAG,EAAE;IACrF,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAA,sBAAa,GAAE,CAAC,CAAC;IAE9C,OAAO;QACL,MAAM,EAAE,SAAS;QACjB,IAAI,EAAE;YACJ,QAAQ;YACR,QAAQ,EAAE,oBAAoB;YAC9B,UAAU,EAAE,EAAE;YACd,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,CAAC;YACf,oBAAoB,EAAE,CAAC;YACvB,GAAG,EAAE,GAAG;YACR,SAAS,EAAE,IAAI;YACf,KAAK,EAAE,IAAA,4BAAa,GAAE;SACvB;QACD,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;QACxB,aAAa,EAAE,GAAG;QAClB,SAAS,EAAE,EAAE;QACb,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,iBAAiB,GAAjB,iBAAiB,CAqB5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateMaxSpendable.d.ts","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"estimateMaxSpendable.d.ts","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQ5C,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,sBAAsB,CA4BnF,CAAC"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.estimateMaxSpendable = void 0;
|
|
7
7
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
8
|
const common_logic_1 = require("../common-logic");
|
|
9
|
+
const config_1 = require("../config");
|
|
9
10
|
const PATTERN_ADDRESS_IN_TOKEN_ACCOUNT_ID = /:(0x\w+):/;
|
|
10
11
|
const getAddressFromTokenAccountId = (tokenAccountId) => PATTERN_ADDRESS_IN_TOKEN_ACCOUNT_ID.exec(tokenAccountId)?.[1];
|
|
11
12
|
const estimateMaxSpendable = async ({ account, parentAccount, transaction, }) => {
|
|
@@ -15,7 +16,7 @@ const estimateMaxSpendable = async ({ account, parentAccount, transaction, }) =>
|
|
|
15
16
|
if (account.type === "TokenAccount") {
|
|
16
17
|
const originAddress = parentAccount?.freshAddress || getAddressFromTokenAccountId(account.id);
|
|
17
18
|
if (originAddress) {
|
|
18
|
-
const { estimatedGasFees: maxTokenFees } = await (0, common_logic_1.calculateGasFees)(transaction, true, originAddress);
|
|
19
|
+
const { estimatedGasFees: maxTokenFees } = await (0, common_logic_1.calculateGasFees)((0, config_1.getCoinConfig)(), transaction, true, originAddress);
|
|
19
20
|
const spendable = account.balance.minus(maxTokenFees);
|
|
20
21
|
if (spendable.gt(0)) {
|
|
21
22
|
return spendable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAErC,kDAAmD;
|
|
1
|
+
{"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAErC,kDAAmD;AAEnD,sCAA0C;AAE1C,MAAM,mCAAmC,GAAG,WAAW,CAAC;AAExD,MAAM,4BAA4B,GAAG,CAAC,cAAsB,EAAsB,EAAE,CAClF,mCAAmC,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAEzD,MAAM,oBAAoB,GAAuD,KAAK,EAAE,EAC7F,OAAO,EACP,aAAa,EACb,WAAW,GACZ,EAAsB,EAAE;IACvB,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,WAAW,EAAE,CAAC;QAC/C,OAAO,OAAO,CAAC,OAAO,CAAC;IACzB,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QACpC,MAAM,aAAa,GAAG,aAAa,EAAE,YAAY,IAAI,4BAA4B,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAE9F,IAAI,aAAa,EAAE,CAAC;YAClB,MAAM,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,MAAM,IAAA,+BAAgB,EAC/D,IAAA,sBAAa,GAAE,EACf,WAAW,EACX,IAAI,EACJ,aAAa,CACd,CAAC;YACF,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAEtD,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACpB,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;AAC1B,CAAC,CAAC;AA5BW,QAAA,oBAAoB,GAApB,oBAAoB,CA4B/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAI5C,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,sBAAsB,CA8DnF,CAAC;eAEa,oBAAoB"}
|
|
@@ -8,12 +8,13 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
|
8
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
|
+
const config_1 = require("../config");
|
|
11
12
|
const getTransactionStatus = async (account, transaction) => {
|
|
12
13
|
const { freshAddress, currency, subAccounts } = account;
|
|
13
14
|
const { body, recipient, amount } = transaction;
|
|
14
15
|
const errors = {};
|
|
15
16
|
const warnings = {};
|
|
16
|
-
const { isTokenAccount, spendableBalance } = await (0, common_logic_1.calculateTransactionInfo)(account, transaction, {
|
|
17
|
+
const { isTokenAccount, spendableBalance } = await (0, common_logic_1.calculateTransactionInfo)((0, config_1.getCoinConfig)(), account, transaction, {
|
|
17
18
|
estimatedGas: body.gas,
|
|
18
19
|
estimatedGasFees: new bignumber_js_1.default(transaction.estimatedFees),
|
|
19
20
|
maxFeePerGas: body.maxFeePerGas,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;A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AClB,IAAI,CAAC,WAAW,CAAC,YAAY;YAAE,MAAM,CAAC,MAAM,GAAG,IAAI,uBAAc,EAAE,CAAC;;YAC/D,MAAM,CAAC,MAAM,GAAG,IAAI,yBAAgB,EAAE,CAAC;IAC9C,CAAC;SAAM,CAAC;QACN,IAAI,MAAM,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAChC,MAAM,CAAC,MAAM,GAAG,IAAI,yBAAgB,EAAE,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,cAAc,EAAE,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;AA9DW,QAAA,oBAAoB,GAApB,oBAAoB,CA8D/B;kBAEa,QAAA,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAO/C,OAAO,EAAE,WAAW,EAA+B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAO/C,OAAO,EAAE,WAAW,EAA+B,MAAM,UAAU,CAAC;AAIpE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,YACpB,OAAO,eACH,WAAW,KACvB,OAAO,CAAC,WAAW,CAgCrB,CAAC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.prepareTransaction = void 0;
|
|
4
4
|
const common_logic_1 = require("../common-logic");
|
|
5
5
|
const network_1 = require("../network");
|
|
6
|
+
const config_1 = require("../config");
|
|
6
7
|
/**
|
|
7
8
|
* Prepare transaction before checking status
|
|
8
9
|
*
|
|
@@ -10,11 +11,12 @@ const network_1 = require("../network");
|
|
|
10
11
|
* @param {Transaction} t
|
|
11
12
|
*/
|
|
12
13
|
const prepareTransaction = async (account, transaction) => {
|
|
13
|
-
const
|
|
14
|
+
const config = (0, config_1.getCoinConfig)();
|
|
15
|
+
const { amount, isTokenAccount, estimatedFees, estimatedGas, maxFeePerGas, maxPriorityFeePerGas, } = await (0, common_logic_1.calculateTransactionInfo)(config, account, transaction);
|
|
14
16
|
let blockRef = "";
|
|
15
17
|
let clauses = [];
|
|
16
18
|
if (transaction.recipient && (0, common_logic_1.parseAddress)(transaction.recipient)) {
|
|
17
|
-
blockRef = await (0, network_1.getBlockRef)();
|
|
19
|
+
blockRef = await (0, network_1.getBlockRef)(config);
|
|
18
20
|
if (isTokenAccount) {
|
|
19
21
|
clauses = await (0, common_logic_1.calculateClausesVtho)(transaction.recipient, amount);
|
|
20
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareTransaction.js","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":";;;AACA,kDAKyB;AAEzB,wCAAyC;
|
|
1
|
+
{"version":3,"file":"prepareTransaction.js","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":";;;AAC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e,EAAY,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"synchronisation.d.ts","sourceRoot":"","sources":["../../src/bridge/synchronisation.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,eAAe,EAAY,MAAM,oDAAoD,CAAC;AAC/F,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAM/C,eAAO,MAAM,eAAe,EAAE,eAAe,CAAC,OAAO,CAwFpD,CAAC"}
|
|
@@ -12,6 +12,7 @@ const jsHelpers_1 = require("@ledgerhq/ledger-wallet-framework/bridge/jsHelpers"
|
|
|
12
12
|
const helpers_1 = require("./helpers");
|
|
13
13
|
const sdk_core_1 = require("@vechain/sdk-core");
|
|
14
14
|
const cryptoAssetsStore_1 = require("@ledgerhq/ledger-wallet-framework/cryptoAssetsStore");
|
|
15
|
+
const config_1 = require("../config");
|
|
15
16
|
const getAccountShape = async (info) => {
|
|
16
17
|
const { initialAccount, currency, derivationMode } = info;
|
|
17
18
|
const address = eip55_1.default.encode(info.address);
|
|
@@ -24,18 +25,19 @@ const getAccountShape = async (info) => {
|
|
|
24
25
|
xpubOrAddress: address,
|
|
25
26
|
derivationMode,
|
|
26
27
|
});
|
|
28
|
+
const config = (0, config_1.getCoinConfig)();
|
|
27
29
|
// get the current account balance state depending your api implementation
|
|
28
|
-
const { balance, energy } = await (0, network_1.getAccount)(address);
|
|
30
|
+
const { balance, energy } = await (0, network_1.getAccount)(config, address);
|
|
29
31
|
// get the current block height
|
|
30
|
-
const blockHeight = await (0, network_1.getLastBlockHeight)();
|
|
32
|
+
const blockHeight = await (0, network_1.getLastBlockHeight)(config);
|
|
31
33
|
// Merge new operations with the previously synced ones
|
|
32
|
-
const newOperations = await (0, network_1.getOperations)(accountId, address, startAt, blockHeight);
|
|
34
|
+
const newOperations = await (0, network_1.getOperations)(config, accountId, address, startAt, blockHeight);
|
|
33
35
|
//Get last token operations
|
|
34
36
|
const vthoToken = await (0, cryptoAssetsStore_1.getCryptoAssetsStore)().findTokenById("vechain/vip180/vtho");
|
|
35
37
|
if (!vthoToken)
|
|
36
38
|
throw new Error("VTHO token not found");
|
|
37
39
|
const vthoAccountId = (0, index_1.encodeTokenAccountId)(accountId, vthoToken);
|
|
38
|
-
const vthoOperations = await (0, network_1.getTokenOperations)(vthoAccountId, address, sdk_core_1.VTHO_ADDRESS, 1, // from parameter must be 1 otherwise the response is empty
|
|
40
|
+
const vthoOperations = await (0, network_1.getTokenOperations)(config, vthoAccountId, address, sdk_core_1.VTHO_ADDRESS, 1, // from parameter must be 1 otherwise the response is empty
|
|
39
41
|
blockHeight);
|
|
40
42
|
const operations = (0, jsHelpers_1.mergeOps)(oldOperations, newOperations);
|
|
41
43
|
//Account creation date set to now if there are no operation or at the first operation on the account
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"synchronisation.js","sourceRoot":"","sources":["../../src/bridge/synchronisation.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAyC;AAEzC,kDAA0B;AAC1B,2EAIyD;AAEzD,wCAA+F;AAC/F,kFAA+F;AAE/F,uCAA2C;AAC3C,gDAAiD;AACjD,2FAA2F;
|
|
1
|
+
{"version":3,"file":"synchronisation.js","sourceRoot":"","sources":["../../src/bridge/synchronisation.ts"],"names":[],"mappings":";;;;;;AAAA,+CAAyC;AAEzC,kDAA0B;AAC1B,2EAIyD;AAEzD,wCAA+F;AAC/F,kFAA+F;AAE/F,uCAA2C;AAC3C,gDAAiD;AACjD,2FAA2F;AAC3F,sCAA0C;AAEnC,MAAM,eAAe,GAA6B,KAAK,EAAC,IAAI,EAAC,EAAE;IACpE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAC1D,MAAM,OAAO,GAAG,eAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE3C,MAAM,aAAa,GAAG,cAAc,EAAE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C,IAAI,IAAI,EAAE;gBAC7D,eAAe,EAAE,cAAc,CAAC,MAAM;gBACtC,UAAU,EAAE,cAAc;gBAC1B,WAAW;gBACX,iBAAiB,EACf,CAAC,cAAc,EAAE,WAAW,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,iBAAiB,CAAC,IAAI,EAAE;gBACzF,mBAAmB,EACjB,CAAC,cAAc,EAAE,WAAW,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC;oBACnF,yBAAiB;gBACnB,WAAW,EAAE,EAAE;aAChB;SACF;KACF,CAAC;IAEF,OAAO;QACL,GAAG,KAAK;QACR,IAAI,EAAE,CAAC,IAAA,wBAAc,EAAC,KAAK,CAAC;KAC7B,CAAC;AACJ,CAAC,CAAC;AAxFW,QAAA,eAAe,GAAf,eAAe,CAwF1B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import { Transaction } from "../types";
|
|
3
|
-
|
|
3
|
+
import type { VechainCurrencyConfig } from "../config";
|
|
4
|
+
export declare const calculateGasFees: (config: VechainCurrencyConfig, transaction: Transaction, isTokenAccount: boolean, originAddress: string) => Promise<{
|
|
4
5
|
estimatedGas: number;
|
|
5
6
|
estimatedGasFees: BigNumber;
|
|
6
7
|
maxFeePerGas: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateGasFees.d.ts","sourceRoot":"","sources":["../../src/common-logic/calculateGasFees.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"calculateGasFees.d.ts","sourceRoot":"","sources":["../../src/common-logic/calculateGasFees.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAMvD,eAAO,MAAM,gBAAgB,WACnB,qBAAqB,eAChB,WAAW,kBACR,OAAO,iBACR,MAAM,KACpB,OAAO,CAAC;IACT,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,SAAS,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,CA+BA,CAAC"}
|
|
@@ -9,7 +9,7 @@ const parseAddress_1 = require("./parseAddress");
|
|
|
9
9
|
const calculateClauses_1 = require("./calculateClauses");
|
|
10
10
|
const estimateGas_1 = require("./estimateGas");
|
|
11
11
|
const getThorClient_1 = require("./getThorClient");
|
|
12
|
-
const calculateGasFees = async (transaction, isTokenAccount, originAddress) => {
|
|
12
|
+
const calculateGasFees = async (config, transaction, isTokenAccount, originAddress) => {
|
|
13
13
|
if (transaction.recipient && (0, parseAddress_1.parseAddress)(transaction.recipient)) {
|
|
14
14
|
let clauses;
|
|
15
15
|
if (isTokenAccount) {
|
|
@@ -18,8 +18,8 @@ const calculateGasFees = async (transaction, isTokenAccount, originAddress) => {
|
|
|
18
18
|
else {
|
|
19
19
|
clauses = await (0, calculateClauses_1.calculateClausesVet)(transaction.recipient, transaction.amount);
|
|
20
20
|
}
|
|
21
|
-
const gasEstimation = await (0, estimateGas_1.estimateGas)(clauses, originAddress);
|
|
22
|
-
const thorClient = (0, getThorClient_1.getThorClient)();
|
|
21
|
+
const gasEstimation = await (0, estimateGas_1.estimateGas)(config, clauses, originAddress);
|
|
22
|
+
const thorClient = (0, getThorClient_1.getThorClient)(config);
|
|
23
23
|
const body = await thorClient.transactions.buildTransactionBody(clauses, gasEstimation.totalGas, {});
|
|
24
24
|
return {
|
|
25
25
|
estimatedGas: gasEstimation.totalGas,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateGasFees.js","sourceRoot":"","sources":["../../src/common-logic/calculateGasFees.ts"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AI,CAAC,oBAAoB,IAAI,GAAG,CAAC;SAC/D,CAAC;IACJ,CAAC;IACD,OAAO;QACL,YAAY,EAAE,CAAC;QACf,gBAAgB,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;QAClC,YAAY,EAAE,CAAC;QACf,oBAAoB,EAAE,CAAC;KACxB,CAAC;AACJ,CAAC,CAAC;AAzCW,QAAA,gBAAgB,GAAhB,gBAAgB,CAyC3B"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import { Account } from "@ledgerhq/types-live";
|
|
3
3
|
import { Transaction, TransactionInfo } from "../types";
|
|
4
|
-
|
|
4
|
+
import type { VechainCurrencyConfig } from "../config";
|
|
5
|
+
export declare const calculateTransactionInfo: (config: VechainCurrencyConfig, account: Account, transaction: Transaction, fixedMaxTokenFees?: {
|
|
5
6
|
estimatedGas: number;
|
|
6
7
|
estimatedGasFees: BigNumber;
|
|
7
8
|
maxFeePerGas: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateTransactionInfo.d.ts","sourceRoot":"","sources":["../../src/common-logic/calculateTransactionInfo.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,OAAO,EAAgB,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"calculateTransactionInfo.d.ts","sourceRoot":"","sources":["../../src/common-logic/calculateTransactionInfo.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,OAAO,EAAgB,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAwBvD,eAAO,MAAM,wBAAwB,WAC3B,qBAAqB,WACpB,OAAO,eACH,WAAW,sBACJ;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,SAAS,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;CAC9B,KACA,OAAO,CAAC,eAAe,CAkEzB,CAAC"}
|
|
@@ -21,7 +21,7 @@ const getTokenAccount = (subAccountId, subAccounts) => subAccountId && subAccoun
|
|
|
21
21
|
// balance: USER
|
|
22
22
|
// circular dependency is:
|
|
23
23
|
// amount -> spendableBalance -> fees -> amount
|
|
24
|
-
const calculateTransactionInfo = async (account, transaction, fixedMaxTokenFees) => {
|
|
24
|
+
const calculateTransactionInfo = async (config, account, transaction, fixedMaxTokenFees) => {
|
|
25
25
|
const { subAccounts } = account;
|
|
26
26
|
const { amount: oldAmount, subAccountId, useAllAmount } = transaction;
|
|
27
27
|
const tokenAccount = getTokenAccount(subAccountId, subAccounts);
|
|
@@ -41,7 +41,7 @@ const calculateTransactionInfo = async (account, transaction, fixedMaxTokenFees)
|
|
|
41
41
|
do {
|
|
42
42
|
amountBackup = amount;
|
|
43
43
|
const estimatedGasAndFees = fixedMaxTokenFees ||
|
|
44
|
-
(await (0, calculateGasFees_1.calculateGasFees)(tempTransaction, isTokenAccount, account.freshAddress));
|
|
44
|
+
(await (0, calculateGasFees_1.calculateGasFees)(config, tempTransaction, isTokenAccount, account.freshAddress));
|
|
45
45
|
maxEstimatedGasFees = estimatedGasAndFees.estimatedGasFees;
|
|
46
46
|
maxEstimatedGas = estimatedGasAndFees.estimatedGas;
|
|
47
47
|
maxFeePerGas = estimatedGasAndFees.maxFeePerGas;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculateTransactionInfo.js","sourceRoot":"","sources":["../../src/common-logic/calculateTransactionInfo.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;
|
|
1
|
+
{"version":3,"file":"calculateTransactionInfo.js","sourceRoot":"","sources":["../../src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K,cAAc,EAAE,CAAC;YAClC,MAAM,IAAI,2CAAkC,EAAE,CAAC;QACjD,CAAC;IACH,CAAC;IAED,OAAO;QACL,cAAc;QACd,MAAM;QACN,gBAAgB;QAChB,OAAO;QACP,YAAY;QACZ,aAAa,EAAE,mBAAmB,CAAC,QAAQ,EAAE;QAC7C,YAAY,EAAE,eAAe;QAC7B,YAAY,EAAE,YAAY;QAC1B,oBAAoB,EAAE,oBAAoB;KAC3C,CAAC;AACJ,CAAC,CAAC;AA5EW,QAAA,wBAAwB,GAAxB,wBAAwB,CA4EnC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { TransactionClause } from "@vechain/sdk-core";
|
|
2
2
|
import { EstimateGasResult } from "@vechain/sdk-network";
|
|
3
|
+
import type { VechainCurrencyConfig } from "../config";
|
|
3
4
|
/**
|
|
4
5
|
* Estimates gas fees for transaction clauses
|
|
5
6
|
* @param {TransactionClause[]} clauses - Array of transaction clauses
|
|
6
7
|
* @param {string} origin - Origin address for the transaction
|
|
7
8
|
* @return {Promise<EstimateGasResult>} Estimated gas result
|
|
8
9
|
*/
|
|
9
|
-
export declare const estimateGas: (clauses: TransactionClause[], origin: string) => Promise<EstimateGasResult>;
|
|
10
|
+
export declare const estimateGas: (config: VechainCurrencyConfig, clauses: TransactionClause[], origin: string) => Promise<EstimateGasResult>;
|
|
10
11
|
//# sourceMappingURL=estimateGas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateGas.d.ts","sourceRoot":"","sources":["../../src/common-logic/estimateGas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"estimateGas.d.ts","sourceRoot":"","sources":["../../src/common-logic/estimateGas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,WACd,qBAAqB,WACpB,iBAAiB,EAAE,UACpB,MAAM,KACb,OAAO,CAAC,iBAAiB,CAI3B,CAAC"}
|
|
@@ -8,8 +8,8 @@ const getThorClient_1 = require("./getThorClient");
|
|
|
8
8
|
* @param {string} origin - Origin address for the transaction
|
|
9
9
|
* @return {Promise<EstimateGasResult>} Estimated gas result
|
|
10
10
|
*/
|
|
11
|
-
const estimateGas = async (clauses, origin) => {
|
|
12
|
-
const thorClient = (0, getThorClient_1.getThorClient)();
|
|
11
|
+
const estimateGas = async (config, clauses, origin) => {
|
|
12
|
+
const thorClient = (0, getThorClient_1.getThorClient)(config);
|
|
13
13
|
const gasResult = await thorClient.gas.estimateGas(clauses, origin);
|
|
14
14
|
return gasResult;
|
|
15
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateGas.js","sourceRoot":"","sources":["../../src/common-logic/estimateGas.ts"],"names":[],"mappings":";;;AACA,mDAAgD;
|
|
1
|
+
{"version":3,"file":"estimateGas.js","sourceRoot":"","sources":["../../src/common-logic/estimateGas.ts"],"names":[],"mappings":";;;AACA,mDAAgD;AAIhD;;;;;GAKG;AACI,MAAM,WAAW,GAAG,KAAK,EAC9B,MAA6B,EAC7B,OAA4B,EAC5B,MAAc,EACc,EAAE;IAC9B,MAAM,UAAU,GAAG,IAAA,6BAAa,EAAC,MAAM,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACpE,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AARW,QAAA,WAAW,GAAX,WAAW,CAQtB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ThorClient } from "@vechain/sdk-network";
|
|
2
|
+
import { type VechainCurrencyConfig } from "../config";
|
|
2
3
|
/**
|
|
3
4
|
* Returns a ThorClient instance configured with the VeChain node URL
|
|
4
5
|
* @returns {ThorClient} Configured ThorClient instance for interacting with the VeChain network
|
|
5
6
|
*/
|
|
6
|
-
export declare const getThorClient: () => ThorClient;
|
|
7
|
+
export declare const getThorClient: (config: VechainCurrencyConfig) => ThorClient;
|
|
7
8
|
//# sourceMappingURL=getThorClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getThorClient.d.ts","sourceRoot":"","sources":["../../src/common-logic/getThorClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"getThorClient.d.ts","sourceRoot":"","sources":["../../src/common-logic/getThorClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,aAAa,WAAY,qBAAqB,KAAG,UAE7D,CAAC"}
|
|
@@ -7,8 +7,8 @@ const config_1 = require("../config");
|
|
|
7
7
|
* Returns a ThorClient instance configured with the VeChain node URL
|
|
8
8
|
* @returns {ThorClient} Configured ThorClient instance for interacting with the VeChain network
|
|
9
9
|
*/
|
|
10
|
-
const getThorClient = () => {
|
|
11
|
-
return sdk_network_1.ThorClient.at((0, config_1.getNodeUrl)());
|
|
10
|
+
const getThorClient = (config) => {
|
|
11
|
+
return sdk_network_1.ThorClient.at((0, config_1.getNodeUrl)(config));
|
|
12
12
|
};
|
|
13
13
|
exports.getThorClient = getThorClient;
|
|
14
14
|
//# sourceMappingURL=getThorClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getThorClient.js","sourceRoot":"","sources":["../../src/common-logic/getThorClient.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAClD,
|
|
1
|
+
{"version":3,"file":"getThorClient.js","sourceRoot":"","sources":["../../src/common-logic/getThorClient.ts"],"names":[],"mappings":";;;AAAA,sDAAkD;AAClD,sCAAmE;AAEnE;;;GAGG;AACI,MAAM,aAAa,GAAG,CAAC,MAA6B,EAAc,EAAE;IACzE,OAAO,wBAAU,CAAC,EAAE,CAAC,IAAA,mBAAU,EAAC,MAAM,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC;AAFW,QAAA,aAAa,GAAb,aAAa,CAExB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Operation } from "@ledgerhq/types-live";
|
|
2
2
|
import { EventLog, TransferLog } from "../types";
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
3
|
+
import type { VechainCurrencyConfig } from "../config";
|
|
4
|
+
export declare const mapVetTransfersToOperations: (config: VechainCurrencyConfig, txs: TransferLog[], accountId: string, addr: string) => Promise<Operation[]>;
|
|
5
|
+
export declare const mapTokenTransfersToOperations: (config: VechainCurrencyConfig, events: EventLog[], accountId: string, addr: string) => Promise<Operation[]>;
|
|
5
6
|
//# sourceMappingURL=mapTransfersToOperations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapTransfersToOperations.d.ts","sourceRoot":"","sources":["../../src/common-logic/mapTransfersToOperations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"mapTransfersToOperations.d.ts","sourceRoot":"","sources":["../../src/common-logic/mapTransfersToOperations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIjD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,eAAO,MAAM,2BAA2B,WAC9B,qBAAqB,OACxB,WAAW,EAAE,aACP,MAAM,QACX,MAAM,KACX,OAAO,CAAC,SAAS,EAAE,CAwBrB,CAAC;AAEF,eAAO,MAAM,6BAA6B,WAChC,qBAAqB,UACrB,QAAQ,EAAE,aACP,MAAM,QACX,MAAM,KACX,OAAO,CAAC,SAAS,EAAE,CAmCrB,CAAC"}
|
|
@@ -8,9 +8,9 @@ const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
|
8
8
|
const operation_1 = require("@ledgerhq/ledger-wallet-framework/operation");
|
|
9
9
|
const getFees_1 = require("../network/getFees");
|
|
10
10
|
const sdk_core_1 = require("@vechain/sdk-core");
|
|
11
|
-
const mapVetTransfersToOperations = async (txs, accountId, addr) => {
|
|
11
|
+
const mapVetTransfersToOperations = async (config, txs, accountId, addr) => {
|
|
12
12
|
return Promise.all(txs.map(async (tx) => {
|
|
13
|
-
const fees = await (0, getFees_1.getFees)(tx.meta.txID);
|
|
13
|
+
const fees = await (0, getFees_1.getFees)(config, tx.meta.txID);
|
|
14
14
|
return {
|
|
15
15
|
id: (0, operation_1.encodeOperationId)(accountId, tx.meta.txID, tx.recipient.toLowerCase() === addr.toLowerCase() ? "IN" : "OUT"),
|
|
16
16
|
hash: tx.meta.txID,
|
|
@@ -28,7 +28,7 @@ const mapVetTransfersToOperations = async (txs, accountId, addr) => {
|
|
|
28
28
|
}));
|
|
29
29
|
};
|
|
30
30
|
exports.mapVetTransfersToOperations = mapVetTransfersToOperations;
|
|
31
|
-
const mapTokenTransfersToOperations = async (events, accountId, addr) => {
|
|
31
|
+
const mapTokenTransfersToOperations = async (config, events, accountId, addr) => {
|
|
32
32
|
return Promise.all(events.map(async (event) => {
|
|
33
33
|
const decoded = sdk_core_1.ABIEvent.parseLog(sdk_core_1.VIP180_ABI, {
|
|
34
34
|
data: sdk_core_1.Hex.of(event.data),
|
|
@@ -38,7 +38,7 @@ const mapTokenTransfersToOperations = async (events, accountId, addr) => {
|
|
|
38
38
|
const to = decoded.args.to;
|
|
39
39
|
const value = decoded.args.value;
|
|
40
40
|
const type = to.toLowerCase() === addr.toLowerCase() ? "IN" : "OUT";
|
|
41
|
-
const fees = await (0, getFees_1.getFees)(event.meta.txID);
|
|
41
|
+
const fees = await (0, getFees_1.getFees)(config, event.meta.txID);
|
|
42
42
|
return {
|
|
43
43
|
id: (0, operation_1.encodeOperationId)(accountId, event.meta.txID, type),
|
|
44
44
|
hash: event.meta.txID,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapTransfersToOperations.js","sourceRoot":"","sources":["../../src/common-logic/mapTransfersToOperations.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAGrC,2EAAgF;AAChF,gDAA6C;AAC7C,gDAA8D;
|
|
1
|
+
{"version":3,"file":"mapTransfersToOperations.js","sourceRoot":"","sources":["../../src/common-logic/mapTransfersToOperations.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAGrC,2EAAgF;AAChF,gDAA6C;AAC7C,gDAA8D;AAGvD,MAAM,2BAA2B,GAAG,KAAK,EAC9C,MAA6B,EAC7B,GAAkB,EAClB,SAAiB,EACjB,IAAY,EACU,EAAE;IACxB,OAAO,OAAO,CAAC,GAAG,CAChB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAC,EAAE,EAAC,EAAE;QACjB,MAAM,IAAI,GAAG,MAAM,IAAA,iBAAO,EAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACjD,OAAO;YACL,EAAE,EAAE,IAAA,6BAAiB,EACnB,SAAS,EACT,EAAE,CAAC,IAAI,CAAC,IAAI,EACZ,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CACjE;YACD,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IA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AAE,GAAG,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;QACjC,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACpE,MAAM,IAAI,GAAG,MAAM,IAAA,iBAAO,EAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpD,OAAO;YACL,EAAE,EAAE,IAAA,6BAAiB,EAAC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC;YACvD,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;YACrB,IAAI;YACJ,KAAK,EAAE,IAAI,sBAAS,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACtC,GAAG,EAAE,IAAI;YACT,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC7B,UAAU,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;YAC9B,WAAW,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW;YACnC,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO;YAC7B,SAAS;YACT,IAAI,EAAE,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAChD,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,6BAA6B,GAA7B,6BAA6B,CAwCxC"}
|
package/lib/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CurrencyConfig, CoinConfig } from "@ledgerhq/coin-module-framework/config";
|
|
1
|
+
import { CurrencyConfig, CoinConfig, type Context } from "@ledgerhq/coin-module-framework/config";
|
|
2
2
|
/**
|
|
3
3
|
* `node.url` is the Thor REST endpoint. It is part of the coin config, as in coin-stellar and
|
|
4
4
|
* coin-xrp, rather than read from `@ledgerhq/live-env` inside the module: a coin module that
|
|
@@ -12,9 +12,15 @@ export type VechainCurrencyConfig = CurrencyConfig & {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
export type VechainCoinConfig = () => VechainCurrencyConfig;
|
|
15
|
+
/** The {@link Context} threaded through the coin-vechain API layer (ADR-019). */
|
|
16
|
+
export type VechainContext = Context<VechainCurrencyConfig>;
|
|
15
17
|
export declare function setCoinConfig(config: CoinConfig<VechainCurrencyConfig>): void;
|
|
16
18
|
export declare function getCoinConfig(): VechainCurrencyConfig;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Thor REST endpoint. Config is threaded in explicitly by every caller: the Alpaca (`createApi`)
|
|
21
|
+
* path resolves it from `context.config()`, and the classic bridge resolves it once from the
|
|
22
|
+
* {@link getCoinConfig} singleton at its entry points and passes it down.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getNodeUrl(config: VechainCurrencyConfig): string;
|
|
25
|
+
export declare function getChainTag(config: VechainCurrencyConfig): number;
|
|
20
26
|
//# sourceMappingURL=config.d.ts.map
|
package/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,wCAAwC,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,wCAAwC,CAAC;AAIlG;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,GAAG;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,qBAAqB,CAAC;AAE5D,iFAAiF;AACjF,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAI5D,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAE7E;AAED,wBAAgB,aAAa,IAAI,qBAAqB,CAMrD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAQhE;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,qBAAqB,GAAG,MAAM,CAQjE"}
|