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: hot-wallet #1286

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ yarn add \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
@near-wallet-selector/nearfi \
@near-wallet-selector/hot-wallet \
@near-wallet-selector/here-wallet \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
Expand Down Expand Up @@ -89,6 +90,7 @@ npm install \
@near-wallet-selector/my-near-wallet \
@near-wallet-selector/sender \
@near-wallet-selector/nearfi \
@near-wallet-selector/hot-wallet \
@near-wallet-selector/here-wallet \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
Expand Down Expand Up @@ -129,6 +131,7 @@ import { setupModal } from "@near-wallet-selector/modal-ui";
import { setupBitgetWallet } from "@near-wallet-selector/bitget-wallet";
import { setupMyNearWallet } from "@near-wallet-selector/my-near-wallet";
import { setupSender } from "@near-wallet-selector/sender";
import { setupHotWallet } from "@near-wallet-selector/hot-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupNearSnap } from "@near-wallet-selector/near-snap";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
Expand Down Expand Up @@ -156,6 +159,7 @@ const selector = await setupWalletSelector({
setupBitgetWallet(),
setupMyNearWallet(),
setupSender(),
setupHotWallet(),
setupHereWallet(),
setupMathWallet(),
setupNightly(),
Expand Down
5 changes: 5 additions & 0 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
"input": "packages/here-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/hot-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/narwallets/assets/",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupHotWallet } from "@near-wallet-selector/hot-wallet";
import { setupCoin98Wallet } from "@near-wallet-selector/coin98-wallet";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupNearSnap } from "@near-wallet-selector/near-snap";
Expand Down Expand Up @@ -128,6 +129,7 @@ export class WalletSelectorComponent implements OnInit {
setupNarwallets(),
setupWelldoneWallet(),
setupHereWallet(),
setupHotWallet(),
setupCoin98Wallet(),
setupNearFi(),
setupNearSnap(),
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 @@ -5,6 +5,7 @@ import type {
WalletSelector,
} from "@near-wallet-selector/core";
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupHotWallet } from "@near-wallet-selector/hot-wallet";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
Expand Down Expand Up @@ -168,6 +169,7 @@ export const WalletSelectorContextProvider: React.FC<{
setupOKXWallet(),
setupNarwallets(),
setupWelldoneWallet(),
setupHotWallet(),
setupHereWallet(),
setupCoin98Wallet(),
setupNearFi(),
Expand Down
5 changes: 5 additions & 0 deletions examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
"input": "packages/here-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/hot-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/narwallets/assets/",
Expand Down
3 changes: 2 additions & 1 deletion examples/vanillajs/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ 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";
import { setupHotWallet } from "@near-wallet-selector/hot-wallet";

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

const modal = setupModal(selector, {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
"@angular/platform-browser": "16.1.9",
"@angular/platform-browser-dynamic": "16.1.9",
"@angular/router": "16.1.9",
"@here-wallet/core": "3.3.1",
"@here-wallet/core": "3.4.0",
"@hot-wallet/sdk": "1.0.7",
"@jscutlery/semver": "5.3.1",
"@ledgerhq/hw-transport": "6.30.3",
"@ledgerhq/hw-transport-webhid": "6.29.4",
Expand Down
10 changes: 10 additions & 0 deletions packages/hot-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/hot-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": {}
}
]
}
63 changes: 63 additions & 0 deletions packages/hot-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# @near-wallet-selector/hot-wallet

This is the [HOT Wallet](https://hot-labs.org/wallet) 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/hot-wallet

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

Then use it in your dApp:

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

// HOT Wallet for Wallet Selector can be setup without any params or it can take few optional params, see options below.
const hotWallet = setupHereWallet({
iconUrl: "https://<Wallet Icon URL Here>" // optional
});

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

## Options

- `iconUrl`: (`string?`): Icon is optional. Default image point to Here Wallet Logo in base64 format.
- `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 { setupHotWallet } from "@near-wallet-selector/hot-wallet";
import HereWalletIconUrl from "@near-wallet-selector/hot-wallet/assets/hot-wallet-icon.png";

const hereWallet = setupHotWallet({
iconUrl: HereWalletIconUrl
});

```

## License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
Binary file added packages/hot-wallet/assets/hot-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.
14 changes: 14 additions & 0 deletions packages/hot-wallet/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: "hot-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/hot-wallet",
};
16 changes: 16 additions & 0 deletions packages/hot-wallet/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: "hot-wallet",
preset: "../../jest.preset.js",
globals: {},
transform: {
"^.+\\.[tj]s$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.spec.json",
},
],
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/hot-wallet",
};
24 changes: 24 additions & 0 deletions packages/hot-wallet/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@near-wallet-selector/hot-wallet",
"version": "8.9.16",
"description": "HOT Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
"blockchain",
"wallets",
"dapps",
"near-protocol",
"near-blockchain",
"wallet selector",
"injected wallet",
"hot wallet"
],
"repository": {
"type": "git",
"url": "https://github.com/near/wallet-selector.git"
},
"bugs": {
"url": "https://github.com/near/wallet-selector/issues"
},
"homepage": "https://github.com/near/wallet-selector/tree/main/packages/hot-wallet"
}
56 changes: 56 additions & 0 deletions packages/hot-wallet/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "hot-wallet",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/hot-wallet/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/hot-wallet",
"tsConfig": "packages/hot-wallet/tsconfig.lib.json",
"project": "packages/hot-wallet/package.json",
"entryFile": "packages/hot-wallet/src/index.ts",
"buildableProjectDepsInPackageJsonType": "dependencies",
"compiler": "babel",
"format": ["esm", "cjs"],
"assets": [
{
"glob": "packages/hot-wallet/README.md",
"input": ".",
"output": "."
},
{
"glob": "packages/hot-wallet/assets/*",
"input": ".",
"output": "assets"
}
]
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/hot-wallet/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/packages/hot-wallet"],
"options": {
"jestConfig": "packages/hot-wallet/jest.config.ts",
"passWithNoTests": true
}
},
"deploy": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public"
},
"dependsOn": ["^deploy"]
}
},
"tags": ["browser-wallet"]
}
1 change: 1 addition & 0 deletions packages/hot-wallet/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { setupHotWallet } from "./lib";
Loading
Loading