Skip to content

Commit

Permalink
Fix bigint in encodeJson (#109)
Browse files Browse the repository at this point in the history
* Fix bigint in encodeJson

* Fix typo
  • Loading branch information
rosepuppy authored Jan 24, 2024
1 parent 90c62d9 commit 998daec
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions v4-client-js/__native__/__ios__/v4-native-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -202360,7 +202360,7 @@ function encodeJson(object, byteArrayEncoding = ByteArrayEncoding.HEX) {
if (value instanceof bignumber_js_1.default) {
return value.toString();
}
if (value instanceof BigInt) {
if (typeof value === 'bigint') {
return value.toString();
}
if (value instanceof long_1.default) {
Expand All @@ -202386,7 +202386,7 @@ function encodeJson(object, byteArrayEncoding = ByteArrayEncoding.HEX) {
});
}
exports.encodeJson = encodeJson;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvaGVscGVycy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSwrQ0FBeUM7QUFDekMsZ0VBQXFDO0FBQ3JDLGdEQUF3QjtBQUd4QiwyQ0FBK0M7QUFFL0M7Ozs7O0dBS0c7QUFDSCxTQUFnQixzQ0FBc0MsQ0FDcEQseUJBQXFEO0lBRXJELElBQUkseUJBQXlCLEtBQUssU0FBUyxFQUFFO1FBQzNDLE9BQU8sU0FBUyxDQUFDO0tBQ2xCO0lBRUQsT0FBTztRQUNMLFFBQVEsRUFBRSw0QkFBZ0I7UUFDMUIsR0FBRyx5QkFBeUI7S0FDN0IsQ0FBQztBQUNKLENBQUM7QUFYRCx3RkFXQztBQUVEOzs7OztHQUtHO0FBQ0gsU0FBZ0IsY0FBYyxDQUFDLEtBQWE7SUFDMUMsSUFBSSxLQUFLLENBQUMsT0FBTyxDQUFDLElBQUksQ0F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EVBQUU7WUFDdkMsSUFBSSxpQkFBaUIsS0FBSyxpQkFBaUIsQ0FBQyxHQUFHLEVBQUU7Z0JBQy9DLE9BQU8sSUFBQSxnQkFBSyxFQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsQ0FBQzthQUM1QjtpQkFBTTtnQkFDTCxPQUFPLFFBQVEsQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDLENBQUMsUUFBUSxFQUFFLENBQUM7YUFDMUM7U0FDRjthQUFNLElBQUksS0FBSyxZQUFZLFVBQVUsRUFBRTtZQUN0QyxJQUFJLGlCQUFpQixLQUFLLGlCQUFpQixDQUFDLEdBQUcsRUFBRTtnQkFDL0MsT0FBTyxJQUFBLGdCQUFLLEVBQUMsS0FBSyxDQUFDLENBQUM7YUFDckI7aUJBQU07Z0JBQ0wsT0FBTyxRQUFRLENBQUMsS0FBSyxDQUFDLENBQUMsUUFBUSxFQUFFLENBQUM7YUFDbkM7U0FDRjtRQUNELE9BQU8sS0FBSyxDQUFDO0lBQ2YsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDO0FBaENELGdDQWdDQyJ9

/***/ }),

Expand Down
4 changes: 2 additions & 2 deletions v4-client-js/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 v4-client-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dydxprotocol/v4-client-js",
"version": "1.0.14",
"version": "1.0.15",
"description": "General client library for the new dYdX system (v4 decentralized)",
"main": "build/src/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/src/clients/native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ export async function withdrawToNobleIBC(payload: string): Promise<String> {
...parsedIbcPayload.msg,
// Squid returns timeoutTimestamp as Long, but the signer expects BigInt
timeoutTimestamp: parsedIbcPayload.msg.timeoutTimestamp
? BigInt(Long.fromValue(json.msg.timeoutTimestamp).toString())
? BigInt(Long.fromValue(parsedIbcPayload.msg.timeoutTimestamp).toString())
: undefined,
},
};
Expand Down
2 changes: 1 addition & 1 deletion v4-client-js/src/lib/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function encodeJson(
if (value instanceof BigNumber) {
return value.toString();
}
if (value instanceof BigInt) {
if (typeof value === 'bigint') {
return value.toString();
}
if (value instanceof Long) {
Expand Down

0 comments on commit 998daec

Please sign in to comment.