Skip to content

Commit

Permalink
feature: added points info function
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Apr 25, 2024
1 parent 886ceeb commit 4b251b9
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
identityShow,
login,
logout,
marketplacePointsInfo,
marketplacePointsShow,
marketplacePointsStake,
oracleStake,
Expand Down Expand Up @@ -606,6 +607,11 @@ program
.option("-a, --address <address>", "Address override")
.action(({ address }) => marketplacePointsShow(address));

points
.command("info")
.description("Shows information about the points")
.action(() => marketplacePointsInfo());

points
.command("stake")
.argument("<address>", "Pool address")
Expand Down
1 change: 1 addition & 0 deletions src/commands/marketplace/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { pointsShow as marketplacePointsShow } from "./points-show";
export { pointsStake as marketplacePointsStake } from "./points-stake";
export { pointsInfo as marketplacePointsInfo } from "./points-info";
17 changes: 17 additions & 0 deletions src/commands/marketplace/points-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { masa } from "../../helpers";

export const pointsInfo = async () => {
if (!masa.marketplace.isContractAvailable) {
console.error(`Marketplace is not available on ${masa.config.networkName}`);
return;
}

const { getAllTokenIdMetadata } = masa.contracts.instances.DataPointsMulti;

console.log(
(await getAllTokenIdMetadata()).map(
(metadata) =>
`${metadata.tokenId.toString()} - ${metadata.metadata.name}`,
),
);
};

0 comments on commit 4b251b9

Please sign in to comment.