Skip to content

Commit

Permalink
Merge pull request #1070 from near/dev
Browse files Browse the repository at this point in the history
v8.9.4 Release (dev -> main)
  • Loading branch information
kujtimprenkuSQA authored Feb 8, 2024
2 parents 97b9c3c + 42e7c85 commit 6d009bf
Show file tree
Hide file tree
Showing 67 changed files with 167 additions and 431 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

NEAR Wallet Selector makes it easy for users to interact with your dApp by providing an abstraction over various wallets within the NEAR ecosystem:

- [NEAR Wallet](https://www.npmjs.com/package/@near-wallet-selector/near-wallet) - Browser wallet.
- [My NEAR Wallet](https://www.npmjs.com/package/@near-wallet-selector/my-near-wallet) - Browser wallet.
- [Mintbase Wallet](https://www.npmjs.com/package/@near-wallet-selector/mintbase-wallet) - Browser wallet.
- [Ledger](https://www.npmjs.com/package/@near-wallet-selector/ledger) - Hardware wallet.
Expand Down Expand Up @@ -54,7 +53,6 @@ Next, you'll need to install the wallets you want to support:
```bash
# Using Yarn
yarn add \
@near-wallet-selector/near-wallet \
@near-wallet-selector/bitget-wallet \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
Expand All @@ -77,7 +75,6 @@ yarn add \

# Using NPM.
npm install \
@near-wallet-selector/near-wallet \
@near-wallet-selector/bitget-wallet \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
Expand Down Expand Up @@ -115,7 +112,6 @@ Then in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupModal } from "@near-wallet-selector/modal-ui";
import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
Expand All @@ -139,7 +135,6 @@ import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
const selector = await setupWalletSelector({
network: "testnet",
modules: [
setupNearWallet(),
setupBitgetWallet(),
setupMyNearWallet(),
setupSender(),
Expand Down
5 changes: 0 additions & 5 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
"assets": [
"examples/angular/src/favicon.ico",
"examples/angular/src/assets",
{
"glob": "**/*",
"input": "packages/near-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/my-near-wallet/assets/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class ContentComponent implements OnInit, OnDestroy {
async onSignMessage() {
const wallet = await this.selector.wallet();
const message = "test message to sign";
const nonce = Buffer.from(Array.from(Array(32).keys()));
const nonce = Buffer.from(crypto.getRandomValues(new Uint8Array(32)));
const recipient = "guest-book.testnet";

if (wallet.type === "browser") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { OnInit } from "@angular/core";
import type { AccountState, WalletSelector } from "@near-wallet-selector/core";
import { setupWalletSelector } from "@near-wallet-selector/core";
import type { WalletSelectorModal } from "@near-wallet-selector/account-export";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
import { setupXDEFI } from "@near-wallet-selector/xdefi";
Expand Down Expand Up @@ -56,7 +55,6 @@ export class WalletSelectorExportComponent implements OnInit {
modules: [
setupMyNearWallet(),
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupXDEFI(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { AccountState, WalletSelector } from "@near-wallet-selector/core";
import { setupWalletSelector } from "@near-wallet-selector/core";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui-js";
import { setupModal } from "@near-wallet-selector/modal-ui-js";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
import { setupXDEFI } from "@near-wallet-selector/xdefi";
Expand Down Expand Up @@ -58,7 +57,6 @@ export class WalletSelectorComponent implements OnInit {
modules: [
setupMyNearWallet(),
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupXDEFI(),
Expand All @@ -76,6 +74,15 @@ export class WalletSelectorComponent implements OnInit {
}),
setupWalletConnect({
projectId: "c8cb6204543639c31aef44ea4837a554", // Replace this with your own projectId form WalletConnect.
// Overrides the default methods on wallet-connect.ts
// the near_signMessage and near_verifyOwner are missing here.
methods: [
"near_signIn",
"near_signOut",
"near_getAccounts",
"near_signTransaction",
"near_signTransactions",
],
metadata: {
name: "NEAR Wallet Selector",
description: "Example dApp used by NEAR Wallet Selector",
Expand Down
2 changes: 1 addition & 1 deletion examples/react/components/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ const Content: React.FC = () => {
const wallet = await selector.wallet();

const message = "test message to sign";
const nonce = Buffer.from(Array.from(Array(32).keys()));
const nonce = Buffer.from(crypto.getRandomValues(new Uint8Array(32)));
const recipient = "guest-book.testnet";

if (wallet.type === "browser") {
Expand Down
2 changes: 0 additions & 2 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
import { setupModal } from "@near-wallet-selector/modal-ui";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupSender } from "@near-wallet-selector/sender";
Expand Down Expand Up @@ -68,7 +67,6 @@ export const WalletSelectorContextProvider: React.FC<{
modules: [
setupMyNearWallet(),
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupMathWallet(),
Expand Down
2 changes: 0 additions & 2 deletions examples/react/contexts/WalletSelectorExportContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { setupWalletSelector } from "@near-wallet-selector/core";
import type { WalletSelector, AccountState } from "@near-wallet-selector/core";
import { setupExportSelectorModal } from "@near-wallet-selector/account-export";
import type { WalletSelectorModal } from "@near-wallet-selector/account-export";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
Expand Down Expand Up @@ -61,7 +60,6 @@ export const ExportAccountSelectorContextProvider: React.FC<{
modules: [
setupMyNearWallet(),
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupMathWallet(),
Expand Down
5 changes: 0 additions & 5 deletions examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
"root": "examples/react",
"outputPath": "dist/examples/react",
"assets": [
{
"glob": "**/*",
"input": "packages/near-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/my-near-wallet/assets/",
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.9.3",
"version": "8.9.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 All @@ -9,7 +9,6 @@
"dapps",
"near-protocol",
"near-blockchain",
"near-wallet",
"near-snap",
"my-near-wallet",
"bitget-wallet",
Expand Down Expand Up @@ -48,7 +47,6 @@
"build:bitget-wallet": "nx run-many --target=build --projects=bitget-wallet --configuration=production",
"build:ledger": "nx run-many --target=build --projects=ledger --configuration=production",
"build:math-wallet": "nx run-many --target=build --projects=math-wallet --configuration=production",
"build:near-wallet": "nx run-many --target=build --projects=near-wallet --configuration=production",
"build:here-wallet": "nx run-many --target=build --projects=here-wallet --configuration=production",
"build:my-near-wallet": "nx run-many --target=build --projects=my-near-wallet --configuration=production",
"build:sender": "nx run-many --target=build --projects=sender --configuration=production",
Expand Down Expand Up @@ -88,8 +86,8 @@
"@angular/router": "15.2.9",
"@here-wallet/core": "^1.5.1",
"@jscutlery/semver": "3.1.0",
"@ledgerhq/hw-transport": "6.27.1",
"@ledgerhq/hw-transport-webhid": "6.27.1",
"@ledgerhq/hw-transport": "6.30.3",
"@ledgerhq/hw-transport-webhid": "6.28.3",
"@metamask/detect-provider": "^2.0.0",
"@meteorwallet/sdk": "^1.0.9",
"@mintbase-js/wallet": "0.5.0-beta.6",
Expand All @@ -98,7 +96,7 @@
"@ramper/near": "^0.0.30",
"@walletconnect/modal": "^2.6.2",
"@walletconnect/sign-client": "2.11.0",
"better-sqlite3": "^9.2.2",
"better-sqlite3": "^9.3.0",
"big.js": "^6.1.1",
"bn.js": "^5.2.0",
"borsh": "^0.7.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/account-export/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Then use it in your wallet:
```ts
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupExportSelectorModal } from "@near-wallet-selector/account-export";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";

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

const modal = setupExportSelectorModal(selector, {
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.9.3",
"version": "8.9.4",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/bitget-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/bitget-wallet",
"version": "8.9.3",
"version": "8.9.4",
"description": "Bitget wallet 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.9.3",
"version": "8.9.4",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Then use it in your dApp:

```ts
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";

// The entire set of options can be found in the section below.
const selector = await setupWalletSelector({
network: "testnet",
modules: [setupNearWallet()],
modules: [setupMyNearWallet()],
});
```

Expand Down
4 changes: 2 additions & 2 deletions packages/core/docs/api/selector.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Retrieve the current state. You can find more information on `WalletSelectorStat

```ts
const state = selector.store.getState();
console.log(state); // { modules: [{ id: "near-wallet", ... }], ... }
console.log(state); // { modules: [{ id: "my-near-wallet", ... }], ... }
```

### `.store.observable`
Expand Down Expand Up @@ -126,7 +126,7 @@ Programmatically access wallets and call their methods. It's advised to use `sta

// Specific wallet.
(async () => {
const wallet = await selector.wallet("near-wallet");
const wallet = await selector.wallet("my-near-wallet");
const accounts = await wallet.signIn({ contractId: "test.testnet" });
})();
```
Expand Down
6 changes: 3 additions & 3 deletions packages/core/docs/api/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Returns the list of available modules.

```ts
const { modules } = selector.store.getState();
console.log(modules); // [{ id: "near-wallet", ... }]
console.log(modules); // [{ id: "my-near-wallet", ... }]
```

### `.accounts`
Expand Down Expand Up @@ -74,7 +74,7 @@ Returns the ID of the selected wallet.

```ts
const { selectedWalletId } = selector.store.getState();
console.log(selectedWalletId); // "near-wallet"
console.log(selectedWalletId); // "my-near-wallet"
```

### `.recentlySignedInWallets`
Expand All @@ -91,5 +91,5 @@ Returns ID-s of 5 recently signed in wallets.

```ts
const { recentlySignedInWallets } = selector.store.getState();
console.log(recentlySignedInWallets); // ["near-wallet", "sender", ...]
console.log(recentlySignedInWallets); // ["my-near-wallet", "sender", ...]
```
12 changes: 6 additions & 6 deletions packages/core/docs/api/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Unique identifier of the wallet.

```ts
(async () => {
const wallet = await selector.wallet("near-wallet");
console.log(wallet.id); // "near-wallet"
const wallet = await selector.wallet("my-near-wallet");
console.log(wallet.id); // "my-near-wallet"
})();
```

Expand Down Expand Up @@ -97,9 +97,9 @@ Programmatically sign in. Hardware wallets (e.g. Ledger) require `derivationPath
**Example**

```ts
// NEAR Wallet.
// MyNearWallet.
(async () => {
const wallet = await selector.wallet("near-wallet");
const wallet = await selector.wallet("my-near-wallet");
const accounts = await wallet.signIn({ contractId: "test.testnet" });
})();

Expand Down Expand Up @@ -223,7 +223,7 @@ Signs the message and verifies the owner. Message is not sent to blockchain.
- `signerId` (`string?`): Account ID used to sign the transaction. Defaults to the first account.
- `receiverId` (`string?`): Account ID to receive the transaction. Defaults to `contractId` defined in `.init`.
- `actions` (`Array<Action>`): NEAR Action(s) to sign and send to the network (e.g. `FunctionCall`). You can find more information on `Action` [here](./transactions.md).
- `callbackUrl` (`string?`): Applicable to browser wallets (e.g. NEAR Wallet). This the callback url once the transaction is approved.
- `callbackUrl` (`string?`): Applicable to browser wallets (e.g. MyNearWallet). This the callback url once the transaction is approved.

**Returns**

Expand Down Expand Up @@ -260,7 +260,7 @@ Signs one or more NEAR Actions before sending to the network. The user must be s

- `params` (`object`)
- `transactions` (`Array<Transaction>`): NEAR Transactions(s) to sign and send to the network. You can find more information on `Transaction` [here](./transactions.md).
- `callbackUrl` (`string?`): Applicable to browser wallets (e.g. NEAR Wallet). This the callback url once the transaction is approved.
- `callbackUrl` (`string?`): Applicable to browser wallets (e.g. MyNearWallet). This the callback url once the transaction is approved.

**Returns**

Expand Down
6 changes: 3 additions & 3 deletions packages/core/docs/guides/custom-wallets.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ This method signs a list of NEAR Actions before sending via an RPC endpoint. The

Where you might have to construct NEAR Transactions and send them yourself, you can import `near-api-js` and make use of the injected `provider` that's configured based on `options.network`.

> Note: Browser wallets (i.e. NEAR Wallet) are unable to return the transaction outcome as they can trigger a redirect. The return type in this case is `Promise<void>` instead of the usual `Promise<FinalExecutionOutcome>`.
> Note: Browser wallets (i.e. MyNearWallet) are unable to return the transaction outcome as they can trigger a redirect. The return type in this case is `Promise<void>` instead of the usual `Promise<FinalExecutionOutcome>`.
### `signAndSendTransactions`

This method is similar to `signAndSendTransaction` but instead sends a batch of Transactions.

> Note: Exactly how this method should behave when transactions fail is still under review with no clear "right" way to do it. NEAR Wallet (website) seems to ignore any transactions that fail and continue executing the rest. Our approach attempts to execute the transactions in a series and bail if any fail (we will look to improve this in the future by implementing a retry feature).
> Note: Exactly how this method should behave when transactions fail is still under review with no clear "right" way to do it. MyNearWallet (website) seems to ignore any transactions that fail and continue executing the rest. Our approach attempts to execute the transactions in a series and bail if any fail (we will look to improve this in the future by implementing a retry feature).
### `signMessage`

This method allows users to sign a message for a specific recipient using their NEAR account.
Returns the `SignedMessage` based on the [NEP413](https://github.com/near/NEPs/blob/master/neps/nep-0413.md).
Returns the `SignedMessage` based on the [NEP413](https://github.com/near/NEPs/blob/master/neps/nep-0413.md).
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.9.3",
"version": "8.9.4",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/lib/wallet/wallet.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,15 +220,15 @@ interface BrowserWalletSignInParams extends SignInParams {
interface BrowserWalletSignAndSendTransactionParams
extends SignAndSendTransactionParams {
/**
* Applicable to browser wallets (e.g. NEAR Wallet). This the callback url once the transaction is approved.
* Applicable to browser wallets (e.g. MyNearWallet). This the callback url once the transaction is approved.
*/
callbackUrl?: string;
}

interface BrowserWalletSignAndSendTransactionsParams
extends SignAndSendTransactionsParams {
/**
* Applicable to browser wallets (e.g. NEAR Wallet). This the callback url once the transaction is approved.
* Applicable to browser wallets (e.g. MyNearWallet). This the callback url once the transaction is approved.
*/
callbackUrl?: string;
}
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.9.3",
"version": "8.9.4",
"description": "Here wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
Loading

0 comments on commit 6d009bf

Please sign in to comment.