Skip to content

Commit

Permalink
fix: #1957: unblock ibc deposits and withdrawals (#1958)
Browse files Browse the repository at this point in the history
* fix: #1957: IBC withdrawal, request transparent address only for USDC on Noble

* chore: changeset

* fix: #1957: ibc deposit form
  • Loading branch information
VanishMax authored Dec 23, 2024
1 parent 9ebe4a7 commit 0402d31
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-wasps-itch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'minifront': patch
---

Hotfix IBC withdrawals
22 changes: 13 additions & 9 deletions apps/minifront/src/state/ibc-in/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,22 @@ async function execute(

const transferToken = fromDisplayAmount(assetMetadata, coin.displayDenom, amount);

const { address: t_addr, encoding: encoding } = await penumbra
.service(ViewService)
.transparentAddress(new TransparentAddressRequest({}));
if (!t_addr) {
throw new Error('Error with generating IBC transparent address');
}

// Temporary: detect USDC Noble inbound transfers, and use a transparent (t-addr) encoding
// to ensure Bech32 encoding compatibility.
if (transferToken.denom.includes('uusdc') && bech32ChainIds.includes(selectedChain.chainId)) {
// Set the reciever address to the t-addr encoding.
penumbraAddress = encoding;
// Set the receiver address to the t-addr encoding.
try {
const { address: t_addr, encoding: encoding } = await penumbra
.service(ViewService)
.transparentAddress(new TransparentAddressRequest({}));
if (!t_addr) {
throw new Error('Error with generating IBC transparent address');
}

penumbraAddress = encoding;
} catch (_) {
throw new Error('Error with generating IBC transparent address');
}
}

const params: MsgTransfer = {
Expand Down
22 changes: 13 additions & 9 deletions apps/minifront/src/state/ibc-out.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,6 @@ const getPlanRequest = async ({

const { timeoutHeight, timeoutTime } = await getTimeout(chain.channelId);

// Request transparent address from view service
const { address: t_addr } = await penumbra
.service(ViewService)
.transparentAddress(new TransparentAddressRequest({}));
if (!t_addr) {
throw new Error('Error with generating IBC transparent address');
}

// IBC-related fields
const denom = getMetadata(selection.balanceView).base;
let useTransparentAddress = false;
Expand All @@ -233,7 +225,19 @@ const getPlanRequest = async ({
if (denom.includes('uusdc') && bech32ChainIds.includes(chain.chainId)) {
// Outbound IBC transfers timeout without setting either of these fields.
useTransparentAddress = true;
returnAddress = t_addr;

// Request transparent address from view service
try {
const { address: t_addr } = await penumbra
.service(ViewService)
.transparentAddress(new TransparentAddressRequest({}));
if (!t_addr) {
throw new Error('Error with generating IBC transparent address');
}
returnAddress = t_addr;
} catch (e) {
throw new Error('Error with generating IBC transparent address');
}
}

return new TransactionPlannerRequest({
Expand Down

0 comments on commit 0402d31

Please sign in to comment.