@storm-trade/wallet-core 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,50 @@
1
+ export declare type ActiveSessionsResponse = {
2
+ addresses: string[];
3
+ };
4
+
5
+ export declare type ConnectResponse = {
6
+ publicKey: Uint8Array;
7
+ };
8
+
9
+ export declare class IframeAdapter {
10
+ private readonly host;
11
+ private readonly initTimeout;
12
+ private readonly connectTimeout;
13
+ private readonly signTimeout;
14
+ private readonly activeSessionTimeout;
15
+ private readonly waitingForResponse;
16
+ private iframe?;
17
+ private state;
18
+ constructor(props: IframeAdapterProps);
19
+ private sendMessage;
20
+ private setupMessageListener;
21
+ private handleMessage;
22
+ private attachIframe;
23
+ init(root: HTMLElement): Promise<void>;
24
+ destroy(): void;
25
+ connect(masterAddress: string): Promise<ConnectResponse>;
26
+ signMessage(masterAddress: string, message: SignRequest): Promise<SignResponse>;
27
+ getActiveSessions(): Promise<ActiveSessionsResponse>;
28
+ disconnect(masterAddress: string): Promise<void>;
29
+ }
30
+
31
+ export declare type IframeAdapterProps = {
32
+ host: string;
33
+ initTimeout?: number;
34
+ connectTimeout?: number;
35
+ signTimeout?: number;
36
+ activeSessionTimeout?: number;
37
+ };
38
+
39
+ export declare type PingResponse = {};
40
+
41
+ export declare type SignRequest = {
42
+ body: Uint8Array;
43
+ };
44
+
45
+ export declare type SignResponse = {
46
+ hash: Uint8Array;
47
+ signature: Uint8Array;
48
+ };
49
+
50
+ export { }
@@ -0,0 +1,78 @@
1
+ var h = Object.defineProperty;
2
+ var m = (a, e, t) => e in a ? h(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
+ var s = (a, e, t) => m(a, typeof e != "symbol" ? e + "" : e, t);
4
+ class g {
5
+ constructor(e) {
6
+ s(this, "host");
7
+ s(this, "initTimeout");
8
+ s(this, "connectTimeout");
9
+ s(this, "signTimeout");
10
+ s(this, "activeSessionTimeout");
11
+ s(this, "waitingForResponse", /* @__PURE__ */ new Map());
12
+ s(this, "iframe");
13
+ s(this, "state", "not-ready");
14
+ s(this, "handleMessage", (e) => {
15
+ if (typeof e.data != "object" || e.data === null || !("payload" in e.data) || !("id" in e.data) || !("status" in e.data) || typeof e.data.id != "string" || typeof e.data.status != "string")
16
+ return;
17
+ const t = this.waitingForResponse.get(e.data.id);
18
+ if (!t)
19
+ return;
20
+ const [i, n] = t;
21
+ e.data.status === "success" ? i(e.data.payload) : "error" in e.data ? n(new Error(e.data.error)) : n(new Error("Unknown error"));
22
+ });
23
+ this.host = e.host, this.initTimeout = e.initTimeout ?? 5e3, this.connectTimeout = e.connectTimeout ?? 6e4, this.signTimeout = e.signTimeout ?? 6e4, this.activeSessionTimeout = e.activeSessionTimeout ?? 5e3;
24
+ }
25
+ async sendMessage(e, t) {
26
+ var r, o;
27
+ const i = Math.random().toString(), n = Promise.race([
28
+ new Promise((c, d) => {
29
+ this.waitingForResponse.set(i, [c, d]);
30
+ }),
31
+ new Promise((c, d) => {
32
+ setTimeout(() => {
33
+ d(new Error("Response timeout"));
34
+ }, t);
35
+ })
36
+ ]);
37
+ return (o = (r = this.iframe) == null ? void 0 : r.contentWindow) == null || o.postMessage({ id: i, payload: e }, this.host), n;
38
+ }
39
+ setupMessageListener() {
40
+ window.addEventListener("message", this.handleMessage);
41
+ }
42
+ async attachIframe(e) {
43
+ return this.iframe = document.createElement("iframe"), this.iframe.src = this.host, this.iframe.frameBorder = "0", e.appendChild(this.iframe), new Promise((t, i) => {
44
+ var n, r;
45
+ (n = this.iframe) == null || n.addEventListener("load", async () => {
46
+ t();
47
+ }, { once: !0 }), (r = this.iframe) == null || r.addEventListener("error", (o) => {
48
+ i(o);
49
+ }, { once: !0 });
50
+ });
51
+ }
52
+ async init(e) {
53
+ this.state === "not-ready" && (this.state = "initializing", await this.attachIframe(e), this.setupMessageListener(), await this.sendMessage({ type: "ping" }, this.initTimeout), this.state = "ready");
54
+ }
55
+ destroy() {
56
+ var e;
57
+ this.state = "not-ready", window.removeEventListener("message", this.handleMessage);
58
+ for (const [t, i] of this.waitingForResponse.values())
59
+ i(new Error("Iframe disconnected"));
60
+ this.waitingForResponse.clear(), (e = this.iframe) == null || e.remove();
61
+ }
62
+ async connect(e) {
63
+ return this.sendMessage({ type: "connect", address: e }, this.connectTimeout);
64
+ }
65
+ async signMessage(e, t) {
66
+ return this.sendMessage({ type: "sign", address: e, message: t }, this.signTimeout);
67
+ }
68
+ async getActiveSessions() {
69
+ return this.sendMessage({ type: "active-sessions" }, this.activeSessionTimeout);
70
+ }
71
+ async disconnect(e) {
72
+ return this.sendMessage({ type: "disconnect", address: e }, 1e3);
73
+ }
74
+ }
75
+ export {
76
+ g as IframeAdapter
77
+ };
78
+ //# sourceMappingURL=wallet-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-core.js","sources":["../src/adapters/iframe-adapter.ts"],"sourcesContent":["import {\n ActiveSessionsResponse,\n AdapterState,\n ConnectResponse,\n IframeAdapterProps,\n SignRequest,\n SignResponse\n} from \"../types.ts\";\n\ntype Waiter = [(value: any) => void, (e: Error) => void]\n\nexport class IframeAdapter {\n private readonly host: string;\n private readonly initTimeout: number;\n private readonly connectTimeout: number;\n private readonly signTimeout: number;\n private readonly activeSessionTimeout: number;\n private readonly waitingForResponse = new Map<string, Waiter>()\n private iframe?: HTMLIFrameElement;\n private state: AdapterState = 'not-ready';\n\n constructor(props: IframeAdapterProps) {\n this.host = props.host;\n this.initTimeout = props.initTimeout ?? 5000\n this.connectTimeout = props.connectTimeout ?? 60000\n this.signTimeout = props.signTimeout ?? 60000\n this.activeSessionTimeout = props.activeSessionTimeout ?? 5000\n }\n\n private async sendMessage<R>(payload: unknown, timeout: number): Promise<R> {\n const messageId = Math.random().toString()\n const response = Promise.race([\n new Promise<R>((resolve, reject) => {\n this.waitingForResponse.set(messageId, [resolve, reject])\n }),\n new Promise<R>((_, reject) => {\n setTimeout(() => {\n reject(new Error('Response timeout'))\n }, timeout)\n })\n ])\n this.iframe?.contentWindow?.postMessage({ id: messageId, payload }, this.host);\n return response\n }\n\n private setupMessageListener() {\n window.addEventListener('message', this.handleMessage);\n }\n\n private handleMessage = (e: MessageEvent<unknown>) => {\n if (typeof e.data !== 'object' || e.data === null) {\n return\n }\n if (!('payload' in e.data) || !('id' in e.data) || !('status' in e.data)) {\n return;\n }\n if (typeof e.data.id !== 'string' || typeof e.data.status !== 'string') {\n return;\n }\n const waiter = this.waitingForResponse.get(e.data.id)\n if (!waiter) {\n return;\n }\n const [resolve, reject] = waiter;\n if (e.data.status === 'success') {\n resolve(e.data.payload)\n } else {\n if ('error' in e.data) {\n reject(new Error(e.data.error as string))\n } else {\n reject(new Error('Unknown error'))\n }\n }\n\n }\n\n private async attachIframe(root: HTMLElement): Promise<void> {\n this.iframe = document.createElement('iframe');\n this.iframe.src = this.host;\n this.iframe.frameBorder = '0'\n root.appendChild(this.iframe)\n return new Promise((resolve, reject) => {\n this.iframe?.addEventListener('load', async () => {\n resolve();\n }, { once: true })\n this.iframe?.addEventListener('error', (e) => {\n reject(e)\n }, { once: true })\n })\n }\n\n async init(root: HTMLElement): Promise<void> {\n if (this.state === 'not-ready') {\n this.state = 'initializing'\n await this.attachIframe(root)\n this.setupMessageListener()\n await this.sendMessage({ type: 'ping' }, this.initTimeout)\n this.state = 'ready'\n }\n }\n\n destroy(): void {\n this.state = 'not-ready'\n window.removeEventListener('message', this.handleMessage);\n for (const [_, reject] of this.waitingForResponse.values()) {\n reject(new Error('Iframe disconnected'));\n }\n this.waitingForResponse.clear()\n this.iframe?.remove();\n }\n\n async connect(masterAddress: string): Promise<ConnectResponse> {\n return this.sendMessage({ type: 'connect', address: masterAddress }, this.connectTimeout)\n }\n\n async signMessage(masterAddress: string, message: SignRequest): Promise<SignResponse> {\n return this.sendMessage({ type: 'sign', address: masterAddress, message }, this.signTimeout)\n }\n\n async getActiveSessions(): Promise<ActiveSessionsResponse> {\n return this.sendMessage({ type: 'active-sessions' }, this.activeSessionTimeout)\n }\n\n async disconnect(masterAddress: string): Promise<void> {\n return this.sendMessage({ type: 'disconnect', address: masterAddress }, 1000)\n }\n}\n"],"names":["IframeAdapter","props","__publicField","waiter","resolve","reject","payload","timeout","_a","_b","messageId","response","_","root","e","masterAddress","message"],"mappings":";;;AAWO,MAAMA,EAAc;AAAA,EAUzB,YAAYC,GAA2B;AATtB,IAAAC,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA;AACA,IAAAA,EAAA,gDAAyB,IAAoB;AACtD,IAAAA,EAAA;AACA,IAAAA,EAAA,eAAsB;AA8BtB,IAAAA,EAAA,uBAAgB,CAAC,MAA6B;AAOhD,UANA,OAAO,EAAE,QAAS,YAAY,EAAE,SAAS,QAGzC,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,SAG/D,OAAO,EAAE,KAAK,MAAO,YAAY,OAAO,EAAE,KAAK,UAAW;AAC5D;AAEF,YAAMC,IAAS,KAAK,mBAAmB,IAAI,EAAE,KAAK,EAAE;AACpD,UAAI,CAACA;AACH;AAEI,YAAA,CAACC,GAASC,CAAM,IAAIF;AACtB,MAAA,EAAE,KAAK,WAAW,YACZC,EAAA,EAAE,KAAK,OAAO,IAElB,WAAW,EAAE,OACfC,EAAO,IAAI,MAAM,EAAE,KAAK,KAAe,CAAC,IAEjCA,EAAA,IAAI,MAAM,eAAe,CAAC;AAAA,IAIvC;AApDE,SAAK,OAAOJ,EAAM,MACb,KAAA,cAAcA,EAAM,eAAe,KACnC,KAAA,iBAAiBA,EAAM,kBAAkB,KACzC,KAAA,cAAcA,EAAM,eAAe,KACnC,KAAA,uBAAuBA,EAAM,wBAAwB;AAAA,EAAA;AAAA,EAG5D,MAAc,YAAeK,GAAkBC,GAA6B;AAlBvE,QAAAC,GAAAC;AAmBH,UAAMC,IAAY,KAAK,OAAO,EAAE,SAAS,GACnCC,IAAW,QA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X,QAAAL;AA2FH,SAAK,QAAQ,aACN,OAAA,oBAAoB,WAAW,KAAK,aAAa;AACxD,eAAW,CAACI,GAAGP,CAAM,KAAK,KAAK,mBAAmB;AACzC,MAAAA,EAAA,IAAI,MAAM,qBAAqB,CAAC;AAEzC,SAAK,mBAAmB,MAAM,IAC9BG,IAAA,KAAK,WAAL,QAAAA,EAAa;AAAA,EAAO;AAAA,EAGtB,MAAM,QAAQO,GAAiD;AACtD,WAAA,KAAK,YAAY,EAAE,MAAM,WAAW,SAASA,EAAA,GAAiB,KAAK,cAAc;AAAA,EAAA;AAAA,EAG1F,MAAM,YAAYA,GAAuBC,GAA6C;AAC7E,WAAA,KAAK,YAAY,EAAE,MAAM,QAAQ,SAASD,GAAe,SAAAC,EAAA,GAAW,KAAK,WAAW;AAAA,EAAA;AAAA,EAG7F,MAAM,oBAAqD;AACzD,WAAO,KAAK,YAAY,EAAE,MAAM,kBAAkB,GAAG,KAAK,oBAAoB;AAAA,EAAA;AAAA,EAGhF,MAAM,WAAWD,GAAsC;AAC9C,WAAA,KAAK,YAAY,EAAE,MAAM,cAAc,SAASA,KAAiB,GAAI;AAAA,EAAA;AAEhF;"}
@@ -0,0 +1,2 @@
1
+ (function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.WalletCore={}))})(this,function(s){"use strict";var u=Object.defineProperty;var f=(s,t,o)=>t in s?u(s,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):s[t]=o;var i=(s,t,o)=>f(s,typeof t!="symbol"?t+"":t,o);class t{constructor(e){i(this,"host");i(this,"initTimeout");i(this,"connectTimeout");i(this,"signTimeout");i(this,"activeSessionTimeout");i(this,"waitingForResponse",new Map);i(this,"iframe");i(this,"state","not-ready");i(this,"handleMessage",e=>{if(typeof e.data!="object"||e.data===null||!("payload"in e.data)||!("id"in e.data)||!("status"in e.data)||typeof e.data.id!="string"||typeof e.data.status!="string")return;const n=this.waitingForResponse.get(e.data.id);if(!n)return;const[a,r]=n;e.data.status==="success"?a(e.data.payload):"error"in e.data?r(new Error(e.data.error)):r(new Error("Unknown error"))});this.host=e.host,this.initTimeout=e.initTimeout??5e3,this.connectTimeout=e.connectTimeout??6e4,this.signTimeout=e.signTimeout??6e4,this.activeSessionTimeout=e.activeSessionTimeout??5e3}async sendMessage(e,n){var d,c;const a=Math.random().toString(),r=Promise.race([new Promise((m,h)=>{this.waitingForResponse.set(a,[m,h])}),new Promise((m,h)=>{setTimeout(()=>{h(new Error("Response timeout"))},n)})]);return(c=(d=this.iframe)==null?void 0:d.contentWindow)==null||c.postMessage({id:a,payload:e},this.host),r}setupMessageListener(){window.addEventListener("message",this.handleMessage)}async attachIframe(e){return this.iframe=document.createElement("iframe"),this.iframe.src=this.host,this.iframe.frameBorder="0",e.appendChild(this.iframe),new Promise((n,a)=>{var r,d;(r=this.iframe)==null||r.addEventListener("load",async()=>{n()},{once:!0}),(d=this.iframe)==null||d.addEventListener("error",c=>{a(c)},{once:!0})})}async init(e){this.state==="not-ready"&&(this.state="initializing",await this.attachIframe(e),this.setupMessageListener(),await this.sendMessage({type:"ping"},this.initTimeout),this.state="ready")}destroy(){var e;this.state="not-ready",window.removeEventListener("message",this.handleMessage);for(const[n,a]of this.waitingForResponse.values())a(new Error("Iframe disconnected"));this.waitingForResponse.clear(),(e=this.iframe)==null||e.remove()}async connect(e){return this.sendMessage({type:"connect",address:e},this.connectTimeout)}async signMessage(e,n){return this.sendMessage({type:"sign",address:e,message:n},this.signTimeout)}async getActiveSessions(){return this.sendMessage({type:"active-sessions"},this.activeSessionTimeout)}async disconnect(e){return this.sendMessage({type:"disconnect",address:e},1e3)}}s.IframeAdapter=t,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=wallet-core.umd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-core.umd.cjs","sources":["../src/adapters/iframe-adapter.ts"],"sourcesContent":["import {\n ActiveSessionsResponse,\n AdapterState,\n ConnectResponse,\n IframeAdapterProps,\n SignRequest,\n SignResponse\n} from \"../types.ts\";\n\ntype Waiter = [(value: any) => void, (e: Error) => void]\n\nexport class IframeAdapter {\n private readonly host: string;\n private readonly initTimeout: number;\n private readonly connectTimeout: number;\n private readonly signTimeout: number;\n private readonly activeSessionTimeout: number;\n private readonly waitingForResponse = new Map<string, Waiter>()\n private iframe?: HTMLIFrameElement;\n private state: AdapterState = 'not-ready';\n\n constructor(props: IframeAdapterProps) {\n this.host = props.host;\n this.initTimeout = props.initTimeout ?? 5000\n this.connectTimeout = props.connectTimeout ?? 60000\n this.signTimeout = props.signTimeout ?? 60000\n this.activeSessionTimeout = props.activeSessionTimeout ?? 5000\n }\n\n private async sendMessage<R>(payload: unknown, timeout: number): Promise<R> {\n const messageId = Math.random().toString()\n const response = Promise.race([\n new Promise<R>((resolve, reject) => {\n this.waitingForResponse.set(messageId, [resolve, reject])\n }),\n new Promise<R>((_, reject) => {\n setTimeout(() => {\n reject(new Error('Response timeout'))\n }, timeout)\n })\n ])\n this.iframe?.contentWindow?.postMessage({ id: messageId, payload }, this.host);\n return response\n }\n\n private setupMessageListener() {\n window.addEventListener('message', this.handleMessage);\n }\n\n private handleMessage = (e: MessageEvent<unknown>) => {\n if (typeof e.data !== 'object' || e.data === null) {\n return\n }\n if (!('payload' in e.data) || !('id' in e.data) || !('status' in e.data)) {\n return;\n }\n if (typeof e.data.id !== 'string' || typeof e.data.status !== 'string') {\n return;\n }\n const waiter = this.waitingForResponse.get(e.data.id)\n if (!waiter) {\n return;\n }\n const [resolve, reject] = waiter;\n if (e.data.status === 'success') {\n resolve(e.data.payload)\n } else {\n if ('error' in e.data) {\n reject(new Error(e.data.error as string))\n } else {\n reject(new Error('Unknown error'))\n }\n }\n\n }\n\n private async attachIframe(root: HTMLElement): Promise<void> {\n this.iframe = document.createElement('iframe');\n this.iframe.src = this.host;\n this.iframe.frameBorder = '0'\n root.appendChild(this.iframe)\n return new Promise((resolve, reject) => {\n this.iframe?.addEventListener('load', async () => {\n resolve();\n }, { once: true })\n this.iframe?.addEventListener('error', (e) => {\n reject(e)\n }, { once: true })\n })\n }\n\n async init(root: HTMLElement): Promise<void> {\n if (this.state === 'not-ready') {\n this.state = 'initializing'\n await this.attachIframe(root)\n this.setupMessageListener()\n await this.sendMessage({ type: 'ping' }, this.initTimeout)\n this.state = 'ready'\n }\n }\n\n destroy(): void {\n this.state = 'not-ready'\n window.removeEventListener('message', this.handleMessage);\n for (const [_, reject] of this.waitingForResponse.values()) {\n reject(new Error('Iframe disconnected'));\n }\n this.waitingForResponse.clear()\n this.iframe?.remove();\n }\n\n async connect(masterAddress: string): Promise<ConnectResponse> {\n return this.sendMessage({ type: 'connect', address: masterAddress }, this.connectTimeout)\n }\n\n async signMessage(masterAddress: string, message: SignRequest): Promise<SignResponse> {\n return this.sendMessage({ type: 'sign', address: masterAddress, message }, this.signTimeout)\n }\n\n async getActiveSessions(): Promise<ActiveSessionsResponse> {\n return this.sendMessage({ type: 'active-sessions' }, this.activeSessionTimeout)\n }\n\n async disconnect(masterAddress: string): Promise<void> {\n return this.sendMessage({ type: 'disconnect', address: masterAddress }, 1000)\n }\n}\n"],"names":["IframeAdapter","props","__publicField","waiter","resolve","reject","payload","timeout","messageId","response","_","_b","_a","root","e","masterAddress","message"],"mappings":"sYAWO,MAAMA,CAAc,CAUzB,YAAYC,EAA2B,CATtBC,EAAA,aACAA,EAAA,oBACAA,EAAA,uBACAA,EAAA,oBACAA,EAAA,6BACAA,EAAA,8BAAyB,KAClCA,EAAA,eACAA,EAAA,aAAsB,aA8BtBA,EAAA,qBAAiB,GAA6B,CAOhD,GANA,OAAO,EAAE,MAAS,UAAY,EAAE,OAAS,MAGzC,EAAE,YAAa,EAAE,OAAS,EAAE,OAAQ,EAAE,OAAS,EAAE,WAAY,EAAE,OAG/D,OAAO,EAAE,KAAK,IAAO,UAAY,OAAO,EAAE,KAAK,QAAW,SAC5D,O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SAAY,CACxCR,EAAA,CAAA,EACP,CAAE,KAAM,MACXO,EAAA,KAAK,SAAL,MAAAA,EAAa,iBAAiB,QAAUG,GAAM,CAC5CT,EAAOS,CAAC,CAAA,EACP,CAAE,KAAM,IAAM,CAClB,CAAA,CAGH,MAAM,KAAKD,EAAkC,CACvC,KAAK,QAAU,cACjB,KAAK,MAAQ,eACP,MAAA,KAAK,aAAaA,CAAI,EAC5B,KAAK,qBAAqB,EAC1B,MAAM,KAAK,YAAY,CAAE,KAAM,MAAO,EAAG,KAAK,WAAW,EACzD,KAAK,MAAQ,QACf,CAGF,SAAgB,OACd,KAAK,MAAQ,YACN,OAAA,oBAAoB,UAAW,KAAK,aAAa,EACxD,SAAW,CAACH,EAAGL,CAAM,IAAK,KAAK,mBAAmB,SACzCA,EAAA,IAAI,MAAM,qBAAqB,CAAC,EAEzC,KAAK,mBAAmB,MAAM,GAC9BO,EAAA,KAAK,SAAL,MAAAA,EAAa,QAAO,CAGtB,MAAM,QAAQG,EAAiD,CACtD,OAAA,KAAK,YAAY,CAAE,KAAM,UAAW,QAASA,CAAA,EAAiB,KAAK,cAAc,CAAA,CAG1F,MAAM,YAAYA,EAAuBC,EAA6C,CAC7E,OAAA,KAAK,YAAY,CAAE,KAAM,OAAQ,QAASD,EAAe,QAAAC,CAAA,EAAW,KAAK,WAAW,CAAA,CAG7F,MAAM,mBAAqD,CACzD,OAAO,KAAK,YAAY,CAAE,KAAM,iBAAkB,EAAG,KAAK,oBAAoB,CAAA,CAGhF,MAAM,WAAWD,EAAsC,CAC9C,OAAA,KAAK,YAAY,CAAE,KAAM,aAAc,QAASA,GAAiB,GAAI,CAAA,CAEhF"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@storm-trade/wallet-core",
3
+ "version": "1.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "main": "./dist/wallet-core.umd.cjs",
10
+ "module": "./dist/wallet-core",
11
+ "types": "./dist/wallet-core",
12
+ "description": "",
13
+ "scripts": {
14
+ "dev": "vite",
15
+ "build": "tsc && vite build",
16
+ "test": "vitest",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "keywords": [],
20
+ "author": "",
21
+ "license": "ISC",
22
+ "devDependencies": {
23
+ "@types/node": "^22.13.1",
24
+ "typescript": "^5.7.3",
25
+ "vite": "^6.1.0",
26
+ "vite-plugin-dts": "^4.5.0",
27
+ "vitest": "^3.0.5"
28
+ },
29
+ "dependencies": {
30
+ "buffer": "^6.0.3",
31
+ "eventemitter3": "^5.0.1",
32
+ "typed-ts-events": "^3.0.1"
33
+ },
34
+ "peerDependencies": {
35
+ "@ton/core": ">=0.60.0",
36
+ "@ton/crypto": ">=3.3.0",
37
+ "@ton/ton": ">=15.2.1"
38
+ }
39
+ }