Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(activation): switch SIA activation to the enable request #2491

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ui-tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
]
include:
- name: web-app-linux
os: [self-hosted, Linux]
os: ubuntu-latest

- name: web-app-macos
os: [self-hosted, macos]
os: macos-latest

steps:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
build_and_preview:
runs-on: [self-hosted, Linux]
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
Expand Down
23 changes: 14 additions & 9 deletions app_build/build_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"api": {
"api_commit_hash": "b021d34",
"api_commit_hash": "171f5f6",
"branch": "remaining-sia-swapops",
"fetch_at_build_enabled": true,
"source_urls": [
Expand All @@ -10,29 +10,35 @@
"web": {
"matching_keyword": "wasm",
"valid_zip_sha256_checksums": [
"cea9d2df6cba6af4de2b2583ed90ce7a6b1eb7658e2792778404bd4f192a76a3"
"f3dda3a77ca9da50ca924e82e7455decf0862a50b57d1b8bada7281eb7d2ce70"
],
"path": "web/src/mm2"
},
"ios": {
"matching_keyword": "ios-aarch64",
"valid_zip_sha256_checksums": ["3c8cad2bb1e58d3fc12a4a3d44d1d21499652b7aadb4ea5dadf583f695a1af05"],
"valid_zip_sha256_checksums": [
"0ad0ada35f41756bde4d3de479f5fe3f261559faba11430308da9d35e0f776e8"
],
"path": "ios"
},
"macos": {
"matching_keyword": "mac-arm64",
"valid_zip_sha256_checksums": ["e67f76ed5f3284c279b377f79e8288796c123ff4055168d15b0d17f5576352d7"],
"valid_zip_sha256_checksums": [
"db9d84bf61e7355cad6ea1af09db48b86a21c99bef874d7276931265684ff03d"
],
"path": "macos"
},
"windows": {
"matching_keyword": "win-x86-64",
"valid_zip_sha256_checksums": ["46298c52939a5220f719e1fb855cb3eff45de1b6ff6e72c9518279ac15160ae3"],
"valid_zip_sha256_checksums": [
"ea5d0e59ac7a940b54d37a9e16cc900be550ecc5131092c8fbea1ae03cb2f9f1"
],
"path": "windows/runner/exe"
},
"linux": {
"matching_keyword": "linux-x86-64",
"valid_zip_sha256_checksums": [
"eadf1e240d06004791cad99fff36b2ee939538d1349e7e0cc7b27d3339fa92e6"
"e89098bc317404975f9459a261e2a996f95d3a55fe50cb96c5e7fbb01b6cfbe5"
],
"path": "linux/mm2"
}
Expand All @@ -41,7 +47,7 @@
},
"coins": {
"update_commit_on_build": true,
"bundled_coins_repo_commit": "5e49096c30ece1fd0092e34261278be7632bc09e",
"bundled_coins_repo_commit": "dc9ace1cceed5da4a402d001b67fc28bbcd92bb8",
"coins_repo_api_url": "https://api.github.com/repos/KomodoPlatform/coins",
"coins_repo_content_url": "https://raw.githubusercontent.com/KomodoPlatform/coins",
"coins_repo_branch": "master",
Expand All @@ -51,5 +57,4 @@
"assets/coin_icons/png/": "icons"
}
}
}

}
20 changes: 1 addition & 19 deletions lib/mm2/mm2_api/mm2_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import 'package:web_dex/mm2/mm2_api/rpc/convert_address/convert_address_request.
import 'package:web_dex/mm2/mm2_api/rpc/disable_coin/disable_coin_req.dart';
import 'package:web_dex/mm2/mm2_api/rpc/electrum/electrum_req.dart';
import 'package:web_dex/mm2/mm2_api/rpc/enable/enable_req.dart';
import 'package:web_dex/mm2/mm2_api/rpc/enable/enable_req_status.dart';
import 'package:web_dex/mm2/mm2_api/rpc/enable_tendermint/enable_tendermint_token.dart';
import 'package:web_dex/mm2/mm2_api/rpc/enable_tendermint/enable_tendermint_with_assets.dart';
import 'package:web_dex/mm2/mm2_api/rpc/get_enabled_coins/get_enabled_coins_req.dart';
Expand Down Expand Up @@ -152,25 +151,8 @@ class Mm2Api {

Future<void> _enableSiaCoins(List<EnableSiaRequest> requests) async {
try {
// final requestToString =
// jsonEncode(requests.map((e) => e.toJson()).toList());
// log('SIA COIN ACTIVATION REQUESTS: \n$requestToString\n');
final dynamic response = await _call(requests);
log(
response,
path: 'api => _enableSiaCoins => _call',
);

final coinTasks = jsonDecode(response) as List<dynamic>;
final taskId = coinTasks[0]["result"]["task_id"];

final statusReq = EnableSiaStatusRequest(taskId: taskId);
String status = "InProgress";
while (status == "InProgress") {
final statusResp = jsonDecode(await _call(statusReq));
status = statusResp["result"]["status"] as String;
await Future.delayed(const Duration(milliseconds: 100), () => "2");
}
log( response, path: 'api => _enableSiaCoins');
} catch (e, s) {
log(
'Error enabling Sia coins: ${e.toString()}',
Expand Down
13 changes: 4 additions & 9 deletions lib/mm2/mm2_api/rpc/enable/enable_req.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,16 @@ class EnableSiaRequest implements BaseRequest {
late String userpass;

@override
final String method = 'enable_sia';
final String method = 'enable';

@override
Map<String, dynamic> toJson() {
return <String, dynamic>{
'userpass': userpass,
'mmrpc': '2.0',
'method': method,
'params': {
'ticker': ticker,
'activation_params': {
'tx_history': true,
'client_conf': httpConf.toJson(),
},
},
'tx_history': true,
'coin': ticker,
'client_conf': httpConf.toJson(),
};
}
}
Expand Down
30 changes: 0 additions & 30 deletions lib/mm2/mm2_api/rpc/enable/enable_req_status.dart

This file was deleted.

35 changes: 9 additions & 26 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
<!--
NB! This file is generated automatically as part of the build process in `./packages/komodo_wallet_build_transformer`.
Do not edit it manually.

If you need to manually rebuild the file, you can run the following command:

DO NOT CHECK INTO VERSION CONTROL.
```bash
npm install && npm run build
```

This file is generated! Please edit template.html instead! --><!doctype html><html lang="en"><head><base href="/"><meta charset="UTF-8"><meta content="IE=Edge" http-equiv="X-UA-Compatible"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="Start using Komodo Wallet from your web browser on any device or operating system. HODL and trade popular cryptocurrencies — BTC, ETH, DOGE, LTC, and more."><title>Komodo Wallet | Non-Custodial Multi-Coin Wallet & DEX</title><!-- Open Graph Protocol --><meta property="og:site_name" content="Komodo Wallet"/><meta property="og:type" content="website"/><meta property="og:title" content="Komodo Wallet | Non-Custodial Multi-Coin Wallet & DEX"/><meta property="og:description" content="Start using Komodo Wallet from your web browser on any device or operating system. HODL and trade popular cryptocurrencies — BTC, ETH, DOGE, LTC, and more."/><meta property="og:image" content="https://app.komodoplatform.com/thumbnail.jpg"/><!-- Twitter Card --><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Komodo Wallet | Non-Custodial Multi-Coin Wallet & DEX"/><meta name="twitter:description" content="Start using Komodo Wallet from your web browser on any device or operating system. HODL and trade popular cryptocurrencies — BTC, ETH, DOGE, LTC, and more."/><meta name="twitter:site" content="@komodoplatform"/><meta name="twitter:image" content="https://app.komodoplatform.com/thumbnail.jpg"/><!-- iOS meta tags & icons --><meta name="apple-mobile-web-app-capable" content="yes"><meta name="apple-mobile-web-app-status-bar-style" content="black"><meta name="apple-mobile-web-app-title" content="Komodo Wallet"><link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"><link rel="manifest" href="manifest.json"><link rel="mask-icon" href="/icons/safari-pinned-tab.svg" color="#5bbad5"><link rel="shortcut icon" href="/favicon.ico"><meta name="msapplication-TileColor" content="#0175c2"><meta name="msapplication-config" content="/icons/browserconfig.xml"><meta name="theme-color" content="#ffffff"><!-- Preload coin configs. This will no longer be needed in the near future when build-time coins are removed --><link rel="preload" as="fetch" href="assets/assets/config/coins.json" crossorigin><link rel="preload" as="fetch" href="assets/assets/config/coins_config.json" crossorigin><script src="/assets/packages/flutter_inappwebview_web/assets/web/web_support.js" defer="defer"></script><link rel="prefetch" href="/icons/logo_icon.png" as="image"><!-- Preconnects --><link rel="preconnect" href="https://www.gstatic.com"/><link rel="preconnect" href="https://www.googletagmanager.com"/><link rel="preconnect" href="https://worldtimeapi.org"/><!-- Preload resources --><link rel="preload" as="fetch" href="https://cache.defi-stats.komodo.earth/api/v3/prices/tickers_v2.json?expire_at=600" crossorigin><!-- <link rel="preload" as="fetch" href='https://defi-stats.komodo.earth/api/v3/stats_xyz/fiat_rates?expire_at=60' crossorigin> --><!-- Structured Data --><script type="application/ld+json">{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Komodo Wallet",
"url": "https://app.komodoplatform.com",
"description": "Start using Komodo Wallet from your web browser on any device or operating system. HODL and trade popular cryptocurrencies — BTC, ETH, DOGE, LTC, and more.",
"applicationCategory": "FinanceApplication",
"operatingSystem": "All",
maintainer: {
"@type": "Organization",
"name": "Komodo Platform",
"url": "https://komodoplatform.com",
"email": "[email protected]",
"logo": "https://komodoplatform.com/assets/img/logo-dark.png",
"sameAs": [
"https://twitter.com/komodoplatform",
"https://www.linkedin.com/company/komodoplatform",
"https://www.reddit.com/r/komodoplatform",
"https://www.youtube.com/channel/UCtp7YrrEnZbW97sgPldyvKg",
"https://www.github.com/KomodoPlatform"
],
"description": "Komodo is an open, composable blockchain platform. With a unique multi-chain design, Komodo is focused on providing fully composable blockchain solutions for independent developers, startups, and enterprise businesses alike.",
}
}</script><script defer="defer" src="dist/script.3de9a3603a465b8b295b.js"></script></head><body><script src="flutter_bootstrap.js" async></script><!-- Background --><style>body.light{background-color:#e6ebeb}body.dark{background-color:#121420}</style><script>var queryParams=new URLSearchParams(window.location.search),theme=queryParams.get("brightness");theme||=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.body.classList.add(theme)</script><!-- Loading indicator --><div id="loading"><style>body{inset:0;overflow:hidden;margin:0;padding:0;position:fixed}#loading{align-items:center;display:flex;height:100%;justify-content:center;width:100%}#loading img{animation:1s ease-in-out 0s infinite alternate breathe;opacity:.9;transition:opacity .4s}#loading.main_done img{opacity:1}#loading.init_done img{animation:.33s ease-in-out 0s 1 forwards zooooom;opacity:.05}@keyframes breathe{from{transform:scale(1)}to{transform:scale(.95)}}@keyframes zooooom{from{transform:scale(1)}to{transform:scale(.01)}}</style><img src="/icons/logo_icon.png" width="192" height="192" alt="Komodo Wallet is starting... Please wait."/></div><script async="false">window.addEventListener("DOMContentLoaded",(d=>{console.log("DOM fully loaded and parsed"),window.init_wasm&&!0!==window.is_mm2_preload_busy&&(window.is_mm2_preload_busy=!0,window.init_wasm().then((()=>{window.is_mm2_preloaded=!0})).finally((()=>{window.is_mm2_preload_busy=!1})))}))</script><!-- App --><div id="main-content" style="position:absolute;width:100%;height:100%;display:none"><!-- Flutter app will be injected here --></div></body></html>
If you are seeing this message in your browser, it means that the build steps have not been run. Please run `flutter
clean && flutter pub get` and then try again. If issues persist, please ensure you are using the latest Flutter SDK and
have set up your environment correctly as per our docs.
Loading