Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add WELLDONE extension wallet #477

Merged
merged 19 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [Math Wallet](https://www.npmjs.com/package/@near-wallet-selector/math-wallet) - Injected wallet.
- [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.
- [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.
Expand Down Expand Up @@ -49,6 +50,7 @@ yarn add \
@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 \
Expand All @@ -62,6 +64,7 @@ npm install \
@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 \
Expand Down Expand Up @@ -89,6 +92,7 @@ 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 { setupLedger } from "@near-wallet-selector/ledger";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupNightlyConnect } from "@near-wallet-selector/nightly-connect";
Expand All @@ -104,6 +108,7 @@ const selector = await setupWalletSelector({
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupWelldoneWallet(),
setupLedger(),
setupWalletConnect({
projectId: "c4f79cc...",
Expand Down
5 changes: 5 additions & 0 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
"input": "packages/meteor-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/welldone-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/coin98-wallet/assets/",
Expand Down
2 changes: 2 additions & 0 deletions examples/angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ 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 { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";
Expand Down Expand Up @@ -52,6 +53,7 @@ export class AppComponent implements OnInit {
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupWelldoneWallet(),
setupCoin98Wallet(),
setupWalletConnect({
projectId: "c4f79cc...",
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 @@ -10,6 +10,7 @@ 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 { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";
Expand Down Expand Up @@ -49,6 +50,7 @@ export const WalletSelectorContextProvider: React.FC = ({ children }) => {
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupWelldoneWallet(),
setupWalletConnect({
projectId: "test...",
metadata: {
Expand Down
5 changes: 5 additions & 0 deletions examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@
"input": "packages/meteor-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/welldone-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/coin98-wallet/assets/",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"ledger",
"wallet-connect",
"nightly-connect",
"meteor-wallet"
"meteor-wallet",
"welldone-wallet"
],
"homepage": "https://github.com/near/wallet-selector#README",
"bugs": {
Expand All @@ -44,6 +45,7 @@
"build:sender": "nx run-many --target=build --projects=sender --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",
"build:wallet-connect": "nx run-many --target=build --projects=wallet-connect --configuration=production",
"build:nightly-connect": "nx run-many --target=build --projects=nightly-connect --configuration=production",
"build:wallet-utils": "nx run-many --target=build --projects=wallet-utils --configuration=production",
Expand Down
10 changes: 10 additions & 0 deletions packages/welldone-wallet/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
[
"@nrwl/web/babel",
{
"useBuiltIns": "usage"
}
]
]
}
18 changes: 18 additions & 0 deletions packages/welldone-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": {}
}
]
}
60 changes: 60 additions & 0 deletions packages/welldone-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# @near-wallet-selector/welldone

This is the [Sender](https://chrome.google.com/webstore/detail/welldone-wallet-for-multi/bmkakpenjmcpfhhjadflneinmhboecjf) 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` v0.44.2 or above:

```bash
# Using Yarn
yarn add near-api-js@^0.44.2

# Using NPM.
npm install near-api-js@^0.44.2
```
```bash
# Using Yarn
yarn add @near-wallet-selector/welldone-wallet

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

Then use it in your dApp:

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

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

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

## 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/welldone-wallet.png`.

## Assets

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

```ts
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import welldoneIconUrl from "@near-wallet-selector/welldone-wallet/assets/welldone-wallet.png";

const sender = setupWelldoneWallet({
iconUrl: welldoneIconUrl
});
```

## License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions packages/welldone-wallet/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: "welldone wallet",
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/welldone-wallet",
};
15 changes: 15 additions & 0 deletions packages/welldone-wallet/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-disable */
export default {
displayName: "sender",
preset: "../../jest.preset.js",
globals: {
"ts-jest": {
tsconfig: "<rootDir>/tsconfig.spec.json",
},
},
transform: {
"^.+\\.[tj]s$": "ts-jest",
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/sender",
};
7 changes: 7 additions & 0 deletions packages/welldone-wallet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@near-wallet-selector/welldone-wallet",
"version": "0.0.1",
"peerDependencies": {
"near-api-js": "^0.44.2"
}
}
54 changes: 54 additions & 0 deletions packages/welldone-wallet/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/sender/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/web:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/welldone-wallet",
"tsConfig": "packages/welldone-wallet/tsconfig.lib.json",
"project": "packages/welldone-wallet/package.json",
"entryFile": "packages/welldone-wallet/src/index.ts",
"buildableProjectDepsInPackageJsonType": "dependencies",
"compiler": "babel",
"format": ["esm", "cjs"],
"assets": [
{
"glob": "packages/welldone-wallet/README.md",
"input": ".",
"output": "."
},
{
"glob": "packages/welldone-wallet/assets/*",
"input": ".",
"output": "assets"
}
]
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/welldone-wallet/**/*.ts"]
}
},
"test": {
"executor": "@nrwl/jest:jest",
"outputs": ["coverage/packages/welldone-wallet"],
"options": {
"jestConfig": "packages/welldone-wallet/jest.config.ts",
"passWithNoTests": true
}
},
"deploy": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public"
}
}
},
"tags": ["injected-wallet"]
}
1 change: 1 addition & 0 deletions packages/welldone-wallet/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { setupWelldoneWallet } from "./lib/welldone";