From 2194dfc77ab93ca438e4b2a19cd6cb8e52af4077 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 8 Mar 2023 20:56:45 +0100 Subject: [PATCH 01/28] Added tests --- packages/ledger/src/lib/ledger.spec.ts | 16 ++++++++++++ .../src/lib/my-near-wallet.spec.ts | 26 ++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/packages/ledger/src/lib/ledger.spec.ts b/packages/ledger/src/lib/ledger.spec.ts index 53ffaa8cd..62304d8e4 100644 --- a/packages/ledger/src/lib/ledger.spec.ts +++ b/packages/ledger/src/lib/ledger.spec.ts @@ -174,3 +174,19 @@ describe("signAndSendTransactions", () => { expect(result.length).toEqual(transactions.length); }); }); + +describe("getPublicKey", () => { + it("returns public key", async () => { + const accountId = "amirsaran.testnet"; + const derivationPath = "44'/397'/0'/0'/1'"; + const { wallet, publicKey } = await createLedgerWallet(); + await wallet.signIn({ + accounts: [{ derivationPath, publicKey, accountId }], + contractId: "guest-book.testnet", + }); + const publicKeyResponse = await wallet.getPublicKey(derivationPath); + expect(publicKeyResponse).toBe( + "GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC" + ); + }); +}); diff --git a/packages/my-near-wallet/src/lib/my-near-wallet.spec.ts b/packages/my-near-wallet/src/lib/my-near-wallet.spec.ts index 4ee4a0dcc..504adacc3 100644 --- a/packages/my-near-wallet/src/lib/my-near-wallet.spec.ts +++ b/packages/my-near-wallet/src/lib/my-near-wallet.spec.ts @@ -98,7 +98,7 @@ describe("getAccounts", () => { describe("signAndSendTransaction", () => { // TODO: Figure out why imports to core are returning undefined. - it.skip("signs and sends transaction", async () => { + it("signs and sends transaction", async () => { const { wallet, walletConnection, account } = await createMyNearWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -120,6 +120,30 @@ describe("signAndSendTransaction", () => { }); }); +describe("verifyOwner", () => { + it("verifies owner", async () => { + const { wallet } = await createMyNearWallet(); + + const replace = window.location.replace; + + await wallet.signIn({ contractId: "test.testnet" }); + + Object.defineProperty(window, "location", { + value: { replace: jest.fn() }, + }); + + const result = await wallet.verifyOwner({ + message: "message", + callbackUrl: "http://localhost", + }); + + expect(result).toBe(undefined); + expect(window.location.replace).toHaveBeenCalled(); + + window.location.replace = replace; + }); +}); + describe("buildImportAccountsUrl", () => { it("returns import url", async () => { const { wallet } = await createMyNearWallet(); From 7c570637f0bcded846589498471b3182627659b4 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 8 Mar 2023 21:03:02 +0100 Subject: [PATCH 02/28] Added tests for opto-wallet --- .../opto-wallet/src/lib/opto-wallet.spec.ts | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/opto-wallet/src/lib/opto-wallet.spec.ts b/packages/opto-wallet/src/lib/opto-wallet.spec.ts index 9a021ad9b..0af038abc 100644 --- a/packages/opto-wallet/src/lib/opto-wallet.spec.ts +++ b/packages/opto-wallet/src/lib/opto-wallet.spec.ts @@ -106,7 +106,7 @@ describe("getAccounts", () => { describe("signAndSendTransaction", () => { // TODO: Figure out why imports to core are returning undefined. - it.skip("signs and sends transaction", async () => { + it("signs and sends transaction", async () => { window.opto = {}; const { wallet, walletConnection, account } = await createOptoWallet(); @@ -128,3 +128,28 @@ describe("signAndSendTransaction", () => { expect(result).toEqual(null); }); }); + +describe("verifyOwner", () => { + it("verifies owner", async () => { + window.opto = {}; + const { wallet } = await createOptoWallet(); + + const replace = window.location.replace; + + await wallet.signIn({ contractId: "test.testnet" }); + + Object.defineProperty(window, "location", { + value: { replace: jest.fn() }, + }); + + const result = await wallet.verifyOwner({ + message: "message", + callbackUrl: "http://localhost", + }); + + expect(result).toBe(undefined); + expect(window.location.replace).toHaveBeenCalled(); + + window.location.replace = replace; + }); +}); From cac50bc0bc47a5b7646bd92f0d40fc72b57ff67d Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Thu, 9 Mar 2023 16:58:41 +0100 Subject: [PATCH 03/28] Added sender test (not working atm) --- packages/sender/src/lib/sender.spec.ts | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 packages/sender/src/lib/sender.spec.ts diff --git a/packages/sender/src/lib/sender.spec.ts b/packages/sender/src/lib/sender.spec.ts new file mode 100644 index 000000000..6526ca214 --- /dev/null +++ b/packages/sender/src/lib/sender.spec.ts @@ -0,0 +1,39 @@ +/* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mockWallet } from "../../../core/src/lib/testUtils"; +import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; +import type { InjectedWallet } from "../../../core/src/lib/wallet"; + +const createSenderWallet = async (deps: MockWalletDependencies = {}) => { + // eslint-disable-next-line no-console + console.log("asdasdasdasd"); + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { setupSender } = require("./sender"); + // eslint-disable-next-line no-console + console.log("setupWallet", setupSender); + const { wallet } = await mockWallet(setupSender(), deps); + // eslint-disable-next-line no-console + console.log("wallet", wallet); + + return { + wallet, + }; +}; + +afterEach(() => { + jest.resetModules(); +}); + +describe("signIn", () => { + it("sign into near wallet", async () => { + // eslint-disable-next-line no-console + console.log("========================================asdasdasd"); + const { wallet } = await createSenderWallet(); + + const res = await wallet.signIn({ contractId: "test.testnet" }); + + // eslint-disable-next-line no-console + console.log("===================", res); + + // expect(window.near.requestSignIn).toHaveBeenCalled(); + }); +}); From 79e06d634618bd191d92ea2e7fb9932c8292841c Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Fri, 10 Mar 2023 14:12:48 +0100 Subject: [PATCH 04/28] removed console.logs --- packages/sender/src/lib/sender.spec.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/sender/src/lib/sender.spec.ts b/packages/sender/src/lib/sender.spec.ts index 6526ca214..8297b0245 100644 --- a/packages/sender/src/lib/sender.spec.ts +++ b/packages/sender/src/lib/sender.spec.ts @@ -4,15 +4,9 @@ import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; import type { InjectedWallet } from "../../../core/src/lib/wallet"; const createSenderWallet = async (deps: MockWalletDependencies = {}) => { - // eslint-disable-next-line no-console - console.log("asdasdasdasd"); // eslint-disable-next-line @typescript-eslint/no-var-requires const { setupSender } = require("./sender"); - // eslint-disable-next-line no-console - console.log("setupWallet", setupSender); const { wallet } = await mockWallet(setupSender(), deps); - // eslint-disable-next-line no-console - console.log("wallet", wallet); return { wallet, @@ -25,14 +19,9 @@ afterEach(() => { describe("signIn", () => { it("sign into near wallet", async () => { - // eslint-disable-next-line no-console - console.log("========================================asdasdasd"); const { wallet } = await createSenderWallet(); - const res = await wallet.signIn({ contractId: "test.testnet" }); - - // eslint-disable-next-line no-console - console.log("===================", res); + await wallet.signIn({ contractId: "test.testnet" }); // expect(window.near.requestSignIn).toHaveBeenCalled(); }); From b700fd111007db392ece04a4e5b255db789c8013 Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Mon, 13 Mar 2023 12:35:38 +0100 Subject: [PATCH 05/28] Attempt fixing sender tests. --- packages/sender/src/lib/injected-sender.ts | 8 +- packages/sender/src/lib/sender.spec.ts | 91 +++++++++++++++++++++- packages/sender/src/lib/sender.ts | 2 +- packages/sender/tsconfig.json | 3 +- 4 files changed, 97 insertions(+), 7 deletions(-) diff --git a/packages/sender/src/lib/injected-sender.ts b/packages/sender/src/lib/injected-sender.ts index f42d1e14b..63036ef29 100644 --- a/packages/sender/src/lib/injected-sender.ts +++ b/packages/sender/src/lib/injected-sender.ts @@ -18,7 +18,7 @@ interface RequestSignInResponse { type: "sender-wallet-result"; } -type SignOutResponse = true | { error: string | { type: string } }; +export type SignOutResponse = true | { error: string | { type: string } }; interface RpcInfo { explorerUrl: string; @@ -74,7 +74,7 @@ interface SignAndSendTransactionParams { actions: Array; } -interface FunctionCallError { +export interface FunctionCallError { error: { index: number; kind: object; @@ -85,7 +85,7 @@ interface FunctionCallError { } // Seems to reuse signAndSendTransactions internally, hence the wrong method name and list of responses. -interface SignAndSendTransactionResponse { +export interface SignAndSendTransactionResponse { actionType: "DAPP/DAPP_POPUP_RESPONSE"; method: "signAndSendTransactions"; notificationId: number; @@ -112,7 +112,7 @@ interface RequestSignTransactionsParams { transactions: Array; } -interface SenderEvents { +export interface SenderEvents { signIn: () => void; signOut: () => void; accountChanged: (changedAccountId: string) => void; diff --git a/packages/sender/src/lib/sender.spec.ts b/packages/sender/src/lib/sender.spec.ts index 8297b0245..08527a94a 100644 --- a/packages/sender/src/lib/sender.spec.ts +++ b/packages/sender/src/lib/sender.spec.ts @@ -1,9 +1,53 @@ /* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mock } from "jest-mock-extended"; import { mockWallet } from "../../../core/src/lib/testUtils"; + import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; import type { InjectedWallet } from "../../../core/src/lib/wallet"; +import type { InjectedSender, SenderEvents } from "./injected-sender"; +import type { FinalExecutionOutcome } from "near-api-js/lib/providers"; +import type { SignOutResponse } from "./injected-sender"; + +declare global { + interface Window { + near: InjectedSender; + } +} + +const mockSenderOnWindow = () => { + window.near = { + isSender: true, + callbacks: mock(), + getAccountId: jest.fn().mockReturnValue("test-account.testnet"), + getRpc: jest.fn(), + account: jest.fn().mockReturnValue({ + connection: { + signer: { + getPublicKey: jest.fn().mockReturnValue(""), + }, + }, + }), + requestSignIn: jest + .fn() + .mockReturnValue({ accessKey: "accessKey", error: "" }), + signOut: jest.fn().mockReturnValue(mock()), + isSignedIn: jest.fn().mockReturnValue(true), + remove: jest.fn(), + on: jest.fn(), + sendMoney: jest.fn(), + signAndSendTransaction: jest.fn().mockReturnValue( + Promise.resolve({ + error: undefined, + response: mock(), + }) + ), + requestSignTransactions: jest.fn().mockReturnValue(null), + }; +}; const createSenderWallet = async (deps: MockWalletDependencies = {}) => { + mockSenderOnWindow(); + // eslint-disable-next-line @typescript-eslint/no-var-requires const { setupSender } = require("./sender"); const { wallet } = await mockWallet(setupSender(), deps); @@ -21,8 +65,53 @@ describe("signIn", () => { it("sign into near wallet", async () => { const { wallet } = await createSenderWallet(); + // Allow `requestSignIn` to be invoked + // getAccounts depends on window.near.getAccountId + // so by default the mocked account would be returned. + window.near.getAccountId = jest.fn().mockReturnValue(""); + + await wallet.signIn({ contractId: "test.testnet" }); + + expect(window.near.requestSignIn).toHaveBeenCalled(); + }); +}); + +describe("signOut", () => { + it("sign out of sender wallet", async () => { + const { wallet } = await createSenderWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signOut(); + + expect(window.near.signOut).toHaveBeenCalled(); + }); +}); + +describe("getAccounts", () => { + it("returns array of accounts", async () => { + const { wallet } = await createSenderWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.getAccounts(); + + expect(window.near.getAccountId).toHaveBeenCalled(); + expect(result).toEqual([ + { accountId: "test-account.testnet", publicKey: undefined }, + ]); + }); +}); + +describe("signAndSendTransaction", () => { + it("sign transaction in sender", async () => { + const { wallet } = await createSenderWallet(); + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signAndSendTransaction({ + signerId: "test-account.testnet", + receiverId: "test.testnet", + actions: [], + }); - // expect(window.near.requestSignIn).toHaveBeenCalled(); + expect(window.near.signAndSendTransaction).toHaveBeenCalled(); }); }); diff --git a/packages/sender/src/lib/sender.ts b/packages/sender/src/lib/sender.ts index 71380a1c8..b26126a4f 100644 --- a/packages/sender/src/lib/sender.ts +++ b/packages/sender/src/lib/sender.ts @@ -187,7 +187,7 @@ const Sender: WalletBehaviourFactory = async ({ setupEvents(); - return getAccounts(); + return await getAccounts(); }, signOut, diff --git a/packages/sender/tsconfig.json b/packages/sender/tsconfig.json index 8b6d6acaf..3aaed7519 100644 --- a/packages/sender/tsconfig.json +++ b/packages/sender/tsconfig.json @@ -4,7 +4,8 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true }, "files": [], "include": [], From a3fdf7ea097703b3d2fbc8b409bce4c4d5c835c0 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 22 Mar 2023 09:28:41 +0100 Subject: [PATCH 06/28] Fixed sender test --- packages/sender/src/lib/sender.spec.ts | 36 +++++++++++--------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/packages/sender/src/lib/sender.spec.ts b/packages/sender/src/lib/sender.spec.ts index 08527a94a..b8f62147d 100644 --- a/packages/sender/src/lib/sender.spec.ts +++ b/packages/sender/src/lib/sender.spec.ts @@ -4,15 +4,9 @@ import { mockWallet } from "../../../core/src/lib/testUtils"; import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; import type { InjectedWallet } from "../../../core/src/lib/wallet"; -import type { InjectedSender, SenderEvents } from "./injected-sender"; +import type { SenderEvents, SignOutResponse } from "./injected-sender"; import type { FinalExecutionOutcome } from "near-api-js/lib/providers"; -import type { SignOutResponse } from "./injected-sender"; - -declare global { - interface Window { - near: InjectedSender; - } -} +import { setupSender } from "./sender"; const mockSenderOnWindow = () => { window.near = { @@ -43,17 +37,17 @@ const mockSenderOnWindow = () => { ), requestSignTransactions: jest.fn().mockReturnValue(null), }; + + return window.near; }; const createSenderWallet = async (deps: MockWalletDependencies = {}) => { - mockSenderOnWindow(); - - // eslint-disable-next-line @typescript-eslint/no-var-requires - const { setupSender } = require("./sender"); + const injectedSender = mockSenderOnWindow(); const { wallet } = await mockWallet(setupSender(), deps); return { wallet, + injectedSender, }; }; @@ -63,38 +57,38 @@ afterEach(() => { describe("signIn", () => { it("sign into near wallet", async () => { - const { wallet } = await createSenderWallet(); + const { wallet, injectedSender } = await createSenderWallet(); // Allow `requestSignIn` to be invoked // getAccounts depends on window.near.getAccountId // so by default the mocked account would be returned. - window.near.getAccountId = jest.fn().mockReturnValue(""); + injectedSender.getAccountId = jest.fn().mockReturnValue(""); await wallet.signIn({ contractId: "test.testnet" }); - expect(window.near.requestSignIn).toHaveBeenCalled(); + expect(injectedSender.requestSignIn).toHaveBeenCalled(); }); }); describe("signOut", () => { it("sign out of sender wallet", async () => { - const { wallet } = await createSenderWallet(); + const { wallet, injectedSender } = await createSenderWallet(); await wallet.signIn({ contractId: "test.testnet" }); await wallet.signOut(); - expect(window.near.signOut).toHaveBeenCalled(); + expect(injectedSender.signOut).toHaveBeenCalled(); }); }); describe("getAccounts", () => { it("returns array of accounts", async () => { - const { wallet } = await createSenderWallet(); + const { wallet, injectedSender } = await createSenderWallet(); await wallet.signIn({ contractId: "test.testnet" }); const result = await wallet.getAccounts(); - expect(window.near.getAccountId).toHaveBeenCalled(); + expect(injectedSender.getAccountId).toHaveBeenCalled(); expect(result).toEqual([ { accountId: "test-account.testnet", publicKey: undefined }, ]); @@ -103,7 +97,7 @@ describe("getAccounts", () => { describe("signAndSendTransaction", () => { it("sign transaction in sender", async () => { - const { wallet } = await createSenderWallet(); + const { wallet, injectedSender } = await createSenderWallet(); await wallet.signIn({ contractId: "test.testnet" }); await wallet.signAndSendTransaction({ @@ -112,6 +106,6 @@ describe("signAndSendTransaction", () => { actions: [], }); - expect(window.near.signAndSendTransaction).toHaveBeenCalled(); + expect(injectedSender.signAndSendTransaction).toHaveBeenCalled(); }); }); From 38ad391d63b321ca34a252e0fd5261e55a5f2ab5 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 22 Mar 2023 12:08:26 +0100 Subject: [PATCH 07/28] Fixed sender tests and added coin98 tests --- .../src/lib/coin98-wallet.spec.ts | 130 ++++++++++++++++++ .../coin98-wallet/src/lib/coin98-wallet.ts | 14 +- packages/coin98-wallet/tsconfig.json | 5 +- packages/sender/src/lib/injected-sender.ts | 2 +- packages/sender/src/lib/sender.spec.ts | 72 +++++++--- 5 files changed, 196 insertions(+), 27 deletions(-) create mode 100644 packages/coin98-wallet/src/lib/coin98-wallet.spec.ts diff --git a/packages/coin98-wallet/src/lib/coin98-wallet.spec.ts b/packages/coin98-wallet/src/lib/coin98-wallet.spec.ts new file mode 100644 index 000000000..561c521de --- /dev/null +++ b/packages/coin98-wallet/src/lib/coin98-wallet.spec.ts @@ -0,0 +1,130 @@ +/* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mock } from "jest-mock-extended"; +import { mockWallet } from "../../../core/src/lib/testUtils"; + +import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; +import type { InjectedWallet } from "../../../core/src/lib/wallet"; +import { setupCoin98Wallet } from "./coin98-wallet"; +import type { Signer } from "near-api-js/lib/signer"; + +const accountId = "amirsaran.testnet"; +const publicKey = "GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC"; + +const mockCoin98WalletOnWindow = () => { + window.coin98 = { + near: { + account: accountId, + signer: mock({ + createKey: jest.fn(), + signMessage: jest.fn().mockReturnValue({ + signature: Buffer.from([ + 86, 38, 222, 143, 115, 251, 107, 14, 115, 59, 92, 98, 66, 174, 173, + 124, 209, 189, 191, 180, 89, 25, 125, 254, 97, 240, 178, 98, 65, 70, + 238, 108, 105, 122, 165, 249, 193, 70, 118, 194, 126, 218, 117, 100, + 250, 124, 202, 161, 173, 12, 232, 146, 105, 194, 138, 35, 207, 53, + 84, 218, 45, 220, 10, 4, + ]), + publicKey, + }), + getPublicKey: jest.fn().mockReturnValue(publicKey), + }), + connect: jest.fn().mockReturnValue(""), + disconnect: jest.fn(), + }, + }; + + return window.coin98; +}; + +const createSenderWallet = async (deps: MockWalletDependencies = {}) => { + const injectedCoin98Wallet = mockCoin98WalletOnWindow(); + const { wallet } = await mockWallet( + setupCoin98Wallet(), + deps + ); + + return { + wallet, + injectedCoin98Wallet, + }; +}; + +afterEach(() => { + jest.resetModules(); +}); + +describe("signIn", () => { + it("sign into coin98 wallet", async () => { + const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + + injectedCoin98Wallet.near.account = ""; + await wallet.signIn({ contractId: "test.testnet" }); + + expect(injectedCoin98Wallet.near.connect).toHaveBeenCalled(); + }); +}); + +describe("signOut", () => { + it("sign out of coin98 wallet", async () => { + const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signOut(); + + expect(injectedCoin98Wallet.near.disconnect).toHaveBeenCalled(); + }); +}); + +describe("getAccounts", () => { + it("returns array of accounts", async () => { + const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.getAccounts(); + + expect(injectedCoin98Wallet.near.signer.getPublicKey).toHaveBeenCalled(); + expect(result).toEqual([{ accountId, publicKey }]); + }); +}); + +describe("signAndSendTransaction", () => { + it("sign transaction in coin98", async () => { + const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signAndSendTransaction({ + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }); + + expect(injectedCoin98Wallet.near.signer.signMessage).toHaveBeenCalled(); + }); +}); + +describe("signAndSendTransactions", () => { + it("sign transactions in coin98", async () => { + const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + + const transactions = [ + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + ]; + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.signAndSendTransactions({ + transactions, + }); + + expect(injectedCoin98Wallet.near.signer.signMessage).toHaveBeenCalled(); + expect(result.length).toEqual(transactions.length); + }); +}); diff --git a/packages/coin98-wallet/src/lib/coin98-wallet.ts b/packages/coin98-wallet/src/lib/coin98-wallet.ts index c82385140..a8c7cf0f0 100644 --- a/packages/coin98-wallet/src/lib/coin98-wallet.ts +++ b/packages/coin98-wallet/src/lib/coin98-wallet.ts @@ -56,15 +56,15 @@ const Coin98Wallet: WalletBehaviourFactory = async ({ return []; } + const publicKey = await _state.wallet.near.signer.getPublicKey( + accountId, + options.network.networkId + ); + return [ { - accountId: _state.wallet.near.account, - publicKey: ( - await _state.wallet.near.signer.getPublicKey( - accountId, - options.network.networkId - ) - ).toString(), + accountId, + publicKey: publicKey ? publicKey.toString() : undefined, }, ]; }; diff --git a/packages/coin98-wallet/tsconfig.json b/packages/coin98-wallet/tsconfig.json index e258886ff..115cd6e64 100644 --- a/packages/coin98-wallet/tsconfig.json +++ b/packages/coin98-wallet/tsconfig.json @@ -14,6 +14,7 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true } -} +} \ No newline at end of file diff --git a/packages/sender/src/lib/injected-sender.ts b/packages/sender/src/lib/injected-sender.ts index 63036ef29..a4f2f8cbc 100644 --- a/packages/sender/src/lib/injected-sender.ts +++ b/packages/sender/src/lib/injected-sender.ts @@ -3,7 +3,7 @@ // Empty string if we haven't signed in before. import type { Account, providers } from "near-api-js"; -interface AccessKey { +export interface AccessKey { publicKey: { data: Uint8Array; keyType: number; diff --git a/packages/sender/src/lib/sender.spec.ts b/packages/sender/src/lib/sender.spec.ts index b8f62147d..f3daf002c 100644 --- a/packages/sender/src/lib/sender.spec.ts +++ b/packages/sender/src/lib/sender.spec.ts @@ -4,15 +4,33 @@ import { mockWallet } from "../../../core/src/lib/testUtils"; import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; import type { InjectedWallet } from "../../../core/src/lib/wallet"; -import type { SenderEvents, SignOutResponse } from "./injected-sender"; +import type { + AccessKey, + SenderEvents, + SignOutResponse, +} from "./injected-sender"; import type { FinalExecutionOutcome } from "near-api-js/lib/providers"; import { setupSender } from "./sender"; +const accountId = "test-account.testnet"; +const transactions = [ + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, +]; + const mockSenderOnWindow = () => { window.near = { isSender: true, callbacks: mock(), - getAccountId: jest.fn().mockReturnValue("test-account.testnet"), + getAccountId: jest.fn().mockReturnValue(""), getRpc: jest.fn(), account: jest.fn().mockReturnValue({ connection: { @@ -21,9 +39,15 @@ const mockSenderOnWindow = () => { }, }, }), - requestSignIn: jest - .fn() - .mockReturnValue({ accessKey: "accessKey", error: "" }), + requestSignIn: jest.fn(async () => { + window.near!.getAccountId = jest.fn().mockReturnValue(accountId); + return { + accessKey: mock(), + error: "", + notificationId: 0, + type: "sender-wallet-result" as const, + }; + }), signOut: jest.fn().mockReturnValue(mock()), isSignedIn: jest.fn().mockReturnValue(true), remove: jest.fn(), @@ -35,7 +59,14 @@ const mockSenderOnWindow = () => { response: mock(), }) ), - requestSignTransactions: jest.fn().mockReturnValue(null), + requestSignTransactions: jest.fn().mockReturnValue( + Promise.resolve({ + error: undefined, + response: mock>( + new Array(transactions.length).fill({}) + ), + }) + ), }; return window.near; @@ -56,17 +87,13 @@ afterEach(() => { }); describe("signIn", () => { - it("sign into near wallet", async () => { + it("sign into sender wallet", async () => { const { wallet, injectedSender } = await createSenderWallet(); - // Allow `requestSignIn` to be invoked - // getAccounts depends on window.near.getAccountId - // so by default the mocked account would be returned. - injectedSender.getAccountId = jest.fn().mockReturnValue(""); - - await wallet.signIn({ contractId: "test.testnet" }); + const accounts = await wallet.signIn({ contractId: "test.testnet" }); expect(injectedSender.requestSignIn).toHaveBeenCalled(); + expect(accounts).toEqual([{ accountId, publicKey: undefined }]); }); }); @@ -89,9 +116,7 @@ describe("getAccounts", () => { const result = await wallet.getAccounts(); expect(injectedSender.getAccountId).toHaveBeenCalled(); - expect(result).toEqual([ - { accountId: "test-account.testnet", publicKey: undefined }, - ]); + expect(result).toEqual([{ accountId, publicKey: undefined }]); }); }); @@ -101,7 +126,7 @@ describe("signAndSendTransaction", () => { await wallet.signIn({ contractId: "test.testnet" }); await wallet.signAndSendTransaction({ - signerId: "test-account.testnet", + signerId: accountId, receiverId: "test.testnet", actions: [], }); @@ -109,3 +134,16 @@ describe("signAndSendTransaction", () => { expect(injectedSender.signAndSendTransaction).toHaveBeenCalled(); }); }); +describe("signAndSendTransactions", () => { + it("sign transactions in sender", async () => { + const { wallet, injectedSender } = await createSenderWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.signAndSendTransactions({ + transactions, + }); + + expect(injectedSender.requestSignTransactions).toHaveBeenCalled(); + expect(result.length).toEqual(transactions.length); + }); +}); From 33130de83db091248b44c3919546eb31ff984edd Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 22 Mar 2023 12:20:11 +0100 Subject: [PATCH 08/28] Added finer-wallet tests --- packages/finer-wallet/src/lib/finer.spec.ts | 148 ++++++++++++++++++ .../finer-wallet/src/lib/injected-wallet.ts | 4 +- packages/finer-wallet/tsconfig.json | 5 +- 3 files changed, 153 insertions(+), 4 deletions(-) create mode 100644 packages/finer-wallet/src/lib/finer.spec.ts diff --git a/packages/finer-wallet/src/lib/finer.spec.ts b/packages/finer-wallet/src/lib/finer.spec.ts new file mode 100644 index 000000000..df1d01baa --- /dev/null +++ b/packages/finer-wallet/src/lib/finer.spec.ts @@ -0,0 +1,148 @@ +/* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mock } from "jest-mock-extended"; +import { mockWallet } from "../../../core/src/lib/testUtils"; + +import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; +import type { InjectedWallet } from "../../../core/src/lib/wallet"; +import type { AccessKey, SignOutResponse } from "./injected-wallet"; +import type { FinalExecutionOutcome } from "near-api-js/lib/providers"; +import { setupFinerWallet } from "./finer"; + +const accountId = "test-account.testnet"; +const transactions = [ + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, +]; + +const mockFinerOnWindow = () => { + window.finer = { + near: { + isSender: false, + isFiner: true, + getAccountId: jest.fn().mockReturnValue(""), + getRpc: jest.fn(), + account: jest.fn().mockReturnValue({ + connection: { + signer: { + getPublicKey: jest.fn().mockReturnValue(""), + }, + }, + }), + requestSignIn: jest.fn(async () => { + window.finer.near!.getAccountId = jest.fn().mockReturnValue(accountId); + return { + accessKey: mock(), + error: "", + notificationId: 0, + type: "sender-wallet-result" as const, + }; + }), + signOut: jest.fn().mockReturnValue(mock()), + isSignedIn: jest.fn().mockReturnValue(true), + remove: jest.fn(), + on: jest.fn(), + sendMoney: jest.fn(), + signAndSendTransaction: jest.fn().mockReturnValue( + Promise.resolve({ + error: undefined, + response: mock(), + }) + ), + requestSignTransactions: jest.fn().mockReturnValue( + Promise.resolve({ + error: undefined, + response: mock>( + new Array(transactions.length).fill({}) + ), + }) + ), + signMessage: jest.fn(), + }, + }; + + return window.finer; +}; + +const createFinerWallet = async (deps: MockWalletDependencies = {}) => { + const injectedFiner = mockFinerOnWindow(); + const { wallet } = await mockWallet(setupFinerWallet(), deps); + + return { + wallet, + injectedFiner, + }; +}; + +afterEach(() => { + jest.resetModules(); +}); + +describe("signIn", () => { + it("sign into sender wallet", async () => { + const { wallet, injectedFiner } = await createFinerWallet(); + + const accounts = await wallet.signIn({ contractId: "test.testnet" }); + + expect(injectedFiner.near?.requestSignIn).toHaveBeenCalled(); + expect(accounts).toEqual([{ accountId, publicKey: undefined }]); + }); +}); + +describe("signOut", () => { + it("sign out of sender wallet", async () => { + const { wallet, injectedFiner } = await createFinerWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signOut(); + + expect(injectedFiner.near?.signOut).toHaveBeenCalled(); + }); +}); + +describe("getAccounts", () => { + it("returns array of accounts", async () => { + const { wallet, injectedFiner } = await createFinerWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.getAccounts(); + + expect(injectedFiner.near?.getAccountId).toHaveBeenCalled(); + expect(result).toEqual([{ accountId, publicKey: undefined }]); + }); +}); + +describe("signAndSendTransaction", () => { + it("sign transaction in sender", async () => { + const { wallet, injectedFiner } = await createFinerWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signAndSendTransaction({ + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }); + + expect(injectedFiner.near?.signAndSendTransaction).toHaveBeenCalled(); + }); +}); +describe("signAndSendTransactions", () => { + it("sign transactions in sender", async () => { + const { wallet, injectedFiner } = await createFinerWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.signAndSendTransactions({ + transactions, + }); + + expect(injectedFiner.near?.requestSignTransactions).toHaveBeenCalled(); + expect(result.length).toEqual(transactions.length); + }); +}); diff --git a/packages/finer-wallet/src/lib/injected-wallet.ts b/packages/finer-wallet/src/lib/injected-wallet.ts index 21738c0c4..6ecbe22f2 100644 --- a/packages/finer-wallet/src/lib/injected-wallet.ts +++ b/packages/finer-wallet/src/lib/injected-wallet.ts @@ -2,7 +2,7 @@ import type { Account, providers } from "near-api-js"; -interface AccessKey { +export interface AccessKey { publicKey: string; secretKey: string; } @@ -12,7 +12,7 @@ interface RequestSignInResponse { error: string | { type: string }; } -type SignOutResponse = true | { error: string | { type: string } }; +export type SignOutResponse = true | { error: string | { type: string } }; interface RpcInfo { explorerUrl: string; diff --git a/packages/finer-wallet/tsconfig.json b/packages/finer-wallet/tsconfig.json index 8b6d6acaf..6532eb213 100644 --- a/packages/finer-wallet/tsconfig.json +++ b/packages/finer-wallet/tsconfig.json @@ -4,7 +4,8 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true }, "files": [], "include": [], @@ -16,4 +17,4 @@ "path": "./tsconfig.spec.json" } ] -} +} \ No newline at end of file From 7d63888face18c212ec8103a10c23550c3807d53 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 22 Mar 2023 12:49:31 +0100 Subject: [PATCH 09/28] Added math-wallet tests, fixed some other tests --- .../src/lib/coin98-wallet.spec.ts | 20 +-- packages/finer-wallet/src/lib/finer.spec.ts | 10 +- .../src/lib/injected-math-wallet.ts | 4 +- .../math-wallet/src/lib/math-wallet.spec.ts | 131 ++++++++++++++++++ packages/math-wallet/src/lib/math-wallet.ts | 7 +- packages/math-wallet/tsconfig.json | 5 +- 6 files changed, 152 insertions(+), 25 deletions(-) create mode 100644 packages/math-wallet/src/lib/math-wallet.spec.ts diff --git a/packages/coin98-wallet/src/lib/coin98-wallet.spec.ts b/packages/coin98-wallet/src/lib/coin98-wallet.spec.ts index 561c521de..64f2352e3 100644 --- a/packages/coin98-wallet/src/lib/coin98-wallet.spec.ts +++ b/packages/coin98-wallet/src/lib/coin98-wallet.spec.ts @@ -13,7 +13,7 @@ const publicKey = "GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC"; const mockCoin98WalletOnWindow = () => { window.coin98 = { near: { - account: accountId, + account: "", signer: mock({ createKey: jest.fn(), signMessage: jest.fn().mockReturnValue({ @@ -28,7 +28,10 @@ const mockCoin98WalletOnWindow = () => { }), getPublicKey: jest.fn().mockReturnValue(publicKey), }), - connect: jest.fn().mockReturnValue(""), + connect: jest.fn(async () => { + window.coin98.near.account = accountId; + return ""; + }), disconnect: jest.fn(), }, }; @@ -36,7 +39,7 @@ const mockCoin98WalletOnWindow = () => { return window.coin98; }; -const createSenderWallet = async (deps: MockWalletDependencies = {}) => { +const createCoin98Wallet = async (deps: MockWalletDependencies = {}) => { const injectedCoin98Wallet = mockCoin98WalletOnWindow(); const { wallet } = await mockWallet( setupCoin98Wallet(), @@ -55,9 +58,8 @@ afterEach(() => { describe("signIn", () => { it("sign into coin98 wallet", async () => { - const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + const { wallet, injectedCoin98Wallet } = await createCoin98Wallet(); - injectedCoin98Wallet.near.account = ""; await wallet.signIn({ contractId: "test.testnet" }); expect(injectedCoin98Wallet.near.connect).toHaveBeenCalled(); @@ -66,7 +68,7 @@ describe("signIn", () => { describe("signOut", () => { it("sign out of coin98 wallet", async () => { - const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + const { wallet, injectedCoin98Wallet } = await createCoin98Wallet(); await wallet.signIn({ contractId: "test.testnet" }); await wallet.signOut(); @@ -77,7 +79,7 @@ describe("signOut", () => { describe("getAccounts", () => { it("returns array of accounts", async () => { - const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + const { wallet, injectedCoin98Wallet } = await createCoin98Wallet(); await wallet.signIn({ contractId: "test.testnet" }); const result = await wallet.getAccounts(); @@ -89,7 +91,7 @@ describe("getAccounts", () => { describe("signAndSendTransaction", () => { it("sign transaction in coin98", async () => { - const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + const { wallet, injectedCoin98Wallet } = await createCoin98Wallet(); await wallet.signIn({ contractId: "test.testnet" }); await wallet.signAndSendTransaction({ @@ -104,7 +106,7 @@ describe("signAndSendTransaction", () => { describe("signAndSendTransactions", () => { it("sign transactions in coin98", async () => { - const { wallet, injectedCoin98Wallet } = await createSenderWallet(); + const { wallet, injectedCoin98Wallet } = await createCoin98Wallet(); const transactions = [ { diff --git a/packages/finer-wallet/src/lib/finer.spec.ts b/packages/finer-wallet/src/lib/finer.spec.ts index df1d01baa..9a766820f 100644 --- a/packages/finer-wallet/src/lib/finer.spec.ts +++ b/packages/finer-wallet/src/lib/finer.spec.ts @@ -41,8 +41,6 @@ const mockFinerOnWindow = () => { return { accessKey: mock(), error: "", - notificationId: 0, - type: "sender-wallet-result" as const, }; }), signOut: jest.fn().mockReturnValue(mock()), @@ -86,7 +84,7 @@ afterEach(() => { }); describe("signIn", () => { - it("sign into sender wallet", async () => { + it("sign into finer wallet", async () => { const { wallet, injectedFiner } = await createFinerWallet(); const accounts = await wallet.signIn({ contractId: "test.testnet" }); @@ -97,7 +95,7 @@ describe("signIn", () => { }); describe("signOut", () => { - it("sign out of sender wallet", async () => { + it("sign out of finer wallet", async () => { const { wallet, injectedFiner } = await createFinerWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -120,7 +118,7 @@ describe("getAccounts", () => { }); describe("signAndSendTransaction", () => { - it("sign transaction in sender", async () => { + it("sign transaction in finer", async () => { const { wallet, injectedFiner } = await createFinerWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -134,7 +132,7 @@ describe("signAndSendTransaction", () => { }); }); describe("signAndSendTransactions", () => { - it("sign transactions in sender", async () => { + it("sign transactions in finer", async () => { const { wallet, injectedFiner } = await createFinerWallet(); await wallet.signIn({ contractId: "test.testnet" }); diff --git a/packages/math-wallet/src/lib/injected-math-wallet.ts b/packages/math-wallet/src/lib/injected-math-wallet.ts index 684c4dde3..75016e867 100644 --- a/packages/math-wallet/src/lib/injected-math-wallet.ts +++ b/packages/math-wallet/src/lib/injected-math-wallet.ts @@ -5,7 +5,7 @@ interface LoginParams { publicKey?: string; } -interface MathAccount { +export interface MathAccount { name: string; accountId: string; publicKey: string; @@ -26,7 +26,7 @@ interface MathNetwork { extra: string; } -type MathSigner = Signer & { +export type MathSigner = Signer & { account: MathAccount | null; network: MathNetwork; }; diff --git a/packages/math-wallet/src/lib/math-wallet.spec.ts b/packages/math-wallet/src/lib/math-wallet.spec.ts new file mode 100644 index 000000000..9c370035f --- /dev/null +++ b/packages/math-wallet/src/lib/math-wallet.spec.ts @@ -0,0 +1,131 @@ +/* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mock } from "jest-mock-extended"; +import { mockWallet } from "../../../core/src/lib/testUtils"; + +import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; +import type { InjectedWallet } from "../../../core/src/lib/wallet"; +import { setupMathWallet } from "./math-wallet"; +import type { MathAccount } from "./injected-math-wallet"; +import type { MathSigner } from "./injected-math-wallet"; + +const accountId = "amirsaran.testnet"; +const publicKey = "GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC"; + +const mockMathWalletOnWindow = () => { + window.nearWalletApi = { + signer: mock({ + createKey: jest.fn(), + signMessage: jest.fn().mockReturnValue({ + signature: Buffer.from([ + 86, 38, 222, 143, 115, 251, 107, 14, 115, 59, 92, 98, 66, 174, 173, + 124, 209, 189, 191, 180, 89, 25, 125, 254, 97, 240, 178, 98, 65, 70, + 238, 108, 105, 122, 165, 249, 193, 70, 118, 194, 126, 218, 117, 100, + 250, 124, 202, 161, 173, 12, 232, 146, 105, 194, 138, 35, 207, 53, 84, + 218, 45, 220, 10, 4, + ]), + publicKey, + }), + getPublicKey: jest.fn().mockReturnValue(publicKey), + }), + login: jest.fn().mockReturnValue(mock()), + logout: jest.fn().mockReturnValue(true), + }; + + return window.nearWalletApi; +}; + +const createMathWallet = async (deps: MockWalletDependencies = {}) => { + const injectedMathWallet = mockMathWalletOnWindow(); + const { wallet } = await mockWallet(setupMathWallet(), deps); + + return { + wallet, + injectedMathWallet, + }; +}; + +afterEach(() => { + jest.resetModules(); +}); + +describe("signIn", () => { + it("sign into math wallet", async () => { + const { wallet, injectedMathWallet } = await createMathWallet(); + + injectedMathWallet.signer.account = null; + await wallet.signIn({ contractId: "test.testnet" }); + + expect(injectedMathWallet.login).toHaveBeenCalled(); + }); +}); + +describe("signOut", () => { + it("sign out of math wallet", async () => { + const { wallet, injectedMathWallet } = await createMathWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signOut(); + + expect(injectedMathWallet.logout).toHaveBeenCalled(); + }); +}); + +describe("getAccounts", () => { + it("returns array of accounts", async () => { + const { wallet, injectedMathWallet } = await createMathWallet(); + + injectedMathWallet.signer.account = { + name: "", + accountId, + publicKey, + permission: "", + network: "testnet", + }; + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.getAccounts(); + + expect(result).toEqual([{ accountId, publicKey }]); + }); +}); + +describe("signAndSendTransaction", () => { + it("sign transaction in math wallet", async () => { + const { wallet, injectedMathWallet } = await createMathWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signAndSendTransaction({ + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }); + + expect(injectedMathWallet.signer.signMessage).toHaveBeenCalled(); + }); +}); + +describe("signAndSendTransactions", () => { + it("sign transactions in math wallet", async () => { + const { wallet, injectedMathWallet } = await createMathWallet(); + + const transactions = [ + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + ]; + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.signAndSendTransactions({ + transactions, + }); + + expect(injectedMathWallet.signer.signMessage).toHaveBeenCalled(); + expect(result.length).toEqual(transactions.length); + }); +}); diff --git a/packages/math-wallet/src/lib/math-wallet.ts b/packages/math-wallet/src/lib/math-wallet.ts index 21bcb4453..5dc75e7d0 100644 --- a/packages/math-wallet/src/lib/math-wallet.ts +++ b/packages/math-wallet/src/lib/math-wallet.ts @@ -59,12 +59,7 @@ const MathWallet: WalletBehaviourFactory = async ({ return [ { accountId: account.accountId, - publicKey: ( - await _state.wallet.signer.getPublicKey( - account.accountId, - options.network.networkId - ) - ).toString(), + publicKey: account.publicKey, }, ]; }; diff --git a/packages/math-wallet/tsconfig.json b/packages/math-wallet/tsconfig.json index 8b6d6acaf..6532eb213 100644 --- a/packages/math-wallet/tsconfig.json +++ b/packages/math-wallet/tsconfig.json @@ -4,7 +4,8 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true }, "files": [], "include": [], @@ -16,4 +17,4 @@ "path": "./tsconfig.spec.json" } ] -} +} \ No newline at end of file From 5cd856005674269c1f61ef22b7ee9d8564a70be0 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 22 Mar 2023 13:14:31 +0100 Subject: [PATCH 10/28] Added meteor-wallet tests (not working atm) --- .../src/lib/meteor-wallet.spec.ts | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 packages/meteor-wallet/src/lib/meteor-wallet.spec.ts diff --git a/packages/meteor-wallet/src/lib/meteor-wallet.spec.ts b/packages/meteor-wallet/src/lib/meteor-wallet.spec.ts new file mode 100644 index 000000000..ee8daa450 --- /dev/null +++ b/packages/meteor-wallet/src/lib/meteor-wallet.spec.ts @@ -0,0 +1,103 @@ +/* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mock } from "jest-mock-extended"; +import { mockWallet } from "../../../core/src/lib/testUtils"; + +import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; +import type { InjectedWallet } from "../../../core/src/lib/wallet"; +import { setupMeteorWallet } from "./meteor-wallet"; +import type { MeteorWallet as MeteorWalletSdk } from "@meteorwallet/sdk"; + +const accountId = "amirsaran.testnet"; +const publicKey = "GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC"; + +const createMeteorWallet = async (deps: MockWalletDependencies = {}) => { + const meteorWalletSdk = mock(); + + const { wallet } = await mockWallet( + setupMeteorWallet(), + deps + ); + + return { + meteorWalletSdk, + wallet, + }; +}; + +afterEach(() => { + jest.resetModules(); +}); + +describe("signIn", () => { + it.skip("sign into math wallet", async () => { + const { wallet, meteorWalletSdk } = await createMeteorWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + + expect(meteorWalletSdk.requestSignIn).toHaveBeenCalled(); + }); +}); + +describe("signOut", () => { + it.skip("sign out of math wallet", async () => { + const { wallet, meteorWalletSdk } = await createMeteorWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signOut(); + + expect(meteorWalletSdk.signOut).toHaveBeenCalled(); + }); +}); + +describe("getAccounts", () => { + it.skip("returns array of accounts", async () => { + const { wallet } = await createMeteorWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.getAccounts(); + + expect(result).toEqual([{ accountId, publicKey }]); + }); +}); + +describe("signAndSendTransaction", () => { + it.skip("sign transaction in math wallet", async () => { + const { wallet, meteorWalletSdk } = await createMeteorWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signAndSendTransaction({ + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }); + + expect(meteorWalletSdk.account).toHaveBeenCalled(); + }); +}); + +describe("signAndSendTransactions", () => { + it.skip("sign transactions in math wallet", async () => { + const { wallet, meteorWalletSdk } = await createMeteorWallet(); + + const transactions = [ + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + ]; + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.signAndSendTransactions({ + transactions, + }); + + expect(meteorWalletSdk.account).toHaveBeenCalled(); + expect(result.length).toEqual(transactions.length); + }); +}); From af9b7d337eaa861bd05b24f66b9b941ee7815182 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Wed, 22 Mar 2023 18:45:28 +0100 Subject: [PATCH 11/28] Added narwallets test --- .../src/lib/meteor-wallet.spec.ts | 8 +- packages/meteor-wallet/tsconfig.json | 5 +- .../narwallets/src/lib/narwallets.spec.ts | 104 ++++++++++++++++++ packages/narwallets/tsconfig.json | 5 +- 4 files changed, 114 insertions(+), 8 deletions(-) create mode 100644 packages/narwallets/src/lib/narwallets.spec.ts diff --git a/packages/meteor-wallet/src/lib/meteor-wallet.spec.ts b/packages/meteor-wallet/src/lib/meteor-wallet.spec.ts index ee8daa450..98c5f94ba 100644 --- a/packages/meteor-wallet/src/lib/meteor-wallet.spec.ts +++ b/packages/meteor-wallet/src/lib/meteor-wallet.spec.ts @@ -29,7 +29,7 @@ afterEach(() => { }); describe("signIn", () => { - it.skip("sign into math wallet", async () => { + it.skip("sign into meteor wallet", async () => { const { wallet, meteorWalletSdk } = await createMeteorWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -39,7 +39,7 @@ describe("signIn", () => { }); describe("signOut", () => { - it.skip("sign out of math wallet", async () => { + it.skip("sign out of meteor wallet", async () => { const { wallet, meteorWalletSdk } = await createMeteorWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -61,7 +61,7 @@ describe("getAccounts", () => { }); describe("signAndSendTransaction", () => { - it.skip("sign transaction in math wallet", async () => { + it.skip("sign transaction in meteor wallet", async () => { const { wallet, meteorWalletSdk } = await createMeteorWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -76,7 +76,7 @@ describe("signAndSendTransaction", () => { }); describe("signAndSendTransactions", () => { - it.skip("sign transactions in math wallet", async () => { + it.skip("sign transactions in meteor wallet", async () => { const { wallet, meteorWalletSdk } = await createMeteorWallet(); const transactions = [ diff --git a/packages/meteor-wallet/tsconfig.json b/packages/meteor-wallet/tsconfig.json index 8b6d6acaf..6532eb213 100644 --- a/packages/meteor-wallet/tsconfig.json +++ b/packages/meteor-wallet/tsconfig.json @@ -4,7 +4,8 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true }, "files": [], "include": [], @@ -16,4 +17,4 @@ "path": "./tsconfig.spec.json" } ] -} +} \ No newline at end of file diff --git a/packages/narwallets/src/lib/narwallets.spec.ts b/packages/narwallets/src/lib/narwallets.spec.ts new file mode 100644 index 000000000..6b6f6eac0 --- /dev/null +++ b/packages/narwallets/src/lib/narwallets.spec.ts @@ -0,0 +1,104 @@ +/* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mock } from "jest-mock-extended"; +import { mockWallet } from "../../../core/src/lib/testUtils"; + +import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; +import { setupNarwallets } from "./narwallets"; +import type { InjectedWallet } from "@near-wallet-selector/core"; + +const accountId = "test-account.testnet"; +const transactions = [ + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, +]; + +const mockNarWalletOnWindow = () => { + window.postMessage = jest.fn(); + window.narwallets = mock(); + + return window.narwallets; +}; + +const createNarWallet = async (deps: MockWalletDependencies = {}) => { + const injectedNarWallet = mockNarWalletOnWindow(); + const { wallet } = await mockWallet(setupNarwallets(), deps); + + return { + wallet, + injectedNarWallet, + }; +}; + +afterEach(() => { + jest.resetModules(); +}); + +describe("signIn", () => { + it.skip("sign into nar wallet", async () => { + const { wallet, injectedNarWallet } = await createNarWallet(); + + const accounts = await wallet.signIn({ contractId: "test.testnet" }); + + expect(injectedNarWallet.signIn).toHaveBeenCalled(); + expect(accounts).toEqual([{ accountId, publicKey: undefined }]); + }); +}); + +describe("signOut", () => { + it.skip("sign out of nar wallet", async () => { + const { wallet, injectedNarWallet } = await createNarWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signOut(); + + expect(injectedNarWallet.signOut).toHaveBeenCalled(); + }); +}); + +describe("getAccounts", () => { + it.skip("returns array of accounts", async () => { + const { wallet, injectedNarWallet } = await createNarWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.getAccounts(); + + expect(injectedNarWallet.getAccounts).toHaveBeenCalled(); + expect(result).toEqual([{ accountId, publicKey: undefined }]); + }); +}); + +describe("signAndSendTransaction", () => { + it.skip("sign transaction in nar wallet", async () => { + const { wallet, injectedNarWallet } = await createNarWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signAndSendTransaction({ + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }); + + expect(injectedNarWallet.signAndSendTransaction).toHaveBeenCalled(); + }); +}); +describe("signAndSendTransactions", () => { + it.skip("sign transactions in nar wallet", async () => { + const { wallet, injectedNarWallet } = await createNarWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.signAndSendTransactions({ + transactions, + }); + + expect(injectedNarWallet.signAndSendTransactions).toHaveBeenCalled(); + expect(result.length).toEqual(transactions.length); + }); +}); diff --git a/packages/narwallets/tsconfig.json b/packages/narwallets/tsconfig.json index e258886ff..115cd6e64 100644 --- a/packages/narwallets/tsconfig.json +++ b/packages/narwallets/tsconfig.json @@ -14,6 +14,7 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true } -} +} \ No newline at end of file From cd65b6e218ff34316cb294911b5f750ac088755d Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Wed, 29 Mar 2023 20:02:41 +0200 Subject: [PATCH 12/28] Bumped walletconnect dependencies to v2.5.2 --- package.json | 4 +- yarn.lock | 363 +++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 293 insertions(+), 74 deletions(-) diff --git a/package.json b/package.json index 878ba3e71..ae82dde72 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,7 @@ "@meteorwallet/sdk": "^0.6.0", "@nightlylabs/connect-near": "0.0.15", "@walletconnect/qrcode-modal": "2.0.0-alpha.20", - "@walletconnect/sign-client": "2.1.4", + "@walletconnect/sign-client": "2.5.2", "better-sqlite3": "^8.1.0", "big.js": "^6.1.1", "bn.js": "^5.2.0", @@ -160,7 +160,7 @@ "@types/w3c-web-usb": "^1.0.5", "@typescript-eslint/eslint-plugin": "5.13.0", "@typescript-eslint/parser": "5.13.0", - "@walletconnect/types": "^2.1.4", + "@walletconnect/types": "^2.5.2", "babel-jest": "27.2.3", "cypress": "^9.1.0", "eslint": "~8.15.0", diff --git a/yarn.lock b/yarn.lock index 305c206af..0e9be49a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4768,27 +4768,27 @@ "@typescript-eslint/types" "5.30.5" eslint-visitor-keys "^3.3.0" -"@walletconnect/core@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.1.4.tgz#871a1e6b80b14fc3a755763b2cdce0c334e41536" - integrity sha512-pEGTbysRwxJJhOYoRmBy8WQ2z7iYrNYsKvdGN/BNoXGuOT9PqKNqiRtVs2E4W79Nwq7ZoM1zohh5VLgbKguSUQ== +"@walletconnect/core@2.5.2": + version "2.5.2" + resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.5.2.tgz#999605a62a3b37867d2559e40b62778534eb787c" + integrity sha512-R0D9NKgHBpdun65q+1L49GOIGDLaIodnyb+Dq0tXGVzvXzy2lkXOlh2e9am61ixaVrUsHt7b96b318geqsuk4Q== dependencies: - "@walletconnect/heartbeat" "^1.0.1" - "@walletconnect/jsonrpc-provider" "^1.0.6" + "@walletconnect/heartbeat" "1.2.0" + "@walletconnect/jsonrpc-provider" "1.0.10" "@walletconnect/jsonrpc-utils" "^1.0.4" - "@walletconnect/jsonrpc-ws-connection" "^1.0.5" + "@walletconnect/jsonrpc-ws-connection" "1.0.10" "@walletconnect/keyvaluestorage" "^1.0.2" "@walletconnect/logger" "^2.0.1" - "@walletconnect/relay-api" "^1.0.7" + "@walletconnect/relay-api" "^1.0.9" "@walletconnect/relay-auth" "^1.0.4" "@walletconnect/safe-json" "^1.0.1" "@walletconnect/time" "^1.0.2" - "@walletconnect/types" "2.1.4" - "@walletconnect/utils" "2.1.4" + "@walletconnect/types" "2.5.2" + "@walletconnect/utils" "2.5.2" events "^3.3.0" lodash.isequal "4.5.0" pino "7.11.0" - uint8arrays "3.1.0" + uint8arrays "^3.1.0" "@walletconnect/environment@^1.0.1": version "1.0.1" @@ -4805,6 +4805,18 @@ keyvaluestorage-interface "^1.0.0" tslib "1.14.1" +"@walletconnect/heartbeat@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@walletconnect/heartbeat/-/heartbeat-1.2.0.tgz#1e87dd234cb72b0587b84f95c4f942f2b4bd0c79" + integrity sha512-0vbzTa/ARrpmMmOD+bQMxPvFYKtOLQZObgZakrYr0aODiMOO71CmPVNV2eAqXnw9rMmcP+z91OybLeIFlwTjjA== + dependencies: + "@walletconnect/events" "^1.0.1" + "@walletconnect/time" "^1.0.2" + chai "^4.3.7" + mocha "^10.2.0" + ts-node "^10.9.1" + tslib "1.14.1" + "@walletconnect/heartbeat@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@walletconnect/heartbeat/-/heartbeat-1.0.1.tgz#0cd89a53b6eafbfde07204936b29ac0d185d8e16" @@ -4814,12 +4826,12 @@ "@walletconnect/time" "^1.0.2" tslib "1.14.1" -"@walletconnect/jsonrpc-provider@^1.0.6": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.6.tgz#e91321ef523f1904e6634e7866a0f3c6f056d2cd" - integrity sha512-f5vQxr53vUVQ51/9mRLb1OiNciT/546XZ68Byn9OYnDBGeGJXK2kQWDHp8sPWZbN5x0p7B6asdCWMVFJ6danlw== +"@walletconnect/jsonrpc-provider@1.0.10": + version "1.0.10" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.10.tgz#8351a06b70faa8f8c0e77dc2c6d9b0190d17d407" + integrity sha512-g0ffPSpY3P6GqGjWGHsr3yqvQUhj7q2k6pAikoXv5XTXWaJRzFvrlbFkSgxziXsBrwrMZn0qvPufvpN4mMZ5FA== dependencies: - "@walletconnect/jsonrpc-utils" "^1.0.4" + "@walletconnect/jsonrpc-utils" "^1.0.6" "@walletconnect/safe-json" "^1.0.1" tslib "1.14.1" @@ -4840,13 +4852,23 @@ "@walletconnect/jsonrpc-types" "^1.0.2" tslib "1.14.1" -"@walletconnect/jsonrpc-ws-connection@^1.0.5": - version "1.0.5" - resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.5.tgz#cf43e40f283da34ca962e74007829930f7aa4a75" - integrity sha512-M8a7nPmJbY3itLVdkq6d+EjZUsDDwyNpK1rYlhT1xcD07oXqFSqzkSCvFXylUaPlOsBVIhJ8l7I8oOYkb6K5XQ== +"@walletconnect/jsonrpc-utils@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.6.tgz#7fa58e6671247e64e189828103282e6258f5330f" + integrity sha512-snp0tfkjPiDLQp/jrBewI+9SM33GPV4+Gjgldod6XQ7rFyQ5FZjnBxUkY4xWH0+arNxzQSi6v5iDXjCjSaorpg== dependencies: - "@walletconnect/jsonrpc-utils" "^1.0.4" + "@walletconnect/environment" "^1.0.1" + "@walletconnect/jsonrpc-types" "^1.0.2" + tslib "1.14.1" + +"@walletconnect/jsonrpc-ws-connection@1.0.10": + version "1.0.10" + resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.10.tgz#04e04a7d8c70b27c386a1bdd9ff6511045da3c81" + integrity sha512-/tidvjfCXZuYugjF5fOswsNDPoMo9QRML3DFQ0dfNUarL4f5HGqu8NDGerr2n0+4MOX23GsT6Vv2POSwFbvgGw== + dependencies: + "@walletconnect/jsonrpc-utils" "^1.0.6" "@walletconnect/safe-json" "^1.0.1" + events "^3.3.0" tslib "1.14.1" ws "^7.5.1" @@ -4893,6 +4915,14 @@ "@walletconnect/jsonrpc-types" "^1.0.2" tslib "1.14.1" +"@walletconnect/relay-api@^1.0.9": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@walletconnect/relay-api/-/relay-api-1.0.9.tgz#f8c2c3993dddaa9f33ed42197fc9bfebd790ecaf" + integrity sha512-Q3+rylJOqRkO1D9Su0DPE3mmznbAalYapJ9qmzDgK28mYF9alcP3UwG/og5V7l7CFOqzCLi7B8BvcBUrpDj0Rg== + dependencies: + "@walletconnect/jsonrpc-types" "^1.0.2" + tslib "1.14.1" + "@walletconnect/relay-auth@^1.0.4": version "1.0.4" resolved "https://registry.yarnpkg.com/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz#0b5c55c9aa3b0ef61f526ce679f3ff8a5c4c2c7c" @@ -4912,20 +4942,19 @@ dependencies: tslib "1.14.1" -"@walletconnect/sign-client@2.1.4": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.1.4.tgz#678d35f29967bbedcc03d91cd5d47f872baba917" - integrity sha512-40fnyRUVNT+6AYQElQA/rUPHH9fdlbAd4hacpBFny2TbjGeGD/P+n4enhF5m0AQWwuF8zS8c7/qERvbWnaYnEg== +"@walletconnect/sign-client@2.5.2": + version "2.5.2" + resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.5.2.tgz#d05df9dce271720fdb75741fb162dcc899e39029" + integrity sha512-eKUnGCVgYqN+6b4gm27ML/064m0c/2hTlTHy6tbUszYtEPTzb+q4fvpnWs6blaOjzc18l8NFwX3c1+MHxVdQUQ== dependencies: - "@walletconnect/core" "2.1.4" + "@walletconnect/core" "2.5.2" "@walletconnect/events" "^1.0.1" - "@walletconnect/heartbeat" "^1.0.1" - "@walletconnect/jsonrpc-provider" "^1.0.6" + "@walletconnect/heartbeat" "1.2.0" "@walletconnect/jsonrpc-utils" "^1.0.4" "@walletconnect/logger" "^2.0.1" "@walletconnect/time" "^1.0.2" - "@walletconnect/types" "2.1.4" - "@walletconnect/utils" "2.1.4" + "@walletconnect/types" "2.5.2" + "@walletconnect/utils" "2.5.2" events "^3.3.0" pino "7.11.0" @@ -4936,7 +4965,7 @@ dependencies: tslib "1.14.1" -"@walletconnect/types@2.1.4", "@walletconnect/types@^2.0.0-alpha.20", "@walletconnect/types@^2.1.4": +"@walletconnect/types@2.1.4", "@walletconnect/types@^2.0.0-alpha.20": version "2.1.4" resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.1.4.tgz#0db77adbaffd3a9bdf7e9d710d7e7352de542b16" integrity sha512-n9fIk0z2fiGFlPgQcpurQ8WH7XF/blYaDIpr2ai3qdoo1N10yCsX1vj65L8t3zJAmSeHFoVJI9YVrSDj5eWjWw== @@ -4948,7 +4977,40 @@ "@walletconnect/logger" "^2.0.1" events "^3.3.0" -"@walletconnect/utils@2.1.4", "@walletconnect/utils@^2.0.0-alpha.20": +"@walletconnect/types@2.5.2", "@walletconnect/types@^2.5.2": + version "2.5.2" + resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.5.2.tgz#b2ad73f9e6e19a90fe372babc9ed461fe27098fe" + integrity sha512-VnV43qs4f2hwv6wGQ9ZSE+smP0z2oVy2XaVO5Szd2fmOx9bB+ov+sQzh9xeoQ+DhjNrbJhUaecW/peE6CPPSag== + dependencies: + "@walletconnect/events" "^1.0.1" + "@walletconnect/heartbeat" "1.2.0" + "@walletconnect/jsonrpc-types" "^1.0.2" + "@walletconnect/keyvaluestorage" "^1.0.2" + "@walletconnect/logger" "^2.0.1" + events "^3.3.0" + +"@walletconnect/utils@2.5.2": + version "2.5.2" + resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.5.2.tgz#2ee0a10ea646f3e33e192de4b087a846e03b839f" + integrity sha512-s5bpY5q/RaXMc6LgPp+E7qPbKhrff9TjrLRjN2m9COnt9cERowpQEFrPzWmh10FatRZ7dNrudJ5I/c36nFc+hw== + dependencies: + "@stablelib/chacha20poly1305" "1.0.1" + "@stablelib/hkdf" "1.0.1" + "@stablelib/random" "^1.0.2" + "@stablelib/sha256" "1.0.1" + "@stablelib/x25519" "^1.0.3" + "@walletconnect/jsonrpc-utils" "^1.0.4" + "@walletconnect/relay-api" "^1.0.9" + "@walletconnect/safe-json" "^1.0.1" + "@walletconnect/time" "^1.0.2" + "@walletconnect/types" "2.5.2" + "@walletconnect/window-getters" "^1.0.1" + "@walletconnect/window-metadata" "^1.0.1" + detect-browser "5.3.0" + query-string "7.1.1" + uint8arrays "^3.1.0" + +"@walletconnect/utils@^2.0.0-alpha.20": version "2.1.4" resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.1.4.tgz#992442d175f71cf7a685c5568d12bf25d719600e" integrity sha512-g3XRGAgETQbwbZleQS1f4ZFl8X6jb+CaWVNM+vtVO9EvIUJAzE8TLq3H70v+KawRMaLXjgRc0z0W7Wg6bvct7g== @@ -5516,6 +5578,11 @@ assert-plus@1.0.0, assert-plus@^1.0.0: resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" integrity sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw== +assertion-error@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" + integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== + ast-types-flow@^0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" @@ -5977,6 +6044,11 @@ browser-process-hrtime@^1.0.0: resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== +browser-stdout@1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60" + integrity sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw== + browserify-aes@^1.0.0, browserify-aes@^1.0.4: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -6236,7 +6308,7 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.2.0: +camelcase@^6.0.0, camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -6274,6 +6346,19 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw== +chai@^4.3.7: + version "4.3.7" + resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.7.tgz#ec63f6df01829088e8bf55fca839bcd464a8ec51" + integrity sha512-HLnAzZ2iupm25PlN0xFreAlBA5zaBSv3og0DdeGA4Ar6h6rJ3A0rolRUKJhSF2V10GZKDgWF/VmAEsNWjCRB+A== + dependencies: + assertion-error "^1.1.0" + check-error "^1.0.2" + deep-eql "^4.1.2" + get-func-name "^2.0.0" + loupe "^2.3.1" + pathval "^1.1.1" + type-detect "^4.0.5" + chalk@4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" @@ -6327,12 +6412,17 @@ chardet@^0.7.0: resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA== +check-error@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" + integrity sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA== + check-more-types@^2.24.0: version "2.24.0" resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" integrity sha512-Pj779qHxV2tuapviy1bSZNEL1maXr13bPYpsvSDB68HlYcYuhlDrmGd63i0JHMCLKzc7rUSNIrpdJlhVlNwrxA== -"chokidar@>=3.0.0 <4.0.0", chokidar@^3.0.0, chokidar@^3.4.2, chokidar@^3.5.1, chokidar@^3.5.3: +chokidar@3.5.3, "chokidar@>=3.0.0 <4.0.0", chokidar@^3.0.0, chokidar@^3.4.2, chokidar@^3.5.1, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -7346,6 +7436,11 @@ decamelize@^1.1.0, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== +decamelize@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-4.0.0.tgz#aa472d7bf660eb15f3494efd531cab7f2a709837" + integrity sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ== + decimal.js@^10.2.1, decimal.js@^10.3.1: version "10.3.1" resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.3.1.tgz#d8c3a444a9c6774ba60ca6ad7261c3a94fd5e783" @@ -7368,6 +7463,13 @@ dedent@^0.7.0: resolved "https://registry.yarnpkg.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" integrity sha512-Q6fKUPqnAHAyhiUgFU7BUzLiv0kd8saH9al7tnu5Q/okj6dnupxyTgFIBjVzJATdfIAm9NAsvXNzjaKa+bxVyA== +deep-eql@^4.1.2: + version "4.1.3" + resolved "https://registry.yarnpkg.com/deep-eql/-/deep-eql-4.1.3.tgz#7c7775513092f7df98d8df9996dd085eb668cc6d" + integrity sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw== + dependencies: + type-detect "^4.0.0" + deep-extend@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/deep-extend/-/deep-extend-0.6.0.tgz#c4fa7c95404a17a9c3e8ca7e1537312b736330ac" @@ -7510,6 +7612,11 @@ diff-sequences@^28.1.1: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== +diff@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/diff/-/diff-5.0.0.tgz#7ed6ad76d859d030787ec35855f5b1daf31d852b" + integrity sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w== + diff@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" @@ -8138,6 +8245,11 @@ escape-html@~1.0.3: resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" integrity sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow== +escape-string-regexp@4.0.0, escape-string-regexp@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" + integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== + escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -8148,11 +8260,6 @@ escape-string-regexp@^2.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz#a30304e99daa32e23b2fd20f51babd07cffca344" integrity sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w== -escape-string-regexp@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" - integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== - escodegen@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.0.0.tgz#5e32b12833e8aa8fa35e1bf0befa89380484c7dd" @@ -8823,6 +8930,14 @@ find-cache-dir@^3.3.1, find-cache-dir@^3.3.2: make-dir "^3.0.2" pkg-dir "^4.1.0" +find-up@5.0.0, find-up@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" + integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== + dependencies: + locate-path "^6.0.0" + path-exists "^4.0.0" + find-up@^2.0.0, find-up@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" @@ -8838,14 +8953,6 @@ find-up@^4.0.0, find-up@^4.1.0: locate-path "^5.0.0" path-exists "^4.0.0" -find-up@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc" - integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng== - dependencies: - locate-path "^6.0.0" - path-exists "^4.0.0" - find-versions@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/find-versions/-/find-versions-4.0.0.tgz#3c57e573bf97769b8cb8df16934b627915da4965" @@ -9080,6 +9187,11 @@ get-caller-file@^2.0.1, get-caller-file@^2.0.5: resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== +get-func-name@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/get-func-name/-/get-func-name-2.0.0.tgz#ead774abee72e20409433a066366023dd6887a41" + integrity sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig== + get-intrinsic@^1.0.2, get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: version "1.1.2" resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.1.2.tgz#336975123e05ad0b7ba41f152ee4aadbea6cf598" @@ -9245,6 +9357,18 @@ glob@7.1.7: once "^1.3.0" path-is-absolute "^1.0.0" +glob@7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023" + integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@8.0.1: version "8.0.1" resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.1.tgz#00308f5c035aa0b2a447cd37ead267ddff1577d3" @@ -9457,7 +9581,7 @@ hdr-histogram-percentiles-obj@^3.0.0: resolved "https://registry.yarnpkg.com/hdr-histogram-percentiles-obj/-/hdr-histogram-percentiles-obj-3.0.0.tgz#9409f4de0c2dda78e61de2d9d78b1e9f3cba283c" integrity sha512-7kIufnBqdsBGcSZLPJwqHT3yhk1QTsSlFsVD3kx5ixH/AlgBs9yM1q6DPhXZ8f8gtdqgh7N7/5btRLpQsS2gHw== -he@^1.2.0: +he@1.2.0, he@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== @@ -10085,6 +10209,11 @@ is-plain-obj@^1.1.0: resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e" integrity sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg== +is-plain-obj@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-2.1.0.tgz#45e42e37fccf1f40da8e5f76ee21515840c09287" + integrity sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA== + is-plain-obj@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz#af6f2ea14ac5a646183a5bbdb5baabbc156ad9d7" @@ -11393,7 +11522,7 @@ lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17 resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -log-symbols@^4.0.0, log-symbols@^4.1.0: +log-symbols@4.1.0, log-symbols@^4.0.0, log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -11418,6 +11547,13 @@ loose-envify@^1.1.0, loose-envify@^1.4.0: dependencies: js-tokens "^3.0.0 || ^4.0.0" +loupe@^2.3.1: + version "2.3.6" + resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.6.tgz#76e4af498103c532d1ecc9be102036a21f787b53" + integrity sha512-RaPMZKiMy8/JruncMU5Bt6na1eftNoo++R4Y+N2FrxkDVTrGvcyzFTsaGif4QTeKESheMGegbhw6iUAq+5A8zA== + dependencies: + get-func-name "^2.0.0" + lru-cache@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94" @@ -11862,6 +11998,33 @@ mkdirp@^1.0.3, mkdirp@^1.0.4, mkdirp@~1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mocha@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8" + integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg== + dependencies: + ansi-colors "4.1.1" + browser-stdout "1.3.1" + chokidar "3.5.3" + debug "4.3.4" + diff "5.0.0" + escape-string-regexp "4.0.0" + find-up "5.0.0" + glob "7.2.0" + he "1.2.0" + js-yaml "4.1.0" + log-symbols "4.1.0" + minimatch "5.0.1" + ms "2.1.3" + nanoid "3.3.3" + serialize-javascript "6.0.0" + strip-json-comments "3.1.1" + supports-color "8.1.1" + workerpool "6.2.1" + yargs "16.2.0" + yargs-parser "20.2.4" + yargs-unparser "2.0.0" + modify-values@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" @@ -11905,6 +12068,11 @@ mute-stream@0.0.8, mute-stream@~0.0.4: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +nanoid@3.3.3: + version "3.3.3" + resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.3.tgz#fd8e8b7aa761fe807dba2d1b98fb7241bb724a25" + integrity sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w== + nanoid@3.3.4, nanoid@^3.3.3, nanoid@^3.3.4: version "3.3.4" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.4.tgz#730b67e3cd09e2deacf03c027c81c9d9dbc5e8ab" @@ -12940,6 +13108,11 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== +pathval@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" + integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== + pbkdf2@^3.0.3, pbkdf2@^3.0.9: version "3.1.2" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" @@ -14675,7 +14848,7 @@ send@0.18.0: range-parser "~1.2.1" statuses "2.0.1" -serialize-javascript@^6.0.0: +serialize-javascript@6.0.0, serialize-javascript@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-6.0.0.tgz#efae5d88f45d7924141da8b5c3a7a7e663fefeb8" integrity sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag== @@ -15227,7 +15400,7 @@ strip-indent@^3.0.0: dependencies: min-indent "^1.0.0" -strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: +strip-json-comments@3.1.1, strip-json-comments@^3.1.0, strip-json-comments@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== @@ -15302,6 +15475,13 @@ stylus@^0.55.0: semver "^6.3.0" source-map "^0.7.3" +supports-color@8.1.1, supports-color@^8.0.0, supports-color@^8.1.1: + version "8.1.1" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" + integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== + dependencies: + has-flag "^4.0.0" + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -15316,13 +15496,6 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -supports-color@^8.0.0, supports-color@^8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-8.1.1.tgz#cd6fc17e28500cff56c1b86c0a7fd4a54a73005c" - integrity sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q== - dependencies: - has-flag "^4.0.0" - supports-hyperlinks@^2.0.0, supports-hyperlinks@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.2.0.tgz#4f77b42488765891774b70c79babd87f9bd594bb" @@ -15700,6 +15873,25 @@ ts-morph@^13.0.1: "@ts-morph/common" "~0.12.3" code-block-writer "^11.0.0" +ts-node@^10.9.1: + version "10.9.1" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" + integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw== + dependencies: + "@cspotcode/source-map-support" "^0.8.0" + "@tsconfig/node10" "^1.0.7" + "@tsconfig/node12" "^1.0.7" + "@tsconfig/node14" "^1.0.0" + "@tsconfig/node16" "^1.0.2" + acorn "^8.4.1" + acorn-walk "^8.1.1" + arg "^4.1.0" + create-require "^1.1.0" + diff "^4.0.1" + make-error "^1.1.1" + v8-compile-cache-lib "^3.0.1" + yn "3.1.1" + ts-node@~10.8.0: version "10.8.2" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.8.2.tgz#3185b75228cef116bf82ffe8762594f54b2a23f2" @@ -15803,7 +15995,7 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@4.0.8: +type-detect@4.0.8, type-detect@^4.0.0, type-detect@^4.0.5: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== @@ -15897,6 +16089,13 @@ uint8arrays@^3.0.0: dependencies: multiformats "^9.4.2" +uint8arrays@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.1.tgz#2d8762acce159ccd9936057572dade9459f65ae0" + integrity sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg== + dependencies: + multiformats "^9.4.2" + unbox-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" @@ -16494,6 +16693,11 @@ wordwrap@^1.0.0: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" integrity sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q== +workerpool@6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" + integrity sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw== + wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" @@ -16604,6 +16808,11 @@ yargs-parser@20.0.0: resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.0.0.tgz#c65a1daaa977ad63cebdd52159147b789a4e19a9" integrity sha512-8eblPHTL7ZWRkyjIZJjnGf+TijiKJSwA24svzLRVvtgoi/RZiKa9fFQTrlx0OKLnyHSdt/enrdadji6WFfESVA== +yargs-parser@20.2.4: + version "20.2.4" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.4.tgz#b42890f14566796f85ae8e3a25290d205f154a54" + integrity sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA== + yargs-parser@20.x, yargs-parser@^20.2.2, yargs-parser@^20.2.3: version "20.2.9" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" @@ -16622,6 +16831,29 @@ yargs-parser@^18.1.2: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-unparser@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/yargs-unparser/-/yargs-unparser-2.0.0.tgz#f131f9226911ae5d9ad38c432fe809366c2325eb" + integrity sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA== + dependencies: + camelcase "^6.0.0" + decamelize "^4.0.0" + flat "^5.0.2" + is-plain-obj "^2.1.0" + +yargs@16.2.0, yargs@^16.2.0: + version "16.2.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + yargs@17.4.1: version "17.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.4.1.tgz#ebe23284207bb75cee7c408c33e722bfb27b5284" @@ -16652,19 +16884,6 @@ yargs@^15.3.1: y18n "^4.0.0" yargs-parser "^18.1.2" -yargs@^16.2.0: - version "16.2.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" - integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== - dependencies: - cliui "^7.0.2" - escalade "^3.1.1" - get-caller-file "^2.0.5" - require-directory "^2.1.1" - string-width "^4.2.0" - y18n "^5.0.5" - yargs-parser "^20.2.2" - yargs@^17.2.1, yargs@^17.4.0: version "17.5.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.5.1.tgz#e109900cab6fcb7fd44b1d8249166feb0b36e58e" From da6be798b03a94fb5b2f78ac3e0a82d51e9a95ac Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Wed, 29 Mar 2023 20:03:51 +0200 Subject: [PATCH 13/28] Installed @web3modal/standalone --- package.json | 1 + yarn.lock | 185 ++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 177 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index ae82dde72..a9a5f9589 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,7 @@ "@nightlylabs/connect-near": "0.0.15", "@walletconnect/qrcode-modal": "2.0.0-alpha.20", "@walletconnect/sign-client": "2.5.2", + "@web3modal/standalone": "^2.2.2", "better-sqlite3": "^8.1.0", "big.js": "^6.1.1", "bn.js": "^5.2.0", diff --git a/yarn.lock b/yarn.lock index 0e9be49a7..60729ce63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2622,6 +2622,18 @@ resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b" integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A== +"@lit-labs/ssr-dom-shim@^1.0.0", "@lit-labs/ssr-dom-shim@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.0.tgz#3361d6b8c4cb2ac426d5794ac7cd9776cd2f0814" + integrity sha512-92uQ5ARf7UXYrzaFcAX3T2rTvaS9Z1//ukV+DqjACM4c8s0ZBQd7ayJU5Dh2AFLD/Ayuyz4uMmxQec8q3U4Ong== + +"@lit/reactive-element@^1.3.0", "@lit/reactive-element@^1.6.0": + version "1.6.1" + resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.6.1.tgz#0d958b6d479d0e3db5fc1132ecc4fa84be3f0b93" + integrity sha512-va15kYZr7KZNNPZdxONGQzpUr+4sxVu7V/VG7a8mRfPPXUyhEYj5RzXCQmGrlP3tAh0L3HHm5AjBMFYRqlM9SA== + dependencies: + "@lit-labs/ssr-dom-shim" "^1.0.0" + "@metamask/detect-provider@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@metamask/detect-provider/-/detect-provider-2.0.0.tgz#4bc2795e5e6f7d8b84b2e845058d2f222c99917d" @@ -2635,6 +2647,75 @@ nanoid "3.3.4" query-string "^7.1.1" +"@motionone/animation@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/animation/-/animation-10.15.1.tgz#4a85596c31cbc5100ae8eb8b34c459fb0ccf6807" + integrity sha512-mZcJxLjHor+bhcPuIFErMDNyrdb2vJur8lSfMCsuCB4UyV8ILZLvK+t+pg56erv8ud9xQGK/1OGPt10agPrCyQ== + dependencies: + "@motionone/easing" "^10.15.1" + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + tslib "^2.3.1" + +"@motionone/dom@^10.15.5": + version "10.15.5" + resolved "https://registry.yarnpkg.com/@motionone/dom/-/dom-10.15.5.tgz#4af18f8136d85c2fc997cac98121c969f6731802" + integrity sha512-Xc5avlgyh3xukU9tydh9+8mB8+2zAq+WlLsC3eEIp7Ax7DnXgY7Bj/iv0a4X2R9z9ZFZiaXK3BO0xMYHKbAAdA== + dependencies: + "@motionone/animation" "^10.15.1" + "@motionone/generators" "^10.15.1" + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + hey-listen "^1.0.8" + tslib "^2.3.1" + +"@motionone/easing@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/easing/-/easing-10.15.1.tgz#95cf3adaef34da6deebb83940d8143ede3deb693" + integrity sha512-6hIHBSV+ZVehf9dcKZLT7p5PEKHGhDwky2k8RKkmOvUoYP3S+dXsKupyZpqx5apjd9f+php4vXk4LuS+ADsrWw== + dependencies: + "@motionone/utils" "^10.15.1" + tslib "^2.3.1" + +"@motionone/generators@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/generators/-/generators-10.15.1.tgz#dc6abb11139d1bafe758a41c134d4c753a9b871c" + integrity sha512-67HLsvHJbw6cIbLA/o+gsm7h+6D4Sn7AUrB/GPxvujse1cGZ38F5H7DzoH7PhX+sjvtDnt2IhFYF2Zp1QTMKWQ== + dependencies: + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + tslib "^2.3.1" + +"@motionone/svelte@^10.15.5": + version "10.15.5" + resolved "https://registry.yarnpkg.com/@motionone/svelte/-/svelte-10.15.5.tgz#f36b40101ec1db122820598089f42e831f6cf5f5" + integrity sha512-Xyxtgp7BlVnSBwcoFmXGHUVnpNktzeXsEifu2NJJWc7VGuxutDsBZxNdz80qvpLIC5MeBa1wh7GGegZzTm1msg== + dependencies: + "@motionone/dom" "^10.15.5" + tslib "^2.3.1" + +"@motionone/types@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/types/-/types-10.15.1.tgz#89441b54285012795cbba8612cbaa0fa420db3eb" + integrity sha512-iIUd/EgUsRZGrvW0jqdst8st7zKTzS9EsKkP+6c6n4MPZoQHwiHuVtTQLD6Kp0bsBLhNzKIBlHXponn/SDT4hA== + +"@motionone/utils@^10.15.1": + version "10.15.1" + resolved "https://registry.yarnpkg.com/@motionone/utils/-/utils-10.15.1.tgz#6b5f51bde75be88b5411e084310299050368a438" + integrity sha512-p0YncgU+iklvYr/Dq4NobTRdAPv9PveRDUXabPEeOjBLSO/1FNB2phNTZxOxpi1/GZwYpAoECEa0Wam+nsmhSw== + dependencies: + "@motionone/types" "^10.15.1" + hey-listen "^1.0.8" + tslib "^2.3.1" + +"@motionone/vue@^10.15.5": + version "10.15.5" + resolved "https://registry.yarnpkg.com/@motionone/vue/-/vue-10.15.5.tgz#3101c62b2fce06b3f3072b9ff0f551213eb02476" + integrity sha512-cUENrLYAolUacHvCgU+8wF9OgSlVutfWbHMLERI/bElCJ+e2YVQvG/CpGhIM5fYOOJzuvg2T2wHmLLmvJoavEw== + dependencies: + "@motionone/dom" "^10.15.5" + tslib "^2.3.1" + "@next/env@12.2.3": version "12.2.3" resolved "https://registry.yarnpkg.com/@next/env/-/env-12.2.3.tgz#64f210e74c137d3d9feea738795b055a7f8aebe2" @@ -4531,6 +4612,11 @@ resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397" integrity sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw== +"@types/trusted-types@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.3.tgz#a136f83b0758698df454e328759dbd3d44555311" + integrity sha512-NfQ4gyz38SL8sDNrSixxU2Os1a5xcdFxipAFxYEuLUlvU2uDwS4NUpsImcf1//SlWItCVMMLiylsxbmNMToV/g== + "@types/uuid@^9.0.1": version "9.0.1" resolved "https://registry.yarnpkg.com/@types/uuid/-/uuid-9.0.1.tgz#98586dc36aee8dacc98cc396dbca8d0429647aa6" @@ -5046,6 +5132,32 @@ "@walletconnect/window-getters" "^1.0.1" tslib "1.14.1" +"@web3modal/core@2.2.2": + version "2.2.2" + resolved "https://registry.yarnpkg.com/@web3modal/core/-/core-2.2.2.tgz#1e282dc45bddb11c04f1c93abce570bac1b9a620" + integrity sha512-RKbYNIEVP5Hwiva68PWXExbkTFLUTasneyRpcjoQSM4BIh78qXp1YMt0nyTvFdHmHQEGxXEMCuRG5qoE97uMHA== + dependencies: + buffer "6.0.3" + valtio "1.10.3" + +"@web3modal/standalone@^2.2.2": + version "2.2.2" + resolved "https://registry.yarnpkg.com/@web3modal/standalone/-/standalone-2.2.2.tgz#2d5ce74bbb7f112b31da32049620afa75c4a4686" + integrity sha512-c05kkTFNGZqnjJ3n2C8uo+wWL6ut1jexGYAyTvbweDengdsOr8LDo0VpK5V3XSKCV2fFcPh5JE9H1aA4jpnZPg== + dependencies: + "@web3modal/core" "2.2.2" + "@web3modal/ui" "2.2.2" + +"@web3modal/ui@2.2.2": + version "2.2.2" + resolved "https://registry.yarnpkg.com/@web3modal/ui/-/ui-2.2.2.tgz#f1c1ac908230d4214c35891a5d922c118353eaf2" + integrity sha512-PAuMOuk4sZ4UGjucGMZKzu6Qu56XtFsgLaqOn8ZgP2RkZmYEBGSG9mUQVzJd3XzfzAy1T91Wmqp/3TI3m0pXuQ== + dependencies: + "@web3modal/core" "2.2.2" + lit "2.6.1" + motion "10.15.5" + qrcode "1.5.1" + "@webassemblyjs/ast@1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" @@ -6166,6 +6278,14 @@ buffer-xor@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== +buffer@6.0.3, buffer@^6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" + integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.2.1" + buffer@^5.5.0, buffer@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" @@ -6174,14 +6294,6 @@ buffer@^5.5.0, buffer@^5.6.0: base64-js "^1.3.1" ieee754 "^1.1.13" -buffer@^6.0.3: - version "6.0.3" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" - integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.2.1" - builtin-modules@^3.0.0: version "3.3.0" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.3.0.tgz#cae62812b89801e9656336e46223e030386be7b6" @@ -9586,6 +9698,11 @@ he@1.2.0, he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== +hey-listen@^1.0.8: + version "1.0.8" + resolved "https://registry.yarnpkg.com/hey-listen/-/hey-listen-1.0.8.tgz#8e59561ff724908de1aa924ed6ecc84a56a9aa68" + integrity sha512-COpmrF2NOg4TBWUJ5UVyaCU2A88wEMkUPK4hNqyCkqHbxT92BbvfjoSozkAIIm6XhicGlJHhFdullInrdhwU8Q== + hmac-drbg@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -11387,6 +11504,31 @@ listr2@^3.8.3: through "^2.3.8" wrap-ansi "^7.0.0" +lit-element@^3.2.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-3.3.0.tgz#a8e0b9ca5239faf721d9af4460f106cf7f03533b" + integrity sha512-M3OIoblNS7LZdRxOIk8g0wyLEA/lRw/UGJ1TX+767OpkuDsRdSoxBIvewpWqCo7sMd9xt1XedUNZIr9jUO1X3g== + dependencies: + "@lit-labs/ssr-dom-shim" "^1.1.0" + "@lit/reactive-element" "^1.3.0" + lit-html "^2.7.0" + +lit-html@^2.6.0, lit-html@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.7.0.tgz#b244457d0f8c4782a50e83b2c6f3611347ef775d" + integrity sha512-/zPOl8EfeB3HHpTzINSpnWgvgQ8N07g/j272EOAIyB0Ys2RzBqTVT23i+JZuUlNbB2WHHeSsTCFi92NtWrtpqQ== + dependencies: + "@types/trusted-types" "^2.0.2" + +lit@2.6.1: + version "2.6.1" + resolved "https://registry.yarnpkg.com/lit/-/lit-2.6.1.tgz#5951a2098b9bde5b328c73b55c15fdc0eefd96d7" + integrity sha512-DT87LD64f8acR7uVp7kZfhLRrHkfC/N4BVzAtnw9Yg8087mbBJ//qedwdwX0kzDbxgPccWRW6mFwGbRQIxy0pw== + dependencies: + "@lit/reactive-element" "^1.6.0" + lit-element "^3.2.0" + lit-html "^2.6.0" + load-json-file@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" @@ -12030,6 +12172,18 @@ modify-values@^1.0.0: resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022" integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw== +motion@10.15.5: + version "10.15.5" + resolved "https://registry.yarnpkg.com/motion/-/motion-10.15.5.tgz#d336ddbdd37bc28bb99fbb243fe309df6c685ad6" + integrity sha512-ejP6KioN4pigTGxL93APzOnvtLklParL59UQB2T3HWXQBxFcIp5/7YXFmkgiA6pNKKzjvnLhnonRBN5iSFMnNw== + dependencies: + "@motionone/animation" "^10.15.1" + "@motionone/dom" "^10.15.5" + "@motionone/svelte" "^10.15.5" + "@motionone/types" "^10.15.1" + "@motionone/utils" "^10.15.1" + "@motionone/vue" "^10.15.5" + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -13937,6 +14091,11 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" +proxy-compare@2.5.0: + version "2.5.0" + resolved "https://registry.yarnpkg.com/proxy-compare/-/proxy-compare-2.5.0.tgz#0387c5e4d283ba9b1c0353bb20def4449b06bbd2" + integrity sha512-f1us0OsVAJ3tdIMXGQx2lmseYS4YXe4W+sKF5g5ww/jV+5ogMadPt+sIZ+88Ga9kvMJsrRNWzCrKPpr6pMWYbA== + proxy-from-env@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" @@ -13997,7 +14156,7 @@ qrcode-terminal@^0.12.0: resolved "https://registry.yarnpkg.com/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz#bb5b699ef7f9f0505092a3748be4464fe71b5819" integrity sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ== -qrcode@^1.4.4, qrcode@^1.5.1: +qrcode@1.5.1, qrcode@^1.4.4, qrcode@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.5.1.tgz#0103f97317409f7bc91772ef30793a54cd59f0cb" integrity sha512-nS8NJ1Z3md8uTjKtP+SGGhfqmTCs5flU/xR623oI0JX+Wepz9R8UrRVCTBTJm3qGw3rH6jJ6MUHjkDx15cxSSg== @@ -16285,6 +16444,14 @@ validate-npm-package-name@^4.0.0: dependencies: builtins "^5.0.0" +valtio@1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/valtio/-/valtio-1.10.3.tgz#273eda9ba6459869798b4f58c84514e18fb80ed8" + integrity sha512-t3Ez/+baJ+Z5tIyeaI6nCAbW/hrmcq2jditwg/X++o5IvCdiGirQKTOv1kJq0glgUo13v5oABCVGcinggBfiKw== + dependencies: + proxy-compare "2.5.0" + use-sync-external-store "1.2.0" + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" From 06be59c868229c3a7daba626df6cadd3f9755e59 Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Thu, 30 Mar 2023 10:13:24 +0200 Subject: [PATCH 14/28] Replaced walletconnect/qr-modal with web3moda/standalone modal. --- .../src/lib/wallet-connect-client.ts | 24 +++++++++++++++---- .../wallet-connect/src/lib/wallet-connect.ts | 6 ++++- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/packages/wallet-connect/src/lib/wallet-connect-client.ts b/packages/wallet-connect/src/lib/wallet-connect-client.ts index d28853ce7..8a9054fd4 100644 --- a/packages/wallet-connect/src/lib/wallet-connect-client.ts +++ b/packages/wallet-connect/src/lib/wallet-connect-client.ts @@ -1,6 +1,6 @@ import Client from "@walletconnect/sign-client"; import type { SignClientTypes, EngineTypes } from "@walletconnect/types"; -import QRCodeModal from "@walletconnect/qrcode-modal"; +import { Web3Modal } from "@web3modal/standalone"; import type { SessionTypes } from "@walletconnect/types"; import type { EventEmitterService, @@ -41,15 +41,29 @@ class WalletConnectClient { this.client.once(event, callback); } - async connect(params: EngineTypes.ConnectParams, qrCodeModal: boolean) { + async connect( + params: EngineTypes.ConnectParams, + qrCodeModal: boolean, + projectId: string, + chainId: string + ) { + const web3Modal = new Web3Modal({ + walletConnectVersion: 2, + projectId, + standaloneChains: [chainId], + }); + return new Promise((resolve, reject) => { this.client .connect(params) .then(({ uri, approval }) => { if (uri) { if (qrCodeModal) { - QRCodeModal.open(uri, () => { - reject(new Error("User cancelled pairing")); + web3Modal.openModal({ uri, standaloneChains: [chainId] }); + web3Modal.subscribeModal(({ open }) => { + if (!open) { + reject(new Error("User cancelled pairing")); + } }); } else { this.emitter.emit("uriChanged", { uri }); @@ -59,7 +73,7 @@ class WalletConnectClient { approval() .then(resolve) .catch(reject) - .finally(() => QRCodeModal.close()); + .finally(() => web3Modal.closeModal()); }) .catch(reject); }); diff --git a/packages/wallet-connect/src/lib/wallet-connect.ts b/packages/wallet-connect/src/lib/wallet-connect.ts index cde71bcc0..98a07f40a 100644 --- a/packages/wallet-connect/src/lib/wallet-connect.ts +++ b/packages/wallet-connect/src/lib/wallet-connect.ts @@ -485,6 +485,8 @@ const WalletConnect: WalletBehaviourFactory< } try { + const chainId = getChainId(); + _state.session = await _state.client.connect( { requiredNamespaces: { @@ -495,7 +497,9 @@ const WalletConnect: WalletBehaviourFactory< }, }, }, - qrCodeModal + qrCodeModal, + params.projectId, + chainId ); await requestSignIn({ receiverId: contractId, methodNames }); From 466bf629af2a1e746232b79e700c6bf3ef04a96f Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Thu, 30 Mar 2023 10:14:27 +0200 Subject: [PATCH 15/28] Reduce z-index for modal to allow walletconnect modal to show up. --- packages/modal-ui-js/src/lib/styles.css | 2 +- packages/modal-ui/src/lib/components/styles.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/modal-ui-js/src/lib/styles.css b/packages/modal-ui-js/src/lib/styles.css index ccc2c63e7..6d5ffeba1 100644 --- a/packages/modal-ui-js/src/lib/styles.css +++ b/packages/modal-ui-js/src/lib/styles.css @@ -126,7 +126,7 @@ color: var(--wallet-selector-text-color, var(--text-color)); font-family: Manrope, sans-serif; font-weight: 500; - z-index: 100; + z-index: 80; display: flex; justify-content: center; align-items: center; diff --git a/packages/modal-ui/src/lib/components/styles.css b/packages/modal-ui/src/lib/components/styles.css index b62bd544c..edd9f9aad 100644 --- a/packages/modal-ui/src/lib/components/styles.css +++ b/packages/modal-ui/src/lib/components/styles.css @@ -126,7 +126,7 @@ color: var(--wallet-selector-text-color, var(--text-color)); font-family: Manrope, sans-serif; font-weight: 500; - z-index: 100; + z-index: 80; display: flex; justify-content: center; align-items: center; From d81285e42e5d0c44926e33fe7f9ff5cae9e6f9ec Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Thu, 30 Mar 2023 10:19:34 +0200 Subject: [PATCH 16/28] Removed @walletconnect/qrcode-modal dependency. --- package.json | 1 - yarn.lock | 90 ++-------------------------------------------------- 2 files changed, 2 insertions(+), 89 deletions(-) diff --git a/package.json b/package.json index a9a5f9589..596eba2cb 100644 --- a/package.json +++ b/package.json @@ -90,7 +90,6 @@ "@metamask/detect-provider": "^2.0.0", "@meteorwallet/sdk": "^0.6.0", "@nightlylabs/connect-near": "0.0.15", - "@walletconnect/qrcode-modal": "2.0.0-alpha.20", "@walletconnect/sign-client": "2.5.2", "@web3modal/standalone": "^2.2.2", "better-sqlite3": "^8.1.0", diff --git a/yarn.lock b/yarn.lock index 60729ce63..7b9cffd56 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4903,15 +4903,6 @@ ts-node "^10.9.1" tslib "1.14.1" -"@walletconnect/heartbeat@^1.0.1": - version "1.0.1" - resolved "https://registry.yarnpkg.com/@walletconnect/heartbeat/-/heartbeat-1.0.1.tgz#0cd89a53b6eafbfde07204936b29ac0d185d8e16" - integrity sha512-2FbyTlftC7TMpLSMhEI/H9fy4ToadJ8B7t8ROI97L9ZlmmVyPdoYA8WDu7akQQId/ZBYb7WClfJqvweOB11vTA== - dependencies: - "@walletconnect/events" "^1.0.1" - "@walletconnect/time" "^1.0.2" - tslib "1.14.1" - "@walletconnect/jsonrpc-provider@1.0.10": version "1.0.10" resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.10.tgz#8351a06b70faa8f8c0e77dc2c6d9b0190d17d407" @@ -4974,33 +4965,6 @@ pino "7.11.0" tslib "1.14.1" -"@walletconnect/mobile-registry@^2.0.0-alpha.20": - version "2.0.0-alpha.20" - resolved "https://registry.yarnpkg.com/@walletconnect/mobile-registry/-/mobile-registry-2.0.0-alpha.20.tgz#5f6c6299ec149effaf2a278250198e7ecf33d6b7" - integrity sha512-Qunuhp6dnjkIQgVWRRktLE3KGRbNw7AgZnLAoTsOakOLLVL+l9zOIUuowRcbCOpPzDK8Vb5Y2gWSPR1tce0hAg== - -"@walletconnect/qrcode-modal@2.0.0-alpha.20": - version "2.0.0-alpha.20" - resolved "https://registry.yarnpkg.com/@walletconnect/qrcode-modal/-/qrcode-modal-2.0.0-alpha.20.tgz#b80da728183b5a9340d99ff507bb40d14727d87f" - integrity sha512-R+lKspxKfjQ5VCWFpuxQ49s+vEeBsKLXtAhOALRga/5dJVc33eRmgd6dJ2dEhkCaUJ6SDVPd3w3EF0jYBVBXPg== - dependencies: - "@walletconnect/mobile-registry" "^2.0.0-alpha.20" - "@walletconnect/types" "^2.0.0-alpha.20" - "@walletconnect/utils" "^2.0.0-alpha.20" - detect-browser "^5.1.0" - preact "^10.4.1" - qrcode "^1.4.4" - safe-json-utils "^1.1.1" - window-getters "^1.0.1" - -"@walletconnect/relay-api@^1.0.7": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@walletconnect/relay-api/-/relay-api-1.0.7.tgz#e7aed03cbaff99ecdf2c8d32280c0b5d673bb419" - integrity sha512-Mf/Ql7Z0waZzAuondHS9bbUi12Kyvl95ihxVDM7mPO8o7Ke7S1ffpujCUhXbSacSKcw9aV2+7bKADlsBjQLR5Q== - dependencies: - "@walletconnect/jsonrpc-types" "^1.0.2" - tslib "1.14.1" - "@walletconnect/relay-api@^1.0.9": version "1.0.9" resolved "https://registry.yarnpkg.com/@walletconnect/relay-api/-/relay-api-1.0.9.tgz#f8c2c3993dddaa9f33ed42197fc9bfebd790ecaf" @@ -5051,18 +5015,6 @@ dependencies: tslib "1.14.1" -"@walletconnect/types@2.1.4", "@walletconnect/types@^2.0.0-alpha.20": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.1.4.tgz#0db77adbaffd3a9bdf7e9d710d7e7352de542b16" - integrity sha512-n9fIk0z2fiGFlPgQcpurQ8WH7XF/blYaDIpr2ai3qdoo1N10yCsX1vj65L8t3zJAmSeHFoVJI9YVrSDj5eWjWw== - dependencies: - "@walletconnect/events" "^1.0.1" - "@walletconnect/heartbeat" "^1.0.1" - "@walletconnect/jsonrpc-types" "^1.0.2" - "@walletconnect/keyvaluestorage" "^1.0.2" - "@walletconnect/logger" "^2.0.1" - events "^3.3.0" - "@walletconnect/types@2.5.2", "@walletconnect/types@^2.5.2": version "2.5.2" resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.5.2.tgz#b2ad73f9e6e19a90fe372babc9ed461fe27098fe" @@ -5096,27 +5048,6 @@ query-string "7.1.1" uint8arrays "^3.1.0" -"@walletconnect/utils@^2.0.0-alpha.20": - version "2.1.4" - resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.1.4.tgz#992442d175f71cf7a685c5568d12bf25d719600e" - integrity sha512-g3XRGAgETQbwbZleQS1f4ZFl8X6jb+CaWVNM+vtVO9EvIUJAzE8TLq3H70v+KawRMaLXjgRc0z0W7Wg6bvct7g== - dependencies: - "@stablelib/chacha20poly1305" "1.0.1" - "@stablelib/hkdf" "1.0.1" - "@stablelib/random" "^1.0.2" - "@stablelib/sha256" "1.0.1" - "@stablelib/x25519" "^1.0.3" - "@walletconnect/jsonrpc-utils" "^1.0.4" - "@walletconnect/relay-api" "^1.0.7" - "@walletconnect/safe-json" "^1.0.1" - "@walletconnect/time" "^1.0.2" - "@walletconnect/types" "2.1.4" - "@walletconnect/window-getters" "^1.0.1" - "@walletconnect/window-metadata" "^1.0.1" - detect-browser "5.3.0" - query-string "7.1.1" - uint8arrays "3.1.0" - "@walletconnect/window-getters@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@walletconnect/window-getters/-/window-getters-1.0.1.tgz#f36d1c72558a7f6b87ecc4451fc8bd44f63cbbdc" @@ -7681,7 +7612,7 @@ destroy@1.2.0: resolved "https://registry.yarnpkg.com/destroy/-/destroy-1.2.0.tgz#4803735509ad8be552934c67df614f94e66fa015" integrity sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg== -detect-browser@5.3.0, detect-browser@^5.1.0: +detect-browser@5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.3.0.tgz#9705ef2bddf46072d0f7265a1fe300e36fe7ceca" integrity sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w== @@ -13942,11 +13873,6 @@ postcss@8.4.14, postcss@^8.2.13, postcss@^8.2.14, postcss@^8.3.5, postcss@^8.3.7 picocolors "^1.0.0" source-map-js "^1.0.2" -preact@^10.4.1: - version "10.10.0" - resolved "https://registry.yarnpkg.com/preact/-/preact-10.10.0.tgz#7434750a24b59dae1957d95dc0aa47a4a8e9a180" - integrity sha512-fszkg1iJJjq68I4lI8ZsmBiaoQiQHbxf1lNq+72EmC/mZOsFF5zn3k1yv9QGoFgIXzgsdSKtYymLJsrJPoamjQ== - prebuild-install@^7.1.0: version "7.1.1" resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45" @@ -14156,7 +14082,7 @@ qrcode-terminal@^0.12.0: resolved "https://registry.yarnpkg.com/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz#bb5b699ef7f9f0505092a3748be4464fe71b5819" integrity sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ== -qrcode@1.5.1, qrcode@^1.4.4, qrcode@^1.5.1: +qrcode@1.5.1, qrcode@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/qrcode/-/qrcode-1.5.1.tgz#0103f97317409f7bc91772ef30793a54cd59f0cb" integrity sha512-nS8NJ1Z3md8uTjKtP+SGGhfqmTCs5flU/xR623oI0JX+Wepz9R8UrRVCTBTJm3qGw3rH6jJ6MUHjkDx15cxSSg== @@ -16234,13 +16160,6 @@ uglify-js@^3.1.4: resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.2.tgz#0481e1dbeed343ad1c2ddf3c6d42e89b7a6d4def" integrity sha512-AaQNokTNgExWrkEYA24BTNMSjyqEXPSfhqoS0AxmHkCJ4U+Dyy5AvbGV/sqxuxficEfGGoX3zWw9R7QpLFfEsg== -uint8arrays@3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.1.0.tgz#8186b8eafce68f28bd29bd29d683a311778901e2" - integrity sha512-ei5rfKtoRO8OyOIor2Rz5fhzjThwIHJZ3uyDPnDHTXbP0aMQ1RN/6AI5B5d9dBxJOU+BvOAk7ZQ1xphsX8Lrog== - dependencies: - multiformats "^9.4.2" - uint8arrays@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/uint8arrays/-/uint8arrays-3.0.0.tgz#260869efb8422418b6f04e3fac73a3908175c63b" @@ -16845,11 +16764,6 @@ wildcard@^2.0.0: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== -window-getters@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/window-getters/-/window-getters-1.0.1.tgz#a564c258413b4808789633d8bfb7ed741d798aa0" - integrity sha512-cojBfDeV58XEurDgj+rre15c7dvu27bWCPlOIpwQgreOsw6qQk0UGDR1hi7ZHKw5+L0AENUNNWGG2h4yr2Y3hQ== - word-wrap@^1.2.3, word-wrap@~1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/word-wrap/-/word-wrap-1.2.3.tgz#610636f6b1f703891bd34771ccb17fb93b47079c" From c0158f46a4012dfd7dcc2d8caef14494f70f4e14 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Thu, 30 Mar 2023 10:33:37 +0200 Subject: [PATCH 17/28] Added welldone tests --- .../src/lib/injected-welldone.ts | 2 +- .../welldone-wallet/src/lib/welldone.spec.ts | 152 ++++++++++++++++++ packages/welldone-wallet/tsconfig.json | 3 +- 3 files changed, 155 insertions(+), 2 deletions(-) create mode 100644 packages/welldone-wallet/src/lib/welldone.spec.ts diff --git a/packages/welldone-wallet/src/lib/injected-welldone.ts b/packages/welldone-wallet/src/lib/injected-welldone.ts index 5459bdaa2..6ab981bcf 100644 --- a/packages/welldone-wallet/src/lib/injected-welldone.ts +++ b/packages/welldone-wallet/src/lib/injected-welldone.ts @@ -16,7 +16,7 @@ export interface SignAndSendTransactionParams { actions: Array; } -interface RequestParams { +export interface RequestParams { jsonrpc?: "2.0"; id?: number; method: string; diff --git a/packages/welldone-wallet/src/lib/welldone.spec.ts b/packages/welldone-wallet/src/lib/welldone.spec.ts new file mode 100644 index 000000000..70529316d --- /dev/null +++ b/packages/welldone-wallet/src/lib/welldone.spec.ts @@ -0,0 +1,152 @@ +/* eslint-disable @nrwl/nx/enforce-module-boundaries */ +import { mockWallet } from "../../../core/src/lib/testUtils"; +import type { MockWalletDependencies } from "../../../core/src/lib/testUtils"; +import type { InjectedWallet } from "../../../core/src/lib/wallet"; +import { setupWelldoneWallet } from "./welldone"; +import type { RequestParams } from "./injected-welldone"; + +// eslint-disable-next-line @typescript-eslint/no-var-requires +global.TextDecoder = require("util").TextDecoder; + +const accountId = "amirsaran.testnet"; +const publicKey = "ed25519:GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC"; +const transactions = [ + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, + { + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }, +]; + +const mockWelldoneOnWindow = () => { + window.dapp = { + getAccount: jest.fn(), + request: jest.fn(async (chain: string, args: RequestParams) => { + if (chain === "near" && args.method === "dapp:accounts") { + return { + near: { + address: accountId, + pubKey: publicKey, + }, + }; + } else if (chain === "near" && args.method === "query") { + return { + permission: "FullAccess", + }; + } else if (chain === "near" && args.method === "dapp:signMessage") { + return [ + { + signature: + "0x8f77971cdd4813c82f27dfce119472f78adc7552ddec4d6ac72dcc3c3deebb31c6d2d85fc7d1b68c1d22a7aa1a749e0a3607403603af9b7afc3fbe2115921509", + publicKey, + }, + ]; + } else if (chain === "near" && args.method === "dapp:signTransaction") { + return [ + { + signature: + "0x0000000000e27d386ac7c349f60af93979f9e9c916660f83a5814c6d28aaf1668c2b85c81f819c8bbc365a000000000000d7bbdd188195d2a74dc6cc6f77457f131fd9c48f20376e4967b6f76f377ee98200000000", + publicKey, + }, + ]; + } else { + return null; + } + }), + on: jest.fn(), + }; + + return window.dapp; +}; + +const createWelldoneWallet = async (deps: MockWalletDependencies = {}) => { + const injectedWelldone = mockWelldoneOnWindow(); + const { wallet } = await mockWallet( + setupWelldoneWallet(), + deps + ); + + return { + wallet, + injectedWelldone, + }; +}; + +afterEach(() => { + jest.resetModules(); +}); + +describe("signIn", () => { + it("sign into welldone wallet", async () => { + const { wallet, injectedWelldone } = await createWelldoneWallet(); + + const accounts = await wallet.signIn({ contractId: "test.testnet" }); + + expect(injectedWelldone.request).toHaveBeenCalledWith("near", { + method: "query", + params: { + request_type: "view_access_key", + finality: "final", + account_id: accountId, + public_key: publicKey, + }, + }); + expect(accounts).toEqual([{ accountId, publicKey }]); + }); +}); + +describe("signOut", () => { + it("sign out of welldone wallet", async () => { + const { wallet } = await createWelldoneWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signOut(); + }); +}); + +describe("getAccounts", () => { + it("returns array of accounts", async () => { + const { wallet, injectedWelldone } = await createWelldoneWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.getAccounts(); + + expect(injectedWelldone.request).toHaveBeenCalledWith("near", { + method: "dapp:accounts", + }); + expect(result).toEqual([{ accountId, publicKey }]); + }); +}); + +describe("signAndSendTransaction", () => { + it("sign transaction in welldone", async () => { + const { wallet, injectedWelldone } = await createWelldoneWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + await wallet.signAndSendTransaction({ + signerId: accountId, + receiverId: "test.testnet", + actions: [], + }); + + expect(injectedWelldone.request).toHaveBeenCalledTimes(3); + }); +}); +describe("signAndSendTransactions", () => { + it("sign transactions in welldone", async () => { + const { wallet, injectedWelldone } = await createWelldoneWallet(); + + await wallet.signIn({ contractId: "test.testnet" }); + const result = await wallet.signAndSendTransactions({ + transactions, + }); + + expect(injectedWelldone.request).toHaveBeenCalledTimes(4); + expect(result.length).toEqual(transactions.length); + }); +}); diff --git a/packages/welldone-wallet/tsconfig.json b/packages/welldone-wallet/tsconfig.json index 8b6d6acaf..3aaed7519 100644 --- a/packages/welldone-wallet/tsconfig.json +++ b/packages/welldone-wallet/tsconfig.json @@ -4,7 +4,8 @@ "forceConsistentCasingInFileNames": true, "strict": true, "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true + "noFallthroughCasesInSwitch": true, + "resolveJsonModule": true }, "files": [], "include": [], From c825bf0d1720588a1809504d377a4b1030581100 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Thu, 30 Mar 2023 13:53:22 +0200 Subject: [PATCH 18/28] small change --- packages/welldone-wallet/src/lib/welldone.spec.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/welldone-wallet/src/lib/welldone.spec.ts b/packages/welldone-wallet/src/lib/welldone.spec.ts index 70529316d..aab56928c 100644 --- a/packages/welldone-wallet/src/lib/welldone.spec.ts +++ b/packages/welldone-wallet/src/lib/welldone.spec.ts @@ -128,11 +128,7 @@ describe("signAndSendTransaction", () => { const { wallet, injectedWelldone } = await createWelldoneWallet(); await wallet.signIn({ contractId: "test.testnet" }); - await wallet.signAndSendTransaction({ - signerId: accountId, - receiverId: "test.testnet", - actions: [], - }); + await wallet.signAndSendTransaction(transactions[0]); expect(injectedWelldone.request).toHaveBeenCalledTimes(3); }); From 1261a8ca2b1a2cddd16a629f93daccfda008f95c Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Thu, 30 Mar 2023 13:58:39 +0200 Subject: [PATCH 19/28] skip welldone wallet tests --- packages/welldone-wallet/src/lib/welldone.spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/welldone-wallet/src/lib/welldone.spec.ts b/packages/welldone-wallet/src/lib/welldone.spec.ts index aab56928c..6185fec68 100644 --- a/packages/welldone-wallet/src/lib/welldone.spec.ts +++ b/packages/welldone-wallet/src/lib/welldone.spec.ts @@ -82,7 +82,7 @@ afterEach(() => { }); describe("signIn", () => { - it("sign into welldone wallet", async () => { + it.skip("sign into welldone wallet", async () => { const { wallet, injectedWelldone } = await createWelldoneWallet(); const accounts = await wallet.signIn({ contractId: "test.testnet" }); @@ -101,7 +101,7 @@ describe("signIn", () => { }); describe("signOut", () => { - it("sign out of welldone wallet", async () => { + it.skip("sign out of welldone wallet", async () => { const { wallet } = await createWelldoneWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -110,7 +110,7 @@ describe("signOut", () => { }); describe("getAccounts", () => { - it("returns array of accounts", async () => { + it.skip("returns array of accounts", async () => { const { wallet, injectedWelldone } = await createWelldoneWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -124,7 +124,7 @@ describe("getAccounts", () => { }); describe("signAndSendTransaction", () => { - it("sign transaction in welldone", async () => { + it.skip("sign transaction in welldone", async () => { const { wallet, injectedWelldone } = await createWelldoneWallet(); await wallet.signIn({ contractId: "test.testnet" }); @@ -134,7 +134,7 @@ describe("signAndSendTransaction", () => { }); }); describe("signAndSendTransactions", () => { - it("sign transactions in welldone", async () => { + it.skip("sign transactions in welldone", async () => { const { wallet, injectedWelldone } = await createWelldoneWallet(); await wallet.signIn({ contractId: "test.testnet" }); From ed9ae5446be15a856ff3900e7e3b66ef44e00c5e Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Fri, 31 Mar 2023 16:05:22 +0200 Subject: [PATCH 20/28] Populate selectedAccounts when there is only account. --- packages/modal-ui/src/lib/components/DerivationPath.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/modal-ui/src/lib/components/DerivationPath.tsx b/packages/modal-ui/src/lib/components/DerivationPath.tsx index 7b6707e0c..32b0d06b4 100644 --- a/packages/modal-ui/src/lib/components/DerivationPath.tsx +++ b/packages/modal-ui/src/lib/components/DerivationPath.tsx @@ -133,6 +133,7 @@ export const DerivationPath: React.FC = ({ setAccounts(resolvedAccounts); if (!multipleAccounts) { + setSelectedAccounts(resolvedAccounts); setRoute("OverviewAccounts"); } else { setHeaderTitle(translate("modal.ledger.selectYourAccounts")); From 9863b4b4c8a2590eadb3bf7e9ebdc6060f52538e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Apr 2023 09:09:16 +0000 Subject: [PATCH 21/28] Bump @jscutlery/semver from 2.29.3 to 2.30.1 Bumps [@jscutlery/semver](https://github.com/jscutlery/semver) from 2.29.3 to 2.30.1. - [Release notes](https://github.com/jscutlery/semver/releases) - [Commits](https://github.com/jscutlery/semver/compare/semver-2.29.3...semver-2.30.1) --- updated-dependencies: - dependency-name: "@jscutlery/semver" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 19 ++++++------------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 878ba3e71..bc30f6ffb 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "@angular/platform-browser-dynamic": "~14.0.0", "@angular/router": "~14.0.0", "@here-wallet/core": "^1.4.0", - "@jscutlery/semver": "^2.29.3", + "@jscutlery/semver": "^2.30.1", "@ledgerhq/hw-transport": "6.27.1", "@ledgerhq/hw-transport-webhid": "6.27.1", "@metamask/detect-provider": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 305c206af..6824c3f48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2566,17 +2566,17 @@ "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" -"@jscutlery/semver@^2.29.3": - version "2.29.3" - resolved "https://registry.yarnpkg.com/@jscutlery/semver/-/semver-2.29.3.tgz#e705ce22d74ce54872f9cd05a1298b2ce94fae78" - integrity sha512-Vb1K8xsZtU2iz25/QcXm0JCTmLcX91mNqRf8/6Pp5vzaO0aKztDX4hHNIRBBo/5nCh4TVJk6QWp3CeUCGdoFNQ== +"@jscutlery/semver@^2.30.1": + version "2.30.1" + resolved "https://registry.yarnpkg.com/@jscutlery/semver/-/semver-2.30.1.tgz#daaaf223a6536a339ad98bee92c872205a5c0191" + integrity sha512-Adnlu/kEOaikxNJLi3Ll4UfgEW4VG0dvf5zm7Ere7vT/udHhPs6CTO6B7PCFLzKsLgM0vqSrVk/nKYFWri83Ww== dependencies: chalk "4.1.2" conventional-changelog "^3.1.25" conventional-recommended-bump "^6.1.0" detect-indent "6.1.0" inquirer "8.2.5" - rxjs "7.6.0" + rxjs "7.8.0" "@ledgerhq/devices@^6.27.1": version "6.27.1" @@ -14424,14 +14424,7 @@ rxjs@6, rxjs@6.6.7, rxjs@^6.5.4: dependencies: tslib "^1.9.0" -rxjs@7.6.0: - version "7.6.0" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.6.0.tgz#361da5362b6ddaa691a2de0b4f2d32028f1eb5a2" - integrity sha512-DDa7d8TFNUalGC9VqXvQ1euWNN7sc63TrUCuM9J998+ViviahMIjKSOU7rfcgFOF+FCD71BhDRv4hrFz+ImDLQ== - dependencies: - tslib "^2.1.0" - -rxjs@^7.5.1, rxjs@^7.5.5, rxjs@^7.8.0: +rxjs@7.8.0, rxjs@^7.5.1, rxjs@^7.5.5, rxjs@^7.8.0: version "7.8.0" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.0.tgz#90a938862a82888ff4c7359811a595e14e1e09a4" integrity sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg== From 9fabb360ff23ce000e61a236665ad2d344ab3a8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 1 Apr 2023 09:12:08 +0000 Subject: [PATCH 22/28] Bump ngx-deploy-npm from 4.3.1 to 4.3.10 Bumps [ngx-deploy-npm](https://github.com/bikecoders/ngx-deploy-npm) from 4.3.1 to 4.3.10. - [Release notes](https://github.com/bikecoders/ngx-deploy-npm/releases) - [Commits](https://github.com/bikecoders/ngx-deploy-npm/compare/v4.3.1...v4.3.10) --- updated-dependencies: - dependency-name: ngx-deploy-npm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 878ba3e71..79006f106 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,7 @@ "near-api-js": "^1.1.0", "near-seed-phrase": "^0.2.0", "next": "12.2.3", - "ngx-deploy-npm": "^4.3.1", + "ngx-deploy-npm": "^4.3.10", "qrcode": "^1.5.1", "react": "18.2.0", "react-dom": "18.2.0", diff --git a/yarn.lock b/yarn.lock index 305c206af..3506c7e9a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3030,14 +3030,15 @@ semver "7.3.4" tslib "^2.3.0" -"@nrwl/devkit@14.7.17": - version "14.7.17" - resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-14.7.17.tgz#0dd914d0596e793264cd117c77bb1a3a0d9de2f2" - integrity sha512-flTV8BuC7oacWGHseoKsyOAYmWsMSP6iYGRjrCaV0MyRbDkNy0P07elXXFUW01er+l7x/awZYQR9/n/eNyqfXA== +"@nrwl/devkit@15.2.3": + version "15.2.3" + resolved "https://registry.yarnpkg.com/@nrwl/devkit/-/devkit-15.2.3.tgz#70b4e914c4cd19cd1ba99389499ba854985a821e" + integrity sha512-3IZVahO6vvEFxp0N7mEO34ZnYT+8FaObyYI/2XVYZ0eDCAMihn2IIUMj+M42vAXPOJpctdghSKXovQDuHO031w== dependencies: "@phenomnomnominal/tsquery" "4.1.1" ejs "^3.1.7" ignore "^5.0.4" + semver "7.3.4" tslib "^2.3.0" "@nrwl/eslint-plugin-nx@14.4.2": @@ -12028,12 +12029,12 @@ next@12.2.3: "@next/swc-win32-ia32-msvc" "12.2.3" "@next/swc-win32-x64-msvc" "12.2.3" -ngx-deploy-npm@^4.3.1: - version "4.3.1" - resolved "https://registry.yarnpkg.com/ngx-deploy-npm/-/ngx-deploy-npm-4.3.1.tgz#70577f9c909aede59186e5301f7add6cc482844e" - integrity sha512-U1sIef5PwPUtXNXFzoBkYXYJ4+uqvpO9KUICzsaX5Tm8evAE0Pt6B9S69YaS4y5W1qGhPsMiPRFVCE5bLbL3jg== +ngx-deploy-npm@^4.3.10: + version "4.3.10" + resolved "https://registry.yarnpkg.com/ngx-deploy-npm/-/ngx-deploy-npm-4.3.10.tgz#e1d150512c9196e5a70f0f2d1e9f0d8666bc622b" + integrity sha512-6cLM1z0h6VD5SYH9fJSeslvTSKTkaySsH63k2AouXnAXsHQe4eFrdkmfMAZoVwUZHyaNIBOKMUcTvotgMwQnug== dependencies: - "@nrwl/devkit" "14.7.17" + "@nrwl/devkit" "15.2.3" nice-napi@^1.0.2: version "1.0.2" From 6a3d880b58462786aafb64625a46c8ee276b777a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Apr 2023 08:32:15 +0000 Subject: [PATCH 23/28] Bump better-sqlite3 from 8.1.0 to 8.2.0 Bumps [better-sqlite3](https://github.com/WiseLibs/better-sqlite3) from 8.1.0 to 8.2.0. - [Release notes](https://github.com/WiseLibs/better-sqlite3/releases) - [Commits](https://github.com/WiseLibs/better-sqlite3/compare/v8.1.0...v8.2.0) --- updated-dependencies: - dependency-name: better-sqlite3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 596eba2cb..d1406a6ca 100644 --- a/package.json +++ b/package.json @@ -92,7 +92,7 @@ "@nightlylabs/connect-near": "0.0.15", "@walletconnect/sign-client": "2.5.2", "@web3modal/standalone": "^2.2.2", - "better-sqlite3": "^8.1.0", + "better-sqlite3": "^8.2.0", "big.js": "^6.1.1", "bn.js": "^5.2.0", "bs58": "^5.0.0", diff --git a/yarn.lock b/yarn.lock index 7b9cffd56..d10668d1c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5909,10 +5909,10 @@ before-after-hook@^2.2.0: resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e" integrity sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ== -better-sqlite3@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/better-sqlite3/-/better-sqlite3-8.1.0.tgz#a0039c5dfdc04b733cac3c8dbe1b71f3e5fc62d3" - integrity sha512-p1m09H+Oi8R9TPj810pdNswMFuVgRNgCJEWypp6jlkOgSwMIrNyuj3hW78xEuBRGok5RzeaUW8aBtTWF3l/TQA== +better-sqlite3@^8.2.0: + version "8.2.0" + resolved "https://registry.yarnpkg.com/better-sqlite3/-/better-sqlite3-8.2.0.tgz#4ef6185b88992723de7e00cfa67585ac59f320bd" + integrity sha512-8eTzxGk9535SB3oSNu0tQ6I4ZffjVCBUjKHN9QeeIFtphBX0sEd0NxAuglBNR9TO5ThnxBB7GqzfcYo9kjadJQ== dependencies: bindings "^1.5.0" prebuild-install "^7.1.0" From 1be13c81904dd23d09064dfe24370ea2f8aa0960 Mon Sep 17 00:00:00 2001 From: DamirSQA Date: Wed, 5 Apr 2023 16:00:27 +0200 Subject: [PATCH 24/28] Suported languages list update --- packages/core/docs/guides/multilanguage-support.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/core/docs/guides/multilanguage-support.md b/packages/core/docs/guides/multilanguage-support.md index 1f1711d6b..f5d6184b7 100644 --- a/packages/core/docs/guides/multilanguage-support.md +++ b/packages/core/docs/guides/multilanguage-support.md @@ -6,13 +6,17 @@ ## Supported languages - English -- Spanish -- Chinese -- Bulgarian -- Vietnamese -- Korean - Arabic +- Bulgarian +- Chinese +- Croatian - Hindi +- Korean +- Macedonian +- Serbian +- Slovenian +- Spanish +- Vietnamese ## How to use From fcc46bc364de321687a5a9c1b297e59653209849 Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Thu, 6 Apr 2023 09:05:46 +0200 Subject: [PATCH 25/28] Fix imports from near-api-js. --- .../src/lib/components/ExportAccount.tsx | 12 +++-- .../provider/provider.service.spec.ts | 6 ++- .../lib/services/provider/provider.service.ts | 6 +-- packages/ledger/src/lib/ledger-client.spec.ts | 23 +++++---- packages/ledger/src/lib/ledger-client.ts | 4 +- packages/ledger/src/lib/ledger.ts | 6 +-- .../meteor-wallet/src/lib/meteor-wallet.ts | 18 +++---- .../my-near-wallet/src/lib/my-near-wallet.ts | 24 ++++------ .../src/lib/nightly-connect.ts | 12 +++-- packages/nightly/src/lib/nightly.ts | 8 ++-- packages/opto-wallet/src/lib/opto-wallet.ts | 24 ++++------ .../wallet-connect/src/lib/wallet-connect.ts | 48 +++++++++---------- .../wallet-utils/src/lib/create-action.ts | 3 +- .../wallet-utils/src/lib/sign-transactions.ts | 18 +++---- packages/welldone-wallet/src/lib/welldone.ts | 14 +++--- 15 files changed, 109 insertions(+), 117 deletions(-) diff --git a/packages/account-export/src/lib/components/ExportAccount.tsx b/packages/account-export/src/lib/components/ExportAccount.tsx index 36cb9694c..97c8c3830 100644 --- a/packages/account-export/src/lib/components/ExportAccount.tsx +++ b/packages/account-export/src/lib/components/ExportAccount.tsx @@ -10,7 +10,7 @@ import type { InjectedWalletMetadata, } from "@near-wallet-selector/core"; -import { utils, providers } from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { FunctionCallPermissionView, AccessKeyView, @@ -78,7 +78,7 @@ const permissionToType = ( }; interface getAccountTypeProps { - provider: providers.Provider; + provider: nearAPI.providers.Provider; accountId: string; publicKey: string; } @@ -103,7 +103,7 @@ const getAccountType = async ({ }; interface getAccountBalanceProps { - provider: providers.Provider; + provider: nearAPI.providers.Provider; accountId: string; } @@ -183,7 +183,9 @@ export const ExportAccount: React.FC = ({ }, [module?.metadata.name, alertMessage]); const { network } = selector.options; - const provider = new providers.JsonRpcProvider({ url: network.nodeUrl }); + const provider = new nearAPI.providers.JsonRpcProvider({ + url: network.nodeUrl, + }); const [hasCopied, setHasCopied] = useState(false); useEffect(() => { @@ -191,7 +193,7 @@ export const ExportAccount: React.FC = ({ setIsLoading(true); const accountsWithDetails = await Promise.all( accounts.map(async ({ accountId, privateKey }) => { - const keyPair = utils.KeyPair.fromString(privateKey); + const keyPair = nearAPI.utils.KeyPair.fromString(privateKey); const { type } = await getAccountType({ provider, accountId, diff --git a/packages/core/src/lib/services/provider/provider.service.spec.ts b/packages/core/src/lib/services/provider/provider.service.spec.ts index 59f3df958..573dd7348 100644 --- a/packages/core/src/lib/services/provider/provider.service.spec.ts +++ b/packages/core/src/lib/services/provider/provider.service.spec.ts @@ -6,7 +6,7 @@ import type { import { mock } from "jest-mock-extended"; import type { FinalExecutionOutcome } from "near-api-js/lib/providers"; import type { JsonRpcProvider } from "near-api-js/lib/providers"; -import { providers } from "near-api-js"; +import * as nearAPI from "near-api-js"; import { createQueryResponseMock, createViewAccessKeyResponseMock, @@ -24,7 +24,9 @@ const defaults = { const setup = (url: string) => { const provider = mock(); - jest.spyOn(providers, "JsonRpcProvider").mockImplementation(() => provider); + jest + .spyOn(nearAPI.providers, "JsonRpcProvider") + .mockImplementation(() => provider); return { provider, diff --git a/packages/core/src/lib/services/provider/provider.service.ts b/packages/core/src/lib/services/provider/provider.service.ts index 93e026003..d9cb996c7 100644 --- a/packages/core/src/lib/services/provider/provider.service.ts +++ b/packages/core/src/lib/services/provider/provider.service.ts @@ -1,4 +1,4 @@ -import { providers } from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { AccessKeyView, BlockReference, @@ -12,10 +12,10 @@ import type { } from "./provider.service.types"; export class Provider implements ProviderService { - private provider: providers.JsonRpcProvider; + private provider: nearAPI.providers.JsonRpcProvider; constructor(url: string) { - this.provider = new providers.JsonRpcProvider({ url }); + this.provider = new nearAPI.providers.JsonRpcProvider({ url }); } query(params: QueryParams) { diff --git a/packages/ledger/src/lib/ledger-client.spec.ts b/packages/ledger/src/lib/ledger-client.spec.ts index c850e67ed..b993b7ea2 100644 --- a/packages/ledger/src/lib/ledger-client.spec.ts +++ b/packages/ledger/src/lib/ledger-client.spec.ts @@ -2,7 +2,7 @@ import type { DeepPartial } from "ts-essentials"; import { mock } from "jest-mock-extended"; import type Transport from "@ledgerhq/hw-transport"; import type TransportWebHID from "@ledgerhq/hw-transport-webhid"; -import { transactions, utils } from "near-api-js"; +import * as nearAPI from "near-api-js"; import { BN } from "bn.js"; interface CreateLedgerClientParams { @@ -24,23 +24,27 @@ const createGetPublicKeyResponseMock = () => { const createTransactionMock = () => { const actions = [ - transactions.functionCall( + nearAPI.transactions.functionCall( "addMessage", { text: "test" }, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - new BN(utils.format.parseNearAmount("0.00000000003")!), + new BN(nearAPI.utils.format.parseNearAmount("0.00000000003")!), // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - new BN(utils.format.parseNearAmount("0")!) + new BN(nearAPI.utils.format.parseNearAmount("0")!) ), ]; - return transactions.createTransaction( + return nearAPI.transactions.createTransaction( "test.testnet", - utils.PublicKey.from("GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC"), + nearAPI.utils.PublicKey.from( + "GF7tLvSzcxX4EtrMFtGvGTb2yUj2DhL8hWzc97BwUkyC" + ), "guest-book.testnet", 76068360000003, actions, - utils.serialize.base_decode("DMgHVMag7MAmtEC17Dpvso5DgvqqYcHzrTpTrA86FG7t") + nearAPI.utils.serialize.base_decode( + "DMgHVMag7MAmtEC17Dpvso5DgvqqYcHzrTpTrA86FG7t" + ) ); }; @@ -148,7 +152,10 @@ describe("sign", () => { }); const transaction = createTransactionMock(); - const data = utils.serialize.serialize(transactions.SCHEMA, transaction); + const data = nearAPI.utils.serialize.serialize( + nearAPI.transactions.SCHEMA, + transaction + ); await client.connect(); const result = await client.sign({ diff --git a/packages/ledger/src/lib/ledger-client.ts b/packages/ledger/src/lib/ledger-client.ts index 742a2e82f..fc99690fc 100644 --- a/packages/ledger/src/lib/ledger-client.ts +++ b/packages/ledger/src/lib/ledger-client.ts @@ -1,6 +1,6 @@ import TransportWebHID from "@ledgerhq/hw-transport-webhid"; import type Transport from "@ledgerhq/hw-transport"; -import { utils } from "near-api-js"; +import * as nearAPI from "near-api-js"; // Further reading regarding APDU Ledger API: // - https://gist.github.com/Wollac/49f0c4e318e42f463b8306298dfb4f4a @@ -151,7 +151,7 @@ export class LedgerClient { parseDerivationPath(derivationPath) ); - return utils.serialize.base_encode(res.subarray(0, -2)); + return nearAPI.utils.serialize.base_encode(res.subarray(0, -2)); }; sign = async ({ data, derivationPath }: SignParams) => { diff --git a/packages/ledger/src/lib/ledger.ts b/packages/ledger/src/lib/ledger.ts index 372906601..69fb7b86a 100644 --- a/packages/ledger/src/lib/ledger.ts +++ b/packages/ledger/src/lib/ledger.ts @@ -14,7 +14,7 @@ import { getActiveAccount } from "@near-wallet-selector/core"; import { isLedgerSupported, LedgerClient } from "./ledger-client"; import type { Subscription } from "./ledger-client"; import type { Signer } from "near-api-js"; -import { utils } from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { FinalExecutionOutcome } from "near-api-js/lib/providers"; import icon from "./icon"; @@ -76,7 +76,7 @@ const Ledger: WalletBehaviourFactory = async ({ throw new Error("Failed to find public key for account"); } - return utils.PublicKey.from(account.publicKey); + return nearAPI.utils.PublicKey.from(account.publicKey); }, signMessage: async (message, accountId) => { const account = _state.accounts.find((a) => a.accountId === accountId); @@ -92,7 +92,7 @@ const Ledger: WalletBehaviourFactory = async ({ return { signature, - publicKey: utils.PublicKey.from(account.publicKey), + publicKey: nearAPI.utils.PublicKey.from(account.publicKey), }; }, }; diff --git a/packages/meteor-wallet/src/lib/meteor-wallet.ts b/packages/meteor-wallet/src/lib/meteor-wallet.ts index c3171e854..11f56e1a7 100644 --- a/packages/meteor-wallet/src/lib/meteor-wallet.ts +++ b/packages/meteor-wallet/src/lib/meteor-wallet.ts @@ -11,13 +11,7 @@ import type { MeteorWalletParams_Injected, MeteorWalletState, } from "./meteor-wallet-types"; -import { - connect, - keyStores, - transactions as nearTransactions, - utils, -} from "near-api-js"; - +import * as nearAPI from "near-api-js"; import { EMeteorWalletSignInType, MeteorWallet as MeteorWalletSdk, @@ -29,12 +23,12 @@ const setupWalletState = async ( params: MeteorWalletParams_Injected, network: Network ): Promise => { - const keyStore = new keyStores.BrowserLocalStorageKeyStore( + const keyStore = new nearAPI.keyStores.BrowserLocalStorageKeyStore( window.localStorage, "_meteor_wallet" ); - const near = await connect({ + const near = await nearAPI.connect({ keyStore, ...network, headers: {}, @@ -101,13 +95,13 @@ const createMeteorWalletInjected: WalletBehaviourFactory< const block = await provider.block({ finality: "final" }); - return nearTransactions.createTransaction( + return nearAPI.transactions.createTransaction( account.accountId, - utils.PublicKey.from(accessKey.public_key), + nearAPI.utils.PublicKey.from(accessKey.public_key), transaction.receiverId, accessKey.access_key.nonce + index + 1, actions, - utils.serialize.base_decode(block.header.hash) + nearAPI.utils.serialize.base_decode(block.header.hash) ); }) ); diff --git a/packages/my-near-wallet/src/lib/my-near-wallet.ts b/packages/my-near-wallet/src/lib/my-near-wallet.ts index ad9d5ee3a..ef2d8d7c2 100644 --- a/packages/my-near-wallet/src/lib/my-near-wallet.ts +++ b/packages/my-near-wallet/src/lib/my-near-wallet.ts @@ -1,10 +1,4 @@ -import { - WalletConnection, - connect, - keyStores, - transactions as nearTransactions, - utils, -} from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { WalletModuleFactory, WalletBehaviourFactory, @@ -26,8 +20,8 @@ export interface MyNearWalletParams { } interface MyNearWalletState { - wallet: WalletConnection; - keyStore: keyStores.BrowserLocalStorageKeyStore; + wallet: nearAPI.WalletConnection; + keyStore: nearAPI.keyStores.BrowserLocalStorageKeyStore; } interface MyNearWalletExtraOptions { @@ -53,16 +47,16 @@ const setupWalletState = async ( params: MyNearWalletExtraOptions, network: Network ): Promise => { - const keyStore = new keyStores.BrowserLocalStorageKeyStore(); + const keyStore = new nearAPI.keyStores.BrowserLocalStorageKeyStore(); - const near = await connect({ + const near = await nearAPI.connect({ keyStore, walletUrl: params.walletUrl, ...network, headers: {}, }); - const wallet = new WalletConnection(near, "near_app"); + const wallet = new nearAPI.WalletConnection(near, "near_app"); return { wallet, @@ -122,13 +116,13 @@ const MyNearWallet: WalletBehaviourFactory< const block = await provider.block({ finality: "final" }); - return nearTransactions.createTransaction( + return nearAPI.transactions.createTransaction( account.accountId, - utils.PublicKey.from(accessKey.public_key), + nearAPI.utils.PublicKey.from(accessKey.public_key), transaction.receiverId, accessKey.access_key.nonce + index + 1, actions, - utils.serialize.base_decode(block.header.hash) + nearAPI.utils.serialize.base_decode(block.header.hash) ); }) ); diff --git a/packages/nightly-connect/src/lib/nightly-connect.ts b/packages/nightly-connect/src/lib/nightly-connect.ts index 53ef52e22..5285b1d23 100644 --- a/packages/nightly-connect/src/lib/nightly-connect.ts +++ b/packages/nightly-connect/src/lib/nightly-connect.ts @@ -1,5 +1,5 @@ import type { Signer } from "near-api-js"; -import { transactions as nearTransactions, utils } from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { AppMetadata } from "@nightlylabs/connect-near"; import { AppNear, @@ -34,7 +34,7 @@ interface NightlyConnectParams { interface NightlyConnectAccount { accountId: string; - publicKey: utils.PublicKey; + publicKey: nearAPI.utils.PublicKey; } interface NightlyConnectState { @@ -73,7 +73,7 @@ const NightlyConnect: WalletBehaviourFactory< throw new Error("Failed to find public key for account"); } - return utils.PublicKey.from(account.publicKey); + return nearAPI.utils.PublicKey.from(account.publicKey); }, signMessage: async (message, accountId) => { const accounts = getAccounts(); @@ -84,7 +84,9 @@ const NightlyConnect: WalletBehaviourFactory< } try { - const tx = nearTransactions.Transaction.decode(Buffer.from(message)); + const tx = nearAPI.transactions.Transaction.decode( + Buffer.from(message) + ); // @ts-ignore const signedTx = await _state.client!.signTransaction(tx); @@ -184,7 +186,7 @@ const NightlyConnect: WalletBehaviourFactory< ) { _state.accounts.push({ accountId: persistedAccountId, - publicKey: utils.PublicKey.from(persistedPubkey), + publicKey: nearAPI.utils.PublicKey.from(persistedPubkey), }); _state.modal.onClose = undefined; resolve( diff --git a/packages/nightly/src/lib/nightly.ts b/packages/nightly/src/lib/nightly.ts index 6421dc373..3efcdd6f9 100644 --- a/packages/nightly/src/lib/nightly.ts +++ b/packages/nightly/src/lib/nightly.ts @@ -13,7 +13,7 @@ import { waitFor } from "@near-wallet-selector/core"; import { signTransactions } from "@near-wallet-selector/wallet-utils"; import { isMobile } from "is-mobile"; import type { Signer } from "near-api-js"; -import { utils, transactions as nearTransactions } from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { NearNightly, InjectedNightly } from "./injected-nightly"; import type { FinalExecutionOutcome } from "near-api-js/lib/providers"; import icon from "./icon"; @@ -116,7 +116,7 @@ const Nightly: WalletBehaviourFactory = async ({ if (!account) { throw new Error("Failed to find public key for account"); } - return utils.PublicKey.from(account.publicKey!); + return nearAPI.utils.PublicKey.from(account.publicKey!); }, signMessage: async (message, accountId) => { const accounts = getAccounts(); @@ -127,7 +127,9 @@ const Nightly: WalletBehaviourFactory = async ({ } try { - const tx = nearTransactions.Transaction.decode(Buffer.from(message)); + const tx = nearAPI.transactions.Transaction.decode( + Buffer.from(message) + ); const signedTx = await _state.wallet.signTransaction(tx); return { diff --git a/packages/opto-wallet/src/lib/opto-wallet.ts b/packages/opto-wallet/src/lib/opto-wallet.ts index b1a3596a8..328ab7a02 100644 --- a/packages/opto-wallet/src/lib/opto-wallet.ts +++ b/packages/opto-wallet/src/lib/opto-wallet.ts @@ -1,10 +1,4 @@ -import { - WalletConnection, - connect, - keyStores, - transactions as nearTransactions, - utils, -} from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { WalletModuleFactory, WalletBehaviourFactory, @@ -30,8 +24,8 @@ export interface OptoWalletParams { } interface OptoWalletState { - wallet: WalletConnection; - keyStore: keyStores.BrowserLocalStorageKeyStore; + wallet: nearAPI.WalletConnection; + keyStore: nearAPI.keyStores.BrowserLocalStorageKeyStore; } interface OptoWalletExtraOptions { @@ -57,16 +51,16 @@ const setupWalletState = async ( params: OptoWalletExtraOptions, network: Network ): Promise => { - const keyStore = new keyStores.BrowserLocalStorageKeyStore(); + const keyStore = new nearAPI.keyStores.BrowserLocalStorageKeyStore(); - const near = await connect({ + const near = await nearAPI.connect({ keyStore, walletUrl: params.walletUrl, ...network, headers: {}, }); - const wallet = new WalletConnection(near, "near_app"); + const wallet = new nearAPI.WalletConnection(near, "near_app"); return { wallet, @@ -131,13 +125,13 @@ const OptoWallet: WalletBehaviourFactory< const block = await provider.block({ finality: "final" }); - return nearTransactions.createTransaction( + return nearAPI.transactions.createTransaction( account.accountId, - utils.PublicKey.from(accessKey.public_key), + nearAPI.utils.PublicKey.from(accessKey.public_key), transaction.receiverId, accessKey.access_key.nonce + index + 1, actions, - utils.serialize.base_decode(block.header.hash) + nearAPI.utils.serialize.base_decode(block.header.hash) ); }) ); diff --git a/packages/wallet-connect/src/lib/wallet-connect.ts b/packages/wallet-connect/src/lib/wallet-connect.ts index 98a07f40a..7544326c9 100644 --- a/packages/wallet-connect/src/lib/wallet-connect.ts +++ b/packages/wallet-connect/src/lib/wallet-connect.ts @@ -1,10 +1,5 @@ import type { KeyPair, providers } from "near-api-js"; -import { - InMemorySigner, - keyStores, - transactions as nearTransactions, - utils, -} from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { AccessKeyViewRaw } from "near-api-js/lib/providers/provider"; import type { SignClientTypes, SessionTypes } from "@walletconnect/types"; import type { @@ -58,7 +53,7 @@ interface WalletConnectAccount { interface WalletConnectState { client: WalletConnectClient; session: SessionTypes.Struct | null; - keystore: keyStores.KeyStore; + keystore: nearAPI.keyStores.KeyStore; subscriptions: Array; } @@ -80,7 +75,7 @@ const setupWalletConnectState = async ( ): Promise => { const client = new WalletConnectClient(emitter); let session: SessionTypes.Struct | null = null; - const keystore = new keyStores.BrowserLocalStorageKeyStore( + const keystore = new nearAPI.keyStores.BrowserLocalStorageKeyStore( window.localStorage, `near-wallet-selector:${id}:keystore:` ); @@ -129,7 +124,7 @@ const WalletConnect: WalletBehaviourFactory< const newAccounts = []; for (let i = 0; i < accounts.length; i++) { - const signer = new InMemorySigner(_state.keystore); + const signer = new nearAPI.InMemorySigner(_state.keystore); const publicKey = await signer.getPublicKey( accounts[i].split(":")[2], options.network.networkId @@ -181,8 +176,9 @@ const WalletConnect: WalletBehaviourFactory< }; const signTransactions = async (transactions: Array) => { - const signer = new InMemorySigner(_state.keystore); - const signedTransactions: Array = []; + const signer = new nearAPI.InMemorySigner(_state.keystore); + const signedTransactions: Array = + []; const block = await provider.block({ finality: "final" }); @@ -208,16 +204,16 @@ const WalletConnect: WalletBehaviourFactory< throw new Error("Invalid access key"); } - const tx = nearTransactions.createTransaction( + const tx = nearAPI.transactions.createTransaction( transactions[i].signerId, - utils.PublicKey.from(publicKey.toString()), + nearAPI.utils.PublicKey.from(publicKey.toString()), transactions[i].receiverId, accessKey.nonce + i + 1, transaction.actions.map((action) => createAction(action)), - utils.serialize.base_decode(block.header.hash) + nearAPI.utils.serialize.base_decode(block.header.hash) ); - const [, signedTx] = await nearTransactions.signTransaction( + const [, signedTx] = await nearAPI.transactions.signTransaction( tx, signer, transactions[i].signerId, @@ -270,13 +266,13 @@ const WalletConnect: WalletBehaviourFactory< }), ]); - const tx = nearTransactions.createTransaction( + const tx = nearAPI.transactions.createTransaction( transaction.signerId, - utils.PublicKey.from(account.publicKey), + nearAPI.utils.PublicKey.from(account.publicKey), transaction.receiverId, accessKey.nonce + 1, transaction.actions.map((action) => createAction(action)), - utils.serialize.base_decode(block.header.hash) + nearAPI.utils.serialize.base_decode(block.header.hash) ); const result = await _state.client.request({ @@ -288,7 +284,7 @@ const WalletConnect: WalletBehaviourFactory< }, }); - return nearTransactions.SignedTransaction.decode(Buffer.from(result)); + return nearAPI.transactions.SignedTransaction.decode(Buffer.from(result)); }; const requestSignTransactions = async (transactions: Array) => { @@ -296,7 +292,7 @@ const WalletConnect: WalletBehaviourFactory< return []; } - const txs: Array = []; + const txs: Array = []; const [block, accounts] = await Promise.all([ provider.block({ finality: "final" }), @@ -321,13 +317,13 @@ const WalletConnect: WalletBehaviourFactory< }); txs.push( - nearTransactions.createTransaction( + nearAPI.transactions.createTransaction( transaction.signerId, - utils.PublicKey.from(account.publicKey), + nearAPI.utils.PublicKey.from(account.publicKey), transaction.receiverId, accessKey.nonce + i + 1, transaction.actions.map((action) => createAction(action)), - utils.serialize.base_decode(block.header.hash) + nearAPI.utils.serialize.base_decode(block.header.hash) ) ); } @@ -342,7 +338,7 @@ const WalletConnect: WalletBehaviourFactory< }); return results.map((result) => { - return nearTransactions.SignedTransaction.decode(Buffer.from(result)); + return nearAPI.transactions.SignedTransaction.decode(Buffer.from(result)); }); }; @@ -353,12 +349,12 @@ const WalletConnect: WalletBehaviourFactory< return accounts.map(({ accountId }) => ({ accountId, - keyPair: utils.KeyPair.fromRandom("ed25519"), + keyPair: nearAPI.utils.KeyPair.fromRandom("ed25519"), })); }; const requestSignIn = async ( - permission: nearTransactions.FunctionCallPermission + permission: nearAPI.transactions.FunctionCallPermission ) => { const keyPairs = await createLimitedAccessKeyPairs(); const limitedAccessAccounts: Array = keyPairs.map( diff --git a/packages/wallet-utils/src/lib/create-action.ts b/packages/wallet-utils/src/lib/create-action.ts index 8912f3e74..d72c3b4f6 100644 --- a/packages/wallet-utils/src/lib/create-action.ts +++ b/packages/wallet-utils/src/lib/create-action.ts @@ -1,6 +1,7 @@ import { BN } from "bn.js"; -import { utils, transactions } from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { AddKeyPermission, Action } from "@near-wallet-selector/core"; +const { transactions, utils } = nearAPI; const getAccessKey = (permission: AddKeyPermission) => { if (permission === "FullAccess") { diff --git a/packages/wallet-utils/src/lib/sign-transactions.ts b/packages/wallet-utils/src/lib/sign-transactions.ts index 9e3805ce9..f52de611f 100644 --- a/packages/wallet-utils/src/lib/sign-transactions.ts +++ b/packages/wallet-utils/src/lib/sign-transactions.ts @@ -1,9 +1,5 @@ import type { Signer } from "near-api-js"; -import { - utils, - transactions as nearTransactions, - providers, -} from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { Network, Transaction } from "@near-wallet-selector/core"; import type { AccessKeyViewRaw } from "near-api-js/lib/providers/provider"; import { createAction } from "./create-action"; @@ -13,11 +9,11 @@ export const signTransactions = async ( signer: Signer, network: Network ) => { - const provider = new providers.JsonRpcProvider({ + const provider = new nearAPI.providers.JsonRpcProvider({ url: network.nodeUrl, }); - const signedTransactions: Array = []; + const signedTransactions: Array = []; for (let i = 0; i < transactions.length; i++) { const publicKey = await signer.getPublicKey( @@ -39,16 +35,16 @@ export const signTransactions = async ( createAction(action) ); - const transaction = nearTransactions.createTransaction( + const transaction = nearAPI.transactions.createTransaction( transactions[i].signerId, - utils.PublicKey.from(publicKey.toString()), + nearAPI.utils.PublicKey.from(publicKey.toString()), transactions[i].receiverId, accessKey.nonce + i + 1, actions, - utils.serialize.base_decode(block.header.hash) + nearAPI.utils.serialize.base_decode(block.header.hash) ); - const response = await nearTransactions.signTransaction( + const response = await nearAPI.transactions.signTransaction( transaction, signer, transactions[i].signerId, diff --git a/packages/welldone-wallet/src/lib/welldone.ts b/packages/welldone-wallet/src/lib/welldone.ts index 0e55a6c5f..35e514738 100644 --- a/packages/welldone-wallet/src/lib/welldone.ts +++ b/packages/welldone-wallet/src/lib/welldone.ts @@ -1,5 +1,5 @@ import type { Signer } from "near-api-js"; -import { transactions as Transactions, utils } from "near-api-js"; +import * as nearAPI from "near-api-js"; import type { WalletModuleFactory, InjectedWallet, @@ -150,7 +150,7 @@ const WelldoneWallet: WalletBehaviourFactory = async ({ throw new Error("Failed to find public key for account"); } - return utils.PublicKey.from(account.publicKey!); + return nearAPI.utils.PublicKey.from(account.publicKey!); }, signMessage: async (message, accountId) => { if (!_state.wallet) { @@ -164,7 +164,9 @@ const WelldoneWallet: WalletBehaviourFactory = async ({ throw new Error("Failed to find account for signing"); } try { - const tx = Transactions.Transaction.decode(Buffer.from(message)); + const tx = nearAPI.transactions.Transaction.decode( + Buffer.from(message) + ); const serializedTx = Buffer.from(tx.encode()).toString("hex"); const signed = await _state.wallet.request("near", { method: "dapp:signTransaction", @@ -173,7 +175,7 @@ const WelldoneWallet: WalletBehaviourFactory = async ({ return { signature: Buffer.from(signed[0].signature.substr(2), "hex"), - publicKey: utils.PublicKey.from(signed[0].publicKey), + publicKey: nearAPI.utils.PublicKey.from(signed[0].publicKey), }; } catch (err) { const decoded = new TextDecoder("utf-8").decode(message); @@ -184,7 +186,7 @@ const WelldoneWallet: WalletBehaviourFactory = async ({ return { signature: Buffer.from(signed[0].signature.substr(2), "hex"), - publicKey: utils.PublicKey.from(signed[0].publicKey), + publicKey: nearAPI.utils.PublicKey.from(signed[0].publicKey), }; } }, @@ -270,7 +272,7 @@ const WelldoneWallet: WalletBehaviourFactory = async ({ } const accountId = account.accountId; - const pubKey = utils.PublicKey.fromString(account.publicKey); + const pubKey = nearAPI.utils.PublicKey.fromString(account.publicKey); const block = await provider.block({ finality: "final" }); const data = { From f8c6cdce48fd5f8a2868870a5442f73ab806432c Mon Sep 17 00:00:00 2001 From: DamirSQA Date: Thu, 6 Apr 2023 11:44:54 +0200 Subject: [PATCH 26/28] Support languages type updated --- packages/core/src/lib/translate/translate.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/lib/translate/translate.ts b/packages/core/src/lib/translate/translate.ts index 95b244645..198894cf9 100644 --- a/packages/core/src/lib/translate/translate.ts +++ b/packages/core/src/lib/translate/translate.ts @@ -50,7 +50,11 @@ export type SupportedLanguage = | "ko" | "vi" | "hi" - | "ar"; + | "ar" + | "hr" + | "mk" + | "sl" + | "sr"; let chosenLang: string | undefined; export const allowOnlyLanguage = (langCode: SupportedLanguage | undefined) => { From aae261a4d9b9ce55b6b1e1a20cc07a78b2c7d3a7 Mon Sep 17 00:00:00 2001 From: Kujtim Prenku Date: Thu, 6 Apr 2023 12:41:27 +0200 Subject: [PATCH 27/28] Bumped version to v7.9.3 --- package.json | 2 +- packages/account-export/package.json | 2 +- packages/coin98-wallet/package.json | 2 +- packages/core/package.json | 2 +- packages/default-wallets/package.json | 2 +- packages/finer-wallet/package.json | 2 +- packages/here-wallet/package.json | 2 +- packages/ledger/package.json | 2 +- packages/math-wallet/package.json | 2 +- packages/meteor-wallet/package.json | 2 +- packages/modal-ui-js/package.json | 2 +- packages/modal-ui/package.json | 2 +- packages/my-near-wallet/package.json | 2 +- packages/narwallets/package.json | 2 +- packages/near-snap/package.json | 2 +- packages/near-wallet/package.json | 2 +- packages/nearfi/package.json | 2 +- packages/neth/package.json | 2 +- packages/nightly-connect/package.json | 2 +- packages/nightly/package.json | 2 +- packages/opto-wallet/package.json | 2 +- packages/sender/package.json | 2 +- packages/wallet-connect/package.json | 2 +- packages/wallet-utils/package.json | 2 +- packages/welldone-wallet/package.json | 2 +- packages/xdefi/package.json | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index 1908d070d..bfd4497da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "near-wallet-selector", - "version": "7.9.2", + "version": "7.9.3", "description": "NEAR Wallet Selector makes it easy for users to interact with your dApp by providing an abstraction over various wallets within the NEAR ecosystem", "keywords": [ "near", diff --git a/packages/account-export/package.json b/packages/account-export/package.json index 3cd8d5f50..547fcaeef 100644 --- a/packages/account-export/package.json +++ b/packages/account-export/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/account-export", - "version": "7.9.2", + "version": "7.9.3", "description": "This is the Export Selector UI package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/coin98-wallet/package.json b/packages/coin98-wallet/package.json index 6c363c350..9fe250df6 100644 --- a/packages/coin98-wallet/package.json +++ b/packages/coin98-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/coin98-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "Coin 98 wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/core/package.json b/packages/core/package.json index ccbd2dff0..6a9f7138e 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/core", - "version": "7.9.2", + "version": "7.9.3", "description": "This is the core package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/default-wallets/package.json b/packages/default-wallets/package.json index 0919e7215..fd6b2e8d4 100644 --- a/packages/default-wallets/package.json +++ b/packages/default-wallets/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/default-wallets", - "version": "7.9.2", + "version": "7.9.3", "description": "Default wallets package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/finer-wallet/package.json b/packages/finer-wallet/package.json index 0493e3516..02970f643 100644 --- a/packages/finer-wallet/package.json +++ b/packages/finer-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/finer-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "FiNER Wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/here-wallet/package.json b/packages/here-wallet/package.json index 69c7b7aab..6ee95469a 100644 --- a/packages/here-wallet/package.json +++ b/packages/here-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/here-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "Here wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/ledger/package.json b/packages/ledger/package.json index 4382d75bd..f63c94d94 100644 --- a/packages/ledger/package.json +++ b/packages/ledger/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/ledger", - "version": "7.9.2", + "version": "7.9.3", "description": "Ledger package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/math-wallet/package.json b/packages/math-wallet/package.json index 80cec3740..cdfceee0c 100644 --- a/packages/math-wallet/package.json +++ b/packages/math-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/math-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "Math wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/meteor-wallet/package.json b/packages/meteor-wallet/package.json index 105a74d09..6e2492d65 100644 --- a/packages/meteor-wallet/package.json +++ b/packages/meteor-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/meteor-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "Meteor wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/modal-ui-js/package.json b/packages/modal-ui-js/package.json index dfbecd1e8..436f4aacf 100644 --- a/packages/modal-ui-js/package.json +++ b/packages/modal-ui-js/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/modal-ui-js", - "version": "7.9.2", + "version": "7.9.3", "description": "Modal UI package for NEAR wallet Selector", "keywords": [ "near", diff --git a/packages/modal-ui/package.json b/packages/modal-ui/package.json index 594309d8b..f18d2f4d6 100644 --- a/packages/modal-ui/package.json +++ b/packages/modal-ui/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/modal-ui", - "version": "7.9.2", + "version": "7.9.3", "description": "Modal UI package for NEAR wallet Selector", "keywords": [ "near", diff --git a/packages/my-near-wallet/package.json b/packages/my-near-wallet/package.json index 050f2da94..74c85f366 100644 --- a/packages/my-near-wallet/package.json +++ b/packages/my-near-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/my-near-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "My Near Wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/narwallets/package.json b/packages/narwallets/package.json index 56cb741c7..57c901a44 100644 --- a/packages/narwallets/package.json +++ b/packages/narwallets/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/narwallets", - "version": "7.9.2", + "version": "7.9.3", "description": "This is the Narwallets package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/near-snap/package.json b/packages/near-snap/package.json index 5b07c2b6a..203a43bb6 100644 --- a/packages/near-snap/package.json +++ b/packages/near-snap/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/near-snap", - "version": "7.9.2", + "version": "7.9.3", "description": "Metamask snap to interact with Near dapps.", "keywords": [ "near", diff --git a/packages/near-wallet/package.json b/packages/near-wallet/package.json index 2eaee404f..d74cec904 100644 --- a/packages/near-wallet/package.json +++ b/packages/near-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/near-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "Near Wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/nearfi/package.json b/packages/nearfi/package.json index 8a480fa7d..bc82a4222 100644 --- a/packages/nearfi/package.json +++ b/packages/nearfi/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/nearfi", - "version": "7.9.2", + "version": "7.9.3", "description": "Nearfi package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/neth/package.json b/packages/neth/package.json index 425ebfc5e..a909d8c7d 100644 --- a/packages/neth/package.json +++ b/packages/neth/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/neth", - "version": "7.9.2", + "version": "7.9.3", "description": "Control NEAR accounts with ETH accounts", "author": "mattlockyer", "keywords": [ diff --git a/packages/nightly-connect/package.json b/packages/nightly-connect/package.json index c932d577d..edf6d057c 100644 --- a/packages/nightly-connect/package.json +++ b/packages/nightly-connect/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/nightly-connect", - "version": "7.9.2", + "version": "7.9.3", "description": "Nightly connect package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/nightly/package.json b/packages/nightly/package.json index 10678906b..3f09411ab 100644 --- a/packages/nightly/package.json +++ b/packages/nightly/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/nightly", - "version": "7.9.2", + "version": "7.9.3", "description": "Nightly wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/opto-wallet/package.json b/packages/opto-wallet/package.json index be7301c94..e807c0d8a 100644 --- a/packages/opto-wallet/package.json +++ b/packages/opto-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/opto-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "Opto wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/sender/package.json b/packages/sender/package.json index a5dd40b6e..53270bd71 100644 --- a/packages/sender/package.json +++ b/packages/sender/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/sender", - "version": "7.9.2", + "version": "7.9.3", "description": "Sender wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/wallet-connect/package.json b/packages/wallet-connect/package.json index 4066ef5a1..99d7af153 100644 --- a/packages/wallet-connect/package.json +++ b/packages/wallet-connect/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/wallet-connect", - "version": "7.9.2", + "version": "7.9.3", "description": "Wallet Connect package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/wallet-utils/package.json b/packages/wallet-utils/package.json index 27f847bc7..96043f6f7 100644 --- a/packages/wallet-utils/package.json +++ b/packages/wallet-utils/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/wallet-utils", - "version": "7.9.2", + "version": "7.9.3", "description": "Wallet utils package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/welldone-wallet/package.json b/packages/welldone-wallet/package.json index 2d249acd7..854d5ccae 100644 --- a/packages/welldone-wallet/package.json +++ b/packages/welldone-wallet/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/welldone-wallet", - "version": "7.9.2", + "version": "7.9.3", "description": "Welldone wallet package for NEAR Wallet Selector.", "keywords": [ "near", diff --git a/packages/xdefi/package.json b/packages/xdefi/package.json index 595e69b46..e6b8b344d 100644 --- a/packages/xdefi/package.json +++ b/packages/xdefi/package.json @@ -1,6 +1,6 @@ { "name": "@near-wallet-selector/xdefi", - "version": "7.9.2", + "version": "7.9.3", "description": "This is the XDEFI package for NEAR Wallet Selector.", "keywords": [ "near", From cfc83e6b667e19fa72a90aa50e912e7f6ec1d3e5 Mon Sep 17 00:00:00 2001 From: amirsaran3 Date: Thu, 6 Apr 2023 12:55:14 +0200 Subject: [PATCH 28/28] Fixed typo --- packages/wallet-connect/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/wallet-connect/README.md b/packages/wallet-connect/README.md index 809956046..cddd71473 100644 --- a/packages/wallet-connect/README.md +++ b/packages/wallet-connect/README.md @@ -47,7 +47,7 @@ const selector = await setupWalletSelector({ ## Wallet Connect Configuration -Project ID is required for wallet connect, please obtain it from [walletconnect.ocm](https://walletconnect.com/) +Project ID is required for wallet connect, please obtain it from [walletconnect.com](https://walletconnect.com/) ## Options