Skip to content

Commit

Permalink
add get all assets (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentine1898 authored Apr 24, 2024
1 parent 085b54e commit 1ee5e67
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @penumbra-labs/registry

## 5.1.0

### Minor Changes

- Get all assets

## 5.0.0

### Major Changes
Expand Down
2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@penumbra-labs/registry",
"version": "5.0.0",
"version": "5.1.0",
"description": "Chain and asset registry for Penumbra",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down
6 changes: 6 additions & 0 deletions npm/src/registry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,10 @@ describe('Registry', () => {
const getCubeMetadata = () => registry.getMetadata(new AssetId({ inner: cubeId }));
expect(getCubeMetadata).toThrow();
});

it('get all assets successfully', () => {
const registry = new Registry(testRegistry);
const res = registry.getAllAssets();
expect(res.length).toEqual(2);
});
});
4 changes: 4 additions & 0 deletions npm/src/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ export class Registry {
}
return metadata;
}

getAllAssets(): Metadata[] {
return Object.values(this.assetById);
}
}

0 comments on commit 1ee5e67

Please sign in to comment.