From de9fc4d7f847ceab4a6020404d1e7eb757dd967c Mon Sep 17 00:00:00 2001 From: filipzeta <103913117+filipzeta@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:43:43 +1000 Subject: [PATCH] New account type withdraw_only (#407) * build * versions --- CHANGELOG.md | 6 ++++++ package.json | 2 +- src/constants.ts | 1 + src/idl/zeta.json | 8 ++++++++ src/types.ts | 6 ++++++ src/types/zeta.ts | 16 ++++++++++++++++ 6 files changed, 38 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d5dc54c..9f2e18e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. Version changes are pinned to SDK releases. +## [1.38.0] + +### Breaking + +- Add new account type withdraw_only. This will break account deserialisation if fetching all accounts and reading one that has withdraw_only set. ([#407](https://github.com/zetamarkets/sdk/pull/407)) + ## [1.37.0] - Move over oracle to new pyth model. ([#406](https://github.com/zetamarkets/sdk/pull/406)) diff --git a/package.json b/package.json index 51e07b8b..869f369c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@zetamarkets/sdk", "repository": "https://github.com/zetamarkets/sdk/", - "version": "1.37.0", + "version": "1.38.0", "description": "Zeta SDK", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/constants.ts b/src/constants.ts index 6dc6942f..293e4cee 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -44,6 +44,7 @@ export enum MarginAccountType { NORMAL_T7 = 18, NORMAL_T8 = 19, NORMAL_T9 = 20, + WITHDRAW_ONLY = 100, } export const ZETA_PID: { diff --git a/src/idl/zeta.json b/src/idl/zeta.json index e35e4ea0..d4c6e01b 100644 --- a/src/idl/zeta.json +++ b/src/idl/zeta.json @@ -10260,6 +10260,9 @@ }, { "name": "NormalT9" + }, + { + "name": "WithdrawOnly" } ] } @@ -11662,6 +11665,11 @@ "code": 6173, "name": "OODoesntMatch", "msg": "Can only pop events for open orders passed in" + }, + { + "code": 6174, + "name": "WithdrawOnlyAccount", + "msg": "Account is restricted, only withdrawals are allowed" } ] } \ No newline at end of file diff --git a/src/types.ts b/src/types.ts index 9375e426..690cd944 100644 --- a/src/types.ts +++ b/src/types.ts @@ -461,6 +461,9 @@ export function fromProgramMarginAccountType( if (objectEquals(accountType, { normalT9: {} })) { return MarginAccountType.NORMAL_T9; } + if (objectEquals(accountType, { withdrawOnly: {} })) { + return MarginAccountType.WITHDRAW_ONLY; + } throw Error("Invalid margin account type"); } @@ -530,6 +533,9 @@ export function toProgramMarginAccountType( if (accountType == MarginAccountType.NORMAL_T9) { return { normalT9: {} }; } + if (accountType == MarginAccountType.WITHDRAW_ONLY) { + return { withdrawOnly: {} }; + } throw Error("Invalid margin account type"); } diff --git a/src/types/zeta.ts b/src/types/zeta.ts index 42b59e85..753a1085 100644 --- a/src/types/zeta.ts +++ b/src/types/zeta.ts @@ -10260,6 +10260,9 @@ export type Zeta = { }, { "name": "NormalT9" + }, + { + "name": "WithdrawOnly" } ] } @@ -11662,6 +11665,11 @@ export type Zeta = { "code": 6173, "name": "OODoesntMatch", "msg": "Can only pop events for open orders passed in" + }, + { + "code": 6174, + "name": "WithdrawOnlyAccount", + "msg": "Account is restricted, only withdrawals are allowed" } ] }; @@ -21928,6 +21936,9 @@ export const IDL: Zeta = { }, { "name": "NormalT9" + }, + { + "name": "WithdrawOnly" } ] } @@ -23330,6 +23341,11 @@ export const IDL: Zeta = { "code": 6173, "name": "OODoesntMatch", "msg": "Can only pop events for open orders passed in" + }, + { + "code": 6174, + "name": "WithdrawOnlyAccount", + "msg": "Account is restricted, only withdrawals are allowed" } ] };