Skip to content

Commit

Permalink
fix: keep denomination with quantity init value
Browse files Browse the repository at this point in the history
  • Loading branch information
martonlederer committed Apr 13, 2024
1 parent f25beb2 commit f64e19b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Quantity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ export default class Quantity {
throw new Error("Could not convert object to quantity");
}

base = base.clone();
base._convert(this.#D);
this.#qty = base.#qty;
this.#D = base.#D;
break;
case "undefined":
break;
Expand Down
11 changes: 11 additions & 0 deletions src/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ export class TokenInstance {
return this.#info;
}

/**
* Get a quantity instance for this token. The instance
* will have the token's denomination defined by default.
*/
get Quantity() {
return new Quantity(
0n,
this.info.Denomination
);
}

/**
* Get balance for an address
* @param address Wallet address
Expand Down

0 comments on commit f64e19b

Please sign in to comment.