Skip to content

Commit

Permalink
chore(types): relax to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Jan 9, 2025
1 parent db1c812 commit 1940c71
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/// <reference types="@agoric/zoe/src/contractSupport/types-ambient"/>

//Exports all handler functions
export * from './mappings/mappingHandlers';
11 changes: 10 additions & 1 deletion src/mappings/events/vaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const vaultsEventKit = (block: CosmosBlock, data: StreamCell, module: str
oldState: string | undefined,
newState: string,
blockTime: ReadonlyDateWithNanoseconds,
blockHeight: number,
blockHeight: string,
): Promise<[VaultStatesDaily, VaultStatesDaily]> {
let vaultState: VaultStatesDaily | undefined = await VaultStatesDaily.get('latest');

Expand Down Expand Up @@ -129,10 +129,15 @@ export const vaultsEventKit = (block: CosmosBlock, data: StreamCell, module: str
vault = new Vault(path, BigInt(data.blockHeight), block.block.header.time as Date, '');
}

// @ts-expect-error see resolveBrandNamesAndValues
vault.coin = payload?.locked?.__brand;
// @ts-expect-error see resolveBrandNamesAndValues
vault.denom = payload?.locked?.__brand;
// @ts-expect-error see resolveBrandNamesAndValues
vault.debt = BigInt(payload?.debtSnapshot?.debt?.__value);
// @ts-expect-error see resolveBrandNamesAndValues
vault.balance = BigInt(payload?.locked?.__value);
// @ts-expect-error see resolveBrandNamesAndValues
vault.lockedValue = BigInt(payload?.locked?.__value);
vault.state = payload?.vaultState;

Expand All @@ -148,6 +153,7 @@ export const vaultsEventKit = (block: CosmosBlock, data: StreamCell, module: str
const id = `${path}-${payload?.vaultState}`;
const liquidatingId = `${path}-${VAULT_STATES.LIQUIDATING}`;

// @ts-expect-error see resolveBrandNamesAndValues
const denom = payload?.locked?.__brand;

let vault = await VaultLiquidation.get(id);
Expand Down Expand Up @@ -187,8 +193,11 @@ export const vaultsEventKit = (block: CosmosBlock, data: StreamCell, module: str

vault.coin = denom;
vault.denom = denom;
// @ts-expect-error see resolveBrandNamesAndValues
vault.debt = payload?.debtSnapshot?.debt?.__value;
// @ts-expect-error see resolveBrandNamesAndValues
vault.balance = payload?.locked?.__value;
// @ts-expect-error see resolveBrandNamesAndValues
vault.lockedValue = payload?.locked?.__value;
vault.state = payload?.vaultState;
return vault.save();
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@
"rootDir": "src",
"target": "es2017",
"strict": true,
"noImplicitAny": false,
// UNTIL package-json-type and ejs packages have types
"skipLibCheck": true,
"lib": [
"es2021"
]
},
"exclude": [
// generated code has typecheck error
"src/types/proto-interfaces/**",
],
"include": [
"src/**/*",
"src",
"node_modules/@subql/types-core/dist/global.d.ts",
"node_modules/@subql/types-cosmos/dist/global.d.ts"
]
Expand Down

0 comments on commit 1940c71

Please sign in to comment.