@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/config.js
CHANGED
|
@@ -16,16 +16,20 @@ function getCoinConfig() {
|
|
|
16
16
|
}
|
|
17
17
|
return coinConfig();
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
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
|
+
function getNodeUrl(config) {
|
|
25
|
+
const { node } = config;
|
|
22
26
|
if (!node?.url) {
|
|
23
27
|
throw new Error("vechain: node.url is missing from the coin config");
|
|
24
28
|
}
|
|
25
29
|
return node.url;
|
|
26
30
|
}
|
|
27
|
-
function getChainTag() {
|
|
28
|
-
const { chainTag } =
|
|
31
|
+
function getChainTag(config) {
|
|
32
|
+
const { chainTag } = config;
|
|
29
33
|
return typeof chainTag === "number" &&
|
|
30
34
|
Number.isInteger(chainTag) &&
|
|
31
35
|
chainTag >= 0 &&
|
package/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AACA,mEAA2E;AAC3E,mCAA4C;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AACA,mEAA2E;AAC3E,mCAA4C;AAkB5C,IAAI,UAAyD,CAAC;AAE9D,uBAA8B,MAAyC;IACrE,UAAU,GAAG,MAAM,CAAC;AACtB,CAAC;AAED;IACE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,0BAAiB,EAAE,CAAC;IAChC,CAAC;IAED,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,oBAA2B,MAA6B;IACtD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAExB,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACvE,CAAC;IAED,OAAO,IAAI,CAAC,GAAG,CAAC;AAClB,CAAC;AAED,qBAA4B,MAA6B;IACvD,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;IAC5B,OAAO,OAAO,QAAQ,KAAK,QAAQ;QACjC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;QAC1B,QAAQ,IAAI,CAAC;QACb,QAAQ,IAAI,GAAG;QACf,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,yBAAiB,CAAC;AACxB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AssetInfo, Balance } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
import type { VechainContext } from "../../config";
|
|
2
3
|
export declare const NATIVE_ASSET: AssetInfo;
|
|
3
4
|
export declare const vthoAsset: (address: string) => AssetInfo;
|
|
4
|
-
export declare function getBalance(address: string): Promise<Balance[]>;
|
|
5
|
+
export declare function getBalance(context: VechainContext, address: string): Promise<Balance[]>;
|
|
5
6
|
//# sourceMappingURL=getBalance.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAEpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,YAAY,EAAE,SAA2C,CAAC;AAIvE,eAAO,MAAM,SAAS,YAAa,MAAM,KAAG,SAK1C,CAAC;AAGH,wBAAsB,UAAU,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAQ7F"}
|
|
@@ -15,8 +15,9 @@ const vthoAsset = (address) => ({
|
|
|
15
15
|
});
|
|
16
16
|
exports.vthoAsset = vthoAsset;
|
|
17
17
|
// VET + VTHO balances from Thor's /accounts/{address} (both returned in one call); 0 if absent.
|
|
18
|
-
async function getBalance(address) {
|
|
19
|
-
const
|
|
18
|
+
async function getBalance(context, address) {
|
|
19
|
+
const config = await context.config();
|
|
20
|
+
const { balance, energy } = await (0, network_1.getAccount)(config, address);
|
|
20
21
|
return [
|
|
21
22
|
{ value: BigInt(balance || "0"), asset: exports.NATIVE_ASSET },
|
|
22
23
|
{ value: BigInt(energy || "0"), asset: (0, exports.vthoAsset)(address) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../../src/logic/account/getBalance.ts"],"names":[],"mappings":";;;;AACA,gDAAiD;
|
|
1
|
+
{"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../../src/logic/account/getBalance.ts"],"names":[],"mappings":";;;;AACA,gDAAiD;AAEjD,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,OAAuB,EAAE,OAAe;IACvE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,oBAAU,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE9D,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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { Block } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
-
|
|
2
|
+
import type { VechainContext } from "../../config";
|
|
3
|
+
export declare function getBlock(context: VechainContext, height: number): Promise<Block>;
|
|
3
4
|
//# sourceMappingURL=getBlock.d.ts.map
|
|
@@ -1 +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,
|
|
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;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAOnD,wBAAsB,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CActF"}
|
|
@@ -5,8 +5,9 @@ const network_1 = require("../../network");
|
|
|
5
5
|
const getBlockInfo_1 = require("./getBlockInfo");
|
|
6
6
|
// Full expanded block; block info is derived from it (no separate fetch). Only native VET transfers
|
|
7
7
|
// map to operations; VTHO (VIP-180) movements are ABI-encoded events, not decoded here.
|
|
8
|
-
async function getBlock(height) {
|
|
9
|
-
const
|
|
8
|
+
async function getBlock(context, height) {
|
|
9
|
+
const config = await context.config();
|
|
10
|
+
const block = await (0, network_1.getBlock)(config, height, true);
|
|
10
11
|
if (!block) {
|
|
11
12
|
throw new Error(`vechain: no block at height ${height}`);
|
|
12
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBlock.js","sourceRoot":"","sources":["../../../src/logic/history/getBlock.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"getBlock.js","sourceRoot":"","sources":["../../../src/logic/history/getBlock.ts"],"names":[],"mappings":";;;AAMA,2CAAgE;AAEhE,iDAA6C;AAE7C,oGAAoG;AACpG,wFAAwF;AACjF,KAAK,mBAAmB,OAAuB,EAAE,MAAc;IACpE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,IAAA,kBAAmB,EAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAE9D,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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { BlockInfo } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
import type { VechainContext } from "../../config";
|
|
2
3
|
import type { ApiResponseBlock } from "../../types";
|
|
3
4
|
export declare function toBlockInfo(block: ApiResponseBlock): BlockInfo;
|
|
4
5
|
/** 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
|
+
export declare function getBlockInfo(context: VechainContext, height: number): Promise<BlockInfo>;
|
|
6
7
|
//# sourceMappingURL=getBlockInfo.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,SAAS,CAO9D;AAED,kGAAkG;AAClG,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAS9F"}
|
|
@@ -13,8 +13,9 @@ function toBlockInfo(block) {
|
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
/** Block metadata (height/hash/time) at a given block height, via Thor `GET /blocks/{height}`. */
|
|
16
|
-
async function getBlockInfo(height) {
|
|
17
|
-
const
|
|
16
|
+
async function getBlockInfo(context, height) {
|
|
17
|
+
const config = await context.config();
|
|
18
|
+
const block = await (0, network_1.getBlock)(config, height, false);
|
|
18
19
|
if (!block) {
|
|
19
20
|
throw new Error(`vechain: no block at height ${height}`);
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBlockInfo.js","sourceRoot":"","sources":["../../../src/logic/history/getBlockInfo.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"getBlockInfo.js","sourceRoot":"","sources":["../../../src/logic/history/getBlockInfo.ts"],"names":[],"mappings":";;;;AAEA,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,OAAuB,EAAE,MAAc;IACxE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM,IAAA,kBAAmB,EAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE/D,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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { BlockInfo } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
-
|
|
2
|
+
import type { VechainContext } from "../../config";
|
|
3
|
+
export declare function lastBlock(context: VechainContext): Promise<BlockInfo>;
|
|
3
4
|
//# sourceMappingURL=lastBlock.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAKnD,wBAAsB,SAAS,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,CAI3E"}
|
|
@@ -4,8 +4,9 @@ exports.lastBlock = lastBlock;
|
|
|
4
4
|
const network_1 = require("../../network");
|
|
5
5
|
const getBlockInfo_1 = require("./getBlockInfo");
|
|
6
6
|
// Latest block; /blocks/best exposes only the height, so hash/time come from getBlockInfo.
|
|
7
|
-
async function lastBlock() {
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
async function lastBlock(context) {
|
|
8
|
+
const config = await context.config();
|
|
9
|
+
const height = await (0, network_1.getLastBlockHeight)(config);
|
|
10
|
+
return (0, getBlockInfo_1.getBlockInfo)(context, height);
|
|
10
11
|
}
|
|
11
12
|
//# sourceMappingURL=lastBlock.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lastBlock.js","sourceRoot":"","sources":["../../../src/logic/history/lastBlock.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"lastBlock.js","sourceRoot":"","sources":["../../../src/logic/history/lastBlock.ts"],"names":[],"mappings":";;;AAEA,2CAAmD;AACnD,iDAA8C;AAE9C,2FAA2F;AACpF,KAAK,oBAAoB,OAAuB;IACrD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,IAAA,4BAAkB,EAAC,MAAM,CAAC,CAAC;IAChD,OAAO,IAAA,2BAAY,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ListOperationsOptions, MemoNotSupported, Operation, Page } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
-
|
|
2
|
+
import type { VechainContext } from "../../config";
|
|
3
|
+
export declare function listOperations(context: VechainContext, address: string, options: ListOperationsOptions): Promise<Page<Operation<MemoNotSupported>>>;
|
|
3
4
|
//# sourceMappingURL=listOperations.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAGnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AA8BnD,wBAAsB,cAAc,CAClC,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,qBAAqB,GAC7B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAuB5C"}
|
|
@@ -28,15 +28,16 @@ function parseCursor(options) {
|
|
|
28
28
|
return Math.max(fromCursor, options.minHeight || 0);
|
|
29
29
|
}
|
|
30
30
|
// Merged VET + VTHO operations; `next` is one block past the current head for incremental resume.
|
|
31
|
-
async function listOperations(address, options) {
|
|
31
|
+
async function listOperations(context, address, options) {
|
|
32
|
+
const config = await context.config();
|
|
32
33
|
const startAt = parseCursor(options);
|
|
33
|
-
const stopAt = await (0, network_1.getLastBlockHeight)();
|
|
34
|
+
const stopAt = await (0, network_1.getLastBlockHeight)(config);
|
|
34
35
|
if (startAt > stopAt) {
|
|
35
36
|
return { items: [], next: String(startAt) };
|
|
36
37
|
}
|
|
37
38
|
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),
|
|
39
|
+
(0, network_1.getOperations)(config, address, address, startAt, stopAt),
|
|
40
|
+
(0, network_1.getTokenOperations)(config, address, address, sdk_core_1.VTHO_ADDRESS, startAt, stopAt),
|
|
40
41
|
]);
|
|
41
42
|
const items = [
|
|
42
43
|
...vetOps.map(op => toFrameworkOperation(op, getBalance_1.NATIVE_ASSET)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listOperations.js","sourceRoot":"","sources":["../../../src/logic/history/listOperations.ts"],"names":[],"mappings":";;;AAQA,gDAAiD;
|
|
1
|
+
{"version":3,"file":"listOperations.js","sourceRoot":"","sources":["../../../src/logic/history/listOperations.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { BroadcastConfig } from "@ledgerhq/coin-module-framework/api/types";
|
|
2
|
-
|
|
2
|
+
import type { VechainContext } from "../../config";
|
|
3
|
+
export declare function broadcast(context: VechainContext, tx: string, _broadcastConfig?: BroadcastConfig): Promise<string>;
|
|
3
4
|
//# sourceMappingURL=broadcast.d.ts.map
|
|
@@ -1 +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;
|
|
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;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAKnD,wBAAsB,SAAS,CAC7B,OAAO,EAAE,cAAc,EACvB,EAAE,EAAE,MAAM,EACV,gBAAgB,CAAC,EAAE,eAAe,GACjC,OAAO,CAAC,MAAM,CAAC,CAKjB"}
|
|
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.broadcast = broadcast;
|
|
4
4
|
const network_1 = require("../../network");
|
|
5
5
|
// Submit a signed tx (hex from combine) via Thor POST /transactions.
|
|
6
|
-
async function broadcast(tx, _broadcastConfig) {
|
|
6
|
+
async function broadcast(context, tx, _broadcastConfig) {
|
|
7
|
+
const config = await context.config();
|
|
7
8
|
const encoded = Uint8Array.from(Buffer.from(tx.replace(/^0x/, ""), "hex"));
|
|
8
|
-
return (0, network_1.submit)({ encoded });
|
|
9
|
+
return (0, network_1.submit)(config, { encoded });
|
|
9
10
|
}
|
|
10
11
|
//# sourceMappingURL=broadcast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../src/logic/transaction/broadcast.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../src/logic/transaction/broadcast.ts"],"names":[],"mappings":";;;AAEA,2CAAuC;AAGvC,qEAAqE;AAC9D,KAAK,oBACV,OAAuB,EACvB,EAAU,EACV,gBAAkC;IAElC,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;IACtC,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,MAAM,EAAE,EAAE,OAAO,EAA2B,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function combine(tx: string, signature: string): string;
|
|
1
|
+
export declare function combine(tx: string, signature: string[]): string;
|
|
2
2
|
//# sourceMappingURL=combine.d.ts.map
|
|
@@ -1 +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,
|
|
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,EAAE,GAAG,MAAM,CAS/D"}
|
|
@@ -4,8 +4,11 @@ exports.combine = combine;
|
|
|
4
4
|
const types_1 = require("../../types");
|
|
5
5
|
// Attach the signature to the crafted body and return the signed, hex-encoded tx for broadcast.
|
|
6
6
|
function combine(tx, signature) {
|
|
7
|
+
if (signature.length !== 1) {
|
|
8
|
+
throw new Error(`VeChain combine expects exactly one signature, got ${signature.length}`);
|
|
9
|
+
}
|
|
7
10
|
const body = JSON.parse(tx);
|
|
8
|
-
const signed = types_1.VechainSDKTransaction.of(body, Buffer.from(signature, "hex"));
|
|
11
|
+
const signed = types_1.VechainSDKTransaction.of(body, Buffer.from(signature[0], "hex"));
|
|
9
12
|
return `0x${Buffer.from(signed.encoded).toString("hex")}`;
|
|
10
13
|
}
|
|
11
14
|
//# sourceMappingURL=combine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../../../src/logic/transaction/combine.ts"],"names":[],"mappings":";;;AACA,uCAAoD;AAEpD,gGAAgG;AAChG,iBAAwB,EAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"combine.js","sourceRoot":"","sources":["../../../src/logic/transaction/combine.ts"],"names":[],"mappings":";;;AACA,uCAAoD;AAEpD,gGAAgG;AAChG,iBAAwB,EAAU,EAAE,SAAmB;IACrD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,sDAAsD,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED,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,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAEhF,OAAO,KAAK,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { CraftedTransaction, FeeEstimation, TransactionIntent } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
-
|
|
2
|
+
import { type VechainContext } from "../../config";
|
|
3
|
+
export declare function craftTransaction(context: VechainContext, intent: TransactionIntent, customFees?: FeeEstimation): Promise<CraftedTransaction>;
|
|
3
4
|
//# sourceMappingURL=craftTransaction.d.ts.map
|
|
@@ -1 +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;
|
|
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;AASnD,OAAO,EAAe,KAAK,cAAc,EAA8B,MAAM,cAAc,CAAC;AAmE5F,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,iBAAiB,EACzB,UAAU,CAAC,EAAE,aAAa,GACzB,OAAO,CAAC,kBAAkB,CAAC,CA0D7B"}
|
|
@@ -11,14 +11,14 @@ const EXPIRATION = 18;
|
|
|
11
11
|
function isTokenAsset(intent) {
|
|
12
12
|
return intent.asset.type !== "native";
|
|
13
13
|
}
|
|
14
|
-
async function resolveAmount(intent, isToken) {
|
|
14
|
+
async function resolveAmount(config, intent, isToken) {
|
|
15
15
|
if (!intent.useAllAmount) {
|
|
16
16
|
return new bignumber_js_1.BigNumber(intent.amount.toString());
|
|
17
17
|
}
|
|
18
|
-
const { balance, energy } = await (0, network_1.getAccount)(intent.sender);
|
|
18
|
+
const { balance, energy } = await (0, network_1.getAccount)(config, intent.sender);
|
|
19
19
|
return new bignumber_js_1.BigNumber((isToken ? energy : balance) || "0");
|
|
20
20
|
}
|
|
21
|
-
async function resolveGasFees(clauses, sender, customFees) {
|
|
21
|
+
async function resolveGasFees(config, clauses, sender, customFees) {
|
|
22
22
|
const custom = customFees?.parameters;
|
|
23
23
|
// Fast path: a full override covers every field, so skip the network round trip entirely.
|
|
24
24
|
if (custom?.gas !== undefined &&
|
|
@@ -30,8 +30,8 @@ async function resolveGasFees(clauses, sender, customFees) {
|
|
|
30
30
|
maxPriorityFeePerGas: Number(custom.maxPriorityFeePerGas),
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
const gasResult = await (0, estimateGas_1.estimateGas)(clauses, sender);
|
|
34
|
-
const thorClient = (0, getThorClient_1.getThorClient)();
|
|
33
|
+
const gasResult = await (0, estimateGas_1.estimateGas)(config, clauses, sender);
|
|
34
|
+
const thorClient = (0, getThorClient_1.getThorClient)(config);
|
|
35
35
|
const body = await thorClient.transactions.buildTransactionBody(clauses, gasResult.totalGas, {});
|
|
36
36
|
// Partial override: apply each provided field individually over the estimate, so e.g. a
|
|
37
37
|
// gas-only override is honoured instead of being discarded by an all-or-nothing check. Coerce
|
|
@@ -45,7 +45,7 @@ async function resolveGasFees(clauses, sender, customFees) {
|
|
|
45
45
|
}
|
|
46
46
|
// Craft an unsigned single-clause Thor tx (VET transfer, or VIP-180 transfer for VTHO). The returned
|
|
47
47
|
// transaction is the JSON VechainSDKTransactionBody that combine() parses back — keep them in sync.
|
|
48
|
-
async function craftTransaction(intent, customFees) {
|
|
48
|
+
async function craftTransaction(context, intent, customFees) {
|
|
49
49
|
if (!intent.recipient) {
|
|
50
50
|
throw new Error("vechain: recipient is required");
|
|
51
51
|
}
|
|
@@ -54,8 +54,9 @@ async function craftTransaction(intent, customFees) {
|
|
|
54
54
|
if (!(0, common_logic_1.parseAddress)(intent.sender)) {
|
|
55
55
|
throw new Error("vechain: invalid sender address");
|
|
56
56
|
}
|
|
57
|
+
const config = await context.config();
|
|
57
58
|
const isToken = isTokenAsset(intent);
|
|
58
|
-
let amount = await resolveAmount(intent, isToken);
|
|
59
|
+
let amount = await resolveAmount(config, intent, isToken);
|
|
59
60
|
if (amount.lte(0)) {
|
|
60
61
|
throw new Error("vechain: transaction amount must be positive");
|
|
61
62
|
}
|
|
@@ -63,8 +64,8 @@ async function craftTransaction(intent, customFees) {
|
|
|
63
64
|
? await (0, common_logic_1.calculateClausesVtho)(intent.recipient, amount)
|
|
64
65
|
: await (0, common_logic_1.calculateClausesVet)(intent.recipient, amount);
|
|
65
66
|
const [{ gas, maxFeePerGas, maxPriorityFeePerGas }, blockRef] = await Promise.all([
|
|
66
|
-
resolveGasFees(clauses, intent.sender, customFees),
|
|
67
|
-
(0, network_1.getBlockRef)(),
|
|
67
|
+
resolveGasFees(config, clauses, intent.sender, customFees),
|
|
68
|
+
(0, network_1.getBlockRef)(config),
|
|
68
69
|
]);
|
|
69
70
|
const fee = new bignumber_js_1.BigNumber(maxFeePerGas).times(gas);
|
|
70
71
|
if (intent.useAllAmount && isToken) {
|
|
@@ -75,7 +76,7 @@ async function craftTransaction(intent, customFees) {
|
|
|
75
76
|
clauses = await (0, common_logic_1.calculateClausesVtho)(intent.recipient, amount);
|
|
76
77
|
}
|
|
77
78
|
const body = {
|
|
78
|
-
chainTag: (0, config_1.getChainTag)(),
|
|
79
|
+
chainTag: (0, config_1.getChainTag)(config),
|
|
79
80
|
blockRef,
|
|
80
81
|
expiration: EXPIRATION,
|
|
81
82
|
clauses,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"craftTransaction.js","sourceRoot":"","sources":["../../../src/logic/transaction/craftTransaction.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AAMzC,qDAK4B;AAC5B,gEAA6D;AAC7D,oEAAiE;AACjE,
|
|
1
|
+
{"version":3,"file":"craftTransaction.js","sourceRoot":"","sources":["../../../src/logic/transaction/craftTransaction.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { FeeEstimation, TransactionIntent } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
-
|
|
2
|
+
import type { VechainContext } from "../../config";
|
|
3
|
+
export declare function estimateFees(context: VechainContext, intent: TransactionIntent, customFeesParameters?: FeeEstimation["parameters"]): Promise<FeeEstimation>;
|
|
3
4
|
//# sourceMappingURL=estimateFees.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../../src/logic/transaction/estimateFees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../../src/logic/transaction/estimateFees.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAC;AAElG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAInD,wBAAsB,YAAY,CAChC,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,iBAAiB,EACzB,oBAAoB,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,GACjD,OAAO,CAAC,aAAa,CAAC,CAwBxB"}
|
|
@@ -4,12 +4,12 @@ exports.estimateFees = estimateFees;
|
|
|
4
4
|
const common_logic_1 = require("../../common-logic");
|
|
5
5
|
const craftTransaction_1 = require("./craftTransaction");
|
|
6
6
|
// Estimate VTHO gas by crafting the unsigned tx and reading back its settled fee/gas parameters.
|
|
7
|
-
async function estimateFees(intent, customFeesParameters) {
|
|
7
|
+
async function estimateFees(context, intent, customFeesParameters) {
|
|
8
8
|
if (!intent.recipient || !(0, common_logic_1.parseAddress)(intent.recipient)) {
|
|
9
9
|
return { value: 0n, parameters: {} };
|
|
10
10
|
}
|
|
11
11
|
const estimationIntent = !intent.useAllAmount && intent.amount <= 0n ? { ...intent, amount: 1n } : intent;
|
|
12
|
-
const { details } = await (0, craftTransaction_1.craftTransaction)(estimationIntent, customFeesParameters ? { value: 0n, parameters: customFeesParameters } : undefined);
|
|
12
|
+
const { details } = await (0, craftTransaction_1.craftTransaction)(context, estimationIntent, customFeesParameters ? { value: 0n, parameters: customFeesParameters } : undefined);
|
|
13
13
|
const fee = typeof details?.fee === "string" ? details.fee : "0";
|
|
14
14
|
return {
|
|
15
15
|
value: BigInt(fee),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateFees.js","sourceRoot":"","sources":["../../../src/logic/transaction/estimateFees.ts"],"names":[],"mappings":";;;AACA,qDAAkD;
|
|
1
|
+
{"version":3,"file":"estimateFees.js","sourceRoot":"","sources":["../../../src/logic/transaction/estimateFees.ts"],"names":[],"mappings":";;;AACA,qDAAkD;AAElD,yDAAsD;AAEtD,iGAAiG;AAC1F,KAAK,uBACV,OAAuB,EACvB,MAAyB,EACzB,oBAAkD;IAElD,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,IAAA,2BAAY,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;QACzD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACvC,CAAC;IAED,MAAM,gBAAgB,GACpB,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;IAEnF,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,mCAAgB,EACxC,OAAO,EACP,gBAAgB,EAChB,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC,CAAC,CAAC,SAAS,CACnF,CAAC;IAEF,MAAM,GAAG,GAAG,OAAO,OAAO,EAAE,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAEjE,OAAO;QACL,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC;QAClB,UAAU,EAAE;YACV,GAAG,EAAE,OAAO,EAAE,GAAG;YACjB,YAAY,EAAE,OAAO,EAAE,YAAY;YACnC,oBAAoB,EAAE,OAAO,EAAE,oBAAoB;SACpD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type VechainCurrencyConfig } from "../config";
|
|
1
2
|
import type { ApiResponseBlock } from "../types";
|
|
2
|
-
export declare const getBlock: (revision: number, expanded?: boolean) => Promise<ApiResponseBlock | null>;
|
|
3
|
+
export declare const getBlock: (config: VechainCurrencyConfig, revision: number, expanded?: boolean) => Promise<ApiResponseBlock | null>;
|
|
3
4
|
//# sourceMappingURL=getBlock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBlock.d.ts","sourceRoot":"","sources":["../../src/network/getBlock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getBlock.d.ts","sourceRoot":"","sources":["../../src/network/getBlock.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAIjD,eAAO,MAAM,QAAQ,WACX,qBAAqB,YACnB,MAAM,yBAEf,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAajC,CAAC"}
|
package/lib/network/getBlock.js
CHANGED
|
@@ -8,14 +8,14 @@ const live_network_1 = __importDefault(require("@ledgerhq/live-network"));
|
|
|
8
8
|
const config_1 = require("../config");
|
|
9
9
|
// Thor GET /blocks/{revision}. `expanded` returns full clause/output detail (getBlock) vs. tx
|
|
10
10
|
// hashes only (getBlockInfo/lastBlock).
|
|
11
|
-
const getBlock = async (revision, expanded = false) => {
|
|
11
|
+
const getBlock = async (config, revision, expanded = false) => {
|
|
12
12
|
if (!Number.isInteger(revision) || revision < 0) {
|
|
13
13
|
throw new Error(`vechain: getBlock: invalid revision ${revision}`);
|
|
14
14
|
}
|
|
15
15
|
const query = new URLSearchParams({ expanded: String(expanded) });
|
|
16
16
|
const { data } = await (0, live_network_1.default)({
|
|
17
17
|
method: "GET",
|
|
18
|
-
url: `${(0, config_1.getNodeUrl)()}/blocks/${revision}?${query}`,
|
|
18
|
+
url: `${(0, config_1.getNodeUrl)(config)}/blocks/${revision}?${query}`,
|
|
19
19
|
});
|
|
20
20
|
return data;
|
|
21
21
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBlock.js","sourceRoot":"","sources":["../../src/network/getBlock.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"getBlock.js","sourceRoot":"","sources":["../../src/network/getBlock.ts"],"names":[],"mappings":";;;;;;AAAA,0EAA6C;AAC7C,sCAAmE;AAGnE,8FAA8F;AAC9F,wCAAwC;AACjC,MAAM,QAAQ,GAAG,KAAK,EAC3B,MAA6B,EAC7B,QAAgB,EAChB,QAAQ,GAAG,KAAK,EACkB,EAAE;IACpC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,uCAAuC,QAAQ,EAAE,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAElE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,sBAAO,EAA0B;QACtD,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,GAAG,IAAA,mBAAU,EAAC,MAAM,CAAC,WAAW,QAAQ,IAAI,KAAK,EAAE;KACzD,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAjBW,QAAA,QAAQ,GAAR,QAAQ,CAiBnB"}
|
package/lib/network/getFees.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
|
+
import { type VechainCurrencyConfig } from "../config";
|
|
2
3
|
/**
|
|
3
4
|
* Get fees paid for the transaction
|
|
4
5
|
* @param transactionId - the id of the transaction
|
|
5
6
|
* @return the fee paid in VTHO or 0
|
|
6
7
|
*/
|
|
7
|
-
export declare const getFees: (transactionId: string) => Promise<BigNumber>;
|
|
8
|
+
export declare const getFees: (config: VechainCurrencyConfig, transactionId: string) => Promise<BigNumber>;
|
|
8
9
|
//# sourceMappingURL=getFees.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFees.d.ts","sourceRoot":"","sources":["../../src/network/getFees.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"getFees.d.ts","sourceRoot":"","sources":["../../src/network/getFees.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEnE;;;;GAIG;AACH,eAAO,MAAM,OAAO,WACV,qBAAqB,iBACd,MAAM,KACpB,OAAO,CAAC,SAAS,CASnB,CAAC"}
|
package/lib/network/getFees.js
CHANGED
|
@@ -12,10 +12,10 @@ const config_1 = require("../config");
|
|
|
12
12
|
* @param transactionId - the id of the transaction
|
|
13
13
|
* @return the fee paid in VTHO or 0
|
|
14
14
|
*/
|
|
15
|
-
const getFees = async (transactionId) => {
|
|
15
|
+
const getFees = async (config, transactionId) => {
|
|
16
16
|
const { data } = await (0, live_network_1.default)({
|
|
17
17
|
method: "GET",
|
|
18
|
-
url: `${(0, config_1.getNodeUrl)()}/transactions/${transactionId}/receipt`,
|
|
18
|
+
url: `${(0, config_1.getNodeUrl)(config)}/transactions/${transactionId}/receipt`,
|
|
19
19
|
params: { id: transactionId },
|
|
20
20
|
});
|
|
21
21
|
if (!data || !data.paid)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFees.js","sourceRoot":"","sources":["../../src/network/getFees.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,0EAA6C;AAC7C,
|
|
1
|
+
{"version":3,"file":"getFees.js","sourceRoot":"","sources":["../../src/network/getFees.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,0EAA6C;AAC7C,sCAAmE;AAEnE;;;;GAIG;AACI,MAAM,OAAO,GAAG,KAAK,EAC1B,MAA6B,EAC7B,aAAqB,EACD,EAAE;IACtB,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,sBAAO,EAAmB;QAC/C,MAAM,EAAE,KAAK;QACb,GAAG,EAAE,GAAG,IAAA,mBAAU,EAAC,MAAM,CAAC,iBAAiB,aAAa,UAAU;QAClE,MAAM,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE;KAC9B,CAAC,CAAC;IAEH,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;IACjD,OAAO,IAAI,sBAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAClC,CAAC,CAAC;AAZW,QAAA,OAAO,GAAP,OAAO,CAYlB"}
|
package/lib/network/sdk.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { AccountResponse, VechainSDKTransaction } from "../types";
|
|
2
2
|
import type { Operation } from "@ledgerhq/types-live";
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
3
|
+
import { type VechainCurrencyConfig } from "../config";
|
|
4
|
+
export declare const getAccount: (config: VechainCurrencyConfig, address: string) => Promise<AccountResponse>;
|
|
5
|
+
export declare const getLastBlockHeight: (config: VechainCurrencyConfig) => Promise<number>;
|
|
5
6
|
/**
|
|
6
7
|
* Get VET operations
|
|
7
8
|
*
|
|
@@ -12,7 +13,7 @@ export declare const getLastBlockHeight: () => Promise<number>;
|
|
|
12
13
|
* @param fetchRangeOfLogs
|
|
13
14
|
* @returns an array of operations
|
|
14
15
|
*/
|
|
15
|
-
export declare const getOperations: (accountId: string, addr: string, startAt: number, stopAt: number) => Promise<Operation[]>;
|
|
16
|
+
export declare const getOperations: (config: VechainCurrencyConfig, accountId: string, addr: string, startAt: number, stopAt: number) => Promise<Operation[]>;
|
|
16
17
|
/**
|
|
17
18
|
* Get operations for a fungible token
|
|
18
19
|
*
|
|
@@ -23,16 +24,16 @@ export declare const getOperations: (accountId: string, addr: string, startAt: n
|
|
|
23
24
|
* @param stopAt
|
|
24
25
|
* @returns an array of operations
|
|
25
26
|
*/
|
|
26
|
-
export declare const getTokenOperations: (accountId: string, addr: string, tokenAddr: string, startAt: number, stopAt: number) => Promise<Operation[]>;
|
|
27
|
+
export declare const getTokenOperations: (config: VechainCurrencyConfig, accountId: string, addr: string, tokenAddr: string, startAt: number, stopAt: number) => Promise<Operation[]>;
|
|
27
28
|
/**
|
|
28
29
|
* Submit a transaction and return the ID
|
|
29
30
|
* @param transaction - The transaction to submit
|
|
30
31
|
* @returns transaction ID
|
|
31
32
|
*/
|
|
32
|
-
export declare const submit: (transaction: VechainSDKTransaction) => Promise<string>;
|
|
33
|
+
export declare const submit: (config: VechainCurrencyConfig, transaction: VechainSDKTransaction) => Promise<string>;
|
|
33
34
|
/**
|
|
34
35
|
* Get the block ref to use in a transaction
|
|
35
36
|
* @returns the block ref of head
|
|
36
37
|
*/
|
|
37
|
-
export declare const getBlockRef: () => Promise<string>;
|
|
38
|
+
export declare const getBlockRef: (config: VechainCurrencyConfig) => Promise<string>;
|
|
38
39
|
//# sourceMappingURL=sdk.d.ts.map
|
package/lib/network/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/network/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAKf,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/network/sdk.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EAKf,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMtD,OAAO,EAAc,KAAK,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAOnE,eAAO,MAAM,UAAU,WACb,qBAAqB,WACpB,MAAM,KACd,OAAO,CAAC,eAAe,CAOzB,CAAC;AAEF,eAAO,MAAM,kBAAkB,WAAkB,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAOtF,CAAC;AAwKF;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,WAChB,qBAAqB,aAClB,MAAM,QACX,MAAM,WACH,MAAM,UACP,MAAM,KACb,OAAO,CAAC,SAAS,EAAE,CAIrB,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,WACrB,qBAAqB,aAClB,MAAM,QACX,MAAM,aACD,MAAM,WACR,MAAM,UACP,MAAM,KACb,OAAO,CAAC,SAAS,EAAE,CAIrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,MAAM,WACT,qBAAqB,eAChB,qBAAqB,KACjC,OAAO,CAAC,MAAM,CAehB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,WAAkB,qBAAqB,KAAG,OAAO,CAAC,MAAM,CAO/E,CAAC"}
|