Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

v7.9.3 Release (dev -> main) #767

Merged
merged 42 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2194dfc
Added tests
amirsaran3 Mar 8, 2023
7c57063
Added tests for opto-wallet
amirsaran3 Mar 8, 2023
cac50bc
Added sender test (not working atm)
amirsaran3 Mar 9, 2023
79e06d6
removed console.logs
amirsaran3 Mar 10, 2023
b700fd1
Attempt fixing sender tests.
kujtimprenkuSQA Mar 13, 2023
ceaad84
Merge pull request #733 from near/test-coverage-fix-sender-tests
amirsaran3 Mar 21, 2023
a3fdf7e
Fixed sender test
amirsaran3 Mar 22, 2023
38ad391
Fixed sender tests and added coin98 tests
amirsaran3 Mar 22, 2023
33130de
Added finer-wallet tests
amirsaran3 Mar 22, 2023
7d63888
Added math-wallet tests, fixed some other tests
amirsaran3 Mar 22, 2023
5cd8560
Added meteor-wallet tests (not working atm)
amirsaran3 Mar 22, 2023
af9b7d3
Added narwallets test
amirsaran3 Mar 22, 2023
cd65b6e
Bumped walletconnect dependencies to v2.5.2
kujtimprenkuSQA Mar 29, 2023
da6be79
Installed @web3modal/standalone
kujtimprenkuSQA Mar 29, 2023
06be59c
Replaced walletconnect/qr-modal with web3moda/standalone modal.
kujtimprenkuSQA Mar 30, 2023
466bf62
Reduce z-index for modal to allow walletconnect modal to show up.
kujtimprenkuSQA Mar 30, 2023
d81285e
Removed @walletconnect/qrcode-modal dependency.
kujtimprenkuSQA Mar 30, 2023
c0158f4
Added welldone tests
amirsaran3 Mar 30, 2023
c825bf0
small change
amirsaran3 Mar 30, 2023
1261a8c
skip welldone wallet tests
amirsaran3 Mar 30, 2023
ed9ae54
Populate selectedAccounts when there is only account.
kujtimprenkuSQA Mar 31, 2023
f2a001d
Merge pull request #747 from near/SQC-496/fix-modal-ui-for-ledger
kujtimprenkuSQA Mar 31, 2023
9863b4b
Bump @jscutlery/semver from 2.29.3 to 2.30.1
dependabot[bot] Apr 1, 2023
9fabb36
Bump ngx-deploy-npm from 4.3.1 to 4.3.10
dependabot[bot] Apr 1, 2023
647b45b
Merge pull request #746 from kujtimprenkuSQA/upgrade-wallet-connect-deps
kujtimprenkuSQA Apr 3, 2023
6a3d880
Bump better-sqlite3 from 8.1.0 to 8.2.0
dependabot[bot] Apr 3, 2023
ce8517e
Merge branch 'main' into align-main-and-dev-branch
kujtimprenkuSQA Apr 5, 2023
db18ccc
Merge pull request #758 from near/align-main-and-dev-branch
kujtimprenkuSQA Apr 5, 2023
1be13c8
Suported languages list update
DamirSQA Apr 5, 2023
fcc46bc
Fix imports from near-api-js.
kujtimprenkuSQA Apr 6, 2023
2192a25
Merge pull request #726 from near/test-coverage
amirsaran3 Apr 6, 2023
f4564b1
Merge branch 'dev' into SQC-504/fix-default-and-named-imports-form-naj
kujtimprenkuSQA Apr 6, 2023
c2650fb
Merge pull request #749 from near/dependabot/npm_and_yarn/dev/better-…
amirsaran3 Apr 6, 2023
ac2fc2a
Merge pull request #750 from near/dependabot/npm_and_yarn/dev/jscutle…
amirsaran3 Apr 6, 2023
7578f2f
Merge pull request #765 from near/SQC-504/fix-default-and-named-impor…
kujtimprenkuSQA Apr 6, 2023
f8c6cdc
Support languages type updated
DamirSQA Apr 6, 2023
9a59ca2
Merge pull request #753 from near/dependabot/npm_and_yarn/dev/ngx-dep…
amirsaran3 Apr 6, 2023
d317f33
Merge pull request #763 from near/lang-support-docs-update
kujtimprenkuSQA Apr 6, 2023
aae261a
Bumped version to v7.9.3
kujtimprenkuSQA Apr 6, 2023
562ef58
Merge branch 'main' into version-bump
kujtimprenkuSQA Apr 6, 2023
cfc83e6
Fixed typo
amirsaran3 Apr 6, 2023
28774c2
Merge pull request #766 from near/version-bump
kujtimprenkuSQA Apr 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -84,15 +84,15 @@
"@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",
"@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",
"better-sqlite3": "^8.1.0",
"@walletconnect/sign-client": "2.5.2",
"@web3modal/standalone": "^2.2.2",
"better-sqlite3": "^8.2.0",
"big.js": "^6.1.1",
"bn.js": "^5.2.0",
"bs58": "^5.0.0",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/account-export/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 7 additions & 5 deletions packages/account-export/src/lib/components/ExportAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -78,7 +78,7 @@ const permissionToType = (
};

interface getAccountTypeProps {
provider: providers.Provider;
provider: nearAPI.providers.Provider;
accountId: string;
publicKey: string;
}
Expand All @@ -103,7 +103,7 @@ const getAccountType = async ({
};

interface getAccountBalanceProps {
provider: providers.Provider;
provider: nearAPI.providers.Provider;
accountId: string;
}

Expand Down Expand Up @@ -183,15 +183,17 @@ export const ExportAccount: React.FC<ExportAccountProps> = ({
}, [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(() => {
const initialize = async () => {
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,
Expand Down
2 changes: 1 addition & 1 deletion packages/coin98-wallet/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
132 changes: 132 additions & 0 deletions packages/coin98-wallet/src/lib/coin98-wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
/* 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: "",
signer: mock<Signer>({
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(async () => {
window.coin98.near.account = accountId;
return "";
}),
disconnect: jest.fn(),
},
};

return window.coin98;
};

const createCoin98Wallet = async (deps: MockWalletDependencies = {}) => {
const injectedCoin98Wallet = mockCoin98WalletOnWindow();
const { wallet } = await mockWallet<InjectedWallet>(
setupCoin98Wallet(),
deps
);

return {
wallet,
injectedCoin98Wallet,
};
};

afterEach(() => {
jest.resetModules();
});

describe("signIn", () => {
it("sign into coin98 wallet", async () => {
const { wallet, injectedCoin98Wallet } = await createCoin98Wallet();

await wallet.signIn({ contractId: "test.testnet" });

expect(injectedCoin98Wallet.near.connect).toHaveBeenCalled();
});
});

describe("signOut", () => {
it("sign out of coin98 wallet", async () => {
const { wallet, injectedCoin98Wallet } = await createCoin98Wallet();

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 createCoin98Wallet();

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 createCoin98Wallet();

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 createCoin98Wallet();

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);
});
});
14 changes: 7 additions & 7 deletions packages/coin98-wallet/src/lib/coin98-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ const Coin98Wallet: WalletBehaviourFactory<InjectedWallet> = 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,
},
];
};
Expand Down
5 changes: 3 additions & 2 deletions packages/coin98-wallet/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true
}
}
}
14 changes: 9 additions & 5 deletions packages/core/docs/guides/multilanguage-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -24,7 +24,9 @@ const defaults = {
const setup = (url: string) => {
const provider = mock<JsonRpcProvider>();

jest.spyOn(providers, "JsonRpcProvider").mockImplementation(() => provider);
jest
.spyOn(nearAPI.providers, "JsonRpcProvider")
.mockImplementation(() => provider);

return {
provider,
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/lib/services/provider/provider.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { providers } from "near-api-js";
import * as nearAPI from "near-api-js";
import type {
AccessKeyView,
BlockReference,
Expand All @@ -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<Response extends QueryResponseKind>(params: QueryParams) {
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/lib/translate/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/default-wallets/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/finer-wallet/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading