Multi-chain provider would require primarly two main methods to interface with a multi-chain cryptocurrency wallet: enable and request.
Enable method would translate the same JSON-RPC parameters of CAIP-25 as Javascript arguments
Multi-chain provider would require primarly two main methods to interface with a multi-chain cryptocurrency wallet: enable and request.
Enable method would translate the same JSON-RPC parameters of CAIP-25 as Javascript arguments
| import { BigNumber, BigNumberish, constants, utils } from "ethers"; | |
| const { Zero, MaxUint256 } = constants; | |
| const { parseUnits, formatUnits } = utils; | |
| export const toWad = (amount: string, decimals = 18): BigNumber => { | |
| return parseUnits(sanitizeDecimals(amount, decimals), decimals); | |
| }; | |
| export const fromWad = (wad: BigNumberish, decimals = 18): string => { |
This spec has moved to WalletConnect Docs
| <!-- index.html --> | |
| <html> | |
| <head> | |
| <script src="index.js"></script> | |
| </head> | |
| </html> |
| // Currently our proposals require a lot from wallets by including all methods into requiredNamespaces | |
| // This puts a high requirement on the wallets to support a lot of methods and chains | |
| { | |
| requiredNamespaces: { | |
| eip155: { | |
| chains: [1, 2, 3], | |
| methods: [ | |
| 'eth_sendTransaction', | |
| 'eth_sendRawTransaction', |
| // Our RPC id's are expected to be the same "length" | |
| // generating id's should use Unix epoch timestamp in miliseconds and append 3 random digits | |
| // currently Kotlin SDK has at least 3 more digits than all other SDKs | |
| // yet while Kotlin is the minority, it's preferable to increase integers than decrease them | |
| // this way we can keep backwards-compatibility for Kotlin clients in older releases | |
| // thus we could also increase entropy by also increasing other SDKs to 6 random digits | |
| function payloadId() { | |
| const date = Date.now() * Math.pow(10, 6); | |
| const extra = Math.ceil(Math.random() * Math.pow(10, 6)); |
| REQ wc_pairingDelete | |
| - ttl = 86400 | |
| - tag = 1000 | |
| - msg = 400 (~312) | |
| RES wc_pairingDelete | |
| - ttl = 86400 | |
| - tag = 1001 | |
| - msg = ?? |
| import React from "react"; | |
| import * as uuid from 'uuid'; | |
| import { WindowProvider } from "@wagmi/connectors" | |
| import defaultProviderIcon from "../assets/defaultProviderIcon.png" | |
| // copied from https://github.com/wagmi-dev/references/blob/main/packages/connectors/src/utils/getInjectedName.ts | |
| function getInjectedName(ethereum?: WindowProvider) { | |
| if (!ethereum) return 'Injected' |