@lendasat/lendaswap-sdk 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +56 -19
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +63 -1
- package/dist/api.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/wasm/lendaswap_wasm_sdk.d.ts +695 -0
- package/wasm/lendaswap_wasm_sdk.js +2959 -0
- package/wasm/lendaswap_wasm_sdk_bg.wasm +0 -0
- package/wasm/lendaswap_wasm_sdk_bg.wasm.d.ts +185 -0
- package/wasm/package.json +17 -0
- package/dist/storage/indexedDB.d.ts +0 -30
- package/dist/storage/indexedDB.d.ts.map +0 -1
- package/dist/storage/indexedDB.js +0 -108
- package/dist/storage/indexedDB.js.map +0 -1
- package/dist/storage/localStorage.d.ts +0 -32
- package/dist/storage/localStorage.d.ts.map +0 -1
- package/dist/storage/localStorage.js +0 -58
- package/dist/storage/localStorage.js.map +0 -1
- package/dist/storage/memory.d.ts +0 -35
- package/dist/storage/memory.d.ts.map +0 -1
- package/dist/storage/memory.js +0 -50
- package/dist/storage/memory.js.map +0 -1
- package/dist/wallet.d.ts +0 -108
- package/dist/wallet.d.ts.map +0 -1
- package/dist/wallet.js +0 -188
- package/dist/wallet.js.map +0 -1
|
Binary file
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_tokeninfo_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_get_tokeninfo_tokenId: (a: number) => [number, number];
|
|
6
|
+
export const __wbg_set_tokeninfo_tokenId: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const __wbg_get_tokeninfo_symbol: (a: number) => [number, number];
|
|
8
|
+
export const __wbg_set_tokeninfo_symbol: (a: number, b: number, c: number) => void;
|
|
9
|
+
export const __wbg_get_tokeninfo_chain: (a: number) => number;
|
|
10
|
+
export const __wbg_set_tokeninfo_chain: (a: number, b: number) => void;
|
|
11
|
+
export const __wbg_get_tokeninfo_name: (a: number) => [number, number];
|
|
12
|
+
export const __wbg_set_tokeninfo_name: (a: number, b: number, c: number) => void;
|
|
13
|
+
export const __wbg_get_tokeninfo_decimals: (a: number) => number;
|
|
14
|
+
export const __wbg_set_tokeninfo_decimals: (a: number, b: number) => void;
|
|
15
|
+
export const __wbg_assetpair_free: (a: number, b: number) => void;
|
|
16
|
+
export const __wbg_get_assetpair_source: (a: number) => number;
|
|
17
|
+
export const __wbg_set_assetpair_source: (a: number, b: number) => void;
|
|
18
|
+
export const __wbg_get_assetpair_target: (a: number) => number;
|
|
19
|
+
export const __wbg_set_assetpair_target: (a: number, b: number) => void;
|
|
20
|
+
export const __wbg_quoteresponse_free: (a: number, b: number) => void;
|
|
21
|
+
export const __wbg_get_quoteresponse_exchangeRate: (a: number) => [number, number];
|
|
22
|
+
export const __wbg_set_quoteresponse_exchangeRate: (a: number, b: number, c: number) => void;
|
|
23
|
+
export const __wbg_get_quoteresponse_protocolFeeRate: (a: number) => number;
|
|
24
|
+
export const __wbg_set_quoteresponse_protocolFeeRate: (a: number, b: number) => void;
|
|
25
|
+
export const __wbg_get_quoteresponse_minAmount: (a: number) => bigint;
|
|
26
|
+
export const __wbg_set_quoteresponse_minAmount: (a: number, b: bigint) => void;
|
|
27
|
+
export const __wbg_get_quoteresponse_maxAmount: (a: number) => bigint;
|
|
28
|
+
export const __wbg_set_quoteresponse_maxAmount: (a: number, b: bigint) => void;
|
|
29
|
+
export const __wbg_estimatevtxoswapresponse_free: (a: number, b: number) => void;
|
|
30
|
+
export const __wbg_get_estimatevtxoswapresponse_feeSats: (a: number) => bigint;
|
|
31
|
+
export const __wbg_set_estimatevtxoswapresponse_feeSats: (a: number, b: bigint) => void;
|
|
32
|
+
export const __wbg_get_estimatevtxoswapresponse_totalInputSats: (a: number) => bigint;
|
|
33
|
+
export const __wbg_set_estimatevtxoswapresponse_totalInputSats: (a: number, b: bigint) => void;
|
|
34
|
+
export const __wbg_get_estimatevtxoswapresponse_outputSats: (a: number) => bigint;
|
|
35
|
+
export const __wbg_set_estimatevtxoswapresponse_outputSats: (a: number, b: bigint) => void;
|
|
36
|
+
export const __wbg_get_estimatevtxoswapresponse_vtxoCount: (a: number) => number;
|
|
37
|
+
export const __wbg_set_estimatevtxoswapresponse_vtxoCount: (a: number, b: number) => void;
|
|
38
|
+
export const __wbg_vtxoswapresponse_free: (a: number, b: number) => void;
|
|
39
|
+
export const __wbg_get_vtxoswapresponse_id: (a: number) => [number, number];
|
|
40
|
+
export const __wbg_set_vtxoswapresponse_id: (a: number, b: number, c: number) => void;
|
|
41
|
+
export const __wbg_get_vtxoswapresponse_status: (a: number) => [number, number];
|
|
42
|
+
export const __wbg_set_vtxoswapresponse_status: (a: number, b: number, c: number) => void;
|
|
43
|
+
export const __wbg_get_vtxoswapresponse_createdAt: (a: number) => [number, number];
|
|
44
|
+
export const __wbg_set_vtxoswapresponse_createdAt: (a: number, b: number, c: number) => void;
|
|
45
|
+
export const __wbg_get_vtxoswapresponse_clientVhtlcAddress: (a: number) => [number, number];
|
|
46
|
+
export const __wbg_set_vtxoswapresponse_clientVhtlcAddress: (a: number, b: number, c: number) => void;
|
|
47
|
+
export const __wbg_get_vtxoswapresponse_clientPk: (a: number) => [number, number];
|
|
48
|
+
export const __wbg_set_vtxoswapresponse_clientPk: (a: number, b: number, c: number) => void;
|
|
49
|
+
export const __wbg_get_vtxoswapresponse_serverVhtlcAddress: (a: number) => [number, number];
|
|
50
|
+
export const __wbg_set_vtxoswapresponse_serverVhtlcAddress: (a: number, b: number, c: number) => void;
|
|
51
|
+
export const __wbg_get_vtxoswapresponse_serverFundAmountSats: (a: number) => bigint;
|
|
52
|
+
export const __wbg_set_vtxoswapresponse_serverFundAmountSats: (a: number, b: bigint) => void;
|
|
53
|
+
export const __wbg_get_vtxoswapresponse_serverPk: (a: number) => [number, number];
|
|
54
|
+
export const __wbg_set_vtxoswapresponse_serverPk: (a: number, b: number, c: number) => void;
|
|
55
|
+
export const __wbg_get_vtxoswapresponse_serverLocktime: (a: number) => bigint;
|
|
56
|
+
export const __wbg_set_vtxoswapresponse_serverLocktime: (a: number, b: bigint) => void;
|
|
57
|
+
export const __wbg_get_vtxoswapresponse_serverUnilateralClaimDelay: (a: number) => bigint;
|
|
58
|
+
export const __wbg_set_vtxoswapresponse_serverUnilateralClaimDelay: (a: number, b: bigint) => void;
|
|
59
|
+
export const __wbg_get_vtxoswapresponse_serverUnilateralRefundDelay: (a: number) => bigint;
|
|
60
|
+
export const __wbg_set_vtxoswapresponse_serverUnilateralRefundDelay: (a: number, b: bigint) => void;
|
|
61
|
+
export const __wbg_get_vtxoswapresponse_serverUnilateralRefundWithoutReceiverDelay: (a: number) => bigint;
|
|
62
|
+
export const __wbg_set_vtxoswapresponse_serverUnilateralRefundWithoutReceiverDelay: (a: number, b: bigint) => void;
|
|
63
|
+
export const __wbg_get_vtxoswapresponse_arkadeServerPk: (a: number) => [number, number];
|
|
64
|
+
export const __wbg_set_vtxoswapresponse_arkadeServerPk: (a: number, b: number, c: number) => void;
|
|
65
|
+
export const __wbg_get_vtxoswapresponse_preimageHash: (a: number) => [number, number];
|
|
66
|
+
export const __wbg_set_vtxoswapresponse_preimageHash: (a: number, b: number, c: number) => void;
|
|
67
|
+
export const __wbg_get_vtxoswapresponse_feeSats: (a: number) => bigint;
|
|
68
|
+
export const __wbg_set_vtxoswapresponse_feeSats: (a: number, b: bigint) => void;
|
|
69
|
+
export const __wbg_get_vtxoswapresponse_network: (a: number) => [number, number];
|
|
70
|
+
export const __wbg_set_vtxoswapresponse_network: (a: number, b: number, c: number) => void;
|
|
71
|
+
export const __wbg_createvtxoswapresult_free: (a: number, b: number) => void;
|
|
72
|
+
export const __wbg_get_createvtxoswapresult_response: (a: number) => number;
|
|
73
|
+
export const __wbg_set_createvtxoswapresult_response: (a: number, b: number) => void;
|
|
74
|
+
export const __wbg_get_createvtxoswapresult_swapParams: (a: number) => number;
|
|
75
|
+
export const __wbg_set_createvtxoswapresult_swapParams: (a: number, b: number) => void;
|
|
76
|
+
export const __wbg_client_free: (a: number, b: number) => void;
|
|
77
|
+
export const client_new: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number];
|
|
78
|
+
export const client_init: (a: number, b: number, c: number) => any;
|
|
79
|
+
export const client_createArkadeToEvmSwap: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => any;
|
|
80
|
+
export const client_createEvmToArkadeSwap: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => any;
|
|
81
|
+
export const client_createEvmToLightningSwap: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => any;
|
|
82
|
+
export const client_getAssetPairs: (a: number) => any;
|
|
83
|
+
export const client_getTokens: (a: number) => any;
|
|
84
|
+
export const client_getQuote: (a: number, b: number, c: number, d: number, e: number, f: bigint) => any;
|
|
85
|
+
export const client_getSwap: (a: number, b: number, c: number) => any;
|
|
86
|
+
export const client_listAll: (a: number) => any;
|
|
87
|
+
export const client_claimGelato: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
88
|
+
export const client_amountsForSwap: (a: number, b: number, c: number) => any;
|
|
89
|
+
export const client_claimVhtlc: (a: number, b: number, c: number) => any;
|
|
90
|
+
export const client_refundVhtlc: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
91
|
+
export const client_getVersion: (a: number) => any;
|
|
92
|
+
export const client_recoverSwaps: (a: number) => any;
|
|
93
|
+
export const client_getMnemonic: (a: number) => any;
|
|
94
|
+
export const client_getUserIdXpub: (a: number) => any;
|
|
95
|
+
export const client_clearSwapStorage: (a: number) => any;
|
|
96
|
+
export const client_deleteSwap: (a: number, b: number, c: number) => any;
|
|
97
|
+
export const client_estimateVtxoSwap: (a: number, b: number, c: number) => any;
|
|
98
|
+
export const client_createVtxoSwap: (a: number, b: number, c: number) => any;
|
|
99
|
+
export const client_getVtxoSwap: (a: number, b: number, c: number) => any;
|
|
100
|
+
export const client_claimVtxoSwap: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
101
|
+
export const client_refundVtxoSwap: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
102
|
+
export const __wbg_set_quoteresponse_networkFee: (a: number, b: bigint) => void;
|
|
103
|
+
export const __wbg_set_quoteresponse_protocolFee: (a: number, b: bigint) => void;
|
|
104
|
+
export const __wbg_set_vtxoswapresponse_clientFundAmountSats: (a: number, b: bigint) => void;
|
|
105
|
+
export const __wbg_set_vtxoswapresponse_clientLocktime: (a: number, b: bigint) => void;
|
|
106
|
+
export const __wbg_set_vtxoswapresponse_clientUnilateralClaimDelay: (a: number, b: bigint) => void;
|
|
107
|
+
export const __wbg_set_vtxoswapresponse_clientUnilateralRefundDelay: (a: number, b: bigint) => void;
|
|
108
|
+
export const __wbg_set_vtxoswapresponse_clientUnilateralRefundWithoutReceiverDelay: (a: number, b: bigint) => void;
|
|
109
|
+
export const __wbg_get_quoteresponse_networkFee: (a: number) => bigint;
|
|
110
|
+
export const __wbg_get_quoteresponse_protocolFee: (a: number) => bigint;
|
|
111
|
+
export const __wbg_get_vtxoswapresponse_clientFundAmountSats: (a: number) => bigint;
|
|
112
|
+
export const __wbg_get_vtxoswapresponse_clientLocktime: (a: number) => bigint;
|
|
113
|
+
export const __wbg_get_vtxoswapresponse_clientUnilateralClaimDelay: (a: number) => bigint;
|
|
114
|
+
export const __wbg_get_vtxoswapresponse_clientUnilateralRefundDelay: (a: number) => bigint;
|
|
115
|
+
export const __wbg_get_vtxoswapresponse_clientUnilateralRefundWithoutReceiverDelay: (a: number) => bigint;
|
|
116
|
+
export const __wbg_jswalletstorageprovider_free: (a: number, b: number) => void;
|
|
117
|
+
export const jswalletstorageprovider_new: (a: any, b: any, c: any, d: any) => number;
|
|
118
|
+
export const __wbg_jsswapstorageprovider_free: (a: number, b: number) => void;
|
|
119
|
+
export const jsswapstorageprovider_new: (a: any, b: any, c: any, d: any, e: any) => number;
|
|
120
|
+
export const initialize: () => void;
|
|
121
|
+
export const setLogLevel: (a: number, b: number) => [number, number];
|
|
122
|
+
export const getLogLevel: () => [number, number];
|
|
123
|
+
export const __wbg_tokenid_free: (a: number, b: number) => void;
|
|
124
|
+
export const tokenid_toString: (a: number) => [number, number];
|
|
125
|
+
export const tokenid_fromString: (a: number, b: number) => [number, number, number];
|
|
126
|
+
export const __wbg_version_free: (a: number, b: number) => void;
|
|
127
|
+
export const __wbg_get_version_tag: (a: number) => [number, number];
|
|
128
|
+
export const __wbg_set_version_tag: (a: number, b: number, c: number) => void;
|
|
129
|
+
export const __wbg_get_version_commitHash: (a: number) => [number, number];
|
|
130
|
+
export const __wbg_set_version_commitHash: (a: number, b: number, c: number) => void;
|
|
131
|
+
export const __wbg_swapparams_free: (a: number, b: number) => void;
|
|
132
|
+
export const __wbg_get_swapparams_own_sk: (a: number) => [number, number];
|
|
133
|
+
export const __wbg_set_swapparams_own_sk: (a: number, b: number, c: number) => void;
|
|
134
|
+
export const __wbg_get_swapparams_own_pk: (a: number) => [number, number];
|
|
135
|
+
export const __wbg_set_swapparams_own_pk: (a: number, b: number, c: number) => void;
|
|
136
|
+
export const __wbg_get_swapparams_preimage: (a: number) => [number, number];
|
|
137
|
+
export const __wbg_set_swapparams_preimage: (a: number, b: number, c: number) => void;
|
|
138
|
+
export const __wbg_get_swapparams_preimage_hash: (a: number) => [number, number];
|
|
139
|
+
export const __wbg_set_swapparams_preimage_hash: (a: number, b: number, c: number) => void;
|
|
140
|
+
export const __wbg_get_swapparams_user_id: (a: number) => [number, number];
|
|
141
|
+
export const __wbg_set_swapparams_user_id: (a: number, b: number, c: number) => void;
|
|
142
|
+
export const __wbg_get_swapparams_key_index: (a: number) => number;
|
|
143
|
+
export const __wbg_set_swapparams_key_index: (a: number, b: number) => void;
|
|
144
|
+
export const __wbg_vhtlcamounts_free: (a: number, b: number) => void;
|
|
145
|
+
export const __wbg_get_vhtlcamounts_spendable: (a: number) => bigint;
|
|
146
|
+
export const __wbg_set_vhtlcamounts_spendable: (a: number, b: bigint) => void;
|
|
147
|
+
export const __wbg_get_vhtlcamounts_spent: (a: number) => bigint;
|
|
148
|
+
export const __wbg_set_vhtlcamounts_spent: (a: number, b: bigint) => void;
|
|
149
|
+
export const __wbg_get_vhtlcamounts_recoverable: (a: number) => bigint;
|
|
150
|
+
export const __wbg_set_vhtlcamounts_recoverable: (a: number, b: bigint) => void;
|
|
151
|
+
export const __wbg_intounderlyingsink_free: (a: number, b: number) => void;
|
|
152
|
+
export const intounderlyingsink_write: (a: number, b: any) => any;
|
|
153
|
+
export const intounderlyingsink_close: (a: number) => any;
|
|
154
|
+
export const intounderlyingsink_abort: (a: number, b: any) => any;
|
|
155
|
+
export const __wbg_intounderlyingsource_free: (a: number, b: number) => void;
|
|
156
|
+
export const intounderlyingsource_pull: (a: number, b: any) => any;
|
|
157
|
+
export const intounderlyingsource_cancel: (a: number) => void;
|
|
158
|
+
export const __wbg_intounderlyingbytesource_free: (a: number, b: number) => void;
|
|
159
|
+
export const intounderlyingbytesource_type: (a: number) => number;
|
|
160
|
+
export const intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number;
|
|
161
|
+
export const intounderlyingbytesource_start: (a: number, b: any) => void;
|
|
162
|
+
export const intounderlyingbytesource_pull: (a: number, b: any) => any;
|
|
163
|
+
export const intounderlyingbytesource_cancel: (a: number) => void;
|
|
164
|
+
export const rustsecp256k1_v0_11_context_create: (a: number) => number;
|
|
165
|
+
export const rustsecp256k1_v0_11_context_destroy: (a: number) => void;
|
|
166
|
+
export const rustsecp256k1_v0_11_default_illegal_callback_fn: (a: number, b: number) => void;
|
|
167
|
+
export const rustsecp256k1_v0_11_default_error_callback_fn: (a: number, b: number) => void;
|
|
168
|
+
export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
|
|
169
|
+
export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
|
|
170
|
+
export const rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
|
|
171
|
+
export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
|
|
172
|
+
export const wasm_bindgen__convert__closures_____invoke__h49d21def8d7e8715: (a: number, b: number) => void;
|
|
173
|
+
export const wasm_bindgen__closure__destroy__h19250ab695821211: (a: number, b: number) => void;
|
|
174
|
+
export const wasm_bindgen__convert__closures_____invoke__hf86cb6f5b134f7f7: (a: number, b: number, c: any) => void;
|
|
175
|
+
export const wasm_bindgen__closure__destroy__h5b1ee57da9b2ce1f: (a: number, b: number) => void;
|
|
176
|
+
export const wasm_bindgen__convert__closures_____invoke__h68e6792a5299b78b: (a: number, b: number, c: any, d: any) => void;
|
|
177
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
178
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
179
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
180
|
+
export const __externref_table_alloc: () => number;
|
|
181
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
182
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
183
|
+
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
184
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
185
|
+
export const __wbindgen_start: () => void;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "lendaswap-wasm-sdk",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "Lendaswap Client SDK - WASM bindings",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"lendaswap_wasm_sdk_bg.wasm",
|
|
9
|
+
"lendaswap_wasm_sdk.js",
|
|
10
|
+
"lendaswap_wasm_sdk.d.ts"
|
|
11
|
+
],
|
|
12
|
+
"main": "lendaswap_wasm_sdk.js",
|
|
13
|
+
"types": "lendaswap_wasm_sdk.d.ts",
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"./snippets/*"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IndexedDB-based storage provider.
|
|
3
|
-
*
|
|
4
|
-
* IndexedDB is more robust than localStorage for larger amounts of data
|
|
5
|
-
* and provides better async operations.
|
|
6
|
-
*/
|
|
7
|
-
import type { Storage } from "./index.js";
|
|
8
|
-
/**
|
|
9
|
-
* Storage provider using IndexedDB.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const storage = new IndexedDBProvider();
|
|
14
|
-
* await storage.set('key', 'value');
|
|
15
|
-
* const value = await storage.get('key'); // 'value'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class IndexedDBProvider implements Storage {
|
|
19
|
-
private dbPromise;
|
|
20
|
-
/**
|
|
21
|
-
* Get or create the IndexedDB database.
|
|
22
|
-
*/
|
|
23
|
-
private getDB;
|
|
24
|
-
get(key: string): Promise<string | null>;
|
|
25
|
-
set(key: string, value: string): Promise<void>;
|
|
26
|
-
remove(key: string): Promise<void>;
|
|
27
|
-
has(key: string): Promise<boolean>;
|
|
28
|
-
clear(): Promise<void>;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=indexedDB.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indexedDB.d.ts","sourceRoot":"","sources":["../../src/storage/indexedDB.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAO1C;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,YAAW,OAAO;IAC/C,OAAO,CAAC,SAAS,CAAqC;IAEtD;;OAEG;IACH,OAAO,CAAC,KAAK;IA6BP,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAmBxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAgB7B"}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IndexedDB-based storage provider.
|
|
3
|
-
*
|
|
4
|
-
* IndexedDB is more robust than localStorage for larger amounts of data
|
|
5
|
-
* and provides better async operations.
|
|
6
|
-
*/
|
|
7
|
-
// FIXME: TODO: this shouldn't be v1.2, in fact, we probably shouldn't be using this file at all
|
|
8
|
-
const DB_NAME = "lendaswap-v1.2";
|
|
9
|
-
const DB_VERSION = 1;
|
|
10
|
-
const STORE_NAME = "keyvalue";
|
|
11
|
-
/**
|
|
12
|
-
* Storage provider using IndexedDB.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```typescript
|
|
16
|
-
* const storage = new IndexedDBProvider();
|
|
17
|
-
* await storage.set('key', 'value');
|
|
18
|
-
* const value = await storage.get('key'); // 'value'
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export class IndexedDBProvider {
|
|
22
|
-
dbPromise = null;
|
|
23
|
-
/**
|
|
24
|
-
* Get or create the IndexedDB database.
|
|
25
|
-
*/
|
|
26
|
-
getDB() {
|
|
27
|
-
if (this.dbPromise) {
|
|
28
|
-
return this.dbPromise;
|
|
29
|
-
}
|
|
30
|
-
this.dbPromise = new Promise((resolve, reject) => {
|
|
31
|
-
const request = indexedDB.open(DB_NAME, DB_VERSION);
|
|
32
|
-
request.onerror = () => {
|
|
33
|
-
reject(new Error(`Failed to open IndexedDB: ${request.error?.message}`));
|
|
34
|
-
};
|
|
35
|
-
request.onsuccess = () => {
|
|
36
|
-
resolve(request.result);
|
|
37
|
-
};
|
|
38
|
-
request.onupgradeneeded = (event) => {
|
|
39
|
-
const db = event.target.result;
|
|
40
|
-
if (!db.objectStoreNames.contains(STORE_NAME)) {
|
|
41
|
-
db.createObjectStore(STORE_NAME);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
});
|
|
45
|
-
return this.dbPromise;
|
|
46
|
-
}
|
|
47
|
-
async get(key) {
|
|
48
|
-
const db = await this.getDB();
|
|
49
|
-
return new Promise((resolve, reject) => {
|
|
50
|
-
const transaction = db.transaction(STORE_NAME, "readonly");
|
|
51
|
-
const store = transaction.objectStore(STORE_NAME);
|
|
52
|
-
const request = store.get(key);
|
|
53
|
-
request.onerror = () => {
|
|
54
|
-
reject(new Error(`Failed to get key "${key}": ${request.error?.message}`));
|
|
55
|
-
};
|
|
56
|
-
request.onsuccess = () => {
|
|
57
|
-
resolve(request.result ?? null);
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
async set(key, value) {
|
|
62
|
-
const db = await this.getDB();
|
|
63
|
-
return new Promise((resolve, reject) => {
|
|
64
|
-
const transaction = db.transaction(STORE_NAME, "readwrite");
|
|
65
|
-
const store = transaction.objectStore(STORE_NAME);
|
|
66
|
-
const request = store.put(value, key);
|
|
67
|
-
request.onerror = () => {
|
|
68
|
-
reject(new Error(`Failed to set key "${key}": ${request.error?.message}`));
|
|
69
|
-
};
|
|
70
|
-
request.onsuccess = () => {
|
|
71
|
-
resolve();
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
async remove(key) {
|
|
76
|
-
const db = await this.getDB();
|
|
77
|
-
return new Promise((resolve, reject) => {
|
|
78
|
-
const transaction = db.transaction(STORE_NAME, "readwrite");
|
|
79
|
-
const store = transaction.objectStore(STORE_NAME);
|
|
80
|
-
const request = store.delete(key);
|
|
81
|
-
request.onerror = () => {
|
|
82
|
-
reject(new Error(`Failed to remove key "${key}": ${request.error?.message}`));
|
|
83
|
-
};
|
|
84
|
-
request.onsuccess = () => {
|
|
85
|
-
resolve();
|
|
86
|
-
};
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
async has(key) {
|
|
90
|
-
const value = await this.get(key);
|
|
91
|
-
return value !== null;
|
|
92
|
-
}
|
|
93
|
-
async clear() {
|
|
94
|
-
const db = await this.getDB();
|
|
95
|
-
return new Promise((resolve, reject) => {
|
|
96
|
-
const transaction = db.transaction(STORE_NAME, "readwrite");
|
|
97
|
-
const store = transaction.objectStore(STORE_NAME);
|
|
98
|
-
const request = store.clear();
|
|
99
|
-
request.onerror = () => {
|
|
100
|
-
reject(new Error(`Failed to clear storage: ${request.error?.message}`));
|
|
101
|
-
};
|
|
102
|
-
request.onsuccess = () => {
|
|
103
|
-
resolve();
|
|
104
|
-
};
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
//# sourceMappingURL=indexedDB.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"indexedDB.js","sourceRoot":"","sources":["../../src/storage/indexedDB.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,gGAAgG;AAChG,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACjC,MAAM,UAAU,GAAG,CAAC,CAAC;AACrB,MAAM,UAAU,GAAG,UAAU,CAAC;AAE9B;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAiB;IACpB,SAAS,GAAgC,IAAI,CAAC;IAEtD;;OAEG;IACK,KAAK;QACX,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,OAAO,IAAI,CAAC,SAAS,CAAC;QACxB,CAAC;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC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data persists across page refreshes and browser sessions.
|
|
6
|
-
*/
|
|
7
|
-
import type { Storage } from "./index.js";
|
|
8
|
-
/**
|
|
9
|
-
* Storage provider using browser localStorage.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const storage = new LocalStorageProvider();
|
|
14
|
-
* await storage.set('key', 'value');
|
|
15
|
-
* const value = await storage.get('key'); // 'value'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class LocalStorageProvider implements Storage {
|
|
19
|
-
private prefix;
|
|
20
|
-
/**
|
|
21
|
-
* Create a new localStorage provider.
|
|
22
|
-
* @param prefix - Optional prefix for all keys (default: '')
|
|
23
|
-
*/
|
|
24
|
-
constructor(prefix?: string);
|
|
25
|
-
private getKey;
|
|
26
|
-
get(key: string): Promise<string | null>;
|
|
27
|
-
set(key: string, value: string): Promise<void>;
|
|
28
|
-
remove(key: string): Promise<void>;
|
|
29
|
-
has(key: string): Promise<boolean>;
|
|
30
|
-
clear(): Promise<void>;
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=localStorage.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localStorage.d.ts","sourceRoot":"","sources":["../../src/storage/localStorage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;;GASG;AACH,qBAAa,oBAAqB,YAAW,OAAO;IAClD,OAAO,CAAC,MAAM,CAAS;IAEvB;;;OAGG;gBACS,MAAM,GAAE,MAAW;IAI/B,OAAO,CAAC,MAAM;IAIR,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAe7B"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* localStorage-based storage provider.
|
|
3
|
-
*
|
|
4
|
-
* This is the simplest storage option, suitable for most browser environments.
|
|
5
|
-
* Data persists across page refreshes and browser sessions.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Storage provider using browser localStorage.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const storage = new LocalStorageProvider();
|
|
13
|
-
* await storage.set('key', 'value');
|
|
14
|
-
* const value = await storage.get('key'); // 'value'
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export class LocalStorageProvider {
|
|
18
|
-
prefix;
|
|
19
|
-
/**
|
|
20
|
-
* Create a new localStorage provider.
|
|
21
|
-
* @param prefix - Optional prefix for all keys (default: '')
|
|
22
|
-
*/
|
|
23
|
-
constructor(prefix = "") {
|
|
24
|
-
this.prefix = prefix;
|
|
25
|
-
}
|
|
26
|
-
getKey(key) {
|
|
27
|
-
return this.prefix + key;
|
|
28
|
-
}
|
|
29
|
-
async get(key) {
|
|
30
|
-
return localStorage.getItem(this.getKey(key));
|
|
31
|
-
}
|
|
32
|
-
async set(key, value) {
|
|
33
|
-
localStorage.setItem(this.getKey(key), value);
|
|
34
|
-
}
|
|
35
|
-
async remove(key) {
|
|
36
|
-
localStorage.removeItem(this.getKey(key));
|
|
37
|
-
}
|
|
38
|
-
async has(key) {
|
|
39
|
-
return localStorage.getItem(this.getKey(key)) !== null;
|
|
40
|
-
}
|
|
41
|
-
async clear() {
|
|
42
|
-
if (this.prefix) {
|
|
43
|
-
// Only clear keys with our prefix
|
|
44
|
-
const keysToRemove = [];
|
|
45
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
46
|
-
const key = localStorage.key(i);
|
|
47
|
-
if (key && key.startsWith(this.prefix)) {
|
|
48
|
-
keysToRemove.push(key);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
keysToRemove.forEach((key) => localStorage.removeItem(key));
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
localStorage.clear();
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=localStorage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localStorage.js","sourceRoot":"","sources":["../../src/storage/localStorage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;GASG;AACH,MAAM,OAAO,oBAAoB;IACvB,MAAM,CAAS;IAEvB;;;OAGG;IACH,YAAY,SAAiB,EAAE;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEO,MAAM,CAAC,GAAW;QACxB,OAAO,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,OAAO,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;IACzD,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,kCAAkC;YAClC,MAAM,YAAY,GAAa,EAAE,CAAC;YAClC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC7C,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAChC,IAAI,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;oBACvC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;YACD,YAAY,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,CAAC;aAAM,CAAC;YACN,YAAY,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;IACH,CAAC;CACF"}
|
package/dist/storage/memory.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory storage provider.
|
|
3
|
-
*
|
|
4
|
-
* This is useful for testing or environments where persistent storage
|
|
5
|
-
* is not available. Data is lost when the page is refreshed.
|
|
6
|
-
*/
|
|
7
|
-
import type { Storage } from "./index.js";
|
|
8
|
-
/**
|
|
9
|
-
* In-memory storage provider for testing.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```typescript
|
|
13
|
-
* const storage = new MemoryStorageProvider();
|
|
14
|
-
* await storage.set('key', 'value');
|
|
15
|
-
* const value = await storage.get('key'); // 'value'
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare class MemoryStorageProvider implements Storage {
|
|
19
|
-
private data;
|
|
20
|
-
constructor();
|
|
21
|
-
get(key: string): Promise<string | null>;
|
|
22
|
-
set(key: string, value: string): Promise<void>;
|
|
23
|
-
remove(key: string): Promise<void>;
|
|
24
|
-
has(key: string): Promise<boolean>;
|
|
25
|
-
clear(): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Get all keys in storage (for debugging).
|
|
28
|
-
*/
|
|
29
|
-
keys(): string[];
|
|
30
|
-
/**
|
|
31
|
-
* Get the number of items in storage.
|
|
32
|
-
*/
|
|
33
|
-
get size(): number;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=memory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/storage/memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;;;;;GASG;AACH,qBAAa,qBAAsB,YAAW,OAAO;IACnD,OAAO,CAAC,IAAI,CAAsB;;IAM5B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9C,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIlC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACH,IAAI,IAAI,MAAM,EAAE;IAIhB;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
package/dist/storage/memory.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* In-memory storage provider.
|
|
3
|
-
*
|
|
4
|
-
* This is useful for testing or environments where persistent storage
|
|
5
|
-
* is not available. Data is lost when the page is refreshed.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* In-memory storage provider for testing.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```typescript
|
|
12
|
-
* const storage = new MemoryStorageProvider();
|
|
13
|
-
* await storage.set('key', 'value');
|
|
14
|
-
* const value = await storage.get('key'); // 'value'
|
|
15
|
-
* ```
|
|
16
|
-
*/
|
|
17
|
-
export class MemoryStorageProvider {
|
|
18
|
-
data;
|
|
19
|
-
constructor() {
|
|
20
|
-
this.data = new Map();
|
|
21
|
-
}
|
|
22
|
-
async get(key) {
|
|
23
|
-
return this.data.get(key) ?? null;
|
|
24
|
-
}
|
|
25
|
-
async set(key, value) {
|
|
26
|
-
this.data.set(key, value);
|
|
27
|
-
}
|
|
28
|
-
async remove(key) {
|
|
29
|
-
this.data.delete(key);
|
|
30
|
-
}
|
|
31
|
-
async has(key) {
|
|
32
|
-
return this.data.has(key);
|
|
33
|
-
}
|
|
34
|
-
async clear() {
|
|
35
|
-
this.data.clear();
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Get all keys in storage (for debugging).
|
|
39
|
-
*/
|
|
40
|
-
keys() {
|
|
41
|
-
return Array.from(this.data.keys());
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Get the number of items in storage.
|
|
45
|
-
*/
|
|
46
|
-
get size() {
|
|
47
|
-
return this.data.size;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=memory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"memory.js","sourceRoot":"","sources":["../../src/storage/memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;GASG;AACH,MAAM,OAAO,qBAAqB;IACxB,IAAI,CAAsB;IAElC;QACE,IAAI,CAAC,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW,EAAE,KAAa;QAClC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAW;QACtB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,GAAW;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAI;QACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IACxB,CAAC;CACF"}
|