Skip to content

Commit

Permalink
New asset GOAT (#423)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipzeta authored Nov 4, 2024
1 parent 78f1b93 commit 5cb34a6
Show file tree
Hide file tree
Showing 8 changed files with 578 additions and 469 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.49.0]

- New asset GOAT. ([#422](https://github.com/zetamarkets/sdk/pull/423))

## [1.48.0]

- Skipped

## [1.47.0]

- New asset DBR. ([#422](https://github.com/zetamarkets/sdk/pull/422))
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.47.0",
"version": "1.49.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 @@ -69,6 +69,7 @@ export function assetToName(asset: Asset): string | null {
if (asset == Asset.POPCAT) return "POPCAT";
if (asset == Asset.EIGEN) return "EIGEN";
if (asset == Asset.DBR) return "DBR";
if (asset == Asset.GOAT) return "GOAT";
if (asset == null) return null; // Some things, like clock callbacks, are for all assets and return asset=null
return "UNDEFINED";
}
Expand All @@ -94,6 +95,7 @@ export function nameToAsset(name: string): Asset {
if (name == "POPCAT") return Asset.POPCAT;
if (name == "EIGEN") return Asset.EIGEN;
if (name == "DBR") return Asset.DBR;
if (name == "GOAT") return Asset.GOAT;
return Asset.UNDEFINED;
}

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

Expand Down Expand Up @@ -186,6 +189,9 @@ export function fromProgramAsset(asset: any): Asset {
if (objectEquals(asset, { dbr: {} })) {
return Asset.DBR;
}
if (objectEquals(asset, { goat: {} })) {
return Asset.GOAT;
}
return Asset.UNDEFINED;
}

Expand Down Expand Up @@ -251,6 +257,9 @@ export function assetToIndex(asset: Asset): number {
case Asset.DBR: {
return 19;
}
case Asset.GOAT: {
return 20;
}
}
return 255; // Undefined is 255 onchain
}
Expand Down Expand Up @@ -317,6 +326,9 @@ export function indexToAsset(index: number): Asset {
case 19: {
return Asset.DBR;
}
case 20: {
return Asset.GOAT;
}
}
return Asset.UNDEFINED;
}
Expand Down
568 changes: 305 additions & 263 deletions src/constants.ts

Large diffs are not rendered by default.

Loading

0 comments on commit 5cb34a6

Please sign in to comment.