Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ jobs:
- run: pnpm install
- run: pnpm build

typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- uses: jdx/mise-action@5228313ee0372e111a38da051671ca30fc5a96db # v3.6.3
- run: pnpm install
- run: pnpm typecheck

format:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"format": "prettier --write .",
"pretest": "just build-test-canister",
"test": "vitest run",
"typecheck": "tsc --noEmit --skipLibCheck",
"build": "node rmdir.mjs && node esbuild.mjs",
"prepack": "pnpm run build",
"clean": "pnpm run build",
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ async function claimNeurons() {

async function getNeuron(neuronId: bigint) {
const identity = await getIdentity();
const governance = GovernanceCanister.create({
const governance = NnsGovernanceCanister.create({
agent: await getCurrentAgent(identity),
});
const neuron = await governance.getNeuron({
Expand Down
14 changes: 7 additions & 7 deletions src/ledger/identity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class LedgerIdentity extends SignIdentity {
/**
* Connect to a ledger hardware wallet.
*/
private static async _connect(): Promise<[LedgerApp, Transport]> {
private static async _connect(): Promise<[typeof LedgerApp, Transport]> {
async function getTransport() {
if (await TransportWebHID.isSupported()) {
// We're in a web browser.
Expand Down Expand Up @@ -129,7 +129,7 @@ export class LedgerIdentity extends SignIdentity {
}
}
private static async _fetchPublicKeyFromDevice(
app: LedgerApp,
app: typeof LedgerApp,
derivePath: string
): Promise<Secp256k1PublicKey> {
const resp = await app.getAddressAndPubKey(derivePath);
Expand Down Expand Up @@ -168,7 +168,7 @@ export class LedgerIdentity extends SignIdentity {
* and verify the address/pubkey are the same as on the device screen.
*/
public async showAddressAndPubKeyOnDevice(): Promise<void> {
this._executeWithApp(async (app: LedgerApp) => {
this._executeWithApp(async (app: typeof LedgerApp) => {
await app.showAddressAndPubKey(this.derivePath);
});
}
Expand All @@ -177,7 +177,7 @@ export class LedgerIdentity extends SignIdentity {
* @returns The verion of the `Internet Computer' app installed on the Ledger device.
*/
public async getVersion(): Promise<Version> {
return this._executeWithApp(async (app: LedgerApp) => {
return this._executeWithApp(async (app: typeof LedgerApp) => {
const res = await app.getVersion();
if (
isNullish(res.major) ||
Expand All @@ -199,7 +199,7 @@ export class LedgerIdentity extends SignIdentity {
}

public async getSupportedTokens(): Promise<TokenInfo[]> {
return this._executeWithApp(async (app: LedgerApp) => {
return this._executeWithApp(async (app: typeof LedgerApp) => {
const res = await app.tokenRegistry();
if (nonNullish(res.tokenRegistry)) {
return res.tokenRegistry;
Expand All @@ -217,7 +217,7 @@ export class LedgerIdentity extends SignIdentity {
}

public async sign(blob: Uint8Array): Promise<Signature> {
return await this._executeWithApp(async (app: LedgerApp) => {
return await this._executeWithApp(async (app: typeof LedgerApp) => {
const resp: ResponseSign = await app.sign(
this.derivePath,
Buffer.from(blob),
Expand Down Expand Up @@ -267,7 +267,7 @@ export class LedgerIdentity extends SignIdentity {
}

private async _executeWithApp<T>(
func: (app: LedgerApp) => Promise<T>
func: (app: typeof LedgerApp) => Promise<T>
): Promise<T> {
const [app, transport] = await LedgerIdentity._connect();

Expand Down
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"module": "CommonJS",
"module": "preserve",
"target": "esnext",
"lib": ["esnext", "dom"],
"strict": true,
Expand All @@ -9,5 +9,6 @@
"moduleResolution": "bundler",
"outDir": "dist",
"resolveJsonModule": true
}
},
"exclude": ["scripts"]
}
Loading