Skip to content

Commit

Permalink
Merge pull request #1112 from near/dev
Browse files Browse the repository at this point in the history
* feat: integrate okx wallet
* feat: move import pos
* feat: add Safari & Edge downloadUrl for okx wallet
* chore: Bump version 8.9.9 for OKX Wallet (#1111)
* docs: add OKX to the readme
* chore: bump version to 8.9.9

---------

Co-authored-by: quanquan.luo <[email protected]>
Co-authored-by: okxwallet <[email protected]>
  • Loading branch information
3 people authored Jun 16, 2024
2 parents ae7f7ac + b1a936e commit 6e1276a
Show file tree
Hide file tree
Showing 46 changed files with 743 additions and 26 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ NEAR Wallet Selector makes it easy for users to interact with your dApp by provi
- [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.
- [Metamask Snap](https://www.npmjs.com/package/@near-wallet-selector/near-snap) - Injected wallet.
- [OKX Wallet](https://www.npmjs.com/package/@near-wallet-selector/okx-wallet) - Injected wallet.
- [Narwallets](https://www.npmjs.com/package/@near-wallet-selector/narwallets) - Injected wallet.
- [WELLDONE Wallet](https://www.npmjs.com/package/@near-wallet-selector/welldone-wallet) - Injected wallet.
- [Coin98 Wallet](https://www.npmjs.com/package/@near-wallet-selector/coin98-wallet) - Injected wallet.
Expand Down Expand Up @@ -61,6 +62,7 @@ yarn add \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/okx-wallet \
@near-wallet-selector/narwallets \
@near-wallet-selector/welldone-wallet \
@near-wallet-selector/near-snap \
Expand All @@ -83,6 +85,7 @@ npm install \
@near-wallet-selector/math-wallet \
@near-wallet-selector/nightly \
@near-wallet-selector/meteor-wallet \
@near-wallet-selector/okx-wallet \
@near-wallet-selector/narwallets \
@near-wallet-selector/welldone-wallet \
@near-wallet-selector/near-snap \
Expand Down Expand Up @@ -119,6 +122,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 { setupOkxWallet } from "@near-wallet-selector/okx-wallet";
import { setupNarwallets } from "@near-wallet-selector/narwallets";
import { setupWelldoneWallet } from "@near-wallet-selector/welldone-wallet";
import { setupNearSnap } from "@near-wallet-selector/near-snap";
Expand All @@ -143,6 +147,7 @@ const selector = await setupWalletSelector({
setupNightly(),
setupMeteorWallet(),
setupNearSnap(),
setupOkxWallet(),
setupNarwallets(),
setupWelldoneWallet(),
setupLedger(),
Expand Down
5 changes: 5 additions & 0 deletions examples/angular/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@
"glob": "**/*",
"input": "packages/near-mobile-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/okx-wallet/assets/",
"output": "assets/"
}
],
"styles": ["examples/angular/src/styles.scss"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupLedger } from "@near-wallet-selector/ledger";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupOKXWallet } from "@near-wallet-selector/okx-wallet";
import { CONTRACT_ID } from "../../../constants";

declare global {
Expand Down Expand Up @@ -63,6 +64,7 @@ export class WalletSelectorComponent implements OnInit {
setupMathWallet(),
setupNightly(),
setupMeteorWallet(),
setupOKXWallet(),
setupNarwallets(),
setupWelldoneWallet(),
setupHereWallet(),
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 @@ -21,6 +21,7 @@ import { setupXDEFI } from "@near-wallet-selector/xdefi";
import { setupRamperWallet } from "@near-wallet-selector/ramper-wallet";
import { setupNearMobileWallet } from "@near-wallet-selector/near-mobile-wallet";
import { setupMintbaseWallet } from "@near-wallet-selector/mintbase-wallet";
import { setupOKXWallet } from "@near-wallet-selector/okx-wallet";

import type { ReactNode } from "react";
import React, {
Expand Down Expand Up @@ -73,6 +74,7 @@ export const WalletSelectorContextProvider: React.FC<{
setupNightly(),
setupMeteorWallet(),
setupNearSnap(),
setupOKXWallet(),
setupNarwallets(),
setupWelldoneWallet(),
setupHereWallet(),
Expand Down
5 changes: 5 additions & 0 deletions examples/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
"glob": "**/*",
"input": "packages/near-mobile-wallet/assets/",
"output": "assets/"
},
{
"glob": "**/*",
"input": "packages/okx-wallet/assets/",
"output": "assets/"
}
]
},
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "near-wallet-selector",
"version": "8.9.8",
"version": "8.9.9",
"description": "NEAR Wallet Selector makes it easy for users to interact with your dApp by providing an abstraction over various wallets within the NEAR ecosystem",
"keywords": [
"near",
Expand All @@ -23,7 +23,8 @@
"welldone-wallet",
"ramper-wallet",
"near-mobile-wallet",
"mintbase-wallet"
"mintbase-wallet",
"okx-wallet"
],
"homepage": "https://github.com/near/wallet-selector#README",
"bugs": {
Expand Down Expand Up @@ -64,6 +65,7 @@
"build:ramper-wallet": "nx run-many --target=build --projects=ramper-wallet --configuration=production",
"build:near-mobile-wallet": "nx run-many --target=build --projects=near-mobile-wallet --configuration=production",
"build:mintbase-wallet": "nx run-many --target=build --projects=mintbase-wallet --configuration=production",
"build:okx-wallet": "nx run-many --target=build --projects=okx-wallet --configuration=production",
"examples:vanillajs:generateimportmap": "(cd examples/vanillajs && jspm link index.html -o index.html)",
"serve:vanillajs": "yarn examples:vanillajs:generateimportmap && http-server -c-1 examples/vanillajs",
"lint": "nx workspace-lint && nx run-many --target=lint --all --parallel",
Expand Down
2 changes: 1 addition & 1 deletion packages/account-export/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/account-export",
"version": "8.9.8",
"version": "8.9.9",
"description": "This is the Export Selector UI package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/bitget-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/bitget-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "Bitget wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/coin98-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/coin98-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "Coin 98 wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/core",
"version": "8.9.8",
"version": "8.9.9",
"description": "This is the core package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/here-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/here-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "Here wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/ledger/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/ledger",
"version": "8.9.8",
"version": "8.9.9",
"description": "Ledger package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/math-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/math-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "Math wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/meteor-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/meteor-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "Meteor wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/mintbase-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/mintbase-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "Mintbase wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/modal-ui-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/modal-ui-js",
"version": "8.9.8",
"version": "8.9.9",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/modal-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/modal-ui",
"version": "8.9.8",
"version": "8.9.9",
"description": "Modal UI package for NEAR wallet Selector",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/my-near-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/my-near-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "My Near Wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/narwallets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/narwallets",
"version": "8.9.8",
"version": "8.9.9",
"description": "This is the Narwallets package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/near-mobile-wallet/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/near-mobile-wallet",
"version": "8.9.8",
"version": "8.9.9",
"description": "NEAR Mobile wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/near-snap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/near-snap",
"version": "8.9.8",
"version": "8.9.9",
"description": "Metamask snap to interact with Near dapps.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/nearfi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/nearfi",
"version": "8.9.8",
"version": "8.9.9",
"description": "Nearfi package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
2 changes: 1 addition & 1 deletion packages/neth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/neth",
"version": "8.9.8",
"version": "8.9.9",
"description": "Control NEAR accounts with ETH accounts",
"author": "mattlockyer",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/nightly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@near-wallet-selector/nightly",
"version": "8.9.8",
"version": "8.9.9",
"description": "Nightly wallet package for NEAR Wallet Selector.",
"keywords": [
"near",
Expand Down
10 changes: 10 additions & 0 deletions packages/okx-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/okx-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": {}
}
]
}
71 changes: 71 additions & 0 deletions packages/okx-wallet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# @near-wallet-selector/okx-wallet

This is the [OKX Wallet](https://chromewebstore.google.com/detail/%E6%AC%A7%E6%98%93-web3-%E9%92%B1%E5%8C%85/mcohilncbfahbmgdjkbpemcciiolgcge) package for NEAR Wallet Selector.

## Install OKX Wallet

- [Chrome](https://chromewebstore.google.com/detail/%E6%AC%A7%E6%98%93-web3-%E9%92%B1%E5%8C%85/mcohilncbfahbmgdjkbpemcciiolgcge)
- [Safari](https://apps.apple.com/us/app/okx-wallet/id6463797825)
- [Edge](https://microsoftedge.microsoft.com/addons/detail/%E6%AC%A7%E6%98%93-web3-%E9%92%B1%E5%8C%85/pbpjkcldjiffchgbbndmhojiacbgflha)

## 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/okx-wallet

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

Then use it in your dApp:

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

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

const selector = await setupWalletSelector({
network: "mainnet", // OKX Wallet only supports NEAR Mainnet at the moment.
modules: [okxWallet],
});
```

## Options

- `iconUrl`: (`string?`): Image URL for the icon shown in the modal. This can also be a relative path or base64 encoded image. Defaults is `./assets/okx-wallet.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 { setupOKXWallet } from "@near-wallet-selector/okx-wallet";
import okxIconUrl from "@near-wallet-selector/okx-wallet/assets/okx-wallet.png";

const okxWallet = setupOKXWallet({
iconUrl: okxIconUrl
});
```

## Tip

OKX Wallet only supports NEAR Mainnet at the moment.

## License

This repository is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
Binary file added packages/okx-wallet/assets/okx-wallet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions packages/okx-wallet/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/* eslint-disable */
export default {
displayName: "okx-wallet",
preset: "../../jest.preset.js",
globals: {},
transform: {
"^.+\\.[tj]s$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.spec.json",
},
],
},
moduleFileExtensions: ["ts", "tsx", "js", "jsx"],
coverageDirectory: "../../coverage/packages/okx-wallet",
};
Loading

0 comments on commit 6e1276a

Please sign in to comment.