Skip to content

Commit

Permalink
Merge branch 'near:dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoon-Suji committed Oct 11, 2022
2 parents fe56edb + fc5a5f8 commit b2a9ff8
Show file tree
Hide file tree
Showing 71 changed files with 1,987 additions and 272 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
target-branch: "dev"
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,18 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [Nightly](https://www.npmjs.com/package/@near-wallet-selector/nightly) - Injected wallet.
- [Meteor Wallet](https://www.npmjs.com/package/@near-wallet-selector/meteor-wallet) - Injected wallet.
- [Welldone Wallet](https://www.npmjs.com/package/@near-wallet-selector/welldone-wallet) - Injected wallet.
- [Coin98 Wallet](https://www.npmjs.com/package/@near-wallet-selector/coin98-wallet) - Injected wallet.
- [Ledger](https://www.npmjs.com/package/@near-wallet-selector/ledger) - Hardware wallet.
- [WalletConnect](https://www.npmjs.com/package/@near-wallet-selector/wallet-connect) - Bridge wallet.
- [Nightly Connect](https://www.npmjs.com/package/@near-wallet-selector/nightly-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.

## Preview

[React](https://reactjs.org/) / [Next.js](https://nextjs.org/) and [Angular](https://angular.io/) variations of the [Guest Book](https://github.com/near-examples/guest-book/) dApp can be found in the [`examples`](/examples) directory. You can use these to gain a concrete understanding of how to integrate NEAR Wallet Selector into your own dApp.

![Preview](./images/preview-img.png)
![Preview](./images/preview-img.gif)

## Installation and Usage

Expand Down Expand Up @@ -47,28 +50,34 @@ yarn add \
@near-wallet-selector/near-wallet \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
@near-wallet-selector/nearfi \
@near-wallet-selector/here-wallet \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/welldone-wallet \
@near-wallet-selector/ledger \
@near-wallet-selector/wallet-connect \
@near-wallet-selector/nightly-connect \
@near-wallet-selector/default-wallets
@near-wallet-selector/default-wallets \
@near-wallet-selector/coin98-wallet

# Using NPM.
npm install \
@near-wallet-selector/near-wallet \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
@near-wallet-selector/nearfi \
@near-wallet-selector/here-wallet \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/welldone-wallet \
@near-wallet-selector/ledger \
@near-wallet-selector/wallet-connect \
@near-wallet-selector/nightly-connect \
@near-wallet-selector/default-wallets
@near-wallet-selector/default-wallets \
@near-wallet-selector/coin98-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 All @@ -89,6 +98,7 @@ import { setupModal } from "@near-wallet-selector/modal-ui";
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 { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
Expand All @@ -97,6 +107,8 @@ import { setupLedger } from "@near-wallet-selector/ledger";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupNightlyConnect } from "@near-wallet-selector/nightly-connect";
import { setupDefaultWallets } from "@near-wallet-selector/default-wallets";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";

const selector = await setupWalletSelector({
network: "testnet",
Expand All @@ -105,11 +117,14 @@ const selector = await setupWalletSelector({
setupNearWallet(),
setupMyNearWallet(),
setupSender(),
setupHereWallet(),
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupWelldoneWallet(),
setupLedger(),
setupNearFi(),
setupCoin98Wallet(),
setupWalletConnect({
projectId: "c4f79cc...",
metadata: {
Expand Down
5 changes: 5 additions & 0 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
"input": "packages/sender/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/nearfi/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/nightly/assets/",
Expand Down
4 changes: 4 additions & 0 deletions examples/angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import type { WalletSelector, AccountState } from "@near-wallet-selector/core";
import { setupDefaultWallets } from "@near-wallet-selector/default-wallets";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNightlyConnect } from "@near-wallet-selector/nightly-connect";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
// import { setupModal } from "@near-wallet-selector/modal-ui";
// import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
import { setupModal } from "@near-wallet-selector/modal-ui-js";
Expand Down Expand Up @@ -54,7 +56,9 @@ export class AppComponent implements OnInit {
setupNightly(),
setupMeteorWallet(),
setupWelldoneWallet(),
setupHereWallet(),
setupCoin98Wallet(),
setupNearFi(),
setupWalletConnect({
projectId: "c4f79cc...",
metadata: {
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 @@ -155,7 +155,7 @@ const Content: React.FC = () => {
}

return wallet.signAndSendTransactions({ transactions }).catch((err) => {
alert("Failed to add messages");
alert("Failed to add messages exception " + err);
console.log("Failed to add messages");

throw err;
Expand Down
9 changes: 6 additions & 3 deletions examples/react/contexts/WalletSelectorContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { setupModal } from "@near-wallet-selector/modal-ui";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
import { setupDefaultWallets } from "@near-wallet-selector/default-wallets";
import { setupNearWallet } from "@near-wallet-selector/near-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNightlyConnect } from "@near-wallet-selector/nightly-connect";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";
import { CONTRACT_ID } from "../constants";
Expand Down Expand Up @@ -45,14 +47,16 @@ export const WalletSelectorContextProvider: React.FC = ({ children }) => {
modules: [
...(await setupDefaultWallets()),
setupNearWallet(),
setupCoin98Wallet(),
setupSender(),
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupWelldoneWallet(),
setupHereWallet(),
setupCoin98Wallet(),
setupNearFi(),
setupWalletConnect({
projectId: "test...",
projectId: "c4f79cc...",
metadata: {
name: "NEAR Wallet Selector",
description: "Example dApp used by NEAR Wallet Selector",
Expand All @@ -73,7 +77,6 @@ export const WalletSelectorContextProvider: React.FC = ({ children }) => {
});
const _modal = setupModal(_selector, { contractId: CONTRACT_ID });
const state = _selector.store.getState();

setAccounts(state.accounts);

window.selector = _selector;
Expand Down
5 changes: 5 additions & 0 deletions examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
"input": "packages/sender/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/nearfi/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/nightly/assets/",
Expand Down
Binary file added images/preview-img.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"ledger",
"wallet-connect",
"nightly-connect",
"nearfi",
"meteor-wallet",
"welldone-wallet"
],
Expand All @@ -41,8 +42,10 @@
"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",
"build:nearfi": "nx run-many --target=build --projects=nearfi --configuration=production",
"build:nightly": "nx run-many --target=build --projects=nightly --configuration=production",
"build:meteor-wallet": "nx run-many --target=build --projects=meteor-wallet --configuration=production",
"build:welldone-wallet": "nx run-many --target=build --projects=welldone-wallet --configuration=production",
Expand All @@ -52,13 +55,14 @@
"build:default-wallets": "nx run-many --target=build --projects=default-wallets --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",
"serve:react": "nx serve react --host=0.0.0.0",
"serve:angular": "nx serve angular",
"prepack": "yarn build:core && yarn build:all",
"test": "nx run-many --target=test --all",
"postinstall": "ngcc --properties es2020 browser module main"
},
"dependencies": {

"@angular/animations": "~14.0.0",
"@angular/common": "~14.0.0",
"@angular/compiler": "~14.0.0",
Expand All @@ -78,13 +82,16 @@
"big.js": "^6.1.1",
"bn.js": "^5.2.0",
"buffer": "^6.0.3",
"copy-to-clipboard": "^3.3.2",
"core-js": "^3.6.5",
"is-mobile": "^3.1.1",
"near-api-js": "^0.44.2",
"next": "12.2.3",
"ngx-deploy-npm": "^4.1.1",
"qrcode": "^1.5.1",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-qr-code": "^2.0.8",
"regenerator-runtime": "0.13.7",
"rxjs": "^7.5.5",
"tslib": "^2.3.0",
Expand Down Expand Up @@ -123,6 +130,7 @@
"@types/gh-pages": "^3.2.1",
"@types/jest": "27.4.1",
"@types/node": "16.11.7",
"@types/qrcode": "^1.5.0",
"@types/react": "18.0.14",
"@types/react-dom": "18.0.5",
"@types/regenerator-runtime": "^0.13.1",
Expand All @@ -143,11 +151,11 @@
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "7.30.1",
"eslint-plugin-react-hooks": "4.6.0",
"gh-pages": "^4.0.0",
"jest": "27.5.1",
"jest-mock-extended": "^2.0.6",
"jest-preset-angular": "^12.2.0",
"nx": "14.4.2",
"gh-pages": "^4.0.0",
"prettier": "^2.7.1",
"react-test-renderer": "18.2.0",
"sass": "1.52.3",
Expand Down
Binary file modified packages/coin98-wallet/assets/coin98-wallet-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/coin98-wallet/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"root": "packages/coin98-wallet",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/coin98-wallet/src",
"projectType": "library",
"targets": {
Expand Down
7 changes: 5 additions & 2 deletions packages/coin98-wallet/src/lib/coin98-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { waitFor } from "@near-wallet-selector/core";
import type { InjectedCoin98 } from "./injected-coin98-wallet";
import { signTransactions } from "@near-wallet-selector/wallet-utils";
import type { FinalExecutionOutcome } from "near-api-js/lib/providers";
import icon from "./icon";

declare global {
interface Window {
Expand All @@ -21,6 +22,7 @@ declare global {

export interface Coin98WalletParams {
iconUrl?: string;
deprecated?: boolean;
}

interface Coin98WalletState {
Expand Down Expand Up @@ -175,7 +177,8 @@ const Coin98Wallet: WalletBehaviourFactory<InjectedWallet> = async ({
};

export const setupCoin98Wallet = ({
iconUrl = "./assets/coin98-wallet-icon.png",
iconUrl = icon,
deprecated = false,
}: Coin98WalletParams = {}): WalletModuleFactory<InjectedWallet> => {
return async () => {
const mobile = isMobile();
Expand All @@ -195,7 +198,7 @@ export const setupCoin98Wallet = ({
iconUrl,
downloadUrl:
"https://chrome.google.com/webstore/detail/coin98-wallet/aeachknmefphepccionboohckonoeemg",
deprecated: false,
deprecated,
available: installed,
},
init: Coin98Wallet,
Expand Down
Loading

0 comments on commit b2a9ff8

Please sign in to comment.