Skip to content

Commit

Permalink
w (#377)
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinlau20100 authored Apr 5, 2024
1 parent 9dfcdb1 commit 226e42c
Show file tree
Hide file tree
Showing 8 changed files with 557 additions and 197 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this file.
Version changes are pinned to SDK releases.

## [1.26.0]

- Add W. ([#377](https://github.com/zetamarkets/sdk/pull/377))

## [1.25.3]

- Fix rounding in util functions. ([#375](https://github.com/zetamarkets/sdk/pull/375))
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.25.3",
"version": "1.26.0",
"description": "Zeta SDK",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
12 changes: 12 additions & 0 deletions src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export function assetToName(asset: Asset): string | null {
if (asset == Asset.JUP) return "JUP";
if (asset == Asset.DYM) return "DYM";
if (asset == Asset.STRK) return "STRK";
if (asset == Asset.W) return "W";
if (asset == null) return null; // Some things, like clock callbacks, are for all assets and return asset=null
return "UNDEFINED";
}
Expand All @@ -82,6 +83,7 @@ export function nameToAsset(name: string): Asset {
if (name == "JUP") return Asset.JUP;
if (name == "DYM") return Asset.DYM;
if (name == "STRK") return Asset.STRK;
if (name == "W") return Asset.W;
return Asset.UNDEFINED;
}

Expand All @@ -104,6 +106,7 @@ export function toProgramAsset(asset: Asset): any {
if (asset == Asset.JUP) return { jup: {} };
if (asset == Asset.DYM) return { dym: {} };
if (asset == Asset.STRK) return { strk: {} };
if (asset == Asset.W) return { w: {} };
return { undefined: {} };
}

Expand Down Expand Up @@ -150,6 +153,9 @@ export function fromProgramAsset(asset: any): Asset {
if (objectEquals(asset, { strk: {} })) {
return Asset.STRK;
}
if (objectEquals(asset, { w: {} })) {
return Asset.W;
}
return Asset.UNDEFINED;
}

Expand Down Expand Up @@ -197,6 +203,9 @@ export function assetToIndex(asset: Asset): number {
case Asset.STRK: {
return 13;
}
case Asset.W: {
return 14;
}
}
return 255; // Undefined is 255 onchain
}
Expand Down Expand Up @@ -245,6 +254,9 @@ export function indexToAsset(index: number): Asset {
case 13: {
return Asset.STRK;
}
case 14: {
return Asset.W;
}
}
return Asset.UNDEFINED;
}
Expand Down
26 changes: 22 additions & 4 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export enum Asset {
JUP = "JUP",
DYM = "DYM",
STRK = "STRK",
W = "W",
UNDEFINED = "UNDEFINED",
}

Expand Down Expand Up @@ -76,6 +77,7 @@ export const FLEX_MINTS = {
[Asset.JUP]: new PublicKey("rYFexooTE27wUDaJsjpy8UdyKqUHxroPvfB2Hgmajjt"),
[Asset.DYM]: new PublicKey("EgsE6WkPfaNT9iEDyrUmNb4C4jCaJ6BPC9wZsp6CdRFj"),
[Asset.STRK]: new PublicKey("7dEBs64vVgs8Ws3DkK7cwxSMe9RzQ21pnYawXgFaxisp"),
[Asset.W]: new PublicKey("BgDrDxc75EqPTXPUTCFMnYVYPeWK3CimPz2LGw4egsYc"),
},
devnet: {
[Asset.APT]: new PublicKey("FbfkphUHaAd7c27RqhzKBRAPX8T5AzFBH259sbGmNuvG"),
Expand All @@ -96,6 +98,7 @@ export const FLEX_MINTS = {
[Asset.JUP]: new PublicKey("7uP5h7kxRaSbd2dz5e6gZp8yhqazyMvaXVoNZ4HsgZ2n"),
[Asset.DYM]: new PublicKey("FxxBzHfSZc794sRw6aLs7KuaG9iBy1hSLLFV8LLQYAiL"),
[Asset.STRK]: new PublicKey("C42HXAXQiV6EqxzTvmwff6FgCPNw7r2MgvJ9uv8UNdce"),
[Asset.W]: new PublicKey("7jCmRqJaJq5iojCwGqq5DdwUBYPhrpvJcgNZsFLM4Pd5"),
},
};

Expand Down Expand Up @@ -242,6 +245,7 @@ export const PYTH_PRICE_FEEDS = {
[Asset.JUP]: new PublicKey("8uMQw668EowuxXcX6oYohLepTCoZmk9WEnj224qevLqj"),
[Asset.DYM]: new PublicKey("9XFg7LwjRp2UjqkdiEdeA9wSNovgc5v9iW231UMfeSDz"),
[Asset.STRK]: new PublicKey("6gtqwzdgeb8Luay2BSbyn3tobqfr3tWjdyP2tsySSiJu"),
[Asset.W]: new PublicKey("Ae9pWfoS4jS8WFxMTApKHkmMaod171aRcekm1iFbsmoy"),
},
devnet: {
[Asset.SOL]: new PublicKey("J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"),
Expand Down Expand Up @@ -270,6 +274,7 @@ export const PYTH_PRICE_FEEDS = {
[Asset.JUP]: new PublicKey("g6eRCbboSwK4tSWngn773RCMexr1APQr4uA9bGZBYfo"),
[Asset.DYM]: new PublicKey("CSRRrhXa6DYu1W5jf89A7unCATdug2Z33tYyV2NXZZxa"),
[Asset.STRK]: new PublicKey("899ZkaKUTFZprwCAY3xnSAdWs3Ma6oDW3YqX8zpis1No"),
[Asset.W]: new PublicKey("H9j8CT1bFiWHaZUPMooEaxMRHdWdJ5T9CzFn41z96JHW"),
},
};

Expand All @@ -294,8 +299,8 @@ export const ACTIVE_MARKETS = ACTIVE_EXPIRIES * PRODUCTS_PER_EXPIRY + 1; // +1 f
export const TOTAL_EXPIRIES = 5;
export const TOTAL_MARKETS = PRODUCTS_PER_EXPIRY * (TOTAL_EXPIRIES + 1);
export const PERP_INDEX = TOTAL_MARKETS - 1;
export const ACTIVE_PERP_MARKETS = 14;
export const UNUSED_PERP_MARKETS = 11;
export const ACTIVE_PERP_MARKETS = 15;
export const UNUSED_PERP_MARKETS = 10;

export const DEFAULT_EXCHANGE_POLL_INTERVAL = 30;
export const DEFAULT_MARKET_POLL_INTERVAL = 5;
Expand Down Expand Up @@ -454,8 +459,8 @@ export const STATIC_AND_PERPS_LUT: {
key: new PublicKey("GYCrZc3MkTtLYiYGvcVMZUeqGZwP6S9bVGAbXASGeNtD"),
state: {
deactivationSlot: BigInt("18446744073709551615"),
lastExtendedSlot: 249727678,
lastExtendedSlotStartIndex: 176,
lastExtendedSlot: 258417825,
lastExtendedSlotStartIndex: 189,
authority: new PublicKey("EwXPBSBUPqYDNA3dUVZ3nonFuaw3wGGJqEUTJbknDirH"),
addresses: [
new PublicKey("8eExPiLp47xbSDYkbuem4qnLUpbLTfZBeFuEJoh6EUr2"),
Expand Down Expand Up @@ -647,6 +652,19 @@ export const STATIC_AND_PERPS_LUT: {
new PublicKey("HpTGysQZFppoLQcRrfFu47teEajxharPP7f19XJuKU16"),
new PublicKey("ygRrmycNpMzEsqLYRpDMS9J1SHaFMG4Rm3tjkyVGVnc"),
new PublicKey("EV1UdC9dSz7a66hqYW5TkVe6JihSAyfEwVLwYzy1cGXz"),
new PublicKey("H9j8CT1bFiWHaZUPMooEaxMRHdWdJ5T9CzFn41z96JHW"),
new PublicKey("11111111111111111111111111111111"),
new PublicKey("EPgAyxa8GJiQzy9pgiTA3bRinxfzyiNxDhorr1KGUznB"),
new PublicKey("AXrWGEh3c8Jiz2Uhr6kiUxYypjgVYanm48jSWhXjudV8"),
new PublicKey("8CCrvJUSFta3HMRSFSM5M1LUX2MeFHT5Wcgjo55HQCqC"),
new PublicKey("7iXjCwhQg9sVys8Ze7Ybusf7WECJBABAmWvGxVMVfX7F"),
new PublicKey("GcMVDi71RqWuBGgxSo8LKPoSCSkzPXAGmMnr3t5fJZar"),
new PublicKey("FnDtHqrTuySW94Yy3QFYjMtvyYuJkRp3H6xtDDG1Ehi"),
new PublicKey("KsUoxhYnaTUFTJ6SuAdAAmUBVrExhCq7SXE7BCu5irh"),
new PublicKey("9JZFuP5C78QvDrz3HucskAU6uog3XkoEa4Tbwxs3TTgY"),
new PublicKey("HHvs3T3rcFnZFiTdKn5eXwg1w9ADGB98CpyprHW7jYMB"),
new PublicKey("GpvkM2TeZXqQzFtBBgqoJYfc3BPScEHaSk41dwMrsKiW"),
new PublicKey("H3j7orNNo7pzzHJZ1WFsrpJAxWCiE8QW3aatbGufu2PC"),
],
},
}),
Expand Down
Loading

0 comments on commit 226e42c

Please sign in to comment.