Skip to content

Commit

Permalink
Add an existing method to XdrLargeInt, jsdoc/types fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Aug 10, 2023
1 parent 7c85cc4 commit 6eb853c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/numbers/sc_int.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ import { XdrLargeInt } from './xdr_large_int';
* // Or reinterpret it as a different type (size permitting):
* const scv = i.toI64();
*
* @param {number|bigint|string|ScInt} value - a single, integer-like value
* which will be interpreted in the smallest appropriate XDR type supported
* by Stellar (64, 128, or 256 bit integer values). signed values are
* supported, though they are sanity-checked against `opts.type`. if you need
* 32-bit values, you can construct them directly without needing this
* wrapper, e.g. `xdr.ScVal.scvU32(1234)`.
* @param {number|bigint|string} value - a single, integer-like value which will
* be interpreted in the smallest appropriate XDR type supported by Stellar
* (64, 128, or 256 bit integer values). signed values are supported, though
* they are sanity-checked against `opts.type`. if you need 32-bit values,
* you can construct them directly without needing this wrapper, e.g.
* `xdr.ScVal.scvU32(1234)`.
*
* @param {object} [opts] - an optional object controlling optional parameters
* @param {string} [opts.type] - force a specific data type. the type choices
Expand Down Expand Up @@ -96,7 +96,7 @@ export class ScInt extends XdrLargeInt {

default:
throw RangeError(
`expected 64/128/256 bits for parts (${value}), got ${bitlen}`
`expected 64/128/256 bits for input (${value}), got ${bitlen}`
);
}
}
Expand Down
3 changes: 2 additions & 1 deletion types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1105,6 +1105,7 @@ export class XdrLargeInt {
toU128(): xdr.ScVal;
toI256(): xdr.ScVal;
toU256(): xdr.ScVal;
toScVal(): xdr.ScVal;

valueOf(): any; // FIXME
toString(): string;
Expand All @@ -1115,7 +1116,7 @@ export class XdrLargeInt {
}

export class ScInt extends XdrLargeInt {
constructor(value: IntLike | ScInt, opts?: { type: ScIntType });
constructor(value: IntLike, opts?: { type: ScIntType });
}

export function scValToBigInt(scv: xdr.ScVal): bigint;
Expand Down

0 comments on commit 6eb853c

Please sign in to comment.