@ledgerhq/coin-sui 0.16.0-nightly.8 → 0.16.0-nightly.9

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @ledgerhq/coin-sui@0.16.0-nightly.7 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-sui
2
+ > @ledgerhq/coin-sui@0.16.0-nightly.8 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-sui
3
3
  > tsc --outDir lib --module commonjs --moduleResolution node10 && tsc -m ES6 --outDir lib-es
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @ledgerhq/coin-sui
2
2
 
3
+ ## 0.16.0-nightly.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#12310](https://github.com/LedgerHQ/ledger-live/pull/12310) [`fbc2b07`](https://github.com/LedgerHQ/ledger-live/commit/fbc2b0712037dfcee79ba72831878a814ca2185f) Thanks [@nchataing](https://github.com/nchataing)! - fix: correctly pass extra parameters for undelegate tx fee estimation
8
+
9
+ - Updated dependencies [[`c96d73f`](https://github.com/LedgerHQ/ledger-live/commit/c96d73fed0a75a9c208f78d51c34b742703a7dda)]:
10
+ - @ledgerhq/coin-framework@6.7.0-nightly.8
11
+
3
12
  ## 0.16.0-nightly.8
4
13
 
5
14
  ### Patch Changes
@@ -1,3 +1,6 @@
1
1
  import type { TransactionIntent } from "@ledgerhq/coin-framework/api/index";
2
- export declare function estimateFees({ recipient, amount, sender, asset, type, }: TransactionIntent): Promise<bigint>;
2
+ export declare function estimateFees({ recipient, amount, sender, asset, type, ...extra }: TransactionIntent & {
3
+ useAllAmount?: boolean;
4
+ stakedSuiId?: string;
5
+ }): Promise<bigint>;
3
6
  //# sourceMappingURL=estimateFees.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../src/logic/estimateFees.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,wBAAsB,YAAY,CAAC,EACjC,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,GACL,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BrC"}
1
+ {"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../src/logic/estimateFees.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,wBAAsB,YAAY,CAAC,EACjC,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,iBAAiB,GAAG;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BlB"}
@@ -7,7 +7,7 @@ exports.estimateFees = void 0;
7
7
  const network_1 = __importDefault(require("../network"));
8
8
  const bignumber_js_1 = require("bignumber.js");
9
9
  const sdk_1 = require("../network/sdk");
10
- async function estimateFees({ recipient, amount, sender, asset, type, }) {
10
+ async function estimateFees({ recipient, amount, sender, asset, type, ...extra }) {
11
11
  let coinType = sdk_1.DEFAULT_COIN_TYPE;
12
12
  if (asset.type === "token" && asset.assetReference) {
13
13
  coinType = asset.assetReference;
@@ -31,6 +31,7 @@ async function estimateFees({ recipient, amount, sender, asset, type, }) {
31
31
  amount: (0, bignumber_js_1.BigNumber)(amount.toString()),
32
32
  errors: {},
33
33
  coinType,
34
+ ...extra,
34
35
  });
35
36
  return BigInt(gasBudget);
36
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"estimateFees.js","sourceRoot":"","sources":["../../src/logic/estimateFees.ts"],"names":[],"mappings":";;;;;;AAAA,yDAAgC;AAChC,+CAAyC;AAEzC,wCAAmD;AAE5C,KAAK,UAAU,YAAY,CAAC,EACjC,SAAS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;QACb,KAAK,UAAU;YACb,IAAI,GAAG,UAAU,CAAC;YAClB,MAAM;QACR,KAAK,YAAY;YACf,IAAI,GAAG,YAAY,CAAC;YACpB,MAAM;QACR;YACE,IAAI,GAAG,MAAM,CAAC;YACd,MAAM;IACV,CAAC;IAED,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,iBAAM,CAAC,WAAW,CAAC,MAAM,EAAE;QACrD,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,SAAS;QACT,MAAM,EAAE,IAAA,wBAAS,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,EAAE,EAAE;QACV,QAAQ;QACR,GAAG,KAAK;KACT,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC;AAC3B,CAAC;AAvCD,oCAuCC"}
@@ -1,3 +1,6 @@
1
1
  import type { TransactionIntent } from "@ledgerhq/coin-framework/api/index";
2
- export declare function estimateFees({ recipient, amount, sender, asset, type, }: TransactionIntent): Promise<bigint>;
2
+ export declare function estimateFees({ recipient, amount, sender, asset, type, ...extra }: TransactionIntent & {
3
+ useAllAmount?: boolean;
4
+ stakedSuiId?: string;
5
+ }): Promise<bigint>;
3
6
  //# sourceMappingURL=estimateFees.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../src/logic/estimateFees.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,wBAAsB,YAAY,CAAC,EACjC,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,GACL,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CA4BrC"}
1
+ {"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../src/logic/estimateFees.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAG5E,wBAAsB,YAAY,CAAC,EACjC,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,iBAAiB,GAAG;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BlB"}
@@ -1,7 +1,7 @@
1
1
  import suiAPI from "../network";
2
2
  import { BigNumber } from "bignumber.js";
3
3
  import { DEFAULT_COIN_TYPE } from "../network/sdk";
4
- export async function estimateFees({ recipient, amount, sender, asset, type, }) {
4
+ export async function estimateFees({ recipient, amount, sender, asset, type, ...extra }) {
5
5
  let coinType = DEFAULT_COIN_TYPE;
6
6
  if (asset.type === "token" && asset.assetReference) {
7
7
  coinType = asset.assetReference;
@@ -25,6 +25,7 @@ export async function estimateFees({ recipient, amount, sender, asset, type, })
25
25
  amount: BigNumber(amount.toString()),
26
26
  errors: {},
27
27
  coinType,
28
+ ...extra,
28
29
  });
29
30
  return BigInt(gasBudget);
30
31
  }
@@ -1 +1 @@
1
- {"version":3,"file":"estimateFees.js","sourceRoot":"","sources":["../../src/logic/estimateFees.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,YAAY,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,EACjC,SAAS,EACT,MAAM,EACN,MAAM,EACN,KAAK,EACL,IAAI,GACc;IAClB,IAAI,QAAQ,GAAG,iBAAiB,CAAC;IACjC,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QACnD,QAAQ,GAAG,KAAK,CAAC,cAAc,CAAC;IAClC,CAAC;IAED,IAAI,IAAwC,CAAC;IAC7C,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,UAAU;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AAC,WAAW,CAAC,MAAM,EAAE;QACrD,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,SAAS;QACT,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpC,MAAM,EAAE,EAAE;QACV,QAAQ;QACR,GAAG,KAAK;KACT,CAAC,CAAC;IACH,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC;AAC3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-sui",
3
- "version": "0.16.0-nightly.8",
3
+ "version": "0.16.0-nightly.9",
4
4
  "description": "Ledger Sui Coin integration",
5
5
  "keywords": [
6
6
  "Ledger",
@@ -124,7 +124,7 @@
124
124
  "bignumber.js": "^9.1.2",
125
125
  "lodash": "4.17.21",
126
126
  "rxjs": "^7.8.1",
127
- "@ledgerhq/coin-framework": "^6.7.0-nightly.7",
127
+ "@ledgerhq/coin-framework": "^6.7.0-nightly.8",
128
128
  "@ledgerhq/cryptoassets": "^13.31.0-nightly.7",
129
129
  "@ledgerhq/errors": "^6.27.0-nightly.0",
130
130
  "@ledgerhq/hw-app-sui": "^1.4.0",
@@ -33,14 +33,17 @@ describe("estimateFees", () => {
33
33
 
34
34
  const result = await estimateFees(transactionIntent);
35
35
 
36
- expect(suiAPI.paymentInfo).toHaveBeenCalledWith(transactionIntent.sender, {
37
- recipient: transactionIntent.recipient,
38
- amount: BigNumber(transactionIntent.amount.toString()),
39
- coinType: "0x2::sui::SUI",
40
- errors: {},
41
- family: "sui",
42
- mode: "send",
43
- });
36
+ expect(suiAPI.paymentInfo).toHaveBeenCalledWith(
37
+ transactionIntent.sender,
38
+ expect.objectContaining({
39
+ recipient: transactionIntent.recipient,
40
+ amount: BigNumber(transactionIntent.amount.toString()),
41
+ coinType: "0x2::sui::SUI",
42
+ errors: {},
43
+ family: "sui",
44
+ mode: "send",
45
+ }),
46
+ );
44
47
  expect(result).toBe(BigInt(mockGasBudget));
45
48
  });
46
49
 
@@ -61,14 +64,17 @@ describe("estimateFees", () => {
61
64
 
62
65
  const result = await estimateFees(transactionIntent);
63
66
 
64
- expect(suiAPI.paymentInfo).toHaveBeenCalledWith(transactionIntent.sender, {
65
- recipient: transactionIntent.recipient,
66
- amount: BigNumber("0"),
67
- coinType: "0x2::sui::SUI",
68
- errors: {},
69
- family: "sui",
70
- mode: "send",
71
- });
67
+ expect(suiAPI.paymentInfo).toHaveBeenCalledWith(
68
+ transactionIntent.sender,
69
+ expect.objectContaining({
70
+ recipient: transactionIntent.recipient,
71
+ amount: BigNumber("0"),
72
+ coinType: "0x2::sui::SUI",
73
+ errors: {},
74
+ family: "sui",
75
+ mode: "send",
76
+ }),
77
+ );
72
78
  expect(result).toBe(BigInt(mockGasBudget));
73
79
  });
74
80
  });
@@ -9,7 +9,11 @@ export async function estimateFees({
9
9
  sender,
10
10
  asset,
11
11
  type,
12
- }: TransactionIntent): Promise<bigint> {
12
+ ...extra
13
+ }: TransactionIntent & {
14
+ useAllAmount?: boolean;
15
+ stakedSuiId?: string;
16
+ }): Promise<bigint> {
13
17
  let coinType = DEFAULT_COIN_TYPE;
14
18
  if (asset.type === "token" && asset.assetReference) {
15
19
  coinType = asset.assetReference;
@@ -35,6 +39,7 @@ export async function estimateFees({
35
39
  amount: BigNumber(amount.toString()),
36
40
  errors: {},
37
41
  coinType,
42
+ ...extra,
38
43
  });
39
44
  return BigInt(gasBudget);
40
45
  }