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 support for meteor wallet mobile app #1275

Open
wants to merge 5 commits into
base: dev
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,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.
- [Metamask Snap](https://www.npmjs.com/package/@near-wallet-selector/near-snap) - Injected wallet.
- [Meteor Wallet](https://www.npmjs.com/package/@near-wallet-selector/meteor-wallet) - Injected wallet.
- [Meteor Wallet App](https://www.npmjs.com/package/@near-wallet-selector/meteor-wallet-app) - Instant link wallet.
- [Mintbase Wallet](https://www.npmjs.com/package/@near-wallet-selector/mintbase-wallet) - Browser wallet.
- [My NEAR Wallet](https://www.npmjs.com/package/@near-wallet-selector/my-near-wallet) - Browser wallet.
- [Narwallets](https://www.npmjs.com/package/@near-wallet-selector/narwallets) - Injected wallet.
Expand Down Expand Up @@ -64,6 +65,7 @@ yarn add \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/meteor-wallet-app \
@near-wallet-selector/okx-wallet \
@near-wallet-selector/narwallets \
@near-wallet-selector/welldone-wallet \
Expand Down Expand Up @@ -91,6 +93,7 @@ npm install \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/meteor-wallet-app \
@near-wallet-selector/okx-wallet \
@near-wallet-selector/narwallets \
@near-wallet-selector/welldone-wallet \
Expand Down Expand Up @@ -131,6 +134,7 @@ import { setupNearSnap } from "@near-wallet-selector/near-snap";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupOkxWallet } from "@near-wallet-selector/okx-wallet";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
Expand All @@ -156,6 +160,7 @@ const selector = await setupWalletSelector({
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: "guest-book.testnet" }),
setupNearSnap(),
setupOkxWallet(),
setupNarwallets(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
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";
Expand Down Expand Up @@ -63,6 +64,7 @@ export class WalletSelectorExportComponent implements OnInit {
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupNarwallets(),
setupWelldoneWallet(),
setupHereWallet(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupNightly } from "@near-wallet-selector/nightly";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
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";
Expand Down Expand Up @@ -122,6 +123,7 @@ export class WalletSelectorComponent implements OnInit {
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupOKXWallet(),
setupNarwallets(),
setupWelldoneWallet(),
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 @@ -8,6 +8,7 @@ import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupHereWallet } from "@near-wallet-selector/here-wallet";
import { setupMathWallet } from "@near-wallet-selector/math-wallet";
import { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import type { WalletSelectorModal } from "@near-wallet-selector/modal-ui";
import { setupModal } from "@near-wallet-selector/modal-ui";
Expand Down Expand Up @@ -162,6 +163,7 @@ export const WalletSelectorContextProvider: React.FC<{
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupNearSnap(),
setupOKXWallet(),
setupNarwallets(),
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 @@ -17,6 +17,7 @@ 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";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNearFi } from "@near-wallet-selector/nearfi";
import { setupWalletConnect } from "@near-wallet-selector/wallet-connect";
Expand Down Expand Up @@ -67,6 +68,7 @@ export const ExportAccountSelectorContextProvider: React.FC<{
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupMeteorWalletApp({ contractId: CONTRACT_ID }),
setupWelldoneWallet(),
setupHereWallet(),
setupCoin98Wallet(),
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
"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:meteor-wallet": "nx run-many --target=build --projects=meteor-wallet --configuration=production",
"build:meteor-wallet-app": "nx run-many --target=build --projects=meteor-wallet-app --configuration=production",
"build:mintbase-wallet": "nx run-many --target=build --projects=mintbase-wallet --configuration=production",
"build:bitte-wallet": "nx run-many --target=build --projects=bitte-wallet --configuration=production",
"build:modal-ui": "nx run-many --target=build --projects=modal-ui --configuration=production",
Expand Down
10 changes: 10 additions & 0 deletions packages/meteor-wallet-app/.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/meteor-wallet-app/.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": {}
}
]
}
66 changes: 66 additions & 0 deletions packages/meteor-wallet-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# @near-wallet-selector/meteor-wallet-app

This is the [Meteor Wallet (for in app only)](https://meteorwallet.app) package for NEAR Wallet Selector.

If you are looking for NEAR Wallet Selector for Meteor Web or extension, please check out `@near-wallet-selector/meteor-wallet` instead.

## 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/meteor-wallet-app

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

Then use it in your dApp:

```ts
import { setupWalletSelector } from "@near-wallet-selector/core";
import { setupMeteorWalletApp } from "@near-wallet-selector/meteor-wallet-app";

// Meteor App for Wallet Selector must setup with contractId and take few optional params, see options below.
const meteorWallet = setupMeteorWalletApp({
contractId: "guest-book.testnet", // required
iconUrl: "https://<Wallet Icon URL Here>" // optional
deprecated: false // optional
});

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

## Options

- `contractId`: (`string`): The contract ID your DApp is interacting with.
- `iconUrl`: (`string?`): Image URL for the icon shown in the modal. This can also be a relative path or base64 encoded image.
- `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 { setupMeteorWallet } from "@near-wallet-selector/meteor-wallet";
import meteorIconUrl from "@near-wallet-selector/meteor-wallet-app/assets/meteor-app-icon.png";

const meteorWallet = setupMeteorWallet({
iconUrl: meteorIconUrl
});
```

## 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.
14 changes: 14 additions & 0 deletions packages/meteor-wallet-app/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
displayName: "meteor-wallet-app",
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/meteor-wallet-app",
};
16 changes: 16 additions & 0 deletions packages/meteor-wallet-app/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: "meteor-wallet-app",
preset: "../../jest.preset.js",
globals: {},
transform: {
"^.+\\.[tj]s$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.spec.json",
},
],
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/meteor-wallet-app",
};
24 changes: 24 additions & 0 deletions packages/meteor-wallet-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "@near-wallet-selector/meteor-wallet-app",
"version": "8.9.15",
"description": "Meteor wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
"blockchain",
"wallets",
"dapps",
"near-protocol",
"near-blockchain",
"wallet selector",
"injected wallet",
"meteor 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/meteor-wallet-app"
}
51 changes: 51 additions & 0 deletions packages/meteor-wallet-app/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "meteor-wallet-app",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "packages/meteor-wallet-app/src",
"projectType": "library",
"targets": {
"build": {
"executor": "@nrwl/rollup:rollup",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/packages/meteor-wallet-app",
"tsConfig": "packages/meteor-wallet-app/tsconfig.lib.json",
"project": "packages/meteor-wallet-app/package.json",
"entryFile": "packages/meteor-wallet-app/src/index.ts",
"buildableProjectDepsInPackageJsonType": "dependencies",
"compiler": "babel",
"format": ["esm", "cjs"],
"assets": [
{
"glob": "packages/meteor-wallet-app/README.md",
"input": ".",
"output": "."
}
]
}
},
"lint": {
"executor": "@nx/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/meteor-wallet-app/**/*.ts"]
}
},
"test": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/packages/meteor-wallet-app"],
"options": {
"jestConfig": "packages/meteor-wallet-app/jest.config.ts",
"passWithNoTests": true
}
},
"deploy": {
"executor": "ngx-deploy-npm:deploy",
"options": {
"access": "public"
},
"dependsOn": ["^deploy"]
}
},
"tags": ["injected-wallet"]
}
1 change: 1 addition & 0 deletions packages/meteor-wallet-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { setupMeteorWalletApp } from "./lib/meteor-wallet-app";
1 change: 1 addition & 0 deletions packages/meteor-wallet-app/src/lib/icon.ts

Large diffs are not rendered by default.

Loading
Loading