Skip to content

Commit

Permalink
Merge pull request #616 from near/dev
Browse files Browse the repository at this point in the history
v7.4.0 Release (dev -> main)
  • Loading branch information
DamirSQA authored Dec 23, 2022
2 parents 4425f86 + 8bcee47 commit 06cc982
Show file tree
Hide file tree
Showing 55 changed files with 879 additions and 782 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi

[React](https://reactjs.org/) / [Next.js](https://nextjs.org/) and [Angular](https://angular.io/) variations of the [Guest Book](https://github.com/near-examples/guest-book/) dApp can be found in the [`examples`](/examples) directory. You can use these to gain a concrete understanding of how to integrate NEAR Wallet Selector into your own dApp.

![Preview](./images/preview-img.gif)
![Preview](./images/preview.gif)

## Installation and Usage

The easiest way to use NEAR Wallet Selector is to install the [`core`](https://www.npmjs.com/package/@near-wallet-selector/core) package from the NPM registry, some packages may require `near-api-js` v0.44.2 or above check them at [`packages`](./packages)

```bash
# Using Yarn
yarn add near-api-js@^0.44.2
yarn add near-api-js

# Using NPM.
npm install near-api-js@^0.44.2
npm install near-api-js
```

```bash
Expand Down
Binary file removed images/preview-img.gif
Binary file not shown.
Binary file added images/preview.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "7.3.0",
"version": "7.4.0",
"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 @@ -76,20 +76,21 @@
"@angular/platform-browser": "~14.0.0",
"@angular/platform-browser-dynamic": "~14.0.0",
"@angular/router": "~14.0.0",
"@here-wallet/core": "^1.1.0",
"@jscutlery/semver": "^2.27.2",
"@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.14",
"@walletconnect/qrcode-modal": "2.0.0-alpha.20",
"@walletconnect/sign-client": "2.1.1",
"better-sqlite3": "^7.6.2",
"@walletconnect/sign-client": "2.1.4",
"better-sqlite3": "^8.0.0",
"big.js": "^6.1.1",
"bn.js": "^5.2.0",
"bs58": "^5.0.0",
"buffer": "^6.0.3",
"copy-to-clipboard": "^3.3.2",
"copy-to-clipboard": "^3.3.3",
"core-js": "^3.6.5",
"crypto-browserify": "^3.12.0",
"ethers": "^5.7.2",
Expand All @@ -102,7 +103,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-qr-code": "^2.0.8",
"regenerator-runtime": "0.13.10",
"regenerator-runtime": "0.13.11",
"rxjs": "^7.5.7",
"stream-browserify": "^3.0.0",
"tslib": "^2.3.0",
Expand Down Expand Up @@ -151,7 +152,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.1",
"@walletconnect/types": "^2.1.4",
"babel-jest": "27.2.3",
"cypress": "^9.1.0",
"eslint": "~8.15.0",
Expand All @@ -174,8 +175,8 @@
"semantic-release": "^19.0.2",
"ts-jest": "27.1.4",
"ts-node": "~10.8.0",
"ts-prune": "^0.10.3",
"typescript": "~4.7.2",
"uuid": "^9.0.0",
"ts-prune": "^0.10.3"
"uuid": "^9.0.0"
}
}
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.3.0",
"version": "7.4.0",
"peerDependencies": {
"near-api-js": "^0.44.2 || ^1.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/docs/api/selector.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ subscription.remove();

**Parameters**

- `event` (`string`): Name of the event. This can be: `networkChanged | uriChanged`.
- `event` (`string`): Name of the event. This can be: `signedIn | signedOut | accountsChanged | networkChanged | uriChanged`.
- `callback` (`Function`): Original handler passed to `.on(event, callback)`.

**Returns**
Expand Down
17 changes: 17 additions & 0 deletions packages/core/docs/api/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,20 @@ Returns the ID of the selected wallet.
const { selectedWalletId } = selector.store.getState();
console.log(selectedWalletId); // "near-wallet"
```

### `.recentlySignedInWallets`

**Returns**

- `Array<string>`: List of wallet ID-s

**Description**

Returns ID-s of 5 recently signed in wallets.

**Example**

```ts
const { recentlySignedInWallets } = selector.store.getState();
console.log(recentlySignedInWallets); // ["near-wallet", "sender", ...]
```
4 changes: 3 additions & 1 deletion packages/core/docs/guides/custom-wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {

export interface MyWalletParams {
iconUrl?: string;
deprecated?: boolean;
}

const MyWallet: WalletBehaviourFactory<BrowserWallet> = ({
Expand Down Expand Up @@ -62,6 +63,7 @@ const MyWallet: WalletBehaviourFactory<BrowserWallet> = ({

export function setupMyWallet({
iconUrl = "./assets/my-wallet-icon.png",
deprecated = false,
}: MyWalletParams = {}): WalletModuleFactory<BrowserWallet> {
return async () => {
// Return null here when wallet is unavailable.
Expand All @@ -73,7 +75,7 @@ export function setupMyWallet({
name: "My Wallet",
description: null,
iconUrl,
deprecated: false,
deprecated,
available: true,
},
init: MyWallet,
Expand Down
66 changes: 38 additions & 28 deletions packages/core/docs/guides/multilanguage-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
- Languages are detected from browser language settings.
- If user preffered language is not supported, english is rendered as default.

## Supported language
## Supported languages
- Spanish
- Chinese
- Bulgarian
- Vietnamese
- Korean


## How to use

Expand All @@ -13,7 +18,7 @@
as in example below
- Can be extended when needed following `packageName.section.translationKey`structure

```ts
```json
{
"modal": {
"wallet": {
Expand All @@ -31,45 +36,50 @@

// Text that will be translated
translate("modal.wallet.connectYourWallet")
```
> Note: Should be used accordingly, example:
```typescript jsx
// In modal-ui
<p>{translate("modal.wallet.whatIsAWallet")}</p>

> Note:should be wrapped accordingly ex.
// In modal-ui-js
<p>${translate("modal.wallet.whatIsAWallet")}</p>
```


## Adding new language
- Language files are located in locale folder in `packages\core\src\lib\locale`
- Files are named after ISO 639-1: two-letter language code
- Keys are named in camelCase as the beginning of the string always in English, with the following pattern used :

```ts
"packageName" : {
```json
{
"packageName": {
"section": {
"translationKey : "text to be rendered"
"translationKey": "text to be rendered"
}
}
}
```

- When new language is introduced it must be added to `packages\core\src\lib\translate\translate.ts`

```ts
import en from "../locale/en.json";
import es from "../locale/es.json";
import fr from "../locale/fr.json";
import de from "../locale/de.json";
const getLanguage = (languageCode: string) => {
switch (languageCode) {
case "en":
return en;
case "es":
return es;
case "fr":
return fr;
case "de":
return de;
default:
return en;
}
};
```
```ts
import en from "../locale/en.json";
import es from "../locale/es.json";

const getLanguage = (languageCode: string) => {
switch (languageCode) {
case "en":
return en;
case "es":
return es;
case "fr":
return fr;
case "de":
return de;
default:
return en;
}
};
```
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.3.0",
"version": "7.4.0",
"peerDependencies": {
"near-api-js": "^0.44.2 || ^1.0.0"
}
Expand Down
59 changes: 59 additions & 0 deletions packages/core/src/lib/locale/bg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"modal": {
"wallet": {
"connectYourWallet": "Свържете вашия Портфейл",
"whatIsAWallet": "Какво е Портфейл?",
"secureAndManage": "Защитете и управлявайте дигиталните си активи",
"safelyStore": "Съхранявайте и прехвърляйте безопасно вашите крипто и NFT.",
"logInToAny": "Използвайте всяко приложение на NEAR",
"noNeedToCreate": "Няма нужда да създавате нови профили. Свържете портфейла си и сте готови!",
"getAWallet": "Създайте Портфейл",
"useAWallet": "Използвайте портфейла, за да защитите и управлявате активите си на NEAR както и да използвате всяко приложение на NEAR без нужда от потребителски имена и пароли.",
"connectionFailed": "Свързването неуспешно",
"connectionSuccessful": "Свързването успешно",
"connected": "Свързан",
"connectingTo": "Свързване към",
"connectingMessage": {
"injected": "Потвърдете свързването в прозореца на разширението",
"browser": "Потвърдете свързването в портфейла след пренасочването",
"hardware": "Потвърдете свързването в хардуерния портфейл",
"bridge": "Потвърдете връзката в портфейла"
}
},
"ledger": {
"connectWithLedger": "Свържете се с Ledger",
"makeSureYourLedger": "Уверете се, че вашият Ledger е свързан и че приложението NEAR е отворено нa него.",
"continue": "Продължете",
"specifyHDPath": "Посочете HD път",
"enterYourPreferredHDPath": "Въведете предпочитания HD път, след което сканирайте за активни акаунти.",
"scan": "Сканирайте",
"retry": "Опитайте отново",
"ledgerIsNotAvailable": "Ledger устройството не е достъпно",
"accessDeniedToUseLedgerDevice": "Достъпът за използване на Ledger е отказан",
"noAccountsFound": "Няма намерени профили",
"selectYourAccounts": "Изберете вашите профили",
"connecting1Account": "Свързване на 1 профил",
"cantFindAnyAccount": "Няма намерени профили, съврзани с този Ledger. Моля, създайте нов NEAR профил на",
"orConnectAnAnotherLedger": "или свържете друг Ledger.",
"connecting": "Свързване",
"ofAccounts": "от профили",
"failedToAutomatically": "Автоматичното намиране на профила не бе успешно. Въведете го ръчно:",
"overviewTheListOfAuthorized": "Прегледайте списъка с упълномощени профили, завършете влизането, като щракнете върху бутона по-долу..",
"finish": "Завършете"
},
"install": {
"youllNeedToInstall": "Ще трябва да инсталирате",
"toContinueAfterInstalling": "за да продължите. След инсталиране",
"refreshThePage": "презаредете страницата.",
"open": "Отворете"
},
"qr": {
"copiedToClipboard": "Копирано в клипборда",
"failedToCopy": "Неуспешно копиране в клипборда",
"scanWithYourMobile": " Сканирайте с мобилното си устройство",
"copyToClipboard": " Копирайте в клипборда",
"preferTheOfficial": "Предпочитан език за кореспонденция",
"open": "Отворете"
}
}
}
58 changes: 0 additions & 58 deletions packages/core/src/lib/locale/de.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/core/src/lib/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"connectingMessage": {
"injected": "Confirm the connection in the extension window",
"browser": "Confirm the connection in the wallet after redirect",
"hardware": "Confirm the connection in the ledger device"
"hardware": "Confirm the connection in the ledger device",
"bridge": "Confirm the connection in the wallet"
}
},
"ledger": {
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/lib/locale/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"connectingMessage": {
"injected": "Confirme la conexión en la ventana de extensión",
"browser": "Confirme la conexión en la billetera después de la redirección",
"hardware": "Confirme la conexión en el dispositivo de libro mayor"
"hardware": "Confirme la conexión en el dispositivo de libro mayor",
"bridge": "Confirmar la conexión en la billetera"
}
},
"ledger": {
Expand Down
Loading

0 comments on commit 06cc982

Please sign in to comment.