@ckb-ccc/connector 0.0.3-alpha.0 → 0.0.3

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.
@@ -0,0 +1,2 @@
1
+ export declare const OKX_SVG: string;
2
+ //# sourceMappingURL=okx.svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"okx.svg.d.ts","sourceRoot":"","sources":["../../src/assets/okx.svg.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,QAEnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { encodeSvgToImgSrc } from "./utils";
2
+ export const OKX_SVG = encodeSvgToImgSrc('<svg width="1000" height="1000" viewBox="0 0 1000 1000" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="1000" height="1000" fill="black"/><path fill-rule="evenodd" clip-rule="evenodd" d="M393.949 218.518H231.049C224.129 218.518 218.519 224.128 218.519 231.048V393.948C218.519 400.869 224.129 406.479 231.049 406.479H393.949C400.87 406.479 406.48 400.869 406.48 393.948V231.048C406.48 224.128 400.87 218.518 393.949 218.518ZM581.992 406.479H419.092C412.172 406.479 406.561 412.09 406.561 419.01V581.91C406.561 588.831 412.172 594.441 419.092 594.441H581.992C588.913 594.441 594.523 588.831 594.523 581.91V419.01C594.523 412.09 588.913 406.479 581.992 406.479ZM606.974 218.518H769.874C776.794 218.518 782.405 224.128 782.405 231.048V393.948C782.405 400.869 776.794 406.479 769.874 406.479H606.974C600.053 406.479 594.443 400.869 594.443 393.948V231.048C594.443 224.128 600.053 218.518 606.974 218.518ZM393.95 594.442H231.049C224.129 594.442 218.519 600.052 218.519 606.973V769.873C218.519 776.793 224.129 782.404 231.049 782.404H393.95C400.87 782.404 406.48 776.793 406.48 769.873V606.973C406.48 600.052 400.87 594.442 393.95 594.442ZM606.974 594.442H769.874C776.794 594.442 782.405 600.052 782.405 606.973V769.873C782.405 776.793 776.794 782.404 769.874 782.404H606.974C600.053 782.404 594.443 776.793 594.443 769.873V606.973C594.443 600.052 600.053 594.442 606.974 594.442Z" fill="white"/></svg>');
@@ -0,0 +1,2 @@
1
+ export declare const UNI_SAT_SVG: string;
2
+ //# sourceMappingURL=uni-sat.svg.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uni-sat.svg.d.ts","sourceRoot":"","sources":["../../src/assets/uni-sat.svg.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,QAEvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { encodeSvgToImgSrc } from "./utils";
2
+ export const UNI_SAT_SVG = encodeSvgToImgSrc('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 115.77 147.7" xmlns:v="https://vecta.io/nano"><defs><linearGradient id="A" x1="106.985" y1="30.78" x2="13.053" y2="72.524" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#201c1b"/><stop offset=".36" stop-color="#77390d"/><stop offset=".67" stop-color="#ea8101"/><stop offset="1" stop-color="#f4b852"/></linearGradient><linearGradient id="B" x1="11.381" y1="118.167" x2="120.232" y2="85.771" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1f1d1c"/><stop offset=".37" stop-color="#77390d"/><stop offset=".67" stop-color="#ea8101"/><stop offset="1" stop-color="#f4fb52"/></linearGradient><radialGradient id="C" cx="53.01" cy="45.84" fx="53.01" fy="45.84" r="11.13" gradientTransform="translate(0 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f4b852"/><stop offset=".33" stop-color="#ea8101"/><stop offset=".64" stop-color="#77390d"/><stop offset="1" stop-color="#211c1d"/></radialGradient></defs><path d="M81.66 13.29l30.31 30.02c2.58 2.55 3.85 5.13 3.81 7.73s-1.15 4.97-3.32 7.12c-2.27 2.25-4.72 3.39-7.34 3.44-2.62.04-5.22-1.22-7.8-3.77l-31-30.7c-3.52-3.49-6.92-5.96-10.19-7.41s-6.71-1.68-10.31-.68c-3.61.99-7.48 3.54-11.63 7.64-5.72 5.67-8.45 10.99-8.17 15.96s3.12 10.13 8.51 15.46l31.25 30.96c2.61 2.58 3.89 5.16 3.85 7.72-.04 2.57-1.16 4.94-3.37 7.13-2.2 2.18-4.63 3.32-7.27 3.41s-5.27-1.16-7.87-3.74L20.81 73.56c-4.93-4.88-8.49-9.5-10.68-13.86s-3.01-9.29-2.44-14.79c.51-4.71 2.02-9.27 4.54-13.69 2.51-4.42 6.11-8.94 10.78-13.57 5.56-5.51 10.87-9.73 15.93-12.67C43.99 2.04 48.88.41 53.6.07c4.73-.34 9.39.6 14 2.82s9.29 5.68 14.05 10.4z" fill="url(#A)"/><path d="M34.11 134.42L3.81 104.4C1.23 101.84-.04 99.27 0 96.67s1.15-4.97 3.32-7.12c2.27-2.25 4.72-3.39 7.34-3.44 2.62-.04 5.22 1.21 7.8 3.77l30.99 30.7c3.53 3.49 6.92 5.96 10.19 7.41s6.71 1.67 10.32.68 7.48-3.54 11.63-7.65c5.72-5.67 8.45-10.99 8.17-15.96s-3.12-10.13-8.51-15.47L64.6 73.24c-2.61-2.58-3.89-5.16-3.85-7.72.04-2.57 1.16-4.94 3.37-7.13 2.2-2.18 4.63-3.32 7.27-3.41s5.27 1.16 7.87 3.74l15.7 15.41c4.93 4.88 8.49 9.5 10.68 13.86s3.01 9.29 2.44 14.79c-.51 4.71-2.02 9.27-4.54 13.69-2.51 4.42-6.11 8.94-10.78 13.57-5.56 5.51-10.87 9.73-15.93 12.67s-9.95 4.58-14.68 4.92-9.39-.6-14-2.82-9.29-5.68-14.05-10.4z" fill="url(#B)"/><circle cx="53.01" cy="45.83" r="11.13" fill="url(#C)"/></svg>');
@@ -0,0 +1,2 @@
1
+ export declare function encodeSvgToImgSrc(svg: string): string;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/assets/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,UAE5C"}
@@ -0,0 +1,3 @@
1
+ export function encodeSvgToImgSrc(svg) {
2
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
3
+ }
package/dist/barrel.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export * from "@ckb-ccc/ccc";
2
2
  export * from "./connector";
3
3
  export * from "./events";
4
- export * from "./signers";
5
4
  //# sourceMappingURL=barrel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../src/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
1
+ {"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../src/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC"}
package/dist/barrel.js CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "@ckb-ccc/ccc";
2
2
  export * from "./connector";
3
3
  export * from "./events";
4
- export * from "./signers";
@@ -1 +1 @@
1
- {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAM5C,qBACa,qBAAsB,SAAQ,UAAU;IAEnD,OAAO,CAAC,OAAO,CAAoB;IAG5B,MAAM,EAAE,OAAO,CAAS;IAE/B,iBAAiB,IAAI,IAAI;IAsBzB,MAAM,CAAC,MAAM,0BA+CX;IAEF,MAAM;CAoCP"}
1
+ {"version":3,"file":"connector.d.ts","sourceRoot":"","sources":["../src/connector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAO5C,qBACa,qBAAsB,SAAQ,UAAU;IAEnD,OAAO,CAAC,OAAO,CAAwB;IAGhC,MAAM,EAAE,OAAO,CAAS;IAE/B,iBAAiB,IAAI,IAAI;IAkDzB,MAAM,CAAC,MAAM,0BAmDX;IAEF,MAAM;CAoCP"}
package/dist/connector.js CHANGED
@@ -4,12 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { ClientPublicMainnet, Eip6963 } from "@ckb-ccc/ccc";
7
+ import { ccc } from "@ckb-ccc/ccc";
8
8
  import { LitElement, css, html } from "lit";
9
9
  import { customElement, property, state } from "lit/decorators.js";
10
10
  import { repeat } from "lit/directives/repeat.js";
11
+ import { OKX_SVG } from "./assets/okx.svg";
12
+ import { UNI_SAT_SVG } from "./assets/uni-sat.svg";
11
13
  import { CloseEvent, ConnectedEvent } from "./events";
12
- import { SignerType } from "./signers";
13
14
  let WebComponentConnector = class WebComponentConnector extends LitElement {
14
15
  constructor() {
15
16
  super(...arguments);
@@ -18,8 +19,34 @@ let WebComponentConnector = class WebComponentConnector extends LitElement {
18
19
  }
19
20
  connectedCallback() {
20
21
  super.connectedCallback();
21
- const client = new ClientPublicMainnet();
22
- const eip6963Manager = new Eip6963.SignerFactory(client);
22
+ const client = new ccc.ClientPublicTestnet();
23
+ const uniSatSigner = ccc.UniSat.getUniSatSigner(client);
24
+ if (uniSatSigner) {
25
+ this.signers = [
26
+ ...this.signers,
27
+ {
28
+ id: "uni-sat",
29
+ name: "BTC: UniSat",
30
+ icon: UNI_SAT_SVG,
31
+ type: ccc.SignerType.UniSat,
32
+ signer: uniSatSigner,
33
+ },
34
+ ];
35
+ }
36
+ const okxBitcoinSigner = ccc.Okx.getOKXBitcoinSigner(client);
37
+ if (okxBitcoinSigner) {
38
+ this.signers = [
39
+ ...this.signers,
40
+ {
41
+ id: "okx-bitcoin",
42
+ name: "BTC: OKX",
43
+ icon: OKX_SVG,
44
+ type: ccc.SignerType.OkxBitcoin,
45
+ signer: okxBitcoinSigner,
46
+ },
47
+ ];
48
+ }
49
+ const eip6963Manager = new ccc.Eip6963.SignerFactory(client);
23
50
  eip6963Manager.subscribeSigners((signer) => {
24
51
  if (this.signers.some((s) => s.id === signer.detail.info.uuid)) {
25
52
  return;
@@ -28,9 +55,9 @@ let WebComponentConnector = class WebComponentConnector extends LitElement {
28
55
  ...this.signers,
29
56
  {
30
57
  id: signer.detail.info.uuid,
31
- name: signer.detail.info.name,
58
+ name: `ETH: ${signer.detail.info.name}`,
32
59
  icon: signer.detail.info.icon,
33
- type: SignerType.Eip6963,
60
+ type: ccc.SignerType.Eip6963,
34
61
  signer,
35
62
  },
36
63
  ];
@@ -62,7 +89,7 @@ let WebComponentConnector = class WebComponentConnector extends LitElement {
62
89
  }}
63
90
  >
64
91
  <img src=${signer.icon} alt=${signer.name} />
65
- Connect ${signer.name}
92
+ ${signer.name}
66
93
  </button>
67
94
  `)}
68
95
  </div>
@@ -102,18 +129,22 @@ WebComponentConnector.styles = css `
102
129
  }
103
130
 
104
131
  .wallet-button {
132
+ width: 100%;
105
133
  display: flex;
106
134
  align-items: center;
107
- justify-content: center;
135
+ justify-content: start;
108
136
  padding: 0.75rem 1.25rem;
109
137
  color: #fff;
110
138
  background: #000;
111
139
  background-image: none;
112
140
  border-radius: 9999px;
113
141
  border: none;
142
+ margin-bottom: 0.5rem;
114
143
  }
115
144
 
116
145
  .wallet-button img {
146
+ width: 1.5rem;
147
+ height: 1.5rem;
117
148
  padding-right: 0.5rem;
118
149
  }
119
150
  `;
package/dist/events.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SignerInfo } from "./signers";
1
+ import { SignerInfo } from "@ckb-ccc/ccc";
2
2
  export declare class ConnectedEvent extends Event {
3
3
  readonly signerInfo: SignerInfo;
4
4
  constructor(signerInfo: SignerInfo);
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,qBAAa,cAAe,SAAQ,KAAK;aACX,UAAU,EAAE,UAAU;gBAAtB,UAAU,EAAE,UAAU;CAGnD;AAED,qBAAa,UAAW,SAAQ,KAAK;;CAIpC"}
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,qBAAa,cAAe,SAAQ,KAAK;aACX,UAAU,EAAE,UAAU;gBAAtB,UAAU,EAAE,UAAU;CAGnD;AAED,qBAAa,UAAW,SAAQ,KAAK;;CAIpC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckb-ccc/connector",
3
- "version": "0.0.3-alpha.0",
3
+ "version": "0.0.3",
4
4
  "description": "Common Chains Connector UI",
5
5
  "author": "Hanssen0 <hanssen0@hanssen0.com>",
6
6
  "license": "MIT",
@@ -37,8 +37,8 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@ckb-ccc/ccc": "0.0.3-alpha.0",
40
+ "@ckb-ccc/ccc": "0.0.3",
41
41
  "lit": "^3.1.3"
42
42
  },
43
- "gitHead": "4a995208e5135d11e9f72b9a9fd73174a3056fc7"
43
+ "gitHead": "9df1bbe0007136568914d8a73fe39f898d636a12"
44
44
  }
@@ -0,0 +1,5 @@
1
+ import { encodeSvgToImgSrc } from "./utils";
2
+
3
+ export const OKX_SVG = encodeSvgToImgSrc(
4
+ '<svg width="1000" height="1000" viewBox="0 0 1000 1000" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="1000" height="1000" fill="black"/><path fill-rule="evenodd" clip-rule="evenodd" d="M393.949 218.518H231.049C224.129 218.518 218.519 224.128 218.519 231.048V393.948C218.519 400.869 224.129 406.479 231.049 406.479H393.949C400.87 406.479 406.48 400.869 406.48 393.948V231.048C406.48 224.128 400.87 218.518 393.949 218.518ZM581.992 406.479H419.092C412.172 406.479 406.561 412.09 406.561 419.01V581.91C406.561 588.831 412.172 594.441 419.092 594.441H581.992C588.913 594.441 594.523 588.831 594.523 581.91V419.01C594.523 412.09 588.913 406.479 581.992 406.479ZM606.974 218.518H769.874C776.794 218.518 782.405 224.128 782.405 231.048V393.948C782.405 400.869 776.794 406.479 769.874 406.479H606.974C600.053 406.479 594.443 400.869 594.443 393.948V231.048C594.443 224.128 600.053 218.518 606.974 218.518ZM393.95 594.442H231.049C224.129 594.442 218.519 600.052 218.519 606.973V769.873C218.519 776.793 224.129 782.404 231.049 782.404H393.95C400.87 782.404 406.48 776.793 406.48 769.873V606.973C406.48 600.052 400.87 594.442 393.95 594.442ZM606.974 594.442H769.874C776.794 594.442 782.405 600.052 782.405 606.973V769.873C782.405 776.793 776.794 782.404 769.874 782.404H606.974C600.053 782.404 594.443 776.793 594.443 769.873V606.973C594.443 600.052 600.053 594.442 606.974 594.442Z" fill="white"/></svg>',
5
+ );
@@ -0,0 +1,5 @@
1
+ import { encodeSvgToImgSrc } from "./utils";
2
+
3
+ export const UNI_SAT_SVG = encodeSvgToImgSrc(
4
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 115.77 147.7" xmlns:v="https://vecta.io/nano"><defs><linearGradient id="A" x1="106.985" y1="30.78" x2="13.053" y2="72.524" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#201c1b"/><stop offset=".36" stop-color="#77390d"/><stop offset=".67" stop-color="#ea8101"/><stop offset="1" stop-color="#f4b852"/></linearGradient><linearGradient id="B" x1="11.381" y1="118.167" x2="120.232" y2="85.771" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#1f1d1c"/><stop offset=".37" stop-color="#77390d"/><stop offset=".67" stop-color="#ea8101"/><stop offset="1" stop-color="#f4fb52"/></linearGradient><radialGradient id="C" cx="53.01" cy="45.84" fx="53.01" fy="45.84" r="11.13" gradientTransform="translate(0 0)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#f4b852"/><stop offset=".33" stop-color="#ea8101"/><stop offset=".64" stop-color="#77390d"/><stop offset="1" stop-color="#211c1d"/></radialGradient></defs><path d="M81.66 13.29l30.31 30.02c2.58 2.55 3.85 5.13 3.81 7.73s-1.15 4.97-3.32 7.12c-2.27 2.25-4.72 3.39-7.34 3.44-2.62.04-5.22-1.22-7.8-3.77l-31-30.7c-3.52-3.49-6.92-5.96-10.19-7.41s-6.71-1.68-10.31-.68c-3.61.99-7.48 3.54-11.63 7.64-5.72 5.67-8.45 10.99-8.17 15.96s3.12 10.13 8.51 15.46l31.25 30.96c2.61 2.58 3.89 5.16 3.85 7.72-.04 2.57-1.16 4.94-3.37 7.13-2.2 2.18-4.63 3.32-7.27 3.41s-5.27-1.16-7.87-3.74L20.81 73.56c-4.93-4.88-8.49-9.5-10.68-13.86s-3.01-9.29-2.44-14.79c.51-4.71 2.02-9.27 4.54-13.69 2.51-4.42 6.11-8.94 10.78-13.57 5.56-5.51 10.87-9.73 15.93-12.67C43.99 2.04 48.88.41 53.6.07c4.73-.34 9.39.6 14 2.82s9.29 5.68 14.05 10.4z" fill="url(#A)"/><path d="M34.11 134.42L3.81 104.4C1.23 101.84-.04 99.27 0 96.67s1.15-4.97 3.32-7.12c2.27-2.25 4.72-3.39 7.34-3.44 2.62-.04 5.22 1.21 7.8 3.77l30.99 30.7c3.53 3.49 6.92 5.96 10.19 7.41s6.71 1.67 10.32.68 7.48-3.54 11.63-7.65c5.72-5.67 8.45-10.99 8.17-15.96s-3.12-10.13-8.51-15.47L64.6 73.24c-2.61-2.58-3.89-5.16-3.85-7.72.04-2.57 1.16-4.94 3.37-7.13 2.2-2.18 4.63-3.32 7.27-3.41s5.27 1.16 7.87 3.74l15.7 15.41c4.93 4.88 8.49 9.5 10.68 13.86s3.01 9.29 2.44 14.79c-.51 4.71-2.02 9.27-4.54 13.69-2.51 4.42-6.11 8.94-10.78 13.57-5.56 5.51-10.87 9.73-15.93 12.67s-9.95 4.58-14.68 4.92-9.39-.6-14-2.82-9.29-5.68-14.05-10.4z" fill="url(#B)"/><circle cx="53.01" cy="45.83" r="11.13" fill="url(#C)"/></svg>',
5
+ );
@@ -0,0 +1,3 @@
1
+ export function encodeSvgToImgSrc(svg: string) {
2
+ return `data:image/svg+xml,${encodeURIComponent(svg)}`;
3
+ }
package/src/barrel.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export * from "@ckb-ccc/ccc";
2
2
  export * from "./connector";
3
3
  export * from "./events";
4
- export * from "./signers";
package/src/connector.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { ClientPublicMainnet, Eip6963 } from "@ckb-ccc/ccc";
1
+ import { ccc } from "@ckb-ccc/ccc";
2
2
  import { LitElement, css, html } from "lit";
3
3
  import { customElement, property, state } from "lit/decorators.js";
4
4
  import { repeat } from "lit/directives/repeat.js";
5
+ import { OKX_SVG } from "./assets/okx.svg";
6
+ import { UNI_SAT_SVG } from "./assets/uni-sat.svg";
5
7
  import { CloseEvent, ConnectedEvent } from "./events";
6
- import { SignerInfo, SignerType } from "./signers";
7
8
 
8
9
  @customElement("ccc-connector")
9
10
  export class WebComponentConnector extends LitElement {
10
11
  @state()
11
- private signers: SignerInfo[] = [];
12
+ private signers: ccc.SignerInfo[] = [];
12
13
 
13
14
  @property()
14
15
  public isOpen: boolean = false;
@@ -16,8 +17,36 @@ export class WebComponentConnector extends LitElement {
16
17
  connectedCallback(): void {
17
18
  super.connectedCallback();
18
19
 
19
- const client = new ClientPublicMainnet();
20
- const eip6963Manager = new Eip6963.SignerFactory(client);
20
+ const client = new ccc.ClientPublicTestnet();
21
+ const uniSatSigner = ccc.UniSat.getUniSatSigner(client);
22
+ if (uniSatSigner) {
23
+ this.signers = [
24
+ ...this.signers,
25
+ {
26
+ id: "uni-sat",
27
+ name: "BTC: UniSat",
28
+ icon: UNI_SAT_SVG,
29
+ type: ccc.SignerType.UniSat,
30
+ signer: uniSatSigner,
31
+ },
32
+ ];
33
+ }
34
+
35
+ const okxBitcoinSigner = ccc.Okx.getOKXBitcoinSigner(client);
36
+ if (okxBitcoinSigner) {
37
+ this.signers = [
38
+ ...this.signers,
39
+ {
40
+ id: "okx-bitcoin",
41
+ name: "BTC: OKX",
42
+ icon: OKX_SVG,
43
+ type: ccc.SignerType.OkxBitcoin,
44
+ signer: okxBitcoinSigner,
45
+ },
46
+ ];
47
+ }
48
+
49
+ const eip6963Manager = new ccc.Eip6963.SignerFactory(client);
21
50
  eip6963Manager.subscribeSigners((signer) => {
22
51
  if (this.signers.some((s) => s.id === signer.detail.info.uuid)) {
23
52
  return;
@@ -26,9 +55,9 @@ export class WebComponentConnector extends LitElement {
26
55
  ...this.signers,
27
56
  {
28
57
  id: signer.detail.info.uuid,
29
- name: signer.detail.info.name,
58
+ name: `ETH: ${signer.detail.info.name}`,
30
59
  icon: signer.detail.info.icon,
31
- type: SignerType.Eip6963,
60
+ type: ccc.SignerType.Eip6963,
32
61
  signer,
33
62
  },
34
63
  ];
@@ -68,18 +97,22 @@ export class WebComponentConnector extends LitElement {
68
97
  }
69
98
 
70
99
  .wallet-button {
100
+ width: 100%;
71
101
  display: flex;
72
102
  align-items: center;
73
- justify-content: center;
103
+ justify-content: start;
74
104
  padding: 0.75rem 1.25rem;
75
105
  color: #fff;
76
106
  background: #000;
77
107
  background-image: none;
78
108
  border-radius: 9999px;
79
109
  border: none;
110
+ margin-bottom: 0.5rem;
80
111
  }
81
112
 
82
113
  .wallet-button img {
114
+ width: 1.5rem;
115
+ height: 1.5rem;
83
116
  padding-right: 0.5rem;
84
117
  }
85
118
  `;
@@ -113,7 +146,7 @@ export class WebComponentConnector extends LitElement {
113
146
  }}
114
147
  >
115
148
  <img src=${signer.icon} alt=${signer.name} />
116
- Connect ${signer.name}
149
+ ${signer.name}
117
150
  </button>
118
151
  `,
119
152
  )}
package/src/events.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SignerInfo } from "./signers";
1
+ import { SignerInfo } from "@ckb-ccc/ccc";
2
2
 
3
3
  export class ConnectedEvent extends Event {
4
4
  constructor(public readonly signerInfo: SignerInfo) {
package/dist/signers.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { Signer } from "@ckb-ccc/ccc";
2
- export declare enum SignerType {
3
- Eip6963 = "Eip6963"
4
- }
5
- export declare class SignerInfo {
6
- type: SignerType;
7
- id: string;
8
- name: string;
9
- icon: string;
10
- signer: Signer;
11
- constructor(type: SignerType, id: string, name: string, icon: string, signer: Signer);
12
- }
13
- //# sourceMappingURL=signers.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"signers.d.ts","sourceRoot":"","sources":["../src/signers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,oBAAY,UAAU;IACpB,OAAO,YAAY;CACpB;AAED,qBAAa,UAAU;IAEZ,IAAI,EAAE,UAAU;IAChB,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;gBAJd,IAAI,EAAE,UAAU,EAChB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM;CAExB"}
package/dist/signers.js DELETED
@@ -1,13 +0,0 @@
1
- export var SignerType;
2
- (function (SignerType) {
3
- SignerType["Eip6963"] = "Eip6963";
4
- })(SignerType || (SignerType = {}));
5
- export class SignerInfo {
6
- constructor(type, id, name, icon, signer) {
7
- this.type = type;
8
- this.id = id;
9
- this.name = name;
10
- this.icon = icon;
11
- this.signer = signer;
12
- }
13
- }
package/src/signers.ts DELETED
@@ -1,15 +0,0 @@
1
- import { Signer } from "@ckb-ccc/ccc";
2
-
3
- export enum SignerType {
4
- Eip6963 = "Eip6963",
5
- }
6
-
7
- export class SignerInfo {
8
- constructor(
9
- public type: SignerType,
10
- public id: string,
11
- public name: string,
12
- public icon: string,
13
- public signer: Signer,
14
- ) {}
15
- }