Skip to content

Commit

Permalink
Merge pull request #85 from tinymanorg/fix/pool-info-error
Browse files Browse the repository at this point in the history
Add support for larger numbers
  • Loading branch information
gulcinuras authored Jul 16, 2024
2 parents 8100b9c + 51705ba commit 626835d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/util/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export declare function sendAndWaitRawTransaction(client: Algodv2, signedTxnGrou
}[]>;
export declare function sumUpTxnFees(txns: SignerTransaction[]): number;
export declare function getTxnGroupID(txns: SignerTransaction[]): string;
export declare function encodeInteger(number: any): number[];
export declare function encodeInteger(number: bigint): number[];
/**
* Converts a text into bytes
*/
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tinymanorg/tinyman-js-sdk",
"version": "3.1.1",
"version": "3.1.2",
"description": "Tinyman JS SDK",
"author": "Tinyman Core Team",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/contract/v1_1/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class TinymanContractV1_1 extends BaseTinymanContract<V1_1ValidatorApp> {
let start = v.index - offset;
let end = start + v.length;
// All of the template variables are ints
let value_encoded = encodeInteger(value);
let value_encoded = encodeInteger(BigInt(value));
let diff = v.length - value_encoded.length;

offset += diff;
Expand Down
6 changes: 3 additions & 3 deletions src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,16 +302,16 @@ export function getTxnGroupID(txns: SignerTransaction[]) {
return bufferToBase64(txns[0].txn.group);
}

export function encodeInteger(number) {
export function encodeInteger(number: bigint) {
let buf: number[] = [];

/* eslint-disable no-bitwise */
/* eslint-disable no-constant-condition */
/* eslint-disable no-param-reassign */
while (true) {
let towrite = number & 0x7f;
let towrite = Number(number & BigInt(0x7f));

number >>= 7;
number >>= BigInt(7);

if (number) {
buf.push(towrite | 0x80);
Expand Down

0 comments on commit 626835d

Please sign in to comment.