Skip to content

Commit

Permalink
Remove BlockNative as notify API is being deprecated.
Browse files Browse the repository at this point in the history
  • Loading branch information
torreyatcitty committed Aug 20, 2024
1 parent 8f14d8b commit 058089b
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 218 deletions.
1 change: 0 additions & 1 deletion .github/workflows/build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ jobs:
run: yarn build
env:
DATA_PROVIDERS: ${{ secrets.DATA_PROVIDERS }}
BLOCKNATIVE_API_KEY: ${{ secrets.BLOCKNATIVE_API_KEY }}
WALLET_CONNECT_PROJECT_ID: ${{ secrets.WALLET_CONNECT_PROJECT_ID }}

- name: Archive App
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ The following is an example configuration file:
"development": 999
},
"DEFAULT_NETWORK": "mainnet",
"BLOCKNATIVE_API_KEY": "YOUR_BLOCKNATIVE_KEY",
"WALLET_CONNECT_PROJECT_ID": "YOUR_WALLET_CONNECT_PROJECT_ID"
}
```
Expand All @@ -53,7 +52,6 @@ Each of the top level keys have the following functions:
- `API_BASE_URL_MAP` - Object mapping of Eth network name as key and value being the desired Compound Api host. This can be left as is.
- `DATA_PROVIDERS` - Object mapping of Eth network name as key and value being the url of a corresponding JSON RPC host. This example shows Infura as a sample JSON RPC provider and you can find more information [here](https://infura.io/docs/ethereum). Note: this can be specified by setting in the env var `DATA_PROVIDERS` as JSON (e.g. `export DATA_PROVIDERS='{"rinkeby": "https://infura.io/..."}'`).
- `NETWORK_MAP` - Object mapping of Eth network name as key and value being the corresponding NetworkId value. This can be left as is.
- `BLOCKNATIVE_API_KEY` - Blocknative API Key required to track transaction notifications. You can find more information [here](https://docs.blocknative.com/notify). Note: this can be specified by setting the env var `BLOCKNATIVE_API_KEY`. This key is not strictly required (but provides a better user experience).
- `WALLET_CONNECT_PROJECT_ID` - Wallect Connect Project Id required to use Wallet Connect as a wallet type in the app. You can find more information [here](https://docs.walletconnect.com/2.0/). Note: this can be specified by setting the env var `WALLET_CONNECT_PROJECT_ID`. This id is not required unless you want to enable wallet connect usage.

## Getting Started
Expand Down
4 changes: 0 additions & 4 deletions config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@ const envPath = path.join(appDirectory, '/config/env');
const envJson = fs.readFileSync(path.join(envPath, `${CONFIG_ENV}.json`));
const envConfig = JSON.parse(envJson);

if (process.env['BLOCKNATIVE_API_KEY']) {
envConfig.BLOCKNATIVE_API_KEY = process.env['BLOCKNATIVE_API_KEY'];
}

if (process.env['WALLET_CONNECT_PROJECT_ID']) {
envConfig.WALLET_CONNECT_PROJECT_ID = process.env['WALLET_CONNECT_PROJECT_ID'];
}
Expand Down
3 changes: 1 addition & 2 deletions config/env/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@
"kovan": 42,
"development": 999
},
"DEFAULT_NETWORK": "mainnet",
"BLOCKNATIVE_API_KEY": null
"DEFAULT_NETWORK": "mainnet"
}
3 changes: 1 addition & 2 deletions config/env/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@
"goerli": 5,
"kovan": 42
},
"DEFAULT_NETWORK": "mainnet",
"BLOCKNATIVE_API_KEY": null
"DEFAULT_NETWORK": "mainnet"
}
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
"assets-webpack-plugin": "^3.5.1",
"autoprefixer": "^9.7.6",
"babel-loader": "^8.0.0",
"bnc-sdk": "^3.3.3",
"case-sensitive-paths-webpack-plugin": "^2.1.2",
"chalk": "^4.0.0",
"clean-webpack-plugin": "^3.0.0",
Expand Down
15 changes: 5 additions & 10 deletions src/elm/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import Http
import Json.Decode
import Json.Encode
import Liquidate
import Port exposing (askNetwork, askNewBlock, askSetBlockNativeNetworkPort, giveAccountBalance, giveError, giveNewBlock, setGasPrice, setTitle)
import Port exposing (askNetwork, askNewBlock, giveAccountBalance, giveError, giveNewBlock, setGasPrice, setTitle)
import Preferences exposing (PreferencesMsg(..), preferencesInit, preferencesSubscriptions, preferencesUpdate)
import Repl
import Strings.Translations as Translations
Expand Down Expand Up @@ -326,7 +326,6 @@ newBlockCmd apiBaseUrlMap maybeNetwork blockNumber previousBlockNumber ({ dataPr

_ ->
[]

in
Cmd.batch <|
pageCmds
Expand Down Expand Up @@ -373,15 +372,9 @@ handleUpdatesFromEthConnectedWallet maybeConfig connectedEthWalletMsg model =
else
model.voteModel

setBlockNativeCmd =
askSetBlockNativeNetworkPort
{ networkId = networkId newNetwork
}

cmd =
Cmd.batch
([ setBlockNativeCmd
, refreshLatestGasPrice model.apiBaseUrlMap newNetwork
([ refreshLatestGasPrice model.apiBaseUrlMap newNetwork
, Cmd.map WrappedTokenMsg newTokenCmd
, Cmd.map liquidateTranslator newLiquidateCmd
]
Expand All @@ -391,6 +384,7 @@ handleUpdatesFromEthConnectedWallet maybeConfig connectedEthWalletMsg model =
refreshBlockCmd =
if model.network /= Just newNetwork then
newBlockCmd model.apiBaseUrlMap (Just newNetwork) blockNumber Nothing model

else
Cmd.none
in
Expand Down Expand Up @@ -1117,10 +1111,11 @@ update msg ({ page, configs, apiBaseUrlMap, account, transactionState, bnTransac


view : Model -> Html Msg
view ({userLanguage} as model) =
view ({ userLanguage } as model) =
Html.div [ id "main" ]
(viewFull model)


viewFull : Model -> List (Html Msg)
viewFull ({ page, liquidateModel, transactionState, compoundState, tokenState, oracleState, configs, configAbis, network, preferences, account, blockNumber, userLanguage } as model) =
let
Expand Down
8 changes: 0 additions & 8 deletions src/elm/Port.elm
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
port module Port exposing
( askNetwork
, askNewBlock
, askSetBlockNativeNetworkPort
, encodeParameters
, giveAccountBalance
, giveEncodedExtrinsic
Expand Down Expand Up @@ -42,13 +41,6 @@ port setTitle : String -> Cmd msg
port giveProviderType : (Int -> msg) -> Sub msg



-- Update BlockNative target network


port askSetBlockNativeNetworkPort : { networkId : Int } -> Cmd msg


port giveAccountBalancePort : (Value -> msg) -> Sub msg


Expand Down
1 change: 0 additions & 1 deletion src/js/dapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ window.addEventListener('load', function () {
configFiles,
configAbiFiles,
configNameToAddressMappings,
process.env.BLOCKNATIVE_API_KEY,
process.env.WALLET_CONNECT_PROJECT_ID
);
});
Loading

0 comments on commit 058089b

Please sign in to comment.