Skip to content

Commit

Permalink
Merge branch 'main' into cyr/client
Browse files Browse the repository at this point in the history
  • Loading branch information
brittcyr authored Aug 27, 2024
2 parents cdb0e69 + 14825c8 commit f1a1220
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 0 additions & 2 deletions client/idl/generateIdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ function modifyIdlCore(programName) {
}
}

// TODO: Override u128 price in the output for QuoteAtomsPerBaseAtom

for (const idlAccount of idl.accounts) {
if (idlAccount.type && idlAccount.type.fields) {
idlAccount.type.fields = idlAccount.type.fields.map((field) => {
Expand Down
4 changes: 3 additions & 1 deletion client/ts/src/utils/numbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export function convertU128(n: bignum): number {
} else {
// can only initialize up to 2**53, but need to divide by 10**20.
const divisor = new BN(10 ** 10);
// TODO: This may lose decimals, so after the first divide, convert to number.
if (n.div(divisor) < new BN(2 ** 53 - 1)) {
return n.div(divisor).toNumber() / 10 ** 10;
}
target = n.div(divisor).div(divisor).toNumber();
}
return target;
Expand Down

0 comments on commit f1a1220

Please sign in to comment.