-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1020 from near/dev
v8.9.0 Release (dev -> main)
- Loading branch information
Showing
59 changed files
with
2,461 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@nrwl/js/babel", | ||
{ | ||
"useBuiltIns": "usage" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Oops, something went wrong.