@ledgerhq/coin-casper 3.2.0-nightly.20260904020502 → 3.2.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/CHANGELOG.md +39 -26
- package/lib/api/index.d.ts +1 -1
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.js +10 -4
- package/lib/api/index.js.map +1 -1
- package/lib-es/api/index.d.ts +1 -1
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.js +10 -4
- package/lib-es/api/index.js.map +1 -1
- package/package.json +7 -7
- package/src/api/index.test.ts +11 -7
- package/src/api/index.ts +10 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,45 @@
|
|
|
1
1
|
# @ledgerhq/coin-casper
|
|
2
2
|
|
|
3
|
-
## 3.2.0
|
|
3
|
+
## 3.2.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
- [#
|
|
7
|
+
- [#21168](https://github.com/LedgerHQ/ledger-live/pull/21168) [`a4f727d`](https://github.com/LedgerHQ/ledger-live/commit/a4f727d0c17d685302cf9ec2a39e752b2c9937fd) 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 its object with `satisfies CoinModuleImpl<CasperConfig, CasperMemo>`
|
|
10
|
+
— which keeps the precise shape, so a caller sees exactly which methods exist — and omits the
|
|
11
|
+
eight capabilities Casper does not expose: block queries (`getBlock`, `getBlockInfo`), `call`,
|
|
12
|
+
`register`, staking (`getValidators`, `getStakes`, `getRewards`) and `craftRawTransaction`.
|
|
13
|
+
|
|
14
|
+
`craftTransactionData` is the interesting one and is _not_ omitted. It is the single
|
|
15
|
+
unsupported method the contract requires, so the type will not let it be dropped; it stays
|
|
16
|
+
declared, now built with the framework's `notSupported()` helper rather than an inline throw.
|
|
17
|
+
That keeps the distinction the migration is about visible in the source: eight absent
|
|
18
|
+
capabilities on one side, one required method this module does not implement on the other.
|
|
19
|
+
|
|
20
|
+
`getNextSequence` keeps its real implementation returning `0n` — Casper uses transaction hash
|
|
21
|
+
plus TTL for replay protection rather than a per-account nonce, so zero is an answer, not a
|
|
22
|
+
placeholder.
|
|
23
|
+
|
|
24
|
+
Callers see no change: the resolver's `withDefaults` supplies every omitted capability, so the
|
|
25
|
+
same call raises the same error from one place. What improves is introspection — `supports()`
|
|
26
|
+
can now tell these capabilities are absent, which was impossible while a throwing placeholder
|
|
27
|
+
occupied the slot and looked exactly like an implementation.
|
|
8
28
|
|
|
9
|
-
|
|
29
|
+
The authored type also keeps the contract's trailing optional parameter, or a caller reaching the module through it could no longer pass it: `broadcast` accepts and ignores its own. TypeScript does not hold a function's shorter parameter list against a target declaring more, so the `satisfies` passed either way and nothing flagged the narrowing.
|
|
30
|
+
|
|
31
|
+
- [#21190](https://github.com/LedgerHQ/ledger-live/pull/21190) [`aafcdb7`](https://github.com/LedgerHQ/ledger-live/commit/aafcdb70e59584d6580f080cfd167cce41e56c19) Thanks [@vtaranushenko-ext-ledger](https://github.com/vtaranushenko-ext-ledger)! - Preserve transferId through the generic adapter for Casper
|
|
10
32
|
|
|
11
33
|
### Patch Changes
|
|
12
34
|
|
|
35
|
+
- Updated dependencies [[`27388a8`](https://github.com/LedgerHQ/ledger-live/commit/27388a894eaac67b8e162a60f6d3368aad0a8682)]:
|
|
36
|
+
- @ledgerhq/types-live@6.122.0
|
|
37
|
+
- @ledgerhq/ledger-wallet-framework@3.2.0
|
|
38
|
+
|
|
39
|
+
## 3.2.0-next.0
|
|
40
|
+
|
|
41
|
+
### Minor Changes
|
|
42
|
+
|
|
13
43
|
- [#21168](https://github.com/LedgerHQ/ledger-live/pull/21168) [`a4f727d`](https://github.com/LedgerHQ/ledger-live/commit/a4f727d0c17d685302cf9ec2a39e752b2c9937fd) Thanks [@cted-ledger](https://github.com/cted-ledger)! - Adopt the coin-module authoring type, dropping the hand-written "not supported" stubs.
|
|
14
44
|
|
|
15
45
|
`createApi` now returns its object with `satisfies CoinModuleImpl<CasperConfig, CasperMemo>`
|
|
@@ -34,11 +64,13 @@
|
|
|
34
64
|
|
|
35
65
|
The authored type also keeps the contract's trailing optional parameter, or a caller reaching the module through it could no longer pass it: `broadcast` accepts and ignores its own. TypeScript does not hold a function's shorter parameter list against a target declaring more, so the `satisfies` passed either way and nothing flagged the narrowing.
|
|
36
66
|
|
|
37
|
-
- [#
|
|
67
|
+
- [#21190](https://github.com/LedgerHQ/ledger-live/pull/21190) [`aafcdb7`](https://github.com/LedgerHQ/ledger-live/commit/aafcdb70e59584d6580f080cfd167cce41e56c19) Thanks [@vtaranushenko-ext-ledger](https://github.com/vtaranushenko-ext-ledger)! - Preserve transferId through the generic adapter for Casper
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
38
70
|
|
|
39
|
-
- Updated dependencies [[`
|
|
40
|
-
- @ledgerhq/types-live@6.122.0-
|
|
41
|
-
- @ledgerhq/ledger-wallet-framework@3.2.0-
|
|
71
|
+
- Updated dependencies [[`27388a8`](https://github.com/LedgerHQ/ledger-live/commit/27388a894eaac67b8e162a60f6d3368aad0a8682)]:
|
|
72
|
+
- @ledgerhq/types-live@6.122.0-next.0
|
|
73
|
+
- @ledgerhq/ledger-wallet-framework@3.2.0-next.0
|
|
42
74
|
|
|
43
75
|
## 3.1.0
|
|
44
76
|
|
|
@@ -376,23 +408,4 @@
|
|
|
376
408
|
- @ledgerhq/ledger-wallet-framework@2.2.0
|
|
377
409
|
- @ledgerhq/live-network@2.6.5
|
|
378
410
|
|
|
379
|
-
## 2.13.7-next.1
|
|
380
|
-
|
|
381
|
-
### Patch Changes
|
|
382
|
-
|
|
383
|
-
- Updated dependencies [[`93a5bcd`](https://github.com/LedgerHQ/ledger-live/commit/93a5bcd8b7e361148f7bac751d072cc8bcec2cf9)]:
|
|
384
|
-
- @ledgerhq/cryptoassets@13.52.0-next.1
|
|
385
|
-
- @ledgerhq/types-live@6.112.0-next.1
|
|
386
|
-
- @ledgerhq/ledger-wallet-framework@2.2.0-next.1
|
|
387
|
-
|
|
388
|
-
## 2.13.7-next.0
|
|
389
|
-
|
|
390
|
-
### Patch Changes
|
|
391
|
-
|
|
392
|
-
- Updated dependencies [[`9ddf006`](https://github.com/LedgerHQ/ledger-live/commit/9ddf006bc2897a2393f1a9595b3c6a43d0c35bf7), [`b9a2a9e`](https://github.com/LedgerHQ/ledger-live/commit/b9a2a9e5b85f9fb5556ef2de83bd0418e5326e89), [`bfbd74d`](https://github.com/LedgerHQ/ledger-live/commit/bfbd74d47f028d7398e1856c7b18442be3f8f6d7), [`da1c0c8`](https://github.com/LedgerHQ/ledger-live/commit/da1c0c87b3d2540eff9e51c665df8192b4486855), [`031097a`](https://github.com/LedgerHQ/ledger-live/commit/031097ac469c39e4ab475b92d9f6960ebb9a1ad3), [`82a143f`](https://github.com/LedgerHQ/ledger-live/commit/82a143ff527c4a71e2c9ea79babc473ed395b42d), [`e6c617b`](https://github.com/LedgerHQ/ledger-live/commit/e6c617b91062f82f70d020212189a806d2452166), [`04e3349`](https://github.com/LedgerHQ/ledger-live/commit/04e33498ffd5d7a81ad86436a75b1562ca263356), [`eb1dae8`](https://github.com/LedgerHQ/ledger-live/commit/eb1dae8fc14ff8e0bc1e1ce040712492a0328451)]:
|
|
393
|
-
- @ledgerhq/types-live@6.112.0-next.0
|
|
394
|
-
- @ledgerhq/cryptoassets@13.52.0-next.0
|
|
395
|
-
- @ledgerhq/ledger-wallet-framework@2.2.0-next.0
|
|
396
|
-
- @ledgerhq/live-network@2.6.5-next.0
|
|
397
|
-
|
|
398
411
|
<!-- changelog-pruned: older entries were removed to keep this file small. Full history is in `git log -p CHANGELOG.md` and in the GitHub release for each version. -->
|
package/lib/api/index.d.ts
CHANGED
|
@@ -22,6 +22,6 @@ export declare function createApi(): {
|
|
|
22
22
|
} | undefined) => Promise<import("@ledgerhq/coin-module-framework/lib/api/types").TransactionValidation>;
|
|
23
23
|
getNextSequence: (_context: CasperContext, _address: string) => Promise<bigint>;
|
|
24
24
|
validateAddress: (_context: import("@ledgerhq/coin-module-framework/lib/config").Context<CasperConfig>, address: string, parameters: Partial<import("@ledgerhq/coin-module-framework/lib/api/types").AddressValidationCurrencyParameters>) => Promise<boolean>;
|
|
25
|
-
craftTransactionData: (
|
|
25
|
+
craftTransactionData: () => never;
|
|
26
26
|
};
|
|
27
27
|
//# 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":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAEf,MAAM,2CAA2C,CAAC;AAMnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAEf,MAAM,2CAA2C,CAAC;AAMnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAUxE,wBAAgB,SAAS;;wBAIV,aAAa,WACb,MAAM,YACL,cAAc,GACvB,OAAO,CAAC,OAAO,EAAE,CAAC;;;;;;;;;;;;;;;gCAaa,aAAa,YAAY,MAAM;;;EAIpE"}
|
package/lib/api/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createApi = createApi;
|
|
4
|
+
const index_1 = require("@ledgerhq/coin-module-framework/api/index");
|
|
4
5
|
const rejectBalanceOptions_1 = require("@ledgerhq/coin-module-framework/api/getBalance/rejectBalanceOptions");
|
|
5
|
-
const craftTransactionData_1 = require("@ledgerhq/coin-module-framework/logic/craftTransactionData");
|
|
6
6
|
const broadcast_1 = require("../logic/broadcast");
|
|
7
7
|
const combine_1 = require("../logic/combine");
|
|
8
8
|
const craftTransaction_1 = require("../logic/craftTransaction");
|
|
@@ -12,8 +12,14 @@ const listOperations_1 = require("../logic/listOperations");
|
|
|
12
12
|
const estimateFees_1 = require("../logic/estimateFees");
|
|
13
13
|
const validateIntent_1 = require("../logic/validateIntent");
|
|
14
14
|
const validateAddress_1 = require("../bridge/validateAddress");
|
|
15
|
-
//
|
|
16
|
-
//
|
|
15
|
+
// The caller builds the {@link CasperContext} (config + logger) and passes it to each method (ADR-019).
|
|
16
|
+
//
|
|
17
|
+
// Casper supports everything the contract requires but `craftTransactionData`, so it declares
|
|
18
|
+
// the authoring type and omits its unsupported *capabilities* — block queries, `call`,
|
|
19
|
+
// `register`, staking and raw crafting — rather than stubbing each one. That distinction is
|
|
20
|
+
// the point: eight omissions are capabilities this chain does not expose, while the stub
|
|
21
|
+
// below is a required method this module does not implement, which the type will not let us
|
|
22
|
+
// omit and which therefore stays visible here.
|
|
17
23
|
function createApi() {
|
|
18
24
|
return {
|
|
19
25
|
lastBlock: lastBlock_1.lastBlock,
|
|
@@ -30,7 +36,7 @@ function createApi() {
|
|
|
30
36
|
// per-account nonce, so getNextSequence has no meaningful value here.
|
|
31
37
|
getNextSequence: async (_context, _address) => 0n,
|
|
32
38
|
validateAddress: (_context, address, parameters) => (0, validateAddress_1.validateAddress)(address, parameters),
|
|
33
|
-
craftTransactionData: (
|
|
39
|
+
craftTransactionData: (0, index_1.notSupported)("craftTransactionData"),
|
|
34
40
|
};
|
|
35
41
|
}
|
|
36
42
|
//# sourceMappingURL=index.js.map
|
package/lib/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAKA,8GAA2G;AAC3G,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AAKA,qEAAyE;AACzE,8GAA2G;AAC3G,kDAA+C;AAC/C,8CAA2C;AAC3C,gEAA6D;AAC7D,kDAA+C;AAC/C,oDAAsE;AACtE,4DAAyD;AACzD,wDAAqD;AACrD,4DAAyD;AACzD,+DAA4D;AAG5D,wGAAwG;AACxG,EAAE;AACF,8FAA8F;AAC9F,uFAAuF;AACvF,4FAA4F;AAC5F,yFAAyF;AACzF,4FAA4F;AAC5F,+CAA+C;AAC/C;IACE,OAAO;QACL,SAAS,EAAT,qBAAS;QACT,UAAU,CACR,OAAsB,EACtB,OAAe,EACf,OAAwB;YAExB,OAAO,IAAA,2CAAoB,EAAC,GAAG,EAAE,CAAC,IAAA,uBAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAClF,CAAC;QACD,cAAc,EAAd,+BAAc;QACd,gBAAgB,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAQ,EAAE,EAAE,CAC1D,IAAA,mCAAgB,EAAC,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC;QAC1D,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,OAAQ,EAAE,EAAE,CAAC,IAAA,iBAAO,EAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC;QACvF,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,QAAS,EAAE,EAAE,CAAC,IAAA,qBAAS,EAAC,OAAO,EAAE,EAAE,CAAC;QAC7D,YAAY,EAAZ,2BAAY;QACZ,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAQ,EAAE,EAAE,CAC7D,IAAA,+BAAc,EAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC;QACvD,2EAA2E;QAC3E,sEAAsE;QACtE,eAAe,EAAE,KAAK,EAAE,QAAuB,EAAE,QAAgB,EAAE,EAAE,CAAC,EAAE;QACxE,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,IAAA,iCAAe,EAAC,OAAO,EAAE,UAAU,CAAC;QACxF,oBAAoB,EAAE,IAAA,oBAAY,EAAC,sBAAsB,CAAC;KACR,CAAC;AACvD,CAAC"}
|
package/lib-es/api/index.d.ts
CHANGED
|
@@ -22,6 +22,6 @@ export declare function createApi(): {
|
|
|
22
22
|
} | undefined) => Promise<import("@ledgerhq/coin-module-framework/lib-es/api/types").TransactionValidation>;
|
|
23
23
|
getNextSequence: (_context: CasperContext, _address: string) => Promise<bigint>;
|
|
24
24
|
validateAddress: (_context: import("@ledgerhq/coin-module-framework/lib-es/config").Context<CasperConfig>, address: string, parameters: Partial<import("@ledgerhq/coin-module-framework/lib-es/api/types").AddressValidationCurrencyParameters>) => Promise<boolean>;
|
|
25
|
-
craftTransactionData: (
|
|
25
|
+
craftTransactionData: () => never;
|
|
26
26
|
};
|
|
27
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAEf,MAAM,2CAA2C,CAAC;AAMnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EAEf,MAAM,2CAA2C,CAAC;AAMnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAUxE,wBAAgB,SAAS;;wBAIV,aAAa,WACb,MAAM,YACL,cAAc,GACvB,OAAO,CAAC,OAAO,EAAE,CAAC;;;;;;;;;;;;;;;gCAaa,aAAa,YAAY,MAAM;;;EAIpE"}
|
package/lib-es/api/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { notSupported } from "@ledgerhq/coin-module-framework/api/index";
|
|
1
2
|
import { rejectBalanceOptions } from "@ledgerhq/coin-module-framework/api/getBalance/rejectBalanceOptions";
|
|
2
|
-
import { craftTransactionData } from "@ledgerhq/coin-module-framework/logic/craftTransactionData";
|
|
3
3
|
import { broadcast } from "../logic/broadcast";
|
|
4
4
|
import { combine } from "../logic/combine";
|
|
5
5
|
import { craftTransaction } from "../logic/craftTransaction";
|
|
@@ -9,8 +9,14 @@ import { listOperations } from "../logic/listOperations";
|
|
|
9
9
|
import { estimateFees } from "../logic/estimateFees";
|
|
10
10
|
import { validateIntent } from "../logic/validateIntent";
|
|
11
11
|
import { validateAddress } from "../bridge/validateAddress";
|
|
12
|
-
//
|
|
13
|
-
//
|
|
12
|
+
// The caller builds the {@link CasperContext} (config + logger) and passes it to each method (ADR-019).
|
|
13
|
+
//
|
|
14
|
+
// Casper supports everything the contract requires but `craftTransactionData`, so it declares
|
|
15
|
+
// the authoring type and omits its unsupported *capabilities* — block queries, `call`,
|
|
16
|
+
// `register`, staking and raw crafting — rather than stubbing each one. That distinction is
|
|
17
|
+
// the point: eight omissions are capabilities this chain does not expose, while the stub
|
|
18
|
+
// below is a required method this module does not implement, which the type will not let us
|
|
19
|
+
// omit and which therefore stays visible here.
|
|
14
20
|
export function createApi() {
|
|
15
21
|
return {
|
|
16
22
|
lastBlock,
|
|
@@ -27,7 +33,7 @@ export function createApi() {
|
|
|
27
33
|
// per-account nonce, so getNextSequence has no meaningful value here.
|
|
28
34
|
getNextSequence: async (_context, _address) => 0n,
|
|
29
35
|
validateAddress: (_context, address, parameters) => validateAddress(address, parameters),
|
|
30
|
-
craftTransactionData: (
|
|
36
|
+
craftTransactionData: notSupported("craftTransactionData"),
|
|
31
37
|
};
|
|
32
38
|
}
|
|
33
39
|
//# sourceMappingURL=index.js.map
|
package/lib-es/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,UAAU,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,wGAAwG;AACxG,EAAE;AACF,8FAA8F;AAC9F,uFAAuF;AACvF,4FAA4F;AAC5F,yFAAyF;AACzF,4FAA4F;AAC5F,+CAA+C;AAC/C,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,SAAS;QACT,UAAU,CACR,OAAsB,EACtB,OAAe,EACf,OAAwB;YAExB,OAAO,oBAAoB,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAClF,CAAC;QACD,cAAc;QACd,gBAAgB,EAAE,CAAC,QAAQ,EAAE,iBAAiB,EAAE,OAAQ,EAAE,EAAE,CAC1D,gBAAgB,CAAC,iBAAiB,EAAE,OAAO,EAAE,UAAU,CAAC;QAC1D,OAAO,EAAE,CAAC,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,OAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,CAAC;QACvF,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,EAAE,QAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7D,YAAY;QACZ,cAAc,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAQ,EAAE,EAAE,CAC7D,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC;QACvD,2EAA2E;QAC3E,sEAAsE;QACtE,eAAe,EAAE,KAAK,EAAE,QAAuB,EAAE,QAAgB,EAAE,EAAE,CAAC,EAAE;QACxE,eAAe,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC;QACxF,oBAAoB,EAAE,YAAY,CAAC,sBAAsB,CAAC;KACR,CAAC;AACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-casper",
|
|
3
|
-
"version": "3.2.0
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Ledger Casper integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -95,15 +95,15 @@
|
|
|
95
95
|
"license": "Apache-2.0",
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"@ledgerhq/coin-module-framework": "8.2.0",
|
|
98
|
-
"@ledgerhq/logs": "6.
|
|
98
|
+
"@ledgerhq/logs": "6.17.0",
|
|
99
99
|
"bignumber.js": "^9.1.2",
|
|
100
100
|
"casper-js-sdk": "5.0.5",
|
|
101
101
|
"invariant": "^2.2.2",
|
|
102
102
|
"lodash": "4.17.21",
|
|
103
103
|
"rxjs": "7.8.2",
|
|
104
|
-
"@ledgerhq/ledger-wallet-framework": "^3.2.0
|
|
105
|
-
"@ledgerhq/
|
|
106
|
-
"@ledgerhq/live
|
|
104
|
+
"@ledgerhq/ledger-wallet-framework": "^3.2.0",
|
|
105
|
+
"@ledgerhq/live-network": "^3.0.0",
|
|
106
|
+
"@ledgerhq/types-live": "^6.122.0"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
109
|
"@swc/core": "1.15.11",
|
|
@@ -114,12 +114,12 @@
|
|
|
114
114
|
"@types/node": "24.12.0",
|
|
115
115
|
"@types/semver": "7.7.1",
|
|
116
116
|
"axios": "1.13.5",
|
|
117
|
-
"jest": "30.
|
|
117
|
+
"jest": "30.4.1",
|
|
118
118
|
"oxfmt": "0.64.0",
|
|
119
119
|
"oxlint": "1.79.0",
|
|
120
120
|
"@ledgerhq/disable-network-setup": "^0.3.0",
|
|
121
121
|
"@ledgerhq/test-quarantine": "0.0.0",
|
|
122
|
-
"@ledgerhq/wallet-framework-test-setup": "^0.1.8
|
|
122
|
+
"@ledgerhq/wallet-framework-test-setup": "^0.1.8"
|
|
123
123
|
},
|
|
124
124
|
"scripts": {
|
|
125
125
|
"clean": "rimraf lib lib-es",
|
package/src/api/index.test.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Balance, TransactionIntent } from "@ledgerhq/coin-module-framework/api/index";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
isNotSupportedStub,
|
|
4
|
+
requiredApiKeys,
|
|
5
|
+
withDefaults,
|
|
6
|
+
} from "@ledgerhq/coin-module-framework/api/index";
|
|
3
7
|
import { CASPER_FEES_MOTES } from "../constants";
|
|
4
8
|
import { TEST_ADDRESSES } from "../__tests__/fixtures/addresses.fixture";
|
|
5
9
|
import type { CasperContext, CasperMemo } from "../types";
|
|
@@ -52,6 +56,12 @@ describe("createApi", () => {
|
|
|
52
56
|
}
|
|
53
57
|
});
|
|
54
58
|
|
|
59
|
+
// `craftTransactionData` is the one unsupported method the contract requires, so it cannot
|
|
60
|
+
// be omitted — it stays declared, and stays visible for what it is.
|
|
61
|
+
it("declares craftTransactionData as unsupported", () => {
|
|
62
|
+
expect(isNotSupportedStub(api.craftTransactionData)).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
|
|
55
65
|
describe("validateIntent", () => {
|
|
56
66
|
it("validates a send intent through the api surface", async () => {
|
|
57
67
|
const result = await api.validateIntent(context, sendIntent, balances, {
|
|
@@ -88,10 +98,4 @@ describe("createApi", () => {
|
|
|
88
98
|
await expect(api.getNextSequence(context, validEd25519)).resolves.toBe(0n);
|
|
89
99
|
});
|
|
90
100
|
});
|
|
91
|
-
|
|
92
|
-
describe("craftTransactionData", () => {
|
|
93
|
-
it("reports no transaction data — Casper carries none, the transfer id travels on the intent memo", () => {
|
|
94
|
-
expect(api.craftTransactionData(context, sendIntent)).toEqual({ type: "none" });
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
101
|
});
|
package/src/api/index.ts
CHANGED
|
@@ -3,8 +3,8 @@ import type {
|
|
|
3
3
|
BalanceOptions,
|
|
4
4
|
CoinModuleImpl,
|
|
5
5
|
} from "@ledgerhq/coin-module-framework/api/index";
|
|
6
|
+
import { notSupported } from "@ledgerhq/coin-module-framework/api/index";
|
|
6
7
|
import { rejectBalanceOptions } from "@ledgerhq/coin-module-framework/api/getBalance/rejectBalanceOptions";
|
|
7
|
-
import { craftTransactionData } from "@ledgerhq/coin-module-framework/logic/craftTransactionData";
|
|
8
8
|
import { broadcast } from "../logic/broadcast";
|
|
9
9
|
import { combine } from "../logic/combine";
|
|
10
10
|
import { craftTransaction } from "../logic/craftTransaction";
|
|
@@ -16,8 +16,14 @@ import { validateIntent } from "../logic/validateIntent";
|
|
|
16
16
|
import { validateAddress } from "../bridge/validateAddress";
|
|
17
17
|
import type { CasperConfig, CasperContext, CasperMemo } from "../types";
|
|
18
18
|
|
|
19
|
-
//
|
|
20
|
-
//
|
|
19
|
+
// The caller builds the {@link CasperContext} (config + logger) and passes it to each method (ADR-019).
|
|
20
|
+
//
|
|
21
|
+
// Casper supports everything the contract requires but `craftTransactionData`, so it declares
|
|
22
|
+
// the authoring type and omits its unsupported *capabilities* — block queries, `call`,
|
|
23
|
+
// `register`, staking and raw crafting — rather than stubbing each one. That distinction is
|
|
24
|
+
// the point: eight omissions are capabilities this chain does not expose, while the stub
|
|
25
|
+
// below is a required method this module does not implement, which the type will not let us
|
|
26
|
+
// omit and which therefore stays visible here.
|
|
21
27
|
export function createApi() {
|
|
22
28
|
return {
|
|
23
29
|
lastBlock,
|
|
@@ -40,6 +46,6 @@ export function createApi() {
|
|
|
40
46
|
// per-account nonce, so getNextSequence has no meaningful value here.
|
|
41
47
|
getNextSequence: async (_context: CasperContext, _address: string) => 0n,
|
|
42
48
|
validateAddress: (_context, address, parameters) => validateAddress(address, parameters),
|
|
43
|
-
craftTransactionData: (
|
|
49
|
+
craftTransactionData: notSupported("craftTransactionData"),
|
|
44
50
|
} satisfies CoinModuleImpl<CasperConfig, CasperMemo>;
|
|
45
51
|
}
|