dApp向けRedoubt
Redoubtは、Burst Labsが開発した、Flare、Songbird、XRP Ledger向けのセルフカストディ型ウォレットです。独自のweb3ブラウザとWalletConnectを備えたAndroidアプリで、今後ブラウザ拡張機能も提供します。
このページには、dAppのウォレット一覧にRedoubtをその名前で表示するために必要な情報をまとめています。
- ダウンロード用のロゴ
- ページからRedoubtがどう見えるか
- ネットワーク
- メソッドとイベント
- WalletConnectでの接続
- ウォレット一覧にRedoubtを追加する
- テスト用にRedoubtを入手する
ダウンロード用のロゴ
アプリアイコン
プラム色の背景に置いた、正方形のアプリアイコンです。ウォレット一覧に使用できます。明るいページでも暗いページでも使えます。ほとんどの一覧は角を自動で丸めます。SVG版は、あらかじめ角が丸くなっています。
マーク
背景のない、塔だけのマークです。
名前入りのロゴ
マークにREDOUBTの文字を添えたものです。Redoubtについてのページや記事に使用できます。
ロゴの使い方
- 最小サイズ:アプリアイコンとマークは24ピクセル、名前入りのロゴは幅96ピクセル。
- ロゴの周囲には、ロゴの高さの4分の1以上の余白を空けてください。
- 色や縦横比を変えたり、効果を加えたりしないでください。
- 色:ローズゴールド(#E8A987)とディーププラム(#2E0829)。
ページからRedoubtがどう見えるか
Redoubtのブラウザでは、すべてのhttpsページにEIP-1193プロバイダーが提供されます。このプロバイダーはEIP-6963でアナウンスされ、window.ethereumにも設定されます:
- 名前
Redoubt- 識別子(rdns)
io.burstlabs.redoubt- プロバイダーのフラグ
isRedoubt: true- アイコン
- アプリアイコン(96×96ピクセルのPNG)のdata URI
- ユーザーがMetaMaskとの互換性をオンにしたサイトを除き、isMetaMaskはfalseです。Redoubtは、rdnsまたはisRedoubtで検出してください。isMetaMaskでは決して検出しないでください。
- プロバイダーが追加されるのは、httpsページのトップフレームだけです。iframeには追加されません。
- ブラウザ拡張機能も、提供が始まれば、同じ名前とrdnsをアナウンスします。
ネットワーク
- Flare:チェーンID 14(0xe)
- Songbird:チェーンID 19(0x13)
- Coston2:チェーンID 114(0x72)、テスト専用。テストネットワークをオンにすると、Redoubtに表示されます。オンにする方法は、お問い合わせください。
接続できるのは、これらのEVMネットワークだけです。ネットワークはサイトごとに保持されます。wallet_switchEthereumChainとwallet_addEthereumChainは、切り替える前にユーザーに確認します。その後Redoubtは、サイトが送ってくるRPCアドレスではなく、Redoubt自身のノードを使います。それ以外のネットワークは拒否します。
メソッドとイベント
署名(いずれも、Redoubtの安全な画面でユーザーが承認します):
personal_signeth_signTypedData_v4eth_signTypedData_v3eth_sendTransaction
アカウントとネットワーク:
eth_requestAccountseth_accountseth_coinbaseeth_chainIdnet_versionwallet_switchEthereumChainwallet_addEthereumChainwallet_requestPermissionswallet_getPermissionswallet_revokePermissions
読み取り(Redoubtのブラウザが自ら、またはRedoubt自身のノードから応答します。eth_getLogsの範囲は、1回の呼び出しにつき最大10,000ブロックです):
eth_blockNumbereth_calleth_estimateGaseth_gasPriceeth_maxPriorityFeePerGaseth_feeHistoryeth_getBalanceeth_getCodeeth_getStorageAteth_getTransactionCounteth_getTransactionByHasheth_getTransactionReceipteth_getBlockByNumbereth_getBlockByHasheth_getLogseth_syncingweb3_clientVersionpersonal_ecRecover
エラー4200で拒否されるもの(このページに載っていないメソッドもすべて同様です):
eth_signeth_signTypedDataeth_signTransactioneth_sendRawTransactioneth_decrypteth_getEncryptionPublicKeywallet_watchAssetwallet_sendCallswallet_getCapabilitieseth_subscribeeth_newFilter
イベント:
connectaccountsChangedchainChanged
Redoubtはサイトのためにコントラクトをデプロイしないため、eth_sendTransactionにはtoアドレスが必要です。nonceと手数料は、Redoubtが自ら設定します。
WalletConnectでの接続
ほかのブラウザやパソコンでは、dAppはWalletConnect v2でRedoubtに接続します。Redoubtは、ReownのWalletKitで構築されたウォレットです。
- 名前
Redoubt- リダイレクト(ネイティブ)
redoubt://- ペアリングリンク
redoubt://wc?uri=<wc: URI>wc:- ネットワーク(CAIP-2)
eip155:14eip155:19eip155:114- メソッド
personal_signeth_signTypedData_v4eth_signTypedData_v3eth_sendTransactionwallet_switchEthereumChainwallet_addEthereumChain- イベント
accountsChangedchainChanged- WalletGuideへの掲載
- 手続き中です。掲載が始まり次第、RedoubtのWalletGuide IDをここに追加します。
FlareとSongbirdは、optionalNamespacesで要求してください。ほかのネットワーク、またはeip155以外のネームスペースを必須とするセッションは、Redoubtでは承認できません。
ウォレット一覧にRedoubtを追加する
短いコード例です。それぞれ対象のライブラリのバージョンを明記し、そのバージョンの公開コードと照らし合わせて確認しています。YOUR_REOWN_PROJECT_IDは、Reownで取得したご自身のプロジェクトIDに置き換えてください。
wagmi
wagmiは、EIP-6963(multiInjectedProviderDiscovery、デフォルトでオン)によってRedoubtを自動で検出します。コネクターのidはRedoubtのrdnsです。Redoubtを優先して表示するには、そのコネクターを先頭に置いてください:
import { createConfig, http, useConnect, useConnectors } from 'wagmi'
import { flare, songbird } from 'wagmi/chains'
// EIP-6963 discovery (multiInjectedProviderDiscovery) is on by default:
// inside Redoubt, a connector with id 'io.burstlabs.redoubt' appears by itself.
export const config = createConfig({
chains: [flare, songbird],
transports: { [flare.id]: http(), [songbird.id]: http() },
})
const REDOUBT = 'io.burstlabs.redoubt'
export function WalletList() {
const connectors = useConnectors()
const { mutate: connect } = useConnect()
// Redoubt first, the others in their usual order
const sorted = [...connectors].sort((a, b) => Number(b.id === REDOUBT) - Number(a.id === REDOUBT))
return (
<>
{sorted.map((c) => (
<button key={c.uid} onClick={() => connect({ connector: c })}>{c.name}</button>
))}
</>
)
}
RainbowKit
RainbowKit用のRedoubtのエントリーです。Redoubtの外では、WalletConnectで接続し、Androidスマートフォンではアプリを開きます。Redoubtのブラウザ内では、RainbowKitは代わりに、インストール済みのウォレットとともにRedoubt自身のEIP-6963エントリーを表示します。照合にはrdnsが使われます。
import { connectorsForWallets, getWalletConnectConnector, type RainbowKitWalletConnectParameters, type Wallet } from '@rainbow-me/rainbowkit'
import { injectedWallet, walletConnectWallet } from '@rainbow-me/rainbowkit/wallets'
import { createConfig, http } from 'wagmi'
import { flare, songbird } from 'wagmi/chains'
const projectId = 'YOUR_REOWN_PROJECT_ID'
const redoubtWallet = ({ projectId, walletConnectParameters }: {
projectId: string
walletConnectParameters?: RainbowKitWalletConnectParameters
}): Wallet => ({
id: 'redoubt',
name: 'Redoubt',
rdns: 'io.burstlabs.redoubt', // in Redoubt's browser, its EIP-6963 entry takes this one's place
iconUrl: 'https://redoubtwallet.com/static/images/wallet/kit/redoubt-icon-256.png',
iconBackground: '#2E0829',
mobile: { getUri: (uri: string) => `redoubt://wc?uri=${encodeURIComponent(uri)}` },
qrCode: { getUri: (uri: string) => uri },
createConnector: getWalletConnectConnector({ projectId, walletConnectParameters }),
})
const connectors = connectorsForWallets(
[{ groupName: 'Recommended', wallets: [redoubtWallet, injectedWallet, walletConnectWallet] }],
{ appName: 'Your dApp', projectId },
)
export const config = createConfig({
connectors,
chains: [flare, songbird],
transports: { [flare.id]: http(), [songbird.id]: http() },
})
Reown AppKit
AppKitはEIP-6963のウォレットを自動で一覧に表示するため、Redoubtのブラウザ内では、変更を加えなくてもRedoubtが表示されます。RedoubtのWalletGuideへの掲載が始まったら、そのIDをfeaturedWalletIdsに追加してください。どこでもRedoubtが先頭に表示されます。
import { createAppKit } from '@reown/appkit/react'
import { WagmiAdapter } from '@reown/appkit-adapter-wagmi'
import { flare, songbird } from '@reown/appkit/networks'
const projectId = 'YOUR_REOWN_PROJECT_ID'
const wagmiAdapter = new WagmiAdapter({ networks: [flare, songbird], projectId })
createAppKit({
adapters: [wagmiAdapter],
networks: [flare, songbird],
projectId,
// enableEIP6963 is on by default: inside Redoubt's browser, Redoubt is listed.
// Once Redoubt's WalletGuide listing is live:
// featuredWalletIds: ['<Redoubt WalletGuide ID>'],
})
web3-onboard
injected-walletsモジュールも、EIP-6963のウォレットを検出します。このカスタムエントリーは、isRedoubtでRedoubtを認識し、そのアイコンを使って、一覧の先頭に表示します:
import Onboard from '@web3-onboard/core'
import injectedModule from '@web3-onboard/injected-wallets'
const isRedoubt = (provider) => !!provider && !!provider.isRedoubt
const redoubt = {
label: 'Redoubt',
injectedNamespace: 'ethereum',
checkProviderIdentity: ({ provider }) => isRedoubt(provider),
getIcon: async () => 'https://redoubtwallet.com/static/images/wallet/kit/redoubt-icon-256.png',
getInterface: async () => ({
provider: [window.ethereum, ...(window.ethereum?.providers ?? [])].find(isRedoubt),
}),
platforms: ['all'],
}
const onboard = Onboard({
wallets: [
injectedModule({
custom: [redoubt],
sort: (wallets) => [...wallets.filter((w) => w.label === 'Redoubt'), ...wallets.filter((w) => w.label !== 'Redoubt')],
}),
],
chains: [
{ id: '0xe', token: 'FLR', label: 'Flare', rpcUrl: 'https://flare-api.flare.network/ext/C/rpc' },
{ id: '0x13', token: 'SGB', label: 'Songbird', rpcUrl: 'https://songbird-api.flare.network/ext/C/rpc' },
],
})
ライブラリを使わない場合
RedoubtのEIP-6963のアナウンスを待ち受け、そのプロバイダーを保持します:
const REDOUBT_RDNS = 'io.burstlabs.redoubt'
let redoubt // Redoubt's EIP-1193 provider, once it announces itself
window.addEventListener('eip6963:announceProvider', (event) => {
const { info, provider } = event.detail // info.name 'Redoubt', info.icon a data: URI
if (info.rdns === REDOUBT_RDNS) redoubt = provider
})
window.dispatchEvent(new Event('eip6963:requestProvider'))
async function connectRedoubt() {
const [account] = await redoubt.request({ method: 'eth_requestAccounts' })
const chainId = await redoubt.request({ method: 'eth_chainId' }) // '0xe' Flare, '0x13' Songbird
return { account, chainId }
}
テスト用にRedoubtを入手する
Redoubtは、まもなくGoogle Playで公開されます。それまでの間、RedoubtでdAppをテストしたい場合は、[email protected]までメールでご連絡ください。
お問い合わせ
Redoubtの追加についてご質問がある場合や、Redoubtを掲載すべきウォレット一覧をご存じの場合は、[email protected]までメールでご連絡ください。