Skip to content

Commit

Permalink
feat: meteor wallet in app selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Elabar committed Jan 2, 2025
1 parent b67dbba commit f172cdc
Show file tree
Hide file tree
Showing 20 changed files with 466 additions and 0 deletions.
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": {}
}
]
}
61 changes: 61 additions & 0 deletions packages/meteor-wallet-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# @near-wallet-selector/meteor-wallet

This is the [Meteor Wallet](https://meteorwallet.app) 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/meteor-wallet

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

Then use it in your dApp:

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

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

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

## 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/meteor-icon.png`.
- `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/assets/meteor-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).
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

0 comments on commit f172cdc

Please sign in to comment.