Skip to content

Commit

Permalink
debug transactions example (#162)
Browse files Browse the repository at this point in the history
* Docs in monorepo (#155)

* add docs to monorepo

* random updates

* add images

* GitBook: [#2] No subject

* GitBook: [#3] No subject

* Update README.md

* update TOC

* Update README.md

* Update README.md

* restructure

* Update SUMMARY.md

* work1

* work2

* Update 001_how-to-bridge.md

* work3

* work4

* work5

* work6

* Update 000_developer_start.md

* work 7

* work 8

* Update 000_developer_start.md

* Update 000_developer_start.md

* work9

* work10

* Update xdomain-tx-status.md

* Update xdomain-tx-status.md

* more cleanup

* Update SUMMARY.md

* Update README.md

* Update README.md

* work 11

* Update AWS_lambda_setup.md

* work 12

* Update README.md

* work 13

* work 14

* update links

* work 15

* work 16

* Update README.md

* Update README.md

* work 16

* Update 001_how-to-bridge.md (#134)

Co-authored-by: Gian-Bobarino <100376939+Gian-Bobarino@users.noreply.github.com>

* Update 001_how-to-bridge.md

* work 17

* work 18

* Update developer-start.md

* work 19

* Update faq.md

* work 19

* Update xdomain-tx-status.md

* Update xdomain-tx-status.md

* work 20

* work 21

* Update README.md

* Update SUMMARY.md

* work 21

* work 22

* work 22

* instructions for adding new tokens

* Update fee docs (#136)

* docs: cleanup bridge docs (#137)

* cleanup bridge docs

* fix link

* work 22

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* work 23

* Update price-feeds.md

* work 24

* work 25

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update price-feeds.md

* Update price-feeds.md

* Update price-feeds.md

* work 26

* Update README.md

* work 27

* work 29

* Update README.md

* work 29

* Update documentation.md

* Update documentation.md

* add turing overview

* Update turing.md

* Update turing.md

* Update turing.md

* Update turing.md

* work 30

* Update network-parameters.md

* update network parameters

* update network addresses

* Update network-parameters.md

* update structure

* Update network-parameters.md

* Moonbeam (#154)

* other chain addresses

* moonbeam continued

* Create addressesBobaBase_0xF8d0bF3a1411AC973A606f90B2d1ee0840e5979B.json

* Update network-moonbeam.md

* update bobabeam links

* chain IDs

* Update addresses and docs

Co-authored-by: cby3149 <cby3149@gmail.com>

Co-authored-by: Boba Lab <jan@omg.network>
Co-authored-by: Riedl Kevin, Bsc <kevin.riedl.privat@gmail.com>
Co-authored-by: Gian-Bobarino <100376939+Gian-Bobarino@users.noreply.github.com>
Co-authored-by: Boyuan-Chen <46272347+Boyuan-Chen@users.noreply.github.com>
Co-authored-by: Souradeep Das <dsouradeep2@gmail.com>
Co-authored-by: cby3149 <cby3149@gmail.com>

* add USDC display and open fee switcher (#159)

* Update Wallet.js (#160)

* fix typo

* improved error handling

* debug transactions example

Co-authored-by: CAPtheorem <79423264+CAPtheorem@users.noreply.github.com>
Co-authored-by: Boba Lab <jan@omg.network>
Co-authored-by: Riedl Kevin, Bsc <kevin.riedl.privat@gmail.com>
Co-authored-by: Gian-Bobarino <100376939+Gian-Bobarino@users.noreply.github.com>
Co-authored-by: Boyuan-Chen <46272347+Boyuan-Chen@users.noreply.github.com>
Co-authored-by: Souradeep Das <dsouradeep2@gmail.com>
Co-authored-by: cby3149 <cby3149@gmail.com>
  • Loading branch information
8 people authored May 10, 2022
1 parent 338131e commit e6ce0af
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
10 changes: 10 additions & 0 deletions boba_documentation/developer/json-rpc-api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@

Boba Network shares the same [JSON-RPC API (opens new window)](https://eth.wiki/json-rpc/API) as Ethereum. Some new custom methods have been introduced and some other have been made unsupported for operation.
### Debug JSON-RPC methods

You can use the lightning replica node to debug your transactions.

**Example**

```
curl https://lightning-replica.boba.network/ -X POST --header 'Content-type: application/json' --data '{"jsonrpc":"2.0", "method":"debug_traceTransaction", "params":["0xf97b6fdce473b96d9cb00bb45d8fbfbc2911f383c7d525ec9d84d916cc30d347", {}], "id":1}'
```


### Custom JSON-RPC methods

Expand Down
7 changes: 7 additions & 0 deletions packages/boba/gateway/src/actions/createAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export function createAction (key, asyncAction) {
return false
}

if(response && typeof(response) === 'string' && response.includes('Insufficient balance')) {
//let errorMessage = JSON.parse(response)
dispatch({ type: `UI/ERROR/UPDATE`, payload: "Insufficient BOBA balance for emergency swap" })
dispatch({ type: `${key}/ERROR` })
return false
}

//deal with metamask errors - they will have a 'code' field so we can detect those
if(response && response.hasOwnProperty('message') && response.hasOwnProperty('code')) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,10 @@ function FeeSwitcher() {
return null
}

if (network === 'mainnet' && monsterNumber < 1) {
return null
}
// enable fee switcher for everyone
// if (network === 'mainnet' && monsterNumber < 1) {
// return null
// }

return (
<S.FeeSwitcherWrapper>
Expand Down
8 changes: 4 additions & 4 deletions packages/boba/gateway/src/containers/wallet/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ function Wallet() {
}

async function emergencySwap () {
if(network !== 'rinkeby') return
const res = await dispatch(getETHMetaTransaction())
console.log("emergencySwap - res:",res)
if (res) dispatch(openAlert('Emergency Swap submitted'))
}

Expand All @@ -129,8 +129,8 @@ function Wallet() {
accountEnabled={accountEnabled}
/>

{layer === 'L2' && tooSmallETH && network === 'rinkeby' &&
<G.LayerAlert>
{layer === 'L2' && tooSmallETH &&
<G.LayerAlert style={{padding: '20px'}}>
<G.AlertInfo>
<Icon as={Info} sx={{color:"#BAE21A"}}/>
<Typography
Expand All @@ -142,7 +142,7 @@ function Wallet() {
>
Using Boba requires a minimum ETH balance (of 0.002 ETH) regardless of your fee setting,
otherwise MetaMask may incorrectly reject transactions. If you ran out of ETH, use
EMERGENCY SWAP to swap BOBA for 0.05 ETH at market rates.
EMERGENCY SWAP to swap BOBA for 0.005 ETH at market rates.
</Typography>
</G.AlertInfo>
<Button
Expand Down
2 changes: 2 additions & 0 deletions packages/boba/gateway/src/containers/wallet/token/Token.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ function TokenPage() {
return 'boba-network'
} else if(i.symbolL1 === 'OLO') {
return 'oolongswap'
} else if(i.symbolL1 === 'USDC') {
return 'usd-coin'
} else {
return i.symbolL1.toLowerCase()
}
Expand Down
2 changes: 2 additions & 0 deletions packages/boba/gateway/src/services/networkService.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,7 @@ class NetworkService {
}

let signature

try {
signature = await this.provider.send('eth_signTypedData_v4', [this.account, JSON.stringify(data)])
} catch (error) {
Expand All @@ -569,6 +570,7 @@ class NetworkService {
if(errorData.hasOwnProperty('error')) {
errorData = errorData.error.error.body
}
console.log("returning:",error)
return errorData
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/boba/gateway/src/util/amountConvert.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ export function amountToUsd(amount, lookupPrice, token) {
return amount * lookupPrice['oolongswap'].usd
} else if (token.symbol === 'OMG' && !!lookupPrice[ 'omisego' ]) {
return amount * lookupPrice['omisego'].usd
} else if (token.symbol === 'USDC' && !!lookupPrice[ 'usd-coin' ]) {
return amount * lookupPrice['usd-coin'].usd
} else if (!!lookupPrice[ token.symbol.toLowerCase() ]) {
return amount * lookupPrice[token.symbol.toLowerCase()].usd
} else {
Expand Down

0 comments on commit e6ce0af

Please sign in to comment.