From d0d40fc952744ff3e59a1ec0e562849469cbc28f Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 8 Dec 2023 11:06:51 +0100 Subject: [PATCH] update idl and client tokenEdit() --- mango_v4.json | 99 +++++++--- ts/client/src/client.ts | 1 + ts/client/src/clientIxParamBuilder.ts | 2 + ts/client/src/mango_v4.ts | 267 +++++++++++++++++++++----- 4 files changed, 297 insertions(+), 72 deletions(-) diff --git a/mango_v4.json b/mango_v4.json index d052a7e0d..0937feb95 100644 --- a/mango_v4.json +++ b/mango_v4.json @@ -1,5 +1,5 @@ { - "version": "0.20.0", + "version": "0.22.0", "name": "mango_v4", "instructions": [ { @@ -485,6 +485,11 @@ "isMut": false, "isSigner": false }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false + }, { "name": "payer", "isMut": true, @@ -727,6 +732,11 @@ "isMut": false, "isSigner": false }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false + }, { "name": "payer", "isMut": true, @@ -788,6 +798,15 @@ "The oracle account is optional and only used when reset_stable_price is set.", "" ] + }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false, + "docs": [ + "The fallback oracle account is optional and only used when set_fallback_oracle is true.", + "" + ] } ], "args": [ @@ -993,6 +1012,10 @@ "name": "maintWeightShiftAbort", "type": "bool" }, + { + "name": "setFallbackOracle", + "type": "bool" + }, { "name": "depositLimitOpt", "type": { @@ -1699,27 +1722,7 @@ { "name": "oracle", "isMut": true, - "isSigner": false, - "pda": { - "seeds": [ - { - "kind": "const", - "type": "string", - "value": "StubOracle" - }, - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, - { - "kind": "account", - "type": "publicKey", - "account": "Mint", - "path": "mint" - } - ] - } + "isSigner": true }, { "name": "admin", @@ -7388,6 +7391,10 @@ "defined": "I80F48" } }, + { + "name": "fallbackOracle", + "type": "publicKey" + }, { "name": "depositLimit", "docs": [ @@ -7400,7 +7407,7 @@ "type": { "array": [ "u8", - 2000 + 1968 ] } } @@ -7799,12 +7806,16 @@ "name": "registrationTime", "type": "u64" }, + { + "name": "fallbackOracle", + "type": "publicKey" + }, { "name": "reserved", "type": { "array": [ "u8", - 2560 + 2528 ] } } @@ -12234,6 +12245,46 @@ } ] }, + { + "name": "TokenMetaDataLogV2", + "fields": [ + { + "name": "mangoGroup", + "type": "publicKey", + "index": false + }, + { + "name": "mint", + "type": "publicKey", + "index": false + }, + { + "name": "tokenIndex", + "type": "u16", + "index": false + }, + { + "name": "mintDecimals", + "type": "u8", + "index": false + }, + { + "name": "oracle", + "type": "publicKey", + "index": false + }, + { + "name": "fallbackOracle", + "type": "publicKey", + "index": false + }, + { + "name": "mintInfo", + "type": "publicKey", + "index": false + } + ] + }, { "name": "PerpMarketMetaDataLog", "fields": [ diff --git a/ts/client/src/client.ts b/ts/client/src/client.ts index 033e33b61..f21675ab7 100644 --- a/ts/client/src/client.ts +++ b/ts/client/src/client.ts @@ -502,6 +502,7 @@ export class MangoClient { params.maintWeightShiftAssetTarget, params.maintWeightShiftLiabTarget, params.maintWeightShiftAbort ?? false, + params.setFallbackOracle ?? false, params.depositLimit, ) .accounts({ diff --git a/ts/client/src/clientIxParamBuilder.ts b/ts/client/src/clientIxParamBuilder.ts index 17f70963f..f4b2b73e7 100644 --- a/ts/client/src/clientIxParamBuilder.ts +++ b/ts/client/src/clientIxParamBuilder.ts @@ -103,6 +103,7 @@ export interface TokenEditParams { maintWeightShiftAssetTarget: number | null; maintWeightShiftLiabTarget: number | null; maintWeightShiftAbort: boolean | null; + setFallbackOracle: boolean | null; depositLimit: BN | null; } @@ -141,6 +142,7 @@ export const NullTokenEditParams: TokenEditParams = { maintWeightShiftAssetTarget: null, maintWeightShiftLiabTarget: null, maintWeightShiftAbort: null, + setFallbackOracle: null, depositLimit: null, }; diff --git a/ts/client/src/mango_v4.ts b/ts/client/src/mango_v4.ts index b9e779465..f3d1c4e0b 100644 --- a/ts/client/src/mango_v4.ts +++ b/ts/client/src/mango_v4.ts @@ -1,5 +1,5 @@ export type MangoV4 = { - "version": "0.20.0", + "version": "0.22.0", "name": "mango_v4", "instructions": [ { @@ -485,6 +485,11 @@ export type MangoV4 = { "isMut": false, "isSigner": false }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false + }, { "name": "payer", "isMut": true, @@ -727,6 +732,11 @@ export type MangoV4 = { "isMut": false, "isSigner": false }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false + }, { "name": "payer", "isMut": true, @@ -788,6 +798,15 @@ export type MangoV4 = { "The oracle account is optional and only used when reset_stable_price is set.", "" ] + }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false, + "docs": [ + "The fallback oracle account is optional and only used when set_fallback_oracle is true.", + "" + ] } ], "args": [ @@ -993,6 +1012,10 @@ export type MangoV4 = { "name": "maintWeightShiftAbort", "type": "bool" }, + { + "name": "setFallbackOracle", + "type": "bool" + }, { "name": "depositLimitOpt", "type": { @@ -1699,27 +1722,7 @@ export type MangoV4 = { { "name": "oracle", "isMut": true, - "isSigner": false, - "pda": { - "seeds": [ - { - "kind": "const", - "type": "string", - "value": "StubOracle" - }, - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, - { - "kind": "account", - "type": "publicKey", - "account": "Mint", - "path": "mint" - } - ] - } + "isSigner": true }, { "name": "admin", @@ -7388,6 +7391,10 @@ export type MangoV4 = { "defined": "I80F48" } }, + { + "name": "fallbackOracle", + "type": "publicKey" + }, { "name": "depositLimit", "docs": [ @@ -7400,7 +7407,7 @@ export type MangoV4 = { "type": { "array": [ "u8", - 2000 + 1968 ] } } @@ -7799,12 +7806,16 @@ export type MangoV4 = { "name": "registrationTime", "type": "u64" }, + { + "name": "fallbackOracle", + "type": "publicKey" + }, { "name": "reserved", "type": { "array": [ "u8", - 2560 + 2528 ] } } @@ -12234,6 +12245,46 @@ export type MangoV4 = { } ] }, + { + "name": "TokenMetaDataLogV2", + "fields": [ + { + "name": "mangoGroup", + "type": "publicKey", + "index": false + }, + { + "name": "mint", + "type": "publicKey", + "index": false + }, + { + "name": "tokenIndex", + "type": "u16", + "index": false + }, + { + "name": "mintDecimals", + "type": "u8", + "index": false + }, + { + "name": "oracle", + "type": "publicKey", + "index": false + }, + { + "name": "fallbackOracle", + "type": "publicKey", + "index": false + }, + { + "name": "mintInfo", + "type": "publicKey", + "index": false + } + ] + }, { "name": "PerpMarketMetaDataLog", "fields": [ @@ -13610,7 +13661,7 @@ export type MangoV4 = { }; export const IDL: MangoV4 = { - "version": "0.20.0", + "version": "0.22.0", "name": "mango_v4", "instructions": [ { @@ -14096,6 +14147,11 @@ export const IDL: MangoV4 = { "isMut": false, "isSigner": false }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false + }, { "name": "payer", "isMut": true, @@ -14338,6 +14394,11 @@ export const IDL: MangoV4 = { "isMut": false, "isSigner": false }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false + }, { "name": "payer", "isMut": true, @@ -14399,6 +14460,15 @@ export const IDL: MangoV4 = { "The oracle account is optional and only used when reset_stable_price is set.", "" ] + }, + { + "name": "fallbackOracle", + "isMut": false, + "isSigner": false, + "docs": [ + "The fallback oracle account is optional and only used when set_fallback_oracle is true.", + "" + ] } ], "args": [ @@ -14604,6 +14674,10 @@ export const IDL: MangoV4 = { "name": "maintWeightShiftAbort", "type": "bool" }, + { + "name": "setFallbackOracle", + "type": "bool" + }, { "name": "depositLimitOpt", "type": { @@ -15310,27 +15384,7 @@ export const IDL: MangoV4 = { { "name": "oracle", "isMut": true, - "isSigner": false, - "pda": { - "seeds": [ - { - "kind": "const", - "type": "string", - "value": "StubOracle" - }, - { - "kind": "account", - "type": "publicKey", - "path": "group" - }, - { - "kind": "account", - "type": "publicKey", - "account": "Mint", - "path": "mint" - } - ] - } + "isSigner": true }, { "name": "admin", @@ -16604,6 +16658,75 @@ export const IDL: MangoV4 = { } ] }, + { + "name": "serum3CancelOrderByClientOrderId", + "accounts": [ + { + "name": "group", + "isMut": false, + "isSigner": false + }, + { + "name": "account", + "isMut": true, + "isSigner": false, + "relations": [ + "group" + ] + }, + { + "name": "owner", + "isMut": false, + "isSigner": true + }, + { + "name": "openOrders", + "isMut": true, + "isSigner": false + }, + { + "name": "serumMarket", + "isMut": false, + "isSigner": false, + "relations": [ + "group", + "serum_program", + "serum_market_external" + ] + }, + { + "name": "serumProgram", + "isMut": false, + "isSigner": false + }, + { + "name": "serumMarketExternal", + "isMut": true, + "isSigner": false + }, + { + "name": "marketBids", + "isMut": true, + "isSigner": false + }, + { + "name": "marketAsks", + "isMut": true, + "isSigner": false + }, + { + "name": "marketEventQueue", + "isMut": true, + "isSigner": false + } + ], + "args": [ + { + "name": "clientOrderId", + "type": "u64" + } + ] + }, { "name": "serum3CancelAllOrders", "accounts": [ @@ -20930,6 +21053,10 @@ export const IDL: MangoV4 = { "defined": "I80F48" } }, + { + "name": "fallbackOracle", + "type": "publicKey" + }, { "name": "depositLimit", "docs": [ @@ -20942,7 +21069,7 @@ export const IDL: MangoV4 = { "type": { "array": [ "u8", - 2000 + 1968 ] } } @@ -21341,12 +21468,16 @@ export const IDL: MangoV4 = { "name": "registrationTime", "type": "u64" }, + { + "name": "fallbackOracle", + "type": "publicKey" + }, { "name": "reserved", "type": { "array": [ "u8", - 2560 + 2528 ] } } @@ -25776,6 +25907,46 @@ export const IDL: MangoV4 = { } ] }, + { + "name": "TokenMetaDataLogV2", + "fields": [ + { + "name": "mangoGroup", + "type": "publicKey", + "index": false + }, + { + "name": "mint", + "type": "publicKey", + "index": false + }, + { + "name": "tokenIndex", + "type": "u16", + "index": false + }, + { + "name": "mintDecimals", + "type": "u8", + "index": false + }, + { + "name": "oracle", + "type": "publicKey", + "index": false + }, + { + "name": "fallbackOracle", + "type": "publicKey", + "index": false + }, + { + "name": "mintInfo", + "type": "publicKey", + "index": false + } + ] + }, { "name": "PerpMarketMetaDataLog", "fields": [