Trust Wallet
Trust Wallet is a crypto wallet app. Protocol Launcher allows you to generate Trust Wallet deep links for DApps, assets, payments, staking, exchange flows, WalletConnect, and other documented pages.
Usage
There are two ways to use this library:
- On-Demand import from subpaths enables tree-shaking and keeps bundles small.
- Full Import from the root package is convenient but includes all app modules.
Pick On-Demand for production builds; Full Import is fine for quick scripts or demos.
Select Installation Method
URL Methods
Trust Wallet documents that every deeplink route can use either https://link.trustwallet.com or trust://. This module defaults to the HTTPS app link and supports format: 'scheme' when you need the direct trust:// URL.
Open DApp Browser
Open the DApp browser with a specific website URL and SLIP-44 network.
import { openDappBrowser } from 'protocol-launcher/trust-wallet'
const url = openDappBrowser({
coinId: 60,
url: 'https://compound.finance',
})Open Coin
Open a coin by its UAI asset identifier.
import { openCoin } from 'protocol-launcher/trust-wallet'
const url = openCoin({
asset: 'c60',
})Add Asset
Add an asset to local storage so it shows on the wallet screen.
import { addAsset } from 'protocol-launcher/trust-wallet'
const url = addAsset({
asset: 'c60_t0x514910771af9ca656af840dff83e8264ecf986ca',
})Send Payment
Generate a payment URL with the documented optional amount, memo, and data parameters.
import { sendPayment } from 'protocol-launcher/trust-wallet'
const url = sendPayment({
asset: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F',
address: '0x650b5e446edabad7eba7fa7bb2f6119b2630bfbb',
amount: 1,
memo: 'test',
})Stake
Open staking details for a SLIP-44 coin index.
import { stake } from 'protocol-launcher/trust-wallet'
const url = stake({
coin: 118,
})Stake Delegate
Open the stake/delegate flow, optionally selecting a validator or delegator.
import { stakeDelegate } from 'protocol-launcher/trust-wallet'
const url = stakeDelegate({
coin: 118,
id: 'cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf',
})Stake Undelegate
Open the unstake/undelegate flow.
import { stakeUndelegate } from 'protocol-launcher/trust-wallet'
const url = stakeUndelegate({
coin: 118,
})Stake Claim Rewards
Open the claim rewards flow.
import { stakeClaimRewards } from 'protocol-launcher/trust-wallet'
const url = stakeClaimRewards({
coin: 118,
})Open Swap
Open Swap with source and destination assets in UAI format.
import { openSwap } from 'protocol-launcher/trust-wallet'
const url = openSwap({
from: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F',
to: 'c60',
})Open Buy Crypto
Open Buy Crypto with the documented optional fiat ramp parameters.
import { openBuyCrypto } from 'protocol-launcher/trust-wallet'
const url = openBuyCrypto({
asset: 'c60',
provider: 'moonpay',
paymentMethod: 'digital_wallet',
subPaymentMethod: 'paypal',
fiatCurrency: 'USD',
fiatQuantity: 300,
})Open Sell Crypto
Open Sell Crypto for an asset in UAI format.
import { openSellCrypto } from 'protocol-launcher/trust-wallet'
const url = openSellCrypto({
asset: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F',
})Open Market Info
Open market information for an asset in UAI format.
import { openMarketInfo } from 'protocol-launcher/trust-wallet'
const url = openMarketInfo({
asset: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F',
})Open Hot Tokens
Open the Hot Tokens tab, optionally with a category and network.
import { openHotTokens } from 'protocol-launcher/trust-wallet'
const url = openHotTokens({
categoryId: 'hot',
network: 'c0',
})Connect WalletConnect
Generate the WalletConnect route. Trust Wallet documents this route with a URL-encoded WalletConnect v2 URI in the uri query parameter.
import { connectWalletConnect } from 'protocol-launcher/trust-wallet'
const url = connectWalletConnect({
uri: 'wc%3A1234abcd...%402%3FrelaySrotocol%3Dirn%26symKey%3D...',
})Open Simple Pages
Open NFTs, quest, Launchpool, notification settings, notifications, and price alerts.
import {
openNfts, openQuest, openLaunchpool, openNotificationSettings, openNotifications, openPriceAlerts
} from 'protocol-launcher/trust-wallet'
const nftsUrl = openNfts()
const questUrl = openQuest()
const launchpoolUrl = openLaunchpool()
const notificationSettingsUrl = openNotificationSettings()
const notificationsUrl = openNotifications()
const priceAlertsUrl = openPriceAlerts()Generated URLs
openDappBrowser({ coinId: 60, url: 'https://compound.finance' })
// => 'https://link.trustwallet.com/open_url?coin_id=60&url=https://compound.finance'
openDappBrowser({ coinId: 60, url: 'https://compound.finance', format: 'scheme' })
// => 'trust://open_url?coin_id=60&url=https://compound.finance'
openCoin({ asset: 'c60' })
// => 'https://link.trustwallet.com/open_coin?asset=c60'
addAsset({ asset: 'c60_t0x514910771af9ca656af840dff83e8264ecf986ca' })
// => 'https://link.trustwallet.com/add_asset?asset=c60_t0x514910771af9ca656af840dff83e8264ecf986ca'
sendPayment({
asset: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F',
address: '0x650b5e446edabad7eba7fa7bb2f6119b2630bfbb',
amount: 1,
memo: 'test',
})
// => 'https://link.trustwallet.com/send?asset=c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F&address=0x650b5e446edabad7eba7fa7bb2f6119b2630bfbb&amount=1&memo=test'
stake({ coin: 118 })
// => 'https://link.trustwallet.com/stake?coin=118'
stakeDelegate({ coin: 118, id: 'cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf' })
// => 'https://link.trustwallet.com/stake_delegate?coin=118&id=cosmosvaloper156gqf9837u7d4c4678yt3rl4ls9c5vuursrrzf'
stakeUndelegate({ coin: 118 })
// => 'https://link.trustwallet.com/stake_undelegate?coin=118'
stakeClaimRewards({ coin: 118 })
// => 'https://link.trustwallet.com/stake_claim_rewards?coin=118'
openSwap({ from: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F', to: 'c60' })
// => 'https://link.trustwallet.com/swap?from=c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F&to=c60'
openBuyCrypto({
asset: 'c60',
provider: 'moonpay',
paymentMethod: 'digital_wallet',
subPaymentMethod: 'paypal',
fiatCurrency: 'USD',
fiatQuantity: 300,
})
// => 'https://link.trustwallet.com/buy?asset=c60&provider=moonpay&payment_method=digital_wallet&sub_payment_method=paypal&fiat_currency=USD&fiat_quantity=300'
openSellCrypto({ asset: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F' })
// => 'https://link.trustwallet.com/sell?asset=c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F'
openMarketInfo({ asset: 'c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F' })
// => 'https://link.trustwallet.com/market?asset=c60_t0x6B175474E89094C44Da98b954EedeAC495271d0F'
openHotTokens()
// => 'https://link.trustwallet.com/hot_tokens'
openHotTokens({ categoryId: 'hot', network: 'c0' })
// => 'https://link.trustwallet.com/hot_tokens?category_id=hot&network=c0'
connectWalletConnect({ uri: 'wc%3A1234abcd...%402%3FrelaySrotocol%3Dirn%26symKey%3D...' })
// => 'https://link.trustwallet.com/wc?uri=wc%3A1234abcd...%402%3FrelaySrotocol%3Dirn%26symKey%3D...'
openNfts()
// => 'https://link.trustwallet.com/nfts'
openQuest()
// => 'https://link.trustwallet.com/quest'
openLaunchpool()
// => 'https://link.trustwallet.com/launchpool'
openNotificationSettings()
// => 'https://link.trustwallet.com/notification_settings'
openNotifications()
// => 'https://link.trustwallet.com/notifications'
openPriceAlerts()
// => 'https://link.trustwallet.com/alerts'