From a6c1376e8e3cc0b74b0dcc46c471d4270bd19183 Mon Sep 17 00:00:00 2001 From: Mark Nardi Date: Wed, 1 Nov 2023 17:47:11 +0100 Subject: [PATCH] add walletconnect documentation --- wallet-connect/eip155/index.md | 7 ++ wallet-connect/eip155/supportedMethods.md | 80 +++++++++++++++++++++++ wallet-connect/guide.md | 28 ++++++++ wallet-connect/index.md | 14 ++++ wallet-connect/supported.md | 30 +++++++++ wallet-connect/tip32/index.md | 9 +++ 6 files changed, 168 insertions(+) create mode 100644 wallet-connect/eip155/index.md create mode 100644 wallet-connect/eip155/supportedMethods.md create mode 100644 wallet-connect/guide.md create mode 100644 wallet-connect/index.md create mode 100644 wallet-connect/supported.md create mode 100644 wallet-connect/tip32/index.md diff --git a/wallet-connect/eip155/index.md b/wallet-connect/eip155/index.md new file mode 100644 index 0000000..74782a9 --- /dev/null +++ b/wallet-connect/eip155/index.md @@ -0,0 +1,7 @@ +--- +icon: link +expanded: true +order: 999 +--- + +# EIP155 RPC diff --git a/wallet-connect/eip155/supportedMethods.md b/wallet-connect/eip155/supportedMethods.md new file mode 100644 index 0000000..88af65f --- /dev/null +++ b/wallet-connect/eip155/supportedMethods.md @@ -0,0 +1,80 @@ +--- +icon: link +expanded: true +order: 999 +--- + +# Supported Methods + +### personal_sign +The sign method calculates an Ethereum specific signature with: `sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. + +By adding a prefix to the message makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim. + +Note See ecRecover to verify the signature. + +#### Parameters +message, account + +`DATA`, N Bytes - message to sign. +`DATA`, 20 Bytes - address. + +#### Returns +`DATA`: Signature + +#### Example + +``` +// Request +{ + "id": 1, + "jsonrpc": "2.0", + "method": "personal_sign", + "params":["0xdeadbeaf","0x9b2055d370f73ec7d8a03e965129118dc8f5bf83"], +} + +// Result +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b" +} +``` + + +### eth_sign +The sign method calculates an Ethereum specific signature with: `sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. + +By adding a prefix to the message makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim. + +Note the address to sign with must be unlocked. + +#### Parameters +account, message + +`DATA`, 20 Bytes - address. +`DATA`, N Bytes - message to sign. +#### Returns +`DATA`: Signature + +#### Example + +``` +// Request +{ + "id": 1, + "jsonrpc": "2.0", + "method": "eth_sign", + "params": ["0x9b2055d370f73ec7d8a03e965129118dc8f5bf83", "0xdeadbeaf"], +} + + +// Result +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0xa3f20717a250c2b0b729b7e5becbff67fdaef7e0699da4de7ca5895b02a170a12d887fd3b17bfdce3481f10bea41f45ba9f709d39ce8325427b57afcfc994cee1b" +} +``` + +An example how to use solidity ecrecover to verify the signature calculated with eth_sign can be found here. The contract is deployed on the testnet Ropsten and Rinkeby. diff --git a/wallet-connect/guide.md b/wallet-connect/guide.md new file mode 100644 index 0000000..d8686e4 --- /dev/null +++ b/wallet-connect/guide.md @@ -0,0 +1,28 @@ +--- +icon: book +order: 1000 +--- + +# Guide + +`WalletConnect`s `Web3Modal` has many suggestions on wallets on all ecosystems, but these suggestions can be adapted and changed by the dApp developer. If `Bloom` wallet implements features that your app requires, or if you generally want to recomment `Bloom` for your dApp's users, you can include the following code into your code base: + +``` +createWeb3Modal({ + //... + featuredWalletIds: [ + '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Bloom wallet + ] +}) +``` + +If your dApp requires a feature that most of the wallets don't implement, but `Bloom` does, you can use the following code instead of the code on top: + +``` +createWeb3Modal({ + //... + includeWalletIds: [ + '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Bloom wallet + ] +}) +``` \ No newline at end of file diff --git a/wallet-connect/index.md b/wallet-connect/index.md new file mode 100644 index 0000000..111f219 --- /dev/null +++ b/wallet-connect/index.md @@ -0,0 +1,14 @@ +--- +icon: link +expanded: true +order: 999 +--- + +# WalletConnect + +To be able to connect with the IOTA / Shimmer ecosystem, Bloom implements `WalletConnect`(ref: https://docs.walletconnect.com/quickstart). WalletConnect is a generic interface, which offers the user the freedom to connect their trusted wallet to the dApp. + +If you're a dApp developer and plan to implement `WalletConnect` into your dApp, checkout https://docs.walletconnect.com/web3modal/about. + +[Include Bloom](guide.md) +[Supported Networks and Methods](supported.md) diff --git a/wallet-connect/supported.md b/wallet-connect/supported.md new file mode 100644 index 0000000..75dd0b4 --- /dev/null +++ b/wallet-connect/supported.md @@ -0,0 +1,30 @@ +--- +icon: search +order: 998 +--- + +# Supported Networks and Methods + +Bloom currently supports the following events for the following chains: + +## EIP155 + +#### Supported Networks +`eip155:1073`, `eip155:1074` + +#### Supported Methods +`personal_sign`, `eth_sign` + + +#### Implemented Events +`accountsChanged`, `chainChanged` + + +## TIP32 + +#### Supported Networks + +#### Supported Methods + +#### Implemented Events +`accountsChanged`, `chainChanged` diff --git a/wallet-connect/tip32/index.md b/wallet-connect/tip32/index.md new file mode 100644 index 0000000..820db84 --- /dev/null +++ b/wallet-connect/tip32/index.md @@ -0,0 +1,9 @@ +--- +icon: link +expanded: true +order: 999 +--- + +# TIP32 RPC + +## TBD \ No newline at end of file