From 889fe3f5b8dcd92ea24eda07fb6398daa9b02efd Mon Sep 17 00:00:00 2001
From: Davide Segullo
Date: Wed, 15 Jun 2022 13:24:47 +0200
Subject: [PATCH 01/10] feat: :sparkles: add wallet connect
---
package.json | 4 +
src/components/BalanceSummary.vue | 2 +-
src/layouts/MainLayout.vue | 5 +-
src/models/index.ts | 1 +
src/models/session.ts | 1 +
src/models/wallet-connect.ts | 18 +
.../authentication/views/LoginHome.vue | 30 +-
src/services/index.ts | 1 +
src/services/wallet-connect.ts | 59 +++
src/signing/transaction-manager.ts | 37 ++
src/store/data/actions.ts | 63 ++-
yarn.lock | 378 +++++++++++++++++-
12 files changed, 562 insertions(+), 37 deletions(-)
create mode 100644 src/models/wallet-connect.ts
create mode 100644 src/services/wallet-connect.ts
diff --git a/package.json b/package.json
index 185b0569..d7c4b577 100644
--- a/package.json
+++ b/package.json
@@ -22,6 +22,9 @@
"@ledgerhq/hw-transport-webhid": "^6.20.0",
"@ledgerhq/hw-transport-webusb": "^6.20.0",
"@quasar/extras": "^1.0.0",
+ "@walletconnect/browser-utils": "^1.7.8",
+ "@walletconnect/client": "^1.7.8",
+ "@walletconnect/qrcode-modal": "^1.7.8",
"axios": "^0.21.1",
"bech32": "^2.0.0",
"bignumber.js": "^9.0.2",
@@ -54,6 +57,7 @@
"@types/w3c-web-hid": "^1.0.2",
"@typescript-eslint/eslint-plugin": "^4.16.1",
"@typescript-eslint/parser": "^4.16.1",
+ "@walletconnect/types": "^1.7.8",
"eslint": "^7.14.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.19.1",
diff --git a/src/components/BalanceSummary.vue b/src/components/BalanceSummary.vue
index 45ad434a..30e72eb9 100644
--- a/src/components/BalanceSummary.vue
+++ b/src/components/BalanceSummary.vue
@@ -41,7 +41,7 @@
-
+
SEND
diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue
index eccce333..1eb5de8e 100644
--- a/src/layouts/MainLayout.vue
+++ b/src/layouts/MainLayout.vue
@@ -91,6 +91,7 @@ import { useRouter } from 'vue-router';
import MenuLink from 'src/components/MenuLink.vue';
import FaucetDialog from 'src/components/FaucetDialog.vue';
+import { SessionType } from 'src/models';
export default defineComponent({
name: 'MainLayout',
@@ -123,7 +124,9 @@ export default defineComponent({
});
window.addEventListener('keplr_keystorechange', async () => {
- await store.dispatch('authentication/init');
+ if (session.value && session.value.sessionType === SessionType.KEPLR) {
+ await store.dispatch('authentication/init');
+ }
});
onMounted(() => {
diff --git a/src/models/index.ts b/src/models/index.ts
index b18c3d3b..8cb0a34b 100644
--- a/src/models/index.ts
+++ b/src/models/index.ts
@@ -21,3 +21,4 @@ export * from './supply';
export * from './inflaction';
export * from './faucet';
export * from './fantoken';
+export * from './wallet-connect';
diff --git a/src/models/session.ts b/src/models/session.ts
index a179d28e..ad7a78ad 100644
--- a/src/models/session.ts
+++ b/src/models/session.ts
@@ -2,6 +2,7 @@ export enum SessionType {
KEPLR = 'keplr',
LOCAL = 'local',
LEDGER = 'ledger',
+ WALLET_CONNECT = 'walletconnect',
EXTENSION = 'extension',
EXPLORE = 'explore'
}
diff --git a/src/models/wallet-connect.ts b/src/models/wallet-connect.ts
new file mode 100644
index 00000000..c4dfb429
--- /dev/null
+++ b/src/models/wallet-connect.ts
@@ -0,0 +1,18 @@
+export interface PeerMeta {
+ description: string
+ icons: string[]
+ name: string
+ url: string
+}
+
+export interface WalletConnectPayload {
+ event: string
+ params: T[]
+}
+
+export interface WalletConnectionParam {
+ accounts: string[]
+ chainId: number
+ peerId: string
+ peerMeta: PeerMeta
+}
diff --git a/src/modules/authentication/views/LoginHome.vue b/src/modules/authentication/views/LoginHome.vue
index fd9e4f0c..44735d70 100644
--- a/src/modules/authentication/views/LoginHome.vue
+++ b/src/modules/authentication/views/LoginHome.vue
@@ -7,16 +7,8 @@
- -
-
-
-
-
-
-
- -
+
+ -
-
+
-
+
-
+
-
+
diff --git a/src/modules/wallet/components/ValidatorDelegation.vue b/src/modules/wallet/components/ValidatorDelegation.vue
index be8c11fe..3137e8c5 100644
--- a/src/modules/wallet/components/ValidatorDelegation.vue
+++ b/src/modules/wallet/components/ValidatorDelegation.vue
@@ -8,15 +8,15 @@
-
+
delegate
-
+
-
+
redelegate
diff --git a/src/modules/wallet/components/ValidatorRewards.vue b/src/modules/wallet/components/ValidatorRewards.vue
index 7cf0eec2..1e7eba4a 100644
--- a/src/modules/wallet/components/ValidatorRewards.vue
+++ b/src/modules/wallet/components/ValidatorRewards.vue
@@ -8,7 +8,7 @@
-
+
CLAIM
diff --git a/src/modules/wallet/views/Fantokens.vue b/src/modules/wallet/views/Fantokens.vue
index 4c5c5a08..a086bc7e 100644
--- a/src/modules/wallet/views/Fantokens.vue
+++ b/src/modules/wallet/views/Fantokens.vue
@@ -6,7 +6,7 @@
Fantoken Lab
-
+
CREATE FANTOKEN
diff --git a/src/modules/wallet/views/IssueFantoken.vue b/src/modules/wallet/views/IssueFantoken.vue
index 6b6eaa20..42a909c3 100644
--- a/src/modules/wallet/views/IssueFantoken.vue
+++ b/src/modules/wallet/views/IssueFantoken.vue
@@ -103,7 +103,7 @@
-->
-
+
ISSUE
diff --git a/src/modules/wallet/views/Portfolio.vue b/src/modules/wallet/views/Portfolio.vue
index 2c79053a..54d792b6 100644
--- a/src/modules/wallet/views/Portfolio.vue
+++ b/src/modules/wallet/views/Portfolio.vue
@@ -36,7 +36,7 @@
-
+
Create New
diff --git a/src/modules/wallet/views/SubmitProposal.vue b/src/modules/wallet/views/SubmitProposal.vue
index 7ae43cab..90dfec81 100644
--- a/src/modules/wallet/views/SubmitProposal.vue
+++ b/src/modules/wallet/views/SubmitProposal.vue
@@ -99,7 +99,7 @@
-
+
Publish
From 6672938b783d65818134fe9b9a34cb94fb23e232 Mon Sep 17 00:00:00 2001
From: DavideSegullo
Date: Sat, 23 Jul 2022 16:45:02 +0200
Subject: [PATCH 08/10] fix: :bug: fix remove min deposit for proposal
---
src/modules/wallet/views/SubmitProposal.vue | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/modules/wallet/views/SubmitProposal.vue b/src/modules/wallet/views/SubmitProposal.vue
index 90dfec81..c9169db9 100644
--- a/src/modules/wallet/views/SubmitProposal.vue
+++ b/src/modules/wallet/views/SubmitProposal.vue
@@ -69,7 +69,6 @@
val => !!val || 'Field is required',
val => !isNaN(val) || 'Amount must be a decimal value',,
val => gtnZero(val) || 'Amount must be a greater then zero',
- val => !minAmount(val, minDeposit) || `inimum amount required ${minDeposit} ${network.stakingDenom}`,
val => compareBalance(val, availableCoins) || 'You don\'t have enough coins',
val => !isNegative(val) || 'Amount must be greater then zero'
]"
From 4451c3db8dec180ebd35ab05e1061eda4e0b77ec Mon Sep 17 00:00:00 2001
From: Giorgio Nocera
Date: Fri, 29 Jul 2022 09:36:24 +0200
Subject: [PATCH 09/10] refactor: :speech_balloon: update connection buttons
Updating the name for mobile app connection button.
---
src/modules/authentication/views/LoginHome.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modules/authentication/views/LoginHome.vue b/src/modules/authentication/views/LoginHome.vue
index 44735d70..ceb0c88c 100644
--- a/src/modules/authentication/views/LoginHome.vue
+++ b/src/modules/authentication/views/LoginHome.vue
@@ -7,7 +7,7 @@
-
+
-
From e7a0c489feac011968864a8b18fb670023cc5abd Mon Sep 17 00:00:00 2001
From: DavideSegullo
Date: Fri, 29 Jul 2022 21:29:20 +0200
Subject: [PATCH 10/10] fix: :wrench: update bitsong testnet config
---
src/constants/network.ts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/constants/network.ts b/src/constants/network.ts
index a6125111..d1da1f48 100644
--- a/src/constants/network.ts
+++ b/src/constants/network.ts
@@ -2,16 +2,16 @@ import { NetworkConfig } from 'src/models';
// Default network
export const network: NetworkConfig = {
- id: 'bitsong-2b',
+ id: 'b-public-testnet-1',
name: 'BitSong Testnet',
description: 'BitSong Testnet',
logo: 'logo.svg',
website: 'https://bitsong.io',
- apiURL: 'http://host.docker.internal:1317',
+ apiURL: 'https://lcd.b-public-testnet-1.bitsong.network',
faucetURL: 'https://faucet.testnet.bitsong.network',
- rpcURL: 'http://host.docker.internal:26657',
+ rpcURL: 'https://rpc.b-public-testnet-1.bitsong.network',
explorerURL: 'https://www.mintscan.io/bitsong/',
- minBlockHeight: 1,
+ minBlockHeight: 6995667,
stakingDenom: 'BTSG',
coinLookup: [
{