Skip to content

Commit

Permalink
New asset - EIGEN (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Oct 4, 2024
1 parent 8976b89 commit 1b3bfa9
Show file tree
Hide file tree
Showing 7 changed files with 306 additions and 249 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.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

0 comments on commit 1b3bfa9

Please sign in to comment.