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.
Files changed (317) hide show
  1. package/README.md +417 -201
  2. package/build/agent.d.ts +371 -0
  3. package/build/agent.d.ts.map +1 -0
  4. package/build/agent.js +553 -0
  5. package/build/agent.js.map +1 -0
  6. package/build/agentActions.d.ts +841 -0
  7. package/build/agentActions.d.ts.map +1 -0
  8. package/build/agentActions.js +581 -0
  9. package/build/agentActions.js.map +1 -0
  10. package/build/agentRecord.d.ts +83 -0
  11. package/build/agentRecord.d.ts.map +1 -0
  12. package/build/agentRecord.js +69 -0
  13. package/build/agentRecord.js.map +1 -0
  14. package/build/agentVendor.d.ts +220 -0
  15. package/build/agentVendor.d.ts.map +1 -0
  16. package/build/agentVendor.js +306 -0
  17. package/build/agentVendor.js.map +1 -0
  18. package/build/appsLookup.d.ts +14 -0
  19. package/build/appsLookup.d.ts.map +1 -0
  20. package/build/appsLookup.js +12 -0
  21. package/build/appsLookup.js.map +1 -0
  22. package/build/archiveBootstrap.d.ts +31 -5
  23. package/build/archiveBootstrap.d.ts.map +1 -0
  24. package/build/archiveBootstrap.js +140 -47
  25. package/build/archiveBootstrap.js.map +1 -0
  26. package/build/atomicJson.d.ts +5 -0
  27. package/build/atomicJson.d.ts.map +1 -0
  28. package/build/atomicJson.js +55 -0
  29. package/build/atomicJson.js.map +1 -0
  30. package/build/bindClient.d.ts +85 -0
  31. package/build/bindClient.d.ts.map +1 -0
  32. package/build/bindClient.js +187 -0
  33. package/build/bindClient.js.map +1 -0
  34. package/build/buyClient.d.ts +27 -4
  35. package/build/buyClient.d.ts.map +1 -0
  36. package/build/buyClient.js +72 -26
  37. package/build/buyClient.js.map +1 -0
  38. package/build/chainHead.d.ts +61 -0
  39. package/build/chainHead.d.ts.map +1 -0
  40. package/build/chainHead.js +88 -0
  41. package/build/chainHead.js.map +1 -0
  42. package/build/compactMerkleMap.d.ts +72 -0
  43. package/build/compactMerkleMap.d.ts.map +1 -0
  44. package/build/compactMerkleMap.js +224 -0
  45. package/build/compactMerkleMap.js.map +1 -0
  46. package/build/contractInterface.d.ts +191 -51
  47. package/build/contractInterface.d.ts.map +1 -0
  48. package/build/contractInterface.js +234 -43
  49. package/build/contractInterface.js.map +1 -0
  50. package/build/contractTypes.d.ts +9 -0
  51. package/build/contractTypes.d.ts.map +1 -0
  52. package/build/contractTypes.js +28 -0
  53. package/build/contractTypes.js.map +1 -0
  54. package/build/countryStats.d.ts +12 -3
  55. package/build/countryStats.d.ts.map +1 -0
  56. package/build/countryStats.js +87 -23
  57. package/build/countryStats.js.map +1 -0
  58. package/build/deployClient.d.ts +138 -24
  59. package/build/deployClient.d.ts.map +1 -0
  60. package/build/deployClient.js +91 -31
  61. package/build/deployClient.js.map +1 -0
  62. package/build/deviceIdentity.d.ts +68 -0
  63. package/build/deviceIdentity.d.ts.map +1 -0
  64. package/build/deviceIdentity.js +209 -0
  65. package/build/deviceIdentity.js.map +1 -0
  66. package/build/freezeClient.d.ts +26 -6
  67. package/build/freezeClient.d.ts.map +1 -0
  68. package/build/freezeClient.js +30 -6
  69. package/build/freezeClient.js.map +1 -0
  70. package/build/generationClient.d.ts +6 -3
  71. package/build/generationClient.d.ts.map +1 -0
  72. package/build/generationClient.js +25 -38
  73. package/build/generationClient.js.map +1 -0
  74. package/build/holderSecret.d.ts +70 -0
  75. package/build/holderSecret.d.ts.map +1 -0
  76. package/build/holderSecret.js +76 -0
  77. package/build/holderSecret.js.map +1 -0
  78. package/build/index.d.ts +38 -38
  79. package/build/index.d.ts.map +1 -0
  80. package/build/index.js +97 -121
  81. package/build/index.js.map +1 -0
  82. package/build/keysClient.d.ts +142 -0
  83. package/build/keysClient.d.ts.map +1 -0
  84. package/build/keysClient.js +109 -0
  85. package/build/keysClient.js.map +1 -0
  86. package/build/licenseLeaf.d.ts +76 -0
  87. package/build/licenseLeaf.d.ts.map +1 -0
  88. package/build/licenseLeaf.js +189 -0
  89. package/build/licenseLeaf.js.map +1 -0
  90. package/build/licenseRecord.d.ts +68 -5
  91. package/build/licenseRecord.d.ts.map +1 -0
  92. package/build/licenseRecord.js +26 -1
  93. package/build/licenseRecord.js.map +1 -0
  94. package/build/licenseStore.d.ts +81 -4
  95. package/build/licenseStore.d.ts.map +1 -0
  96. package/build/licenseStore.js +400 -30
  97. package/build/licenseStore.js.map +1 -0
  98. package/build/licenseTrustless.d.ts +43 -0
  99. package/build/licenseTrustless.d.ts.map +1 -0
  100. package/build/licenseTrustless.js +180 -0
  101. package/build/licenseTrustless.js.map +1 -0
  102. package/build/manifestVerify.d.ts +29 -1
  103. package/build/manifestVerify.d.ts.map +1 -0
  104. package/build/manifestVerify.js +46 -4
  105. package/build/manifestVerify.js.map +1 -0
  106. package/build/minaPriceHistory.d.ts +9 -0
  107. package/build/minaPriceHistory.d.ts.map +1 -0
  108. package/build/minaPriceHistory.js +152 -0
  109. package/build/minaPriceHistory.js.map +1 -0
  110. package/build/onChainRoot.d.ts +60 -0
  111. package/build/onChainRoot.d.ts.map +1 -0
  112. package/build/onChainRoot.js +74 -0
  113. package/build/onChainRoot.js.map +1 -0
  114. package/build/ownershipLicenseHash.d.ts +25 -0
  115. package/build/ownershipLicenseHash.d.ts.map +1 -0
  116. package/build/ownershipLicenseHash.js +29 -0
  117. package/build/ownershipLicenseHash.js.map +1 -0
  118. package/build/ownershipSignature.d.ts +153 -0
  119. package/build/ownershipSignature.d.ts.map +1 -0
  120. package/build/ownershipSignature.js +297 -0
  121. package/build/ownershipSignature.js.map +1 -0
  122. package/build/permitCheckFlow.d.ts +155 -0
  123. package/build/permitCheckFlow.d.ts.map +1 -0
  124. package/build/permitCheckFlow.js +196 -0
  125. package/build/permitCheckFlow.js.map +1 -0
  126. package/build/permitDescribe.d.ts +124 -0
  127. package/build/permitDescribe.d.ts.map +1 -0
  128. package/build/permitDescribe.js +324 -0
  129. package/build/permitDescribe.js.map +1 -0
  130. package/build/permitInterface.d.ts +85 -0
  131. package/build/permitInterface.d.ts.map +1 -0
  132. package/build/permitInterface.js +121 -0
  133. package/build/permitInterface.js.map +1 -0
  134. package/build/permitMessages.d.ts +313 -0
  135. package/build/permitMessages.d.ts.map +1 -0
  136. package/build/permitMessages.js +462 -0
  137. package/build/permitMessages.js.map +1 -0
  138. package/build/permitProof.d.ts +108 -0
  139. package/build/permitProof.d.ts.map +1 -0
  140. package/build/permitProof.js +202 -0
  141. package/build/permitProof.js.map +1 -0
  142. package/build/permitRegistryRebuild.d.ts +166 -0
  143. package/build/permitRegistryRebuild.d.ts.map +1 -0
  144. package/build/permitRegistryRebuild.js +347 -0
  145. package/build/permitRegistryRebuild.js.map +1 -0
  146. package/build/permitTree.d.ts +88 -0
  147. package/build/permitTree.d.ts.map +1 -0
  148. package/build/permitTree.js +230 -0
  149. package/build/permitTree.js.map +1 -0
  150. package/build/permitsClient.d.ts +680 -0
  151. package/build/permitsClient.d.ts.map +1 -0
  152. package/build/permitsClient.js +597 -0
  153. package/build/permitsClient.js.map +1 -0
  154. package/build/proveErrors.d.ts +50 -0
  155. package/build/proveErrors.d.ts.map +1 -0
  156. package/build/proveErrors.js +76 -0
  157. package/build/proveErrors.js.map +1 -0
  158. package/build/receipt.d.ts +95 -0
  159. package/build/receipt.d.ts.map +1 -0
  160. package/build/receipt.js +84 -0
  161. package/build/receipt.js.map +1 -0
  162. package/build/refundClient.d.ts +7 -12
  163. package/build/refundClient.d.ts.map +1 -0
  164. package/build/refundClient.js +52 -21
  165. package/build/refundClient.js.map +1 -0
  166. package/build/registryTrustVerify.d.ts +78 -0
  167. package/build/registryTrustVerify.d.ts.map +1 -0
  168. package/build/registryTrustVerify.js +129 -0
  169. package/build/registryTrustVerify.js.map +1 -0
  170. package/build/releaseClient.d.ts +26 -0
  171. package/build/releaseClient.d.ts.map +1 -0
  172. package/build/releaseClient.js +65 -0
  173. package/build/releaseClient.js.map +1 -0
  174. package/build/renewClient.d.ts +28 -2
  175. package/build/renewClient.d.ts.map +1 -0
  176. package/build/renewClient.js +31 -27
  177. package/build/renewClient.js.map +1 -0
  178. package/build/seatName.d.ts +8 -0
  179. package/build/seatName.d.ts.map +1 -0
  180. package/build/seatName.js +136 -0
  181. package/build/seatName.js.map +1 -0
  182. package/build/slotConstants.d.ts +15 -0
  183. package/build/slotConstants.d.ts.map +1 -0
  184. package/build/slotConstants.js +17 -0
  185. package/build/slotConstants.js.map +1 -0
  186. package/build/statsClient.d.ts +61 -7
  187. package/build/statsClient.d.ts.map +1 -0
  188. package/build/statsClient.js +44 -5
  189. package/build/statsClient.js.map +1 -0
  190. package/build/successorChain.d.ts +35 -0
  191. package/build/successorChain.d.ts.map +1 -0
  192. package/build/successorChain.js +69 -0
  193. package/build/successorChain.js.map +1 -0
  194. package/build/taxId.d.ts +44 -0
  195. package/build/taxId.d.ts.map +1 -0
  196. package/build/taxId.js +212 -0
  197. package/build/taxId.js.map +1 -0
  198. package/build/trustAnchorVerify.d.ts +49 -0
  199. package/build/trustAnchorVerify.d.ts.map +1 -0
  200. package/build/trustAnchorVerify.js +432 -0
  201. package/build/trustAnchorVerify.js.map +1 -0
  202. package/build/trustAnchorVerifyCli.d.ts +45 -0
  203. package/build/trustAnchorVerifyCli.d.ts.map +1 -0
  204. package/build/trustAnchorVerifyCli.js +235 -0
  205. package/build/trustAnchorVerifyCli.js.map +1 -0
  206. package/build/txBroadcastClient.d.ts +26 -0
  207. package/build/txBroadcastClient.d.ts.map +1 -0
  208. package/build/txBroadcastClient.js +20 -0
  209. package/build/txBroadcastClient.js.map +1 -0
  210. package/build/unbindClient.d.ts +77 -0
  211. package/build/unbindClient.d.ts.map +1 -0
  212. package/build/unbindClient.js +169 -0
  213. package/build/unbindClient.js.map +1 -0
  214. package/build/units.d.ts +28 -0
  215. package/build/units.d.ts.map +1 -0
  216. package/build/units.js +65 -0
  217. package/build/units.js.map +1 -0
  218. package/build/vatRates.d.ts +54 -0
  219. package/build/vatRates.d.ts.map +1 -0
  220. package/build/vatRates.js +82 -0
  221. package/build/vatRates.js.map +1 -0
  222. package/build/vatRatesData.d.ts +5 -0
  223. package/build/vatRatesData.d.ts.map +1 -0
  224. package/build/vatRatesData.js +42 -0
  225. package/build/vatRatesData.js.map +1 -0
  226. package/build/vendorAccountClient.d.ts +66 -0
  227. package/build/vendorAccountClient.d.ts.map +1 -0
  228. package/build/vendorAccountClient.js +47 -0
  229. package/build/vendorAccountClient.js.map +1 -0
  230. package/build/verifyCore.d.ts +4 -1
  231. package/build/verifyCore.d.ts.map +1 -0
  232. package/build/verifyCore.js +21 -10
  233. package/build/verifyCore.js.map +1 -0
  234. package/build/verifyOffline.d.ts +85 -0
  235. package/build/verifyOffline.d.ts.map +1 -0
  236. package/build/verifyOffline.js +139 -0
  237. package/build/verifyOffline.js.map +1 -0
  238. package/build/verifyService.d.ts.map +1 -0
  239. package/build/verifyService.js +571 -501
  240. package/build/verifyService.js.map +1 -0
  241. package/build/verifyWithAncestors.d.ts +19 -0
  242. package/build/verifyWithAncestors.d.ts.map +1 -0
  243. package/build/verifyWithAncestors.js +127 -0
  244. package/build/verifyWithAncestors.js.map +1 -0
  245. package/build/zipToState.d.ts +2 -0
  246. package/build/zipToState.d.ts.map +1 -0
  247. package/build/zipToState.js +94 -0
  248. package/build/zipToState.js.map +1 -0
  249. package/package.json +141 -16
  250. package/src/agent.ts +682 -0
  251. package/src/agentActions.ts +637 -0
  252. package/src/agentRecord.ts +121 -0
  253. package/src/agentVendor.ts +356 -0
  254. package/src/appsLookup.ts +48 -0
  255. package/src/archiveBootstrap.ts +386 -0
  256. package/src/atomicJson.ts +53 -0
  257. package/src/bindClient.ts +297 -0
  258. package/src/buyClient.ts +344 -0
  259. package/src/chainHead.ts +106 -0
  260. package/src/compactMerkleMap.ts +222 -0
  261. package/src/contractInterface.ts +465 -0
  262. package/src/contractTypes.ts +31 -0
  263. package/src/countryStats.ts +200 -0
  264. package/src/deployClient.ts +517 -0
  265. package/src/deviceIdentity.ts +249 -0
  266. package/src/freezeClient.ts +162 -0
  267. package/src/generationClient.ts +145 -0
  268. package/src/holderSecret.ts +91 -0
  269. package/src/index.ts +362 -0
  270. package/src/keysClient.ts +135 -0
  271. package/src/licenseLeaf.ts +221 -0
  272. package/src/licenseRecord.ts +190 -0
  273. package/src/licenseStore.ts +767 -0
  274. package/src/licenseTrustless.ts +207 -0
  275. package/src/manifestVerify.ts +164 -0
  276. package/src/minaPriceHistory.ts +166 -0
  277. package/src/onChainRoot.ts +90 -0
  278. package/src/ownershipLicenseHash.ts +31 -0
  279. package/src/ownershipSignature.ts +421 -0
  280. package/src/permitCheckFlow.ts +227 -0
  281. package/src/permitDescribe.ts +362 -0
  282. package/src/permitInterface.ts +146 -0
  283. package/src/permitMessages.ts +572 -0
  284. package/src/permitProof.ts +230 -0
  285. package/src/permitRegistryRebuild.ts +423 -0
  286. package/src/permitTree.ts +232 -0
  287. package/src/permitsClient.ts +746 -0
  288. package/src/proveErrors.ts +98 -0
  289. package/src/receipt.ts +156 -0
  290. package/src/refundClient.ts +177 -0
  291. package/src/registryTrustVerify.ts +192 -0
  292. package/src/releaseClient.ts +101 -0
  293. package/src/renewClient.ts +234 -0
  294. package/src/seatName.ts +165 -0
  295. package/src/slotConstants.ts +18 -0
  296. package/src/statsClient.ts +249 -0
  297. package/src/successorChain.ts +87 -0
  298. package/src/taxId.ts +227 -0
  299. package/src/trustAnchorVerify.ts +550 -0
  300. package/src/trustAnchorVerifyCli.ts +234 -0
  301. package/src/txBroadcastClient.ts +48 -0
  302. package/src/unbindClient.ts +233 -0
  303. package/src/units.ts +74 -0
  304. package/src/vatRates.ts +100 -0
  305. package/src/vatRatesData.ts +43 -0
  306. package/src/vendorAccountClient.ts +120 -0
  307. package/src/verifyCore.ts +100 -0
  308. package/src/verifyOffline.ts +212 -0
  309. package/src/verifyService.ts +982 -0
  310. package/src/verifyWithAncestors.ts +163 -0
  311. package/src/zipToState.ts +94 -0
  312. package/build/licenseProof.d.ts +0 -26
  313. package/build/licenseProof.js +0 -41
  314. package/build/migrateClient.d.ts +0 -43
  315. package/build/migrateClient.js +0 -47
  316. package/build/ownership.d.ts +0 -34
  317. package/build/ownership.js +0 -147
@@ -0,0 +1,680 @@
1
+ import { type ApplicationRecord, type PermitRecord, type PermitStatusName } from './permitRegistryRebuild.js';
2
+ import type { DescribeContext, PermitMessageDescription } from './permitDescribe.js';
3
+ import type { PurchaseReceipt } from './receipt.js';
4
+ /** One row of GET /permits/registries/:address/transactions (amounts in nanomina, as strings). */
5
+ export type RegistryTransaction = {
6
+ date: string;
7
+ slot: number;
8
+ kind: 'permit' | 'renewal' | 'rejected' | 'withdrawn' | 'refunded after deadline';
9
+ subject: string;
10
+ amount: string;
11
+ authorityShare: string;
12
+ platformShare: string;
13
+ refunded: string;
14
+ txHash: string | null;
15
+ };
16
+ /** GET /permits/registries/:address/stats (amounts in nanomina, as strings). */
17
+ export type RegistryStats = {
18
+ registry: string;
19
+ name: string;
20
+ network: string;
21
+ slot: number;
22
+ listing: 'listed' | 'pending' | 'delisted';
23
+ permits: {
24
+ total: number;
25
+ byStatus: Record<string, number>;
26
+ };
27
+ applications: Record<string, number>;
28
+ fees: {
29
+ grants: number;
30
+ grantFees: string;
31
+ renewals: number;
32
+ renewalFees: string;
33
+ processingFees: string;
34
+ refunded: string;
35
+ gross: string;
36
+ platformShare: string;
37
+ authorityShare: string;
38
+ };
39
+ byMonth: Array<{
40
+ month: string;
41
+ grants: number;
42
+ renewals: number;
43
+ fees: string;
44
+ }>;
45
+ };
46
+ export type Network = 'devnet' | 'mainnet';
47
+ /** What the client needs from a wallet. */
48
+ export interface PermitWallet {
49
+ readonly address: string;
50
+ /** Field signature (Auro `signFields`), base58. */
51
+ signFields(fields: string[]): Promise<string>;
52
+ /** Text signature (Auro `signMessage`). */
53
+ signMessage(message: string): Promise<{
54
+ field: string;
55
+ scalar: string;
56
+ }>;
57
+ /** Signs a keeper-proved transaction as fee payer and broadcasts it; returns the hash. */
58
+ signAndSendTransaction(transactionJson: string): Promise<string>;
59
+ }
60
+ export declare class PermitsError extends Error {
61
+ readonly status: number;
62
+ readonly code: string;
63
+ readonly retryable: boolean;
64
+ readonly body: unknown;
65
+ constructor(message: string, status: number, code: string, retryable: boolean, body?: unknown);
66
+ }
67
+ /** The sign-in text: names the site and network (the keeper's challenge
68
+ * supplies both), so a sign-in for devnet never works on mainnet. */
69
+ export declare function sessionMessage(address: string, nonce: string, issuedAt: string, network: string, site: string): string;
70
+ /**
71
+ * An authority's details. On mainnet `registrationNumber` (organisation
72
+ * number) and `billingAddress` are required; `vatId` only when the
73
+ * organisation is VAT-registered (it is then checked, with VIES for EU
74
+ * numbers). Without one, the platform's fee includes VAT.
75
+ */
76
+ export type AuthorityDetails = {
77
+ legalName: string;
78
+ country: string;
79
+ website: string;
80
+ contactEmail: string;
81
+ registrationNumber?: string;
82
+ vatId?: string;
83
+ billingAddress?: {
84
+ line1: string;
85
+ line2?: string;
86
+ city: string;
87
+ postalCode: string;
88
+ };
89
+ };
90
+ export declare function authorityAcceptanceMessage(f: {
91
+ address: string;
92
+ legalName: string;
93
+ country: string;
94
+ termsVersion: string;
95
+ termsHash: string;
96
+ acceptedAt: string;
97
+ }): string;
98
+ export type PermitsClientOptions = {
99
+ keeperUrl: string;
100
+ network: Network;
101
+ wallet?: PermitWallet;
102
+ fetcher?: typeof fetch;
103
+ /**
104
+ * Called before every field signature (wallets show those as numbers):
105
+ * with what the numbers mean, checked against them
106
+ * (zklicensing/permits/describe). Return false to cancel. Unverified
107
+ * descriptions are refused before this is called.
108
+ */
109
+ confirmSignature?: (d: PermitMessageDescription) => Promise<boolean | void> | boolean | void;
110
+ /** Labels for the descriptions: activity names and dates, per registry. */
111
+ describeContext?: (registry: string) => Promise<DescribeContext> | DescribeContext;
112
+ };
113
+ export type RequestView = {
114
+ id: string;
115
+ registry: string;
116
+ kind: string;
117
+ message: string[];
118
+ keys: string[];
119
+ required: number;
120
+ signatures: Record<string, string>;
121
+ status: string;
122
+ salt?: string;
123
+ fee?: string;
124
+ oldLeaf?: PermitRecord;
125
+ newLeaf?: PermitRecord;
126
+ reasonCode?: string;
127
+ newFeesPacked?: string;
128
+ newAppTermsPacked?: string;
129
+ newKeys?: string[];
130
+ newThreshold?: number;
131
+ /** payout: the address proposed; payoutCancel: the one cancelled. */
132
+ newPayout?: string;
133
+ /** rotate: every new key's signature, by its slot in the new set. */
134
+ newSignatures?: Record<string, string>;
135
+ /** approveApplication / rejectApplication: the application as filed. */
136
+ application?: ApplicationRecord;
137
+ applicationId?: string;
138
+ /** The transaction that carried it out, once sent. */
139
+ txHash?: string;
140
+ };
141
+ export declare function createPermitsClient(opts: PermitsClientOptions): {
142
+ network: Network;
143
+ signIn: () => Promise<string>;
144
+ listRegistries: () => Promise<{
145
+ registries: any[];
146
+ }>;
147
+ getRegistry: (address: string) => Promise<{
148
+ registry: any;
149
+ chain?: any;
150
+ }>;
151
+ /** The registry's lineage (its first generation's address), which holder secrets are derived against. */
152
+ registryLineage: (address: string) => Promise<string>;
153
+ /**
154
+ * A permit with a witness against its registry's root. Asked through an
155
+ * earlier generation's address, it comes from the current one
156
+ * (`registry`, `generation`), which starts with every permit of the one it
157
+ * replaced.
158
+ */
159
+ getPermit: (registry: string, subject: string) => Promise<{
160
+ permit: PermitRecord | null;
161
+ status: PermitStatusName;
162
+ slot: number;
163
+ root: string;
164
+ witness: {
165
+ isLefts: boolean[];
166
+ siblings: string[];
167
+ };
168
+ registry?: string;
169
+ generation?: number;
170
+ frozen?: boolean;
171
+ }>;
172
+ /** A registry's generations and release, and any redeploy under way (no events needed). */
173
+ getDeployment: (registry: string) => Promise<{
174
+ registry: string;
175
+ network: string;
176
+ generation: number;
177
+ status: string;
178
+ current: string;
179
+ generations: Array<{
180
+ generation: number;
181
+ address: string;
182
+ status: string;
183
+ retiredAt?: string;
184
+ }>;
185
+ currentVerificationKeyHash: string;
186
+ chain: {
187
+ verificationKeyHash: string | null;
188
+ current: boolean;
189
+ retired: boolean;
190
+ hasPermits: boolean;
191
+ hasOpenApplications: boolean;
192
+ } | null;
193
+ /** draining: open applications settle first (no new filings); then successor and the two requests. */
194
+ redeploy: {
195
+ startedAt: string;
196
+ draining?: boolean;
197
+ openApplications?: number;
198
+ lastDeadline?: number | null;
199
+ successor?: any;
200
+ request?: RequestView | null;
201
+ retireRequest?: RequestView | null; /** The platform key retires it (retireByPlatform): the keys sign only the new registry. */
202
+ byPlatform?: boolean;
203
+ } | null;
204
+ }>;
205
+ verifyPermit: (registry: string, subject: string, scope?: bigint | string) => Promise<{
206
+ valid: boolean;
207
+ status: PermitStatusName;
208
+ scopeOk: boolean;
209
+ slot: number;
210
+ root: string;
211
+ permit: any;
212
+ }>;
213
+ getRequest: (id: string, asSelf?: boolean) => Promise<{
214
+ request: RequestView;
215
+ }>;
216
+ /** `agentConsent`: the owner's standing consent when an AI agent's key accepts for them. */
217
+ acceptAuthorityTerms(f: AuthorityDetails & {
218
+ termsVersion: string;
219
+ termsHash: string;
220
+ agentConsent?: unknown;
221
+ }): Promise<{
222
+ authority: any;
223
+ }>;
224
+ /**
225
+ * The platform's monthly fee statement for this wallet's registries
226
+ * (`month` YYYY-MM): its share of each permit fee, in euros, with VAT as
227
+ * the authority's details require. null when nothing to show.
228
+ */
229
+ /**
230
+ * What forced retirements left in escrow on this wallet's registries
231
+ * (Authority Terms §8.4): per registry, the applications whose fees stay
232
+ * there, their payers and the total.
233
+ */
234
+ authorityStranded: () => Promise<{
235
+ registries: Array<{
236
+ registry: string;
237
+ name: string | null;
238
+ successor: string | null;
239
+ retireTxHash: string;
240
+ strandedAt: string;
241
+ count: number;
242
+ totalNano: string;
243
+ applications: Array<{
244
+ id: string;
245
+ holderKey: string;
246
+ payer: string | null;
247
+ feeNano: string;
248
+ deadline: number | null;
249
+ contactEmail: string;
250
+ }>;
251
+ }>;
252
+ count: number;
253
+ totalNano: string;
254
+ }>;
255
+ authorityFeeStatement: (month: string) => Promise<any>;
256
+ /**
257
+ * This wallet's receipts and credit notes for a license (zklicensing/receipt),
258
+ * purchase first; signs in with the wallet (a receipt shows the buyer's country).
259
+ */
260
+ getLicenseReceipts: (zkAppAddress: string, licenseHash: string) => Promise<PurchaseReceipt[]>;
261
+ /** This wallet's receipt or credit note for one transaction (a license or a permit fee). */
262
+ getReceipt: (txHash: string) => Promise<PurchaseReceipt>;
263
+ /**
264
+ * This wallet as a holder: its applications, its permits (with their
265
+ * effective status; a redeployed registry's earlier permits are marked
266
+ * frozen) and renewals offered to it that wait for acceptGrant.
267
+ */
268
+ getHolderOverview: () => Promise<{
269
+ network: string;
270
+ slot: number;
271
+ applications: Array<{
272
+ id: string;
273
+ registry: string;
274
+ registryName: string;
275
+ status: string;
276
+ createdAt: string;
277
+ requestedScope: string;
278
+ terms: any | null;
279
+ escrow: any | null;
280
+ settlement: any | null;
281
+ }>;
282
+ permits: Array<PermitRecord & {
283
+ registry: string;
284
+ registryName: string;
285
+ generation: number;
286
+ frozen: boolean;
287
+ effectiveStatus: PermitStatusName;
288
+ }>;
289
+ offers: Array<{
290
+ id: string;
291
+ registry: string;
292
+ registryName: string;
293
+ newLeaf: PermitRecord;
294
+ fee: string;
295
+ createdAt: string;
296
+ }>;
297
+ }>;
298
+ /** This wallet's authority account (404 NOT_FOUND before the terms are accepted). */
299
+ getAuthority: () => Promise<{
300
+ authority: any;
301
+ currentTerms: {
302
+ version: string;
303
+ hash: string;
304
+ };
305
+ }>;
306
+ /** Registries this wallet is an authority of, including drafts. */
307
+ listMyRegistries: () => Promise<{
308
+ registries: any[];
309
+ }>;
310
+ listRequests: (registry: string, status?: string) => Promise<{
311
+ requests: RequestView[];
312
+ }>;
313
+ createRegistry: (draft: {
314
+ name: string;
315
+ website: string;
316
+ jurisdiction?: string;
317
+ description?: string;
318
+ keys: string[];
319
+ threshold: number;
320
+ scopes: Array<{
321
+ bit: number;
322
+ label: string;
323
+ }>;
324
+ policy?: {
325
+ gracePeriod?: number;
326
+ maxTerm?: number;
327
+ singleKeySuspend?: boolean;
328
+ holderSigRequired?: boolean;
329
+ };
330
+ grantFeeMina: string;
331
+ renewalFeeMina?: string;
332
+ payout?: string;
333
+ /** Kept when an application is rejected or withdrawn (default the platform minimum); decision window in slots (default 14 days). */
334
+ processingFeeMina?: string;
335
+ decisionWindow?: number;
336
+ }) => Promise<{
337
+ registry: any;
338
+ request: RequestView;
339
+ }>;
340
+ /**
341
+ * Changes a registry's public details (authority). On devnet they apply
342
+ * at once; on a listed mainnet registry they wait for the platform's
343
+ * review (`staged: true`). `scopeLabels` rewords the activities, one label
344
+ * each in order; the activities themselves can't change.
345
+ */
346
+ updateRegistryListing: (registry: string, edit: {
347
+ name?: string;
348
+ description?: string;
349
+ jurisdiction?: string;
350
+ scopeLabels?: string[];
351
+ }) => Promise<{
352
+ registry: any;
353
+ staged: boolean;
354
+ }>;
355
+ /** Stops (false) or resumes (true) taking applications (authority); everything else carries on. */
356
+ setApplicationsOpen: (registry: string, open: boolean) => Promise<{
357
+ registry: any;
358
+ }>;
359
+ /** Withdraws a staged edit of a registry's public details (authority). */
360
+ withdrawRegistryEdit: (registry: string) => Promise<{
361
+ registry: any;
362
+ }>;
363
+ /** A registry's figures for its authority: permits and applications by status, fees by kind and month (nanomina). */
364
+ getRegistryStats: (registry: string) => Promise<RegistryStats>;
365
+ /** The registry's money events (authority), oldest first: `from`/`to` as YYYY-MM-DD, `to` exclusive. Amounts in nanomina. */
366
+ getRegistryTransactions: (registry: string, period?: {
367
+ from?: string;
368
+ to?: string;
369
+ }) => Promise<{
370
+ registry: string;
371
+ network: string;
372
+ transactions: RegistryTransaction[];
373
+ }>;
374
+ /** Signs a request with this wallet's key and adds the signature at `slot`. */
375
+ signRequest(requestId: string, slot?: number): Promise<{
376
+ request: RequestView;
377
+ }>;
378
+ /**
379
+ * Starts a redeploy to the current release: a new registry (same
380
+ * configuration, next generation) and two requests for the keys to sign,
381
+ * `retireRequest` (freezes this registry's permits on chain) and `request`
382
+ * (deploys the new one). Send them in that order: executeRequest(retire),
383
+ * then deployRegistry(request). The new registry starts with every permit
384
+ * of this one, as it is when it retires. With fees in escrow
385
+ * (ESCROW_NOT_EMPTY) only the platform can start a redeploy: the registry
386
+ * then drains
387
+ * (`draining: true`): no new filings while the open ones are decided,
388
+ * withdrawn or reclaimed; call again once they are, to get the requests.
389
+ */
390
+ redeployRegistry: (registry: string) => Promise<{
391
+ successor: any;
392
+ retireRequest: RequestView | null;
393
+ retiredByPlatform?: boolean;
394
+ request: RequestView;
395
+ } | {
396
+ draining: true;
397
+ openApplications: number;
398
+ lastDeadline: number | null;
399
+ }>;
400
+ /** Calls off a redeploy whose retirement hasn't been sent. */
401
+ cancelRedeploy: (registry: string) => Promise<{
402
+ registry: any;
403
+ }>;
404
+ /** Proves the deployment, signs and pays with this wallet, and reports it. */
405
+ deployRegistry(requestId: string): Promise<{
406
+ registry: string;
407
+ txHash: string;
408
+ }>;
409
+ listApplications: (registry: string, status?: string) => Promise<{
410
+ applications: any[];
411
+ paymentPaused?: boolean;
412
+ }>;
413
+ /**
414
+ * Approves a filed application exactly as applied for (the permit is
415
+ * active once the request is signed and sent): a request for the
416
+ * authority keys to sign, then executeRequest. An unpaid one whose
417
+ * payment waits for a Mina upgrade is approved before payment (no
418
+ * request): the keeper raises the request once its fee is in escrow,
419
+ * and the applicant learns of it then.
420
+ */
421
+ approveApplication: (id: string) => Promise<{
422
+ application: any;
423
+ request?: RequestView;
424
+ }>;
425
+ /**
426
+ * Rejects a filed application: the processing fee is kept, the rest
427
+ * refunded once the request is signed and sent. An unpaid one whose
428
+ * payment waits for a Mina upgrade is rejected before payment (no
429
+ * request): the keeper raises the request once its fee is in escrow,
430
+ * and the applicant learns of it then. `reason` stays off chain.
431
+ */
432
+ rejectApplication: (id: string, reason?: string, reasonCode?: string) => Promise<{
433
+ application: any;
434
+ request?: RequestView;
435
+ }>;
436
+ requestRenewal: (registry: string, subject: string, change: {
437
+ expirySlot: number | "none";
438
+ scope?: string;
439
+ validFrom?: number;
440
+ docHash?: string;
441
+ }) => Promise<{
442
+ request: RequestView;
443
+ }>;
444
+ requestStatus: (registry: string, subject: string, action: "suspend" | "reinstate" | "revoke", reasonCode?: string) => Promise<{
445
+ request: RequestView;
446
+ }>;
447
+ /** New fees; the processing fee (MINA) and decision window (slots) stay as they are unless given. */
448
+ requestFees: (registry: string, grantFeeMina: string, renewalFeeMina?: string, applications?: {
449
+ processingFeeMina?: string;
450
+ decisionWindow?: number;
451
+ }) => Promise<{
452
+ request: RequestView;
453
+ }>;
454
+ requestRotation: (registry: string, keys: string[], threshold: number) => Promise<{
455
+ request: RequestView;
456
+ }>;
457
+ /** Proves a fully signed non-grant request, signs and pays with this wallet, and reports it. */
458
+ executeRequest(requestId: string): Promise<{
459
+ txHash: string;
460
+ }>;
461
+ /**
462
+ * Applies for a permit and pays the fee into escrow (`pay: false` only
463
+ * records the application; file it later with fileApplication). What is
464
+ * applied for is what an approval grants: activities (`scope`), dates and
465
+ * conditions document. Rejection or withdrawal keeps the registry's
466
+ * processing fee and refunds the rest to the payer; no decision by the
467
+ * deadline refunds it all.
468
+ *
469
+ * A new permit's secret for anonymous proofs (zklicensing/permits/holder-secret)
470
+ * is derived by the holder's wallet from a counter, the first not yet
471
+ * used by this key in the registry; only the salt (a hash of the secret)
472
+ * goes to the keeper. The wallet signs once per counter tried. When
473
+ * another key is the holder, derive with that key's wallet
474
+ * (deriveHolderSecret), pass `salt` and `pay: false`, and let the holder
475
+ * file it. To renew or change your active permit, pass its `subject`.
476
+ */
477
+ apply(registry: string, a: {
478
+ scope?: string;
479
+ requestedScope?: string;
480
+ expirySlot?: number | "none";
481
+ validFrom?: number;
482
+ docHash?: string;
483
+ details?: Record<string, unknown>;
484
+ docLinks?: string[];
485
+ contactEmail?: string;
486
+ holderKey?: string;
487
+ salt?: string;
488
+ subject?: string;
489
+ pay?: boolean;
490
+ payer?: PermitWallet;
491
+ }): Promise<{
492
+ application: any;
493
+ apply: any;
494
+ txHash?: string;
495
+ fee?: string;
496
+ processingFee?: string;
497
+ deadline?: number;
498
+ paymentPaused?: {
499
+ reason: string;
500
+ forkActivationSlot: number | null;
501
+ };
502
+ }>;
503
+ getApplication: (id: string) => Promise<{
504
+ application: any;
505
+ request: RequestView | null;
506
+ slot: number | null;
507
+ apply: {
508
+ application: ApplicationRecord;
509
+ fee: string;
510
+ processingFee: string;
511
+ decisionWindow: number;
512
+ message: string[];
513
+ /** Not payable now (ahead of a Mina upgrade, or while the registry moves): it is kept and paid afterwards, on the new registry. */
514
+ paymentPaused?: {
515
+ reason: "upgrade" | "redeploy";
516
+ forkActivationSlot: number | null;
517
+ };
518
+ } | null;
519
+ withdrawMessage?: string[];
520
+ reclaimable?: boolean | null;
521
+ }>;
522
+ /**
523
+ * The holder signs what is applied for (with the registry's current fee
524
+ * and processing fee) and `payer` (default: this wallet) pays the fee
525
+ * into escrow. Returns the deadline slot for the authority's decision.
526
+ */
527
+ fileApplication(id: string, payer?: PermitWallet): Promise<{
528
+ txHash: string;
529
+ fee: string;
530
+ processingFee: string;
531
+ deadline: number;
532
+ }>;
533
+ /**
534
+ * Withdraws an application. Unpaid: recorded off chain. Paid (filed),
535
+ * before the deadline: the holder signs, the processing fee is kept and
536
+ * the rest goes back to the payer; this wallet pays the transaction fee.
537
+ */
538
+ withdrawApplication(id: string): Promise<{
539
+ application: any;
540
+ } | {
541
+ receipt?: PurchaseReceipt | undefined;
542
+ application: any;
543
+ txHash: string;
544
+ kept: string;
545
+ refunded: string;
546
+ }>;
547
+ /** After the deadline without a decision: returns the whole fee to the payer. Any wallet can send it (it pays the transaction fee). */
548
+ reclaimApplication(id: string, sender?: PermitWallet): Promise<{
549
+ txHash: string;
550
+ refunded: string;
551
+ payer: string;
552
+ }>;
553
+ /**
554
+ * The holder accepts a signed grant: signs the exact permit and fee,
555
+ * then pays with `payer` (default: this wallet). The holder's wallet can
556
+ * re-derive the permit's secret for anonymous proofs at any time
557
+ * (findHolderSecret), from the chain alone.
558
+ */
559
+ acceptGrant(requestId: string, payer?: PermitWallet): Promise<{
560
+ receipt?: PurchaseReceipt | undefined;
561
+ txHash: string;
562
+ subject: string;
563
+ fee: string;
564
+ toAuthority: string;
565
+ toPlatform: string;
566
+ }>;
567
+ /**
568
+ * A new payout address for the registry (authority): a request for the
569
+ * keys to sign; once sent it takes effect after 48 hours, unless
570
+ * cancelled (cancelRegistryPayout). The keeper applies it then.
571
+ */
572
+ proposeRegistryPayout: (registry: string, payout: string) => Promise<{
573
+ request: RequestView;
574
+ }>;
575
+ /** Cancels the pending payout change: a request for the keys to sign. */
576
+ cancelRegistryPayout: (registry: string) => Promise<{
577
+ request: RequestView;
578
+ }>;
579
+ /** Applies a payout change past its delay, paid by this wallet (the keeper does it itself when it has a fee payer). */
580
+ applyRegistryPayout(registry: string): Promise<{
581
+ txHash: string;
582
+ payout: string;
583
+ }>;
584
+ /**
585
+ * Signs a key rotation as one of the NEW keys (`newSlot`: its place in
586
+ * the new set). Every new key signs, besides the current keys' threshold.
587
+ */
588
+ signRotationAsNewKey(requestId: string, newSlot?: number): Promise<{
589
+ request: RequestView;
590
+ }>;
591
+ /**
592
+ * Moves the holder's permit to `newWallet`'s key (both keys sign; free):
593
+ * the same terms under a new subject, whose secret the new wallet derives
594
+ * itself (its first unused counter in the registry's lineage). This
595
+ * wallet pays the fee unless `payer` is given.
596
+ */
597
+ rekeyPermit(registry: string, subject: string, newWallet: PermitWallet, payer?: PermitWallet): Promise<{
598
+ txHash: string;
599
+ subject: string;
600
+ salt: string;
601
+ }>;
602
+ /** Moves this wallet's authority account to `newWallet` (both sign); registry keys change by a rotation. */
603
+ moveAuthorityAccount(newWallet: PermitWallet): Promise<{
604
+ moved: {
605
+ from: string;
606
+ to: string;
607
+ };
608
+ }>;
609
+ /** The holder gives up their permit. */
610
+ surrender(registry: string, subject: string): Promise<{
611
+ txHash: string;
612
+ }>;
613
+ };
614
+ export type PermitsClient = ReturnType<typeof createPermitsClient>;
615
+ /**
616
+ * The registry's permits root and the current slot, read from a Mina node
617
+ * (not the keeper) — what a verifier of a holder proof should accept as
618
+ * `acceptedRoots` / `currentSlot` in `verifyHolderProof`.
619
+ */
620
+ export declare function readRegistryHead(args: {
621
+ registry: string;
622
+ network: Network;
623
+ graphqlUrl?: string;
624
+ fetcher?: typeof fetch;
625
+ }): Promise<{
626
+ root: string;
627
+ slot: number;
628
+ }>;
629
+ /**
630
+ * The current registry of `registry`'s lineage, from chain state alone: a
631
+ * retired registry names its successor (stored by its retirement, which its
632
+ * keys signed), and the successor's initialization checked the
633
+ * predecessor named it. Each hop also checks the successor runs a published
634
+ * PermitRegistry release and started from the predecessor's frozen root. A
635
+ * successor not deployed yet (between retirement and deployment, e.g.
636
+ * across a hard fork) leaves the retired registry current.
637
+ */
638
+ export declare function currentRegistryOnChain(args: {
639
+ registry: string;
640
+ network: Network;
641
+ graphqlUrl?: string;
642
+ fetcher?: typeof fetch;
643
+ }): Promise<string>;
644
+ /**
645
+ * Verifies a permit without trusting the keeper: the root comes from
646
+ * `fetchRoot` (default: the registry account's appState[0] read from a
647
+ * Mina node), and the keeper's leaf and witness must fold to that root.
648
+ */
649
+ export declare function verifyPermitTrustless(args: {
650
+ keeperUrl: string;
651
+ network: Network;
652
+ registry: string;
653
+ subject: string;
654
+ requiredScope?: bigint;
655
+ /** Current slot for the date check; default the node's slot (or the keeper's with a custom fetchRoot). */
656
+ slot?: number;
657
+ gracePeriod?: number;
658
+ fetchRoot?: (registry: string) => Promise<string>;
659
+ /** Mina node for the default root and slot read. */
660
+ graphqlUrl?: string;
661
+ fetcher?: typeof fetch;
662
+ }): Promise<{
663
+ valid: boolean;
664
+ status: PermitStatusName;
665
+ scopeOk: boolean;
666
+ rootMatches: boolean;
667
+ permit: PermitRecord | null;
668
+ registry: string;
669
+ frozen: boolean;
670
+ }>;
671
+ /**
672
+ * A wallet for scripts and agents, from a private key the owner handed over.
673
+ * `send` broadcasts the signed transaction (default: o1js on the active
674
+ * Mina instance). Requires the optional `mina-signer` peer dependency.
675
+ */
676
+ export declare function minaSignerWallet(privateKeyBase58: string, opts: {
677
+ network: Network;
678
+ send?: (signedZkappCommandJson: unknown) => Promise<string>;
679
+ }): Promise<PermitWallet>;
680
+ //# sourceMappingURL=permitsClient.d.ts.map