Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New asset - EIGEN #421

Merged
merged 5 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.46.0]

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

## [1.45.2]

- Fix typo in popcat asset.ts. ([#418](https://github.com/zetamarkets/sdk/pull/418))
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.45.2",
"version": "1.46.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 @@ -67,6 +67,7 @@ export function assetToName(asset: Asset): string | null {
if (asset == Asset.RNDR) return "RNDR";
if (asset == Asset.TNSR) return "TNSR";
if (asset == Asset.POPCAT) return "POPCAT";
if (asset == Asset.EIGEN) return "EIGEN";
if (asset == null) return null; // Some things, like clock callbacks, are for all assets and return asset=null
return "UNDEFINED";
}
Expand All @@ -90,6 +91,7 @@ export function nameToAsset(name: string): Asset {
if (name == "RNDR") return Asset.RNDR;
if (name == "TNSR") return Asset.TNSR;
if (name == "POPCAT") return Asset.POPCAT;
if (name == "EIGEN") return Asset.EIGEN;
return Asset.UNDEFINED;
}

Expand All @@ -116,6 +118,7 @@ export function toProgramAsset(asset: Asset): any {
if (asset == Asset.RNDR) return { rndr: {} };
if (asset == Asset.TNSR) return { tnsr: {} };
if (asset == Asset.POPCAT) return { popcat: {} };
if (asset == Asset.EIGEN) return { eigen: {} };
return { undefined: {} };
}

Expand Down Expand Up @@ -174,6 +177,9 @@ export function fromProgramAsset(asset: any): Asset {
if (objectEquals(asset, { popcat: {} })) {
return Asset.POPCAT;
}
if (objectEquals(asset, { eigen: {} })) {
return Asset.EIGEN;
}
return Asset.UNDEFINED;
}

Expand Down Expand Up @@ -233,6 +239,9 @@ export function assetToIndex(asset: Asset): number {
case Asset.POPCAT: {
return 17;
}
case Asset.EIGEN: {
return 18;
}
}
return 255; // Undefined is 255 onchain
}
Expand Down Expand Up @@ -293,6 +302,9 @@ export function indexToAsset(index: number): Asset {
case 17: {
return Asset.POPCAT;
}
case 18: {
return Asset.EIGEN;
}
}
return Asset.UNDEFINED;
}
Expand Down
98 changes: 46 additions & 52 deletions src/constants.ts

Large diffs are not rendered by default.

Loading