@ledgerhq/coin-multiversx 1.0.1 → 1.0.2-nightly.20260901020738
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/CHANGELOG.md +17 -0
- package/jest.config.js +5 -1
- package/lib/api/index.d.ts +31 -3
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +0 -18
- package/lib/api/index.js.map +1 -1
- package/lib-es/api/index.d.ts +31 -3
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +0 -18
- package/lib-es/api/index.js.map +1 -1
- package/package.json +10 -9
- package/src/api/index.ts +3 -34
- package/src/api/index.unit.test.ts +19 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ledgerhq/coin-elrond
|
|
2
2
|
|
|
3
|
+
## 1.0.2-nightly.20260901020738
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#21168](https://github.com/LedgerHQ/ledger-live/pull/21168) [`a29f6a0`](https://github.com/LedgerHQ/ledger-live/commit/a29f6a098921d6216596d4c6a0329f39153e3cfa) Thanks [@cted-ledger](https://github.com/cted-ledger)! - Adopt the coin-module authoring type, dropping the hand-written "not supported" stubs.
|
|
8
|
+
|
|
9
|
+
`createApi` now returns an object checked against `CoinModuleImpl` with `satisfies` — which keeps the precise shape, so a caller sees exactly which methods exist — declaring the thirteen the module implements. The six capabilities MultiversX has none of, `call`, `register`, `craftRawTransaction`, `getBlock`, `getBlockInfo` and `getRewards`, are omitted instead of each carrying a `throw new Error("… is not supported")`.
|
|
10
|
+
|
|
11
|
+
Staking is a good illustration of why capabilities are per-method rather than a group: the module keeps `getStakes` and `getValidators`, which it implements against the delegation API, and omits only `getRewards`.
|
|
12
|
+
|
|
13
|
+
Consumers see no change. They reach the module through a resolver that applies the framework's `withDefaults`, which supplies every omitted capability, so the same call still raises the same `"<method> is not supported"` error — and `supports(method)` now distinguishes the two halves, reporting `getStakes` and `getValidators` as real and `getRewards` as unavailable.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`27388a8`](https://github.com/LedgerHQ/ledger-live/commit/27388a894eaac67b8e162a60f6d3368aad0a8682), [`e21305a`](https://github.com/LedgerHQ/ledger-live/commit/e21305abce18f0a9408bf6c0e2bb47d5c992e06a)]:
|
|
16
|
+
- @ledgerhq/types-live@6.122.0-nightly.20260901020738
|
|
17
|
+
- @ledgerhq/ledger-wallet-framework@3.2.0-nightly.20260901020738
|
|
18
|
+
- @ledgerhq/live-env@3.2.0-nightly.20260901020738
|
|
19
|
+
|
|
3
20
|
## 1.0.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/jest.config.js
CHANGED
|
@@ -27,10 +27,14 @@ module.exports = {
|
|
|
27
27
|
"default",
|
|
28
28
|
...(process.env.CI ? ["github-actions"] : []),
|
|
29
29
|
["jest-sonar", { outputName: "sonar-executionTests-report.xml", reportedFilePath: "absolute" }],
|
|
30
|
+
"@ledgerhq/test-quarantine/jest",
|
|
30
31
|
],
|
|
31
32
|
// @ledgerhq/disable-network-setup (nock) is intentionally not enabled — like coin-tezos,
|
|
32
33
|
// because nock@14 + msw/node conflict for axios-based clients (@ledgerhq/live-network).
|
|
33
34
|
// Network guard: unit tests mock the client; msw tests use onUnhandledRequest: "error".
|
|
34
35
|
// setupFilesAfterEnv: ["@ledgerhq/disable-network-setup"],
|
|
35
|
-
setupFilesAfterEnv: [
|
|
36
|
+
setupFilesAfterEnv: [
|
|
37
|
+
"@ledgerhq/wallet-framework-test-setup",
|
|
38
|
+
"@ledgerhq/test-quarantine/jest-retries",
|
|
39
|
+
],
|
|
36
40
|
};
|
package/lib/api/index.d.ts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type
|
|
3
|
-
export declare function createApi():
|
|
1
|
+
import type { AddressValidationCurrencyParameters, Balance, BalanceOptions, BroadcastConfig, CraftedTransaction, Cursor, FeeEstimation, ListOperationsOptions, Operation, Page, Stake, StakingTransactionIntent, TransactionIntent, TransactionValidation, Validator } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
import { type MultiversXContext } from "../config";
|
|
3
|
+
export declare function createApi(): {
|
|
4
|
+
broadcast: (context: MultiversXContext, tx: string, _options?: {
|
|
5
|
+
broadcastConfig?: BroadcastConfig;
|
|
6
|
+
}) => Promise<string>;
|
|
7
|
+
combine: (_context: MultiversXContext, tx: string, signature: string[], options?: {
|
|
8
|
+
pubkey?: string;
|
|
9
|
+
}) => string;
|
|
10
|
+
craftTransaction: (context: MultiversXContext, intent: TransactionIntent | StakingTransactionIntent, options?: {
|
|
11
|
+
customFees?: FeeEstimation;
|
|
12
|
+
}) => Promise<CraftedTransaction>;
|
|
13
|
+
estimateFees: (_context: MultiversXContext, intent: TransactionIntent, options?: {
|
|
14
|
+
customFeesParameters?: FeeEstimation["parameters"];
|
|
15
|
+
}) => Promise<FeeEstimation>;
|
|
16
|
+
getBalance: (context: MultiversXContext, address: string, options?: BalanceOptions) => Promise<Balance[]>;
|
|
17
|
+
lastBlock: (context: MultiversXContext) => Promise<import("@ledgerhq/coin-module-framework/lib/api/types").BlockInfo>;
|
|
18
|
+
listOperations: (context: MultiversXContext, address: string, options: ListOperationsOptions) => Promise<Page<Operation>>;
|
|
19
|
+
getValidators: (context: MultiversXContext, options?: {
|
|
20
|
+
cursor?: Cursor;
|
|
21
|
+
}) => Promise<Page<Validator>>;
|
|
22
|
+
getStakes: (context: MultiversXContext, address: string, options?: {
|
|
23
|
+
cursor?: Cursor;
|
|
24
|
+
}) => Promise<Page<Stake>>;
|
|
25
|
+
validateIntent: (_context: MultiversXContext, intent: TransactionIntent | StakingTransactionIntent, balances: Balance[], options?: {
|
|
26
|
+
customFees?: FeeEstimation;
|
|
27
|
+
}) => Promise<TransactionValidation>;
|
|
28
|
+
getNextSequence: (context: MultiversXContext, address: string) => Promise<bigint>;
|
|
29
|
+
validateAddress: (_context: MultiversXContext, address: string, parameters: Partial<AddressValidationCurrencyParameters>) => Promise<boolean>;
|
|
30
|
+
craftTransactionData: (_context: MultiversXContext, intent: TransactionIntent) => import("@ledgerhq/coin-module-framework/lib/api/types").TxDataNotSupported;
|
|
31
|
+
};
|
|
4
32
|
//# 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":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mCAAmC,EACnC,OAAO,EACP,cAAc,EACd,eAAe,EAEf,kBAAkB,EAClB,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACV,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAe9E,wBAAgB,SAAS;yBAUV,iBAAiB,MACtB,MAAM,aACC;QAAE,eAAe,CAAC,EAAE,eAAe,CAAA;KAAE,KAC/C,OAAO,CAAC,MAAM,CAAC;wBAKN,iBAAiB,MACvB,MAAM,aACC,MAAM,EAAE,YACT;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAC5B,MAAM;gCAIE,iBAAiB,UAClB,iBAAiB,GAAG,wBAAwB,YAC1C;QAAE,UAAU,CAAC,EAAE,aAAa,CAAA;KAAE,KACvC,OAAO,CAAC,kBAAkB,CAAC;6BAKlB,iBAAiB,UACnB,iBAAiB,YACf;QAAE,oBAAoB,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;KAAE,KAC/D,OAAO,CAAC,aAAa,CAAC;0BAId,iBAAiB,WACjB,MAAM,YACL,cAAc,KACvB,OAAO,CAAC,OAAO,EAAE,CAAC;yBAIM,iBAAiB;8BAIjC,iBAAiB,WACjB,MAAM,WACN,qBAAqB,KAC7B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;6BAKhB,iBAAiB,YAChB;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAC5B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;yBAKhB,iBAAiB,WACjB,MAAM,YACL;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAC5B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;+BAKX,iBAAiB,UACnB,iBAAiB,GAAG,wBAAwB,YAC1C,OAAO,EAAE,YACT;QAAE,UAAU,CAAC,EAAE,aAAa,CAAA;KAAE,KACvC,OAAO,CAAC,qBAAqB,CAAC;+BAGA,iBAAiB,WAAW,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC;gCAKzE,iBAAiB,WAClB,MAAM,cACH,OAAO,CAAC,mCAAmC,CAAC,KACvD,OAAO,CAAC,OAAO,CAAC;qCAGc,iBAAiB,UAAU,iBAAiB;EAGhF"}
|
package/lib/api/index.js
CHANGED
|
@@ -28,12 +28,6 @@ function createApi() {
|
|
|
28
28
|
const api = await resolveApi(context);
|
|
29
29
|
return (0, broadcast_1.broadcast)(api, tx);
|
|
30
30
|
},
|
|
31
|
-
async call(_context) {
|
|
32
|
-
throw new Error("call is not supported");
|
|
33
|
-
},
|
|
34
|
-
async register() {
|
|
35
|
-
throw new Error("register is not supported");
|
|
36
|
-
},
|
|
37
31
|
combine: (_context, tx, signature, options) => {
|
|
38
32
|
return (0, combine_1.combine)(tx, signature, options?.pubkey);
|
|
39
33
|
},
|
|
@@ -41,9 +35,6 @@ function createApi() {
|
|
|
41
35
|
const api = await resolveApi(context);
|
|
42
36
|
return (0, craftTransaction_1.craftTransaction)(api, intent, options?.customFees);
|
|
43
37
|
},
|
|
44
|
-
craftRawTransaction: (_context, _tx, _sender, _publicKey, _sequence) => {
|
|
45
|
-
throw new Error("craftRawTransaction is not supported");
|
|
46
|
-
},
|
|
47
38
|
estimateFees: (_context, intent, options) => {
|
|
48
39
|
return (0, estimateFees_1.estimateFees)(intent, options?.customFeesParameters);
|
|
49
40
|
},
|
|
@@ -58,15 +49,6 @@ function createApi() {
|
|
|
58
49
|
const api = await resolveApi(context);
|
|
59
50
|
return (0, listOperations_1.listOperations)(api, address, options);
|
|
60
51
|
},
|
|
61
|
-
getBlock(_context, _height) {
|
|
62
|
-
throw new Error("getBlock is not supported");
|
|
63
|
-
},
|
|
64
|
-
getBlockInfo(_context, _height) {
|
|
65
|
-
throw new Error("getBlockInfo is not supported");
|
|
66
|
-
},
|
|
67
|
-
getRewards: (_context, _address, _options) => {
|
|
68
|
-
throw new Error("getRewards is not supported");
|
|
69
|
-
},
|
|
70
52
|
getValidators: async (context, options) => {
|
|
71
53
|
const api = await resolveApi(context);
|
|
72
54
|
return (0, getValidators_1.getValidators)(api, options?.cursor);
|
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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAAA,8GAA2G;AAmB3G,qGAAkG;AAElG,wCAAkD;AAClD,8DAA2D;AAC3D,0DAAuD;AACvD,4EAAyE;AACzE,oEAAiE;AACjE,4DAAyD;AACzD,sEAAmE;AACnE,0DAAuD;AACvD,kEAA+D;AAC/D,0DAAuD;AACvD,oEAAiE;AACjE,8DAA2D;AAC3D,4DAAyD;AAEzD;IACE,8FAA8F;IAC9F,sFAAsF;IACtF,MAAM,UAAU,GAAG,KAAK,EAAE,OAA0B,EAAE,EAAE;QACtD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC;QACtC,OAAO,IAAA,sBAAgB,EAAC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CAAC,QAA2B,EAAE,MAAyB,EAAE,EAAE,CAC/E,IAAA,2CAAoB,EAAC,MAAM,CAAC;KACgB,CAAC;AACnD,CAAC"}
|
package/lib-es/api/index.d.ts
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type
|
|
3
|
-
export declare function createApi():
|
|
1
|
+
import type { AddressValidationCurrencyParameters, Balance, BalanceOptions, BroadcastConfig, CraftedTransaction, Cursor, FeeEstimation, ListOperationsOptions, Operation, Page, Stake, StakingTransactionIntent, TransactionIntent, TransactionValidation, Validator } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
+
import { type MultiversXContext } from "../config";
|
|
3
|
+
export declare function createApi(): {
|
|
4
|
+
broadcast: (context: MultiversXContext, tx: string, _options?: {
|
|
5
|
+
broadcastConfig?: BroadcastConfig;
|
|
6
|
+
}) => Promise<string>;
|
|
7
|
+
combine: (_context: MultiversXContext, tx: string, signature: string[], options?: {
|
|
8
|
+
pubkey?: string;
|
|
9
|
+
}) => string;
|
|
10
|
+
craftTransaction: (context: MultiversXContext, intent: TransactionIntent | StakingTransactionIntent, options?: {
|
|
11
|
+
customFees?: FeeEstimation;
|
|
12
|
+
}) => Promise<CraftedTransaction>;
|
|
13
|
+
estimateFees: (_context: MultiversXContext, intent: TransactionIntent, options?: {
|
|
14
|
+
customFeesParameters?: FeeEstimation["parameters"];
|
|
15
|
+
}) => Promise<FeeEstimation>;
|
|
16
|
+
getBalance: (context: MultiversXContext, address: string, options?: BalanceOptions) => Promise<Balance[]>;
|
|
17
|
+
lastBlock: (context: MultiversXContext) => Promise<import("@ledgerhq/coin-module-framework/lib-es/api/types").BlockInfo>;
|
|
18
|
+
listOperations: (context: MultiversXContext, address: string, options: ListOperationsOptions) => Promise<Page<Operation>>;
|
|
19
|
+
getValidators: (context: MultiversXContext, options?: {
|
|
20
|
+
cursor?: Cursor;
|
|
21
|
+
}) => Promise<Page<Validator>>;
|
|
22
|
+
getStakes: (context: MultiversXContext, address: string, options?: {
|
|
23
|
+
cursor?: Cursor;
|
|
24
|
+
}) => Promise<Page<Stake>>;
|
|
25
|
+
validateIntent: (_context: MultiversXContext, intent: TransactionIntent | StakingTransactionIntent, balances: Balance[], options?: {
|
|
26
|
+
customFees?: FeeEstimation;
|
|
27
|
+
}) => Promise<TransactionValidation>;
|
|
28
|
+
getNextSequence: (context: MultiversXContext, address: string) => Promise<bigint>;
|
|
29
|
+
validateAddress: (_context: MultiversXContext, address: string, parameters: Partial<AddressValidationCurrencyParameters>) => Promise<boolean>;
|
|
30
|
+
craftTransactionData: (_context: MultiversXContext, intent: TransactionIntent) => import("@ledgerhq/coin-module-framework/lib-es/api/types").TxDataNotSupported;
|
|
31
|
+
};
|
|
4
32
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,mCAAmC,EACnC,OAAO,EACP,cAAc,EACd,eAAe,EAEf,kBAAkB,EAClB,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,SAAS,EACT,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,SAAS,EACV,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAA6B,KAAK,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAe9E,wBAAgB,SAAS;yBAUV,iBAAiB,MACtB,MAAM,aACC;QAAE,eAAe,CAAC,EAAE,eAAe,CAAA;KAAE,KAC/C,OAAO,CAAC,MAAM,CAAC;wBAKN,iBAAiB,MACvB,MAAM,aACC,MAAM,EAAE,YACT;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAC5B,MAAM;gCAIE,iBAAiB,UAClB,iBAAiB,GAAG,wBAAwB,YAC1C;QAAE,UAAU,CAAC,EAAE,aAAa,CAAA;KAAE,KACvC,OAAO,CAAC,kBAAkB,CAAC;6BAKlB,iBAAiB,UACnB,iBAAiB,YACf;QAAE,oBAAoB,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;KAAE,KAC/D,OAAO,CAAC,aAAa,CAAC;0BAId,iBAAiB,WACjB,MAAM,YACL,cAAc,KACvB,OAAO,CAAC,OAAO,EAAE,CAAC;yBAIM,iBAAiB;8BAIjC,iBAAiB,WACjB,MAAM,WACN,qBAAqB,KAC7B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;6BAKhB,iBAAiB,YAChB;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAC5B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;yBAKhB,iBAAiB,WACjB,MAAM,YACL;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAC5B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;+BAKX,iBAAiB,UACnB,iBAAiB,GAAG,wBAAwB,YAC1C,OAAO,EAAE,YACT;QAAE,UAAU,CAAC,EAAE,aAAa,CAAA;KAAE,KACvC,OAAO,CAAC,qBAAqB,CAAC;+BAGA,iBAAiB,WAAW,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC;gCAKzE,iBAAiB,WAClB,MAAM,cACH,OAAO,CAAC,mCAAmC,CAAC,KACvD,OAAO,CAAC,OAAO,CAAC;qCAGc,iBAAiB,UAAU,iBAAiB;EAGhF"}
|
package/lib-es/api/index.js
CHANGED
|
@@ -25,12 +25,6 @@ export function createApi() {
|
|
|
25
25
|
const api = await resolveApi(context);
|
|
26
26
|
return broadcast(api, tx);
|
|
27
27
|
},
|
|
28
|
-
async call(_context) {
|
|
29
|
-
throw new Error("call is not supported");
|
|
30
|
-
},
|
|
31
|
-
async register() {
|
|
32
|
-
throw new Error("register is not supported");
|
|
33
|
-
},
|
|
34
28
|
combine: (_context, tx, signature, options) => {
|
|
35
29
|
return combine(tx, signature, options?.pubkey);
|
|
36
30
|
},
|
|
@@ -38,9 +32,6 @@ export function createApi() {
|
|
|
38
32
|
const api = await resolveApi(context);
|
|
39
33
|
return craftTransaction(api, intent, options?.customFees);
|
|
40
34
|
},
|
|
41
|
-
craftRawTransaction: (_context, _tx, _sender, _publicKey, _sequence) => {
|
|
42
|
-
throw new Error("craftRawTransaction is not supported");
|
|
43
|
-
},
|
|
44
35
|
estimateFees: (_context, intent, options) => {
|
|
45
36
|
return estimateFees(intent, options?.customFeesParameters);
|
|
46
37
|
},
|
|
@@ -55,15 +46,6 @@ export function createApi() {
|
|
|
55
46
|
const api = await resolveApi(context);
|
|
56
47
|
return listOperations(api, address, options);
|
|
57
48
|
},
|
|
58
|
-
getBlock(_context, _height) {
|
|
59
|
-
throw new Error("getBlock is not supported");
|
|
60
|
-
},
|
|
61
|
-
getBlockInfo(_context, _height) {
|
|
62
|
-
throw new Error("getBlockInfo is not supported");
|
|
63
|
-
},
|
|
64
|
-
getRewards: (_context, _address, _options) => {
|
|
65
|
-
throw new Error("getRewards is not supported");
|
|
66
|
-
},
|
|
67
49
|
getValidators: async (context, options) => {
|
|
68
50
|
const api = await resolveApi(context);
|
|
69
51
|
return getValidators(api, options?.cursor);
|
package/lib-es/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;AAmB3G,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAElG,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO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AA0B,EAC1B,OAAe,EACf,OAA6B,EACP,EAAE;YACxB,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;YACtC,OAAO,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAClD,CAAC;QACD,cAAc,EAAE,CACd,QAA2B,EAC3B,MAAoD,EACpD,QAAmB,EACnB,OAAwC,EACR,EAAE;YAClC,OAAO,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;QAC/D,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,OAA0B,EAAE,OAAe,EAAmB,EAAE;YACtF,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;YACtC,OAAO,eAAe,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;QACD,eAAe,EAAE,CACf,QAA2B,EAC3B,OAAe,EACf,UAAwD,EACtC,EAAE;YACpB,OAAO,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC9C,CAAC;QACD,oBAAoB,EAAE,CAAC,QAA2B,EAAE,MAAyB,EAAE,EAAE,CAC/E,oBAAoB,CAAC,MAAM,CAAC;KACgB,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-multiversx",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2-nightly.20260901020738",
|
|
4
4
|
"description": "Ledger MultiversX Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -49,22 +49,22 @@
|
|
|
49
49
|
},
|
|
50
50
|
"license": "Apache-2.0",
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@ledgerhq/coin-module-framework": "8.
|
|
52
|
+
"@ledgerhq/coin-module-framework": "8.2.0",
|
|
53
53
|
"@ledgerhq/logs": "6.17.0",
|
|
54
54
|
"@multiversx/sdk-core": "^13.7.0",
|
|
55
55
|
"axios": "1.13.5",
|
|
56
56
|
"bech32": "^1.1.3",
|
|
57
57
|
"bignumber.js": "^9.1.2",
|
|
58
|
-
"expect": "30.
|
|
58
|
+
"expect": "30.4.1",
|
|
59
59
|
"invariant": "^2.2.2",
|
|
60
60
|
"lodash": "4.17.21",
|
|
61
61
|
"protobufjs": "^7.2.6",
|
|
62
62
|
"rxjs": "7.8.2",
|
|
63
|
-
"@ledgerhq/
|
|
64
|
-
"@ledgerhq/
|
|
65
|
-
"@ledgerhq/live-env": "^3.1.0",
|
|
63
|
+
"@ledgerhq/ledger-wallet-framework": "^3.2.0-nightly.20260901020738",
|
|
64
|
+
"@ledgerhq/live-env": "^3.2.0-nightly.20260901020738",
|
|
66
65
|
"@ledgerhq/live-network": "^3.0.0",
|
|
67
|
-
"@ledgerhq/types-live": "^6.
|
|
66
|
+
"@ledgerhq/types-live": "^6.122.0-nightly.20260901020738",
|
|
67
|
+
"@ledgerhq/devices": "8.17.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@swc/core": "1.15.11",
|
|
@@ -73,12 +73,13 @@
|
|
|
73
73
|
"@types/jest": "30.0.0",
|
|
74
74
|
"@types/lodash": "^4.17.21",
|
|
75
75
|
"@types/node": "24.12.0",
|
|
76
|
-
"jest": "30.
|
|
76
|
+
"jest": "30.4.1",
|
|
77
77
|
"msw": "^2.7.3",
|
|
78
78
|
"oxfmt": "0.64.0",
|
|
79
79
|
"oxlint": "1.79.0",
|
|
80
80
|
"@ledgerhq/disable-network-setup": "^0.3.0",
|
|
81
|
-
"@ledgerhq/
|
|
81
|
+
"@ledgerhq/test-quarantine": "0.0.0",
|
|
82
|
+
"@ledgerhq/wallet-framework-test-setup": "^0.1.8-nightly.20260901020738"
|
|
82
83
|
},
|
|
83
84
|
"scripts": {
|
|
84
85
|
"clean": "rimraf lib lib-es",
|
package/src/api/index.ts
CHANGED
|
@@ -3,17 +3,14 @@ import type {
|
|
|
3
3
|
AddressValidationCurrencyParameters,
|
|
4
4
|
Balance,
|
|
5
5
|
BalanceOptions,
|
|
6
|
-
Block,
|
|
7
|
-
BlockInfo,
|
|
8
6
|
BroadcastConfig,
|
|
9
|
-
|
|
7
|
+
CoinModuleImpl,
|
|
10
8
|
CraftedTransaction,
|
|
11
9
|
Cursor,
|
|
12
10
|
FeeEstimation,
|
|
13
11
|
ListOperationsOptions,
|
|
14
12
|
Operation,
|
|
15
13
|
Page,
|
|
16
|
-
Reward,
|
|
17
14
|
Stake,
|
|
18
15
|
StakingTransactionIntent,
|
|
19
16
|
TransactionIntent,
|
|
@@ -36,7 +33,7 @@ import { listOperations } from "../logic/history/listOperations";
|
|
|
36
33
|
import { validateAddress } from "../logic/validateAddress";
|
|
37
34
|
import { validateIntent } from "../logic/validateIntent";
|
|
38
35
|
|
|
39
|
-
export function createApi()
|
|
36
|
+
export function createApi() {
|
|
40
37
|
// The network client depends on endpoints that live in the coin config, so it is resolved per
|
|
41
38
|
// call from the context (ADR-019) rather than seeded once through a module singleton.
|
|
42
39
|
const resolveApi = async (context: MultiversXContext) => {
|
|
@@ -53,12 +50,6 @@ export function createApi(): CoinModuleApi<MultiversXCoinConfig> {
|
|
|
53
50
|
const api = await resolveApi(context);
|
|
54
51
|
return broadcast(api, tx);
|
|
55
52
|
},
|
|
56
|
-
async call(_context: MultiversXContext) {
|
|
57
|
-
throw new Error("call is not supported");
|
|
58
|
-
},
|
|
59
|
-
async register() {
|
|
60
|
-
throw new Error("register is not supported");
|
|
61
|
-
},
|
|
62
53
|
combine: (
|
|
63
54
|
_context: MultiversXContext,
|
|
64
55
|
tx: string,
|
|
@@ -75,15 +66,6 @@ export function createApi(): CoinModuleApi<MultiversXCoinConfig> {
|
|
|
75
66
|
const api = await resolveApi(context);
|
|
76
67
|
return craftTransaction(api, intent, options?.customFees);
|
|
77
68
|
},
|
|
78
|
-
craftRawTransaction: (
|
|
79
|
-
_context: MultiversXContext,
|
|
80
|
-
_tx: string,
|
|
81
|
-
_sender: string,
|
|
82
|
-
_publicKey: string,
|
|
83
|
-
_sequence: bigint,
|
|
84
|
-
): Promise<CraftedTransaction> => {
|
|
85
|
-
throw new Error("craftRawTransaction is not supported");
|
|
86
|
-
},
|
|
87
69
|
estimateFees: (
|
|
88
70
|
_context: MultiversXContext,
|
|
89
71
|
intent: TransactionIntent,
|
|
@@ -110,19 +92,6 @@ export function createApi(): CoinModuleApi<MultiversXCoinConfig> {
|
|
|
110
92
|
const api = await resolveApi(context);
|
|
111
93
|
return listOperations(api, address, options);
|
|
112
94
|
},
|
|
113
|
-
getBlock(_context: MultiversXContext, _height: number): Promise<Block> {
|
|
114
|
-
throw new Error("getBlock is not supported");
|
|
115
|
-
},
|
|
116
|
-
getBlockInfo(_context: MultiversXContext, _height: number): Promise<BlockInfo> {
|
|
117
|
-
throw new Error("getBlockInfo is not supported");
|
|
118
|
-
},
|
|
119
|
-
getRewards: (
|
|
120
|
-
_context: MultiversXContext,
|
|
121
|
-
_address: string,
|
|
122
|
-
_options?: { cursor?: Cursor },
|
|
123
|
-
): Promise<Page<Reward>> => {
|
|
124
|
-
throw new Error("getRewards is not supported");
|
|
125
|
-
},
|
|
126
95
|
getValidators: async (
|
|
127
96
|
context: MultiversXContext,
|
|
128
97
|
options?: { cursor?: Cursor },
|
|
@@ -159,5 +128,5 @@ export function createApi(): CoinModuleApi<MultiversXCoinConfig> {
|
|
|
159
128
|
},
|
|
160
129
|
craftTransactionData: (_context: MultiversXContext, intent: TransactionIntent) =>
|
|
161
130
|
craftTransactionData(intent),
|
|
162
|
-
}
|
|
131
|
+
} satisfies CoinModuleImpl<MultiversXCoinConfig>;
|
|
163
132
|
}
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Unit tests for the createApi factory — verifies the
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Unit tests for the createApi factory — verifies every method the module implements is wired and
|
|
3
|
+
* delegates to its logic function with the right arguments, and that the capabilities the chain has
|
|
4
|
+
* none of answer "not supported" once the consumer wrapper is applied. Network and logic layers are
|
|
5
|
+
* mocked; no network access.
|
|
6
6
|
*/
|
|
7
7
|
import type {
|
|
8
8
|
Balance,
|
|
9
9
|
BalanceOptions,
|
|
10
|
-
CoinModuleApi,
|
|
11
10
|
CraftedTransaction,
|
|
12
11
|
FeeEstimation,
|
|
13
12
|
Operation,
|
|
14
13
|
Page,
|
|
15
14
|
TransactionIntent,
|
|
16
15
|
} from "@ledgerhq/coin-module-framework/api/index";
|
|
16
|
+
import { capabilityReport } from "@ledgerhq/coin-module-framework/test-utils";
|
|
17
17
|
import { createApi } from "./index";
|
|
18
|
-
import { type MultiversXCoinConfig } from "../config";
|
|
19
18
|
import type { MultiversXNetworkApi } from "../network/api";
|
|
20
19
|
import { createMockMultiversXContext } from "../test/context";
|
|
21
20
|
import { broadcast } from "../logic/transaction/broadcast";
|
|
@@ -66,7 +65,7 @@ describe("createApi", () => {
|
|
|
66
65
|
jest.clearAllMocks();
|
|
67
66
|
});
|
|
68
67
|
|
|
69
|
-
it("
|
|
68
|
+
it("declares every method the chain supports", () => {
|
|
70
69
|
const api = createApi();
|
|
71
70
|
|
|
72
71
|
expect(api).toEqual(
|
|
@@ -74,15 +73,11 @@ describe("createApi", () => {
|
|
|
74
73
|
broadcast: expect.any(Function),
|
|
75
74
|
combine: expect.any(Function),
|
|
76
75
|
craftTransaction: expect.any(Function),
|
|
77
|
-
craftRawTransaction: expect.any(Function),
|
|
78
76
|
craftTransactionData: expect.any(Function),
|
|
79
77
|
estimateFees: expect.any(Function),
|
|
80
78
|
getBalance: expect.any(Function),
|
|
81
79
|
lastBlock: expect.any(Function),
|
|
82
80
|
listOperations: expect.any(Function),
|
|
83
|
-
getBlock: expect.any(Function),
|
|
84
|
-
getBlockInfo: expect.any(Function),
|
|
85
|
-
getRewards: expect.any(Function),
|
|
86
81
|
getStakes: expect.any(Function),
|
|
87
82
|
getValidators: expect.any(Function),
|
|
88
83
|
validateIntent: expect.any(Function),
|
|
@@ -257,17 +252,18 @@ describe("createApi", () => {
|
|
|
257
252
|
expect(result).toBe(true);
|
|
258
253
|
});
|
|
259
254
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
255
|
+
// Absent, raising "<name> is not supported" through the resolver — exhaustive by `toEqual`.
|
|
256
|
+
it("omits the capabilities the chain has none of", async () => {
|
|
257
|
+
await expect(capabilityReport(createApi(), createMockMultiversXContext())).resolves.toEqual({
|
|
258
|
+
unsupported: [
|
|
259
|
+
"call",
|
|
260
|
+
"craftRawTransaction",
|
|
261
|
+
"getBlock",
|
|
262
|
+
"getBlockInfo",
|
|
263
|
+
"getRewards",
|
|
264
|
+
"register",
|
|
265
|
+
],
|
|
266
|
+
inconsistent: [],
|
|
267
|
+
});
|
|
272
268
|
});
|
|
273
269
|
});
|