Skip to content

Commit

Permalink
Merge pull request #885 from near/dev
Browse files Browse the repository at this point in the history
v8.5.0 Release (dev -> main)
  • Loading branch information
DamirSQA authored Aug 11, 2023
2 parents a4df3f0 + b813bd4 commit a7afd8e
Showing 48 changed files with 584 additions and 345 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -120,6 +120,7 @@ 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";
import { setupNearSnap } from "@near-wallet-selector/near-snap";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
2 changes: 1 addition & 1 deletion examples/angular/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ import "zone.js"; // Included with Angular CLI.
// eslint-disable-next-line @typescript-eslint/no-var-requires
global.Buffer = global.Buffer || require("buffer").Buffer;

(window as any).process = { env: {} };
(window as any).process = { env: {}, version: "" };

/***************************************************************************************************
* APPLICATION IMPORTS
12 changes: 6 additions & 6 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
@@ -13,8 +13,13 @@ import { setupNightly } from "@near-wallet-selector/nightly";
import { setupNightlyConnect } from "@near-wallet-selector/nightly-connect";
import { setupSender } from "@near-wallet-selector/sender";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupNearSnap } from "@near-wallet-selector/near-snap";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNearSnap } from "@near-wallet-selector/near-snap";
import { setupNeth } from "@near-wallet-selector/neth";
import { setupOptoWallet } from "@near-wallet-selector/opto-wallet";
import { setupFinerWallet } from "@near-wallet-selector/finer-wallet";
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 type { ReactNode } from "react";
@@ -27,12 +32,7 @@ import React, {
} from "react";
import { distinctUntilChanged, map } from "rxjs";

import { setupNeth } from "@near-wallet-selector/neth";
import { setupOptoWallet } from "@near-wallet-selector/opto-wallet";
import { setupFinerWallet } from "@near-wallet-selector/finer-wallet";
import { Loading } from "../components/Loading";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { CONTRACT_ID } from "../constants";

declare global {
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.4.0",
"version": "8.5.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",
@@ -91,6 +91,7 @@
"@ledgerhq/hw-transport-webhid": "6.27.1",
"@metamask/detect-provider": "^2.0.0",
"@meteorwallet/sdk": "^0.8.0",
"@near-snap/sdk": "^0.5.0",
"@nightlylabs/connect-near": "0.0.15",
"@ramper/near": "^0.0.30",
"@walletconnect/modal": "^2.6.0",
@@ -99,6 +100,7 @@
"big.js": "^6.1.1",
"bn.js": "^5.2.0",
"borsh": "^0.7.0",
"browserify-fs": "^1.0.0",
"bs58": "^5.0.0",
"buffer": "^6.0.3",
"copy-to-clipboard": "^3.3.3",
@@ -193,6 +195,7 @@
"jsdoc": "^4.0.2",
"nx": "16.0.0",
"nx-cloud": "16.0.5",
"path-browserify": "^1.0.1",
"prettier": "^2.7.1",
"react-refresh": "^0.10.0",
"react-test-renderer": "18.2.0",
@@ -206,6 +209,7 @@
"ts-prune": "^0.10.3",
"typescript": "4.9.5",
"url-loader": "^4.1.1",
"util": "^0.12.5",
"uuid": "^9.0.0",
"webpack": "^5.75.0",
"webpack-merge": "^5.8.0"
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.4.0",
"version": "8.5.0",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ export const verifySignature = ({
const sha = sha256(borshPayload);
const pk = utils.PublicKey.from(publicKey);
return pk.verify(
new Uint8Array(Buffer.from(sha)),
new Uint8Array(Buffer.from(sha, "hex")),
Buffer.from(signature, "base64")
);
};
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.4.0",
"version": "8.5.0",
"description": "Default wallets package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "FiNER Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "Here wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "Ledger package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "Math wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "Meteor wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "My Near Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
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.4.0",
"version": "8.5.0",
"description": "This is the Narwallets package for NEAR Wallet Selector.",
"keywords": [
"near",
2 changes: 1 addition & 1 deletion packages/near-snap/.babelrc
Original file line number Diff line number Diff line change
@@ -7,4 +7,4 @@
}
]
]
}
}
32 changes: 14 additions & 18 deletions packages/near-snap/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# @near-wallet-selector/near-snap
[Metamask Snap](https://metamask.io/snaps/) system that allows anyone to safely expand the capabilities of MetaMask. Currently is pre-release software running on [Metamask Flask](https://metamask.io/flask/).

This package implement NEAR snap for NEAR Wallet Selector.
This is the NEAR Metamask Snap package for NEAR Wallet Selector.

## Installation and Usage

@@ -29,20 +28,22 @@ Then use it in your dApp:
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupNearSnap } from "@near-wallet-selector/near-snap";

// NearSnap for Wallet Selector can be setup without any params or it can take one optional param.
const nearSnap = setupNearSnap({
iconUrl: "https://yourdomain.com/yourwallet-icon.png" //optional
});

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


## Near Snap JS SDK

The library uses @near-snap/sdk, you can read more about the functionality here:
https://github.com/here-wallet/near-snap


## Options

- `iconUrl`: (`string?`): Image URL for the icon shown in the modal. This can also be a relative path or base64 encoded image. Defaults to `./assets/near-snap-icon.png`.
- `iconUrl`: (`string?`): Icon is optional. Default image point to Metamask Flask Logo in base64 format.
- `deprecated`: (`boolean?`): Deprecated is optional. Default is `false`.

## Assets
@@ -51,18 +52,13 @@ Assets such as icons can be found in the `/assets` directory of the package. Bel

```ts
import { setupNearSnap } from "@near-wallet-selector/near-snap";
import nearSnapIconUrl from "@near-wallet-selector/near-snap/assets/near-snap-icon.png";
import SnapIconUrl from "@near-wallet-selector/near-snap/assets/snap-icon.png";

const nearSnap = setupNearSnap({
iconUrl: nearSnapIconUrl
const snapWallet = setupNearSnap({
iconUrl: SnapIconUrl
});
```
## Known Issues

Currently, the Near Snap and Coin98 Wallet conflict each other since the Coin98 overrides the `window.ethereum` to avoid this try the following:

- Through the "Override Wallet" feature on Coin98 Extension (Home > Settings > Override Wallet). Turning off the button means allowing the other wallet to override Coin98 and vice versa.
- Through Chrome's "Manage Extensions" section > Deactivate Coin98 when wishing to use other wallets.
```

## License

File renamed without changes
14 changes: 14 additions & 0 deletions packages/near-snap/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: "near-snap",
preset: "../../jest.preset.js",
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json",
},
},
transform: {
"^.+\\.[tj]sx?$": "ts-jest",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/near-snap",
};
2 changes: 1 addition & 1 deletion packages/near-snap/jest.config.ts
Original file line number Diff line number Diff line change
@@ -11,6 +11,6 @@ export default {
},
],
},
moduleFileExtensions: ["ts", "js", "html"],
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/near-snap",
};
4 changes: 1 addition & 3 deletions packages/near-snap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/near-snap",
"version": "8.4.0",
"version": "8.5.0",
"description": "Metamask snap to interact with Near dapps.",
"keywords": [
"near",
@@ -11,8 +11,6 @@
"near-blockchain",
"wallet selector",
"injected wallet",
"metamask snap",
"metamask flask",
"metamask"
],
"repository": {
3 changes: 1 addition & 2 deletions packages/near-snap/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { setupNearSnap } from "./lib/near-snap";
export type { NearSnapParams } from "./lib/near-snap";
export { setupNearSnap } from "./lib";
26 changes: 26 additions & 0 deletions packages/near-snap/src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { WalletModuleFactory } from "@near-wallet-selector/core";
import { initNearSnap } from "./selector";
import icon from "./icon";

export { icon };

export function setupNearSnap({
deprecated = false,
iconUrl = icon,
} = {}): WalletModuleFactory {
return async () => {
return {
id: "near-snap",
type: "injected",
init: initNearSnap,
metadata: {
name: "Near Snap",
description: "Metamask Snap for NEAR Protocol",
downloadUrl: "https://near-snap.surge.sh",
iconUrl,
deprecated,
available: true,
},
};
};
}
56 changes: 0 additions & 56 deletions packages/near-snap/src/lib/methods.ts

This file was deleted.

Loading

0 comments on commit a7afd8e

Please sign in to comment.