@reef-knot/wallet-adapter-okx 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,16 +1,6 @@
1
- import { WalletAdapterType } from '@reef-knot/types';
2
- import { Ethereum as EthereumTypeWagmi } from '@wagmi/core';
3
- declare module '@wagmi/core' {
4
- interface Ethereum {
5
- isOkxWallet?: true;
6
- }
7
- }
8
- declare global {
9
- interface Window {
10
- okxwallet?: EthereumTypeWagmi;
11
- }
12
- }
1
+ import type { WalletAdapterType } from '@reef-knot/types';
13
2
  export declare const id = "okx";
14
3
  export declare const name = "OKX Wallet";
4
+ export declare const rdns = "com.okex.wallet";
15
5
  export declare const Okx: WalletAdapterType;
16
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAK5D,OAAO,QAAQ,aAAa,CAAC;IAC3B,UAAU,QAAQ;QAChB,WAAW,CAAC,EAAE,IAAI,CAAC;KACpB;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,SAAS,CAAC,EAAE,iBAAiB,CAAC;KAC/B;CACF;AAED,eAAO,MAAM,EAAE,QAAQ,CAAC;AACxB,eAAO,MAAM,IAAI,eAAe,CAAC;AAkBjC,eAAO,MAAM,GAAG,EAAE,iBAgBhB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAS1D,eAAO,MAAM,EAAE,QAAQ,CAAC;AACxB,eAAO,MAAM,IAAI,eAAe,CAAC;AACjC,eAAO,MAAM,IAAI,oBAAoB,CAAC;AAQtC,eAAO,MAAM,GAAG,EAAE,iBAgBhB,CAAC"}
package/dist/index.js CHANGED
@@ -1,23 +1,17 @@
1
1
  import { injected } from 'wagmi/connectors';
2
2
  import Memo from './icons/okx.svg.js';
3
3
  import Memo$1 from './icons/okx-inverted.svg.js';
4
+ import { isProviderExistsEIP6963, getTargetEIP6963 } from '@reef-knot/wallets-helpers';
4
5
 
5
6
  const id = 'okx';
6
7
  const name = 'OKX Wallet';
8
+ const rdns = 'com.okex.wallet';
7
9
  const deeplinkDAppUrl = globalThis.window ? globalThis.window.location.host + globalThis.window.location.pathname : '';
8
10
  const deeplink = 'okx://wallet/dapp/url?dappUrl=' + deeplinkDAppUrl;
9
11
  const urlWithDeeplink = 'https://www.okx.com/download?deeplink=' + deeplink;
10
- const getOkxConnector = () => injected({
11
- target: () => ({
12
- id,
13
- name,
14
- provider: () => {
15
- var _a, _b;
16
- return ((_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.okxwallet) || ((_b = globalThis.window) === null || _b === void 0 ? void 0 : _b.ethereum);
17
- }
18
- })
19
- });
20
- const Okx = () => ({
12
+ const Okx = ({
13
+ providersStore
14
+ }) => ({
21
15
  walletName: name,
22
16
  walletId: id,
23
17
  type: injected.type,
@@ -25,15 +19,14 @@ const Okx = () => ({
25
19
  light: Memo,
26
20
  dark: Memo$1
27
21
  },
28
- detector: () => {
29
- var _a, _b, _c, _d;
30
- return !!((_b = (_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.okxwallet) === null || _b === void 0 ? void 0 : _b.isOkxWallet) || !!((_d = (_c = globalThis.window) === null || _c === void 0 ? void 0 : _c.ethereum) === null || _d === void 0 ? void 0 : _d.isOkxWallet);
31
- },
22
+ detector: () => isProviderExistsEIP6963(providersStore, rdns),
32
23
  downloadURLs: {
33
24
  default: 'https://www.okx.com/download'
34
25
  },
35
26
  deeplink: urlWithDeeplink,
36
- createConnectorFn: getOkxConnector()
27
+ createConnectorFn: injected({
28
+ target: () => getTargetEIP6963(providersStore, rdns)
29
+ })
37
30
  });
38
31
 
39
- export { Okx, id, name };
32
+ export { Okx, id, name, rdns };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/wallet-adapter-okx",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -32,13 +32,15 @@
32
32
  "lint": "eslint --ext ts,tsx,js,mjs ."
33
33
  },
34
34
  "devDependencies": {
35
- "@reef-knot/types": "^2.0.0",
35
+ "@reef-knot/types": "^2.1.0",
36
+ "@reef-knot/wallets-helpers": "^2.1.0",
36
37
  "@svgr/rollup": "^6.5.1",
37
38
  "eslint-config-custom": "*"
38
39
  },
39
40
  "peerDependencies": {
40
- "wagmi": "2.10.4",
41
- "@reef-knot/types": "^2.0.0",
41
+ "wagmi": "2.11.2",
42
+ "@reef-knot/types": "^2.0.1",
43
+ "@reef-knot/wallets-helpers": "^2.0.2",
42
44
  "@tanstack/react-query": "^5.29.0"
43
45
  }
44
46
  }