hookr-sdk 0.2.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +70 -0
- package/LICENSE +21 -0
- package/MIGRATING.md +89 -0
- package/README.md +308 -105
- package/dist/core/abi.d.ts +10930 -0
- package/dist/core/abi.js +455 -0
- package/dist/core/advisories.d.ts +184 -0
- package/dist/core/advisories.js +291 -0
- package/dist/core/client.d.ts +55 -0
- package/dist/core/client.js +107 -0
- package/dist/core/generated.d.ts +14295 -0
- package/dist/core/generated.js +1058 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +17 -0
- package/dist/core/launch.d.ts +200 -0
- package/dist/core/launch.js +427 -0
- package/dist/core/pair.d.ts +64 -0
- package/dist/core/pair.js +136 -0
- package/dist/core/params.d.ts +415 -0
- package/dist/core/params.js +1235 -0
- package/dist/core/policies.d.ts +136 -0
- package/dist/core/policies.js +125 -0
- package/dist/core/proofs.d.ts +25 -0
- package/dist/core/proofs.js +118 -0
- package/dist/core/quotes.d.ts +185 -0
- package/dist/core/quotes.js +550 -0
- package/dist/core/referrals.d.ts +32 -0
- package/dist/core/referrals.js +36 -0
- package/dist/core/registry.d.ts +357 -0
- package/dist/core/registry.js +378 -0
- package/dist/core/rules.d.ts +675 -0
- package/dist/core/rules.js +1049 -0
- package/dist/core/schema.d.ts +358 -0
- package/dist/core/schema.js +105 -0
- package/dist/core/stocks.generated.d.ts +11 -0
- package/dist/core/stocks.generated.js +1228 -0
- package/dist/core/vault.d.ts +59 -0
- package/dist/core/vault.js +112 -0
- package/dist/core/wallet.d.ts +142 -0
- package/dist/core/wallet.js +304 -0
- package/dist/deployments.d.ts +8 -0
- package/dist/deployments.js +26 -0
- package/dist/index.d.ts +42 -15
- package/dist/index.js +40 -15
- package/dist/releases.d.ts +219 -0
- package/dist/releases.js +365 -0
- package/dist/wallet-cap.d.ts +159 -0
- package/dist/wallet-cap.js +234 -0
- package/package.json +46 -10
- package/provenance.json +31 -0
- package/dist/abi.d.ts +0 -6404
- package/dist/abi.js +0 -8300
- package/dist/chain.d.ts +0 -87
- package/dist/chain.js +0 -86
- package/dist/claims.d.ts +0 -32
- package/dist/claims.js +0 -31
- package/dist/fees.d.ts +0 -59
- package/dist/fees.js +0 -142
- package/dist/links.d.ts +0 -48
- package/dist/links.js +0 -93
- package/dist/market.d.ts +0 -264
- package/dist/market.js +0 -310
- package/dist/reads.d.ts +0 -136
- package/dist/reads.js +0 -219
- package/dist/rules.d.ts +0 -84
- package/dist/rules.js +0 -296
- package/dist/swap.d.ts +0 -108
- package/dist/swap.js +0 -144
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* quote and swap through Hookr's router, read markets, and claim payouts.
|
|
2
|
+
* hookr-sdk: build on Hookr, the Uniswap v4 hook on Robinhood Chain.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* `./core` is the release SDK of the release commit, copied byte for byte (`provenance.json` names the commit and
|
|
5
|
+
* every file's hash). `./releases` adds the addresses and deployment of the production release and its canary, the
|
|
6
|
+
* Rules modules its root admits beside the release's own, the chain for viem, and builds the DeploymentManifest the core
|
|
7
|
+
* builders take. `./wallet-cap` adds Wallet Cap: its pool terms, its storage reads and its refusal.
|
|
8
|
+
*
|
|
9
|
+
* Below, the core's quote-admission exports are exported again, marked deprecated: they name functions HookrRegistry
|
|
10
|
+
* does not have on chain.
|
|
11
|
+
*/
|
|
12
|
+
import * as registry from "./core/registry.js";
|
|
13
|
+
import { kingOfTheHillPrizeBound as prizeBound } from "./core/rules.js";
|
|
14
|
+
export * from "./core/index.js";
|
|
15
|
+
export * from "./releases.js";
|
|
16
|
+
export * from "./wallet-cap.js";
|
|
17
|
+
/**
|
|
18
|
+
* The largest King of the Pool `maxPrizeBps` a recapture pool binds with: HookrRecapture's `prizeBoundFor(lpBps,
|
|
19
|
+
* burnBps, protocolShareBps, integratorBps)`, worked out offline.
|
|
9
20
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
export
|
|
21
|
+
export declare const kingOfThePoolPrizeBound: typeof prizeBound;
|
|
22
|
+
/** @deprecated The same function as `kingOfThePoolPrizeBound`, under King of the Pool's earlier name. */
|
|
23
|
+
export declare const kingOfTheHillPrizeBound: typeof prizeBound;
|
|
24
|
+
/** @deprecated Describes calls HookrRegistry does not have on chain. Removed in 2.0. */
|
|
25
|
+
export declare const QUOTE_ADMISSION_ABI: typeof registry.QUOTE_ADMISSION_ABI;
|
|
26
|
+
/** @deprecated Names functions HookrRegistry does not have on chain. Removed in 2.0. */
|
|
27
|
+
export declare const QUOTE_ADMISSION_OPERATIONS: typeof registry.QUOTE_ADMISSION_OPERATIONS;
|
|
28
|
+
/** @deprecated Checks an ABI offline; against the deployed HookrRegistry's ABI it returns false. Removed in 2.0. */
|
|
29
|
+
export declare const registryHasQuoteAdmission: typeof registry.registryHasQuoteAdmission;
|
|
30
|
+
/** @deprecated Checks an ABI offline; against the deployed HookrRegistry's ABI it returns false. Removed in 2.0. */
|
|
31
|
+
export declare const registryHasOperation: typeof registry.registryHasOperation;
|
|
32
|
+
/** @deprecated Calls `excludeQuoteClassNow`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
33
|
+
export declare const buildExcludeQuoteClass: typeof registry.buildExcludeQuoteClass;
|
|
34
|
+
/** @deprecated Calls `stopOpenQuotesNow`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
35
|
+
export declare const buildStopOpenQuotes: typeof registry.buildStopOpenQuotes;
|
|
36
|
+
/** @deprecated Encodes `quoteState()`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
37
|
+
export declare const encodeQuoteStateCall: typeof registry.encodeQuoteStateCall;
|
|
38
|
+
/** @deprecated Decodes `quoteState()`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
39
|
+
export declare const decodeQuoteState: typeof registry.decodeQuoteState;
|
|
40
|
+
/** @deprecated The result of `quoteState()`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
41
|
+
export type QuoteState = registry.QuoteState;
|
|
42
|
+
/** @deprecated Encodes `curatedQuote(asset)`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
43
|
+
export declare const encodeCuratedQuoteCall: typeof registry.encodeCuratedQuoteCall;
|
|
44
|
+
/** @deprecated Decodes `curatedQuote(asset)`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
45
|
+
export declare const decodeCuratedQuote: typeof registry.decodeCuratedQuote;
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* quote and swap through Hookr's router, read markets, and claim payouts.
|
|
2
|
+
* hookr-sdk: build on Hookr, the Uniswap v4 hook on Robinhood Chain.
|
|
4
3
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* `./core` is the release SDK of the release commit, copied byte for byte (`provenance.json` names the commit and
|
|
5
|
+
* every file's hash). `./releases` adds the addresses and deployment of the production release and its canary, the
|
|
6
|
+
* Rules modules its root admits beside the release's own, the chain for viem, and builds the DeploymentManifest the core
|
|
7
|
+
* builders take. `./wallet-cap` adds Wallet Cap: its pool terms, its storage reads and its refusal.
|
|
8
|
+
*
|
|
9
|
+
* Below, the core's quote-admission exports are exported again, marked deprecated: they name functions HookrRegistry
|
|
10
|
+
* does not have on chain.
|
|
11
|
+
*/
|
|
12
|
+
import * as registry from "./core/registry.js";
|
|
13
|
+
import { kingOfTheHillPrizeBound as prizeBound } from "./core/rules.js";
|
|
14
|
+
export * from "./core/index.js";
|
|
15
|
+
export * from "./releases.js";
|
|
16
|
+
export * from "./wallet-cap.js";
|
|
17
|
+
/**
|
|
18
|
+
* The largest King of the Pool `maxPrizeBps` a recapture pool binds with: HookrRecapture's `prizeBoundFor(lpBps,
|
|
19
|
+
* burnBps, protocolShareBps, integratorBps)`, worked out offline.
|
|
9
20
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
export
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
export
|
|
21
|
+
export const kingOfThePoolPrizeBound = prizeBound;
|
|
22
|
+
/** @deprecated The same function as `kingOfThePoolPrizeBound`, under King of the Pool's earlier name. */
|
|
23
|
+
export const kingOfTheHillPrizeBound = prizeBound;
|
|
24
|
+
/** @deprecated Describes calls HookrRegistry does not have on chain. Removed in 2.0. */
|
|
25
|
+
export const QUOTE_ADMISSION_ABI = registry.QUOTE_ADMISSION_ABI;
|
|
26
|
+
/** @deprecated Names functions HookrRegistry does not have on chain. Removed in 2.0. */
|
|
27
|
+
export const QUOTE_ADMISSION_OPERATIONS = registry.QUOTE_ADMISSION_OPERATIONS;
|
|
28
|
+
/** @deprecated Checks an ABI offline; against the deployed HookrRegistry's ABI it returns false. Removed in 2.0. */
|
|
29
|
+
export const registryHasQuoteAdmission = registry.registryHasQuoteAdmission;
|
|
30
|
+
/** @deprecated Checks an ABI offline; against the deployed HookrRegistry's ABI it returns false. Removed in 2.0. */
|
|
31
|
+
export const registryHasOperation = registry.registryHasOperation;
|
|
32
|
+
/** @deprecated Calls `excludeQuoteClassNow`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
33
|
+
export const buildExcludeQuoteClass = registry.buildExcludeQuoteClass;
|
|
34
|
+
/** @deprecated Calls `stopOpenQuotesNow`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
35
|
+
export const buildStopOpenQuotes = registry.buildStopOpenQuotes;
|
|
36
|
+
/** @deprecated Encodes `quoteState()`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
37
|
+
export const encodeQuoteStateCall = registry.encodeQuoteStateCall;
|
|
38
|
+
/** @deprecated Decodes `quoteState()`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
39
|
+
export const decodeQuoteState = registry.decodeQuoteState;
|
|
40
|
+
/** @deprecated Encodes `curatedQuote(asset)`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
41
|
+
export const encodeCuratedQuoteCall = registry.encodeCuratedQuoteCall;
|
|
42
|
+
/** @deprecated Decodes `curatedQuote(asset)`, which HookrRegistry does not have on chain. Removed in 2.0. */
|
|
43
|
+
export const decodeCuratedQuote = registry.decodeCuratedQuote;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hookr on Robinhood Chain: the production release `hookr-1`, its canary `canary-hookr-1-a`, each release's
|
|
3
|
+
* deployment, the Rules modules its root admits beside the release's own, and the deployment manifest the builders take.
|
|
4
|
+
*
|
|
5
|
+
* Every address is fixed by CREATE3 from the release deployer, the release id and the contract's name, so it is known
|
|
6
|
+
* before the contract is deployed and is the same on every machine. `test/releases.test.ts` derives each one again
|
|
7
|
+
* from those inputs. The canary runs the same code at its own addresses and exists to prove a release before
|
|
8
|
+
* production; build on `HOOKR_1`.
|
|
9
|
+
*/
|
|
10
|
+
import { type Chain } from "viem";
|
|
11
|
+
import { type Address, type ContractRole, type DeploymentManifest, type Hash } from "./core/index.js";
|
|
12
|
+
/** Robinhood Chain's id. */
|
|
13
|
+
export declare const CHAIN_ID = 4663;
|
|
14
|
+
/**
|
|
15
|
+
* The chain's public, keyless RPC endpoint. Fine for a few reads. Under load it rate limits, and a wide `eth_getLogs`
|
|
16
|
+
* can come back as an empty array instead of an error, so anything that must not miss data should use a provider
|
|
17
|
+
* endpoint of its own.
|
|
18
|
+
*/
|
|
19
|
+
export declare const RPC_URL = "https://rpc.mainnet.chain.robinhood.com";
|
|
20
|
+
/** The block explorer people open: RobinScan. No trailing slash. */
|
|
21
|
+
export declare const EXPLORER_URL = "https://robin.etherscan.io";
|
|
22
|
+
/**
|
|
23
|
+
* Robinhood Chain for viem, on any viem 2, with RobinScan as its explorer. viem 2.55 and later also ship it as
|
|
24
|
+
* `robinhood` from `viem/chains`, with the same id and RPC endpoint and Blockscout as its explorer.
|
|
25
|
+
*/
|
|
26
|
+
export declare const ROBINHOOD_CHAIN: Chain;
|
|
27
|
+
/** An address's page on the explorer. */
|
|
28
|
+
export declare function explorerAddressUrl(address: Address): string;
|
|
29
|
+
/** A transaction's page on the explorer. */
|
|
30
|
+
export declare function explorerTxUrl(hash: Hash): string;
|
|
31
|
+
/** Uniswap v4's dynamic-fee flag. Every Hookr pool's `PoolKey.fee` is this: the hook sets the LP fee on each swap. */
|
|
32
|
+
export declare const DYNAMIC_FEE = 8388608;
|
|
33
|
+
/** The price limit for a `zeroForOne` swap that may fill in full: TickMath's MIN_SQRT_PRICE + 1. */
|
|
34
|
+
export declare const MIN_SQRT_PRICE_LIMIT = 4295128740n;
|
|
35
|
+
/** The price limit for a `oneForZero` swap that may fill in full: TickMath's MAX_SQRT_PRICE - 1. */
|
|
36
|
+
export declare const MAX_SQRT_PRICE_LIMIT = 1461446703485210103287273052203988822378723970341n;
|
|
37
|
+
/** Uniswap v4's PoolManager on Robinhood Chain. Every Hookr pool lives in it. */
|
|
38
|
+
export declare const POOL_MANAGER: Address;
|
|
39
|
+
/** The account that deploys both releases. CREATE3 addresses depend on it, never on a nonce. */
|
|
40
|
+
export declare const RELEASE_DEPLOYER: Address;
|
|
41
|
+
/** The CREATE3 factory both releases deploy through. */
|
|
42
|
+
export declare const CREATE3_FACTORY: Address;
|
|
43
|
+
/** The source commit both releases are built from. */
|
|
44
|
+
export declare const RELEASE_SOURCE_COMMIT = "412960b37a631ce145d49fb4a1887f04a4d1fa74";
|
|
45
|
+
/** The release digest: the hash of the build both releases deploy from. */
|
|
46
|
+
export declare const RELEASE_PACKET_DIGEST = "83962c12ff55df431612ffae8bfc66a30041eb310035cfc30eab1bb9bdc0e031";
|
|
47
|
+
/** Every contract of a release, by contract name. */
|
|
48
|
+
export interface ReleaseContracts {
|
|
49
|
+
HookrRegistryChecks: Address;
|
|
50
|
+
HookrRegistryAdmin: Address;
|
|
51
|
+
HookrRegistry: Address;
|
|
52
|
+
HookrTreasury: Address;
|
|
53
|
+
HookrForwarder: Address;
|
|
54
|
+
HookrRouter: Address;
|
|
55
|
+
HookrQuoter: Address;
|
|
56
|
+
HookrLaunchChecks: Address;
|
|
57
|
+
HookrTokenDeployer: Address;
|
|
58
|
+
HookrLauncher: Address;
|
|
59
|
+
HookrReferralRegistry: Address;
|
|
60
|
+
HookrProgramsAdmin: Address;
|
|
61
|
+
HookrPrograms: Address;
|
|
62
|
+
/** Created by HookrPrograms. */
|
|
63
|
+
HookrMilestoneNFTFactory: Address;
|
|
64
|
+
/** Created by HookrPrograms. */
|
|
65
|
+
HookrProgramValidator: Address;
|
|
66
|
+
HookrReferralDistributor: Address;
|
|
67
|
+
/** The hook every pool of the release names in `PoolKey.hooks`. */
|
|
68
|
+
HookrRoot: Address;
|
|
69
|
+
/** Created by HookrRoot: the arb recapture lane. */
|
|
70
|
+
HookrLane: Address;
|
|
71
|
+
HookrRules: Address;
|
|
72
|
+
/** Created by HookrRules: the arb recapture split. */
|
|
73
|
+
HookrRecapture: Address;
|
|
74
|
+
HookrFamilyRouter: Address;
|
|
75
|
+
HookrFamilyLock: Address;
|
|
76
|
+
HookrCompliance: Address;
|
|
77
|
+
HookrComplianceGuard: Address;
|
|
78
|
+
HookrAccountCalls: Address;
|
|
79
|
+
HookrPaymasterAdmin: Address;
|
|
80
|
+
HookrPaymaster: Address;
|
|
81
|
+
HookrRootFactory: Address;
|
|
82
|
+
HookrSessionAdvisory: Address;
|
|
83
|
+
HookrFeeAdvisory: Address;
|
|
84
|
+
HookrLiquidityVault: Address;
|
|
85
|
+
HookrOwnedProfiles: Address;
|
|
86
|
+
HookrOwnedRootsLens: Address;
|
|
87
|
+
HookrOwnedRootFactory: Address;
|
|
88
|
+
HookrLpBoost: Address;
|
|
89
|
+
}
|
|
90
|
+
export type ReleaseContractName = keyof ReleaseContracts;
|
|
91
|
+
/** The id each contract's salt is derived from. */
|
|
92
|
+
export type HookrReleaseId = "hookr-1" | "canary-hookr-1-a";
|
|
93
|
+
export interface HookrRelease {
|
|
94
|
+
/** The release id each contract's salt is derived from. */
|
|
95
|
+
releaseId: HookrReleaseId;
|
|
96
|
+
/** True for the canary: the same code at its own addresses, run before production. */
|
|
97
|
+
canary: boolean;
|
|
98
|
+
chainId: typeof CHAIN_ID;
|
|
99
|
+
contracts: Readonly<ReleaseContracts>;
|
|
100
|
+
/**
|
|
101
|
+
* The deployment as the release's verified app manifest records it, or null in a version of this package made
|
|
102
|
+
* before the release was deployed and verified. `releaseManifest` and `readReleaseManifest` use it by default.
|
|
103
|
+
*/
|
|
104
|
+
deployment: Readonly<ReleaseDeployment> | null;
|
|
105
|
+
/**
|
|
106
|
+
* The Rules modules a pool on this release's root can bind, by name: `standard`, the release's own HookrRules, and
|
|
107
|
+
* on `hookr-1` also `whole-pot`, where King of the Pool pays the round's winner the whole pot, `wallet-cap`, the
|
|
108
|
+
* whole-pot Rules with a per-wallet buy cap while the launch guard lasts (`wallet-cap.ts`), and `round-trip`, the
|
|
109
|
+
* Rules that record who traded in each block for Buy/Sell Block's round-trip check. The registry admits each on the
|
|
110
|
+
* root with the release Rules' own terms. `rulesModule` names one.
|
|
111
|
+
*/
|
|
112
|
+
rulesModules: Readonly<Partial<Record<RulesModuleName, Readonly<RulesModule>>>>;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The name of a Rules module: the release's own Rules, or beside them the whole-pot King of the Pool Rules, the Wallet
|
|
116
|
+
* Cap Rules or the round-trip Rules.
|
|
117
|
+
*/
|
|
118
|
+
export type RulesModuleName = "standard" | "whole-pot" | "wallet-cap" | "round-trip";
|
|
119
|
+
/**
|
|
120
|
+
* A HookrRules a pool can bind on the release's root (its `PoolConfig.rules`), and the HookrRecapture it created in its
|
|
121
|
+
* constructor. The Rules reach that module for every King of the Pool call, so a pool's round, pot, prize and claims
|
|
122
|
+
* live at the Rules address. Both runtime hashes are the code read back from chain.
|
|
123
|
+
*/
|
|
124
|
+
export interface RulesModule {
|
|
125
|
+
name: RulesModuleName;
|
|
126
|
+
rules: Address;
|
|
127
|
+
rulesRuntimeHash: Hash;
|
|
128
|
+
recapture: Address;
|
|
129
|
+
recaptureRuntimeHash: Hash;
|
|
130
|
+
}
|
|
131
|
+
/** The production release. Build on this one. */
|
|
132
|
+
export declare const HOOKR_1: HookrRelease;
|
|
133
|
+
/**
|
|
134
|
+
* The canary: the same contracts at their own addresses, deployed and proven before production. Not for users.
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
export declare const CANARY_HOOKR_1_A: HookrRelease;
|
|
138
|
+
/** Both releases by release id. */
|
|
139
|
+
export declare const RELEASES: Readonly<Record<HookrReleaseId, HookrRelease>>;
|
|
140
|
+
/** The contract each manifest role pins, in the order the manifest lists them. */
|
|
141
|
+
export declare const MANIFEST_ROLES: Readonly<Partial<Record<ContractRole, ReleaseContractName | "PoolManager">>>;
|
|
142
|
+
/** The address a manifest role pins in a release. */
|
|
143
|
+
export declare function releaseAddress(release: HookrRelease, role: keyof typeof MANIFEST_ROLES): Address;
|
|
144
|
+
/** What a manifest needs beyond the addresses: the deployment as the chain has it and its source verification. */
|
|
145
|
+
export interface ReleaseDeployment {
|
|
146
|
+
/** The block the manifest starts from, as a decimal string: the block the release's app manifest was read at. */
|
|
147
|
+
startBlock: string;
|
|
148
|
+
/** That block's hash. The manifest calls it `parentHash`. */
|
|
149
|
+
parentHash: Hash;
|
|
150
|
+
/** keccak256 of each role's runtime code. Every role of `MANIFEST_ROLES` needs one. */
|
|
151
|
+
runtimeHashes: Readonly<Partial<Record<ContractRole, Hash>>>;
|
|
152
|
+
/**
|
|
153
|
+
* The hash of the release's source verification records on Blockscout. The manifest carries it to say the release
|
|
154
|
+
* is verified; the builders check its form, not its content.
|
|
155
|
+
*/
|
|
156
|
+
evidenceHash: Hash;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The DeploymentManifest the builders take for a release: every role at its fixed address with its runtime hash, from
|
|
160
|
+
* the release's own deployment unless one is given, then each further Rules module (`otherRulesModules`) as one more
|
|
161
|
+
* `rules` pin with its own runtime hash, so the builders that name a Rules accept it. It makes no reads. Refuses a role
|
|
162
|
+
* without a runtime hash, and anything `deployment()` refuses.
|
|
163
|
+
*
|
|
164
|
+
* It is the builders' manifest. Its release id is the release's, `hookr-1`, so it is not the manifest a Hookr service
|
|
165
|
+
* publishes: `HookrClient` takes the release id and manifest hash the service names.
|
|
166
|
+
*/
|
|
167
|
+
export declare function releaseManifest(release: HookrRelease, d?: Readonly<ReleaseDeployment> | null): DeploymentManifest;
|
|
168
|
+
/** The release's Rules modules other than its own HookrRules: on `hookr-1`, the whole-pot, Wallet Cap and round-trip Rules. */
|
|
169
|
+
export declare function otherRulesModules(release: HookrRelease): Readonly<RulesModule>[];
|
|
170
|
+
/** The release's Rules module `name`, or an error for a release without it (the canary has only `standard`). */
|
|
171
|
+
export declare function rulesModule(release: HookrRelease, name: RulesModuleName): Readonly<RulesModule>;
|
|
172
|
+
/** The two reads `readReleaseManifest` makes. A viem PublicClient has both. */
|
|
173
|
+
export interface ReleaseReader {
|
|
174
|
+
getCode(args: {
|
|
175
|
+
address: Address;
|
|
176
|
+
blockNumber?: bigint;
|
|
177
|
+
}): Promise<`0x${string}` | undefined>;
|
|
178
|
+
getBlock(args: {
|
|
179
|
+
blockNumber: bigint;
|
|
180
|
+
}): Promise<{
|
|
181
|
+
hash: Hash | null;
|
|
182
|
+
}>;
|
|
183
|
+
}
|
|
184
|
+
/** Overrides for `readReleaseManifest`. With none, it reads the release's own deployment. */
|
|
185
|
+
export interface ReadReleaseOptions {
|
|
186
|
+
/** The block the manifest starts from. Defaults to the release's. */
|
|
187
|
+
startBlock?: bigint;
|
|
188
|
+
/** The release's source verification hash. Defaults to the release's. */
|
|
189
|
+
evidenceHash?: Hash;
|
|
190
|
+
/** The block the code is read at. Defaults to the latest. */
|
|
191
|
+
blockNumber?: bigint;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* `releaseManifest` with each role's runtime hash and the start block's hash read from chain. Refuses a role with no
|
|
195
|
+
* code: the release is not deployed, or not on this chain. Where the release carries its deployment, it also refuses
|
|
196
|
+
* a role whose code is not the release's, and a start block whose hash is not the release's. It always refuses a
|
|
197
|
+
* further Rules module whose code is not the one the release pins for it.
|
|
198
|
+
*/
|
|
199
|
+
export declare function readReleaseManifest(client: ReleaseReader, release: HookrRelease, options?: ReadReleaseOptions): Promise<DeploymentManifest>;
|
|
200
|
+
/**
|
|
201
|
+
* The gas floor a swap on an arb recapture pool must carry while its lane is on: `2 × gasCap + gasCap / 63 + 755,000`
|
|
202
|
+
* (HookrLane), the `gasFloor` `laneOf(id)` returns. At the 3,000,000 cap the lane opens with it is 6,802,619. A swap
|
|
203
|
+
* sent with less reverts `InsufficientLaneGas`. The swap's own gas comes on top: a buy on a live lane pool estimates at
|
|
204
|
+
* about 7.5 million, so a fixed limit on such a pool should be at least 8,800,000, the estimate plus a sixth.
|
|
205
|
+
*/
|
|
206
|
+
export declare function laneGasFloor(gasCap: number | bigint): bigint;
|
|
207
|
+
/** The read `readParentBlockNumber` makes. A viem PublicClient has it. */
|
|
208
|
+
export interface ParentBlockReader {
|
|
209
|
+
getBlock(args: {
|
|
210
|
+
blockTag: "latest";
|
|
211
|
+
}): Promise<unknown>;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The block number the contracts read as `block.number`: on Robinhood Chain, an Arbitrum Orbit chain, it is the parent
|
|
215
|
+
* chain's (Ethereum's), which each block carries as `l1BlockNumber`, about one every 12 seconds. Anti-Snipe's launch
|
|
216
|
+
* guard (`guardEndBlock`), and Wallet Cap with it, counts these blocks, so pass this as a launch's `blockNumber`.
|
|
217
|
+
* `getBlockNumber()` is the chain's own, far larger number: a guard counted from it is one the Rules refuse at bind.
|
|
218
|
+
*/
|
|
219
|
+
export declare function readParentBlockNumber(client: ParentBlockReader): Promise<bigint>;
|