Skip to content

Commit

Permalink
Add SWTH (#159)
Browse files Browse the repository at this point in the history
* Add carbon IBC & SCRT asset

* Add SWTH IBC asset

* Add s-SWTH token
  • Loading branch information
SecretSaturn authored May 16, 2024
1 parent 4ddf88c commit 71beb60
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 14 deletions.
2 changes: 1 addition & 1 deletion public/PriceIdsString.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
secret,akash-network,eris-amplified-luna,andromeda-2,archway,cosmos,agoric,cheqd-network,comdex,composite,polkadot,sentinel,dydx,dymension,eclipse-fi,graviton,harbor-2,chihuahua-token,injective-protocol,inter-stable-token,jackal-protocol,juno-network,kujira,kusama,nolus,unstake-fi,neutron-3,terra-luna-2,levana-protocol,milkyway-staked-tia,mantadao,oraichain-token,osmosis,,picasso,pstake-finance,,quicksilver,kujira,usd-coin,saga-2,stargaze,stride-staked-atom,stride-staked-injective,stride-staked-juno,stkatom,pstake-staked-dydx,stride-staked-luna,stride-staked-osmo,stride,stride-staked-tia,celestia,umee,bitcoin,white-whale,persistence,,alter,amberdao,,fina,shade-protocol,,sienna,silk-bcec1136-561c-4706-a42c-8b67d0d7f7d2,stkd-scrt,usd-coin,axelar,ethereum,wrapped-steth,bitcoin,binancecoin,busd,dai,chainlink,uniswap,tether,frax
secret,akash-network,eris-amplified-luna,andromeda-2,archway,cosmos,agoric,cheqd-network,comdex,composite,polkadot,sentinel,dydx,dymension,eclipse-fi,graviton,harbor-2,chihuahua-token,injective-protocol,inter-stable-token,jackal-protocol,juno-network,kujira,kusama,nolus,unstake-fi,neutron-3,terra-luna-2,levana-protocol,milkyway-staked-tia,mantadao,oraichain-token,osmosis,,picasso,pstake-finance,,quicksilver,kujira,usd-coin,saga-2,stargaze,stride-staked-atom,stride-staked-injective,stride-staked-juno,stkatom,pstake-staked-dydx,stride-staked-luna,stride-staked-osmo,stride,stride-staked-tia,switcheo,celestia,umee,bitcoin,white-whale,persistence,,alter,amberdao,,fina,shade-protocol,,sienna,silk-bcec1136-561c-4706-a42c-8b67d0d7f7d2,stkd-scrt,usd-coin,axelar,ethereum,wrapped-steth,bitcoin,binancecoin,busd,dai,chainlink,uniswap,tether,frax
6 changes: 3 additions & 3 deletions src/components/Wallet/Wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,11 @@ function Wallet() {
const [isManageViewingkeysModalOpen, setIsManageViewingkeysModalOpen] = useState<boolean>(false)

function handleConnectWallet() {
if (window.keplr && window.getEnigmaUtils && window.getOfflineSignerAuto && window.leap) {
if (window.keplr && window.getEnigmaUtils && window.getOfflineSignerOnlyAmino && window.leap) {
setIsConnectWalletModalOpen(true)
} else if (window.keplr && window.getEnigmaUtils && window.getOfflineSignerAuto && !window.leap) {
} else if (window.keplr && window.getEnigmaUtils && window.getOfflineSignerOnlyAmino && !window.leap) {
connectWallet('keplr')
} else if (!(window.keplr && window.getEnigmaUtils && window.getOfflineSignerAuto) && window.leap) {
} else if (!(window.keplr && window.getEnigmaUtils && window.getOfflineSignerOnlyAmino) && window.leap) {
connectWallet('leap')
} else {
setIsGetWalletModalOpen(true)
Expand Down
4 changes: 2 additions & 2 deletions src/services/ibc.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async function performIbcDeposit(
isClassic: false
})

const terraSigner = window.wallet.getOfflineSignerAuto(props.chain.chain_id)
const terraSigner = await window.wallet.getOfflineSignerAuto(props.chain.chain_id)
const accounts = await terraSigner.getAccounts()

// Create the transaction options with the corrected fee structure
Expand Down Expand Up @@ -853,7 +853,7 @@ async function getSkipIBCRouting(chain: Chain, IbcMode: IbcMode, token: Token, a
}

async function getReceiverAddress(chainID: string): Promise<string> {
const wallet = window.wallet.getOfflineSigner(chainID)
const wallet = await window.wallet.getOfflineSignerAuto(chainID)
const [{ address: walletAddress }] = await wallet.getAccounts()
return walletAddress
}
Expand Down
10 changes: 5 additions & 5 deletions src/services/wallet.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { TokenBalances } from 'types/TokenBalances'
const connectKeplr = async (lcd: string, chainID: string) => {
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))

while (!window.keplr || !window.getEnigmaUtils || !window.getOfflineSignerAuto) {
while (!window.keplr || !window.getEnigmaUtils || !window.getOfflineSignerOnlyAmino) {
await sleep(50)
}

Expand All @@ -36,15 +36,15 @@ const connectKeplr = async (lcd: string, chainID: string) => {
}
}

const keplrOfflineSigner = await window.getOfflineSignerAuto(chainID)
const keplrOfflineSigner = window.getOfflineSignerOnlyAmino(chainID)
const accounts = await keplrOfflineSigner.getAccounts()

const walletAddress = accounts[0].address

const secretjs: SecretNetworkClient = new SecretNetworkClient({
url: lcd,
chainId: chainID,
wallet: keplrOfflineSigner as any,
wallet: keplrOfflineSigner,
walletAddress,
encryptionUtils: window.getEnigmaUtils(chainID)
})
Expand All @@ -63,13 +63,13 @@ const connectLeap = async (lcd: string, chainID: string) => {
// localStorage.setItem("preferedWalletApi", "Fina");
// window.dispatchEvent(new Event("storage"));
} else {
while (!window.leap || !window.leap.getEnigmaUtils || !window.leap.getOfflineSignerAuto) {
while (!window.leap || !window.leap.getEnigmaUtils || !window.leap.getOfflineSignerOnlyAmino) {
await sleep(50)
}

await window.leap.enable(chainID)

const wallet = await window.leap.getOfflineSignerAuto(chainID)
const wallet = window.leap.getOfflineSignerOnlyAmino(chainID)
const [{ address: walletAddress }] = await wallet.getAccounts()

const secretjs: SecretNetworkClient = new SecretNetworkClient({
Expand Down
51 changes: 48 additions & 3 deletions src/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ export const chains: { [chain_name: string]: Chain } = {
},
Carbon: {
chain_name: 'Carbon',
deposit_channel_id: 'channel-XX',
deposit_channel_id: 'channel-40',
deposit_gas: 200_000,
deposit_gas_denom: 'dswth',
withdraw_channel_id: 'channel-XX',
deposit_gas_denom: 'swth',
withdraw_channel_id: 'channel-157',
withdraw_gas: 150_000,
chain_id: 'carbon-1',
bech32_prefix: 'swth',
Expand Down Expand Up @@ -604,6 +604,18 @@ export const tokens: Token[] = [
'uscrt'
)
},
{
chain_name: 'Carbon',
denom: ibcDenom(
[
{
incomingChannelId: chains['Carbon'].deposit_channel_id,
incomingPortId: 'transfer'
}
],
'uscrt'
)
},
{
chain_name: 'Celestia',
denom: ibcDenom(
Expand Down Expand Up @@ -944,6 +956,10 @@ export const tokens: Token[] = [
chain_name: 'Axelar',
denom: 'uscrt'
},
{
chain_name: 'Carbon',
denom: 'uscrt'
},
{
chain_name: 'Celestia',
denom: 'uscrt'
Expand Down Expand Up @@ -2723,6 +2739,35 @@ export const tokens: Token[] = [
}
]
},
{
name: 'SWTH',
description: 'Carbon Governance Token',
address: 'secret187ehv3mquvfxwnwaff90c6keq0qf66hljw5xzt',
code_hash: '638a3e1d50175fbcb8373cf801565283e3eb23d88a9b7b7f99fcc5eb1e6b561e',
image: '/swth.svg',
decimals: 8,
coingecko_id: 'switcheo',
deposits: [
{
chain_name: 'Carbon',
denom: 'swth'
}
],
withdrawals: [
{
chain_name: 'Carbon',
denom: ibcDenom(
[
{
incomingChannelId: chains['Carbon'].withdraw_channel_id,
incomingPortId: 'transfer'
}
],
'swth'
)
}
]
},
{
name: 'TIA',
description: 'Celestia Governance Token',
Expand Down

0 comments on commit 71beb60

Please sign in to comment.