@ckb-ccc/eip6963 1.0.32 → 1.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/advanced.d.mts +2 -0
  3. package/dist/advanced.mjs +2 -0
  4. package/dist/advanced.mjs.map +1 -0
  5. package/dist/barrel.d.mts +67 -0
  6. package/dist/barrel.d.mts.map +1 -0
  7. package/dist/barrel.mjs +2 -0
  8. package/dist/barrel.mjs.map +1 -0
  9. package/dist/eip6963.advanced-C3p1YxLI.d.mts +128 -0
  10. package/dist/eip6963.advanced-C3p1YxLI.d.mts.map +1 -0
  11. package/dist/index.d.mts +2 -0
  12. package/dist/index.mjs +1 -0
  13. package/dist/rolldown-runtime-DK3Fl9T5.mjs +1 -0
  14. package/dist.commonjs/advanced.d.ts +2 -3
  15. package/dist.commonjs/advanced.js +2 -38
  16. package/dist.commonjs/advanced.js.map +1 -0
  17. package/dist.commonjs/barrel.d.ts +66 -2
  18. package/dist.commonjs/barrel.d.ts.map +1 -1
  19. package/dist.commonjs/barrel.js +2 -18
  20. package/dist.commonjs/barrel.js.map +1 -0
  21. package/dist.commonjs/eip6963.advanced-BMWmWvgB.d.ts +128 -0
  22. package/dist.commonjs/eip6963.advanced-BMWmWvgB.d.ts.map +1 -0
  23. package/dist.commonjs/index.d.ts +2 -2
  24. package/dist.commonjs/index.js +1 -37
  25. package/dist.commonjs/rolldown-runtime-BIInC43l.js +1 -0
  26. package/package.json +24 -21
  27. package/tsdown.config.mts +42 -0
  28. package/dist/advanced.d.ts +0 -3
  29. package/dist/advanced.d.ts.map +0 -1
  30. package/dist/advanced.js +0 -2
  31. package/dist/barrel.d.ts +0 -3
  32. package/dist/barrel.d.ts.map +0 -1
  33. package/dist/barrel.js +0 -2
  34. package/dist/eip1193.advanced.d.ts +0 -75
  35. package/dist/eip1193.advanced.d.ts.map +0 -1
  36. package/dist/eip1193.advanced.js +0 -1
  37. package/dist/eip6963.advanced.d.ts +0 -45
  38. package/dist/eip6963.advanced.d.ts.map +0 -1
  39. package/dist/eip6963.advanced.js +0 -1
  40. package/dist/index.d.ts +0 -2
  41. package/dist/index.d.ts.map +0 -1
  42. package/dist/index.js +0 -1
  43. package/dist/signer.d.ts +0 -39
  44. package/dist/signer.d.ts.map +0 -1
  45. package/dist/signer.js +0 -66
  46. package/dist/signersFactory.d.ts +0 -23
  47. package/dist/signersFactory.d.ts.map +0 -1
  48. package/dist/signersFactory.js +0 -39
  49. package/dist.commonjs/advanced.d.ts.map +0 -1
  50. package/dist.commonjs/eip1193.advanced.d.ts +0 -75
  51. package/dist.commonjs/eip1193.advanced.d.ts.map +0 -1
  52. package/dist.commonjs/eip1193.advanced.js +0 -2
  53. package/dist.commonjs/eip6963.advanced.d.ts +0 -45
  54. package/dist.commonjs/eip6963.advanced.d.ts.map +0 -1
  55. package/dist.commonjs/eip6963.advanced.js +0 -2
  56. package/dist.commonjs/index.d.ts.map +0 -1
  57. package/dist.commonjs/signer.d.ts +0 -39
  58. package/dist.commonjs/signer.d.ts.map +0 -1
  59. package/dist.commonjs/signer.js +0 -70
  60. package/dist.commonjs/signersFactory.d.ts +0 -23
  61. package/dist.commonjs/signersFactory.d.ts.map +0 -1
  62. package/dist.commonjs/signersFactory.js +0 -43
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @ckb-ccc/eip6963
2
2
 
3
+ ## 1.1.0
4
+ ### Minor Changes
5
+
6
+
7
+
8
+ - [#381](https://github.com/ckb-devrel/ccc/pull/381) [`46cc045`](https://github.com/ckb-devrel/ccc/commit/46cc045a3eefe9ba6625482dc7f740a0c59c99d4) Thanks [@Hanssen0](https://github.com/Hanssen0)! - chore: bump packages
9
+
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`46cc045`](https://github.com/ckb-devrel/ccc/commit/46cc045a3eefe9ba6625482dc7f740a0c59c99d4)]:
14
+ - @ckb-ccc/core@1.14.0
15
+
16
+ ## 1.0.33
17
+ ### Patch Changes
18
+
19
+
20
+
21
+ - [#379](https://github.com/ckb-devrel/ccc/pull/379) [`f01a05b`](https://github.com/ckb-devrel/ccc/commit/f01a05bab332d9f4e0cf7f84aecfd688f8e9f346) Thanks [@Hanssen0](https://github.com/Hanssen0)! - chore: bump pnpm to v11.8.0
22
+
23
+ - Updated dependencies [[`1148a5c`](https://github.com/ckb-devrel/ccc/commit/1148a5c403cde985fb4ba713ccfa0c163d287174), [`bf0f8d8`](https://github.com/ckb-devrel/ccc/commit/bf0f8d8ca011e627821445a10bc38519510e5b9d), [`a803d5f`](https://github.com/ckb-devrel/ccc/commit/a803d5fba8d0e082c6aba14db156856025402e72), [`bf0f8d8`](https://github.com/ckb-devrel/ccc/commit/bf0f8d8ca011e627821445a10bc38519510e5b9d), [`6727ffe`](https://github.com/ckb-devrel/ccc/commit/6727ffe05f60e6bfb2060a565c19acb0fd0f375e), [`f01a05b`](https://github.com/ckb-devrel/ccc/commit/f01a05bab332d9f4e0cf7f84aecfd688f8e9f346), [`a526890`](https://github.com/ckb-devrel/ccc/commit/a5268909ea9d61c4e2f5187a43e2318327b27cae), [`4bb3d9d`](https://github.com/ckb-devrel/ccc/commit/4bb3d9d2ef36b3ee8820036625abd9befb1980c4), [`9f7ecb6`](https://github.com/ckb-devrel/ccc/commit/9f7ecb6ab8db9c6866dad029f2888e1e5cfcbe7d)]:
24
+ - @ckb-ccc/core@1.13.0
25
+
3
26
  ## 1.0.32
4
27
  ### Patch Changes
5
28
 
@@ -0,0 +1,2 @@
1
+ import { i as eip1193_advanced_d_exports, n as eip6963_advanced_d_exports } from "./eip6963.advanced-C3p1YxLI.mjs";
2
+ export { eip1193_advanced_d_exports as Eip1193A, eip6963_advanced_d_exports as Eip6963A };
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";var t=e({}),n=e({});export{t as Eip1193A,n as Eip6963A};
2
+ //# sourceMappingURL=advanced.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advanced.mjs","names":[],"sources":["../src/eip1193.advanced.ts","../src/eip6963.advanced.ts"],"sourcesContent":["import { Hex } from \"@ckb-ccc/core\";\n\n/**\n * Interface representing a provider for interacting with Ethereum-compatible wallets.\n */\nexport interface Provider {\n /**\n * Sends a request to the provider.\n */\n request: RequestMethod;\n\n /**\n * Adds an event listener to the provider.\n */\n on: OnMethod;\n\n /**\n * Removes an event listener from the provider.\n * @param eventName - The name of the event to remove the listener from.\n * @param listener - The listener function to remove.\n * @returns The provider instance.\n */\n removeListener(\n eventName: string,\n listener: (...args: unknown[]) => unknown,\n ): Provider;\n}\n\n/**\n * Interface representing a method to send requests to the provider.\n */\nexport interface RequestMethod {\n /**\n * Signs a message with the personal account.\n * @param request - The request object.\n * @returns A promise that resolves to the signed message.\n */\n (request: { method: \"personal_sign\"; params: [string, Hex] }): Promise<Hex>;\n\n /**\n * Requests the accounts from the provider.\n * @param request - The request object.\n * @returns A promise that resolves to an array of account addresses.\n */\n (request: {\n method: \"eth_requestAccounts\";\n params?: undefined;\n }): Promise<Hex[]>;\n\n /**\n * Gets the accounts from the provider.\n * @param request - The request object.\n * @returns A promise that resolves to an array of account addresses.\n */\n (request: { method: \"eth_accounts\"; params?: undefined }): Promise<Hex[]>;\n\n /**\n * Sends a generic request to the provider.\n * @param request - The request object.\n * @returns A promise that resolves to the response from the provider.\n */\n (request: {\n method: string;\n params?: Array<unknown> | Record<string, unknown>;\n }): Promise<unknown>;\n}\n\n/**\n * Interface representing a method to add event listeners to the provider.\n */\nexport interface OnMethod {\n /**\n * Adds an event listener to the provider.\n * @param eventName - The name of the event.\n * @param listener - The listener function.\n * @returns The provider instance.\n */\n (eventName: string, listener: (...args: unknown[]) => unknown): Provider;\n}\n","import { Provider as EIP1193Provider } from \"./eip1193.advanced.js\";\n\n/**\n * Interface representing an event announcing a provider.\n */\nexport interface AnnounceProviderEvent {\n /**\n * The detail of the provider.\n */\n detail: ProviderDetail;\n}\n\n/**\n * Interface representing the details of a provider.\n */\nexport interface ProviderDetail {\n /**\n * The information about the provider.\n */\n info: ProviderInfo;\n\n /**\n * The provider instance compliant with EIP-1193.\n */\n provider: EIP1193Provider;\n}\n\n/**\n * Interface representing information about a provider.\n */\nexport interface ProviderInfo {\n /**\n * The reverse DNS name of the provider.\n */\n rdns: string;\n\n /**\n * The UUID of the provider.\n */\n uuid: string;\n\n /**\n * The name of the provider.\n */\n name: string;\n\n /**\n * The icon URL of the provider.\n */\n icon: string;\n}\n"],"mappings":""}
@@ -0,0 +1,67 @@
1
+ import { r as Provider, t as ProviderDetail } from "./eip6963.advanced-C3p1YxLI.mjs";
2
+ import { ccc } from "@ckb-ccc/core";
3
+
4
+ //#region src/signer.d.ts
5
+ /**
6
+ * Class representing an EVM signer that extends SignerEvm
7
+ * @public
8
+ */
9
+ declare class Signer extends ccc.SignerEvm {
10
+ readonly provider: Provider;
11
+ private accountCache?;
12
+ /**
13
+ * Creates an instance of Signer.
14
+ * @param client - The client instance.
15
+ * @param provider - The provider.
16
+ */
17
+ constructor(client: ccc.Client, provider: Provider);
18
+ /**
19
+ * Gets the EVM account address.
20
+ * @returns A promise that resolves to the EVM account address.
21
+ */
22
+ getEvmAccount(): Promise<ccc.Hex>;
23
+ /**
24
+ * Connects to the provider by requesting accounts.
25
+ * @returns A promise that resolves when the connection is established.
26
+ */
27
+ connect(): Promise<void>;
28
+ onReplaced(listener: () => void): () => void;
29
+ /**
30
+ * Checks if the provider is connected.
31
+ * @returns A promise that resolves to true if connected, false otherwise.
32
+ */
33
+ isConnected(): Promise<boolean>;
34
+ /**
35
+ * Signs a raw message with the personal account.
36
+ * @param message - The message to sign.
37
+ * @returns A promise that resolves to the signed message.
38
+ */
39
+ signMessageRaw(message: string | ccc.BytesLike): Promise<ccc.Hex>;
40
+ }
41
+ //#endregion
42
+ //#region src/signersFactory.d.ts
43
+ /**
44
+ * Class representing a factory for creating and managing Signer instances.
45
+ * @public
46
+ */
47
+ declare class SignerFactory {
48
+ private readonly client;
49
+ private readonly existedUuids;
50
+ /**
51
+ * Creates an instance of SignerFactory.
52
+ * @param client - The client instance.
53
+ */
54
+ constructor(client: ccc.Client);
55
+ /**
56
+ * Subscribes to new signers and triggers a callback when a new signer is available.
57
+ * @param callback - The callback to trigger with the new signer.
58
+ * @returns A function to unsubscribe from the signer events.
59
+ */
60
+ subscribeSigners(callback: (newSigner: Signer, detail?: ProviderDetail) => unknown): () => void;
61
+ }
62
+ declare namespace barrel_d_exports {
63
+ export { Signer, SignerFactory };
64
+ }
65
+ //#endregion
66
+ export { Signer, SignerFactory, barrel_d_exports as t };
67
+ //# sourceMappingURL=barrel.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel.d.mts","names":[],"sources":["../src/signer.ts","../src/signersFactory.ts","../src/barrel.ts"],"mappings":";;;;;;;AAOA;cAAa,MAAA,SAAe,GAAA,CAAI,SAAA;EAAA,SAUZ,QAAA,EAAU,QAAA;EAAA,QATpB,YAAA;EAQE;;;;;cAAR,MAAA,EAAQ,GAAA,CAAI,MAAA,EACI,QAAA,EAAU,QAAA;EAwDW;;;;EA/CjC,aAAA,IAAiB,OAAA,CAAQ,GAAA,CAAI,GAAA;EAnBI;;;;EA8BjC,OAAA,IAAW,OAAA;EAIjB,UAAA,CAAW,QAAA;;;;;EAqBL,WAAA,IAAe,OAAA;EA7CH;;;;;EAwDZ,cAAA,CAAe,OAAA,WAAkB,GAAA,CAAI,SAAA,GAAY,OAAA,CAAQ,GAAA,CAAI,GAAA;AAAA;;;;;AAlErE;;cCKa,aAAA;EAAA,iBAOkB,MAAA;EAAA,iBANZ,YAAA;EDIW;;;;cCEC,MAAA,EAAQ,GAAA,CAAI,MAAA;EDsDF;;;;;EC/CvC,gBAAA,CACE,QAAA,GAAW,SAAA,EAAW,MAAA,EAAQ,MAAA,GAAS,cAAA;AAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{ccc as t}from"@ckb-ccc/core";var n=class extends t.SignerEvm{constructor(e,t){super(e),this.provider=t,this.accountCache=void 0}async getEvmAccount(){return this.accountCache=(await this.provider.request({method:`eth_accounts`}))[0],this.accountCache}async connect(){await this.provider.request({method:`eth_requestAccounts`})}onReplaced(e){let t=[],n=async()=>{e(),t[0]?.()};return t.push(()=>{this.provider.removeListener(`accountsChanged`,n),this.provider.removeListener(`disconnect`,n)}),this.provider.on(`accountsChanged`,n),this.provider.on(`disconnect`,n),t[0]}async isConnected(){return(await this.provider.request({method:`eth_accounts`})).length!==0}async signMessageRaw(e){let n=typeof e==`string`?t.bytesFrom(e,`utf8`):e,r=this.accountCache??await this.getEvmAccount();return this.provider.request({method:`personal_sign`,params:[t.hexFrom(n),r]})}},r=class{constructor(e){this.client=e,this.existedUuids=[]}subscribeSigners(e){let t=t=>{let{detail:r}=t,{uuid:i}=r.info;this.existedUuids.includes(i)||(this.existedUuids.push(i),e(new n(this.client,r.provider),r))};window.addEventListener(`eip6963:announceProvider`,t),window.dispatchEvent(new Event(`eip6963:requestProvider`));let r=window;return r.ethereum!==void 0&&e(new n(this.client,r.ethereum)),()=>window.removeEventListener(`eip6963:announceProvider`,t)}},i=e({Signer:()=>n,SignerFactory:()=>r});export{n as Signer,r as SignerFactory,i as t};
2
+ //# sourceMappingURL=barrel.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel.mjs","names":[],"sources":["../src/signer.ts","../src/signersFactory.ts","../src/barrel.ts"],"sourcesContent":["import { ccc } from \"@ckb-ccc/core\";\nimport { Provider } from \"./eip1193.advanced.js\";\n\n/**\n * Class representing an EVM signer that extends SignerEvm\n * @public\n */\nexport class Signer extends ccc.SignerEvm {\n private accountCache?: ccc.Hex = undefined;\n\n /**\n * Creates an instance of Signer.\n * @param client - The client instance.\n * @param provider - The provider.\n */\n constructor(\n client: ccc.Client,\n public readonly provider: Provider,\n ) {\n super(client);\n }\n\n /**\n * Gets the EVM account address.\n * @returns A promise that resolves to the EVM account address.\n */\n async getEvmAccount(): Promise<ccc.Hex> {\n this.accountCache = (\n await this.provider.request({ method: \"eth_accounts\" })\n )[0];\n return this.accountCache;\n }\n\n /**\n * Connects to the provider by requesting accounts.\n * @returns A promise that resolves when the connection is established.\n */\n async connect(): Promise<void> {\n await this.provider.request({ method: \"eth_requestAccounts\" });\n }\n\n onReplaced(listener: () => void): () => void {\n const stop: (() => void)[] = [];\n const replacer = async () => {\n listener();\n stop[0]?.();\n };\n stop.push(() => {\n this.provider.removeListener(\"accountsChanged\", replacer);\n this.provider.removeListener(\"disconnect\", replacer);\n });\n\n this.provider.on(\"accountsChanged\", replacer);\n this.provider.on(\"disconnect\", replacer);\n\n return stop[0];\n }\n\n /**\n * Checks if the provider is connected.\n * @returns A promise that resolves to true if connected, false otherwise.\n */\n async isConnected(): Promise<boolean> {\n return (\n (await this.provider.request({ method: \"eth_accounts\" })).length !== 0\n );\n }\n\n /**\n * Signs a raw message with the personal account.\n * @param message - The message to sign.\n * @returns A promise that resolves to the signed message.\n */\n async signMessageRaw(message: string | ccc.BytesLike): Promise<ccc.Hex> {\n const challenge =\n typeof message === \"string\" ? ccc.bytesFrom(message, \"utf8\") : message;\n\n const account = this.accountCache ?? (await this.getEvmAccount());\n\n return this.provider.request({\n method: \"personal_sign\",\n params: [ccc.hexFrom(challenge), account],\n });\n }\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { Provider } from \"./eip1193.advanced.js\";\nimport {\n AnnounceProviderEvent as EIP6963AnnounceProviderEvent,\n ProviderDetail,\n} from \"./eip6963.advanced.js\";\nimport { Signer } from \"./signer.js\";\n\n/**\n * Class representing a factory for creating and managing Signer instances.\n * @public\n */\nexport class SignerFactory {\n private readonly existedUuids: string[] = [];\n\n /**\n * Creates an instance of SignerFactory.\n * @param client - The client instance.\n */\n constructor(private readonly client: ccc.Client) {}\n\n /**\n * Subscribes to new signers and triggers a callback when a new signer is available.\n * @param callback - The callback to trigger with the new signer.\n * @returns A function to unsubscribe from the signer events.\n */\n subscribeSigners(\n callback: (newSigner: Signer, detail?: ProviderDetail) => unknown,\n ): () => void {\n const onNewProvider = (event: Event) => {\n const { detail } = event as unknown as EIP6963AnnounceProviderEvent;\n const { uuid } = detail.info;\n\n if (this.existedUuids.includes(uuid)) {\n return;\n }\n\n this.existedUuids.push(uuid);\n const signer = new Signer(this.client, detail.provider);\n callback(signer, detail);\n };\n\n window.addEventListener(\"eip6963:announceProvider\", onNewProvider);\n window.dispatchEvent(new Event(\"eip6963:requestProvider\"));\n\n const windowRef = window as { ethereum?: Provider };\n\n if (typeof windowRef.ethereum !== \"undefined\") {\n callback(new Signer(this.client, windowRef.ethereum));\n }\n\n return () =>\n window.removeEventListener(\"eip6963:announceProvider\", onNewProvider);\n }\n}\n","export * from \"./signer.js\";\nexport * from \"./signersFactory.js\";\n"],"mappings":"wFAOA,IAAa,EAAb,cAA4B,EAAI,SAAU,CAQxC,YACE,EACA,EACA,CACA,MAAM,CAAM,EAFI,KAAA,SAAA,oBATe,IAAA,EAYjC,CAMA,MAAM,eAAkC,CAItC,MAHA,MAAK,cACH,MAAM,KAAK,SAAS,QAAQ,CAAE,OAAQ,cAAe,CAAC,EAAA,CACtD,GACK,KAAK,YACd,CAMA,MAAM,SAAyB,CAC7B,MAAM,KAAK,SAAS,QAAQ,CAAE,OAAQ,qBAAsB,CAAC,CAC/D,CAEA,WAAW,EAAkC,CAC3C,IAAM,EAAuB,CAAC,EACxB,EAAW,SAAY,CAC3B,EAAS,EACT,EAAK,EAAE,GAAG,CACZ,EASA,OARA,EAAK,SAAW,CACd,KAAK,SAAS,eAAe,kBAAmB,CAAQ,EACxD,KAAK,SAAS,eAAe,aAAc,CAAQ,CACrD,CAAC,EAED,KAAK,SAAS,GAAG,kBAAmB,CAAQ,EAC5C,KAAK,SAAS,GAAG,aAAc,CAAQ,EAEhC,EAAK,EACd,CAMA,MAAM,aAAgC,CACpC,OACG,MAAM,KAAK,SAAS,QAAQ,CAAE,OAAQ,cAAe,CAAC,EAAA,CAAG,SAAW,CAEzE,CAOA,MAAM,eAAe,EAAmD,CACtE,IAAM,EACJ,OAAO,GAAY,SAAW,EAAI,UAAU,EAAS,MAAM,EAAI,EAE3D,EAAU,KAAK,cAAiB,MAAM,KAAK,cAAc,EAE/D,OAAO,KAAK,SAAS,QAAQ,CAC3B,OAAQ,gBACR,OAAQ,CAAC,EAAI,QAAQ,CAAS,EAAG,CAAO,CAC1C,CAAC,CACH,CACF,ECxEa,EAAb,KAA2B,CAOzB,YAAY,EAAqC,CAApB,KAAA,OAAA,oBANa,CAAC,CAMO,CAOlD,iBACE,EACY,CACZ,IAAM,EAAiB,GAAiB,CACtC,GAAM,CAAE,UAAW,EACb,CAAE,QAAS,EAAO,KAEpB,KAAK,aAAa,SAAS,CAAI,IAInC,KAAK,aAAa,KAAK,CAAI,EAE3B,EAAS,IADU,EAAO,KAAK,OAAQ,EAAO,QAChC,EAAG,CAAM,EACzB,EAEA,OAAO,iBAAiB,2BAA4B,CAAa,EACjE,OAAO,cAAc,IAAI,MAAM,yBAAyB,CAAC,EAEzD,IAAM,EAAY,OAMlB,OAJW,EAAU,WAAa,QAChC,EAAS,IAAI,EAAO,KAAK,OAAQ,EAAU,QAAQ,CAAC,MAIpD,OAAO,oBAAoB,2BAA4B,CAAa,CACxE,CACF"}
@@ -0,0 +1,128 @@
1
+ import { Hex } from "@ckb-ccc/core";
2
+
3
+ //#region src/eip1193.advanced.d.ts
4
+ declare namespace eip1193_advanced_d_exports {
5
+ export { OnMethod, Provider, RequestMethod };
6
+ }
7
+ /**
8
+ * Interface representing a provider for interacting with Ethereum-compatible wallets.
9
+ */
10
+ interface Provider {
11
+ /**
12
+ * Sends a request to the provider.
13
+ */
14
+ request: RequestMethod;
15
+ /**
16
+ * Adds an event listener to the provider.
17
+ */
18
+ on: OnMethod;
19
+ /**
20
+ * Removes an event listener from the provider.
21
+ * @param eventName - The name of the event to remove the listener from.
22
+ * @param listener - The listener function to remove.
23
+ * @returns The provider instance.
24
+ */
25
+ removeListener(eventName: string, listener: (...args: unknown[]) => unknown): Provider;
26
+ }
27
+ /**
28
+ * Interface representing a method to send requests to the provider.
29
+ */
30
+ interface RequestMethod {
31
+ /**
32
+ * Signs a message with the personal account.
33
+ * @param request - The request object.
34
+ * @returns A promise that resolves to the signed message.
35
+ */
36
+ (request: {
37
+ method: "personal_sign";
38
+ params: [string, Hex];
39
+ }): Promise<Hex>;
40
+ /**
41
+ * Requests the accounts from the provider.
42
+ * @param request - The request object.
43
+ * @returns A promise that resolves to an array of account addresses.
44
+ */
45
+ (request: {
46
+ method: "eth_requestAccounts";
47
+ params?: undefined;
48
+ }): Promise<Hex[]>;
49
+ /**
50
+ * Gets the accounts from the provider.
51
+ * @param request - The request object.
52
+ * @returns A promise that resolves to an array of account addresses.
53
+ */
54
+ (request: {
55
+ method: "eth_accounts";
56
+ params?: undefined;
57
+ }): Promise<Hex[]>;
58
+ /**
59
+ * Sends a generic request to the provider.
60
+ * @param request - The request object.
61
+ * @returns A promise that resolves to the response from the provider.
62
+ */
63
+ (request: {
64
+ method: string;
65
+ params?: Array<unknown> | Record<string, unknown>;
66
+ }): Promise<unknown>;
67
+ }
68
+ /**
69
+ * Interface representing a method to add event listeners to the provider.
70
+ */
71
+ interface OnMethod {
72
+ /**
73
+ * Adds an event listener to the provider.
74
+ * @param eventName - The name of the event.
75
+ * @param listener - The listener function.
76
+ * @returns The provider instance.
77
+ */
78
+ (eventName: string, listener: (...args: unknown[]) => unknown): Provider;
79
+ }
80
+ declare namespace eip6963_advanced_d_exports {
81
+ export { AnnounceProviderEvent, ProviderDetail, ProviderInfo };
82
+ }
83
+ /**
84
+ * Interface representing an event announcing a provider.
85
+ */
86
+ interface AnnounceProviderEvent {
87
+ /**
88
+ * The detail of the provider.
89
+ */
90
+ detail: ProviderDetail;
91
+ }
92
+ /**
93
+ * Interface representing the details of a provider.
94
+ */
95
+ interface ProviderDetail {
96
+ /**
97
+ * The information about the provider.
98
+ */
99
+ info: ProviderInfo;
100
+ /**
101
+ * The provider instance compliant with EIP-1193.
102
+ */
103
+ provider: Provider;
104
+ }
105
+ /**
106
+ * Interface representing information about a provider.
107
+ */
108
+ interface ProviderInfo {
109
+ /**
110
+ * The reverse DNS name of the provider.
111
+ */
112
+ rdns: string;
113
+ /**
114
+ * The UUID of the provider.
115
+ */
116
+ uuid: string;
117
+ /**
118
+ * The name of the provider.
119
+ */
120
+ name: string;
121
+ /**
122
+ * The icon URL of the provider.
123
+ */
124
+ icon: string;
125
+ }
126
+ //#endregion
127
+ export { eip1193_advanced_d_exports as i, eip6963_advanced_d_exports as n, Provider as r, ProviderDetail as t };
128
+ //# sourceMappingURL=eip6963.advanced-C3p1YxLI.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip6963.advanced-C3p1YxLI.d.mts","names":[],"sources":["../src/eip1193.advanced.ts","../src/eip6963.advanced.ts"],"mappings":";;;;;;;;;UAKiB,QAAA;;;;EAIf,OAAA,EAAS,aAAA;EAJM;;;EASf,EAAA,EAAI,QAAA;EAAA;;;;;;EAQJ,cAAA,CACE,SAAA,UACA,QAAA,MAAc,IAAA,0BACb,QAAA;AAAA;;;;UAMY,aAAA;EANZ;;AAAQ;AAMb;;EANK,CAYF,OAAA;IAAW,MAAA;IAAyB,MAAA,WAAiB,GAAA;EAAA,IAAS,OAAA,CAAQ,GAAA;EAU3D;;;;;EAAA,CAHX,OAAA;IACC,MAAA;IACA,MAAA;EAAA,IACE,OAAA,CAAQ,GAAA;EAVA;;;;;EAAA,CAiBX,OAAA;IAAW,MAAA;IAAwB,MAAA;EAAA,IAAuB,OAAA,CAAQ,GAAA;EAP/D;;;;;EAAA,CAcH,OAAA;IACC,MAAA;IACA,MAAA,GAAS,KAAA,YAAiB,MAAA;EAAA,IACxB,OAAA;AAAA;;;;UAMW,QAAA;EANJ;AAMb;;;;;EANa,CAaV,SAAA,UAAmB,QAAA,MAAc,IAAA,0BAA8B,QAAQ;AAAA;AAAA;;;;;;UCxEzD,qBAAA;;;;EAIf,MAAA,EAAQ,cAAc;AAAA;;;;UAMP,cAAA;EDUZ;;;ECNH,IAAA,EAAM,YAAA;EDVG;;;ECeT,QAAA,EAAU,QAAe;AAAA;;;;UAMV,YAAA;EDLJ;AAMb;;ECGE,IAAA;EDGsD;;;ECEtD,IAAA;EDQI;;;ECHJ,IAAA;EDmB4B;;;ECd5B,IAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ import { t as barrel_d_exports } from "./barrel.mjs";
2
+ export { barrel_d_exports as Eip6963 };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import{t as e}from"./barrel.mjs";export{e as Eip6963};
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};export{t};
@@ -1,3 +1,2 @@
1
- export * as Eip1193A from "./eip1193.advanced.js";
2
- export * as Eip6963A from "./eip6963.advanced.js";
3
- //# sourceMappingURL=advanced.d.ts.map
1
+ import { i as eip1193_advanced_d_exports, n as eip6963_advanced_d_exports } from "./eip6963.advanced-BMWmWvgB.js";
2
+ export { eip1193_advanced_d_exports as Eip1193A, eip6963_advanced_d_exports as Eip6963A };
@@ -1,38 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Eip6963A = exports.Eip1193A = void 0;
37
- exports.Eip1193A = __importStar(require("./eip1193.advanced.js"));
38
- exports.Eip6963A = __importStar(require("./eip6963.advanced.js"));
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.js");var t=e.t({}),n=e.t({});Object.defineProperty(exports,"Eip1193A",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"Eip6963A",{enumerable:!0,get:function(){return n}});
2
+ //# sourceMappingURL=advanced.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advanced.js","names":[],"sources":["../src/eip1193.advanced.ts","../src/eip6963.advanced.ts"],"sourcesContent":["import { Hex } from \"@ckb-ccc/core\";\n\n/**\n * Interface representing a provider for interacting with Ethereum-compatible wallets.\n */\nexport interface Provider {\n /**\n * Sends a request to the provider.\n */\n request: RequestMethod;\n\n /**\n * Adds an event listener to the provider.\n */\n on: OnMethod;\n\n /**\n * Removes an event listener from the provider.\n * @param eventName - The name of the event to remove the listener from.\n * @param listener - The listener function to remove.\n * @returns The provider instance.\n */\n removeListener(\n eventName: string,\n listener: (...args: unknown[]) => unknown,\n ): Provider;\n}\n\n/**\n * Interface representing a method to send requests to the provider.\n */\nexport interface RequestMethod {\n /**\n * Signs a message with the personal account.\n * @param request - The request object.\n * @returns A promise that resolves to the signed message.\n */\n (request: { method: \"personal_sign\"; params: [string, Hex] }): Promise<Hex>;\n\n /**\n * Requests the accounts from the provider.\n * @param request - The request object.\n * @returns A promise that resolves to an array of account addresses.\n */\n (request: {\n method: \"eth_requestAccounts\";\n params?: undefined;\n }): Promise<Hex[]>;\n\n /**\n * Gets the accounts from the provider.\n * @param request - The request object.\n * @returns A promise that resolves to an array of account addresses.\n */\n (request: { method: \"eth_accounts\"; params?: undefined }): Promise<Hex[]>;\n\n /**\n * Sends a generic request to the provider.\n * @param request - The request object.\n * @returns A promise that resolves to the response from the provider.\n */\n (request: {\n method: string;\n params?: Array<unknown> | Record<string, unknown>;\n }): Promise<unknown>;\n}\n\n/**\n * Interface representing a method to add event listeners to the provider.\n */\nexport interface OnMethod {\n /**\n * Adds an event listener to the provider.\n * @param eventName - The name of the event.\n * @param listener - The listener function.\n * @returns The provider instance.\n */\n (eventName: string, listener: (...args: unknown[]) => unknown): Provider;\n}\n","import { Provider as EIP1193Provider } from \"./eip1193.advanced.js\";\n\n/**\n * Interface representing an event announcing a provider.\n */\nexport interface AnnounceProviderEvent {\n /**\n * The detail of the provider.\n */\n detail: ProviderDetail;\n}\n\n/**\n * Interface representing the details of a provider.\n */\nexport interface ProviderDetail {\n /**\n * The information about the provider.\n */\n info: ProviderInfo;\n\n /**\n * The provider instance compliant with EIP-1193.\n */\n provider: EIP1193Provider;\n}\n\n/**\n * Interface representing information about a provider.\n */\nexport interface ProviderInfo {\n /**\n * The reverse DNS name of the provider.\n */\n rdns: string;\n\n /**\n * The UUID of the provider.\n */\n uuid: string;\n\n /**\n * The name of the provider.\n */\n name: string;\n\n /**\n * The icon URL of the provider.\n */\n icon: string;\n}\n"],"mappings":""}
@@ -1,3 +1,67 @@
1
- export * from "./signer.js";
2
- export * from "./signersFactory.js";
1
+ import { a as __exportAll, r as Provider, t as ProviderDetail } from "./eip6963.advanced-BMWmWvgB.js";
2
+ import { ccc } from "@ckb-ccc/core";
3
+
4
+ //#region src/signer.d.ts
5
+ /**
6
+ * Class representing an EVM signer that extends SignerEvm
7
+ * @public
8
+ */
9
+ declare class Signer extends ccc.SignerEvm {
10
+ readonly provider: Provider;
11
+ private accountCache?;
12
+ /**
13
+ * Creates an instance of Signer.
14
+ * @param client - The client instance.
15
+ * @param provider - The provider.
16
+ */
17
+ constructor(client: ccc.Client, provider: Provider);
18
+ /**
19
+ * Gets the EVM account address.
20
+ * @returns A promise that resolves to the EVM account address.
21
+ */
22
+ getEvmAccount(): Promise<ccc.Hex>;
23
+ /**
24
+ * Connects to the provider by requesting accounts.
25
+ * @returns A promise that resolves when the connection is established.
26
+ */
27
+ connect(): Promise<void>;
28
+ onReplaced(listener: () => void): () => void;
29
+ /**
30
+ * Checks if the provider is connected.
31
+ * @returns A promise that resolves to true if connected, false otherwise.
32
+ */
33
+ isConnected(): Promise<boolean>;
34
+ /**
35
+ * Signs a raw message with the personal account.
36
+ * @param message - The message to sign.
37
+ * @returns A promise that resolves to the signed message.
38
+ */
39
+ signMessageRaw(message: string | ccc.BytesLike): Promise<ccc.Hex>;
40
+ }
41
+ //#endregion
42
+ //#region src/signersFactory.d.ts
43
+ /**
44
+ * Class representing a factory for creating and managing Signer instances.
45
+ * @public
46
+ */
47
+ declare class SignerFactory {
48
+ private readonly client;
49
+ private readonly existedUuids;
50
+ /**
51
+ * Creates an instance of SignerFactory.
52
+ * @param client - The client instance.
53
+ */
54
+ constructor(client: ccc.Client);
55
+ /**
56
+ * Subscribes to new signers and triggers a callback when a new signer is available.
57
+ * @param callback - The callback to trigger with the new signer.
58
+ * @returns A function to unsubscribe from the signer events.
59
+ */
60
+ subscribeSigners(callback: (newSigner: Signer, detail?: ProviderDetail) => unknown): () => void;
61
+ }
62
+ declare namespace barrel_d_exports {
63
+ export { Signer, SignerFactory };
64
+ }
65
+ //#endregion
66
+ export { Signer, SignerFactory, barrel_d_exports as t };
3
67
  //# sourceMappingURL=barrel.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"barrel.d.ts","sourceRoot":"","sources":["../src/barrel.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"barrel.d.ts","names":[],"sources":["../src/signer.ts","../src/signersFactory.ts","../src/barrel.ts"],"mappings":";;;;;;AAOA;;cAAa,MAAA,SAAe,GAAA,CAAI,SAAA;EAAA,SAUZ,QAAA,EAAU,QAAA;EAAA,QATpB,YAAA;EASoB;;;;;cAD1B,MAAA,EAAQ,GAAA,CAAI,MAAA,EACI,QAAA,EAAU,QAAA;EAwDmC;;;;EA/CzD,aAAA,IAAiB,OAAA,CAAQ,GAAA,CAAI,GAAA;EAnBT;;;;EA8BpB,OAAA,IAAW,OAAA;EAIjB,UAAA,CAAW,QAAA;EAzBD;;;;EA8CJ,WAAA,IAAe,OAAA;EApCf;;;;;EA+CA,cAAA,CAAe,OAAA,WAAkB,GAAA,CAAI,SAAA,GAAY,OAAA,CAAQ,GAAA,CAAI,GAAA;AAAA;;;;AAlErE;;;cCKa,aAAA;EAAA,iBAOkB,MAAA;EAAA,iBANZ,YAAA;EDac;;;;cCPF,MAAA,EAAQ,GAAA,CAAI,MAAA;EDsDsB;;;;;EC/C/D,gBAAA,CACE,QAAA,GAAW,SAAA,EAAW,MAAA,EAAQ,MAAA,GAAS,cAAA;AAAA;AAAA"}
@@ -1,18 +1,2 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./signer.js"), exports);
18
- __exportStar(require("./signersFactory.js"), exports);
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-BIInC43l.js");let t=require("@ckb-ccc/core");var n=class extends t.ccc.SignerEvm{constructor(e,t){super(e),this.provider=t,this.accountCache=void 0}async getEvmAccount(){return this.accountCache=(await this.provider.request({method:`eth_accounts`}))[0],this.accountCache}async connect(){await this.provider.request({method:`eth_requestAccounts`})}onReplaced(e){let t=[],n=async()=>{e(),t[0]?.()};return t.push(()=>{this.provider.removeListener(`accountsChanged`,n),this.provider.removeListener(`disconnect`,n)}),this.provider.on(`accountsChanged`,n),this.provider.on(`disconnect`,n),t[0]}async isConnected(){return(await this.provider.request({method:`eth_accounts`})).length!==0}async signMessageRaw(e){let n=typeof e==`string`?t.ccc.bytesFrom(e,`utf8`):e,r=this.accountCache??await this.getEvmAccount();return this.provider.request({method:`personal_sign`,params:[t.ccc.hexFrom(n),r]})}},r=class{constructor(e){this.client=e,this.existedUuids=[]}subscribeSigners(e){let t=t=>{let{detail:r}=t,{uuid:i}=r.info;this.existedUuids.includes(i)||(this.existedUuids.push(i),e(new n(this.client,r.provider),r))};window.addEventListener(`eip6963:announceProvider`,t),window.dispatchEvent(new Event(`eip6963:requestProvider`));let r=window;return r.ethereum!==void 0&&e(new n(this.client,r.ethereum)),()=>window.removeEventListener(`eip6963:announceProvider`,t)}},i=e.t({Signer:()=>n,SignerFactory:()=>r});exports.Signer=n,exports.SignerFactory=r,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return i}});
2
+ //# sourceMappingURL=barrel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"barrel.js","names":["ccc"],"sources":["../src/signer.ts","../src/signersFactory.ts","../src/barrel.ts"],"sourcesContent":["import { ccc } from \"@ckb-ccc/core\";\nimport { Provider } from \"./eip1193.advanced.js\";\n\n/**\n * Class representing an EVM signer that extends SignerEvm\n * @public\n */\nexport class Signer extends ccc.SignerEvm {\n private accountCache?: ccc.Hex = undefined;\n\n /**\n * Creates an instance of Signer.\n * @param client - The client instance.\n * @param provider - The provider.\n */\n constructor(\n client: ccc.Client,\n public readonly provider: Provider,\n ) {\n super(client);\n }\n\n /**\n * Gets the EVM account address.\n * @returns A promise that resolves to the EVM account address.\n */\n async getEvmAccount(): Promise<ccc.Hex> {\n this.accountCache = (\n await this.provider.request({ method: \"eth_accounts\" })\n )[0];\n return this.accountCache;\n }\n\n /**\n * Connects to the provider by requesting accounts.\n * @returns A promise that resolves when the connection is established.\n */\n async connect(): Promise<void> {\n await this.provider.request({ method: \"eth_requestAccounts\" });\n }\n\n onReplaced(listener: () => void): () => void {\n const stop: (() => void)[] = [];\n const replacer = async () => {\n listener();\n stop[0]?.();\n };\n stop.push(() => {\n this.provider.removeListener(\"accountsChanged\", replacer);\n this.provider.removeListener(\"disconnect\", replacer);\n });\n\n this.provider.on(\"accountsChanged\", replacer);\n this.provider.on(\"disconnect\", replacer);\n\n return stop[0];\n }\n\n /**\n * Checks if the provider is connected.\n * @returns A promise that resolves to true if connected, false otherwise.\n */\n async isConnected(): Promise<boolean> {\n return (\n (await this.provider.request({ method: \"eth_accounts\" })).length !== 0\n );\n }\n\n /**\n * Signs a raw message with the personal account.\n * @param message - The message to sign.\n * @returns A promise that resolves to the signed message.\n */\n async signMessageRaw(message: string | ccc.BytesLike): Promise<ccc.Hex> {\n const challenge =\n typeof message === \"string\" ? ccc.bytesFrom(message, \"utf8\") : message;\n\n const account = this.accountCache ?? (await this.getEvmAccount());\n\n return this.provider.request({\n method: \"personal_sign\",\n params: [ccc.hexFrom(challenge), account],\n });\n }\n}\n","import { ccc } from \"@ckb-ccc/core\";\nimport { Provider } from \"./eip1193.advanced.js\";\nimport {\n AnnounceProviderEvent as EIP6963AnnounceProviderEvent,\n ProviderDetail,\n} from \"./eip6963.advanced.js\";\nimport { Signer } from \"./signer.js\";\n\n/**\n * Class representing a factory for creating and managing Signer instances.\n * @public\n */\nexport class SignerFactory {\n private readonly existedUuids: string[] = [];\n\n /**\n * Creates an instance of SignerFactory.\n * @param client - The client instance.\n */\n constructor(private readonly client: ccc.Client) {}\n\n /**\n * Subscribes to new signers and triggers a callback when a new signer is available.\n * @param callback - The callback to trigger with the new signer.\n * @returns A function to unsubscribe from the signer events.\n */\n subscribeSigners(\n callback: (newSigner: Signer, detail?: ProviderDetail) => unknown,\n ): () => void {\n const onNewProvider = (event: Event) => {\n const { detail } = event as unknown as EIP6963AnnounceProviderEvent;\n const { uuid } = detail.info;\n\n if (this.existedUuids.includes(uuid)) {\n return;\n }\n\n this.existedUuids.push(uuid);\n const signer = new Signer(this.client, detail.provider);\n callback(signer, detail);\n };\n\n window.addEventListener(\"eip6963:announceProvider\", onNewProvider);\n window.dispatchEvent(new Event(\"eip6963:requestProvider\"));\n\n const windowRef = window as { ethereum?: Provider };\n\n if (typeof windowRef.ethereum !== \"undefined\") {\n callback(new Signer(this.client, windowRef.ethereum));\n }\n\n return () =>\n window.removeEventListener(\"eip6963:announceProvider\", onNewProvider);\n }\n}\n","export * from \"./signer.js\";\nexport * from \"./signersFactory.js\";\n"],"mappings":"oJAOA,IAAa,EAAb,cAA4BA,EAAAA,IAAI,SAAU,CAQxC,YACE,EACA,EACA,CACA,MAAM,CAAM,EAFI,KAAA,SAAA,oBATe,IAAA,EAYjC,CAMA,MAAM,eAAkC,CAItC,MAHA,MAAK,cACH,MAAM,KAAK,SAAS,QAAQ,CAAE,OAAQ,cAAe,CAAC,EAAA,CACtD,GACK,KAAK,YACd,CAMA,MAAM,SAAyB,CAC7B,MAAM,KAAK,SAAS,QAAQ,CAAE,OAAQ,qBAAsB,CAAC,CAC/D,CAEA,WAAW,EAAkC,CAC3C,IAAM,EAAuB,CAAC,EACxB,EAAW,SAAY,CAC3B,EAAS,EACT,EAAK,EAAE,GAAG,CACZ,EASA,OARA,EAAK,SAAW,CACd,KAAK,SAAS,eAAe,kBAAmB,CAAQ,EACxD,KAAK,SAAS,eAAe,aAAc,CAAQ,CACrD,CAAC,EAED,KAAK,SAAS,GAAG,kBAAmB,CAAQ,EAC5C,KAAK,SAAS,GAAG,aAAc,CAAQ,EAEhC,EAAK,EACd,CAMA,MAAM,aAAgC,CACpC,OACG,MAAM,KAAK,SAAS,QAAQ,CAAE,OAAQ,cAAe,CAAC,EAAA,CAAG,SAAW,CAEzE,CAOA,MAAM,eAAe,EAAmD,CACtE,IAAM,EACJ,OAAO,GAAY,SAAWA,EAAAA,IAAI,UAAU,EAAS,MAAM,EAAI,EAE3D,EAAU,KAAK,cAAiB,MAAM,KAAK,cAAc,EAE/D,OAAO,KAAK,SAAS,QAAQ,CAC3B,OAAQ,gBACR,OAAQ,CAACA,EAAAA,IAAI,QAAQ,CAAS,EAAG,CAAO,CAC1C,CAAC,CACH,CACF,ECxEa,EAAb,KAA2B,CAOzB,YAAY,EAAqC,CAApB,KAAA,OAAA,oBANa,CAAC,CAMO,CAOlD,iBACE,EACY,CACZ,IAAM,EAAiB,GAAiB,CACtC,GAAM,CAAE,UAAW,EACb,CAAE,QAAS,EAAO,KAEpB,KAAK,aAAa,SAAS,CAAI,IAInC,KAAK,aAAa,KAAK,CAAI,EAE3B,EAAS,IADU,EAAO,KAAK,OAAQ,EAAO,QAChC,EAAG,CAAM,EACzB,EAEA,OAAO,iBAAiB,2BAA4B,CAAa,EACjE,OAAO,cAAc,IAAI,MAAM,yBAAyB,CAAC,EAEzD,IAAM,EAAY,OAMlB,OAJW,EAAU,WAAa,QAChC,EAAS,IAAI,EAAO,KAAK,OAAQ,EAAU,QAAQ,CAAC,MAIpD,OAAO,oBAAoB,2BAA4B,CAAa,CACxE,CACF"}
@@ -0,0 +1,128 @@
1
+ import { Hex } from "@ckb-ccc/core";
2
+
3
+ //#region \0rolldown/runtime.js
4
+ declare namespace eip1193_advanced_d_exports {
5
+ export { OnMethod, Provider, RequestMethod };
6
+ }
7
+ /**
8
+ * Interface representing a provider for interacting with Ethereum-compatible wallets.
9
+ */
10
+ interface Provider {
11
+ /**
12
+ * Sends a request to the provider.
13
+ */
14
+ request: RequestMethod;
15
+ /**
16
+ * Adds an event listener to the provider.
17
+ */
18
+ on: OnMethod;
19
+ /**
20
+ * Removes an event listener from the provider.
21
+ * @param eventName - The name of the event to remove the listener from.
22
+ * @param listener - The listener function to remove.
23
+ * @returns The provider instance.
24
+ */
25
+ removeListener(eventName: string, listener: (...args: unknown[]) => unknown): Provider;
26
+ }
27
+ /**
28
+ * Interface representing a method to send requests to the provider.
29
+ */
30
+ interface RequestMethod {
31
+ /**
32
+ * Signs a message with the personal account.
33
+ * @param request - The request object.
34
+ * @returns A promise that resolves to the signed message.
35
+ */
36
+ (request: {
37
+ method: "personal_sign";
38
+ params: [string, Hex];
39
+ }): Promise<Hex>;
40
+ /**
41
+ * Requests the accounts from the provider.
42
+ * @param request - The request object.
43
+ * @returns A promise that resolves to an array of account addresses.
44
+ */
45
+ (request: {
46
+ method: "eth_requestAccounts";
47
+ params?: undefined;
48
+ }): Promise<Hex[]>;
49
+ /**
50
+ * Gets the accounts from the provider.
51
+ * @param request - The request object.
52
+ * @returns A promise that resolves to an array of account addresses.
53
+ */
54
+ (request: {
55
+ method: "eth_accounts";
56
+ params?: undefined;
57
+ }): Promise<Hex[]>;
58
+ /**
59
+ * Sends a generic request to the provider.
60
+ * @param request - The request object.
61
+ * @returns A promise that resolves to the response from the provider.
62
+ */
63
+ (request: {
64
+ method: string;
65
+ params?: Array<unknown> | Record<string, unknown>;
66
+ }): Promise<unknown>;
67
+ }
68
+ /**
69
+ * Interface representing a method to add event listeners to the provider.
70
+ */
71
+ interface OnMethod {
72
+ /**
73
+ * Adds an event listener to the provider.
74
+ * @param eventName - The name of the event.
75
+ * @param listener - The listener function.
76
+ * @returns The provider instance.
77
+ */
78
+ (eventName: string, listener: (...args: unknown[]) => unknown): Provider;
79
+ }
80
+ declare namespace eip6963_advanced_d_exports {
81
+ export { AnnounceProviderEvent, ProviderDetail, ProviderInfo };
82
+ }
83
+ /**
84
+ * Interface representing an event announcing a provider.
85
+ */
86
+ interface AnnounceProviderEvent {
87
+ /**
88
+ * The detail of the provider.
89
+ */
90
+ detail: ProviderDetail;
91
+ }
92
+ /**
93
+ * Interface representing the details of a provider.
94
+ */
95
+ interface ProviderDetail {
96
+ /**
97
+ * The information about the provider.
98
+ */
99
+ info: ProviderInfo;
100
+ /**
101
+ * The provider instance compliant with EIP-1193.
102
+ */
103
+ provider: Provider;
104
+ }
105
+ /**
106
+ * Interface representing information about a provider.
107
+ */
108
+ interface ProviderInfo {
109
+ /**
110
+ * The reverse DNS name of the provider.
111
+ */
112
+ rdns: string;
113
+ /**
114
+ * The UUID of the provider.
115
+ */
116
+ uuid: string;
117
+ /**
118
+ * The name of the provider.
119
+ */
120
+ name: string;
121
+ /**
122
+ * The icon URL of the provider.
123
+ */
124
+ icon: string;
125
+ }
126
+ //#endregion
127
+ export { __exportAll as a, eip1193_advanced_d_exports as i, eip6963_advanced_d_exports as n, Provider as r, ProviderDetail as t };
128
+ //# sourceMappingURL=eip6963.advanced-BMWmWvgB.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eip6963.advanced-BMWmWvgB.d.ts","names":[],"sources":["../src/eip1193.advanced.ts","../src/eip6963.advanced.ts"],"mappings":";;;;;;;;;UAKiB,QAAA;;;;EAIf,OAAA,EAAS,aAAA;;;;EAKT,EAAA,EAAI,QAAA;;;;;;;EAQJ,cAAA,CACE,SAAA,UACA,QAAA,MAAc,IAAA,0BACb,QAAA;AAAA;;;;UAMY,aAAA;EA1BA;;;;;EAAA,CAgCd,OAAA;IAAW,MAAA;IAAyB,MAAA,WAAiB,GAAA;EAAA,IAAS,OAAA,CAAQ,GAAA;EA5B9D;;;;;EAAA,CAmCR,OAAA;IACC,MAAA;IACA,MAAA;EAAA,IACE,OAAA,CAAQ,GAAA;EAtBD;AAMb;;;;EANa,CA6BV,OAAA;IAAW,MAAA;IAAwB,MAAA;EAAA,IAAuB,OAAA,CAAQ,GAAA;EAAA;;;;;EAAA,CAOlE,OAAA;IACC,MAAA;IACA,MAAA,GAAS,KAAA,YAAiB,MAAA;EAAA,IACxB,OAAA;AAAA;;;;UAMW,QAAA;EAxBb;;;;;;EAAA,CA+BD,SAAA,UAAmB,QAAA,MAAc,IAAA,0BAA8B,QAAQ;AAAA;AAAA;;;;;;UCxEzD,qBAAA;;;;EAIf,MAAA,EAAQ,cAAc;AAAA;;;;UAMP,cAAA;;;;EAIf,IAAA,EAAM,YAAA;;;;EAKN,QAAA,EAAU,QAAe;AAAA;;;ADnB3B;UCyBiB,YAAA;;;;EAIf,IAAA;EDTW;;;ECcX,IAAA;EDzBA;;;EC8BA,IAAA;EDpBgB;;;ECyBhB,IAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- export * as Eip6963 from "./barrel.js";
2
- //# sourceMappingURL=index.d.ts.map
1
+ import { t as barrel_d_exports } from "./barrel.js";
2
+ export { barrel_d_exports as Eip6963 };
@@ -1,37 +1 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.Eip6963 = void 0;
37
- exports.Eip6963 = __importStar(require("./barrel.js"));
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./barrel.js");Object.defineProperty(exports,"Eip6963",{enumerable:!0,get:function(){return e.t}});
@@ -0,0 +1 @@
1
+ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r};Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return t}});