Skip to content

Commit

Permalink
New account type withdraw_only (#407)
Browse files Browse the repository at this point in the history
* build

* versions
  • Loading branch information
filipzeta authored Jun 24, 2024
1 parent 776062f commit de9fc4d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export enum MarginAccountType {
NORMAL_T7 = 18,
NORMAL_T8 = 19,
NORMAL_T9 = 20,
WITHDRAW_ONLY = 100,
}

export const ZETA_PID: {
Expand Down
8 changes: 8 additions & 0 deletions src/idl/zeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -10260,6 +10260,9 @@
},
{
"name": "NormalT9"
},
{
"name": "WithdrawOnly"
}
]
}
Expand Down Expand Up @@ -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"
}
]
}
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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");
}

Expand Down
16 changes: 16 additions & 0 deletions src/types/zeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10260,6 +10260,9 @@ export type Zeta = {
},
{
"name": "NormalT9"
},
{
"name": "WithdrawOnly"
}
]
}
Expand Down Expand Up @@ -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"
}
]
};
Expand Down Expand Up @@ -21928,6 +21936,9 @@ export const IDL: Zeta = {
},
{
"name": "NormalT9"
},
{
"name": "WithdrawOnly"
}
]
}
Expand Down Expand Up @@ -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"
}
]
};

0 comments on commit de9fc4d

Please sign in to comment.