From bb14a4d7a55fcc3417c8fa606ee279154d12e1c1 Mon Sep 17 00:00:00 2001 From: Jan Marcano Date: Mon, 1 Mar 2021 12:26:33 -0300 Subject: [PATCH 01/11] Missing Formatting on AlgoSigner wrapper --- packages/dapp/src/algosigner.ts | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/dapp/src/algosigner.ts b/packages/dapp/src/algosigner.ts index fa210c41..5f6133ac 100644 --- a/packages/dapp/src/algosigner.ts +++ b/packages/dapp/src/algosigner.ts @@ -1,26 +1,26 @@ -import {Task} from './fn/task'; -import {Router} from './fn/router'; +import { Task } from './fn/task'; +import { Router } from './fn/router'; class Wrapper { - private static instance: Wrapper; - private task: Task = new Task(); - private router: Router = new Router(); - - public connect: Function = this.task.connect; - public sign: Function = this.task.sign; - public signMultisig: Function = this.task.signMultisig; - public send: Function = this.task.send; - public accounts: Function = this.task.accounts; - public algod: Function = this.task.algod; - public indexer: Function = this.task.indexer; - public subscribe: Function = this.task.subscribe; + private static instance: Wrapper; + private task: Task = new Task(); + private router: Router = new Router(); - public static getInstance(): Wrapper { - if (!Wrapper.instance) { - Wrapper.instance = new Wrapper(); - } - return Wrapper.instance; + public connect: Function = this.task.connect; + public sign: Function = this.task.sign; + public signMultisig: Function = this.task.signMultisig; + public send: Function = this.task.send; + public accounts: Function = this.task.accounts; + public algod: Function = this.task.algod; + public indexer: Function = this.task.indexer; + public subscribe: Function = this.task.subscribe; + + public static getInstance(): Wrapper { + if (!Wrapper.instance) { + Wrapper.instance = new Wrapper(); } + return Wrapper.instance; + } } -export const AlgoSigner = Wrapper.getInstance(); \ No newline at end of file +export const AlgoSigner = Wrapper.getInstance(); From 92492a90fa787a9580a6d9ee115c8bc747a2306b Mon Sep 17 00:00:00 2001 From: Jan Marcano Date: Mon, 1 Mar 2021 12:27:37 -0300 Subject: [PATCH 02/11] Fix Console error on Logout --- packages/extension/src/background/messaging/task.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/extension/src/background/messaging/task.ts b/packages/extension/src/background/messaging/task.ts index c6a995ca..0feb5159 100644 --- a/packages/extension/src/background/messaging/task.ts +++ b/packages/extension/src/background/messaging/task.ts @@ -775,6 +775,7 @@ export class Task { [JsonRpcMethod.Logout]: (request: any, sendResponse: Function) => { InternalMethods.clearSession(); Task.clearPool(); + sendResponse(true); }, [JsonRpcMethod.GetSession]: (request: any, sendResponse: Function) => { return InternalMethods[JsonRpcMethod.GetSession](request, sendResponse); From 89bb2a083e7686f7c237602eabb815a6b887d0cb Mon Sep 17 00:00:00 2001 From: Jan Marcano Date: Mon, 1 Mar 2021 12:27:59 -0300 Subject: [PATCH 03/11] Fix typo on Validator Error messages --- packages/extension/src/background/utils/validator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/extension/src/background/utils/validator.ts b/packages/extension/src/background/utils/validator.ts index efe4a849..95f290bd 100644 --- a/packages/extension/src/background/utils/validator.ts +++ b/packages/extension/src/background/utils/validator.ts @@ -51,7 +51,7 @@ export function Validate(field: any, value: any): ValidationResponse { if (!algosdk.isValidAddress(value)) { return new ValidationResponse({ status: ValidationStatus.Invalid, - info: 'Address does not adhear to a valid structure.', + info: 'Address does not adhere to a valid structure.', }); } else { return new ValidationResponse({ status: ValidationStatus.Valid }); @@ -60,7 +60,7 @@ export function Validate(field: any, value: any): ValidationResponse { if (!algosdk.isValidAddress(value)) { return new ValidationResponse({ status: ValidationStatus.Invalid, - info: 'Address does not adhear to a valid structure.', + info: 'Address does not adhere to a valid structure.', }); } else { return new ValidationResponse({ status: ValidationStatus.Valid }); From e6e795bca8a69ff0316be5b3efda57133ceaf79b Mon Sep 17 00:00:00 2001 From: Jan Marcano Date: Mon, 1 Mar 2021 12:30:14 -0300 Subject: [PATCH 04/11] Add loading spinner to Create Wallet --- packages/ui/src/pages/SetPassword.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/ui/src/pages/SetPassword.ts b/packages/ui/src/pages/SetPassword.ts index 77bbae6a..2d1056cc 100644 --- a/packages/ui/src/pages/SetPassword.ts +++ b/packages/ui/src/pages/SetPassword.ts @@ -21,6 +21,7 @@ const SetPassword: FunctionalComponent = (props) => { const [pwd, setPwd] = useState(''); const [confirmPwd, setConfirmPwd] = useState(''); const [error, setError] = useState(''); + const [loading, setLoading] = useState(false); const store: any = useContext(StoreContext); const createWallet = () => { @@ -36,7 +37,10 @@ const SetPassword: FunctionalComponent = (props) => { passphrase: pwd, }; + setLoading(true); + sendMessage(JsonRpcMethod.CreateWallet, params, function (response) { + setLoading(false); if ('error' in response) { setError(response.error); } else { @@ -117,7 +121,7 @@ const SetPassword: FunctionalComponent = (props) => {