Skip to content

Commit

Permalink
Merge pull request #960 from near/dev
Browse files Browse the repository at this point in the history
v8.5.4 Release (dev -> main)
  • Loading branch information
erditkurteshiSQA authored Oct 11, 2023
2 parents 9b54af0 + d0000d2 commit 6e8f945
Show file tree
Hide file tree
Showing 58 changed files with 255 additions and 107 deletions.
4 changes: 4 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ categories:
- 'perf'
- 'test'
- 'build'

exclude-labels:
- 'skip-changelog'

template: |
## Changelog
$CHANGES
21 changes: 21 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Near Wallet Selector Examples

This folder contains two example projects that demonstrate how to integrate Near Wallet Selector to React and Angular applications.

## Structure

- **`angular/`**: Angular Example
- An Angular example project demonstrating the integration of the Near Wallet Selector.

- **`react/`**: React Example
- A React example project demonstrating the integration of the Near Wallet Selector.

## Getting Started

Follow the individual README files in each project directory (`react/` or `angular/`) to get started with these examples:

- [Angular Example README](./angular/README.md)
- [React Example README](./react/README.md)


Feel free to explore these examples to understand how to integrate Near Wallet Selector to your React and Angular projects. If you have any questions or need help, please refer to the README files in each project folder or reach out for help.
34 changes: 34 additions & 0 deletions examples/angular/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Near Wallet Selector Angular Example

This Angular example shows how to integrate Near Wallet Selector into your Angular application for easy Near wallet integration.
# Usage

Start the development server:
```bash
yarn nx serve angular
```

Open your web browser and navigate to http://localhost:4200/wallet-selector to see the Angular example in action.

You should be able to interact with the Near Wallet Selector within the example application.

## Folder Structure

The folder structure of this Angular project is organized to maintain a clean codebase. Below is an overview of the major directories and their purposes:

- **`src/`**: This is the root directory for your Angular application.
- **`app/`**: Contains the core application components and modules.
- **`components/`**: Custom Angular components used in the application like `content`, `form`, `loading`, `messages` and `sign-in`.
- **`pages/`**: Wallet Selector and Wallet-selector export has been integrated into this folder.
- **`wallet-selector/`**: Wallet Selector integration.
- **`wallet-selector-export/`**: Wallet Selector Export integration.
- **`environments/`**: Environment configuration files.

- **`.eslintrc.json`**: ESLint configuration for code linting.
- **`jest.config.ts`**: Configuration file for Jest.
- **`project.json`**: Project configuration file.
- **`README.md`**: The file you are currently reading, providing project documentation.
- **`tsconfig.app.json`**: TypeScript configuration to Angular application.
- **`tsconfig.editor.json`**: TypeScript configuration for code editor.
- **`tsconfig.json`**: The root TypeScript configuration file.

30 changes: 30 additions & 0 deletions examples/react/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Near Wallet Selector React Example

This React example shows how to integrate Near Wallet Selector into your React application for easy Near wallet integration.

# Usage

Start the development server:
```bash
yarn nx serve react
```

Open your web browser and navigate to http://localhost:4200/ to see the React example in action.

You should be able to interact with the Near Wallet Selector within the example application.

## Folder Structure

The folder structure of this React project is organized to maintain a clean codebase. Below is an overview of the major directories and their purposes:

- **`components/`**: Contains custom React components used in the application like `Content`, `ExportContent`, `Form`, `Loading`, `Messages`, `SignIn`.
- **`contexts/`**: Wallet Selector and Wallet-selector export has been integrated into this folder.
- **`WalletSelectorContext/`**: Wallet Selector integration.
- **`WalletSelectorExportContext/`**: Wallet Selector Export integration.
- **`pages/`**: Main app pages.

- **`.eslintrc.json`**: ESLint configuration for code linting.
- **`.babelrc`**: Babel configuration file for transpiling JavaScript/TypeScript code.
- **`project.json`**: Project configuration file.
- **`README.md`**: The file you are currently reading, providing project documentation.
- **`tsconfig.json`**: The root TypeScript configuration file.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.5.3",
"version": "8.5.4",
"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 @@ -96,7 +96,7 @@
"@ramper/near": "^0.0.30",
"@walletconnect/modal": "^2.6.0",
"@walletconnect/sign-client": "2.9.1",
"better-sqlite3": "^8.5.2",
"better-sqlite3": "^8.7.0",
"big.js": "^6.1.1",
"bn.js": "^5.2.0",
"borsh": "^0.7.0",
Expand Down Expand Up @@ -163,7 +163,7 @@
"@testing-library/react-hooks": "^7.0.2",
"@types/big.js": "^6.2.0",
"@types/bn.js": "^5.1.1",
"@types/gh-pages": "^3.2.1",
"@types/gh-pages": "^3.2.2",
"@types/jest": "29.4.4",
"@types/node": "18.11.9",
"@types/qrcode": "^1.5.1",
Expand Down
13 changes: 7 additions & 6 deletions packages/account-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ modal.show();
- `accounts` (`Array`): List of objects with an account id and its private key to be exported.
- `theme` (`Theme?`): Specify light/dark theme for UI. Defaults to the browser configuration when omitted or set to 'auto'. This can be either `light`, `dark` or `auto`.
- `description` (`string?`): Define a custom description in the UI.
- `onComplete` (`(accounts: Array<string>) => void`): Triggers when the user completes the flow. By default it is not set.
- `onComplete` (`({ accounts: Array<string>, walletName: string }) => void`): Triggers when the user completes the flow. By default it is not set.

### Supported Wallets
- [Nightly Wallet](https://github.com/near/wallet-selector/blob/main/packages/nightly/src/lib/nightly.ts#L224)
- [Meteor Wallet](https://github.com/near/wallet-selector/blob/main/packages/meteor-wallet/src/lib/meteor-wallet.ts#L204)
- [Welldone Wallet](https://github.com/near/wallet-selector/blob/main/packages/welldone-wallet/src/lib/welldone.ts#L335)
- [Here Wallet](https://github.com/near/wallet-selector/blob/main/packages/here-wallet/src/lib/selector.ts#LL42)
- [My Near Wallet](https://github.com/near/wallet-selector/blob/main/packages/my-near-wallet/src/lib/my-near-wallet.ts#L227)
- [Nightly Wallet](https://github.com/near/wallet-selector/blob/main/packages/nightly/src/lib/nightly.ts)
- [Meteor Wallet](https://github.com/near/wallet-selector/blob/main/packages/meteor-wallet/src/lib/meteor-wallet.ts)
- [Welldone Wallet](https://github.com/near/wallet-selector/blob/main/packages/welldone-wallet/src/lib/welldone.ts)
- [Here Wallet](https://github.com/near/wallet-selector/blob/main/packages/here-wallet/src/lib/selector.ts)
- [My Near Wallet](https://github.com/near/wallet-selector/blob/main/packages/my-near-wallet/src/lib/my-near-wallet.ts)
- [Sender Wallet](https://github.com/near/wallet-selector/blob/main/packages/sender/src/lib/sender.ts)

## Styles & Customizing CSS

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": "8.5.3",
"version": "8.5.4",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/coin98-wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ npm install @near-wallet-selector/coin98-wallet
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";

// Coin98 Wallet for Wallet Selector can be setup without any params or it can take one optional param.
// Coin98 Wallet for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const coin98Wallet = setupCoin98Wallet({
iconUrl: "https://<Your Icon URL here>"
iconUrl: "https://<Wallet Icon URL Here>" // optional
});


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": "8.5.3",
"version": "8.5.4",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
8 changes: 4 additions & 4 deletions packages/core/docs/guides/multilanguage-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

## How to use

- Language files are located in locale folder in `packages\core\src\lib\locale`
- Language files are located in locale folder [here](https://github.com/near/wallet-selector/tree/main/packages/core/src/lib/locale)
- In order for text to be translated `translate` function should be used
as in example below
- Can be extended when needed following `packageName.section.translationKey`structure
Expand Down Expand Up @@ -55,7 +55,7 @@

## Adding new language

- Language files are located in locale folder in `packages\core\src\lib\locale`
- Language files are located in locale folder [here](https://github.com/near/wallet-selector/tree/main/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 :

Expand All @@ -69,7 +69,7 @@
}
```

- When new language is introduced it must be added to `packages\core\src\lib\translate\translate.ts`
- When new language is introduced it must be added to [translate.ts](https://github.com/near/wallet-selector/tree/main/packages/core/src/lib/translate/translate.ts) file.

```ts
import en from "../locale/en.json";
Expand All @@ -92,7 +92,7 @@
```

- Supported language should be added to **Supported
Languages** [list](https://github.com/near/wallet-selector/blob/dev/packages/core/docs/guides/multilanguage-support.md#supported-languages) and type list
Languages** [list](#supported-languages) and type list
.

- Pull request title should be named as **"Add support for `LanguageName` language"**.
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": "8.5.3",
"version": "8.5.4",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export {
isCurrentBrowserSupported,
verifyFullKeyBelongsToUser,
verifySignature,
serializeNep413,
} from "./lib/helpers";

export { translate, allowOnlyLanguage } from "./lib/translate/translate";
1 change: 1 addition & 0 deletions packages/core/src/lib/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from "./waitFor";
export * from "./getActiveAccount";
export * from "./detect-browser";
export * from "./verify-signature/verify-signature";
export * from "./verify-signature/payload";
8 changes: 8 additions & 0 deletions packages/core/src/lib/helpers/verify-signature/payload.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SignMessageParams } from "../../wallet";
import { serialize } from "borsh";

export class Payload {
tag: number;
Expand Down Expand Up @@ -41,3 +42,10 @@ export const payloadSchema = new Map([
},
],
]);

export const serializeNep413 = (
signMessageParams: SignMessageParams
): Buffer => {
const payload = new Payload({ ...signMessageParams });
return Buffer.from(serialize(payloadSchema, payload));
};
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": "8.5.3",
"version": "8.5.4",
"description": "Default wallets package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/finer-wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ Then use it in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupFinerWallet } from "@near-wallet-selector/finer-wallet";

// FiNER Wallet for Wallet Selector can be setup without any params or it can take two optional params.
// FiNER Wallet for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const nearWallet = setupFinerWallet({
walletUrl: "finer://wallet.testnet.near.org",
iconUrl: "https://yourdomain.com/yourwallet-icon.png"
iconUrl: "https://<Wallet Icon URL Here>" // optional
});

const selector = await setupWalletSelector({
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": "8.5.3",
"version": "8.5.4",
"description": "FiNER Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
7 changes: 6 additions & 1 deletion packages/here-wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ Then use it in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";

// HERE Wallet for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const hereWallet = setupHereWallet({
iconUrl: "https://<Wallet Icon URL Here>" // optional
});

const selector = await setupWalletSelector({
network: "testnet",
modules: [setupHereWallet()],
modules: [hereWallet],
});
```

Expand Down
2 changes: 1 addition & 1 deletion packages/here-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/here-wallet",
"version": "8.5.3",
"version": "8.5.4",
"description": "Here wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/ledger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Then use it in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupLedger } from "@near-wallet-selector/ledger";

// Ledger for Wallet Selector can be setup without any params or it can take one optional param.
// Ledger for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const ledger = setupLedger({
iconUrl: "https://yourdomain.com/yourwallet-icon.png"
iconUrl: "https://<Wallet Icon URL Here>" // optional
});

const selector = await setupWalletSelector({
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/ledger",
"version": "8.5.3",
"version": "8.5.4",
"description": "Ledger package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/math-wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Then use it in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";

// Math Wallet for Wallet Selector can be setup without any params or it can take one optional param.
// Math Wallet for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const mathWallet = setupMathWallet({
iconUrl: "https://yourdomain.com/yourwallet-icon.png"
iconUrl: "https://<Wallet Icon URL Here>" // optional
});

const selector = await setupWalletSelector({
Expand Down
2 changes: 1 addition & 1 deletion packages/math-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/math-wallet",
"version": "8.5.3",
"version": "8.5.4",
"description": "Math wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/meteor-wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ Then use it in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";

// Meteor for Wallet Selector can be setup without any params or it can take one optional param.
// Meteor for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const meteorWallet = setupMeteorWallet({
iconUrl: "https://yourdomain.com/yourwallet-icon.png" //optional
iconUrl: "https://<Wallet Icon URL Here>" // optional
});

const selector = await setupWalletSelector({
Expand Down
2 changes: 1 addition & 1 deletion packages/meteor-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/meteor-wallet",
"version": "8.5.3",
"version": "8.5.4",
"description": "Meteor wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/modal-ui-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/modal-ui-js",
"version": "8.5.3",
"version": "8.5.4",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/modal-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/modal-ui",
"version": "8.5.3",
"version": "8.5.4",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/my-near-wallet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ Then use it in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";

// My NEAR Wallet for Wallet Selector can be setup without any params or it can take two optional params.
// My NEAR Wallet for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const myNearWallet = setupMyNearWallet({
walletUrl: "https://testnet.mynearwallet.com",
iconUrl: "https://yourdomain.com/yourwallet-icon.png"
iconUrl: "https://<Wallet Icon URL Here>" // optional
});

const selector = await setupWalletSelector({
Expand Down
2 changes: 1 addition & 1 deletion packages/my-near-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/my-near-wallet",
"version": "8.5.3",
"version": "8.5.4",
"description": "My Near Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
Loading

0 comments on commit 6e8f945

Please sign in to comment.