-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(Deposit/Withdraw) Fix Penumbra Issue (#3966)
* feat: add penumbra bridge provider * fix: build * fix: build
- Loading branch information
1 parent
8419dea
commit 8179a7f
Showing
11 changed files
with
144 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { | ||
BridgeChain, | ||
BridgeExternalUrl, | ||
BridgeProvider, | ||
BridgeProviderContext, | ||
BridgeQuote, | ||
BridgeSupportedAsset, | ||
BridgeTransactionRequest, | ||
GetBridgeSupportedAssetsParams, | ||
} from "../interface"; | ||
|
||
export class PenumbraBridgeProvider implements BridgeProvider { | ||
static readonly ID = "Penumbra"; | ||
readonly providerName = PenumbraBridgeProvider.ID; | ||
|
||
constructor(protected readonly ctx: BridgeProviderContext) {} | ||
|
||
async getQuote(): Promise<BridgeQuote> { | ||
throw new Error("Penumbra quotes are currently not supported."); | ||
} | ||
|
||
async getSupportedAssets({ | ||
asset, | ||
}: GetBridgeSupportedAssetsParams): Promise< | ||
(BridgeChain & BridgeSupportedAsset)[] | ||
> { | ||
// just supports SOL via Penumbra | ||
|
||
const assetListAsset = this.ctx.assetLists | ||
.flatMap(({ assets }) => assets) | ||
.find( | ||
(a) => a.coinMinimalDenom.toLowerCase() === asset.address.toLowerCase() | ||
); | ||
|
||
if (assetListAsset) { | ||
const penumbraCounterparty = assetListAsset.counterparty.find( | ||
(c) => c.chainName === "penumbra" | ||
); | ||
|
||
if (penumbraCounterparty) { | ||
return [ | ||
{ | ||
transferTypes: ["external-url"], | ||
chainId: "penumbra", | ||
chainName: "Penumbra", | ||
chainType: "penumbra", | ||
denom: penumbraCounterparty.symbol, | ||
address: penumbraCounterparty.sourceDenom, | ||
decimals: penumbraCounterparty.decimals, | ||
}, | ||
]; | ||
} | ||
} | ||
|
||
return []; | ||
} | ||
|
||
async getTransactionData(): Promise<BridgeTransactionRequest> { | ||
throw new Error("Penumbra transactions are currently not supported."); | ||
} | ||
|
||
async getExternalUrl(): Promise<BridgeExternalUrl | undefined> { | ||
throw new Error("Penumbra external urls are currently not supported."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const PenumbraChainInfo = { | ||
prettyName: "Penumbra", | ||
chainId: "penumbra", | ||
chainName: "Penumbra", | ||
color: "#ff902f", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters