zklicensing 0.1.0-beta.2 → 0.1.0-beta.21
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 +417 -201
- package/build/agent.d.ts +371 -0
- package/build/agent.d.ts.map +1 -0
- package/build/agent.js +553 -0
- package/build/agent.js.map +1 -0
- package/build/agentActions.d.ts +841 -0
- package/build/agentActions.d.ts.map +1 -0
- package/build/agentActions.js +581 -0
- package/build/agentActions.js.map +1 -0
- package/build/agentRecord.d.ts +83 -0
- package/build/agentRecord.d.ts.map +1 -0
- package/build/agentRecord.js +69 -0
- package/build/agentRecord.js.map +1 -0
- package/build/agentVendor.d.ts +220 -0
- package/build/agentVendor.d.ts.map +1 -0
- package/build/agentVendor.js +306 -0
- package/build/agentVendor.js.map +1 -0
- package/build/appsLookup.d.ts +14 -0
- package/build/appsLookup.d.ts.map +1 -0
- package/build/appsLookup.js +12 -0
- package/build/appsLookup.js.map +1 -0
- package/build/archiveBootstrap.d.ts +31 -5
- package/build/archiveBootstrap.d.ts.map +1 -0
- package/build/archiveBootstrap.js +140 -47
- package/build/archiveBootstrap.js.map +1 -0
- package/build/atomicJson.d.ts +5 -0
- package/build/atomicJson.d.ts.map +1 -0
- package/build/atomicJson.js +55 -0
- package/build/atomicJson.js.map +1 -0
- package/build/bindClient.d.ts +85 -0
- package/build/bindClient.d.ts.map +1 -0
- package/build/bindClient.js +187 -0
- package/build/bindClient.js.map +1 -0
- package/build/buyClient.d.ts +27 -4
- package/build/buyClient.d.ts.map +1 -0
- package/build/buyClient.js +72 -26
- package/build/buyClient.js.map +1 -0
- package/build/chainHead.d.ts +61 -0
- package/build/chainHead.d.ts.map +1 -0
- package/build/chainHead.js +88 -0
- package/build/chainHead.js.map +1 -0
- package/build/compactMerkleMap.d.ts +72 -0
- package/build/compactMerkleMap.d.ts.map +1 -0
- package/build/compactMerkleMap.js +224 -0
- package/build/compactMerkleMap.js.map +1 -0
- package/build/contractInterface.d.ts +191 -51
- package/build/contractInterface.d.ts.map +1 -0
- package/build/contractInterface.js +234 -43
- package/build/contractInterface.js.map +1 -0
- package/build/contractTypes.d.ts +9 -0
- package/build/contractTypes.d.ts.map +1 -0
- package/build/contractTypes.js +28 -0
- package/build/contractTypes.js.map +1 -0
- package/build/countryStats.d.ts +12 -3
- package/build/countryStats.d.ts.map +1 -0
- package/build/countryStats.js +87 -23
- package/build/countryStats.js.map +1 -0
- package/build/deployClient.d.ts +138 -24
- package/build/deployClient.d.ts.map +1 -0
- package/build/deployClient.js +91 -31
- package/build/deployClient.js.map +1 -0
- package/build/deviceIdentity.d.ts +68 -0
- package/build/deviceIdentity.d.ts.map +1 -0
- package/build/deviceIdentity.js +209 -0
- package/build/deviceIdentity.js.map +1 -0
- package/build/freezeClient.d.ts +26 -6
- package/build/freezeClient.d.ts.map +1 -0
- package/build/freezeClient.js +30 -6
- package/build/freezeClient.js.map +1 -0
- package/build/generationClient.d.ts +6 -3
- package/build/generationClient.d.ts.map +1 -0
- package/build/generationClient.js +25 -38
- package/build/generationClient.js.map +1 -0
- package/build/holderSecret.d.ts +70 -0
- package/build/holderSecret.d.ts.map +1 -0
- package/build/holderSecret.js +76 -0
- package/build/holderSecret.js.map +1 -0
- package/build/index.d.ts +38 -38
- package/build/index.d.ts.map +1 -0
- package/build/index.js +97 -121
- package/build/index.js.map +1 -0
- package/build/keysClient.d.ts +142 -0
- package/build/keysClient.d.ts.map +1 -0
- package/build/keysClient.js +109 -0
- package/build/keysClient.js.map +1 -0
- package/build/licenseLeaf.d.ts +76 -0
- package/build/licenseLeaf.d.ts.map +1 -0
- package/build/licenseLeaf.js +189 -0
- package/build/licenseLeaf.js.map +1 -0
- package/build/licenseRecord.d.ts +68 -5
- package/build/licenseRecord.d.ts.map +1 -0
- package/build/licenseRecord.js +26 -1
- package/build/licenseRecord.js.map +1 -0
- package/build/licenseStore.d.ts +81 -4
- package/build/licenseStore.d.ts.map +1 -0
- package/build/licenseStore.js +400 -30
- package/build/licenseStore.js.map +1 -0
- package/build/licenseTrustless.d.ts +43 -0
- package/build/licenseTrustless.d.ts.map +1 -0
- package/build/licenseTrustless.js +180 -0
- package/build/licenseTrustless.js.map +1 -0
- package/build/manifestVerify.d.ts +29 -1
- package/build/manifestVerify.d.ts.map +1 -0
- package/build/manifestVerify.js +46 -4
- package/build/manifestVerify.js.map +1 -0
- package/build/minaPriceHistory.d.ts +9 -0
- package/build/minaPriceHistory.d.ts.map +1 -0
- package/build/minaPriceHistory.js +152 -0
- package/build/minaPriceHistory.js.map +1 -0
- package/build/onChainRoot.d.ts +60 -0
- package/build/onChainRoot.d.ts.map +1 -0
- package/build/onChainRoot.js +74 -0
- package/build/onChainRoot.js.map +1 -0
- package/build/ownershipLicenseHash.d.ts +25 -0
- package/build/ownershipLicenseHash.d.ts.map +1 -0
- package/build/ownershipLicenseHash.js +29 -0
- package/build/ownershipLicenseHash.js.map +1 -0
- package/build/ownershipSignature.d.ts +153 -0
- package/build/ownershipSignature.d.ts.map +1 -0
- package/build/ownershipSignature.js +297 -0
- package/build/ownershipSignature.js.map +1 -0
- package/build/permitCheckFlow.d.ts +155 -0
- package/build/permitCheckFlow.d.ts.map +1 -0
- package/build/permitCheckFlow.js +196 -0
- package/build/permitCheckFlow.js.map +1 -0
- package/build/permitDescribe.d.ts +124 -0
- package/build/permitDescribe.d.ts.map +1 -0
- package/build/permitDescribe.js +324 -0
- package/build/permitDescribe.js.map +1 -0
- package/build/permitInterface.d.ts +85 -0
- package/build/permitInterface.d.ts.map +1 -0
- package/build/permitInterface.js +121 -0
- package/build/permitInterface.js.map +1 -0
- package/build/permitMessages.d.ts +313 -0
- package/build/permitMessages.d.ts.map +1 -0
- package/build/permitMessages.js +462 -0
- package/build/permitMessages.js.map +1 -0
- package/build/permitProof.d.ts +108 -0
- package/build/permitProof.d.ts.map +1 -0
- package/build/permitProof.js +202 -0
- package/build/permitProof.js.map +1 -0
- package/build/permitRegistryRebuild.d.ts +166 -0
- package/build/permitRegistryRebuild.d.ts.map +1 -0
- package/build/permitRegistryRebuild.js +347 -0
- package/build/permitRegistryRebuild.js.map +1 -0
- package/build/permitTree.d.ts +88 -0
- package/build/permitTree.d.ts.map +1 -0
- package/build/permitTree.js +230 -0
- package/build/permitTree.js.map +1 -0
- package/build/permitsClient.d.ts +680 -0
- package/build/permitsClient.d.ts.map +1 -0
- package/build/permitsClient.js +597 -0
- package/build/permitsClient.js.map +1 -0
- package/build/proveErrors.d.ts +50 -0
- package/build/proveErrors.d.ts.map +1 -0
- package/build/proveErrors.js +76 -0
- package/build/proveErrors.js.map +1 -0
- package/build/receipt.d.ts +95 -0
- package/build/receipt.d.ts.map +1 -0
- package/build/receipt.js +84 -0
- package/build/receipt.js.map +1 -0
- package/build/refundClient.d.ts +7 -12
- package/build/refundClient.d.ts.map +1 -0
- package/build/refundClient.js +52 -21
- package/build/refundClient.js.map +1 -0
- package/build/registryTrustVerify.d.ts +78 -0
- package/build/registryTrustVerify.d.ts.map +1 -0
- package/build/registryTrustVerify.js +129 -0
- package/build/registryTrustVerify.js.map +1 -0
- package/build/releaseClient.d.ts +26 -0
- package/build/releaseClient.d.ts.map +1 -0
- package/build/releaseClient.js +65 -0
- package/build/releaseClient.js.map +1 -0
- package/build/renewClient.d.ts +28 -2
- package/build/renewClient.d.ts.map +1 -0
- package/build/renewClient.js +31 -27
- package/build/renewClient.js.map +1 -0
- package/build/seatName.d.ts +8 -0
- package/build/seatName.d.ts.map +1 -0
- package/build/seatName.js +136 -0
- package/build/seatName.js.map +1 -0
- package/build/slotConstants.d.ts +15 -0
- package/build/slotConstants.d.ts.map +1 -0
- package/build/slotConstants.js +17 -0
- package/build/slotConstants.js.map +1 -0
- package/build/statsClient.d.ts +61 -7
- package/build/statsClient.d.ts.map +1 -0
- package/build/statsClient.js +44 -5
- package/build/statsClient.js.map +1 -0
- package/build/successorChain.d.ts +35 -0
- package/build/successorChain.d.ts.map +1 -0
- package/build/successorChain.js +69 -0
- package/build/successorChain.js.map +1 -0
- package/build/taxId.d.ts +44 -0
- package/build/taxId.d.ts.map +1 -0
- package/build/taxId.js +212 -0
- package/build/taxId.js.map +1 -0
- package/build/trustAnchorVerify.d.ts +49 -0
- package/build/trustAnchorVerify.d.ts.map +1 -0
- package/build/trustAnchorVerify.js +432 -0
- package/build/trustAnchorVerify.js.map +1 -0
- package/build/trustAnchorVerifyCli.d.ts +45 -0
- package/build/trustAnchorVerifyCli.d.ts.map +1 -0
- package/build/trustAnchorVerifyCli.js +235 -0
- package/build/trustAnchorVerifyCli.js.map +1 -0
- package/build/txBroadcastClient.d.ts +26 -0
- package/build/txBroadcastClient.d.ts.map +1 -0
- package/build/txBroadcastClient.js +20 -0
- package/build/txBroadcastClient.js.map +1 -0
- package/build/unbindClient.d.ts +77 -0
- package/build/unbindClient.d.ts.map +1 -0
- package/build/unbindClient.js +169 -0
- package/build/unbindClient.js.map +1 -0
- package/build/units.d.ts +28 -0
- package/build/units.d.ts.map +1 -0
- package/build/units.js +65 -0
- package/build/units.js.map +1 -0
- package/build/vatRates.d.ts +54 -0
- package/build/vatRates.d.ts.map +1 -0
- package/build/vatRates.js +82 -0
- package/build/vatRates.js.map +1 -0
- package/build/vatRatesData.d.ts +5 -0
- package/build/vatRatesData.d.ts.map +1 -0
- package/build/vatRatesData.js +42 -0
- package/build/vatRatesData.js.map +1 -0
- package/build/vendorAccountClient.d.ts +66 -0
- package/build/vendorAccountClient.d.ts.map +1 -0
- package/build/vendorAccountClient.js +47 -0
- package/build/vendorAccountClient.js.map +1 -0
- package/build/verifyCore.d.ts +4 -1
- package/build/verifyCore.d.ts.map +1 -0
- package/build/verifyCore.js +21 -10
- package/build/verifyCore.js.map +1 -0
- package/build/verifyOffline.d.ts +85 -0
- package/build/verifyOffline.d.ts.map +1 -0
- package/build/verifyOffline.js +139 -0
- package/build/verifyOffline.js.map +1 -0
- package/build/verifyService.d.ts.map +1 -0
- package/build/verifyService.js +571 -501
- package/build/verifyService.js.map +1 -0
- package/build/verifyWithAncestors.d.ts +19 -0
- package/build/verifyWithAncestors.d.ts.map +1 -0
- package/build/verifyWithAncestors.js +127 -0
- package/build/verifyWithAncestors.js.map +1 -0
- package/build/zipToState.d.ts +2 -0
- package/build/zipToState.d.ts.map +1 -0
- package/build/zipToState.js +94 -0
- package/build/zipToState.js.map +1 -0
- package/package.json +141 -16
- package/src/agent.ts +682 -0
- package/src/agentActions.ts +637 -0
- package/src/agentRecord.ts +121 -0
- package/src/agentVendor.ts +356 -0
- package/src/appsLookup.ts +48 -0
- package/src/archiveBootstrap.ts +386 -0
- package/src/atomicJson.ts +53 -0
- package/src/bindClient.ts +297 -0
- package/src/buyClient.ts +344 -0
- package/src/chainHead.ts +106 -0
- package/src/compactMerkleMap.ts +222 -0
- package/src/contractInterface.ts +465 -0
- package/src/contractTypes.ts +31 -0
- package/src/countryStats.ts +200 -0
- package/src/deployClient.ts +517 -0
- package/src/deviceIdentity.ts +249 -0
- package/src/freezeClient.ts +162 -0
- package/src/generationClient.ts +145 -0
- package/src/holderSecret.ts +91 -0
- package/src/index.ts +362 -0
- package/src/keysClient.ts +135 -0
- package/src/licenseLeaf.ts +221 -0
- package/src/licenseRecord.ts +190 -0
- package/src/licenseStore.ts +767 -0
- package/src/licenseTrustless.ts +207 -0
- package/src/manifestVerify.ts +164 -0
- package/src/minaPriceHistory.ts +166 -0
- package/src/onChainRoot.ts +90 -0
- package/src/ownershipLicenseHash.ts +31 -0
- package/src/ownershipSignature.ts +421 -0
- package/src/permitCheckFlow.ts +227 -0
- package/src/permitDescribe.ts +362 -0
- package/src/permitInterface.ts +146 -0
- package/src/permitMessages.ts +572 -0
- package/src/permitProof.ts +230 -0
- package/src/permitRegistryRebuild.ts +423 -0
- package/src/permitTree.ts +232 -0
- package/src/permitsClient.ts +746 -0
- package/src/proveErrors.ts +98 -0
- package/src/receipt.ts +156 -0
- package/src/refundClient.ts +177 -0
- package/src/registryTrustVerify.ts +192 -0
- package/src/releaseClient.ts +101 -0
- package/src/renewClient.ts +234 -0
- package/src/seatName.ts +165 -0
- package/src/slotConstants.ts +18 -0
- package/src/statsClient.ts +249 -0
- package/src/successorChain.ts +87 -0
- package/src/taxId.ts +227 -0
- package/src/trustAnchorVerify.ts +550 -0
- package/src/trustAnchorVerifyCli.ts +234 -0
- package/src/txBroadcastClient.ts +48 -0
- package/src/unbindClient.ts +233 -0
- package/src/units.ts +74 -0
- package/src/vatRates.ts +100 -0
- package/src/vatRatesData.ts +43 -0
- package/src/vendorAccountClient.ts +120 -0
- package/src/verifyCore.ts +100 -0
- package/src/verifyOffline.ts +212 -0
- package/src/verifyService.ts +982 -0
- package/src/verifyWithAncestors.ts +163 -0
- package/src/zipToState.ts +94 -0
- package/build/licenseProof.d.ts +0 -26
- package/build/licenseProof.js +0 -41
- package/build/migrateClient.d.ts +0 -43
- package/build/migrateClient.js +0 -47
- package/build/ownership.d.ts +0 -34
- package/build/ownership.js +0 -147
package/build/countryStats.js
CHANGED
|
@@ -1,16 +1,43 @@
|
|
|
1
1
|
// Copyright (c) 2025-2026 zkLicensing project developers
|
|
2
|
-
//
|
|
2
|
+
// SPDX-License-Identifier: BUSL-1.1
|
|
3
|
+
/**
|
|
4
|
+
* countryStats.ts
|
|
5
|
+
*
|
|
6
|
+
* Buyer-country breakdown of a vendor's revenue, bucketed by UTC calendar year.
|
|
7
|
+
* Structured for tax reporting: one row per (year, appId, countryCode) with
|
|
8
|
+
* license count + the vendor's cut in MINA. Both the backend (source of
|
|
9
|
+
* truth for /stats) and the dashboard UI import from here so the numbers can
|
|
10
|
+
* never drift between them.
|
|
11
|
+
*
|
|
12
|
+
* Purchases attribute to the year the buyer confirmed on-chain (LicenseRecord
|
|
13
|
+
* `createdAt` ISO timestamp). Legacy records that predate `createdAt` fall
|
|
14
|
+
* back to slot-derived time. Renewals attribute to the renewal year via
|
|
15
|
+
* `renewals[i].slot → time`. Refunded purchases contribute zero revenue but
|
|
16
|
+
* still count the license (a purchase happened even if the money was
|
|
17
|
+
* returned) — remove `count` from refunded rows client-side if you want a
|
|
18
|
+
* strictly net view.
|
|
19
|
+
*
|
|
20
|
+
* Browser-safe: pure computation, no fs, no fetch.
|
|
21
|
+
*/
|
|
22
|
+
import { vendorShareNano } from './licenseRecord.js';
|
|
23
|
+
import { standardVatRate, vatIncludedNano } from './vatRates.js';
|
|
24
|
+
import { zipToState } from './zipToState.js';
|
|
25
|
+
export { zipToState } from './zipToState.js';
|
|
3
26
|
// LicensingApp charges a 2 % platform fee (200 basis points); the vendor
|
|
4
27
|
// receives the remaining 9 800 bps. Keep this in sync with the on-chain
|
|
5
28
|
// constant in LicensingApp.
|
|
6
|
-
const PLATFORM_FEE_BASIS_POINTS = 200n;
|
|
7
|
-
const VENDOR_BPS = 10000n - PLATFORM_FEE_BASIS_POINTS;
|
|
8
29
|
// 90 s/slot post-Mesa. Used only for slot→time fallback attribution.
|
|
9
30
|
const SLOT_DURATION_MS = 90_000;
|
|
10
|
-
|
|
31
|
+
// tzOffsetMinutes: signed minutes east of UTC (e.g. +60 for CET, -480 for PST).
|
|
32
|
+
// Purchase/renewal timestamps are shifted by this offset before extracting the
|
|
33
|
+
// calendar year, so the "tax year" cut-over aligns with the operator's local
|
|
34
|
+
// clock instead of hardcoded UTC. Defaults to 0 (UTC) for callers who don't
|
|
35
|
+
// pass it — preserves the pre-tz behavior.
|
|
36
|
+
export function computeCountryBreakdown(apps, records, currentSlot, nowMs, tzOffsetMinutes = 0) {
|
|
11
37
|
const appByAddress = new Map(apps.map(a => [a.zkAppAddress, a.appId]));
|
|
12
38
|
const byYear = {};
|
|
13
39
|
const yearSet = new Set();
|
|
40
|
+
const tzShiftMs = tzOffsetMinutes * 60_000;
|
|
14
41
|
const ensureYear = (year) => {
|
|
15
42
|
let yb = byYear[year];
|
|
16
43
|
if (!yb) {
|
|
@@ -28,20 +55,51 @@ export function computeCountryBreakdown(apps, records, currentSlot, nowMs) {
|
|
|
28
55
|
}
|
|
29
56
|
return ab;
|
|
30
57
|
};
|
|
31
|
-
const add = (bucket, code, count, revenueNano) => {
|
|
58
|
+
const add = (bucket, code, count, revenueNano, grossNano, saleMs, state) => {
|
|
32
59
|
let b = bucket[code];
|
|
33
60
|
if (!b) {
|
|
34
|
-
b = { count: 0, revenueMina: 0 };
|
|
61
|
+
b = { count: 0, revenueMina: 0, grossMina: 0 };
|
|
35
62
|
bucket[code] = b;
|
|
36
63
|
}
|
|
37
64
|
b.count += count;
|
|
38
65
|
b.revenueMina += Number(revenueNano) / 1e9;
|
|
66
|
+
b.grossMina += Number(grossNano) / 1e9;
|
|
67
|
+
// VAT included at the rate in force on the sale date.
|
|
68
|
+
const rate = code !== '??' && saleMs !== null ? standardVatRate(code, saleMs) : null;
|
|
69
|
+
if (rate !== null) {
|
|
70
|
+
b.estimatedVatMina = (b.estimatedVatMina ?? 0) + Number(vatIncludedNano(grossNano, rate).vatNano) / 1e9;
|
|
71
|
+
if (grossNano > 0n) {
|
|
72
|
+
const rates = (b.vatRates ??= []);
|
|
73
|
+
if (!rates.includes(rate)) {
|
|
74
|
+
rates.push(rate);
|
|
75
|
+
rates.sort((x, y) => x - y);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// State sub-bucket only for US rows whose ZIP resolved to a state.
|
|
80
|
+
// Non-US or unresolvable rows just add to the country total.
|
|
81
|
+
if (code === 'US' && state) {
|
|
82
|
+
const states = b.states ?? (b.states = {});
|
|
83
|
+
let sb = states[state];
|
|
84
|
+
if (!sb) {
|
|
85
|
+
sb = { count: 0, revenueMina: 0, grossMina: 0 };
|
|
86
|
+
states[state] = sb;
|
|
87
|
+
}
|
|
88
|
+
sb.count += count;
|
|
89
|
+
sb.revenueMina += Number(revenueNano) / 1e9;
|
|
90
|
+
sb.grossMina += Number(grossNano) / 1e9;
|
|
91
|
+
}
|
|
39
92
|
};
|
|
40
|
-
const
|
|
93
|
+
const slotToMs = (slot) => {
|
|
41
94
|
if (currentSlot <= 0)
|
|
42
95
|
return null;
|
|
43
96
|
const ms = nowMs - (currentSlot - slot) * SLOT_DURATION_MS;
|
|
44
|
-
|
|
97
|
+
return Number.isFinite(ms) ? ms : null;
|
|
98
|
+
};
|
|
99
|
+
const msToYear = (ms) => {
|
|
100
|
+
if (ms === null)
|
|
101
|
+
return null;
|
|
102
|
+
const y = new Date(ms + tzShiftMs).getUTCFullYear();
|
|
45
103
|
return Number.isFinite(y) ? y : null;
|
|
46
104
|
};
|
|
47
105
|
for (const r of records) {
|
|
@@ -49,36 +107,42 @@ export function computeCountryBreakdown(apps, records, currentSlot, nowMs) {
|
|
|
49
107
|
if (!appId)
|
|
50
108
|
continue;
|
|
51
109
|
const country = r.buyerCountry && /^[A-Z]{2}$/.test(r.buyerCountry) ? r.buyerCountry : '??';
|
|
110
|
+
// Only US rows carry a meaningful ZIP for sales-tax purposes; derive
|
|
111
|
+
// the state jurisdiction here and let `add` roll it up. Non-US ZIPs
|
|
112
|
+
// and unresolvable prefixes fall through to country-total only.
|
|
113
|
+
const state = country === 'US' && r.buyerZip ? zipToState(r.buyerZip) : undefined;
|
|
52
114
|
// Purchase — attribute to the year of confirm-on-chain (createdAt).
|
|
53
115
|
// Fallback: slot-derived time for legacy records that lack createdAt.
|
|
54
|
-
let
|
|
116
|
+
let purchaseMs = null;
|
|
55
117
|
if (r.createdAt) {
|
|
56
|
-
const
|
|
57
|
-
if (Number.isFinite(
|
|
58
|
-
|
|
118
|
+
const t = new Date(r.createdAt).getTime();
|
|
119
|
+
if (Number.isFinite(t))
|
|
120
|
+
purchaseMs = t;
|
|
59
121
|
}
|
|
60
|
-
if (
|
|
61
|
-
|
|
122
|
+
if (purchaseMs === null && r.purchaseSlot > 0) {
|
|
123
|
+
purchaseMs = slotToMs(r.purchaseSlot);
|
|
62
124
|
}
|
|
125
|
+
const purchaseYear = msToYear(purchaseMs);
|
|
63
126
|
if (purchaseYear !== null) {
|
|
64
127
|
const yb = ensureYear(purchaseYear);
|
|
65
128
|
const ab = ensureAppBucket(yb, appId);
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
add(
|
|
70
|
-
add(yb.aggregate, country, 1, purchaseCut);
|
|
129
|
+
const purchaseGross = (!r.refunded && r.purchaseAmount && r.purchaseAmount !== '0') ? BigInt(r.purchaseAmount) : 0n;
|
|
130
|
+
const purchaseCut = purchaseGross > 0n ? vendorShareNano(purchaseGross) : 0n;
|
|
131
|
+
add(ab, country, 1, purchaseCut, purchaseGross, purchaseMs, state);
|
|
132
|
+
add(yb.aggregate, country, 1, purchaseCut, purchaseGross, purchaseMs, state);
|
|
71
133
|
}
|
|
72
134
|
// Renewals — revenue only (no license count), attributed to renewal year.
|
|
73
135
|
for (const rn of r.renewals ?? []) {
|
|
74
|
-
const
|
|
136
|
+
const ms = slotToMs(rn.slot);
|
|
137
|
+
const y = msToYear(ms);
|
|
75
138
|
if (y === null)
|
|
76
139
|
continue;
|
|
77
140
|
const yb = ensureYear(y);
|
|
78
141
|
const ab = ensureAppBucket(yb, appId);
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
add(
|
|
142
|
+
const gross = BigInt(rn.amount);
|
|
143
|
+
const cut = vendorShareNano(gross);
|
|
144
|
+
add(ab, country, 0, cut, gross, ms, state);
|
|
145
|
+
add(yb.aggregate, country, 0, cut, gross, ms, state);
|
|
82
146
|
}
|
|
83
147
|
}
|
|
84
148
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"countryStats.js","sourceRoot":"","sources":["../src/countryStats.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,oCAAoC;AAEpC;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,eAAe,EAAsB,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,yEAAyE;AACzE,wEAAwE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YAC3C,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,OAAO;QACL,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QAChD,MAAM;KACP,CAAC;AACJ,CAAC"}
|
package/build/deployClient.d.ts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* deployClient.ts
|
|
3
3
|
*
|
|
4
4
|
* Browser-safe client for the deploy flow. Mirrors the buy / renew / refund
|
|
5
|
-
* client shape: `proveDeploy` posts to the
|
|
5
|
+
* client shape: `proveDeploy` posts to the backend's `/prove/deploy` endpoint
|
|
6
6
|
* and returns the atomic deploy+initialize tx already signed with the
|
|
7
7
|
* throwaway zkApp key. The vendor's wallet then adds the fee-payer signature
|
|
8
8
|
* and broadcasts.
|
|
9
9
|
*
|
|
10
10
|
* The atomic bundling is what makes single-shot initialization safe:
|
|
11
11
|
* `provenTxJson` holds both `zkApp.deploy()` and `zkApp.initialize()`
|
|
12
|
-
* AccountUpdates in the same transaction, and the
|
|
12
|
+
* AccountUpdates in the same transaction, and the backend generates a
|
|
13
13
|
* throwaway zkApp keypair per request that is discarded before the tx is
|
|
14
14
|
* returned — so the target address is not observable to an attacker until
|
|
15
15
|
* the initialize AU inside is already signed and locked to `(vendor,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* precondition on `initialize()`, this yields a one-shot init per account.
|
|
18
18
|
*
|
|
19
19
|
* Also exports admin-side `redeployApp` / `redeployAll` for the platform
|
|
20
|
-
* operator to trigger post-hardfork v1→v2 migrations via the
|
|
20
|
+
* operator to trigger post-hardfork v1→v2 migrations via the backend's
|
|
21
21
|
* `/admin/redeploy*` endpoints (bearer-token auth).
|
|
22
22
|
*/
|
|
23
23
|
export type ProveDeployRequest = {
|
|
@@ -27,6 +27,12 @@ export type ProveDeployRequest = {
|
|
|
27
27
|
priceMonthlyMina: number;
|
|
28
28
|
priceYearlyMina: number;
|
|
29
29
|
priceFiveYearMina: number;
|
|
30
|
+
pricePerpetualMina: number;
|
|
31
|
+
deviceCap: number;
|
|
32
|
+
forkActivationSlot?: number;
|
|
33
|
+
network?: 'devnet' | 'mainnet';
|
|
34
|
+
website?: string;
|
|
35
|
+
payoutAddress?: string;
|
|
30
36
|
fetcher?: typeof fetch;
|
|
31
37
|
signal?: AbortSignal;
|
|
32
38
|
};
|
|
@@ -35,9 +41,15 @@ export type ProveDeployResponse = {
|
|
|
35
41
|
verificationKeyHash: string;
|
|
36
42
|
zkAppAddress: string;
|
|
37
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* The keeper's deploy watch (GET /deploy/status): `landed` once the zkApp
|
|
46
|
+
* account is on chain, `timeout` if the watch gave up waiting, `unknown` for
|
|
47
|
+
* an address it isn't watching.
|
|
48
|
+
*/
|
|
38
49
|
export type DeployStatus = {
|
|
39
|
-
status: 'unknown' | 'pending' | '
|
|
50
|
+
status: 'unknown' | 'pending' | 'landed' | 'timeout';
|
|
40
51
|
landedAtSlot?: number;
|
|
52
|
+
landedAtBlockHeight?: number;
|
|
41
53
|
elapsedMs?: number;
|
|
42
54
|
};
|
|
43
55
|
export declare function proveDeploy(req: ProveDeployRequest): Promise<ProveDeployResponse>;
|
|
@@ -55,37 +67,60 @@ export type RedeployAppRequest = {
|
|
|
55
67
|
keeperUrl: string;
|
|
56
68
|
appId: string;
|
|
57
69
|
adminToken: string;
|
|
70
|
+
network?: 'devnet' | 'mainnet';
|
|
71
|
+
retireSignature?: string;
|
|
72
|
+
feePayer?: string;
|
|
58
73
|
force?: boolean;
|
|
59
74
|
fetcher?: typeof fetch;
|
|
60
75
|
signal?: AbortSignal;
|
|
61
76
|
};
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
/**
|
|
78
|
+
* A proved redeploy step for the signer's wallet to sign, send and pay
|
|
79
|
+
* (vendor or admin wallet); then register its hash with `redeployId`.
|
|
80
|
+
*/
|
|
81
|
+
export type RedeployTx = {
|
|
82
|
+
step: 'retire';
|
|
83
|
+
provenTxJson: string;
|
|
84
|
+
redeployId: string;
|
|
85
|
+
retiredAddress: string;
|
|
86
|
+
successor: string;
|
|
87
|
+
} | {
|
|
88
|
+
step: 'retireAndDeploy' | 'deploy';
|
|
89
|
+
provenTxJson: string;
|
|
90
|
+
redeployId: string;
|
|
91
|
+
retiredAddress: string;
|
|
64
92
|
zkAppAddress: string;
|
|
65
|
-
txHash: string;
|
|
66
93
|
verificationKeyHash: string;
|
|
67
|
-
onChainVersion: number;
|
|
68
|
-
forcedEscrowNonEmpty?: true;
|
|
69
94
|
};
|
|
95
|
+
/** The step a redeploy call took. */
|
|
96
|
+
export type RedeployStepResult = {
|
|
97
|
+
step: 'sign-retire';
|
|
98
|
+
retireMessage: string[];
|
|
99
|
+
licensesRoot: string;
|
|
100
|
+
successor: string;
|
|
101
|
+
then: 'retire' | 'retireAndDeploy' | 'deploy';
|
|
102
|
+
force: boolean;
|
|
103
|
+
} | RedeployTx;
|
|
104
|
+
export type RedeployAppResponse = {
|
|
105
|
+
ok: true;
|
|
106
|
+
} & RedeployStepResult;
|
|
70
107
|
export type RedeployAllRequest = {
|
|
71
108
|
keeperUrl: string;
|
|
72
109
|
adminToken: string;
|
|
73
|
-
|
|
110
|
+
network?: 'devnet' | 'mainnet';
|
|
74
111
|
fetcher?: typeof fetch;
|
|
75
112
|
signal?: AbortSignal;
|
|
76
113
|
};
|
|
77
114
|
export type RedeployAllResponse = {
|
|
78
115
|
ok: true;
|
|
79
116
|
count: number;
|
|
80
|
-
|
|
117
|
+
/** Apps whose retirement gate is up, ready for their next step. */
|
|
118
|
+
ready: number;
|
|
81
119
|
results: Array<{
|
|
82
120
|
appId: string;
|
|
83
121
|
ok: true;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
verificationKeyHash: string;
|
|
87
|
-
onChainVersion: number;
|
|
88
|
-
forcedEscrowNonEmpty?: true;
|
|
122
|
+
step: 'retire' | 'retireAndDeploy' | 'deploy';
|
|
123
|
+
readyAt: number;
|
|
89
124
|
} | {
|
|
90
125
|
appId: string;
|
|
91
126
|
ok: false;
|
|
@@ -93,6 +128,18 @@ export type RedeployAllResponse = {
|
|
|
93
128
|
}>;
|
|
94
129
|
};
|
|
95
130
|
export declare function redeployApp(req: RedeployAppRequest): Promise<RedeployAppResponse>;
|
|
131
|
+
export declare function registerAdminRedeploy(req: {
|
|
132
|
+
keeperUrl: string;
|
|
133
|
+
appId: string;
|
|
134
|
+
adminToken: string;
|
|
135
|
+
redeployId: string;
|
|
136
|
+
txHash: string;
|
|
137
|
+
fetcher?: typeof fetch;
|
|
138
|
+
signal?: AbortSignal;
|
|
139
|
+
}): Promise<{
|
|
140
|
+
ok: true;
|
|
141
|
+
step: 'retire' | 'deploy';
|
|
142
|
+
}>;
|
|
96
143
|
export declare function redeployAll(req: RedeployAllRequest): Promise<RedeployAllResponse>;
|
|
97
144
|
export type VendorRedeployPreflight = {
|
|
98
145
|
ok: boolean;
|
|
@@ -115,11 +162,22 @@ export type VendorRedeployPreflight = {
|
|
|
115
162
|
supported: boolean;
|
|
116
163
|
supportedList: readonly number[];
|
|
117
164
|
};
|
|
165
|
+
alreadyCurrent: boolean;
|
|
166
|
+
retired: boolean;
|
|
167
|
+
draining: {
|
|
168
|
+
startedAt: string;
|
|
169
|
+
} | null;
|
|
170
|
+
step: 'retire' | 'retireAndDeploy' | 'deploy' | null;
|
|
171
|
+
retirement: {
|
|
172
|
+
readyAt: number;
|
|
173
|
+
expiresAt: number;
|
|
174
|
+
} | null;
|
|
118
175
|
reasons: string[];
|
|
119
176
|
};
|
|
120
177
|
export declare function fetchVendorRedeployPreflight(opts: {
|
|
121
178
|
keeperUrl: string;
|
|
122
179
|
appId: string;
|
|
180
|
+
network: 'devnet' | 'mainnet';
|
|
123
181
|
fetcher?: typeof fetch;
|
|
124
182
|
signal?: AbortSignal;
|
|
125
183
|
}): Promise<VendorRedeployPreflight>;
|
|
@@ -130,6 +188,8 @@ export type VendorRedeployChallenge = {
|
|
|
130
188
|
export declare function getVendorRedeployChallenge(opts: {
|
|
131
189
|
keeperUrl: string;
|
|
132
190
|
appId: string;
|
|
191
|
+
/** The deployment to redeploy (the keeper requires it). */
|
|
192
|
+
network: 'devnet' | 'mainnet';
|
|
133
193
|
fetcher?: typeof fetch;
|
|
134
194
|
signal?: AbortSignal;
|
|
135
195
|
}): Promise<VendorRedeployChallenge>;
|
|
@@ -142,18 +202,26 @@ export type ProveVendorRedeployRequest = {
|
|
|
142
202
|
scalar: string;
|
|
143
203
|
};
|
|
144
204
|
senderPublicKey: string;
|
|
145
|
-
|
|
205
|
+
retireSignature?: string;
|
|
146
206
|
fetcher?: typeof fetch;
|
|
147
207
|
signal?: AbortSignal;
|
|
148
208
|
};
|
|
149
|
-
export type ProveVendorRedeployResponse =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
209
|
+
export type ProveVendorRedeployResponse = RedeployTx;
|
|
210
|
+
export type VendorRedeployDraining = {
|
|
211
|
+
status: 'draining';
|
|
212
|
+
readyAt: number;
|
|
213
|
+
expiresAt: number;
|
|
214
|
+
message: string;
|
|
215
|
+
};
|
|
216
|
+
export type VendorRedeploySignRetire = {
|
|
217
|
+
status: 'sign-retire';
|
|
218
|
+
retireMessage: string[];
|
|
219
|
+
licensesRoot: string;
|
|
220
|
+
/** The new zkApp address the retirement names: only it can start from these licenses. */
|
|
221
|
+
successor: string;
|
|
222
|
+
message: string;
|
|
155
223
|
};
|
|
156
|
-
export declare function proveVendorRedeploy(req: ProveVendorRedeployRequest): Promise<ProveVendorRedeployResponse>;
|
|
224
|
+
export declare function proveVendorRedeploy(req: ProveVendorRedeployRequest): Promise<ProveVendorRedeployResponse | VendorRedeployDraining | VendorRedeploySignRetire>;
|
|
157
225
|
export type RegisterVendorRedeployRequest = {
|
|
158
226
|
keeperUrl: string;
|
|
159
227
|
appId: string;
|
|
@@ -162,7 +230,53 @@ export type RegisterVendorRedeployRequest = {
|
|
|
162
230
|
fetcher?: typeof fetch;
|
|
163
231
|
signal?: AbortSignal;
|
|
164
232
|
};
|
|
233
|
+
export declare function cancelVendorRedeploy(req: {
|
|
234
|
+
keeperUrl: string;
|
|
235
|
+
appId: string;
|
|
236
|
+
nonce: string;
|
|
237
|
+
signature: {
|
|
238
|
+
field: string;
|
|
239
|
+
scalar: string;
|
|
240
|
+
};
|
|
241
|
+
fetcher?: typeof fetch;
|
|
242
|
+
signal?: AbortSignal;
|
|
243
|
+
}): Promise<{
|
|
244
|
+
ok: true;
|
|
245
|
+
}>;
|
|
246
|
+
export declare function startRedeployDrain(req: {
|
|
247
|
+
keeperUrl: string;
|
|
248
|
+
appId: string;
|
|
249
|
+
adminToken: string;
|
|
250
|
+
network: 'devnet' | 'mainnet';
|
|
251
|
+
fetcher?: typeof fetch;
|
|
252
|
+
}): Promise<{
|
|
253
|
+
ok: true;
|
|
254
|
+
draining: {
|
|
255
|
+
startedAt: string;
|
|
256
|
+
};
|
|
257
|
+
alreadyEmpty: boolean;
|
|
258
|
+
}>;
|
|
259
|
+
export declare function cancelRedeploy(req: {
|
|
260
|
+
keeperUrl: string;
|
|
261
|
+
appId: string;
|
|
262
|
+
adminToken: string;
|
|
263
|
+
network: 'devnet' | 'mainnet';
|
|
264
|
+
fetcher?: typeof fetch;
|
|
265
|
+
}): Promise<{
|
|
266
|
+
ok: true;
|
|
267
|
+
}>;
|
|
268
|
+
export declare function sendRedeployNotices(req: {
|
|
269
|
+
keeperUrl: string;
|
|
270
|
+
adminToken: string;
|
|
271
|
+
network: 'devnet' | 'mainnet';
|
|
272
|
+
fetcher?: typeof fetch;
|
|
273
|
+
}): Promise<{
|
|
274
|
+
ok: true;
|
|
275
|
+
notified: string[];
|
|
276
|
+
forkActivationSlot: number;
|
|
277
|
+
}>;
|
|
165
278
|
export declare function registerVendorRedeploy(req: RegisterVendorRedeployRequest): Promise<{
|
|
166
279
|
ok: true;
|
|
280
|
+
step: 'retire' | 'deploy';
|
|
167
281
|
}>;
|
|
168
282
|
//# sourceMappingURL=deployClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployClient.d.ts","sourceRoot":"","sources":["../src/deployClient.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,SAAS,EAAU,MAAM,CAAC;IAC1B,eAAe,EAAI,MAAM,CAAC;IAC1B,aAAa,EAAM,MAAM,CAAC;IAC1B,gBAAgB,EAAI,MAAM,CAAC;IAC3B,eAAe,EAAK,MAAM,CAAC;IAC3B,iBAAiB,EAAG,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAI3B,SAAS,EAAU,MAAM,CAAC;IAM1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,OAAO,CAAC,EAAW,QAAQ,GAAG,SAAS,CAAC;IAGxC,OAAO,CAAC,EAAW,MAAM,CAAC;IAG1B,aAAa,CAAC,EAAK,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAW,OAAO,KAAK,CAAC;IAChC,MAAM,CAAC,EAAY,WAAW,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAS,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAS,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAgB,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IACnE,YAAY,CAAC,EAAS,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,EAAY,MAAM,CAA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