Skip to content

Commit

Permalink
New asset - DRIFT (#426)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Nov 12, 2024
1 parent 10efca4 commit fff5d6c
Show file tree
Hide file tree
Showing 7 changed files with 438 additions and 338 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
Version changes are pinned to SDK releases.

## [1.52.0]

- New asset DRIFT. ([#426](https://github.com/zetamarkets/sdk/pull/426))

## [1.51.0]

- Skipped

## [1.50.0]

- Remove -151 magic number from blockhash confirmation ([#425](https://github.com/zetamarkets/sdk/pull/425))
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.50.0",
"version": "1.52.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 @@ -70,6 +70,7 @@ export function assetToName(asset: Asset): string | null {
if (asset == Asset.EIGEN) return "EIGEN";
if (asset == Asset.DBR) return "DBR";
if (asset == Asset.GOAT) return "GOAT";
if (asset == Asset.DRIFT) return "DRIFT";
if (asset == null) return null; // Some things, like clock callbacks, are for all assets and return asset=null
return "UNDEFINED";
}
Expand All @@ -96,6 +97,7 @@ export function nameToAsset(name: string): Asset {
if (name == "EIGEN") return Asset.EIGEN;
if (name == "DBR") return Asset.DBR;
if (name == "GOAT") return Asset.GOAT;
if (name == "DRIFT") return Asset.DRIFT;
return Asset.UNDEFINED;
}

Expand Down Expand Up @@ -125,6 +127,7 @@ export function toProgramAsset(asset: Asset): any {
if (asset == Asset.EIGEN) return { eigen: {} };
if (asset == Asset.DBR) return { dbr: {} };
if (asset == Asset.GOAT) return { goat: {} };
if (asset == Asset.DRIFT) return { drift: {} };
return { undefined: {} };
}

Expand Down Expand Up @@ -192,6 +195,9 @@ export function fromProgramAsset(asset: any): Asset {
if (objectEquals(asset, { goat: {} })) {
return Asset.GOAT;
}
if (objectEquals(asset, { drift: {} })) {
return Asset.DRIFT;
}
return Asset.UNDEFINED;
}

Expand Down Expand Up @@ -260,6 +266,9 @@ export function assetToIndex(asset: Asset): number {
case Asset.GOAT: {
return 20;
}
case Asset.DRIFT: {
return 21;
}
}
return 255; // Undefined is 255 onchain
}
Expand Down Expand Up @@ -329,6 +338,9 @@ export function indexToAsset(index: number): Asset {
case 20: {
return Asset.GOAT;
}
case 21: {
return Asset.DRIFT;
}
}
return Asset.UNDEFINED;
}
Expand Down
291 changes: 162 additions & 129 deletions src/constants.ts

Large diffs are not rendered by default.

Loading

0 comments on commit fff5d6c

Please sign in to comment.