@reef-knot/wallet-adapter-okx 1.4.0 → 2.0.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,6 +1,5 @@
1
1
  import { WalletAdapterType } from '@reef-knot/types';
2
- import { Ethereum as EthereumTypeWagmi, Chain } from '@wagmi/core';
3
- import { InjectedConnector } from 'wagmi/connectors/injected';
2
+ import { Ethereum as EthereumTypeWagmi } from '@wagmi/core';
4
3
  declare module '@wagmi/core' {
5
4
  interface Ethereum {
6
5
  isOkxWallet?: true;
@@ -13,10 +12,5 @@ declare global {
13
12
  }
14
13
  export declare const id = "okx";
15
14
  export declare const name = "OKX Wallet";
16
- export declare class OkxConnector extends InjectedConnector {
17
- readonly id = "okx";
18
- readonly name = "OKX Wallet";
19
- constructor(chains: Chain[]);
20
- }
21
15
  export declare const Okx: WalletAdapterType;
22
16
  //# 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,KAAK,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAI9D,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;AAEjC,qBAAa,YAAa,SAAQ,iBAAiB;IACjD,QAAQ,CAAC,EAAE,SAAM;IACjB,QAAQ,CAAC,IAAI,gBAAQ;gBACT,MAAM,EAAE,KAAK,EAAE;CAS5B;AAED,eAAO,MAAM,GAAG,EAAE,iBAchB,CAAC"}
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"}
package/dist/index.js CHANGED
@@ -1,29 +1,26 @@
1
- import { InjectedConnector } from 'wagmi/connectors/injected';
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
4
 
5
5
  const id = 'okx';
6
6
  const name = 'OKX Wallet';
7
- class OkxConnector extends InjectedConnector {
8
- constructor(chains) {
9
- super({
10
- chains,
11
- options: {
12
- getProvider: () => {
13
- var _a, _b;
14
- return ((_a = globalThis.window) === null || _a === void 0 ? void 0 : _a.okxwallet) || ((_b = globalThis.window) === null || _b === void 0 ? void 0 : _b.ethereum);
15
- }
16
- }
17
- });
18
- this.id = id;
19
- this.name = name;
20
- }
21
- }
22
- const Okx = ({
23
- chains
24
- }) => ({
7
+ const deeplinkDAppUrl = globalThis.window ? globalThis.window.location.host + globalThis.window.location.pathname : '';
8
+ const deeplink = 'okx://wallet/dapp/url?dappUrl=' + deeplinkDAppUrl;
9
+ 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 = () => ({
25
21
  walletName: name,
26
22
  walletId: id,
23
+ type: injected.type,
27
24
  icon: {
28
25
  light: Memo,
29
26
  dark: Memo$1
@@ -35,7 +32,8 @@ const Okx = ({
35
32
  downloadURLs: {
36
33
  default: 'https://www.okx.com/download'
37
34
  },
38
- connector: new OkxConnector(chains)
35
+ deeplink: urlWithDeeplink,
36
+ createConnectorFn: getOkxConnector()
39
37
  });
40
38
 
41
- export { Okx, OkxConnector, id, name };
39
+ export { Okx, id, name };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reef-knot/wallet-adapter-okx",
3
- "version": "1.4.0",
3
+ "version": "2.0.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -32,12 +32,13 @@
32
32
  "lint": "eslint --ext ts,tsx,js,mjs ."
33
33
  },
34
34
  "devDependencies": {
35
- "@reef-knot/types": "^1.6.0",
35
+ "@reef-knot/types": "^2.0.0",
36
36
  "@svgr/rollup": "^6.5.1",
37
37
  "eslint-config-custom": "*"
38
38
  },
39
39
  "peerDependencies": {
40
- "wagmi": "^0.12.19",
41
- "@reef-knot/types": "^1.2.1"
40
+ "wagmi": "2.10.4",
41
+ "@reef-knot/types": "^2.0.0",
42
+ "@tanstack/react-query": "^5.29.0"
42
43
  }
43
44
  }