@wireio/wallet-ext-sdk 0.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/README.md ADDED
@@ -0,0 +1,309 @@
1
+ # @wireio/wallet-ext-sdk
2
+
3
+ TypeScript client SDK for interacting with the Wire Wallet browser extension.
4
+
5
+ Available on npm: <https://www.npmjs.com/package/@wireio/wallet-ext-sdk>
6
+
7
+ ## Overview
8
+
9
+ This package provides a typed `WireWalletClient` class that wraps the `window.__WIRE_WALLET__` provider injected by the Wire Wallet browser extension. It handles provider detection, method calls, event subscriptions, and error handling with zero runtime dependencies (only `tslib`).
10
+
11
+ The SDK is published as an ES module with full TypeScript declarations.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install @wireio/wallet-ext-sdk
17
+ ```
18
+
19
+ ```sh
20
+ pnpm add @wireio/wallet-ext-sdk
21
+ ```
22
+
23
+ ```sh
24
+ yarn add @wireio/wallet-ext-sdk
25
+ ```
26
+
27
+ ## Quick Start
28
+
29
+ ```typescript
30
+ import { WireWalletClient } from "@wireio/wallet-ext-sdk"
31
+
32
+ const wallet = new WireWalletClient()
33
+
34
+ // Wait for the extension provider to be available (polls for up to 3 seconds)
35
+ await wallet.waitForProvider()
36
+
37
+ // Check if the wallet is unlocked
38
+ const unlocked = await wallet.isUnlocked()
39
+ console.log("Unlocked:", unlocked)
40
+
41
+ // Get the active account
42
+ const account = await wallet.getActiveAccount()
43
+ if (account) {
44
+ console.log("Account:", account.accountName)
45
+ console.log("Public key:", account.publicKey)
46
+ console.log("Endpoint:", account.endpoint.url)
47
+ }
48
+
49
+ // List all accounts
50
+ const accounts = await wallet.getAccounts()
51
+ for (const acct of accounts) {
52
+ console.log(acct.name, acct.publicKeys)
53
+ }
54
+
55
+ // Sign a transaction
56
+ const result = await wallet.signTransaction({
57
+ serializedTransaction: "...",
58
+ chainId: "...",
59
+ })
60
+ console.log("Signatures:", result.signatures)
61
+ ```
62
+
63
+ ### Error handling
64
+
65
+ ```typescript
66
+ import {
67
+ WireWalletClient,
68
+ WalletNotFoundError,
69
+ WalletLockedError,
70
+ UserRejectedError,
71
+ } from "@wireio/wallet-ext-sdk"
72
+
73
+ const wallet = new WireWalletClient()
74
+
75
+ try {
76
+ await wallet.waitForProvider(5000)
77
+ const result = await wallet.signTransaction({
78
+ serializedTransaction: "...",
79
+ })
80
+ } catch (err) {
81
+ if (err instanceof WalletNotFoundError) {
82
+ console.error("Wire Wallet extension is not installed")
83
+ } else if (err instanceof WalletLockedError) {
84
+ console.error("Wallet is locked -- ask the user to unlock it")
85
+ } else if (err instanceof UserRejectedError) {
86
+ console.error("User rejected the signing request")
87
+ }
88
+ }
89
+ ```
90
+
91
+ ### Listening to events
92
+
93
+ ```typescript
94
+ const wallet = new WireWalletClient()
95
+ await wallet.waitForProvider()
96
+
97
+ wallet.on("accountChanged", (data) => {
98
+ console.log("Active account changed:", data)
99
+ })
100
+
101
+ wallet.on("lock", () => {
102
+ console.log("Wallet was locked")
103
+ })
104
+
105
+ wallet.on("unlock", () => {
106
+ console.log("Wallet was unlocked")
107
+ })
108
+ ```
109
+
110
+ ## API Reference
111
+
112
+ ### `WireWalletClient`
113
+
114
+ The main class for interacting with the Wire Wallet extension.
115
+
116
+ #### `isInstalled(): boolean`
117
+
118
+ Synchronously checks whether the Wire Wallet extension is available on the current page.
119
+
120
+ ```typescript
121
+ if (wallet.isInstalled()) {
122
+ // provider is ready
123
+ }
124
+ ```
125
+
126
+ #### `waitForProvider(timeoutMs?: number): Promise<WireWalletProvider>`
127
+
128
+ Waits for the `window.__WIRE_WALLET__` provider to become available. Polls every 100 ms until the provider is found or the timeout elapses.
129
+
130
+ | Parameter | Type | Default | Description |
131
+ |-----------|------|---------|-------------|
132
+ | `timeoutMs` | `number` | `3000` | Maximum time to wait in milliseconds |
133
+
134
+ Returns the `WireWalletProvider` instance. Throws `WalletNotFoundError` if the timeout is reached.
135
+
136
+ #### `isUnlocked(): Promise<boolean>`
137
+
138
+ Returns `true` if the wallet is currently unlocked and ready to sign transactions.
139
+
140
+ #### `getAccounts(): Promise<WireAccountInfo[]>`
141
+
142
+ Returns all accounts configured in the wallet.
143
+
144
+ Each `WireAccountInfo` contains:
145
+
146
+ ```typescript
147
+ {
148
+ name: string
149
+ publicKeys: string[]
150
+ endpoints: Array<{ name: string; url: string; kind: ChainKind }>
151
+ }
152
+ ```
153
+
154
+ #### `getActiveAccount(): Promise<ActiveAccountInfo | null>`
155
+
156
+ Returns details about the currently selected account, or `null` if no account is active.
157
+
158
+ Each `ActiveAccountInfo` contains:
159
+
160
+ ```typescript
161
+ {
162
+ accountName: string
163
+ publicKey: string
164
+ endpoint: { name: string; url: string; kind: ChainKind }
165
+ }
166
+ ```
167
+
168
+ #### `getPublicKeys(): Promise<string[]>`
169
+
170
+ Returns the public key strings associated with the active account.
171
+
172
+ #### `getEndpoints(): Promise<Array<{ name: string; url: string; kind: string }>>`
173
+
174
+ Returns all chain endpoints configured in the wallet.
175
+
176
+ #### `signTransaction(request: SignTransactionRequest): Promise<SignTransactionResult>`
177
+
178
+ Signs a serialized transaction using the active account's key.
179
+
180
+ **Request:**
181
+
182
+ ```typescript
183
+ interface SignTransactionRequest {
184
+ /** Serialized transaction bytes as hex string */
185
+ serializedTransaction: string
186
+ /** Chain ID (optional) */
187
+ chainId?: string
188
+ /** Required public keys (optional) */
189
+ requiredKeys?: string[]
190
+ }
191
+ ```
192
+
193
+ **Result:**
194
+
195
+ ```typescript
196
+ interface SignTransactionResult {
197
+ /** Array of signature strings */
198
+ signatures: string[]
199
+ /** The serialized transaction that was signed (hex) */
200
+ serializedTransaction: string
201
+ }
202
+ ```
203
+
204
+ #### `on(event: WireWalletEvent, handler: EventHandler): void`
205
+
206
+ Subscribe to a wallet event. See the Events section for available event names.
207
+
208
+ #### `removeListener(event: WireWalletEvent, handler: EventHandler): void`
209
+
210
+ Unsubscribe a previously registered event handler.
211
+
212
+ ## Types
213
+
214
+ All types are exported from the package entry point.
215
+
216
+ ### Enums
217
+
218
+ #### `KeyType`
219
+
220
+ ```typescript
221
+ enum KeyType {
222
+ K1 = "K1", // secp256k1
223
+ R1 = "R1", // secp256r1 (NIST P-256)
224
+ EM = "EM", // Ethereum
225
+ ED = "ED", // Ed25519
226
+ }
227
+ ```
228
+
229
+ #### `ChainKind`
230
+
231
+ ```typescript
232
+ enum ChainKind {
233
+ WIRE = "WIRE",
234
+ ETHEREUM = "ETHEREUM",
235
+ SOLANA = "SOLANA",
236
+ SUI = "SUI",
237
+ }
238
+ ```
239
+
240
+ ### Interfaces
241
+
242
+ | Interface | Description |
243
+ |-----------|-------------|
244
+ | `WireWalletProvider` | The raw provider object at `window.__WIRE_WALLET__` |
245
+ | `WireAccountInfo` | Account name, public keys, and endpoints |
246
+ | `ActiveAccountInfo` | Active account name, selected public key, and selected endpoint |
247
+ | `SignTransactionRequest` | Input for `signTransaction` |
248
+ | `SignTransactionResult` | Output from `signTransaction` |
249
+ | `RequestArgs` | Generic RPC request shape (`{ method, params? }`) |
250
+
251
+ ### Type aliases
252
+
253
+ | Type | Description |
254
+ |------|-------------|
255
+ | `WireWalletEvent` | Union of event name strings |
256
+ | `EventHandler` | `(...args: any[]) => void` |
257
+ | `WireWalletMethod` | Union of all `wire_*` method name strings |
258
+
259
+ ### Global augmentation
260
+
261
+ The package augments the global `Window` interface:
262
+
263
+ ```typescript
264
+ interface Window {
265
+ __WIRE_WALLET__?: WireWalletProvider
266
+ }
267
+ ```
268
+
269
+ This means `window.__WIRE_WALLET__` is typed automatically when the package is installed.
270
+
271
+ ## Error Handling
272
+
273
+ All error classes extend `WireWalletError`, which itself extends `Error`. Each error has a numeric `code` property.
274
+
275
+ | Class | Code | Message | When thrown |
276
+ |-------|------|---------|------------|
277
+ | `WireWalletError` | varies | varies | Base class for all wallet errors |
278
+ | `WalletNotFoundError` | `4001` | Wire Wallet extension not found. Please install it. | Provider not detected (extension not installed or not loaded) |
279
+ | `WalletLockedError` | `4002` | Wire Wallet is locked. Please unlock it first. | Operation attempted while the wallet is locked |
280
+ | `UserRejectedError` | `4100` | User rejected the request. | User declined a signing or permission prompt |
281
+
282
+ ```typescript
283
+ import { WireWalletError } from "@wireio/wallet-ext-sdk"
284
+
285
+ try {
286
+ await wallet.signTransaction({ serializedTransaction: "..." })
287
+ } catch (err) {
288
+ if (err instanceof WireWalletError) {
289
+ console.error(`Wallet error ${err.code}: ${err.message}`)
290
+ }
291
+ }
292
+ ```
293
+
294
+ ## Events
295
+
296
+ Subscribe to wallet lifecycle and state-change events using `on()` and `removeListener()`.
297
+
298
+ | Event | Payload | Description |
299
+ |-------|---------|-------------|
300
+ | `accountChanged` | Account data | The user switched the active account |
301
+ | `endpointChanged` | Endpoint data | The user switched the active endpoint |
302
+ | `lock` | -- | The wallet was locked (manual or auto-lock after 15 minutes) |
303
+ | `unlock` | -- | The wallet was unlocked |
304
+ | `connect` | -- | The wallet connected to the page |
305
+ | `disconnect` | -- | The wallet disconnected |
306
+
307
+ ## License
308
+
309
+ FSL-1.1-Apache-2.0
@@ -0,0 +1,31 @@
1
+ import type { WireWalletProvider, WireWalletEvent, EventHandler, WireAccountInfo, ActiveAccountInfo, SignTransactionRequest, SignTransactionResult } from "./Types";
2
+ export declare class WireWalletClient {
3
+ private provider;
4
+ /** Get the provider, throwing if not available */
5
+ private getProvider;
6
+ /** Check if the Wire Wallet extension is installed */
7
+ isInstalled(): boolean;
8
+ /** Wait for the provider to be available (with timeout) */
9
+ waitForProvider(timeoutMs?: number): Promise<WireWalletProvider>;
10
+ /** Check if the wallet is unlocked */
11
+ isUnlocked(): Promise<boolean>;
12
+ /** Get all accounts configured in the wallet */
13
+ getAccounts(): Promise<WireAccountInfo[]>;
14
+ /** Get the currently active account */
15
+ getActiveAccount(): Promise<ActiveAccountInfo | null>;
16
+ /** Get public keys for the active account */
17
+ getPublicKeys(): Promise<string[]>;
18
+ /** Get configured endpoints */
19
+ getEndpoints(): Promise<Array<{
20
+ name: string;
21
+ url: string;
22
+ kind: string;
23
+ }>>;
24
+ /** Sign a transaction */
25
+ signTransaction(request: SignTransactionRequest): Promise<SignTransactionResult>;
26
+ /** Subscribe to a wallet event */
27
+ on(event: WireWalletEvent, handler: EventHandler): void;
28
+ /** Unsubscribe from a wallet event */
29
+ removeListener(event: WireWalletEvent, handler: EventHandler): void;
30
+ }
31
+ //# sourceMappingURL=Client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAkC;IAElD,kDAAkD;IAClD,OAAO,CAAC,WAAW;IASnB,sDAAsD;IACtD,WAAW,IAAI,OAAO;IAItB,2DAA2D;IACrD,eAAe,CAAC,SAAS,SAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoBpE,sCAAsC;IAChC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC,gDAAgD;IAC1C,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAI/C,uCAAuC;IACjC,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAI3D,6CAA6C;IACvC,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIxC,+BAA+B;IACzB,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAIjF,yBAAyB;IACnB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAOtF,kCAAkC;IAClC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAIvD,sCAAsC;IACtC,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;CAGpE"}
package/lib/Client.js ADDED
@@ -0,0 +1,74 @@
1
+ import { WalletNotFoundError } from "./Errors";
2
+ export class WireWalletClient {
3
+ provider = null;
4
+ /** Get the provider, throwing if not available */
5
+ getProvider() {
6
+ if (this.provider)
7
+ return this.provider;
8
+ if (typeof window !== "undefined" && window.__WIRE_WALLET__) {
9
+ this.provider = window.__WIRE_WALLET__;
10
+ return this.provider;
11
+ }
12
+ throw new WalletNotFoundError();
13
+ }
14
+ /** Check if the Wire Wallet extension is installed */
15
+ isInstalled() {
16
+ return typeof window !== "undefined" && !!window.__WIRE_WALLET__;
17
+ }
18
+ /** Wait for the provider to be available (with timeout) */
19
+ async waitForProvider(timeoutMs = 3000) {
20
+ if (this.isInstalled())
21
+ return this.getProvider();
22
+ return new Promise((resolve, reject) => {
23
+ const timeout = setTimeout(() => {
24
+ reject(new WalletNotFoundError());
25
+ }, timeoutMs);
26
+ const check = () => {
27
+ if (this.isInstalled()) {
28
+ clearTimeout(timeout);
29
+ resolve(this.getProvider());
30
+ }
31
+ else {
32
+ setTimeout(check, 100);
33
+ }
34
+ };
35
+ check();
36
+ });
37
+ }
38
+ /** Check if the wallet is unlocked */
39
+ async isUnlocked() {
40
+ return this.getProvider().request({ method: "wire_isUnlocked" });
41
+ }
42
+ /** Get all accounts configured in the wallet */
43
+ async getAccounts() {
44
+ return this.getProvider().request({ method: "wire_getAccounts" });
45
+ }
46
+ /** Get the currently active account */
47
+ async getActiveAccount() {
48
+ return this.getProvider().request({ method: "wire_getActiveAccount" });
49
+ }
50
+ /** Get public keys for the active account */
51
+ async getPublicKeys() {
52
+ return this.getProvider().request({ method: "wire_getPublicKeys" });
53
+ }
54
+ /** Get configured endpoints */
55
+ async getEndpoints() {
56
+ return this.getProvider().request({ method: "wire_getEndpoints" });
57
+ }
58
+ /** Sign a transaction */
59
+ async signTransaction(request) {
60
+ return this.getProvider().request({
61
+ method: "wire_signTransaction",
62
+ params: [request],
63
+ });
64
+ }
65
+ /** Subscribe to a wallet event */
66
+ on(event, handler) {
67
+ this.getProvider().on(event, handler);
68
+ }
69
+ /** Unsubscribe from a wallet event */
70
+ removeListener(event, handler) {
71
+ this.getProvider().removeListener(event, handler);
72
+ }
73
+ }
74
+ //# sourceMappingURL=Client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Client.js","sourceRoot":"","sources":["../src/Client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9C,MAAM,OAAO,gBAAgB;IACnB,QAAQ,GAA8B,IAAI,CAAA;IAElD,kDAAkD;IAC1C,WAAW;QACjB,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAA;QACvC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;YAC5D,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,eAAe,CAAA;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAA;QACtB,CAAC;QACD,MAAM,IAAI,mBAAmB,EAAE,CAAA;IACjC,CAAC;IAED,sDAAsD;IACtD,WAAW;QACT,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,eAAe,CAAA;IAClE,CAAC;IAED,2DAA2D;IAC3D,KAAK,CAAC,eAAe,CAAC,SAAS,GAAG,IAAI;QACpC,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;QAEjD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC9B,MAAM,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAA;YACnC,CAAC,E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AAsB;YAC9B,MAAM,EAAE,CAAC,OAAO,CAAC;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,kCAAkC;IAClC,EAAE,CAAC,KAAsB,EAAE,OAAqB;QAC9C,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACvC,CAAC;IAED,sCAAsC;IACtC,cAAc,CAAC,KAAsB,EAAE,OAAqB;QAC1D,IAAI,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ export declare class WireWalletError extends Error {
2
+ code: number;
3
+ constructor(message: string, code: number);
4
+ }
5
+ export declare class WalletNotFoundError extends WireWalletError {
6
+ constructor();
7
+ }
8
+ export declare class WalletLockedError extends WireWalletError {
9
+ constructor();
10
+ }
11
+ export declare class UserRejectedError extends WireWalletError {
12
+ constructor();
13
+ }
14
+ //# sourceMappingURL=Errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Errors.d.ts","sourceRoot":"","sources":["../src/Errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;IAG/B,IAAI,EAAE,MAAM;gBADnB,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM;CAKtB;AAED,qBAAa,mBAAoB,SAAQ,eAAe;;CAKvD;AAED,qBAAa,iBAAkB,SAAQ,eAAe;;CAKrD;AAED,qBAAa,iBAAkB,SAAQ,eAAe;;CAKrD"}
package/lib/Errors.js ADDED
@@ -0,0 +1,27 @@
1
+ export class WireWalletError extends Error {
2
+ code;
3
+ constructor(message, code) {
4
+ super(message);
5
+ this.code = code;
6
+ this.name = "WireWalletError";
7
+ }
8
+ }
9
+ export class WalletNotFoundError extends WireWalletError {
10
+ constructor() {
11
+ super("Wire Wallet extension not found. Please install it.", 4001);
12
+ this.name = "WalletNotFoundError";
13
+ }
14
+ }
15
+ export class WalletLockedError extends WireWalletError {
16
+ constructor() {
17
+ super("Wire Wallet is locked. Please unlock it first.", 4002);
18
+ this.name = "WalletLockedError";
19
+ }
20
+ }
21
+ export class UserRejectedError extends WireWalletError {
22
+ constructor() {
23
+ super("User rejected the request.", 4100);
24
+ this.name = "UserRejectedError";
25
+ }
26
+ }
27
+ //# sourceMappingURL=Errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Errors.js","sourceRoot":"","sources":["../src/Errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAG/B;IAFT,YACE,OAAe,EACR,IAAY;QAEnB,KAAK,CAAC,OAAO,CAAC,CAAA;QAFP,SAAI,GAAJ,IAAI,CAAQ;QAGnB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IACtD;QACE,KAAK,CAAC,qDAAqD,EAAE,IAAI,CAAC,CAAA;QAClE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IACpD;QACE,KAAK,CAAC,gDAAgD,EAAE,IAAI,CAAC,CAAA;QAC7D,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IACpD;QACE,KAAK,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAA;QACzC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF"}
package/lib/Types.d.ts ADDED
@@ -0,0 +1,79 @@
1
+ /** Key types supported by Wire blockchain */
2
+ export declare enum KeyType {
3
+ K1 = "K1",
4
+ R1 = "R1",
5
+ EM = "EM",
6
+ ED = "ED"
7
+ }
8
+ /** Chain kinds supported by Wire */
9
+ export declare enum ChainKind {
10
+ WIRE = "WIRE",
11
+ ETHEREUM = "ETHEREUM",
12
+ SOLANA = "SOLANA",
13
+ SUI = "SUI"
14
+ }
15
+ /** Account information returned by the wallet */
16
+ export interface WireAccountInfo {
17
+ name: string;
18
+ publicKeys: string[];
19
+ endpoints: Array<{
20
+ name: string;
21
+ url: string;
22
+ kind: ChainKind;
23
+ }>;
24
+ }
25
+ /** Active account details */
26
+ export interface ActiveAccountInfo {
27
+ accountName: string;
28
+ publicKey: string;
29
+ endpoint: {
30
+ name: string;
31
+ url: string;
32
+ kind: ChainKind;
33
+ };
34
+ }
35
+ /** Sign transaction request */
36
+ export interface SignTransactionRequest {
37
+ /** Serialized transaction bytes as hex string */
38
+ serializedTransaction: string;
39
+ /** Chain ID */
40
+ chainId?: string;
41
+ /** Required keys (public key strings) */
42
+ requiredKeys?: string[];
43
+ }
44
+ /** Sign transaction result */
45
+ export interface SignTransactionResult {
46
+ /** Array of signature strings */
47
+ signatures: string[];
48
+ /** The serialized transaction that was signed (hex) */
49
+ serializedTransaction: string;
50
+ }
51
+ /** Provider events */
52
+ export type WireWalletEvent = "accountChanged" | "endpointChanged" | "lock" | "unlock" | "connect" | "disconnect";
53
+ /** Event handler type */
54
+ export type EventHandler = (...args: any[]) => void;
55
+ /** RPC request arguments */
56
+ export interface RequestArgs {
57
+ method: string;
58
+ params?: any[];
59
+ }
60
+ /** The provider interface injected as window.__WIRE_WALLET__ */
61
+ export interface WireWalletProvider {
62
+ /** Identifies this as the Wire Wallet */
63
+ readonly isWireWallet: true;
64
+ /** Send an RPC-style request to the wallet */
65
+ request(args: RequestArgs): Promise<any>;
66
+ /** Subscribe to wallet events */
67
+ on(event: WireWalletEvent, handler: EventHandler): void;
68
+ /** Unsubscribe from wallet events */
69
+ removeListener(event: WireWalletEvent, handler: EventHandler): void;
70
+ }
71
+ /** Methods available on the provider */
72
+ export type WireWalletMethod = "wire_getAccounts" | "wire_getActiveAccount" | "wire_signTransaction" | "wire_getPublicKeys" | "wire_getEndpoints" | "wire_isUnlocked";
73
+ /** Augment the global Window type */
74
+ declare global {
75
+ interface Window {
76
+ __WIRE_WALLET__?: WireWalletProvider;
77
+ }
78
+ }
79
+ //# sourceMappingURL=Types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,oBAAY,OAAO;IACjB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED,oCAAoC;AACpC,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAA;CACjE;AAED,6BAA6B;AAC7B,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAA;CACzD;AAED,+BAA+B;AAC/B,MAAM,WAAW,sBAAsB;IACrC,iDAAiD;IACjD,qBAAqB,EAAE,MAAM,CAAA;IAC7B,eAAe;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CACxB;AAED,8BAA8B;AAC9B,MAAM,WAAW,qBAAqB;IACpC,iCAAiC;IACjC,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,uDAAuD;IACvD,qBAAqB,EAAE,MAAM,CAAA;CAC9B;AAED,sBAAsB;AACtB,MAAM,MAAM,eAAe,GACvB,gBAAgB,GAChB,iBAAiB,GACjB,MAAM,GACN,QAAQ,GACR,SAAS,GACT,YAAY,CAAA;AAEhB,yBAAyB;AACzB,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;AAEnD,4BAA4B;AAC5B,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,GAAG,EAAE,CAAA;CACf;AAED,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;IAE3B,8CAA8C;IAC9C,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IAExC,iCAAiC;IACjC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;IAEvD,qCAAqC;IACrC,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI,CAAA;CACpE;AAED,wCAAwC;AACxC,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,uBAAuB,GACvB,sBAAsB,GACtB,oBAAoB,GACpB,mBAAmB,GACnB,iBAAiB,CAAA;AAErB,qCAAqC;AACrC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,eAAe,CAAC,EAAE,kBAAkB,CAAA;KACrC;CACF"}
package/lib/Types.js ADDED
@@ -0,0 +1,17 @@
1
+ /** Key types supported by Wire blockchain */
2
+ export var KeyType;
3
+ (function (KeyType) {
4
+ KeyType["K1"] = "K1";
5
+ KeyType["R1"] = "R1";
6
+ KeyType["EM"] = "EM";
7
+ KeyType["ED"] = "ED";
8
+ })(KeyType || (KeyType = {}));
9
+ /** Chain kinds supported by Wire */
10
+ export var ChainKind;
11
+ (function (ChainKind) {
12
+ ChainKind["WIRE"] = "WIRE";
13
+ ChainKind["ETHEREUM"] = "ETHEREUM";
14
+ ChainKind["SOLANA"] = "SOLANA";
15
+ ChainKind["SUI"] = "SUI";
16
+ })(ChainKind || (ChainKind = {}));
17
+ //# sourceMappingURL=Types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Types.js","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,CAAN,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,oBAAS,CAAA;IACT,oBAAS,CAAA;IACT,oBAAS,CAAA;IACT,oBAAS,CAAA;AACX,CAAC,EALW,OAAO,KAAP,OAAO,QAKlB;AAED,oCAAoC;AACpC,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,wBAAW,CAAA;AACb,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB"}
@@ -0,0 +1,31 @@
1
+ import type { WireWalletProvider, WireWalletEvent, EventHandler, WireAccountInfo, ActiveAccountInfo, SignTransactionRequest, SignTransactionResult } from "./types";
2
+ export declare class WireWalletClient {
3
+ private provider;
4
+ /** Get the provider, throwing if not available */
5
+ private getProvider;
6
+ /** Check if the Wire Wallet extension is installed */
7
+ isInstalled(): boolean;
8
+ /** Wait for the provider to be available (with timeout) */
9
+ waitForProvider(timeoutMs?: number): Promise<WireWalletProvider>;
10
+ /** Check if the wallet is unlocked */
11
+ isUnlocked(): Promise<boolean>;
12
+ /** Get all accounts configured in the wallet */
13
+ getAccounts(): Promise<WireAccountInfo[]>;
14
+ /** Get the currently active account */
15
+ getActiveAccount(): Promise<ActiveAccountInfo | null>;
16
+ /** Get public keys for the active account */
17
+ getPublicKeys(): Promise<string[]>;
18
+ /** Get configured endpoints */
19
+ getEndpoints(): Promise<Array<{
20
+ name: string;
21
+ url: string;
22
+ kind: string;
23
+ }>>;
24
+ /** Sign a transaction */
25
+ signTransaction(request: SignTransactionRequest): Promise<SignTransactionResult>;
26
+ /** Subscribe to a wallet event */
27
+ on(event: WireWalletEvent, handler: EventHandler): void;
28
+ /** Unsubscribe from a wallet event */
29
+ removeListener(event: WireWalletEvent, handler: EventHandler): void;
30
+ }
31
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAkC;IAElD,kDAAkD;IAClD,OAAO,CAAC,WAAW;IASnB,sDAAsD;IACtD,WAAW,IAAI,OAAO;IAItB,2DAA2D;IACrD,eAAe,CAAC,SAAS,SAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAoBpE,sCAAsC;IAChC,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAIpC,gDAAgD;IAC1C,WAAW,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAI/C,uCAAuC;IACjC,gBAAgB,IAAI,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAI3D,6CAA6C;IACvC,aAAa,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAIxC,+BAA+B;IACzB,YAAY,IAAI,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAIjF,yBAAyB;IACnB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAOtF,kCAAkC;IAClC,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;IAIvD,sCAAsC;IACtC,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,GAAG,IAAI;CAGpE"}
package/lib/client.js ADDED
@@ -0,0 +1,74 @@
1
+ import { WalletNotFoundError } from "./errors";
2
+ export class WireWalletClient {
3
+ provider = null;
4
+ /** Get the provider, throwing if not available */
5
+ getProvider() {
6
+ if (this.provider)
7
+ return this.provider;
8
+ if (typeof window !== "undefined" && window.__WIRE_WALLET__) {
9
+ this.provider = window.__WIRE_WALLET__;
10
+ return this.provider;
11
+ }
12
+ throw new WalletNotFoundError();
13
+ }
14
+ /** Check if the Wire Wallet extension is installed */
15
+ isInstalled() {
16
+ return typeof window !== "undefined" && !!window.__WIRE_WALLET__;
17
+ }
18
+ /** Wait for the provider to be available (with timeout) */
19
+ async waitForProvider(timeoutMs = 3000) {
20
+ if (this.isInstalled())
21
+ return this.getProvider();
22
+ return new Promise((resolve, reject) => {
23
+ const timeout = setTimeout(() => {
24
+ reject(new WalletNotFoundError());
25
+ }, timeoutMs);
26
+ const check = () => {
27
+ if (this.isInstalled()) {
28
+ clearTimeout(timeout);
29
+ resolve(this.getProvider());
30
+ }
31
+ else {
32
+ setTimeout(check, 100);
33
+ }
34
+ };
35
+ check();
36
+ });
37
+ }
38
+ /** Check if the wallet is unlocked */
39
+ async isUnlocked() {
40
+ return this.getProvider().request({ method: "wire_isUnlocked" });
41
+ }
42
+ /** Get all accounts configured in the wallet */
43
+ async getAccounts() {
44
+ return this.getProvider().request({ method: "wire_getAccounts" });
45
+ }
46
+ /** Get the currently active account */
47
+ async getActiveAccount() {
48
+ return this.getProvider().request({ method: "wire_getActiveAccount" });
49
+ }
50
+ /** Get public keys for the active account */
51
+ async getPublicKeys() {
52
+ return this.getProvider().request({ method: "wire_getPublicKeys" });
53
+ }
54
+ /** Get configured endpoints */
55
+ async getEndpoints() {
56
+ return this.getProvider().request({ method: "wire_getEndpoints" });
57
+ }
58
+ /** Sign a transaction */
59
+ async signTransaction(request) {
60
+ return this.getProvider().request({
61
+ method: "wire_signTransaction",
62
+ params: [request],
63
+ });
64
+ }
65
+ /** Subscribe to a wallet event */
66
+ on(event, handler) {
67
+ this.getProvider().on(event, handler);
68
+ }
69
+ /** Unsubscribe from a wallet event */
70
+ removeListener(event, handler) {
71
+ this.getProvider().removeListener(event, handler);
72
+ }
73
+ }
74
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAA;AAE9C,MAAM,OAAO,gBAAgB;IACnB,QAAQ,GAA8B,IAAI,CAAA;IAElD,kDAAkD;IAC1C,WAAW;QACjB,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAA;QACvC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;YAC5D,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,eAAe,CAAA;YACtC,OAAO,IAAI,CAAC,QAAQ,CAAA;QACtB,CAAC;QACD,MAAM,IAAI,mBAAmB,EAAE,CAAA;IACjC,CAAC;IAED,sDAAsD;IACtD,WAAW;QACT,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,MAAM,CAAC,eAAe,CAAA;IAClE,CAAC;IAED,2DAA2D;IAC3D,KAAK,CAAC,eAAe,CAAC,SAAS,GAAG,IAAI;QACpC,IAAI,IAAI,CAAC,WAAW,EAAE;YAAE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAA;QAEjD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;gBAC9B,MAAM,CAAC,IAAI,mBAAmB,EAAE,CAAC,CAAA;YACnC,CAAC,EAAE,SAAS,CAAC,CAAA;YAEb,MAAM,KAAK,GAAG,GAAG,EAAE;gBACj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J,CAAC;IAED,kCAAkC;IAClC,EAAE,CAAC,KAAsB,EAAE,OAAqB;QAC9C,IAAI,CAAC,WAAW,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACvC,CAAC;IAED,sCAAsC;IACtC,cAAc,CAAC,KAAsB,EAAE,OAAqB;QAC1D,IAAI,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACnD,CAAC;CACF"}
@@ -0,0 +1,14 @@
1
+ export declare class WireWalletError extends Error {
2
+ code: number;
3
+ constructor(message: string, code: number);
4
+ }
5
+ export declare class WalletNotFoundError extends WireWalletError {
6
+ constructor();
7
+ }
8
+ export declare class WalletLockedError extends WireWalletError {
9
+ constructor();
10
+ }
11
+ export declare class UserRejectedError extends WireWalletError {
12
+ constructor();
13
+ }
14
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;IAG/B,IAAI,EAAE,MAAM;gBADnB,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM;CAKtB;AAED,qBAAa,mBAAoB,SAAQ,eAAe;;CAKvD;AAED,qBAAa,iBAAkB,SAAQ,eAAe;;CAKrD;AAED,qBAAa,iBAAkB,SAAQ,eAAe;;CAKrD"}
package/lib/errors.js ADDED
@@ -0,0 +1,27 @@
1
+ export class WireWalletError extends Error {
2
+ code;
3
+ constructor(message, code) {
4
+ super(message);
5
+ this.code = code;
6
+ this.name = "WireWalletError";
7
+ }
8
+ }
9
+ export class WalletNotFoundError extends WireWalletError {
10
+ constructor() {
11
+ super("Wire Wallet extension not found. Please install it.", 4001);
12
+ this.name = "WalletNotFoundError";
13
+ }
14
+ }
15
+ export class WalletLockedError extends WireWalletError {
16
+ constructor() {
17
+ super("Wire Wallet is locked. Please unlock it first.", 4002);
18
+ this.name = "WalletLockedError";
19
+ }
20
+ }
21
+ export class UserRejectedError extends WireWalletError {
22
+ constructor() {
23
+ super("User rejected the request.", 4100);
24
+ this.name = "UserRejectedError";
25
+ }
26
+ }
27
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAG/B;IAFT,YACE,OAAe,EACR,IAAY;QAEnB,KAAK,CAAC,OAAO,CAAC,CAAA;QAFP,SAAI,GAAJ,IAAI,CAAQ;QAGnB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IACtD;QACE,KAAK,CAAC,qDAAqD,EAAE,IAAI,CAAC,CAAA;QAClE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAA;IACnC,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IACpD;QACE,KAAK,CAAC,gDAAgD,EAAE,IAAI,CAAC,CAAA;QAC7D,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,eAAe;IACpD;QACE,KAAK,CAAC,4BAA4B,EAAE,IAAI,CAAC,CAAA;QACzC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAA;IACjC,CAAC;CACF"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./Types";
2
+ export * from "./Errors";
3
+ export { WireWalletClient } from "./Client";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./Types";
2
+ export * from "./Errors";
3
+ export { WireWalletClient } from "./Client";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA"}
package/lib/types.d.ts ADDED
@@ -0,0 +1,79 @@
1
+ /** Key types supported by Wire blockchain */
2
+ export declare enum KeyType {
3
+ K1 = "K1",
4
+ R1 = "R1",
5
+ EM = "EM",
6
+ ED = "ED"
7
+ }
8
+ /** Chain kinds supported by Wire */
9
+ export declare enum ChainKind {
10
+ WIRE = "WIRE",
11
+ ETHEREUM = "ETHEREUM",
12
+ SOLANA = "SOLANA",
13
+ SUI = "SUI"
14
+ }
15
+ /** Account information returned by the wallet */
16
+ export interface WireAccountInfo {
17
+ name: string;
18
+ publicKeys: string[];
19
+ endpoints: Array<{
20
+ name: string;
21
+ url: string;
22
+ kind: ChainKind;
23
+ }>;
24
+ }
25
+ /** Active account details */
26
+ export interface ActiveAccountInfo {
27
+ accountName: string;
28
+ publicKey: string;
29
+ endpoint: {
30
+ name: string;
31
+ url: string;
32
+ kind: ChainKind;
33
+ };
34
+ }
35
+ /** Sign transaction request */
36
+ export interface SignTransactionRequest {
37
+ /** Serialized transaction bytes as hex string */
38
+ serializedTransaction: string;
39
+ /** Chain ID */
40
+ chainId?: string;
41
+ /** Required keys (public key strings) */
42
+ requiredKeys?: string[];
43
+ }
44
+ /** Sign transaction result */
45
+ export interface SignTransactionResult {
46
+ /** Array of signature strings */
47
+ signatures: string[];
48
+ /** The serialized transaction that was signed (hex) */
49
+ serializedTransaction: string;
50
+ }
51
+ /** Provider events */
52
+ export type WireWalletEvent = "accountChanged" | "endpointChanged" | "lock" | "unlock" | "connect" | "disconnect";
53
+ /** Event handler type */
54
+ export type EventHandler = (...args: any[]) => void;
55
+ /** RPC request arguments */
56
+ export interface RequestArgs {
57
+ method: string;
58
+ params?: any[];
59
+ }
60
+ /** The provider interface injected as window.__WIRE_WALLET__ */
61
+ export interface WireWalletProvider {
62
+ /** Identifies this as the Wire Wallet */
63
+ readonly isWireWallet: true;
64
+ /** Send an RPC-style request to the wallet */
65
+ request(args: RequestArgs): Promise<any>;
66
+ /** Subscribe to wallet events */
67
+ on(event: WireWalletEvent, handler: EventHandler): void;
68
+ /** Unsubscribe from wallet events */
69
+ removeListener(event: WireWalletEvent, handler: EventHandler): void;
70
+ }
71
+ /** Methods available on the provider */
72
+ export type WireWalletMethod = "wire_getAccounts" | "wire_getActiveAccount" | "wire_signTransaction" | "wire_getPublicKeys" | "wire_getEndpoints" | "wire_isUnlocked";
73
+ /** Augment the global Window type */
74
+ declare global {
75
+ interface Window {
76
+ __WIRE_WALLET__?: WireWalletProvider;
77
+ }
78
+ }
79
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,oBAAY,OAAO;IACjB,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;IACT,EAAE,OAAO;CACV;AAED,oCAAoC;AACpC,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,GAAG,QAAQ;CACZ;AAED,iDAAiD;AACjD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,SAAS,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC,CAAA;CACjE;AAED,6BAA6B;AAC7B,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE,MAAM,CAA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AACxC,MAAM,MAAM,gBAAgB,GACxB,kBAAkB,GAClB,uBAAuB,GACvB,sBAAsB,GACtB,oBAAoB,GACpB,mBAAmB,GACnB,iBAAiB,CAAA;AAErB,qCAAqC;AACrC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,eAAe,CAAC,EAAE,kBAAkB,CAAA;KACrC;CACF"}
package/lib/types.js ADDED
@@ -0,0 +1,17 @@
1
+ /** Key types supported by Wire blockchain */
2
+ export var KeyType;
3
+ (function (KeyType) {
4
+ KeyType["K1"] = "K1";
5
+ KeyType["R1"] = "R1";
6
+ KeyType["EM"] = "EM";
7
+ KeyType["ED"] = "ED";
8
+ })(KeyType || (KeyType = {}));
9
+ /** Chain kinds supported by Wire */
10
+ export var ChainKind;
11
+ (function (ChainKind) {
12
+ ChainKind["WIRE"] = "WIRE";
13
+ ChainKind["ETHEREUM"] = "ETHEREUM";
14
+ ChainKind["SOLANA"] = "SOLANA";
15
+ ChainKind["SUI"] = "SUI";
16
+ })(ChainKind || (ChainKind = {}));
17
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,MAAM,CAAN,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,oBAAS,CAAA;IACT,oBAAS,CAAA;IACT,oBAAS,CAAA;IACT,oBAAS,CAAA;AACX,CAAC,EALW,OAAO,KAAP,OAAO,QAKlB;AAED,oCAAoC;AACpC,MAAM,CAAN,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,0BAAa,CAAA;IACb,kCAAqB,CAAA;IACrB,8BAAiB,CAAA;IACjB,wBAAW,CAAA;AACb,CAAC,EALW,SAAS,KAAT,SAAS,QAKpB"}
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@wireio/wallet-ext-sdk",
3
+ "description": "Client SDK for the Wire Wallet browser extension",
4
+ "version": "0.1.0",
5
+ "private": false,
6
+ "publishConfig": { "access": "public" },
7
+ "files": ["lib"],
8
+ "type": "module",
9
+ "types": "lib/index.d.ts",
10
+ "module": "lib/index.js",
11
+ "license": "FSL-1.1-Apache-2.0",
12
+ "scripts": {
13
+ "build": "tsc -b tsconfig.json",
14
+ "build:dev": "tsc -b tsconfig.json -w",
15
+ "test": "jest"
16
+ },
17
+ "dependencies": {
18
+ "tslib": "^2.1.0"
19
+ }
20
+ }