Skip to content

Commit

Permalink
Merge pull request #976 from near/dev
Browse files Browse the repository at this point in the history
v8.7.0 Release (dev -> main)
  • Loading branch information
kujtimprenkuSQA authored Oct 20, 2023
2 parents 11aa921 + 941aeb0 commit 2436df8
Show file tree
Hide file tree
Showing 53 changed files with 1,878 additions and 100 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [NearFi Wallet](https://www.npmjs.com/package/@near-wallet-selector/nearfi) - Mobile wallet.
- [Opto Wallet](https://www.npmjs.com/package/@near-wallet-selector/opto-wallet) - Mobile wallet & Browser wallet.
- [Ramper Wallet](https://www.npmjs.com/package/@near-wallet-selector/ramper-wallet) - Browser wallet.
- [Near Mobile Wallet](https://nearmobile.app/) - Mobile Wallet.

## Preview

Expand Down Expand Up @@ -71,7 +72,8 @@ yarn add \
@near-wallet-selector/opto-wallet \
@near-wallet-selector/neth \
@near-wallet-selector/xdefi \
@near-wallet-selector/ramper-wallet
@near-wallet-selector/ramper-wallet \
@near-wallet-selector/near-mobile-wallet

# Using NPM.
npm install \
Expand All @@ -93,7 +95,8 @@ npm install \
@near-wallet-selector/opto-wallet \
@near-wallet-selector/neth \
@near-wallet-selector/xdefi \
@near-wallet-selector/ramper-wallet
@near-wallet-selector/ramper-wallet \
@near-wallet-selector/near-mobile-wallet
```

Optionally, you can install our [`modal-ui`](https://www.npmjs.com/package/@near-wallet-selector/modal-ui) or [`modal-ui-js`](https://www.npmjs.com/package/@near-wallet-selector/modal-ui-js) package for a pre-built interface that wraps the `core` API and presents the supported wallets:
Expand Down Expand Up @@ -131,6 +134,7 @@ import { setupOptoWallet } from "@near-wallet-selector/opto-wallet";
import { setupNeth } from "@near-wallet-selector/neth";
import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";

const selector = await setupWalletSelector({
network: "testnet",
Expand Down Expand Up @@ -169,6 +173,7 @@ const selector = await setupWalletSelector({
icon: "https://near.org/wp-content/uploads/2020/09/cropped-favicon-192x192.png",
},
}),
setupNearMobileWallet(),
],
});

Expand Down
5 changes: 5 additions & 0 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@
"glob": "**/*",
"input": "packages/ramper-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/near-mobile-wallet/assets/",
"output": "assets/"
}
],
"styles": ["examples/angular/src/styles.scss"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Component } from "@angular/core";
import { setupExportSelectorModal } from "@near-wallet-selector/account-export";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";

declare global {
Expand Down Expand Up @@ -91,6 +92,7 @@ export class WalletSelectorExportComponent implements OnInit {
},
}),
setupRamperWallet(),
setupNearMobileWallet(),
],
});
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { Component } from "@angular/core";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { CONTRACT_ID } from "../../../constants";

declare global {
Expand Down Expand Up @@ -94,6 +95,7 @@ export class WalletSelectorComponent implements OnInit {
},
}),
setupRamperWallet(),
setupNearMobileWallet(),
],
});

Expand Down
3 changes: 3 additions & 0 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";

import type { ReactNode } from "react";
import React, {
useCallback,
Expand Down Expand Up @@ -104,6 +106,7 @@ export const WalletSelectorContextProvider: React.FC<{
icon: "https://near.org/wp-content/uploads/2020/09/cropped-favicon-192x192.png",
},
}),
setupNearMobileWallet(),
],
});
const _modal = setupModal(_selector, {
Expand Down
2 changes: 2 additions & 0 deletions examples/react/contexts/WalletSelectorExportContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { Loading } from "../components/Loading";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";

declare global {
interface Window {
Expand Down Expand Up @@ -89,6 +90,7 @@ export const ExportAccountSelectorContextProvider: React.FC<{
icon: "https://near.org/wp-content/uploads/2020/09/cropped-favicon-192x192.png",
},
}),
setupNearMobileWallet(),
],
});
/**
Expand Down
5 changes: 5 additions & 0 deletions examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@
"glob": "**/*",
"input": "packages/ramper-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/near-mobile-wallet/assets/",
"output": "assets/"
}
]
},
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.6.0",
"version": "8.7.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 All @@ -24,7 +24,8 @@
"welldone-wallet",
"opto-wallet",
"finer-wallet",
"ramper-wallet"
"ramper-wallet",
"near-mobile-wallet"
],
"homepage": "https://github.com/near/wallet-selector#README",
"bugs": {
Expand Down Expand Up @@ -67,6 +68,7 @@
"build:near-snap": "nx run-many --target=build --projects=near-snap --configuration=production",
"build:account-export": "nx run-many --target=build --projects=account-export --configuration=production",
"build:ramper-wallet": "nx run-many --target=build --projects=ramper-wallet --configuration=production",
"build:near-mobile-wallet": "nx run-many --target=build --projects=near-mobile-wallet --configuration=production",
"lint": "nx workspace-lint && nx run-many --target=lint --all --parallel",
"lint:fix": "nx run-many --target=lint --all --fix",
"serve:react": "nx serve react --host=0.0.0.0",
Expand All @@ -93,6 +95,7 @@
"@meteorwallet/sdk": "^0.8.0",
"@near-snap/sdk": "^0.5.0",
"@nightlylabs/connect-near": "0.0.15",
"@peersyst/near-mobile-signer": "1.0.7",
"@ramper/near": "^0.0.30",
"@walletconnect/modal": "^2.6.0",
"@walletconnect/sign-client": "2.9.1",
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.6.0",
"version": "8.7.0",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
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.6.0",
"version": "8.7.0",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.6.0",
"version": "8.7.0",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
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": "8.6.0",
"version": "8.7.0",
"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": "8.6.0",
"version": "8.7.0",
"description": "FiNER Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.6.0",
"version": "8.7.0",
"description": "Here wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.6.0",
"version": "8.7.0",
"description": "Ledger package for NEAR Wallet Selector.",
"keywords": [
"near",
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.6.0",
"version": "8.7.0",
"description": "Math wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.6.0",
"version": "8.7.0",
"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.6.0",
"version": "8.7.0",
"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.6.0",
"version": "8.7.0",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
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.6.0",
"version": "8.7.0",
"description": "My Near Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
8 changes: 7 additions & 1 deletion packages/my-near-wallet/src/lib/my-near-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ const setupWalletState = async (
const MyNearWallet: WalletBehaviourFactory<
BrowserWallet,
{ params: MyNearWalletExtraOptions }
> = async ({ metadata, options, store, params, logger }) => {
> = async ({ metadata, options, store, params, logger, id }) => {
const _state = await setupWalletState(params, options.network);
const getAccounts = async (): Promise<Array<Account>> => {
const accountId = _state.wallet.getAccountId();
Expand Down Expand Up @@ -163,6 +163,12 @@ const MyNearWallet: WalletBehaviourFactory<
async signMessage({ message, nonce, recipient, callbackUrl, state }) {
logger.log("sign message", { message });

if (id !== "my-near-wallet") {
throw Error(
`The signMessage method is not supported by ${metadata.name}`
);
}

const locationUrl =
typeof window !== "undefined" ? window.location.href : "";

Expand Down
2 changes: 1 addition & 1 deletion packages/narwallets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/narwallets",
"version": "8.6.0",
"version": "8.7.0",
"description": "This is the Narwallets package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
10 changes: 10 additions & 0 deletions packages/near-mobile-wallet/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
[
"@nrwl/js/babel",
{
"useBuiltIns": "usage"
}
]
]
}
18 changes: 18 additions & 0 deletions packages/near-mobile-wallet/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
50 changes: 50 additions & 0 deletions packages/near-mobile-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# @near-wallet-selector/near-mobile-wallet

This is the [Near Mobile Wallet](https://nearmobile.app/) package for NEAR Wallet Selector.

## Installation and Usage

The easiest way to use this package is to install it from the NPM registry, this package requires `near-api-js` v1.0.0 or above:

```bash
# Using Yarn
yarn add near-api-js

# Using NPM.
npm install near-api-js
```

```bash
# Using Yarn
yarn add @near-wallet-selector/near-mobile-wallet

# Using NPM.
npm install @near-wallet-selector/near-mobile-wallet
```

Then use it in your dApp:

```ts
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";

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

## Options

- `dAppMetadata: DAppMetadata` (optional): An object to provide data from your dApp to be displayed on Near Mobile Wallet when signing requests.
```ts
export interface DAppMetadata {
name: string;
logoUrl: string;
url?: string;
}
```

## License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
Binary file added packages/near-mobile-wallet/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions packages/near-mobile-wallet/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: "near-mobile-wallet",
preset: "../../jest.preset.js",
globals: {},
transform: {
"^.+\\.[tj]s$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.spec.json",
},
],
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/near-mobile-wallet",
};
Loading

0 comments on commit 2436df8

Please sign in to comment.