@t3foundry/tasra-sdk 0.0.0-stage → 0.3.1-next.1
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 +148 -0
- package/LICENSE +202 -0
- package/NOTICE +94 -0
- package/README.md +137 -2
- package/SECURITY.md +115 -0
- package/dist/app/approvals.d.ts +50 -0
- package/dist/app/approvals.js +90 -0
- package/dist/app/authorization.d.ts +19 -0
- package/dist/app/authorization.js +20 -0
- package/dist/app/client.d.ts +231 -0
- package/dist/app/client.js +272 -0
- package/dist/app/creation.d.ts +73 -0
- package/dist/app/creation.js +77 -0
- package/dist/app/deployment.d.ts +36 -0
- package/dist/app/deployment.js +18 -0
- package/dist/app/identity.d.ts +211 -0
- package/dist/app/identity.js +287 -0
- package/dist/app/index.d.ts +22 -0
- package/dist/app/index.js +12 -0
- package/dist/app/manifest.d.ts +74 -0
- package/dist/app/manifest.js +120 -0
- package/dist/app/node.d.ts +30 -0
- package/dist/app/node.js +159 -0
- package/dist/app/ready-slot.d.ts +157 -0
- package/dist/app/ready-slot.js +199 -0
- package/dist/app/tasra-client.d.ts +125 -0
- package/dist/app/tasra-client.js +79 -0
- package/dist/app/viem.d.ts +10 -0
- package/dist/app/viem.js +32 -0
- package/dist/app/wallet.d.ts +126 -0
- package/dist/app/wallet.js +137 -0
- package/dist/auth/dpop.d.ts +86 -0
- package/dist/auth/dpop.js +142 -0
- package/dist/auth/holderProof.d.ts +102 -0
- package/dist/auth/holderProof.js +161 -0
- package/dist/auth/identityScope.d.ts +19 -0
- package/dist/auth/identityScope.js +82 -0
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.js +13 -0
- package/dist/auth/oid4vp.d.ts +230 -0
- package/dist/auth/oid4vp.js +780 -0
- package/dist/auth/rego/wasm/PINS.json +11 -0
- package/dist/auth/rego/wasm/keykeeper_rego_wasm.d.ts +76 -0
- package/dist/auth/rego/wasm/keykeeper_rego_wasm.js +379 -0
- package/dist/auth/rego/wasm/keykeeper_rego_wasm_bg.wasm +0 -0
- package/dist/auth/rego.d.ts +192 -0
- package/dist/auth/rego.js +492 -0
- package/dist/auth/verifier.d.ts +166 -0
- package/dist/auth/verifier.js +211 -0
- package/dist/chain/abis/accountantSetRegistry.d.ts +441 -0
- package/dist/chain/abis/accountantSetRegistry.js +574 -0
- package/dist/chain/abis/accountantSlashing.d.ts +2071 -0
- package/dist/chain/abis/accountantSlashing.js +2670 -0
- package/dist/chain/abis/bondingCurve.d.ts +398 -0
- package/dist/chain/abis/bondingCurve.js +521 -0
- package/dist/chain/abis/equivocationSlasher.d.ts +292 -0
- package/dist/chain/abis/equivocationSlasher.js +379 -0
- package/dist/chain/abis/fixedTasraPriceOracle.d.ts +52 -0
- package/dist/chain/abis/fixedTasraPriceOracle.js +72 -0
- package/dist/chain/abis/index.d.ts +12801 -0
- package/dist/chain/abis/index.js +64 -0
- package/dist/chain/abis/keeperShareRegistry.d.ts +519 -0
- package/dist/chain/abis/keeperShareRegistry.js +675 -0
- package/dist/chain/abis/keyRegistry.d.ts +2421 -0
- package/dist/chain/abis/keyRegistry.js +3114 -0
- package/dist/chain/abis/livenessRegistry.d.ts +402 -0
- package/dist/chain/abis/livenessRegistry.js +524 -0
- package/dist/chain/abis/mockEurc.d.ts +210 -0
- package/dist/chain/abis/mockEurc.js +276 -0
- package/dist/chain/abis/nodeRegistry.d.ts +1630 -0
- package/dist/chain/abis/nodeRegistry.js +2113 -0
- package/dist/chain/abis/platformExecutor.d.ts +328 -0
- package/dist/chain/abis/platformExecutor.js +429 -0
- package/dist/chain/abis/prevrandaoSaltBeacon.d.ts +16 -0
- package/dist/chain/abis/prevrandaoSaltBeacon.js +24 -0
- package/dist/chain/abis/serviceRegistry.d.ts +556 -0
- package/dist/chain/abis/serviceRegistry.js +719 -0
- package/dist/chain/abis/settlement.d.ts +1624 -0
- package/dist/chain/abis/settlement.js +2096 -0
- package/dist/chain/abis/tasraSwapRouter.d.ts +92 -0
- package/dist/chain/abis/tasraSwapRouter.js +122 -0
- package/dist/chain/abis/tasraToken.d.ts +455 -0
- package/dist/chain/abis/tasraToken.js +599 -0
- package/dist/chain/abis/tasraVestingVault.d.ts +165 -0
- package/dist/chain/abis/tasraVestingVault.js +215 -0
- package/dist/chain/abis/thresholdRandomBeacon.d.ts +378 -0
- package/dist/chain/abis/thresholdRandomBeacon.js +494 -0
- package/dist/chain/abis/treasury.d.ts +301 -0
- package/dist/chain/abis/treasury.js +390 -0
- package/dist/chain/abis/verifierSetRegistry.d.ts +445 -0
- package/dist/chain/abis/verifierSetRegistry.js +579 -0
- package/dist/chain/client.d.ts +212 -0
- package/dist/chain/client.js +576 -0
- package/dist/chain/commitmentRecovery.d.ts +21 -0
- package/dist/chain/commitmentRecovery.js +44 -0
- package/dist/chain/committeeClient.d.ts +102 -0
- package/dist/chain/committeeClient.js +137 -0
- package/dist/chain/deployments.d.ts +56 -0
- package/dist/chain/deployments.js +269 -0
- package/dist/chain/discovery.d.ts +49 -0
- package/dist/chain/discovery.js +107 -0
- package/dist/chain/events.d.ts +58 -0
- package/dist/chain/events.js +125 -0
- package/dist/chain/format.d.ts +25 -0
- package/dist/chain/format.js +51 -0
- package/dist/chain/index.d.ts +41 -0
- package/dist/chain/index.js +56 -0
- package/dist/chain/manifest.d.ts +165 -0
- package/dist/chain/manifest.js +132 -0
- package/dist/chain/network-profiles.json +75 -0
- package/dist/chain/networks.d.ts +73 -0
- package/dist/chain/networks.js +62 -0
- package/dist/chain/node.d.ts +44 -0
- package/dist/chain/node.js +176 -0
- package/dist/chain/offchain.d.ts +149 -0
- package/dist/chain/offchain.js +73 -0
- package/dist/chain/provisionRule.d.ts +164 -0
- package/dist/chain/provisionRule.js +212 -0
- package/dist/chain/registeredAgent.d.ts +64 -0
- package/dist/chain/registeredAgent.js +140 -0
- package/dist/chain/registeredOperation.d.ts +49 -0
- package/dist/chain/registeredOperation.js +136 -0
- package/dist/chain/registeredRelay.d.ts +206 -0
- package/dist/chain/registeredRelay.js +312 -0
- package/dist/chain/revertReason.d.ts +14 -0
- package/dist/chain/revertReason.js +62 -0
- package/dist/chain/ruleAmendment.d.ts +80 -0
- package/dist/chain/ruleAmendment.js +195 -0
- package/dist/chain/ruleAmendmentCore.d.ts +129 -0
- package/dist/chain/ruleAmendmentCore.js +152 -0
- package/dist/chain/ruleInput.d.ts +10 -0
- package/dist/chain/ruleInput.js +13 -0
- package/dist/chain/serviceIdentity.d.ts +176 -0
- package/dist/chain/serviceIdentity.js +237 -0
- package/dist/chain/serviceProfiles.d.ts +39 -0
- package/dist/chain/serviceProfiles.js +74 -0
- package/dist/chain/services.d.ts +141 -0
- package/dist/chain/services.js +79 -0
- package/dist/chain/slotClient.d.ts +55 -0
- package/dist/chain/slotClient.js +62 -0
- package/dist/chain/slotSeed.d.ts +31 -0
- package/dist/chain/slotSeed.js +98 -0
- package/dist/chain/write.d.ts +431 -0
- package/dist/chain/write.js +958 -0
- package/dist/client/client.d.ts +112 -0
- package/dist/client/client.js +111 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +2 -0
- package/dist/client/session.d.ts +67 -0
- package/dist/client/session.js +238 -0
- package/dist/committee/client.d.ts +284 -0
- package/dist/committee/client.js +351 -0
- package/dist/committee/dual-sign.d.ts +110 -0
- package/dist/committee/dual-sign.js +202 -0
- package/dist/committee/ecdsa.d.ts +36 -0
- package/dist/committee/ecdsa.js +45 -0
- package/dist/committee/extraction.d.ts +82 -0
- package/dist/committee/extraction.js +96 -0
- package/dist/committee/index.d.ts +19 -0
- package/dist/committee/index.js +13 -0
- package/dist/committee/oauth.d.ts +51 -0
- package/dist/committee/oauth.js +90 -0
- package/dist/committee/receipts.d.ts +51 -0
- package/dist/committee/receipts.js +59 -0
- package/dist/committee/request.d.ts +264 -0
- package/dist/committee/request.js +305 -0
- package/dist/committee/token.d.ts +274 -0
- package/dist/committee/token.js +418 -0
- package/dist/crypto/constants.d.ts +10 -0
- package/dist/crypto/constants.js +32 -0
- package/dist/crypto/detect.d.ts +20 -0
- package/dist/crypto/detect.js +44 -0
- package/dist/crypto/envelope.d.ts +60 -0
- package/dist/crypto/envelope.js +243 -0
- package/dist/crypto/frost.d.ts +49 -0
- package/dist/crypto/frost.js +152 -0
- package/dist/crypto/hex.d.ts +7 -0
- package/dist/crypto/hex.js +24 -0
- package/dist/crypto/ibe-blob.d.ts +114 -0
- package/dist/crypto/ibe-blob.js +208 -0
- package/dist/crypto/ibe.d.ts +88 -0
- package/dist/crypto/ibe.js +262 -0
- package/dist/crypto/index.d.ts +12 -0
- package/dist/crypto/index.js +12 -0
- package/dist/crypto/kem.d.ts +55 -0
- package/dist/crypto/kem.js +241 -0
- package/dist/decryption/client.d.ts +64 -0
- package/dist/decryption/client.js +82 -0
- package/dist/decryption/index.d.ts +2 -0
- package/dist/decryption/index.js +2 -0
- package/dist/errors.d.ts +124 -0
- package/dist/errors.js +167 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +98 -0
- package/dist/keys/index.d.ts +1 -0
- package/dist/keys/index.js +4 -0
- package/dist/keys/node-client.d.ts +27 -0
- package/dist/keys/node-client.js +97 -0
- package/dist/oid4vp/binding.d.ts +76 -0
- package/dist/oid4vp/binding.js +118 -0
- package/dist/oid4vp/did-web.d.ts +49 -0
- package/dist/oid4vp/did-web.js +57 -0
- package/dist/oid4vp/index.d.ts +9 -0
- package/dist/oid4vp/index.js +10 -0
- package/dist/oid4vp/jose.d.ts +166 -0
- package/dist/oid4vp/jose.js +242 -0
- package/dist/oid4vp/jwe.d.ts +30 -0
- package/dist/oid4vp/jwe.js +93 -0
- package/dist/oid4vp/oid4vci.d.ts +84 -0
- package/dist/oid4vp/oid4vci.js +85 -0
- package/dist/oid4vp/request-object.d.ts +109 -0
- package/dist/oid4vp/request-object.js +96 -0
- package/dist/oid4vp/sd-jwt.d.ts +177 -0
- package/dist/oid4vp/sd-jwt.js +208 -0
- package/dist/oid4vp/verifier-agent.d.ts +161 -0
- package/dist/oid4vp/verifier-agent.js +132 -0
- package/dist/oid4vp/wallet.d.ts +116 -0
- package/dist/oid4vp/wallet.js +108 -0
- package/dist/recipient/store.d.ts +67 -0
- package/dist/recipient/store.js +98 -0
- package/dist/signing/ecdsa.d.ts +49 -0
- package/dist/signing/ecdsa.js +79 -0
- package/dist/signing/frost.d.ts +88 -0
- package/dist/signing/frost.js +145 -0
- package/dist/signing/index.d.ts +4 -0
- package/dist/signing/index.js +3 -0
- package/dist/slots/faucet.d.ts +23 -0
- package/dist/slots/faucet.js +35 -0
- package/dist/slots/index.d.ts +2 -0
- package/dist/slots/index.js +4 -0
- package/dist/verifier-agent/index.d.ts +241 -0
- package/dist/verifier-agent/index.js +411 -0
- package/docs/DEVELOPER-EXPERIENCE.md +62 -0
- package/docs/README.md +33 -0
- package/docs/access-control.md +76 -0
- package/docs/ai-development.md +292 -0
- package/docs/api.md +338 -0
- package/docs/application-api.md +335 -0
- package/docs/architecture.md +65 -0
- package/docs/basics.md +48 -0
- package/docs/capabilities.md +86 -0
- package/docs/chain.md +153 -0
- package/docs/compatibility.md +36 -0
- package/docs/consumer-migrations.md +80 -0
- package/docs/create-slot.md +104 -0
- package/docs/document-signing.md +243 -0
- package/docs/encrypted-notes.md +129 -0
- package/docs/encryption.md +100 -0
- package/docs/errors.md +76 -0
- package/docs/flows.md +289 -0
- package/docs/fuji.md +127 -0
- package/docs/funding.md +126 -0
- package/docs/getting-started.md +94 -0
- package/docs/glossary.md +44 -0
- package/docs/installation.md +132 -0
- package/docs/manage-slot.md +95 -0
- package/docs/native-approvals.md +124 -0
- package/docs/prerequisites.md +137 -0
- package/docs/read-slot.md +41 -0
- package/docs/reference/README.md +30 -0
- package/docs/reference/app-node.md +102 -0
- package/docs/reference/app.md +1737 -0
- package/docs/reference/chain-node.md +159 -0
- package/docs/reference/chain.md +3609 -0
- package/docs/reference/committee.md +2176 -0
- package/docs/reference/main.md +4068 -0
- package/docs/reference/oid4vp.md +2547 -0
- package/docs/reference/verifier-agent.md +498 -0
- package/docs/shared-account.md +168 -0
- package/docs/signing-and-encryption.md +52 -0
- package/docs/signing.md +172 -0
- package/examples/committee-slot.ts +16 -0
- package/examples/connect-fuji.ts +41 -0
- package/examples/connect-network.ts +14 -0
- package/examples/credential-approvals.ts +46 -0
- package/examples/document-signing/README.md +59 -0
- package/examples/document-signing/backend.ts +132 -0
- package/examples/document-signing/build.mjs +19 -0
- package/examples/document-signing/config.ts +34 -0
- package/examples/document-signing/gitignore.template +9 -0
- package/examples/document-signing/model.ts +140 -0
- package/examples/document-signing/network.ts +58 -0
- package/examples/document-signing/package.json +25 -0
- package/examples/document-signing/public/index.html +27 -0
- package/examples/document-signing/public/sample.pdf +31 -0
- package/examples/document-signing/public/styles.css +531 -0
- package/examples/document-signing/server.ts +358 -0
- package/examples/document-signing/setup.ts +111 -0
- package/examples/document-signing/store.ts +105 -0
- package/examples/document-signing/tsconfig.json +24 -0
- package/examples/document-signing/verify.ts +24 -0
- package/examples/document-signing/web/app.ts +312 -0
- package/examples/document-signing/web/preview.ts +67 -0
- package/examples/document-signing/web/wallet.ts +146 -0
- package/examples/document-signing/workflow.test.ts +228 -0
- package/examples/document-signing/workflow.ts +241 -0
- package/examples/document-signing.ts +96 -0
- package/examples/encrypted-notes.ts +86 -0
- package/examples/ethers-signer.ts +204 -0
- package/examples/fund-slot.ts +73 -0
- package/examples/getting-started.ts +25 -0
- package/examples/learning-authorize.ts +23 -0
- package/examples/learning-cancel-slot.ts +11 -0
- package/examples/learning-context.ts +28 -0
- package/examples/learning-create-slot.ts +25 -0
- package/examples/learning-read-slot.ts +8 -0
- package/examples/learning-renew-slot.ts +12 -0
- package/examples/learning-sign.ts +8 -0
- package/examples/live-config.ts +71 -0
- package/examples/minimal.ts +6 -0
- package/examples/native-approvals.ts +57 -0
- package/examples/network.ts +58 -0
- package/examples/offline.ts +16 -0
- package/examples/personal-vault.ts +20 -0
- package/examples/provision-slot.ts +47 -0
- package/examples/shared-account.ts +46 -0
- package/examples/slot-address.ts +13 -0
- package/examples/slot-creation.ts +9 -0
- package/examples/tutorial-negative.ts +26 -0
- package/examples/tutorial-support.ts +76 -0
- package/examples/viem-account.ts +203 -0
- package/package.json +303 -4
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { type PublicClient, type ReadContractReturnType } from 'viem';
|
|
2
|
+
import { type ContractName } from './abis/index.js';
|
|
3
|
+
import { type ServiceRegistryReaders } from './services.js';
|
|
4
|
+
import { nodeRegistryAbi } from './abis/nodeRegistry.js';
|
|
5
|
+
import { keyRegistryAbi } from './abis/keyRegistry.js';
|
|
6
|
+
import { settlementAbi } from './abis/settlement.js';
|
|
7
|
+
import { tasraTokenAbi } from './abis/tasraToken.js';
|
|
8
|
+
import { bondingCurveAbi } from './abis/bondingCurve.js';
|
|
9
|
+
import { treasuryAbi } from './abis/treasury.js';
|
|
10
|
+
import { tasraVestingVaultAbi } from './abis/tasraVestingVault.js';
|
|
11
|
+
import { thresholdRandomBeaconAbi } from './abis/thresholdRandomBeacon.js';
|
|
12
|
+
import { verifierSetRegistryAbi } from './abis/verifierSetRegistry.js';
|
|
13
|
+
import { type AddressBook, type Address, type VaultTranche } from './deployments.js';
|
|
14
|
+
import { type DecodedEvent } from './events.js';
|
|
15
|
+
/** Multicall3's canonical, deterministic-deployment address. */
|
|
16
|
+
export declare const MULTICALL3_ADDRESS: Address;
|
|
17
|
+
/**
|
|
18
|
+
* RPC and contract configuration for read-only network access.
|
|
19
|
+
*/
|
|
20
|
+
export interface ChainClientConfig {
|
|
21
|
+
/** JSON-RPC HTTP endpoint of the chain. */
|
|
22
|
+
rpcUrl: string;
|
|
23
|
+
/** Resolved deployment addresses. */
|
|
24
|
+
addresses: AddressBook;
|
|
25
|
+
/** Chain id; defaults to DEFAULT_CHAIN_ID (the RPC is never consulted). */
|
|
26
|
+
chainId?: number;
|
|
27
|
+
/** getLogs block-window size; keep <= the RPC's range cap (anvil/besu: large; public: ~2k). */
|
|
28
|
+
logWindow?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Multicall3 address for batching. Omit to probe the canonical address, supply an explicit address to probe that deployment, or set false to disable batching. Unavailable batching falls back to individual reads.
|
|
31
|
+
*/
|
|
32
|
+
multicall3?: Address | false;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Controls whether a failed contract read rejects the batch or leaves a null result.
|
|
36
|
+
*/
|
|
37
|
+
export interface ReadManyOpts {
|
|
38
|
+
/**
|
|
39
|
+
* What a failing item does.
|
|
40
|
+
*
|
|
41
|
+
* - `true` (default) - the item is `null` in place. One unreadable operator must not
|
|
42
|
+
* blank the whole set.
|
|
43
|
+
* - `false` - any failing item rejects the call. Required whenever position carries
|
|
44
|
+
* meaning: dropping one operator from an ordered set shifts every index after it,
|
|
45
|
+
* which silently changes what the caller is looking at.
|
|
46
|
+
*/
|
|
47
|
+
allowFailure?: boolean;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Inclusive block range, contract filter and progress callback for event scanning.
|
|
51
|
+
*/
|
|
52
|
+
export interface GetLogsWindowedOpts {
|
|
53
|
+
/** First block to scan, inclusive. */
|
|
54
|
+
fromBlock: bigint;
|
|
55
|
+
/** Last block to scan, inclusive. */
|
|
56
|
+
toBlock: bigint;
|
|
57
|
+
/** Restrict to these contracts (default: all present in the AddressBook). */
|
|
58
|
+
contracts?: ContractName[];
|
|
59
|
+
/** Number of blocks per query; defaults to the client logWindow setting. */
|
|
60
|
+
windowSize?: number;
|
|
61
|
+
/** Called after each window with the last block scanned (progress). */
|
|
62
|
+
onWindow?: (toBlock: bigint, events: DecodedEvent[]) => void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Typed reads of registered operators, their roles, activity and stake requirements.
|
|
66
|
+
*/
|
|
67
|
+
export interface NodeRegistryReaders {
|
|
68
|
+
nodeOf(op: Address): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'nodeOf'>>;
|
|
69
|
+
isActive(op: Address): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'isActive'>>;
|
|
70
|
+
operatorCount(): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'operatorCount'>>;
|
|
71
|
+
operatorAt(i: bigint): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'operatorAt'>>;
|
|
72
|
+
activeCount(): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'activeCount'>>;
|
|
73
|
+
attributesOf(op: Address): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'attributesOf'>>;
|
|
74
|
+
rewardBalanceOf(op: Address): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'rewardBalanceOf'>>;
|
|
75
|
+
requiredStake(): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'requiredStake'>>;
|
|
76
|
+
operatorIdOf(op: Address): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'operatorIdOf'>>;
|
|
77
|
+
hasTag(op: Address, tag: `0x${string}`): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'hasTag'>>;
|
|
78
|
+
activeOperators(): Promise<ReadContractReturnType<typeof nodeRegistryAbi, 'activeOperators'>>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Typed reads of slots, assigned keepers and creation or verifier policies.
|
|
82
|
+
*/
|
|
83
|
+
export interface KeyRegistryReaders {
|
|
84
|
+
getKeySlot(id: `0x${string}`): Promise<ReadContractReturnType<typeof keyRegistryAbi, 'getKeySlot'>>;
|
|
85
|
+
assignedNodes(id: `0x${string}`): Promise<ReadContractReturnType<typeof keyRegistryAbi, 'assignedNodes'>>;
|
|
86
|
+
requiresCommitReveal(): Promise<ReadContractReturnType<typeof keyRegistryAbi, 'requireCommitReveal'>>;
|
|
87
|
+
verifierPolicy(id: `0x${string}`): Promise<ReadContractReturnType<typeof keyRegistryAbi, 'verifierPolicy'>>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Typed reads of prepaid slot balances, settlement nonces and revenue allocation.
|
|
91
|
+
*/
|
|
92
|
+
export interface SettlementReaders {
|
|
93
|
+
balanceOf(slot: `0x${string}`): Promise<ReadContractReturnType<typeof settlementAbi, 'balanceOf'>>;
|
|
94
|
+
lastNonce(slot: `0x${string}`): Promise<ReadContractReturnType<typeof settlementAbi, 'lastNonce'>>;
|
|
95
|
+
revenueSplit(): Promise<ReadContractReturnType<typeof settlementAbi, 'revenueSplit'>>;
|
|
96
|
+
totalHeld(): Promise<ReadContractReturnType<typeof settlementAbi, 'totalHeld'>>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Typed reads of TSRA supply, account balances and token metadata.
|
|
100
|
+
*/
|
|
101
|
+
export interface TokenReaders {
|
|
102
|
+
totalSupply(): Promise<ReadContractReturnType<typeof tasraTokenAbi, 'totalSupply'>>;
|
|
103
|
+
balanceOf(a: Address): Promise<ReadContractReturnType<typeof tasraTokenAbi, 'balanceOf'>>;
|
|
104
|
+
symbol(): Promise<ReadContractReturnType<typeof tasraTokenAbi, 'symbol'>>;
|
|
105
|
+
decimals(): Promise<ReadContractReturnType<typeof tasraTokenAbi, 'decimals'>>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Typed reads of token-sale prices, sold supply and EURC reserves.
|
|
109
|
+
*/
|
|
110
|
+
export interface BondingCurveReaders {
|
|
111
|
+
spotPrice(): Promise<ReadContractReturnType<typeof bondingCurveAbi, 'spotPrice'>>;
|
|
112
|
+
weightedAvgPrice365d(): Promise<ReadContractReturnType<typeof bondingCurveAbi, 'weightedAvgPrice365d'>>;
|
|
113
|
+
soldTokens(): Promise<ReadContractReturnType<typeof bondingCurveAbi, 'soldTokens'>>;
|
|
114
|
+
reserve(): Promise<ReadContractReturnType<typeof bondingCurveAbi, 'reserve'>>;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Typed reads of the treasury balance.
|
|
118
|
+
*/
|
|
119
|
+
export interface TreasuryReaders {
|
|
120
|
+
balance(): Promise<ReadContractReturnType<typeof treasuryAbi, 'balance'>>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Typed reads of randomness epochs, seeds and the threshold public key.
|
|
124
|
+
*/
|
|
125
|
+
export interface BeaconReaders {
|
|
126
|
+
seed(): Promise<ReadContractReturnType<typeof thresholdRandomBeaconAbi, 'seed'>>;
|
|
127
|
+
epoch(): Promise<ReadContractReturnType<typeof thresholdRandomBeaconAbi, 'epoch'>>;
|
|
128
|
+
seedAt(epoch: bigint): Promise<ReadContractReturnType<typeof thresholdRandomBeaconAbi, 'seedAt'>>;
|
|
129
|
+
lastUpdate(): Promise<ReadContractReturnType<typeof thresholdRandomBeaconAbi, 'lastUpdate'>>;
|
|
130
|
+
mpk(): Promise<ReadContractReturnType<typeof thresholdRandomBeaconAbi, 'mpk'>>;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Typed reads of anchored verifier-set snapshots by epoch.
|
|
134
|
+
*/
|
|
135
|
+
export interface VerifierSetReaders {
|
|
136
|
+
snapshotAt(epoch: bigint): Promise<ReadContractReturnType<typeof verifierSetRegistryAbi, 'snapshotAt'>>;
|
|
137
|
+
}
|
|
138
|
+
/** Readers for one vesting tranche. `address` is the de-duplication key. */
|
|
139
|
+
export interface VaultReaders {
|
|
140
|
+
address(): Address;
|
|
141
|
+
released(): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'released'>>;
|
|
142
|
+
remaining(): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'remaining'>>;
|
|
143
|
+
totalLocked(): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'totalLocked'>>;
|
|
144
|
+
startTime(): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'startTime'>>;
|
|
145
|
+
cliffDuration(): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'cliffDuration'>>;
|
|
146
|
+
linearDuration(): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'linearDuration'>>;
|
|
147
|
+
unlockedAt(ts: bigint): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'unlockedAt'>>;
|
|
148
|
+
beneficiary(): Promise<ReadContractReturnType<typeof tasraVestingVaultAbi, 'beneficiary'>>;
|
|
149
|
+
}
|
|
150
|
+
/** Typed view-function readers, grouped by contract. */
|
|
151
|
+
export interface TasraChainReaders {
|
|
152
|
+
serviceRegistry: ServiceRegistryReaders;
|
|
153
|
+
nodeRegistry: NodeRegistryReaders;
|
|
154
|
+
keyRegistry: KeyRegistryReaders;
|
|
155
|
+
settlement: SettlementReaders;
|
|
156
|
+
token: TokenReaders;
|
|
157
|
+
bondingCurve: BondingCurveReaders;
|
|
158
|
+
treasury: TreasuryReaders;
|
|
159
|
+
vault(tranche: VaultTranche): VaultReaders;
|
|
160
|
+
beacon: BeaconReaders;
|
|
161
|
+
verifierSet: VerifierSetReaders;
|
|
162
|
+
}
|
|
163
|
+
/** A read client for a deployment: a configured viem client, log helpers and typed readers. */
|
|
164
|
+
export interface TasraChainClient {
|
|
165
|
+
/**
|
|
166
|
+
* The configured viem public client. No wallet, no signing.
|
|
167
|
+
*
|
|
168
|
+
* not multicall-batched: batching is applied explicitly in {@link readMany}, so a
|
|
169
|
+
* chain without Multicall3 keeps working. Firing many reads concurrently through this
|
|
170
|
+
* client costs one request each - go through `readMany` for a per-item fan-out.
|
|
171
|
+
*/
|
|
172
|
+
client: PublicClient;
|
|
173
|
+
/** The deployment's resolved contract addresses. */
|
|
174
|
+
addresses: AddressBook;
|
|
175
|
+
/** Return known contract names with configured addresses; this does not probe their deployed code. */
|
|
176
|
+
deployedContracts(): ContractName[];
|
|
177
|
+
/** Return distinct configured event-source addresses and their ABIs, including vesting tranches. */
|
|
178
|
+
logSources(contracts?: ContractName[]): Array<{
|
|
179
|
+
address: Address;
|
|
180
|
+
contract: ContractName;
|
|
181
|
+
}>;
|
|
182
|
+
/** Read one view function across many argument lists. Batched via Multicall3 when
|
|
183
|
+
* available; a failing item is `null` unless `allowFailure: false`. */
|
|
184
|
+
readMany<T>(contract: ContractName, functionName: string, argsList: readonly unknown[][], opts?: ReadManyOpts & {
|
|
185
|
+
allowFailure?: true;
|
|
186
|
+
}): Promise<Array<T | null>>;
|
|
187
|
+
readMany<T>(contract: ContractName, functionName: string, argsList: readonly unknown[][], opts: ReadManyOpts & {
|
|
188
|
+
allowFailure: false;
|
|
189
|
+
}): Promise<T[]>;
|
|
190
|
+
/**
|
|
191
|
+
* The Multicall3 address `readMany` will batch through, or `null` when it will read
|
|
192
|
+
* items individually. Resolved once per client and cached; exposed so a caller can
|
|
193
|
+
* see which mode it is in rather than inferring it from request counts.
|
|
194
|
+
*/
|
|
195
|
+
multicallAddress(): Promise<Address | null>;
|
|
196
|
+
/** Read the current chain block number from the configured RPC. */
|
|
197
|
+
getBlockNumber(): Promise<bigint>;
|
|
198
|
+
/** Scan an inclusive block range in windows and return decoded events. */
|
|
199
|
+
getLogsWindowed(opts: GetLogsWindowedOpts): Promise<DecodedEvent[]>;
|
|
200
|
+
/** Read Unix timestamps in seconds, keyed by decimal block-number strings. */
|
|
201
|
+
getBlockTimestamps(blockNumbers: Iterable<bigint>): Promise<Map<string, number>>;
|
|
202
|
+
/** Call a named read function through the configured address and known contract ABI. */
|
|
203
|
+
read<C extends ContractName>(contract: C, functionName: string, args?: readonly unknown[]): Promise<unknown>;
|
|
204
|
+
/** Contract-specific read methods bound to the configured deployment. */
|
|
205
|
+
readers: TasraChainReaders;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Create a read-only chain client with typed contract readers and windowed event queries. Configure addresses and the chain ID from a network manifest downloaded from tasra-releases.
|
|
209
|
+
* @param cfg RPC endpoint, deployed addresses, chain ID and optional batching limits.
|
|
210
|
+
* @returns Client exposing the viem public client, readers, event queries and address book.
|
|
211
|
+
*/
|
|
212
|
+
export declare function createTasraChainClient(cfg: ChainClientConfig): TasraChainClient;
|