zeldwallet 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 +305 -0
- package/dist/index.d.ts +6 -0
- package/dist/src/ZeldWallet.d.ts +254 -0
- package/dist/src/ZeldWallet.d.ts.map +1 -0
- package/dist/src/component/ZeldWalletUI.d.ts +56 -0
- package/dist/src/component/ZeldWalletUI.d.ts.map +1 -0
- package/dist/src/component/balance.d.ts +41 -0
- package/dist/src/component/balance.d.ts.map +1 -0
- package/dist/src/component/bindings.d.ts +76 -0
- package/dist/src/component/bindings.d.ts.map +1 -0
- package/dist/src/component/constants.d.ts +15 -0
- package/dist/src/component/constants.d.ts.map +1 -0
- package/dist/src/component/controller.d.ts +224 -0
- package/dist/src/component/controller.d.ts.map +1 -0
- package/dist/src/component/errors.d.ts +5 -0
- package/dist/src/component/errors.d.ts.map +1 -0
- package/dist/src/component/i18n.d.ts +156 -0
- package/dist/src/component/i18n.d.ts.map +1 -0
- package/dist/src/component/messages/ar.d.ts +3 -0
- package/dist/src/component/messages/ar.d.ts.map +1 -0
- package/dist/src/component/messages/bn.d.ts +3 -0
- package/dist/src/component/messages/bn.d.ts.map +1 -0
- package/dist/src/component/messages/cs.d.ts +3 -0
- package/dist/src/component/messages/cs.d.ts.map +1 -0
- package/dist/src/component/messages/de.d.ts +3 -0
- package/dist/src/component/messages/de.d.ts.map +1 -0
- package/dist/src/component/messages/el.d.ts +3 -0
- package/dist/src/component/messages/el.d.ts.map +1 -0
- package/dist/src/component/messages/en.d.ts +3 -0
- package/dist/src/component/messages/en.d.ts.map +1 -0
- package/dist/src/component/messages/es.d.ts +3 -0
- package/dist/src/component/messages/es.d.ts.map +1 -0
- package/dist/src/component/messages/fa.d.ts +3 -0
- package/dist/src/component/messages/fa.d.ts.map +1 -0
- package/dist/src/component/messages/fr.d.ts +3 -0
- package/dist/src/component/messages/fr.d.ts.map +1 -0
- package/dist/src/component/messages/he.d.ts +3 -0
- package/dist/src/component/messages/he.d.ts.map +1 -0
- package/dist/src/component/messages/hi.d.ts +3 -0
- package/dist/src/component/messages/hi.d.ts.map +1 -0
- package/dist/src/component/messages/id.d.ts +3 -0
- package/dist/src/component/messages/id.d.ts.map +1 -0
- package/dist/src/component/messages/index.d.ts +31 -0
- package/dist/src/component/messages/index.d.ts.map +1 -0
- package/dist/src/component/messages/it.d.ts +3 -0
- package/dist/src/component/messages/it.d.ts.map +1 -0
- package/dist/src/component/messages/ja.d.ts +3 -0
- package/dist/src/component/messages/ja.d.ts.map +1 -0
- package/dist/src/component/messages/ko.d.ts +3 -0
- package/dist/src/component/messages/ko.d.ts.map +1 -0
- package/dist/src/component/messages/ms.d.ts +3 -0
- package/dist/src/component/messages/ms.d.ts.map +1 -0
- package/dist/src/component/messages/nl.d.ts +3 -0
- package/dist/src/component/messages/nl.d.ts.map +1 -0
- package/dist/src/component/messages/pl.d.ts +3 -0
- package/dist/src/component/messages/pl.d.ts.map +1 -0
- package/dist/src/component/messages/pt.d.ts +3 -0
- package/dist/src/component/messages/pt.d.ts.map +1 -0
- package/dist/src/component/messages/ro.d.ts +3 -0
- package/dist/src/component/messages/ro.d.ts.map +1 -0
- package/dist/src/component/messages/ru.d.ts +3 -0
- package/dist/src/component/messages/ru.d.ts.map +1 -0
- package/dist/src/component/messages/sw.d.ts +3 -0
- package/dist/src/component/messages/sw.d.ts.map +1 -0
- package/dist/src/component/messages/th.d.ts +3 -0
- package/dist/src/component/messages/th.d.ts.map +1 -0
- package/dist/src/component/messages/tl.d.ts +3 -0
- package/dist/src/component/messages/tl.d.ts.map +1 -0
- package/dist/src/component/messages/tr.d.ts +3 -0
- package/dist/src/component/messages/tr.d.ts.map +1 -0
- package/dist/src/component/messages/uk.d.ts +3 -0
- package/dist/src/component/messages/uk.d.ts.map +1 -0
- package/dist/src/component/messages/ur.d.ts +3 -0
- package/dist/src/component/messages/ur.d.ts.map +1 -0
- package/dist/src/component/messages/vi.d.ts +3 -0
- package/dist/src/component/messages/vi.d.ts.map +1 -0
- package/dist/src/component/messages/zh-CN.d.ts +3 -0
- package/dist/src/component/messages/zh-CN.d.ts.map +1 -0
- package/dist/src/component/messages/zh-TW.d.ts +3 -0
- package/dist/src/component/messages/zh-TW.d.ts.map +1 -0
- package/dist/src/component/miner.d.ts +108 -0
- package/dist/src/component/miner.d.ts.map +1 -0
- package/dist/src/component/render.d.ts +11 -0
- package/dist/src/component/render.d.ts.map +1 -0
- package/dist/src/component/state.d.ts +142 -0
- package/dist/src/component/state.d.ts.map +1 -0
- package/dist/src/component/styles.d.ts +2 -0
- package/dist/src/component/styles.d.ts.map +1 -0
- package/dist/src/component/viewModel.d.ts +281 -0
- package/dist/src/component/viewModel.d.ts.map +1 -0
- package/dist/src/component/wallets.d.ts +40 -0
- package/dist/src/component/wallets.d.ts.map +1 -0
- package/dist/src/index.d.ts +18 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/keys/KeyManager.d.ts +132 -0
- package/dist/src/keys/KeyManager.d.ts.map +1 -0
- package/dist/src/keys/derivation.d.ts +58 -0
- package/dist/src/keys/derivation.d.ts.map +1 -0
- package/dist/src/keys/signing.d.ts +44 -0
- package/dist/src/keys/signing.d.ts.map +1 -0
- package/dist/src/provider/WBIPProvider.d.ts +74 -0
- package/dist/src/provider/WBIPProvider.d.ts.map +1 -0
- package/dist/src/react/ZeldWalletCard.d.ts +29 -0
- package/dist/src/react/ZeldWalletCard.d.ts.map +1 -0
- package/dist/src/react/index.d.ts +3 -0
- package/dist/src/react/index.d.ts.map +1 -0
- package/dist/src/react/useZeldWalletController.d.ts +28 -0
- package/dist/src/react/useZeldWalletController.d.ts.map +1 -0
- package/dist/src/storage/SecureStorage.d.ts +183 -0
- package/dist/src/storage/SecureStorage.d.ts.map +1 -0
- package/dist/src/storage/constants.d.ts +59 -0
- package/dist/src/storage/constants.d.ts.map +1 -0
- package/dist/src/types/index.d.ts +245 -0
- package/dist/src/types/index.d.ts.map +1 -0
- package/dist/src/ui/Modal.d.ts +19 -0
- package/dist/src/ui/Modal.d.ts.map +1 -0
- package/dist/src/unifiedWallet.d.ts +29 -0
- package/dist/src/unifiedWallet.d.ts.map +1 -0
- package/dist/src/utils/crypto.d.ts +36 -0
- package/dist/src/utils/crypto.d.ts.map +1 -0
- package/dist/src/utils/encoding.d.ts +46 -0
- package/dist/src/utils/encoding.d.ts.map +1 -0
- package/dist/src/utils/validation.d.ts +42 -0
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/wasm/package.json +31 -0
- package/dist/wasm/zeldhash_miner_wasm.d.ts +82 -0
- package/dist/wasm/zeldhash_miner_wasm.js +1404 -0
- package/dist/wasm/zeldhash_miner_wasm_bg.wasm +0 -0
- package/dist/wasm/zeldhash_miner_wasm_bg.wasm.d.ts +27 -0
- package/dist/worker.js +338 -0
- package/dist/zeldwallet.es.js +36558 -0
- package/dist/zeldwallet.es.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ZeldWallet Type Definitions
|
|
3
|
+
*/
|
|
4
|
+
/** Bitcoin address types supported */
|
|
5
|
+
export type AddressType = 'p2pkh' | 'p2sh-p2wpkh' | 'p2wpkh' | 'p2tr';
|
|
6
|
+
/** Purpose for address derivation (WBIP compatible) */
|
|
7
|
+
export type AddressPurpose = 'payment' | 'ordinals' | 'stacks';
|
|
8
|
+
/** Network type */
|
|
9
|
+
export type NetworkType = 'mainnet' | 'testnet';
|
|
10
|
+
/** Derived address information */
|
|
11
|
+
export interface DerivedAddress {
|
|
12
|
+
address: string;
|
|
13
|
+
publicKey: string;
|
|
14
|
+
path: string;
|
|
15
|
+
type: AddressType;
|
|
16
|
+
}
|
|
17
|
+
/** Full address info including purpose */
|
|
18
|
+
export interface AddressInfo {
|
|
19
|
+
address: string;
|
|
20
|
+
publicKey: string;
|
|
21
|
+
purpose: AddressPurpose;
|
|
22
|
+
addressType: AddressType;
|
|
23
|
+
derivationPath: string;
|
|
24
|
+
}
|
|
25
|
+
/** Wallet implementation type (WBIP) */
|
|
26
|
+
export type WalletImplementation = 'software' | 'ledger' | 'keystone';
|
|
27
|
+
/** Bitcoin network identifiers (WBIP/sats-connect) */
|
|
28
|
+
export type BitcoinNetworkName = 'Mainnet' | 'Testnet' | 'Testnet4' | 'Signet' | 'Regtest';
|
|
29
|
+
export type StacksNetworkName = 'mainnet' | 'testnet';
|
|
30
|
+
export type SparkNetworkName = 'mainnet' | 'regtest';
|
|
31
|
+
/** getInfo response payload (WBIP002) */
|
|
32
|
+
export interface GetInfoResult {
|
|
33
|
+
version: string;
|
|
34
|
+
platform?: 'web' | 'mobile';
|
|
35
|
+
methods?: string[];
|
|
36
|
+
supports: string[];
|
|
37
|
+
}
|
|
38
|
+
/** Network payload returned by WBIP getAddresses */
|
|
39
|
+
export interface WBIPNetworkInfo {
|
|
40
|
+
bitcoin: {
|
|
41
|
+
name: BitcoinNetworkName;
|
|
42
|
+
};
|
|
43
|
+
stacks: {
|
|
44
|
+
name: StacksNetworkName;
|
|
45
|
+
};
|
|
46
|
+
spark: {
|
|
47
|
+
name: SparkNetworkName;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** getAddresses response payload (WBIP005) */
|
|
51
|
+
export interface WBIPAddressEntry {
|
|
52
|
+
address: string;
|
|
53
|
+
publicKey: string;
|
|
54
|
+
purpose: AddressPurpose;
|
|
55
|
+
addressType: AddressType;
|
|
56
|
+
walletType: WalletImplementation;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* WBIP005 getAddresses response. Returned as an array for convenience while
|
|
60
|
+
* keeping the spec fields as properties on the array itself.
|
|
61
|
+
*/
|
|
62
|
+
export type WBIPAddressesResult = WBIPAddressEntry[] & {
|
|
63
|
+
addresses: WBIPAddressEntry[];
|
|
64
|
+
network: WBIPNetworkInfo;
|
|
65
|
+
};
|
|
66
|
+
/** Options for signing PSBT inputs */
|
|
67
|
+
export interface SignInputOptions {
|
|
68
|
+
/** Index of the input to sign */
|
|
69
|
+
index: number;
|
|
70
|
+
/** Address to use for signing */
|
|
71
|
+
address?: string;
|
|
72
|
+
/** Optional explicit derivation path to bypass address lookups */
|
|
73
|
+
derivationPath?: string;
|
|
74
|
+
/** Optional Taproot merkle root (script-path signing not yet supported) */
|
|
75
|
+
tapMerkleRootHex?: string;
|
|
76
|
+
/** Optional Taproot leaf hash (script-path signing not yet supported) */
|
|
77
|
+
tapLeafHashHex?: string;
|
|
78
|
+
/** Sighash type */
|
|
79
|
+
sighashTypes?: number[];
|
|
80
|
+
/** Whether to finalize the input after signing */
|
|
81
|
+
finalize?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/** PSBT signing options */
|
|
84
|
+
export interface SignPsbtOptions {
|
|
85
|
+
/** PSBT in base64 format */
|
|
86
|
+
psbt: string;
|
|
87
|
+
/** Inputs to sign */
|
|
88
|
+
signInputs: SignInputOptions[];
|
|
89
|
+
/** Whether to broadcast after signing */
|
|
90
|
+
broadcast?: boolean;
|
|
91
|
+
}
|
|
92
|
+
/** Encrypted data structure stored in IndexedDB */
|
|
93
|
+
export interface EncryptedData {
|
|
94
|
+
/** Versioned envelope for forward-compatible migrations */
|
|
95
|
+
version: number;
|
|
96
|
+
/** Initialization vector */
|
|
97
|
+
iv: Uint8Array;
|
|
98
|
+
/** Encrypted ciphertext (includes GCM tag) */
|
|
99
|
+
ciphertext: Uint8Array;
|
|
100
|
+
}
|
|
101
|
+
/** Stored key envelope for passwordless mode */
|
|
102
|
+
export interface StoredKeyEnvelope {
|
|
103
|
+
/** Envelope version */
|
|
104
|
+
version: number;
|
|
105
|
+
/** Encoding format for the persisted key */
|
|
106
|
+
format: 'raw';
|
|
107
|
+
/** Raw key bytes (never exposed to callers) */
|
|
108
|
+
keyBytes: Uint8Array;
|
|
109
|
+
}
|
|
110
|
+
/** Storage metadata */
|
|
111
|
+
export interface StorageMetadata {
|
|
112
|
+
/** Version of the storage format */
|
|
113
|
+
version: number;
|
|
114
|
+
/** Whether password protection is enabled */
|
|
115
|
+
hasPassword: boolean;
|
|
116
|
+
/** Whether a backup has been created at least once */
|
|
117
|
+
hasBackup?: boolean;
|
|
118
|
+
/** Timestamp of the most recent backup (ms since epoch) */
|
|
119
|
+
lastBackupAt?: number;
|
|
120
|
+
/** PBKDF2 iterations used for password-derived keys (for unlock/migration) */
|
|
121
|
+
pbkdf2Iterations?: number;
|
|
122
|
+
/** Creation timestamp */
|
|
123
|
+
createdAt: number;
|
|
124
|
+
/** Last update timestamp */
|
|
125
|
+
updatedAt: number;
|
|
126
|
+
}
|
|
127
|
+
/** WBIP Provider registration options */
|
|
128
|
+
export interface WBIPProviderOptions {
|
|
129
|
+
/** Unique identifier for the provider */
|
|
130
|
+
id: string;
|
|
131
|
+
/** Display name */
|
|
132
|
+
name: string;
|
|
133
|
+
/** Icon URL or data URI */
|
|
134
|
+
icon: string;
|
|
135
|
+
/** Optional web URL for the provider */
|
|
136
|
+
webUrl?: string;
|
|
137
|
+
}
|
|
138
|
+
/** WBIP Provider descriptor (registered in window.wbip_providers) */
|
|
139
|
+
export interface WBIPProviderDescriptor {
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
icon: string;
|
|
143
|
+
webUrl?: string;
|
|
144
|
+
methods: string[];
|
|
145
|
+
}
|
|
146
|
+
/** WBIP getAddresses request parameters */
|
|
147
|
+
export interface GetAddressesParams {
|
|
148
|
+
purposes: AddressPurpose[];
|
|
149
|
+
message?: string;
|
|
150
|
+
}
|
|
151
|
+
/** WBIP signMessage request parameters */
|
|
152
|
+
export interface SignMessageParams {
|
|
153
|
+
address: string;
|
|
154
|
+
message: string;
|
|
155
|
+
protocol?: 'ecdsa' | 'bip322-simple';
|
|
156
|
+
}
|
|
157
|
+
/** WBIP signPsbt request parameters */
|
|
158
|
+
export interface SignPsbtParams {
|
|
159
|
+
psbt: string;
|
|
160
|
+
signInputs: Record<string, number[]>;
|
|
161
|
+
broadcast?: boolean;
|
|
162
|
+
}
|
|
163
|
+
/** WBIP sendTransfer request parameters */
|
|
164
|
+
export interface SendTransferParams {
|
|
165
|
+
recipients: Array<{
|
|
166
|
+
address: string;
|
|
167
|
+
amount: number;
|
|
168
|
+
}>;
|
|
169
|
+
}
|
|
170
|
+
/** WBIP Error codes */
|
|
171
|
+
export declare enum WBIPErrorCode {
|
|
172
|
+
/** User rejected the request */
|
|
173
|
+
USER_REJECTED = 4001,
|
|
174
|
+
/** Unauthorized - wallet not connected */
|
|
175
|
+
UNAUTHORIZED = 4100,
|
|
176
|
+
/** Unsupported method */
|
|
177
|
+
UNSUPPORTED_METHOD = 4200,
|
|
178
|
+
/** Disconnected from wallet */
|
|
179
|
+
DISCONNECTED = 4900,
|
|
180
|
+
/** Chain disconnected */
|
|
181
|
+
CHAIN_DISCONNECTED = 4901,
|
|
182
|
+
/** Method not found */
|
|
183
|
+
METHOD_NOT_FOUND = -32601,
|
|
184
|
+
/** Invalid params */
|
|
185
|
+
INVALID_PARAMS = -32602,
|
|
186
|
+
/** Internal error */
|
|
187
|
+
INTERNAL_ERROR = -32603
|
|
188
|
+
}
|
|
189
|
+
/** WBIP Error */
|
|
190
|
+
export interface WBIPError {
|
|
191
|
+
code: WBIPErrorCode;
|
|
192
|
+
message: string;
|
|
193
|
+
data?: unknown;
|
|
194
|
+
}
|
|
195
|
+
/** Wallet event types */
|
|
196
|
+
export type WalletEvent = 'lock' | 'unlock' | 'accountsChanged' | 'networkChanged';
|
|
197
|
+
/** Event handler type */
|
|
198
|
+
export type EventHandler<T = unknown> = (data: T) => void;
|
|
199
|
+
/** Backup structure */
|
|
200
|
+
export interface WalletBackup {
|
|
201
|
+
/** Backup format version */
|
|
202
|
+
version: number;
|
|
203
|
+
/** Encrypted mnemonic payload (base64) */
|
|
204
|
+
encrypted: string;
|
|
205
|
+
/** Creation timestamp */
|
|
206
|
+
createdAt: number;
|
|
207
|
+
/** Optional label */
|
|
208
|
+
label?: string;
|
|
209
|
+
}
|
|
210
|
+
/** Backup envelope for portable backups */
|
|
211
|
+
export interface WalletBackupEnvelope {
|
|
212
|
+
version: number;
|
|
213
|
+
cipher: string;
|
|
214
|
+
kdf: {
|
|
215
|
+
name: string;
|
|
216
|
+
hash: string;
|
|
217
|
+
iterations: number;
|
|
218
|
+
salt: string;
|
|
219
|
+
};
|
|
220
|
+
iv: string;
|
|
221
|
+
ciphertext: string;
|
|
222
|
+
createdAt: number;
|
|
223
|
+
network?: 'mainnet' | 'testnet';
|
|
224
|
+
mac?: string;
|
|
225
|
+
macAlgo?: string;
|
|
226
|
+
}
|
|
227
|
+
/** Types of confirmation dialogs */
|
|
228
|
+
export type ConfirmationType = 'connect' | 'sign_message' | 'sign_psbt' | 'send_transfer';
|
|
229
|
+
/** Confirmation dialog data */
|
|
230
|
+
export interface ConfirmationData {
|
|
231
|
+
type: ConfirmationType;
|
|
232
|
+
origin?: string;
|
|
233
|
+
message?: string;
|
|
234
|
+
psbt?: string;
|
|
235
|
+
amount?: number;
|
|
236
|
+
recipient?: string;
|
|
237
|
+
}
|
|
238
|
+
declare global {
|
|
239
|
+
interface Window {
|
|
240
|
+
wbip_providers?: WBIPProviderDescriptor[];
|
|
241
|
+
[key: string]: unknown;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
export {};
|
|
245
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,sCAAsC;AACtC,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEtE,uDAAuD;AACvD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;AAE/D,mBAAmB;AACnB,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,CAAC;AAEhD,kCAAkC;AAClC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,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,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAMD,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,cAAc,GACd,WAAW,GACX,eAAe,CAAC;AAEpB,+BAA+B;AAC/B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,cAAc,CAAC,EAAE,sBAAsB,EAAE,CAAC;QAC1C,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB;CACF;AAED,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ConfirmationData, ConfirmationType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Lightweight modal-based confirmation UI for browser environments.
|
|
4
|
+
* Falls back to throwing when no DOM is available so callers can provide
|
|
5
|
+
* their own confirmation handler in SSR or native contexts.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ConfirmationModal {
|
|
8
|
+
private container;
|
|
9
|
+
private keydownHandler;
|
|
10
|
+
show(type: ConfirmationType, data?: Partial<ConfirmationData>): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Close the modal if it is open.
|
|
13
|
+
*/
|
|
14
|
+
close(): void;
|
|
15
|
+
private buildSummary;
|
|
16
|
+
private getTitle;
|
|
17
|
+
private injectStyles;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../src/ui/Modal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;GAIG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,cAAc,CAAiD;IAEjE,IAAI,CAAC,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IA2EtF;;OAEG;IACH,KAAK,IAAI,IAAI;IAYb,OAAO,CAAC,YAAY;IAiDpB,OAAO,CAAC,QAAQ;IAchB,OAAO,CAAC,YAAY;CAiFrB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AddressInfo, NetworkType, SignInputOptions } from './types';
|
|
2
|
+
export type ExternalWalletSession = {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
network: NetworkType;
|
|
6
|
+
addresses: AddressInfo[];
|
|
7
|
+
/**
|
|
8
|
+
* Sign an arbitrary message with the connected wallet.
|
|
9
|
+
*/
|
|
10
|
+
signMessage: (message: string, address: string, protocol?: 'ecdsa' | 'bip322-simple') => Promise<string>;
|
|
11
|
+
/**
|
|
12
|
+
* Optional PSBT signing hook. Falls back to ZeldWallet when omitted.
|
|
13
|
+
*/
|
|
14
|
+
signPsbt?: (psbtBase64: string, inputs: SignInputOptions[]) => Promise<string>;
|
|
15
|
+
};
|
|
16
|
+
declare class UnifiedWalletBridge {
|
|
17
|
+
private external?;
|
|
18
|
+
useExternal(session: ExternalWalletSession): void;
|
|
19
|
+
reset(): void;
|
|
20
|
+
isExternalActive(): boolean;
|
|
21
|
+
getActiveName(): string;
|
|
22
|
+
getNetwork(): NetworkType;
|
|
23
|
+
getAddresses(purposes: Array<'payment' | 'ordinals' | 'stacks'>): AddressInfo[];
|
|
24
|
+
signMessage(message: string, address: string, protocol?: 'ecdsa' | 'bip322-simple'): Promise<string>;
|
|
25
|
+
signPsbt(psbtBase64: string, inputs: SignInputOptions[]): Promise<string>;
|
|
26
|
+
}
|
|
27
|
+
export declare const UnifiedWallet: UnifiedWalletBridge;
|
|
28
|
+
export type { UnifiedWalletBridge };
|
|
29
|
+
//# sourceMappingURL=unifiedWallet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unifiedWallet.d.ts","sourceRoot":"","sources":["../../src/unifiedWallet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB;;OAEG;IACH,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACzG;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAChF,CAAC;AAEF,cAAM,mBAAmB;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAwB;IAEzC,WAAW,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI;IAIjD,KAAK,IAAI,IAAI;IAIb,gBAAgB,IAAI,OAAO;IAI3B,aAAa,IAAI,MAAM;IAIvB,UAAU,IAAI,WAAW;IAIzB,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC,GAAG,WAAW,EAAE;IAOzE,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,GAAE,OAAO,GAAG,eAAyB,GAAG,OAAO,CAAC,MAAM,CAAC;IAe7G,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;CAMhF;AAED,eAAO,MAAM,aAAa,qBAA4B,CAAC;AAEvD,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Crypto utilities shared across storage and backup helpers.
|
|
3
|
+
* Provides PBKDF2-based AES-GCM key derivation and simple
|
|
4
|
+
* password-based encryption/decryption helpers.
|
|
5
|
+
*/
|
|
6
|
+
/** Payload returned by password-based encryption helpers */
|
|
7
|
+
export interface PasswordEncryptedPayload {
|
|
8
|
+
version: number;
|
|
9
|
+
salt: Uint8Array;
|
|
10
|
+
iv: Uint8Array;
|
|
11
|
+
ciphertext: Uint8Array;
|
|
12
|
+
/** Optional PBKDF2 iterations used during encryption (backward compatible) */
|
|
13
|
+
iterations?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Compute an HMAC-SHA256 over the provided payload using a password-derived key.
|
|
17
|
+
*/
|
|
18
|
+
export declare function computeHmacSha256(payload: Uint8Array, password: string, salt: Uint8Array, iterationsOverride?: number): Promise<Uint8Array>;
|
|
19
|
+
/**
|
|
20
|
+
* Constant-time comparison of two byte arrays.
|
|
21
|
+
*/
|
|
22
|
+
export declare function timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Derive an AES-GCM key from a password and salt using PBKDF2.
|
|
25
|
+
*/
|
|
26
|
+
export declare function deriveAesKeyFromPassword(password: string, salt: Uint8Array, extractable?: boolean, usages?: KeyUsage[], iterationsOverride?: number): Promise<CryptoKey>;
|
|
27
|
+
/**
|
|
28
|
+
* Encrypt arbitrary bytes with a password using PBKDF2 + AES-GCM.
|
|
29
|
+
* Returns the envelope with salt + iv + ciphertext for easy transport.
|
|
30
|
+
*/
|
|
31
|
+
export declare function encryptWithPassword(plaintext: Uint8Array, password: string, iterationsOverride?: number): Promise<PasswordEncryptedPayload>;
|
|
32
|
+
/**
|
|
33
|
+
* Decrypt bytes produced by encryptWithPassword (salt + iv + ciphertext).
|
|
34
|
+
*/
|
|
35
|
+
export declare function decryptWithPassword(encrypted: PasswordEncryptedPayload | Uint8Array, password: string): Promise<Uint8Array>;
|
|
36
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../src/utils/crypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,4DAA4D;AAC5D,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,EAAE,UAAU,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAgCD;;GAEG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,UAAU,CAAC,CAIrB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAOrE;AAED;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,UAAU,EAChB,WAAW,GAAE,OAAe,EAC5B,MAAM,GAAE,QAAQ,EAA2B,EAC3C,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,SAAS,CAAC,CAqBpB;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,UAAU,EACrB,QAAQ,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,wBAAwB,CAAC,CAiBnC;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,SAAS,EAAE,wBAAwB,GAAG,UAAU,EAChD,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,UAAU,CAAC,CAiBrB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Encoding Utilities
|
|
3
|
+
*
|
|
4
|
+
* Functions for converting between different data formats.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Convert a hex string to Uint8Array
|
|
8
|
+
*/
|
|
9
|
+
export declare function hexToBytes(hex: string): Uint8Array;
|
|
10
|
+
/**
|
|
11
|
+
* Convert a Uint8Array to hex string
|
|
12
|
+
*/
|
|
13
|
+
export declare function bytesToHex(bytes: Uint8Array): string;
|
|
14
|
+
/**
|
|
15
|
+
* Convert a string to Uint8Array (UTF-8)
|
|
16
|
+
*/
|
|
17
|
+
export declare function stringToBytes(str: string): Uint8Array;
|
|
18
|
+
/**
|
|
19
|
+
* Convert a Uint8Array to string (UTF-8)
|
|
20
|
+
*/
|
|
21
|
+
export declare function bytesToString(bytes: Uint8Array): string;
|
|
22
|
+
/**
|
|
23
|
+
* Convert a Uint8Array to base64 string
|
|
24
|
+
*/
|
|
25
|
+
export declare function bytesToBase64(bytes: Uint8Array): string;
|
|
26
|
+
/**
|
|
27
|
+
* Convert a base64 string to Uint8Array
|
|
28
|
+
*/
|
|
29
|
+
export declare function base64ToBytes(base64: string): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Concatenate multiple Uint8Arrays
|
|
32
|
+
*/
|
|
33
|
+
export declare function concatBytes(...arrays: Uint8Array[]): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* Compare two Uint8Arrays for equality
|
|
36
|
+
*/
|
|
37
|
+
export declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Generate cryptographically secure random bytes
|
|
40
|
+
*/
|
|
41
|
+
export declare function randomBytes(length: number): Uint8Array;
|
|
42
|
+
/**
|
|
43
|
+
* Best-effort zeroization of sensitive buffers.
|
|
44
|
+
*/
|
|
45
|
+
export declare function wipeBytes(bytes: Uint8Array): void;
|
|
46
|
+
//# sourceMappingURL=encoding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../../src/utils/encoding.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CASlD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAIpD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAErD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAEvD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAKvD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAOxD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAS/D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAMhE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,CAEjD"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AddressPurpose, AddressType, NetworkType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Validate a BIP39 mnemonic phrase
|
|
4
|
+
*/
|
|
5
|
+
export declare function isValidMnemonic(mnemonic: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Validate that a mnemonic has the correct number of words
|
|
8
|
+
*/
|
|
9
|
+
export declare function isValidMnemonicLength(mnemonic: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Basic Bitcoin address format validation
|
|
12
|
+
* Note: This is a basic check, not cryptographic validation
|
|
13
|
+
*/
|
|
14
|
+
export declare function isValidBitcoinAddress(address: string, network?: NetworkType): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Detect the address type from a Bitcoin address
|
|
17
|
+
*/
|
|
18
|
+
export declare function detectAddressType(address: string, network?: NetworkType): AddressType | null;
|
|
19
|
+
/**
|
|
20
|
+
* Validate address purpose
|
|
21
|
+
*/
|
|
22
|
+
export declare function isValidAddressPurpose(purpose: string): purpose is AddressPurpose;
|
|
23
|
+
/**
|
|
24
|
+
* Validate password strength
|
|
25
|
+
*/
|
|
26
|
+
export declare function validatePassword(password: string): {
|
|
27
|
+
valid: boolean;
|
|
28
|
+
message?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Validate hex string
|
|
32
|
+
*/
|
|
33
|
+
export declare function isValidHex(str: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Validate base64 string
|
|
36
|
+
*/
|
|
37
|
+
export declare function isValidBase64(str: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Validate PSBT (basic format check)
|
|
40
|
+
*/
|
|
41
|
+
export declare function isValidPsbtBase64(psbt: string): boolean;
|
|
42
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEzE;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAuB,GAAG,OAAO,CA6BhG;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,WAAuB,GAAG,WAAW,GAAG,IAAI,CAgCvG;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,IAAI,cAAc,CAEhF;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CASvF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAG/C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAOlD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CASvD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zeldhash-miner-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"collaborators": [
|
|
5
|
+
"Ouziel Slama <ouziel@gmail.com>"
|
|
6
|
+
],
|
|
7
|
+
"description": "WASM bindings for the Zeldhash miner with optional WebGPU acceleration",
|
|
8
|
+
"version": "0.2.0",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/zeldhash/zeldhash-miner"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"zeldhash_miner_wasm_bg.wasm",
|
|
16
|
+
"zeldhash_miner_wasm.js",
|
|
17
|
+
"zeldhash_miner_wasm.d.ts"
|
|
18
|
+
],
|
|
19
|
+
"main": "zeldhash_miner_wasm.js",
|
|
20
|
+
"homepage": "https://github.com/zeldhash/zeldhash-miner",
|
|
21
|
+
"types": "zeldhash_miner_wasm.d.ts",
|
|
22
|
+
"sideEffects": [
|
|
23
|
+
"./snippets/*"
|
|
24
|
+
],
|
|
25
|
+
"keywords": [
|
|
26
|
+
"bitcoin",
|
|
27
|
+
"mining",
|
|
28
|
+
"wasm",
|
|
29
|
+
"webgpu"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export function build_mining_template(inputs: any, outputs: any, network: string, sats_per_vbyte: bigint, start_nonce: bigint, batch_size: number, distribution: any): any;
|
|
5
|
+
|
|
6
|
+
export function build_psbt(inputs: any, outputs: any, network: string, sats_per_vbyte: bigint, nonce: bigint, distribution: any): string;
|
|
7
|
+
|
|
8
|
+
export function calibrate_batch_size(): Promise<number>;
|
|
9
|
+
|
|
10
|
+
export function compute_txid(tx_bytes: Uint8Array): string;
|
|
11
|
+
|
|
12
|
+
export function init_gpu(): Promise<any>;
|
|
13
|
+
|
|
14
|
+
export function init_panic_hook(): void;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Dispatch a GPU batch and return the match with the smallest nonce (OP_RETURN value).
|
|
18
|
+
*/
|
|
19
|
+
export function mine_batch_gpu(tx_prefix: Uint8Array, tx_suffix: Uint8Array, start_nonce: bigint, batch_size: number, target_zeros: number, use_cbor_nonce: boolean): Promise<any>;
|
|
20
|
+
|
|
21
|
+
export function mine_batch_wasm(tx_prefix: Uint8Array, tx_suffix: Uint8Array, start_nonce: bigint, batch_size: number, target_zeros: number, use_cbor_nonce: boolean): any;
|
|
22
|
+
|
|
23
|
+
export function mine_range_gpu(inputs: any, outputs: any, network: string, sats_per_vbyte: bigint, range: any, target_zeros: number, distribution: any): Promise<any>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Mine across a nonce range, automatically splitting at byte-length boundaries.
|
|
27
|
+
*/
|
|
28
|
+
export function mine_range_wasm(inputs: any, outputs: any, network: string, sats_per_vbyte: bigint, range: any, target_zeros: number, distribution: any): any;
|
|
29
|
+
|
|
30
|
+
export function validate_address(addr: string, network: string): any;
|
|
31
|
+
|
|
32
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
33
|
+
|
|
34
|
+
export interface InitOutput {
|
|
35
|
+
readonly memory: WebAssembly.Memory;
|
|
36
|
+
readonly mine_batch_wasm: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: number, h: number) => any;
|
|
37
|
+
readonly mine_range_wasm: (a: any, b: any, c: number, d: number, e: bigint, f: any, g: number, h: any) => any;
|
|
38
|
+
readonly validate_address: (a: number, b: number, c: number, d: number) => any;
|
|
39
|
+
readonly build_psbt: (a: any, b: any, c: number, d: number, e: bigint, f: bigint, g: any) => [number, number, number, number];
|
|
40
|
+
readonly build_mining_template: (a: any, b: any, c: number, d: number, e: bigint, f: bigint, g: number, h: any) => [number, number, number];
|
|
41
|
+
readonly compute_txid: (a: number, b: number) => [number, number];
|
|
42
|
+
readonly init_gpu: () => any;
|
|
43
|
+
readonly mine_batch_gpu: (a: number, b: number, c: number, d: number, e: bigint, f: number, g: number, h: number) => any;
|
|
44
|
+
readonly mine_range_gpu: (a: any, b: any, c: number, d: number, e: bigint, f: any, g: number, h: any) => any;
|
|
45
|
+
readonly calibrate_batch_size: () => any;
|
|
46
|
+
readonly init_panic_hook: () => void;
|
|
47
|
+
readonly wasm_bindgen__convert__closures_____invoke__h4173f797cb68abd1: (a: number, b: number, c: any) => void;
|
|
48
|
+
readonly wasm_bindgen__closure__destroy__h08603745582b4e0f: (a: number, b: number) => void;
|
|
49
|
+
readonly wasm_bindgen__convert__closures_____invoke__h1a38164a3a667135: (a: number, b: number, c: any) => void;
|
|
50
|
+
readonly wasm_bindgen__closure__destroy__h16b8b0f00158f31c: (a: number, b: number) => void;
|
|
51
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2845bf56d21a7dac: (a: number, b: number, c: any, d: any) => void;
|
|
52
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
53
|
+
readonly __externref_table_alloc: () => number;
|
|
54
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
55
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
56
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
57
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
58
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
59
|
+
readonly __wbindgen_start: () => void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
66
|
+
* a precompiled `WebAssembly.Module`.
|
|
67
|
+
*
|
|
68
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
69
|
+
*
|
|
70
|
+
* @returns {InitOutput}
|
|
71
|
+
*/
|
|
72
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
76
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
77
|
+
*
|
|
78
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
79
|
+
*
|
|
80
|
+
* @returns {Promise<InitOutput>}
|
|
81
|
+
*/
|
|
82
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|