Skip to content

Commit 31f1752

Browse files
🎨 (signer-solana): Rename web3check to transactionCheck
1 parent 009e167 commit 31f1752

20 files changed

Lines changed: 221 additions & 192 deletions
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@ledgerhq/device-signer-kit-solana": patch
3+
---
4+
5+
rename web3check to transactionCheck

‎packages/signer/signer-solana/src/api/app-binder/SignTransactionDeviceActionTypes.ts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import { type SigningOperationsDAStateStep } from "./SigningOperationsDeviceActi
1919
export const signTransactionDAStateSteps = Object.freeze({
2020
OPEN_APP: "signer.sol.steps.openApp",
2121
GET_APP_CONFIG: "signer.sol.steps.getAppConfig",
22-
WEB3_CHECKS_OPT_IN: "signer.sol.steps.web3ChecksOptIn",
23-
WEB3_CHECKS_OPT_IN_RESULT: "signer.sol.steps.web3ChecksOptInResult",
24-
WEB3_CHECKS_PROVIDE: "signer.sol.steps.web3ChecksProvide",
22+
TRANSACTION_CHECKS_OPT_IN: "signer.sol.steps.transactionChecksOptIn",
23+
TRANSACTION_CHECKS_OPT_IN_RESULT:
24+
"signer.sol.steps.transactionChecksOptInResult",
25+
TRANSACTION_CHECKS_PROVIDE: "signer.sol.steps.transactionChecksProvide",
2526
INSPECT_TRANSACTION: "signer.sol.steps.inspectTransaction",
2627
GET_PUB_KEY: "signer.sol.steps.getPubKey",
2728
BUILD_BASIC_CLEAR_SIGN_CONTEXT: "signer.sol.steps.buildBasicClearSignContext",
@@ -69,23 +70,23 @@ type SignTransactionDARequiredInteraction =
6970

7071
/**
7172
* The intermediate value shared by every sign-transaction step except the
72-
* WEB3_CHECKS_OPT_IN_RESULT branch (which carries an extra `result`). The
73+
* TRANSACTION_CHECKS_OPT_IN_RESULT branch (which carries an extra `result`). The
7374
* clear-sign child machines emit exactly this shape, so the parent can fold
7475
* their snapshots into its own intermediate value without a cast.
7576
*/
7677
export type SignTransactionDASimpleIntermediateValue = {
7778
requiredUserInteraction: SignTransactionDARequiredInteraction;
7879
step: Exclude<
7980
SignTransactionDAStateStep,
80-
typeof signTransactionDAStateSteps.WEB3_CHECKS_OPT_IN_RESULT
81+
typeof signTransactionDAStateSteps.TRANSACTION_CHECKS_OPT_IN_RESULT
8182
>;
8283
};
8384

8485
export type SignTransactionDAIntermediateValue =
8586
| SignTransactionDASimpleIntermediateValue
8687
| {
8788
requiredUserInteraction: UserInteractionRequired.None;
88-
step: typeof signTransactionDAStateSteps.WEB3_CHECKS_OPT_IN_RESULT;
89+
step: typeof signTransactionDAStateSteps.TRANSACTION_CHECKS_OPT_IN_RESULT;
8990
result: boolean;
9091
};
9192

‎packages/signer/signer-solana/src/api/model/AppConfiguration.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ export type AppConfiguration = {
44
blindSigningEnabled: boolean;
55
pubKeyDisplayMode: PublicKeyDisplayMode;
66
version: string;
7-
web3ChecksEnabled?: boolean;
8-
web3ChecksOptIn?: boolean;
7+
transactionChecksEnabled?: boolean;
8+
transactionChecksOptIn?: boolean;
99
};

‎packages/signer/signer-solana/src/internal/app-binder/SolanaApplicationResolver.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const DEFAULT_VERSION = "0.0.1";
1818
export const SOLANA_MIN_SPL_VERSION = "1.9.2";
1919
export const SOLANA_MIN_DELAYED_SIGNING_VERSION = "1.14.0";
2020

21-
export const SOLANA_MIN_WEB3_CHECKS_VERSION = UNRELEASED_MIN_VERSION;
21+
export const SOLANA_MIN_TRANSACTION_CHECKS_VERSION = UNRELEASED_MIN_VERSION;
2222
export const SOLANA_MIN_GENERIC_CLEAR_SIGN_VERSION = UNRELEASED_MIN_VERSION;
2323

2424
export const SOLANA_FEATURES = {
@@ -27,8 +27,8 @@ export const SOLANA_FEATURES = {
2727
excludedModels: [DeviceModelId.NANO_S],
2828
excludedApps: [] as string[],
2929
},
30-
web3Checks: {
31-
minVersion: SOLANA_MIN_WEB3_CHECKS_VERSION,
30+
transactionChecks: {
31+
minVersion: SOLANA_MIN_TRANSACTION_CHECKS_VERSION,
3232
excludedModels: [
3333
DeviceModelId.NANO_S,
3434
DeviceModelId.NANO_SP,

‎packages/signer/signer-solana/src/internal/app-binder/command/GetAppConfigurationCommand.test.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ describe("GetAppConfigurationCommand", () => {
5959
blindSigningEnabled: true,
6060
pubKeyDisplayMode: PublicKeyDisplayMode.LONG,
6161
version: "2.5.10",
62-
web3ChecksEnabled: false,
63-
web3ChecksOptIn: false,
62+
transactionChecksEnabled: false,
63+
transactionChecksOptIn: false,
6464
},
6565
}),
6666
);
@@ -76,8 +76,8 @@ describe("GetAppConfigurationCommand", () => {
7676
blindSigningEnabled: true,
7777
pubKeyDisplayMode: PublicKeyDisplayMode.SHORT,
7878
version: "2.5.10",
79-
web3ChecksEnabled: false,
80-
web3ChecksOptIn: false,
79+
transactionChecksEnabled: false,
80+
transactionChecksOptIn: false,
8181
},
8282
}),
8383
);
@@ -95,8 +95,8 @@ describe("GetAppConfigurationCommand", () => {
9595
blindSigningEnabled: true,
9696
pubKeyDisplayMode: PublicKeyDisplayMode.LONG,
9797
version: "2.5.10",
98-
web3ChecksEnabled: true,
99-
web3ChecksOptIn: true,
98+
transactionChecksEnabled: true,
99+
transactionChecksOptIn: true,
100100
},
101101
}),
102102
);

‎packages/signer/signer-solana/src/internal/app-binder/command/GetAppConfigurationCommand.ts‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ const RESPONSE_OFFSET_FEATURE_FLAGS = 5;
3131
const RESPONSE_BASE_LENGTH = 5;
3232
const RESPONSE_LENGTH_WITH_FEATURE_FLAGS = 6;
3333

34-
const FEATURE_FLAG_WEB3_CHECKS_ENABLED = 0x10;
35-
const FEATURE_FLAG_WEB3_CHECKS_OPT_IN = 0x20;
34+
const FEATURE_FLAG_TRANSACTION_CHECKS_ENABLED = 0x10;
35+
const FEATURE_FLAG_TRANSACTION_CHECKS_OPT_IN = 0x20;
3636

3737
type GetAppConfigurationCommandArgs = void;
3838

@@ -85,20 +85,24 @@ export class GetAppConfigurationCommand
8585
: PublicKeyDisplayMode.SHORT;
8686
const version = `${data[RESPONSE_OFFSET_VERSION_MAJOR]}.${data[RESPONSE_OFFSET_VERSION_MINOR]}.${data[RESPONSE_OFFSET_VERSION_PATCH]}`;
8787

88-
let web3ChecksEnabled = false;
89-
let web3ChecksOptIn = false;
88+
let transactionChecksEnabled = false;
89+
let transactionChecksOptIn = false;
9090
if (data.length >= RESPONSE_LENGTH_WITH_FEATURE_FLAGS) {
9191
const featureFlags = data[RESPONSE_OFFSET_FEATURE_FLAGS]!;
92-
web3ChecksEnabled = !!(featureFlags & FEATURE_FLAG_WEB3_CHECKS_ENABLED);
93-
web3ChecksOptIn = !!(featureFlags & FEATURE_FLAG_WEB3_CHECKS_OPT_IN);
92+
transactionChecksEnabled = !!(
93+
featureFlags & FEATURE_FLAG_TRANSACTION_CHECKS_ENABLED
94+
);
95+
transactionChecksOptIn = !!(
96+
featureFlags & FEATURE_FLAG_TRANSACTION_CHECKS_OPT_IN
97+
);
9498
}
9599

96100
const config: AppConfiguration = {
97101
blindSigningEnabled,
98102
pubKeyDisplayMode,
99103
version,
100-
web3ChecksEnabled,
101-
web3ChecksOptIn,
104+
transactionChecksEnabled,
105+
transactionChecksOptIn,
102106
};
103107

104108
return CommandResultFactory({

packages/signer/signer-solana/src/internal/app-binder/command/ProvideWeb3CheckCommand.test.ts renamed to packages/signer/signer-solana/src/internal/app-binder/command/ProvideTransactionCheckCommand.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
import { isSuccessCommandResult } from "@ledgerhq/device-management-kit";
22

33
import {
4-
ProvideWeb3CheckCommand,
4+
ProvideTransactionCheckCommand,
55
TRANSACTION_CHECK_CLA,
66
TRANSACTION_CHECK_INS,
77
TRANSACTION_CHECK_P1_PROVIDE,
8-
} from "@internal/app-binder/command/ProvideWeb3CheckCommand";
8+
} from "@internal/app-binder/command/ProvideTransactionCheckCommand";
99
import {
1010
P2_EXTEND,
1111
P2_MORE,
1212
} from "@internal/app-binder/command/utils/apduChunking";
1313

14-
describe("ProvideWeb3CheckCommand", () => {
14+
describe("ProvideTransactionCheckCommand", () => {
1515
describe("name", () => {
16-
it("should be 'provideWeb3Check'", () => {
17-
const command = new ProvideWeb3CheckCommand({
16+
it("should be 'provideTransactionCheck'", () => {
17+
const command = new ProvideTransactionCheckCommand({
1818
payload: new Uint8Array([0xaa]),
1919
isFirstChunk: true,
2020
hasMore: false,
2121
});
22-
expect(command.name).toBe("provideWeb3Check");
22+
expect(command.name).toBe("provideTransactionCheck");
2323
});
2424
});
2525

2626
describe("getApdu", () => {
2727
const payload = new Uint8Array([0xaa, 0xbb, 0xcc]);
2828

2929
it("single chunk: P2 = 0x00 (no EXTEND, no MORE)", () => {
30-
const command = new ProvideWeb3CheckCommand({
30+
const command = new ProvideTransactionCheckCommand({
3131
payload,
3232
isFirstChunk: true,
3333
hasMore: false,
@@ -43,7 +43,7 @@ describe("ProvideWeb3CheckCommand", () => {
4343
});
4444

4545
it("first of many: P2 = P2_MORE", () => {
46-
const command = new ProvideWeb3CheckCommand({
46+
const command = new ProvideTransactionCheckCommand({
4747
payload,
4848
isFirstChunk: true,
4949
hasMore: true,
@@ -54,7 +54,7 @@ describe("ProvideWeb3CheckCommand", () => {
5454
});
5555

5656
it("middle chunk: P2 = P2_MORE | P2_EXTEND", () => {
57-
const command = new ProvideWeb3CheckCommand({
57+
const command = new ProvideTransactionCheckCommand({
5858
payload,
5959
isFirstChunk: false,
6060
hasMore: true,
@@ -65,7 +65,7 @@ describe("ProvideWeb3CheckCommand", () => {
6565
});
6666

6767
it("last chunk: P2 = P2_EXTEND", () => {
68-
const command = new ProvideWeb3CheckCommand({
68+
const command = new ProvideTransactionCheckCommand({
6969
payload,
7070
isFirstChunk: false,
7171
hasMore: false,
@@ -78,7 +78,7 @@ describe("ProvideWeb3CheckCommand", () => {
7878

7979
describe("parseResponse", () => {
8080
it("should return success on 0x9000", () => {
81-
const command = new ProvideWeb3CheckCommand({
81+
const command = new ProvideTransactionCheckCommand({
8282
payload: new Uint8Array([0xaa]),
8383
isFirstChunk: true,
8484
hasMore: false,
@@ -91,7 +91,7 @@ describe("ProvideWeb3CheckCommand", () => {
9191
});
9292

9393
it("should return error on non-success status", () => {
94-
const command = new ProvideWeb3CheckCommand({
94+
const command = new ProvideTransactionCheckCommand({
9595
payload: new Uint8Array([0xaa]),
9696
isFirstChunk: true,
9797
hasMore: false,

packages/signer/signer-solana/src/internal/app-binder/command/ProvideWeb3CheckCommand.ts renamed to packages/signer/signer-solana/src/internal/app-binder/command/ProvideTransactionCheckCommand.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,31 @@ export const TRANSACTION_CHECK_CLA = 0xe0;
2121
export const TRANSACTION_CHECK_INS = 0x23;
2222
export const TRANSACTION_CHECK_P1_PROVIDE = 0x00;
2323

24-
export type ProvideWeb3CheckCommandArgs = {
24+
export type ProvideTransactionCheckCommandArgs = {
2525
readonly payload: Uint8Array;
2626
readonly isFirstChunk: boolean;
2727
readonly hasMore: boolean;
2828
};
2929

3030
/**
31-
* Sends a chunk of the Web3Checks transaction-check descriptor to the Solana app.
31+
* Sends a chunk of the TransactionChecks transaction-check descriptor to the Solana app.
3232
* P2 uses the standard EXTEND/MORE chunking protocol:
3333
* - Single chunk: P2 = 0x00
3434
* - First of many: P2 = 0x02 (MORE)
3535
* - Middle: P2 = 0x03 (MORE | EXTEND)
3636
* - Last: P2 = 0x01 (EXTEND)
3737
*/
38-
export class ProvideWeb3CheckCommand
39-
implements Command<void, ProvideWeb3CheckCommandArgs, SolanaAppErrorCodes>
38+
export class ProvideTransactionCheckCommand
39+
implements
40+
Command<void, ProvideTransactionCheckCommandArgs, SolanaAppErrorCodes>
4041
{
41-
readonly name = "provideWeb3Check";
42+
readonly name = "provideTransactionCheck";
4243
private readonly errorHelper = new CommandErrorHelper<
4344
void,
4445
SolanaAppErrorCodes
4546
>(SOLANA_APP_ERRORS, SolanaAppCommandErrorFactory);
4647

47-
constructor(private readonly args: ProvideWeb3CheckCommandArgs) {}
48+
constructor(private readonly args: ProvideTransactionCheckCommandArgs) {}
4849

4950
getApdu(): Apdu {
5051
const p2 = buildChunkP2(this.args.isFirstChunk, this.args.hasMore);

packages/signer/signer-solana/src/internal/app-binder/command/Web3CheckOptInCommand.test.ts renamed to packages/signer/signer-solana/src/internal/app-binder/command/TransactionCheckOptInCommand.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ import { isSuccessCommandResult } from "@ledgerhq/device-management-kit";
33
import {
44
TRANSACTION_CHECK_CLA,
55
TRANSACTION_CHECK_INS,
6-
} from "@internal/app-binder/command/ProvideWeb3CheckCommand";
6+
} from "@internal/app-binder/command/ProvideTransactionCheckCommand";
77
import {
88
TRANSACTION_CHECK_P1_OPT_IN,
9-
Web3CheckOptInCommand,
10-
} from "@internal/app-binder/command/Web3CheckOptInCommand";
9+
TransactionCheckOptInCommand,
10+
} from "@internal/app-binder/command/TransactionCheckOptInCommand";
1111

12-
describe("Web3CheckOptInCommand", () => {
12+
describe("TransactionCheckOptInCommand", () => {
1313
describe("name", () => {
14-
it("should be 'web3CheckOptIn'", () => {
15-
const command = new Web3CheckOptInCommand();
16-
expect(command.name).toBe("web3CheckOptIn");
14+
it("should be 'transactionCheckOptIn'", () => {
15+
const command = new TransactionCheckOptInCommand();
16+
expect(command.name).toBe("transactionCheckOptIn");
1717
});
1818
});
1919

2020
describe("getApdu", () => {
2121
it("should return the raw APDU with correct header and dummy payload", () => {
22-
const command = new Web3CheckOptInCommand();
22+
const command = new TransactionCheckOptInCommand();
2323
const apdu = command.getApdu();
2424
const raw = apdu.getRawApdu();
2525

@@ -39,7 +39,7 @@ describe("Web3CheckOptInCommand", () => {
3939
statusCode: Uint8Array.from([0x90, 0x00]),
4040
data: new Uint8Array([0x01]),
4141
};
42-
const result = new Web3CheckOptInCommand().parseResponse(response);
42+
const result = new TransactionCheckOptInCommand().parseResponse(response);
4343
if (isSuccessCommandResult(result)) {
4444
expect(result.data).toStrictEqual({ enabled: true });
4545
} else {
@@ -52,7 +52,7 @@ describe("Web3CheckOptInCommand", () => {
5252
statusCode: Uint8Array.from([0x90, 0x00]),
5353
data: new Uint8Array([0x00]),
5454
};
55-
const result = new Web3CheckOptInCommand().parseResponse(response);
55+
const result = new TransactionCheckOptInCommand().parseResponse(response);
5656
if (isSuccessCommandResult(result)) {
5757
expect(result.data).toStrictEqual({ enabled: false });
5858
} else {
@@ -65,7 +65,7 @@ describe("Web3CheckOptInCommand", () => {
6565
statusCode: Uint8Array.from([0x90, 0x00]),
6666
data: new Uint8Array([]),
6767
};
68-
const result = new Web3CheckOptInCommand().parseResponse(response);
68+
const result = new TransactionCheckOptInCommand().parseResponse(response);
6969
if (isSuccessCommandResult(result)) {
7070
expect(result.data).toStrictEqual({ enabled: false });
7171
} else {

packages/signer/signer-solana/src/internal/app-binder/command/Web3CheckOptInCommand.ts renamed to packages/signer/signer-solana/src/internal/app-binder/command/TransactionCheckOptInCommand.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@ import {
1919
import {
2020
TRANSACTION_CHECK_CLA,
2121
TRANSACTION_CHECK_INS,
22-
} from "./ProvideWeb3CheckCommand";
22+
} from "./ProvideTransactionCheckCommand";
2323

2424
export const TRANSACTION_CHECK_P1_OPT_IN = 0x01;
2525

26-
export type Web3CheckOptInCommandResponse = {
26+
export type TransactionCheckOptInCommandResponse = {
2727
enabled: boolean;
2828
};
2929

3030
/**
31-
* Triggers Web3Checks opt-in on the Solana app.
31+
* Triggers TransactionChecks opt-in on the Solana app.
3232
*/
33-
export class Web3CheckOptInCommand
34-
implements Command<Web3CheckOptInCommandResponse, void, SolanaAppErrorCodes>
33+
export class TransactionCheckOptInCommand
34+
implements
35+
Command<TransactionCheckOptInCommandResponse, void, SolanaAppErrorCodes>
3536
{
36-
readonly name = "web3CheckOptIn";
37+
readonly name = "transactionCheckOptIn";
3738
private readonly errorHelper = new CommandErrorHelper<
38-
Web3CheckOptInCommandResponse,
39+
TransactionCheckOptInCommandResponse,
3940
SolanaAppErrorCodes
4041
>(SOLANA_APP_ERRORS, SolanaAppCommandErrorFactory);
4142

@@ -54,7 +55,7 @@ export class Web3CheckOptInCommand
5455

5556
parseResponse(
5657
response: ApduResponse,
57-
): CommandResult<Web3CheckOptInCommandResponse, SolanaAppErrorCodes> {
58+
): CommandResult<TransactionCheckOptInCommandResponse, SolanaAppErrorCodes> {
5859
return Maybe.fromNullable(
5960
this.errorHelper.getError(response),
6061
).orDefaultLazy(() => {

0 commit comments

Comments
 (0)