Skip to content

Commit 8419756

Browse files
committed
feat: update hw-app-sui
1 parent 7c57c22 commit 8419756

7 files changed

Lines changed: 163 additions & 243 deletions

File tree

.changeset/rare-ants-do.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@ledgerhq/hw-app-sui": minor
3+
"@ledgerhq/coin-sui": minor
4+
---
5+
6+
feat: update hw-app-sui

libs/coin-modules/coin-sui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
"@ledgerhq/logs": "workspace:^",
161161
"@ledgerhq/types-cryptoassets": "workspace:^",
162162
"@ledgerhq/types-live": "workspace:^",
163-
"@mysten/signers": "0.6.2",
163+
"@mysten/signers": "1.0.1",
164164
"@mysten/sui": "2.9.0",
165165
"bignumber.js": "^9.1.2",
166166
"lodash": "4.17.21",

libs/coin-modules/coin-sui/src/bridge/signOperation.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { FeeNotLoaded } from "@ledgerhq/errors";
22
import { SignerContext } from "@ledgerhq/ledger-wallet-framework/signer";
33
import type { AccountBridge } from "@ledgerhq/types-live";
44
import { LedgerSigner } from "@mysten/signers/ledger";
5-
import type { SuiJsonRpcClient } from "@mysten/sui/jsonRpc";
5+
import type { ClientWithCoreApi } from "@mysten/sui/client";
66
import { BigNumber } from "bignumber.js";
77
import { Observable } from "rxjs";
88
import { withApi } from "../network/sdk";
@@ -46,12 +46,11 @@ export const buildSignOperation = (
4646
);
4747

4848
const signed = await signerContext(deviceId, async suiSigner =>
49-
withApi(async (suiClient: SuiJsonRpcClient) => {
50-
// TODO: remove cast once @mysten/signers is bumped to v2-compat
49+
withApi(async (suiClient: ClientWithCoreApi) => {
5150
const ledgerSigner = await LedgerSigner.fromDerivationPath(
5251
account.freshAddressPath,
5352
suiSigner,
54-
suiClient as any,
53+
suiClient,
5554
);
5655
return ledgerSigner.signTransaction(unsigned, objects, resolution);
5756
}, account.currency.id),

libs/coin-modules/coin-sui/src/network/sdk.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,7 @@ const createTransactionForDelegate = async (
11521152
tx.setGasBudgetIfNotSet(ONE_SUI / 10);
11531153

11541154
const serialized = await tx.build({ client: api });
1155-
// TODO: remove cast once @mysten/signers is bumped to v2-compat
1156-
const { bcsObjects } = await getInputObjects(tx as any, withBatchedMultiGetObjects(api) as any);
1155+
const { bcsObjects } = await getInputObjects(tx, withBatchedMultiGetObjects(api));
11571156

11581157
return { serialized, bcsObjects };
11591158
}, currencyId);
@@ -1188,8 +1187,7 @@ const createTransactionForUndelegate = async (
11881187
tx.setGasBudgetIfNotSet(ONE_SUI / 10);
11891188

11901189
const serialized = await tx.build({ client: api });
1191-
// TODO: remove cast once @mysten/signers is bumped to v2-compat
1192-
const { bcsObjects } = await getInputObjects(tx as any, withBatchedMultiGetObjects(api) as any);
1190+
const { bcsObjects } = await getInputObjects(tx, withBatchedMultiGetObjects(api));
11931191

11941192
return { serialized, bcsObjects };
11951193
}, currencyId);
@@ -1227,8 +1225,7 @@ const createTransactionForOthers = async (
12271225
}
12281226

12291227
const serialized = await tx.build({ client: api });
1230-
// TODO: remove cast once @mysten/signers is bumped to v2-compat
1231-
const { bcsObjects } = await getInputObjects(tx as any, withBatchedMultiGetObjects(api) as any);
1228+
const { bcsObjects } = await getInputObjects(tx, withBatchedMultiGetObjects(api));
12321229

12331230
return { serialized, bcsObjects };
12341231
}, currencyId);

libs/ledgerjs/packages/hw-app-sui/jest.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,21 @@ import { fileURLToPath } from "node:url";
33
import baseConfig from "../../jest.config.ts";
44

55
const __dirname = dirname(fileURLToPath(import.meta.url));
6+
const esmPackages = ["@mysten"];
67

78
export default {
89
...baseConfig,
910
rootDir: __dirname,
11+
transform: {
12+
...baseConfig.transform,
13+
[`node_modules/.pnpm/(${esmPackages.join("|")}).+\\.(js|mjs)?$`]: [
14+
"@swc/jest",
15+
{
16+
jsc: {
17+
target: "esnext",
18+
},
19+
},
20+
],
21+
},
22+
transformIgnorePatterns: [`node_modules/.pnpm/(?!(${esmPackages.join("|")}))`],
1023
};

libs/ledgerjs/packages/hw-app-sui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"types": "lib/Sui.d.ts",
2727
"license": "Apache-2.0",
2828
"dependencies": {
29-
"@mysten/ledgerjs-hw-app-sui": "0.7.0"
29+
"@mysten/ledgerjs-hw-app-sui": "0.7.1"
3030
},
3131
"devDependencies": {
3232
"@ledgerhq/hw-transport-mocker": "workspace:^",

0 commit comments

Comments
 (0)