Skip to content

Commit

Permalink
Merge pull request #1020 from near/dev
Browse files Browse the repository at this point in the history
v8.9.0 Release (dev -> main)
  • Loading branch information
kujtimprenkuSQA authored Nov 27, 2023
2 parents b8dd1cb + db2eac0 commit a9fef95
Show file tree
Hide file tree
Showing 59 changed files with 2,461 additions and 43 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [WalletConnect](https://www.npmjs.com/package/@near-wallet-selector/wallet-connect) - Bridge wallet.
- [Here Wallet](https://www.npmjs.com/package/@near-wallet-selector/here-wallet) - Mobile wallet.
- [NearFi Wallet](https://www.npmjs.com/package/@near-wallet-selector/nearfi) - Mobile wallet.
- [Bitget Wallet](https://www.npmjs.com/package/@near-wallet-selector/bitget-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.
- [Mintbase Wallet](https://www.npmjs.com/package/@near-wallet-selector/mintbase-wallet) - Browser wallet.
Expand Down Expand Up @@ -54,6 +55,7 @@ Next, you'll need to install the wallets you want to support:
# Using Yarn
yarn add \
@near-wallet-selector/near-wallet \
@near-wallet-selector/bitget-wallet \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
@near-wallet-selector/nearfi \
Expand All @@ -76,6 +78,7 @@ 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 \
@near-wallet-selector/nearfi \
Expand Down Expand Up @@ -111,6 +114,7 @@ Then in your dApp:
```ts
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";
Expand All @@ -136,6 +140,7 @@ const selector = await setupWalletSelector({
network: "testnet",
modules: [
setupNearWallet(),
setupBitgetWallet(),
setupMyNearWallet(),
setupSender(),
setupHereWallet(),
Expand Down
2 changes: 2 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ This folder contains two example projects that demonstrate how to integrate Near

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

## Getting Started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ 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";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
Expand Down Expand Up @@ -58,6 +59,7 @@ export class WalletSelectorExportComponent implements OnInit {
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupXDEFI(),
setupMathWallet(),
setupNightly(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ 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";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
Expand Down Expand Up @@ -60,6 +61,7 @@ export class WalletSelectorComponent implements OnInit {
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupXDEFI(),
setupMathWallet(),
setupNightly(),
Expand Down
2 changes: 2 additions & 0 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ 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";
import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNearSnap } from "@near-wallet-selector/near-snap";
Expand Down Expand Up @@ -70,6 +71,7 @@ export const WalletSelectorContextProvider: React.FC<{
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
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 @@ -14,6 +14,7 @@ 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";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
Expand Down Expand Up @@ -62,6 +63,7 @@ export const ExportAccountSelectorContextProvider: React.FC<{
setupLedger(),
setupNearWallet(),
setupSender(),
setupBitgetWallet(),
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
Expand Down
20 changes: 20 additions & 0 deletions examples/vanillajs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# NEAR wallet selector - vanilla JS example

This example shows how to use the NEAR wallet selector from a "vanilla" Javascript app, without using any framework like React or Angular.

In order to handle the imports and [importmap](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script/type/importmap) is used. This has to be re-generated each time there is a change in the imports, but otherwise you can just make changes to the javascript or html and it will be visible instantly. For generating the import map [JSPM](https://jspm.org/) is used. The benefit of this while developing is that there is no re-bundling time like when using e.g. WebPack with React or Angular.

JSPM can also be used for creating a single file production bundle if needed.

## Creating the import map

This is only needed if imports of external scripts are changed. There's a yarn script for creating the importmap:

`yarn examples:vanillajs:generateimportmap`

## Serving the static files

[http-server](https://github.com/http-party/http-server) is used for serving the static files if you run:

`yarn serve:vanillajs`

91 changes: 91 additions & 0 deletions examples/vanillajs/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@near-wallet-selector/modal-ui-js@8.7.2/styles.css">
</head>
<body>
<button id="open-walletselector-button">Open wallet selector</button>
</body>
<script async src="https://ga.jspm.io/npm:es-module-shims@1.8.2/dist/es-module-shims.js" crossorigin="anonymous"></script>
<script type="importmap">
{
"imports": {
"@near-wallet-selector/core": "https://ga.jspm.io/npm:@near-wallet-selector/core@8.8.0/index.js",
"@near-wallet-selector/here-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/here-wallet@8.8.0/index.js",
"@near-wallet-selector/modal-ui-js": "https://ga.jspm.io/npm:@near-wallet-selector/modal-ui-js@8.8.0/index.js",
"@near-wallet-selector/my-near-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/my-near-wallet@8.8.0/index.js"
},
"scopes": {
"https://ga.jspm.io/": {
"@here-wallet/core": "https://ga.jspm.io/npm:@here-wallet/core@1.5.1/build/index.js",
"@near-js/accounts": "https://ga.jspm.io/npm:@near-js/accounts@0.1.4/lib/index.js",
"@near-js/crypto": "https://ga.jspm.io/npm:@near-js/crypto@0.0.5/lib/index.js",
"@near-js/keystores": "https://ga.jspm.io/npm:@near-js/keystores@0.0.5/lib/index.js",
"@near-js/keystores-browser": "https://ga.jspm.io/npm:@near-js/keystores-browser@0.0.5/lib/index.js",
"@near-js/providers": "https://ga.jspm.io/npm:@near-js/providers@0.0.7/lib/index.js",
"@near-js/signers": "https://ga.jspm.io/npm:@near-js/signers@0.0.5/lib/index.js",
"@near-js/transactions": "https://ga.jspm.io/npm:@near-js/transactions@0.2.1/lib/index.js",
"@near-js/types": "https://ga.jspm.io/npm:@near-js/types@0.0.4/lib/index.js",
"@near-js/utils": "https://ga.jspm.io/npm:@near-js/utils@0.0.4/lib/index.js",
"@near-js/wallet-account": "https://ga.jspm.io/npm:@near-js/wallet-account@0.0.7/lib/index.js",
"@near-wallet-selector/wallet-utils": "https://ga.jspm.io/npm:@near-wallet-selector/wallet-utils@8.8.0/index.js",
"ajv": "https://ga.jspm.io/npm:ajv@8.12.0/dist/dev.ajv.js",
"ajv-formats": "https://ga.jspm.io/npm:ajv-formats@2.1.1/dist/index.js",
"ajv/dist/compile/codegen": "https://ga.jspm.io/npm:ajv@8.12.0/dist/compile/codegen/index.js",
"base-x": "https://ga.jspm.io/npm:base-x@3.0.9/src/index.js",
"bn.js": "https://ga.jspm.io/npm:bn.js@5.2.1/lib/bn.js",
"borsh": "https://ga.jspm.io/npm:borsh@0.7.0/lib/index.js",
"bs58": "https://ga.jspm.io/npm:bs58@4.0.1/index.js",
"buffer": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/buffer.js",
"capability": "https://ga.jspm.io/npm:capability@0.2.5/index.js",
"capability/es5": "https://ga.jspm.io/npm:capability@0.2.5/es5.js",
"charenc": "https://ga.jspm.io/npm:charenc@0.0.2/charenc.js",
"copy-to-clipboard": "https://ga.jspm.io/npm:copy-to-clipboard@3.3.3/index.js",
"crypt": "https://ga.jspm.io/npm:crypt@0.0.2/crypt.js",
"crypto": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/crypto.js",
"depd": "https://ga.jspm.io/npm:depd@2.0.0/lib/browser/index.js",
"dijkstrajs": "https://ga.jspm.io/npm:dijkstrajs@1.0.3/dijkstra.js",
"encode-utf8": "https://ga.jspm.io/npm:encode-utf8@1.0.3/index.js",
"error-polyfill": "https://ga.jspm.io/npm:error-polyfill@0.1.3/index.js",
"events": "https://ga.jspm.io/npm:events@3.3.0/events.js",
"fast-deep-equal": "https://ga.jspm.io/npm:fast-deep-equal@3.1.3/index.js",
"http": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/http.js",
"http-errors": "https://ga.jspm.io/npm:http-errors@1.8.1/index.js",
"https": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/https.js",
"inherits": "https://ga.jspm.io/npm:inherits@2.0.4/inherits_browser.js",
"js-sha256": "https://ga.jspm.io/npm:js-sha256@0.9.0/src/sha256.js",
"json-schema-traverse": "https://ga.jspm.io/npm:json-schema-traverse@1.0.0/index.js",
"mustache": "https://ga.jspm.io/npm:mustache@4.2.0/mustache.js",
"near-abi": "https://ga.jspm.io/npm:near-abi@0.1.1/lib/index.js",
"near-api-js": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/browser-index.js",
"near-api-js/lib/providers": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/providers/index.js",
"near-api-js/lib/utils": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/utils/index.js",
"near-api-js/lib/utils/key_pair": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/utils/key_pair.js",
"near-api-js/lib/utils/serialize": "https://ga.jspm.io/npm:near-api-js@2.1.4/lib/utils/serialize.js",
"node-fetch": "https://ga.jspm.io/npm:node-fetch@2.7.0/browser.js",
"o3": "https://ga.jspm.io/npm:o3@1.0.3/index.js",
"process": "https://ga.jspm.io/npm:@jspm/core@2.0.1/nodelibs/browser/process.js",
"qrcode": "https://ga.jspm.io/npm:qrcode@1.5.3/lib/browser.js",
"rxjs": "https://ga.jspm.io/npm:rxjs@7.8.1/dist/esm5/index.js",
"safe-buffer": "https://ga.jspm.io/npm:safe-buffer@5.2.1/index.js",
"setprototypeof": "https://ga.jspm.io/npm:setprototypeof@1.2.0/index.js",
"sha1": "https://ga.jspm.io/npm:sha1@1.1.1/sha1.js",
"statuses": "https://ga.jspm.io/npm:statuses@1.5.0/dev.index.js",
"text-encoding-utf-8": "https://ga.jspm.io/npm:text-encoding-utf-8@1.0.2/lib/encoding.lib.js",
"toggle-selection": "https://ga.jspm.io/npm:toggle-selection@1.0.6/index.js",
"toidentifier": "https://ga.jspm.io/npm:toidentifier@1.0.1/index.js",
"tslib": "https://ga.jspm.io/npm:tslib@2.6.2/tslib.es6.mjs",
"tweetnacl": "https://ga.jspm.io/npm:tweetnacl@1.0.3/nacl-fast.js",
"u3": "https://ga.jspm.io/npm:u3@0.1.1/index.js",
"uri-js": "https://ga.jspm.io/npm:uri-js@4.4.1/dist/es5/uri.all.js",
"uuid4": "https://ga.jspm.io/npm:uuid4@2.0.3/browser.mjs"
},
"https://ga.jspm.io/npm:http-errors@1.8.1/": {
"depd": "https://ga.jspm.io/npm:depd@1.1.2/lib/browser/index.js"
}
}
}
</script>
<script type="module" src="main.js"></script>
</html>
19 changes: 19 additions & 0 deletions examples/vanillajs/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupModal } from "@near-wallet-selector/modal-ui-js";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";

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

const modal = setupModal(selector, {
contractId: "test.testnet",
});

window.selector = selector;
window.modal = modal;

document.getElementById('open-walletselector-button').addEventListener('click', () => modal.show());

7 changes: 6 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.8.0",
"version": "8.9.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 @@ -12,6 +12,7 @@
"near-wallet",
"near-snap",
"my-near-wallet",
"bitget-wallet",
"sender",
"neth",
"math-wallet",
Expand Down Expand Up @@ -45,6 +46,7 @@
"build:core": "nx run-many --target=build --projects=core --configuration=production",
"build:modal-ui": "nx run-many --target=build --projects=modal-ui --configuration=production",
"build:modal-ui-js": "nx run-many --target=build --projects=modal-ui-js --configuration=production",
"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",
Expand All @@ -66,6 +68,8 @@
"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",
"build:mintbase-wallet": "nx run-many --target=build --projects=mintbase-wallet --configuration=production",
"examples:vanillajs:generateimportmap": "(cd examples/vanillajs && jspm link index.html -o index.html)",
"serve:vanillajs": "yarn examples:vanillajs:generateimportmap && http-server -c-1 examples/vanillajs",
"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 Down Expand Up @@ -194,6 +198,7 @@
"jest-mock-extended": "^2.0.6",
"jest-preset-angular": "13.0.0",
"jsdoc": "^4.0.2",
"jspm": "^3.1.0",
"nx": "16.0.0",
"nx-cloud": "16.0.5",
"path-browserify": "^1.0.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.8.0",
"version": "8.9.0",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
10 changes: 10 additions & 0 deletions packages/bitget-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/bitget-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": {}
}
]
}
59 changes: 59 additions & 0 deletions packages/bitget-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# @near-wallet-selector/bitget-wallet

This is the [Bitget Wallet](https://chrome.google.com/webstore/detail/bitkeep-crypto-nft-wallet/jiidiaalihmmhddjgbnbgdfflelocpak) 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/bitget-wallet

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

Then use it in your dApp:

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

// Bitget Wallet for Wallet Selector can be setup without any params or it can take one optional param.
const bitgetWallet = setupBitgetWallet());

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

## 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/bitget-wallet-icon`.
- `deprecated`: (`boolean?`): Deprecated is optional. Default is `false`.

## Assets

Assets such as icons can be found in the `/assets` directory of the package. Below is an example using Webpack:

```ts
import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
import bitgetWalletIconUrl from "@near-wallet-selector/bitget-wallet/assets/bitget-wallet-icon";

const bitgetWallet = setupBitgetWallet({
iconUrl: bitgetWalletIconUrl
});
```

## License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a9fef95

Please sign in to comment.