-
Notifications
You must be signed in to change notification settings - Fork 163
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f172cdc
feat: meteor wallet in app selector
Elabar d7e5f73
chore: update readme
Elabar 3a83dd0
chore: code linting
Elabar 86655df
feat: use nonce instead of incremental promise id
Elabar 5cfc978
feat: allow post message for all sites, add a source tag in message
Elabar 2429bd6
feat: pass window location href
Elabar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@nrwl/js/babel", | ||
{ | ||
"useBuiltIns": "usage" | ||
} | ||
] | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { setupMeteorWalletApp } from "./lib/meteor-wallet-app"; |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what it means for it to be
in app only
Is this for a mobile app? or for a wallet embedded within apps?
If it is a mobile app, you could change it to: