From 83502136f080fcc956a1e53002d850a06b9e5c01 Mon Sep 17 00:00:00 2001 From: mike-dydx Date: Mon, 5 Feb 2024 16:10:56 -0500 Subject: [PATCH 1/4] add native functions for getWithdrawalAndTransferGatingStatus and getWithdrawalCapacityByDenom --- v4-client-js/src/clients/native.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/v4-client-js/src/clients/native.ts b/v4-client-js/src/clients/native.ts index 2a34cc3a..27ffe0a2 100644 --- a/v4-client-js/src/clients/native.ts +++ b/v4-client-js/src/clients/native.ts @@ -1184,3 +1184,23 @@ export async function cctpWithdraw(squidPayload: string): Promise { return wrappedError(error); } } + +export async function getWithdrawalCapacityByDenom(denom: string): Promise { + try { + const validatorClient = globalThis.client.validatorClient; + const result = await validatorClient.get.getWithdrawalCapacityByDenom(denom); + return encodeJson(result); + } catch (e) { + return wrappedError(e); + } +} + +export async function getWithdrawalAndTransferGatingStatus(): Promise { + try { + const validatorClient = globalThis.client.validatorClient; + const result = await validatorClient.get.GetWithdrawalAndTransferGatingStatus(); + return encodeJson(result); + } catch (e) { + return wrappedError(e); + } +} From 5cb537225cca204fede6e2745f14e3258feddfb1 Mon Sep 17 00:00:00 2001 From: mike-dydx Date: Wed, 20 Mar 2024 18:35:46 -0400 Subject: [PATCH 2/4] Update native.ts --- v4-client-js/src/clients/native.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/v4-client-js/src/clients/native.ts b/v4-client-js/src/clients/native.ts index 27ffe0a2..7f29d631 100644 --- a/v4-client-js/src/clients/native.ts +++ b/v4-client-js/src/clients/native.ts @@ -1189,7 +1189,7 @@ export async function getWithdrawalCapacityByDenom(denom: string): Promise { try { const validatorClient = globalThis.client.validatorClient; const result = await validatorClient.get.GetWithdrawalAndTransferGatingStatus(); - return encodeJson(result); + return encodeJson(result, ByteArrayEncoding.BIGINT); } catch (e) { return wrappedError(e); } From 686057eeadf55eba6d04568e1d1d2935325370a3 Mon Sep 17 00:00:00 2001 From: mike-dydx Date: Tue, 2 Apr 2024 14:24:25 -0400 Subject: [PATCH 3/4] bump version --- v4-client-js/package-lock.json | 4 ++-- v4-client-js/package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/v4-client-js/package-lock.json b/v4-client-js/package-lock.json index e656b885..942e032d 100644 --- a/v4-client-js/package-lock.json +++ b/v4-client-js/package-lock.json @@ -1,12 +1,12 @@ { "name": "@dydxprotocol/v4-client-js", - "version": "1.1.0", + "version": "1.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@dydxprotocol/v4-client-js", - "version": "1.1.0", + "version": "1.1.1", "license": "AGPL-3.0", "dependencies": { "@cosmjs/amino": "^0.32.1", diff --git a/v4-client-js/package.json b/v4-client-js/package.json index 62da8e11..18f413c7 100644 --- a/v4-client-js/package.json +++ b/v4-client-js/package.json @@ -1,6 +1,6 @@ { "name": "@dydxprotocol/v4-client-js", - "version": "1.1.0", + "version": "1.1.1", "description": "General client library for the new dYdX system (v4 decentralized)", "main": "build/src/index.js", "scripts": { From 6019335c18400732a2cdd07969bc9be0705095fa Mon Sep 17 00:00:00 2001 From: mike-dydx Date: Tue, 2 Apr 2024 14:27:25 -0400 Subject: [PATCH 4/4] fix casing --- v4-client-js/src/clients/native.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v4-client-js/src/clients/native.ts b/v4-client-js/src/clients/native.ts index 7f29d631..40b3c120 100644 --- a/v4-client-js/src/clients/native.ts +++ b/v4-client-js/src/clients/native.ts @@ -1198,7 +1198,7 @@ export async function getWithdrawalCapacityByDenom(denom: string): Promise { try { const validatorClient = globalThis.client.validatorClient; - const result = await validatorClient.get.GetWithdrawalAndTransferGatingStatus(); + const result = await validatorClient.get.getWithdrawalAndTransferGatingStatus(); return encodeJson(result, ByteArrayEncoding.BIGINT); } catch (e) { return wrappedError(e);