@zerc20/wallet-sdk 0.2.0 → 0.3.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/dist/burnWorker.js +6 -6
- package/dist/burnWorker.js.map +1 -1
- package/dist/context.d.ts +23 -4
- package/dist/context.js +35 -6
- package/dist/context.js.map +1 -1
- package/dist/core.d.ts +32 -17
- package/dist/core.js +253 -70
- package/dist/core.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pos.js +2 -2
- package/dist/pos.js.map +1 -1
- package/dist/rageExit.js +3 -5
- package/dist/rageExit.js.map +1 -1
- package/dist/seed.d.ts +4 -0
- package/dist/seed.js +12 -1
- package/dist/seed.js.map +1 -1
- package/dist/spend.d.ts +1 -1
- package/dist/spend.js +5 -4
- package/dist/spend.js.map +1 -1
- package/dist/state.d.ts +14 -4
- package/dist/state.js +10 -7
- package/dist/state.js.map +1 -1
- package/dist/sync.d.ts +16 -3
- package/dist/sync.js +90 -25
- package/dist/sync.js.map +1 -1
- package/dist/wallet.d.ts +22 -10
- package/dist/wallet.js +111 -58
- package/dist/wallet.js.map +1 -1
- package/package.json +4 -3
- package/src/burnWorker.ts +9 -10
- package/src/context.ts +48 -8
- package/src/core.ts +279 -87
- package/src/index.ts +1 -1
- package/src/pos.ts +2 -2
- package/src/rageExit.ts +3 -4
- package/src/seed.ts +13 -1
- package/src/spend.ts +5 -5
- package/src/state.ts +17 -7
- package/src/sync.ts +95 -24
- package/src/wallet.ts +136 -60
- package/wasm/zerc20_wallet_core.d.ts +16 -13
- package/wasm/zerc20_wallet_core.js +49 -42
- package/wasm/zerc20_wallet_core_bg.wasm +0 -0
- package/wasm/zerc20_wallet_core_bg.wasm.d.ts +3 -3
package/dist/burnWorker.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
import { initCore,
|
|
4
|
-
async function answer(
|
|
1
|
+
// Runs blocks of burn address searches off the main thread, one at a time: core.ts keeps a pool of these, Web Workers
|
|
2
|
+
// in a browser and worker threads in Node.
|
|
3
|
+
import { initCore, runBlock } from './core.js';
|
|
4
|
+
async function answer(b) {
|
|
5
5
|
try {
|
|
6
6
|
await initCore();
|
|
7
|
-
return { burn:
|
|
7
|
+
return { burn: runBlock(b) };
|
|
8
8
|
}
|
|
9
9
|
catch (e) {
|
|
10
10
|
return { error: e instanceof Error ? e.message : String(e) };
|
|
@@ -16,6 +16,6 @@ if (typeof self !== 'undefined') {
|
|
|
16
16
|
else {
|
|
17
17
|
// a variable, so that bundlers for the browser leave Node's module alone
|
|
18
18
|
const threads = 'node:worker_threads';
|
|
19
|
-
void import(/* @vite-ignore */ threads).then(
|
|
19
|
+
void import(/* @vite-ignore */ threads).then(({ parentPort }) => parentPort.on('message', (b) => void answer(b).then((a) => parentPort.postMessage(a))));
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=burnWorker.js.map
|
package/dist/burnWorker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"burnWorker.js","sourceRoot":"","sources":["../src/burnWorker.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"burnWorker.js","sourceRoot":"","sources":["../src/burnWorker.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,2CAA2C;AAE3C,OAAO,EAAmC,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEhF,KAAK,UAAU,MAAM,CAAC,CAAY;IAChC,IAAI,CAAC;QACH,MAAM,QAAQ,EAAE,CAAC;QACjB,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,EAAE,KAAK,EAAE,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/D,CAAC;AACH,CAAC;AAED,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE,CAAC;IAChC,IAAI,CAAC,SAAS,GAAG,KAAK,EAAE,EAAE,IAAI,EAA2B,EAAE,EAAE,CAAC,WAAW,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAChG,CAAC;KAAM,CAAC;IACN,yEAAyE;IACzE,MAAM,OAAO,GAAG,qBAAqB,CAAC;IAEtC,KAAK,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAwB,EAAE,EAAE,CACpF,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CACvF,CAAC;AACJ,CAAC"}
|
package/dist/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CanisterClient, ViewKey } from '@zerc20/storage-sdk';
|
|
2
|
-
import { type Hex, type WalletClient } from 'viem';
|
|
2
|
+
import { type Account, type Hex, type WalletClient } from 'viem';
|
|
3
3
|
import type { Chain } from './chain.js';
|
|
4
4
|
import type { ChainConfig, Network } from './network.js';
|
|
5
5
|
import type { Asp, Indexer } from './servers.js';
|
|
@@ -18,11 +18,20 @@ export interface SpendKey {
|
|
|
18
18
|
publicKey: Hex;
|
|
19
19
|
nullifyingKey: Hex;
|
|
20
20
|
}
|
|
21
|
+
/** What a sync needs of a key: its public key and nullifying key, which find and follow what it owns but spend none of
|
|
22
|
+
* it. */
|
|
23
|
+
export type Owner = Pick<SpendKey, 'publicKey' | 'nullifyingKey'>;
|
|
21
24
|
export interface Ctx {
|
|
22
25
|
network: Network;
|
|
23
|
-
|
|
26
|
+
/** The root of every key. Opened with a function for it, held only while something needs it; otherwise always. */
|
|
27
|
+
seed: Uint8Array | null;
|
|
28
|
+
/** The owners derived while the seed was held, by key: the wallet's own (`''`) and each receive code's. */
|
|
29
|
+
owners: Map<string, Owner>;
|
|
24
30
|
address: Hex;
|
|
25
|
-
|
|
31
|
+
/** The account that holds the public funds, and signs for them. */
|
|
32
|
+
account: Account;
|
|
33
|
+
/** The user's wallet, when it is what signs and sends rather than an account of the app's own (`walletOn`). */
|
|
34
|
+
walletClient: WalletClient | null;
|
|
26
35
|
storage: CanisterClient;
|
|
27
36
|
view: ViewKey;
|
|
28
37
|
chains: ChainCtx[];
|
|
@@ -37,11 +46,21 @@ export interface CodeId {
|
|
|
37
46
|
tokenId: number;
|
|
38
47
|
index: number;
|
|
39
48
|
}
|
|
49
|
+
/** The seed, which the wallet holds whenever it does what needs it. */
|
|
50
|
+
export declare function seedOf(ctx: Ctx): Uint8Array;
|
|
40
51
|
/** The key that owns this seed's notes and deposits on every chain and token, or with `code`, the notes paid to that
|
|
41
|
-
* receive code. */
|
|
52
|
+
* receive code. Its owner is kept for when the seed is not held. */
|
|
42
53
|
export declare function spendKey(ctx: Ctx, code?: CodeId): SpendKey;
|
|
54
|
+
/** `spendKey`'s owner: derived before, or now if the seed is held; null if neither. The wallet's own is derived as it
|
|
55
|
+
* opens. */
|
|
56
|
+
export declare function owner(ctx: Ctx, code?: CodeId): Owner | null;
|
|
43
57
|
export declare function chainCtx(ctx: Ctx, chainId: bigint): ChainCtx;
|
|
44
58
|
export declare function chainState(ctx: Ctx, chainId: bigint): ChainState;
|
|
59
|
+
/** `wc` on `chainId`, switched there first: a browser wallet is on one chain at a time. */
|
|
60
|
+
export declare function switched(wc: WalletClient, chainId: bigint): Promise<WalletClient>;
|
|
61
|
+
/** The client that sends the account's transactions on `chainId`: the user's wallet, switched to the chain, or the
|
|
62
|
+
* app's own account, through the chain's RPC. */
|
|
63
|
+
export declare function walletOn(ctx: Ctx, chainId: bigint): Promise<WalletClient>;
|
|
45
64
|
/** Waits until the wallet's own node has a transaction mined on ours too: the wallet simulates the next one there, and
|
|
46
65
|
* where blocks are fast that node lags ours now and then, so the next one would show as reverting. A wallet that does
|
|
47
66
|
* not answer is not waited on. */
|
package/dist/context.js
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
// Everything an open wallet works with, shared by sync and the operations.
|
|
2
|
-
import { publicActions } from 'viem';
|
|
2
|
+
import { createWalletClient, http, publicActions } from 'viem';
|
|
3
3
|
import { core } from './core.js';
|
|
4
|
+
import { guard } from './errors.js';
|
|
4
5
|
const keys = new WeakMap();
|
|
6
|
+
const idOf = (code) => (code ? `${code.chainId}:${code.tokenId}:${code.index}` : '');
|
|
7
|
+
/** The seed, which the wallet holds whenever it does what needs it. */
|
|
8
|
+
export function seedOf(ctx) {
|
|
9
|
+
if (!ctx.seed)
|
|
10
|
+
throw new Error('the wallet does not hold its seed now');
|
|
11
|
+
return ctx.seed;
|
|
12
|
+
}
|
|
5
13
|
/** The key that owns this seed's notes and deposits on every chain and token, or with `code`, the notes paid to that
|
|
6
|
-
* receive code. */
|
|
14
|
+
* receive code. Its owner is kept for when the seed is not held. */
|
|
7
15
|
export function spendKey(ctx, code) {
|
|
8
|
-
|
|
16
|
+
const seed = seedOf(ctx);
|
|
17
|
+
let bySeed = keys.get(seed);
|
|
9
18
|
if (!bySeed)
|
|
10
|
-
keys.set(
|
|
11
|
-
const id = code
|
|
19
|
+
keys.set(seed, (bySeed = new Map()));
|
|
20
|
+
const id = idOf(code);
|
|
12
21
|
let key = bySeed.get(id);
|
|
13
22
|
if (!key) {
|
|
14
|
-
key = (code ? core.
|
|
23
|
+
key = (code ? core.codeSpendKey(seed, code.chainId, code.tokenId, code.index) : core.spendKey(seed));
|
|
15
24
|
bySeed.set(id, key);
|
|
16
25
|
}
|
|
26
|
+
if (!ctx.owners.has(id))
|
|
27
|
+
ctx.owners.set(id, { publicKey: key.publicKey, nullifyingKey: key.nullifyingKey });
|
|
17
28
|
return key;
|
|
18
29
|
}
|
|
30
|
+
/** `spendKey`'s owner: derived before, or now if the seed is held; null if neither. The wallet's own is derived as it
|
|
31
|
+
* opens. */
|
|
32
|
+
export function owner(ctx, code) {
|
|
33
|
+
return ctx.owners.get(idOf(code)) ?? (ctx.seed ? spendKey(ctx, code) : null);
|
|
34
|
+
}
|
|
19
35
|
export function chainCtx(ctx, chainId) {
|
|
20
36
|
const c = ctx.chains.find((c) => c.config.chainId === chainId);
|
|
21
37
|
if (!c)
|
|
@@ -28,6 +44,19 @@ export function chainState(ctx, chainId) {
|
|
|
28
44
|
ctx.state.chains.push((s = { chainId, samples: [], burnNext: {} }));
|
|
29
45
|
return s;
|
|
30
46
|
}
|
|
47
|
+
/** `wc` on `chainId`, switched there first: a browser wallet is on one chain at a time. */
|
|
48
|
+
export async function switched(wc, chainId) {
|
|
49
|
+
if ((await wc.getChainId()) !== Number(chainId))
|
|
50
|
+
await guard(wc.switchChain({ id: Number(chainId) }));
|
|
51
|
+
return wc;
|
|
52
|
+
}
|
|
53
|
+
/** The client that sends the account's transactions on `chainId`: the user's wallet, switched to the chain, or the
|
|
54
|
+
* app's own account, through the chain's RPC. */
|
|
55
|
+
export async function walletOn(ctx, chainId) {
|
|
56
|
+
if (ctx.walletClient)
|
|
57
|
+
return switched(ctx.walletClient, chainId);
|
|
58
|
+
return createWalletClient({ account: ctx.account, transport: http(chainCtx(ctx, chainId).config.rpcUrl) });
|
|
59
|
+
}
|
|
31
60
|
/** Waits until the wallet's own node has a transaction mined on ours too: the wallet simulates the next one there, and
|
|
32
61
|
* where blocks are fast that node lags ours now and then, so the next one would show as reverting. A wallet that does
|
|
33
62
|
* not answer is not waited on. */
|
package/dist/context.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAG3E,OAAO,
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.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
8
8
|
address: Address;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* responsive; `signal` stops the search. */
|
|
13
|
-
export declare const burnAddress: (
|
|
14
|
-
/** The `k`-th burn address a point of sale holding `laneKey` makes for its owner's `publicKey` on a chain and token
|
|
15
|
-
* (`keys::pos_burn`), with its salt: about 2^16 hashes too, searched the same way. */
|
|
16
|
-
export declare const posBurnAddress: (laneKey: Uint8Array, chainId: bigint, tokenId: number, k: number, publicKey: Hex, signal?: AbortSignal) => Promise<Burn>;
|
|
10
|
+
/** The `index`-th burn address of `publicKey` on a chain and token, and its salt, from `burnKey`: the wallet's own burn
|
|
11
|
+
* key, or a point of sale's (`wallet_keys::derive_burn_address`). About 2^16 hashes, spread over the device's cores
|
|
12
|
+
* (Web Workers in a browser, worker threads in Node) so that the app stays responsive; `signal` stops the search. */
|
|
13
|
+
export declare const burnAddress: (burnKey: Uint8Array, chainId: bigint, tokenId: number, index: number, publicKey: Hex, signal?: AbortSignal) => Promise<Burn>;
|
|
17
14
|
/** A burn address of someone else's `publicKey` (one they published to be paid), with a random salt that has the proof
|
|
18
15
|
* of work: about 2^16 hashes too, searched the same way. Only who holds the salt finds it: the payer, and the owner once
|
|
19
16
|
* told (`planSend` with `burn`). */
|
|
20
17
|
export declare const burnAddressFor: (chainId: bigint, publicKey: Hex, signal?: AbortSignal) => Promise<Burn>;
|
|
21
18
|
export type BurnSearch = {
|
|
22
|
-
|
|
19
|
+
burnKey: Uint8Array;
|
|
23
20
|
chainId: bigint;
|
|
24
21
|
tokenId: number;
|
|
25
22
|
index: number;
|
|
26
|
-
} | {
|
|
27
|
-
laneKey: Uint8Array;
|
|
28
|
-
chainId: bigint;
|
|
29
|
-
tokenId: number;
|
|
30
|
-
k: number;
|
|
31
23
|
publicKey: Hex;
|
|
32
24
|
} | {
|
|
33
25
|
chainId: bigint;
|
|
34
26
|
publicKey: Hex;
|
|
35
27
|
};
|
|
36
|
-
/** A
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
/** A block of a search: its salt counters `from..=to`, or as many random salts for someone else's key. */
|
|
29
|
+
export interface BurnBlock {
|
|
30
|
+
search: BurnSearch;
|
|
31
|
+
from: number;
|
|
32
|
+
to: number;
|
|
33
|
+
}
|
|
39
34
|
export type BurnAnswer = {
|
|
40
|
-
burn: Burn;
|
|
35
|
+
burn: Burn | null;
|
|
41
36
|
} | {
|
|
42
37
|
error: string;
|
|
43
38
|
};
|
|
39
|
+
/** The address a block holds, if any. Its salts count up from a start: one the burn key derives, or for someone else's
|
|
40
|
+
* key a random one below 2^253, so that every salt is a field element. */
|
|
41
|
+
export declare function runBlock({ search: s, from, to }: BurnBlock): Burn | null;
|
|
42
|
+
type Outcome = {
|
|
43
|
+
burn: Burn;
|
|
44
|
+
} | {
|
|
45
|
+
error: unknown;
|
|
46
|
+
};
|
|
47
|
+
/** A search in progress, in blocks `0, 1, …` of `BLOCK` counters. From a burn key, the address is the first block's
|
|
48
|
+
* hit, so that every device derives the same one; for someone else's key, it is the first found. */
|
|
49
|
+
export declare class Search {
|
|
50
|
+
#private;
|
|
51
|
+
readonly s: BurnSearch;
|
|
52
|
+
constructor(s: BurnSearch, settle: (r: Outcome) => void);
|
|
53
|
+
take(): number | undefined;
|
|
54
|
+
drop(block: number): void;
|
|
55
|
+
finish(block: number, burn: Burn | null): void;
|
|
56
|
+
fail(error: unknown): void;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
package/dist/core.js
CHANGED
|
@@ -17,90 +17,273 @@ export function initCore() {
|
|
|
17
17
|
return ready.then(() => undefined);
|
|
18
18
|
}
|
|
19
19
|
export const core = wasm;
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
* responsive; `signal` stops the search. */
|
|
23
|
-
export const burnAddress = (
|
|
24
|
-
/** The `k`-th burn address a point of sale holding `laneKey` makes for its owner's `publicKey` on a chain and token
|
|
25
|
-
* (`keys::pos_burn`), with its salt: about 2^16 hashes too, searched the same way. */
|
|
26
|
-
export const posBurnAddress = (laneKey, chainId, tokenId, k, publicKey, signal) => search({ laneKey, chainId, tokenId, k, publicKey }, signal);
|
|
20
|
+
/** The `index`-th burn address of `publicKey` on a chain and token, and its salt, from `burnKey`: the wallet's own burn
|
|
21
|
+
* key, or a point of sale's (`wallet_keys::derive_burn_address`). About 2^16 hashes, spread over the device's cores
|
|
22
|
+
* (Web Workers in a browser, worker threads in Node) so that the app stays responsive; `signal` stops the search. */
|
|
23
|
+
export const burnAddress = (burnKey, chainId, tokenId, index, publicKey, signal) => search({ burnKey, chainId, tokenId, index, publicKey }, signal);
|
|
27
24
|
/** A burn address of someone else's `publicKey` (one they published to be paid), with a random salt that has the proof
|
|
28
25
|
* of work: about 2^16 hashes too, searched the same way. Only who holds the salt finds it: the payer, and the owner once
|
|
29
26
|
* told (`planSend` with `burn`). */
|
|
30
27
|
export const burnAddressFor = (chainId, publicKey, signal) => search({ chainId, publicKey }, signal);
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (address)
|
|
44
|
-
return { salt, address };
|
|
28
|
+
/** Counters per block: about 20 ms of hashing on a laptop, a few times that on a phone. */
|
|
29
|
+
const BLOCK = 512;
|
|
30
|
+
/** The address a block holds, if any. Its salts count up from a start: one the burn key derives, or for someone else's
|
|
31
|
+
* key a random one below 2^253, so that every salt is a field element. */
|
|
32
|
+
export function runBlock({ search: s, from, to }) {
|
|
33
|
+
let burn;
|
|
34
|
+
if ('burnKey' in s)
|
|
35
|
+
burn = core.burnBlock(s.burnKey, s.chainId, s.tokenId, s.index, s.publicKey, from, to);
|
|
36
|
+
else {
|
|
37
|
+
const start = crypto.getRandomValues(new Uint8Array(32));
|
|
38
|
+
start[0] = start[0] & 0x1f;
|
|
39
|
+
burn = core.burnBlockFor(s.chainId, s.publicKey, bytesToHex(start), to - from + 1);
|
|
45
40
|
}
|
|
41
|
+
return burn ?? null;
|
|
46
42
|
}
|
|
47
|
-
/**
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
43
|
+
/** A search in progress, in blocks `0, 1, …` of `BLOCK` counters. From a burn key, the address is the first block's
|
|
44
|
+
* hit, so that every device derives the same one; for someone else's key, it is the first found. */
|
|
45
|
+
export class Search {
|
|
46
|
+
s;
|
|
47
|
+
#settle;
|
|
48
|
+
/** From a burn key: the address is the first block's hit, not the first found. */
|
|
49
|
+
#derived;
|
|
50
|
+
#settled = false;
|
|
51
|
+
#next = 0;
|
|
52
|
+
/** Blocks a worker took and died with, handed out again before any other. */
|
|
53
|
+
#dropped = [];
|
|
54
|
+
/** What the finished blocks from `#checked` on hold: every block below it holds none. */
|
|
55
|
+
#found = new Map();
|
|
56
|
+
#checked = 0;
|
|
57
|
+
/** The lowest block known to hold an address: no block above it is needed. */
|
|
58
|
+
#lowest = Infinity;
|
|
59
|
+
constructor(s, settle) {
|
|
60
|
+
this.s = s;
|
|
61
|
+
this.#settle = settle;
|
|
62
|
+
this.#derived = 'burnKey' in s;
|
|
63
|
+
}
|
|
64
|
+
take() {
|
|
65
|
+
if (this.#settled)
|
|
66
|
+
return undefined;
|
|
67
|
+
if (this.#dropped.length)
|
|
68
|
+
return this.#dropped.shift();
|
|
69
|
+
return this.#next < this.#lowest ? this.#next++ : undefined;
|
|
70
|
+
}
|
|
71
|
+
drop(block) {
|
|
72
|
+
this.#dropped.unshift(block);
|
|
73
|
+
}
|
|
74
|
+
finish(block, burn) {
|
|
75
|
+
if (this.#settled)
|
|
76
|
+
return;
|
|
77
|
+
if (!this.#derived) {
|
|
78
|
+
if (burn)
|
|
79
|
+
this.#end({ burn });
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
this.#found.set(block, burn);
|
|
83
|
+
if (burn)
|
|
84
|
+
this.#lowest = Math.min(this.#lowest, block);
|
|
85
|
+
for (let found; (found = this.#found.get(this.#checked)) !== undefined; this.#checked++) {
|
|
86
|
+
if (found)
|
|
87
|
+
return this.#end({ burn: found });
|
|
88
|
+
this.#found.delete(this.#checked);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
fail(error) {
|
|
92
|
+
if (!this.#settled)
|
|
93
|
+
this.#end({ error });
|
|
94
|
+
}
|
|
95
|
+
#end(r) {
|
|
96
|
+
this.#settled = true;
|
|
97
|
+
this.#settle(r);
|
|
61
98
|
}
|
|
62
|
-
// variables, so that bundlers for the browser leave Node's module and a second copy of the worker alone
|
|
63
|
-
const [threads, file] = ['node:worker_threads', './burnWorker.js'];
|
|
64
|
-
const { Worker: Thread } = (await import(/* @vite-ignore */ threads).catch(() => ({})));
|
|
65
|
-
if (!Thread)
|
|
66
|
-
return null;
|
|
67
|
-
const thread = new Thread(new URL(file, import.meta.url), { workerData: s });
|
|
68
|
-
thread.once('message', done);
|
|
69
|
-
thread.once('error', () => done(null)); // run from source, as tests are, there is no burnWorker.js
|
|
70
|
-
return () => void thread.terminate();
|
|
71
99
|
}
|
|
100
|
+
/** Searches in progress, oldest first: blocks go to the oldest that has one to hand out. */
|
|
101
|
+
const searches = [];
|
|
102
|
+
let threads = null;
|
|
103
|
+
let starting = false;
|
|
104
|
+
/** Workers do not run here (a page whose CSP forbids them, a bundler that left burnWorker.js out, tests run from
|
|
105
|
+
* source): blocks run on this thread instead. */
|
|
106
|
+
let here = false;
|
|
107
|
+
let runningHere = false;
|
|
108
|
+
let idle;
|
|
109
|
+
/** An idle pool stops after this long, freeing a wasm instance per core. */
|
|
110
|
+
const IDLE_MS = 30_000;
|
|
72
111
|
async function search(s, signal) {
|
|
73
|
-
signal?.throwIfAborted();
|
|
74
112
|
await initCore();
|
|
113
|
+
signal?.throwIfAborted();
|
|
75
114
|
return new Promise((resolve, reject) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const settle = (f) => {
|
|
79
|
-
if (settled)
|
|
80
|
-
return;
|
|
81
|
-
settled = true;
|
|
82
|
-
stop?.();
|
|
115
|
+
const abort = () => one.fail(signal.reason);
|
|
116
|
+
const one = new Search(s, (r) => {
|
|
83
117
|
signal?.removeEventListener('abort', abort);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
catch (err) {
|
|
91
|
-
reject(err);
|
|
92
|
-
}
|
|
118
|
+
searches.splice(searches.indexOf(one), 1);
|
|
119
|
+
if ('burn' in r)
|
|
120
|
+
resolve(r.burn);
|
|
121
|
+
else
|
|
122
|
+
reject(r.error);
|
|
93
123
|
});
|
|
94
|
-
const abort = () => settle(() => reject(signal.reason));
|
|
95
124
|
signal?.addEventListener('abort', abort, { once: true });
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
here();
|
|
99
|
-
else if (settled)
|
|
100
|
-
stopIt();
|
|
101
|
-
else
|
|
102
|
-
stop = stopIt;
|
|
103
|
-
}, here);
|
|
125
|
+
searches.push(one);
|
|
126
|
+
dispatch();
|
|
104
127
|
});
|
|
105
128
|
}
|
|
129
|
+
function nextJob() {
|
|
130
|
+
for (const search of searches) {
|
|
131
|
+
const block = search.take();
|
|
132
|
+
if (block !== undefined)
|
|
133
|
+
return { search, block };
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const blockOf = ({ search, block }) => ({
|
|
138
|
+
search: search.s,
|
|
139
|
+
from: block * BLOCK,
|
|
140
|
+
to: block * BLOCK + BLOCK - 1,
|
|
141
|
+
});
|
|
142
|
+
function deliver({ search, block }, a) {
|
|
143
|
+
if ('error' in a)
|
|
144
|
+
search.fail(new Error(a.error));
|
|
145
|
+
else
|
|
146
|
+
search.finish(block, a.burn);
|
|
147
|
+
}
|
|
148
|
+
/** Hands blocks to idle threads, starting the pool if it is not running. */
|
|
149
|
+
function dispatch() {
|
|
150
|
+
clearTimeout(idle);
|
|
151
|
+
if (here)
|
|
152
|
+
return void runHere();
|
|
153
|
+
if (!threads)
|
|
154
|
+
return void start();
|
|
155
|
+
for (const t of threads) {
|
|
156
|
+
if (t.job)
|
|
157
|
+
continue;
|
|
158
|
+
const job = nextJob();
|
|
159
|
+
if (!job)
|
|
160
|
+
break;
|
|
161
|
+
t.job = job;
|
|
162
|
+
t.busy(true);
|
|
163
|
+
t.send(blockOf(job));
|
|
164
|
+
}
|
|
165
|
+
if (!searches.length && threads.every((t) => !t.job)) {
|
|
166
|
+
idle = setTimeout(stop, IDLE_MS);
|
|
167
|
+
idle.unref?.(); // a process need not stay up for it
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function start() {
|
|
171
|
+
if (starting)
|
|
172
|
+
return;
|
|
173
|
+
starting = true;
|
|
174
|
+
const cores = globalThis.navigator?.hardwareConcurrency ?? 1;
|
|
175
|
+
// Node leaves a core to its event loop: a point of sale's server answers while it searches
|
|
176
|
+
const count = Math.max(1, Math.min(16, typeof Worker !== 'undefined' ? cores : cores - 1));
|
|
177
|
+
threads = await spawn(count).catch(() => []);
|
|
178
|
+
starting = false;
|
|
179
|
+
if (!threads.length) {
|
|
180
|
+
threads = null;
|
|
181
|
+
void runHere();
|
|
182
|
+
}
|
|
183
|
+
dispatch();
|
|
184
|
+
}
|
|
185
|
+
function stop() {
|
|
186
|
+
const stopped = threads ?? [];
|
|
187
|
+
threads = null;
|
|
188
|
+
for (const t of stopped)
|
|
189
|
+
t.stop();
|
|
190
|
+
}
|
|
191
|
+
function answered(t, a) {
|
|
192
|
+
t.answered = true;
|
|
193
|
+
const job = t.job;
|
|
194
|
+
t.job = null;
|
|
195
|
+
t.busy(false);
|
|
196
|
+
deliver(job, a);
|
|
197
|
+
dispatch();
|
|
198
|
+
}
|
|
199
|
+
function died(t) {
|
|
200
|
+
if (!threads?.includes(t))
|
|
201
|
+
return; // stopped, or already counted
|
|
202
|
+
threads = threads.filter((other) => other !== t);
|
|
203
|
+
if (t.job)
|
|
204
|
+
t.job.search.drop(t.job.block);
|
|
205
|
+
if (!t.answered) {
|
|
206
|
+
// it never ran: neither will the others
|
|
207
|
+
for (const other of threads)
|
|
208
|
+
if (other.job)
|
|
209
|
+
other.job.search.drop(other.job.block);
|
|
210
|
+
stop();
|
|
211
|
+
void runHere();
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
if (!threads.length)
|
|
215
|
+
threads = null; // started again on the next dispatch
|
|
216
|
+
dispatch();
|
|
217
|
+
}
|
|
218
|
+
/** Starts `count` workers; none where there are no workers. */
|
|
219
|
+
async function spawn(count) {
|
|
220
|
+
if (typeof Worker !== 'undefined') {
|
|
221
|
+
return Array.from({ length: count }, () => {
|
|
222
|
+
// this exact form is what bundlers (Vite, webpack) look for to emit the worker
|
|
223
|
+
const worker = new Worker(new URL('./burnWorker.js', import.meta.url), { type: 'module' });
|
|
224
|
+
const t = {
|
|
225
|
+
job: null,
|
|
226
|
+
answered: false,
|
|
227
|
+
send: (b) => worker.postMessage(b),
|
|
228
|
+
stop: () => worker.terminate(),
|
|
229
|
+
busy: () => { },
|
|
230
|
+
};
|
|
231
|
+
worker.onmessage = ({ data }) => answered(t, data);
|
|
232
|
+
worker.onerror = (e) => {
|
|
233
|
+
e.preventDefault();
|
|
234
|
+
died(t);
|
|
235
|
+
};
|
|
236
|
+
worker.onmessageerror = () => died(t);
|
|
237
|
+
return t;
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
// variables, so that bundlers for the browser leave Node's module and a second copy of the worker alone
|
|
241
|
+
const [threadsModule, file] = ['node:worker_threads', './burnWorker.js'];
|
|
242
|
+
const { Worker: ThreadWorker } = (await import(/* @vite-ignore */ threadsModule).catch(() => ({})));
|
|
243
|
+
if (!ThreadWorker)
|
|
244
|
+
return [];
|
|
245
|
+
return Array.from({ length: count }, () => {
|
|
246
|
+
const worker = new ThreadWorker(new URL(file, import.meta.url));
|
|
247
|
+
worker.unref();
|
|
248
|
+
const t = {
|
|
249
|
+
job: null,
|
|
250
|
+
answered: false,
|
|
251
|
+
send: (b) => worker.postMessage(b),
|
|
252
|
+
stop: () => void worker.terminate(),
|
|
253
|
+
busy: (working) => (working ? worker.ref() : worker.unref()),
|
|
254
|
+
};
|
|
255
|
+
worker.on('message', (a) => answered(t, a));
|
|
256
|
+
// run from source, as tests are, there is no burnWorker.js: the thread exits before it answers
|
|
257
|
+
for (const event of ['error', 'exit', 'messageerror'])
|
|
258
|
+
worker.on(event, () => died(t));
|
|
259
|
+
return t;
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
/** Runs the blocks on this thread, yielding to the event loop every ~100 ms, and no more often: each yield is a timer,
|
|
263
|
+
* which costs 4 ms in a visible tab and a whole second in a hidden one. */
|
|
264
|
+
async function runHere() {
|
|
265
|
+
if (!here) {
|
|
266
|
+
here = true;
|
|
267
|
+
console.warn('zerc20: burn addresses are searched on the main thread, slower: no worker starts here');
|
|
268
|
+
}
|
|
269
|
+
if (runningHere)
|
|
270
|
+
return;
|
|
271
|
+
runningHere = true;
|
|
272
|
+
let since = Date.now();
|
|
273
|
+
for (let job; (job = nextJob());) {
|
|
274
|
+
let a;
|
|
275
|
+
try {
|
|
276
|
+
a = { burn: runBlock(blockOf(job)) };
|
|
277
|
+
}
|
|
278
|
+
catch (e) {
|
|
279
|
+
a = { error: e instanceof Error ? e.message : String(e) };
|
|
280
|
+
}
|
|
281
|
+
deliver(job, a);
|
|
282
|
+
if (Date.now() - since >= 100) {
|
|
283
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
284
|
+
since = Date.now();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
runningHere = false;
|
|
288
|
+
}
|
|
106
289
|
//# sourceMappingURL=core.js.map
|
package/dist/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src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AM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;YACvD,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IACD,WAAW,GAAG,KAAK,CAAC;AACtB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { Chain, type Referrer, type Token, MAX_REFERRAL_BPS, NATIVE, UNWRAP_INTE
|
|
|
2
2
|
export { type ErrorCode, WalletError } from './errors.js';
|
|
3
3
|
export { type AttesterTrust, type ChainConfig, type Circuit, type Network, NITRO_ROOT_SHA256, checkNetwork, networkFromJson, } from './network.js';
|
|
4
4
|
export { type Payment, PointOfSale, type PosToken, type Sale, type SaleStatus } from './pos.js';
|
|
5
|
-
export { seedFromSignature } from './seed.js';
|
|
5
|
+
export { accountKey, seedFromSignature } from './seed.js';
|
|
6
6
|
export { type Activity, type Balance, type CoinInfo, type CoinState, type DepositInfo, type DepositStep, type FeeQuote, type OpenOptions, type Operation, type OperationKind, type OperationStatus, type PendingReason, Wallet, } from './wallet.js';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,6 @@ export { Chain, MAX_REFERRAL_BPS, NATIVE, UNWRAP_INTENT } from './chain.js';
|
|
|
14
14
|
export { WalletError } from './errors.js';
|
|
15
15
|
export { NITRO_ROOT_SHA256, checkNetwork, networkFromJson, } from './network.js';
|
|
16
16
|
export { PointOfSale } from './pos.js';
|
|
17
|
-
export { seedFromSignature } from './seed.js';
|
|
17
|
+
export { accountKey, seedFromSignature } from './seed.js';
|
|
18
18
|
export { Wallet, } from './wallet.js';
|
|
19
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAC3E,uFAAuF;AACvF,4DAA4D;AAC5D,kEAAkE;AAClE,mFAAmF;AACnF,EAAE;AACF,uHAAuH;AACvH,qHAAqH;AACrH,8CAA8C;AAE9C,OAAO,EAAE,KAAK,EAA6B,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACvG,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAKL,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAgB,WAAW,EAA6C,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,EAAE;AACF,gFAAgF;AAChF,2EAA2E;AAC3E,uFAAuF;AACvF,4DAA4D;AAC5D,kEAAkE;AAClE,mFAAmF;AACnF,EAAE;AACF,uHAAuH;AACvH,qHAAqH;AACrH,8CAA8C;AAE9C,OAAO,EAAE,KAAK,EAA6B,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACvG,OAAO,EAAkB,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAKL,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAgB,WAAW,EAA6C,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC1D,OAAO,EAaL,MAAM,GACP,MAAM,aAAa,CAAC"}
|