ts: Make oracle arg optional in edit calls

This commit is contained in:
Christian Kamm 2022-12-09 13:21:36 +01:00
parent a91ff847f2
commit 29055199ae
1 changed files with 5 additions and 8 deletions

View File

@ -280,7 +280,7 @@ export class MangoClient {
public async tokenEdit( public async tokenEdit(
group: Group, group: Group,
mintPk: PublicKey, mintPk: PublicKey,
oracle: PublicKey, // TODO: do we need an extra param for resetting stable_price_model? oracle: PublicKey | null,
oracleConfig: OracleConfigParams | null, oracleConfig: OracleConfigParams | null,
groupInsuranceFund: boolean | null, groupInsuranceFund: boolean | null,
interestRateParams: InterestRateParams | null, interestRateParams: InterestRateParams | null,
@ -335,7 +335,7 @@ export class MangoClient {
) )
.accounts({ .accounts({
group: group.publicKey, group: group.publicKey,
oracle, oracle: oracle ?? bank.oracle,
admin: (this.program.provider as AnchorProvider).wallet.publicKey, admin: (this.program.provider as AnchorProvider).wallet.publicKey,
mintInfo: mintInfo.publicKey, mintInfo: mintInfo.publicKey,
}) })
@ -392,10 +392,7 @@ export class MangoClient {
return await sendTransaction( return await sendTransaction(
this.program.provider as AnchorProvider, this.program.provider as AnchorProvider,
[ [...preInstructions, ix],
...preInstructions,
ix,
],
group.addressLookupTablesList, group.addressLookupTablesList,
{ {
postSendTxCallback: this.postSendTxCallback, postSendTxCallback: this.postSendTxCallback,
@ -1496,7 +1493,7 @@ export class MangoClient {
public async perpEditMarket( public async perpEditMarket(
group: Group, group: Group,
perpMarketIndex: PerpMarketIndex, perpMarketIndex: PerpMarketIndex,
oracle: PublicKey, // TODO: do we need an extra param for resetting stable_price_model oracle: PublicKey | null, // TODO: stable price resetting should be a separate flag
oracleConfig: OracleConfigParams | null, oracleConfig: OracleConfigParams | null,
baseDecimals: number | null, baseDecimals: number | null,
maintAssetWeight: number | null, maintAssetWeight: number | null,
@ -1554,7 +1551,7 @@ export class MangoClient {
) )
.accounts({ .accounts({
group: group.publicKey, group: group.publicKey,
oracle, oracle: oracle ?? perpMarket.oracle,
admin: (this.program.provider as AnchorProvider).wallet.publicKey, admin: (this.program.provider as AnchorProvider).wallet.publicKey,
perpMarket: perpMarket.publicKey, perpMarket: perpMarket.publicKey,
}) })