@alephium/web3 0.5.0-rc.20 → 0.5.0-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,3 +15,4 @@ export declare function prettifyExactAmount(amount: Number256, decimals: number)
15
15
  export declare function prettifyNumber(amount: Number256, decimals: number, config: IPrettifyNumberConfig): string | undefined;
16
16
  export declare function convertAmountWithDecimals(amount: string | number, decimals: number): bigint | undefined;
17
17
  export declare function convertAlphAmount(amount: string | number): bigint | undefined;
18
+ export declare function number256ToBigint(number: Number256): bigint;
@@ -20,7 +20,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
20
  return (mod && mod.__esModule) ? mod : { "default": mod };
21
21
  };
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.convertAlphAmount = exports.convertAmountWithDecimals = exports.prettifyNumber = exports.prettifyExactAmount = exports.prettifyTokenAmount = exports.prettifyAttoAlphAmount = exports.prettifyNumberConfig = exports.isNumeric = void 0;
23
+ exports.number256ToBigint = exports.convertAlphAmount = exports.convertAmountWithDecimals = exports.prettifyNumber = exports.prettifyExactAmount = exports.prettifyTokenAmount = exports.prettifyAttoAlphAmount = exports.prettifyNumberConfig = exports.isNumeric = void 0;
24
24
  // Credits:
25
25
  // 1. https://github.com/argentlabs/argent-x/blob/e63affa7f28b27333dca4081a3dcd375bb2da40b/packages/extension/src/shared/utils/number.ts
26
26
  // 2. https://github.com/ethers-io/ethers.js/blob/724881f34d428406488a1c9f9dbebe54b6edecda/src.ts/utils/fixednumber.ts
@@ -142,3 +142,7 @@ function convertAlphAmount(amount) {
142
142
  return convertAmountWithDecimals(amount, 18);
143
143
  }
144
144
  exports.convertAlphAmount = convertAlphAmount;
145
+ function number256ToBigint(number) {
146
+ return typeof number === 'string' ? BigInt(number) : number;
147
+ }
148
+ exports.number256ToBigint = number256ToBigint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alephium/web3",
3
- "version": "0.5.0-rc.20",
3
+ "version": "0.5.0-rc.21",
4
4
  "description": "A JS/TS library to interact with the Alephium platform",
5
5
  "license": "GPL",
6
6
  "main": "dist/src/index.js",
@@ -156,3 +156,7 @@ export function convertAmountWithDecimals(amount: string | number, decimals: num
156
156
  export function convertAlphAmount(amount: string | number): bigint | undefined {
157
157
  return convertAmountWithDecimals(amount, 18)
158
158
  }
159
+
160
+ export function number256ToBigint(number: Number256): bigint {
161
+ return typeof number === 'string' ? BigInt(number) : number
162
+ }