Skip to content

Commit

Permalink
ts part
Browse files Browse the repository at this point in the history
Signed-off-by: microwavedcola1 <[email protected]>
  • Loading branch information
microwavedcola1 committed Aug 9, 2024
1 parent bd3ab0d commit 1e86640
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ts/client/src/accounts/bank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class Bank implements BankForHealth {
public platformLiquidationFee: I80F48;
public collectedLiquidationFees: I80F48;
public collectedCollateralFees: I80F48;
public tier: string;

static from(
publicKey: PublicKey,
Expand Down Expand Up @@ -151,6 +152,7 @@ export class Bank implements BankForHealth {
collectedLiquidationFees: I80F48Dto;
collectedCollateralFees: I80F48Dto;
collateralFeePerDay: number;
tier: number[];
},
): Bank {
return new Bank(
Expand Down Expand Up @@ -218,6 +220,7 @@ export class Bank implements BankForHealth {
obj.disableAssetLiquidation == 0,
obj.collectedCollateralFees,
obj.collateralFeePerDay,
obj.tier,
obj.forceWithdraw == 1,
);
}
Expand Down Expand Up @@ -287,6 +290,7 @@ export class Bank implements BankForHealth {
public allowAssetLiquidation: boolean,
collectedCollateralFees: I80F48Dto,
public collateralFeePerDay: number,
tier: number[],
public forceWithdraw: boolean,
) {
this.name = utf8.decode(new Uint8Array(name)).split('\x00')[0];
Expand Down Expand Up @@ -325,6 +329,7 @@ export class Bank implements BankForHealth {
this._uiPrice = undefined;
this._oracleLastUpdatedSlot = undefined;
this._oracleProvider = undefined;
this.tier = utf8.decode(new Uint8Array(tier)).split('\x00')[0];
}

toString(): string {
Expand Down
2 changes: 1 addition & 1 deletion ts/client/src/accounts/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ export class Group {
Array.from(this.serum3MarketsMapByExternal.values()).map(
(serum3Market) =>
Market.load(
client.program.provider.connection,
client.program.provider.connection as any,
serum3Market.serumMarketExternal,
{ commitment: client.program.provider.connection.commitment },
OPENBOOK_PROGRAM_ID[client.cluster],
Expand Down
4 changes: 2 additions & 2 deletions ts/client/src/accounts/serum3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class Serum3Market {
this.serumMarketExternal,
);
return await serum3MarketExternal.loadBids(
client.program.provider.connection,
client.program.provider.connection as any,
);
}

Expand All @@ -142,7 +142,7 @@ export class Serum3Market {
this.serumMarketExternal,
);
return await serum3MarketExternal.loadAsks(
client.program.provider.connection,
client.program.provider.connection as any,
);
}

Expand Down
3 changes: 2 additions & 1 deletion ts/client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,7 @@ export class MangoClient {
params.platformLiquidationFee,
params.disableAssetLiquidation,
params.collateralFeePerDay,
params.tier,
)
.accounts({
group: group.publicKey,
Expand Down Expand Up @@ -610,6 +611,7 @@ export class MangoClient {
params.disableAssetLiquidation,
params.collateralFeePerDay,
params.forceWithdraw,
params.tier,
)
.accounts({
group: group.publicKey,
Expand Down Expand Up @@ -1447,7 +1449,6 @@ export class MangoClient {

for (const pp of clonedMangoAccount.perpActive()) {
const perpMarketIndex = pp.marketIndex;
const perpMarket = group.getPerpMarketByMarketIndex(perpMarketIndex);
const deactivatingPositionIx = await this.perpDeactivatePositionIx(
group,
clonedMangoAccount,
Expand Down
4 changes: 4 additions & 0 deletions ts/client/src/clientIxParamBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface TokenRegisterParams {
platformLiquidationFee: number;
disableAssetLiquidation: boolean;
collateralFeePerDay: number;
tier: string;
}

export const DefaultTokenRegisterParams: TokenRegisterParams = {
Expand Down Expand Up @@ -74,6 +75,7 @@ export const DefaultTokenRegisterParams: TokenRegisterParams = {
platformLiquidationFee: 0.0,
disableAssetLiquidation: false,
collateralFeePerDay: 0.0,
tier: '',
};

export interface TokenEditParams {
Expand Down Expand Up @@ -117,6 +119,7 @@ export interface TokenEditParams {
platformLiquidationFee: number | null;
disableAssetLiquidation: boolean | null;
collateralFeePerDay: number | null;
tier: string | null;
forceWithdraw: boolean | null;
}

Expand Down Expand Up @@ -161,6 +164,7 @@ export const NullTokenEditParams: TokenEditParams = {
platformLiquidationFee: null,
disableAssetLiquidation: null,
collateralFeePerDay: null,
tier: null,
forceWithdraw: null,
};

Expand Down

0 comments on commit 1e86640

Please sign in to comment.