/** * EIP-712 domain and type builders for Data Portability protocol writes. * * These helpers are shared primitives only. Personal Server runtimes own when * to sign and submit these payloads. * * @category Protocol */ import type { TypedDataDomain } from "viem"; export interface DataPortabilityContracts { dataRegistry: string; dataPortabilityPermissions: string; dataPortabilityServer: string; dataPortabilityGrantees: string; dataPortabilityEscrow: string; feeRegistry: string; } export declare const NATIVE_VANA_ASSET: "0x0000000000000000000000000000000000000000"; export interface DataPortabilityGatewayConfig { chainId: number; contracts: DataPortabilityContracts; } export declare function dataRegistryDomain(config: DataPortabilityGatewayConfig): TypedDataDomain; export declare function grantRegistrationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain; export declare function grantRevocationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain; export declare function serverRegistrationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain; export declare function builderRegistrationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain; export declare function escrowPaymentDomain(config: DataPortabilityGatewayConfig): TypedDataDomain; /** * Domain for a gateway-authorized escrow withdrawal. * * Withdrawals use the escrow contract as their verifying contract, just like * generic payments. The distinct primary type prevents a payment signature * from authorizing a withdrawal. */ export declare function withdrawAuthorizationDomain(config: DataPortabilityGatewayConfig): TypedDataDomain; export declare const GRANT_REGISTRATION_TYPES: { readonly GrantRegistration: readonly [{ readonly name: "grantorAddress"; readonly type: "address"; }, { readonly name: "granteeId"; readonly type: "bytes32"; }, { readonly name: "scopes"; readonly type: "string[]"; }, { readonly name: "grantVersion"; readonly type: "uint256"; }, { readonly name: "expiresAt"; readonly type: "uint256"; }]; }; export declare const GRANT_REVOCATION_TYPES: { readonly GrantRevocation: readonly [{ readonly name: "grantorAddress"; readonly type: "address"; }, { readonly name: "grantId"; readonly type: "bytes32"; }, { readonly name: "grantVersion"; readonly type: "uint256"; }]; }; export declare const SERVER_REGISTRATION_TYPES: { readonly ServerRegistration: readonly [{ readonly name: "ownerAddress"; readonly type: "address"; }, { readonly name: "serverAddress"; readonly type: "address"; }, { readonly name: "publicKey"; readonly type: "string"; }, { readonly name: "serverUrl"; readonly type: "string"; }]; }; export declare const BUILDER_REGISTRATION_TYPES: { readonly BuilderRegistration: readonly [{ readonly name: "ownerAddress"; readonly type: "address"; }, { readonly name: "granteeAddress"; readonly type: "address"; }, { readonly name: "publicKey"; readonly type: "string"; }, { readonly name: "appUrl"; readonly type: "string"; }]; }; export declare const GENERIC_PAYMENT_TYPES: { readonly GenericPayment: readonly [{ readonly name: "payerAddress"; readonly type: "address"; }, { readonly name: "opType"; readonly type: "string"; }, { readonly name: "opId"; readonly type: "bytes32"; }, { readonly name: "asset"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }, { readonly name: "paymentNonce"; readonly type: "uint256"; }]; }; /** * Authorization consumed by `POST /v1/escrow/withdraw`. * * The current escrow contract always pays `account` itself. Do not add an * unsigned recipient field: a future recipient capability must be introduced * as a new, signed protocol type after the contract and gateway support it. */ export declare const WITHDRAW_AUTHORIZATION_TYPES: { readonly WithdrawAuthorization: readonly [{ readonly name: "account"; readonly type: "address"; }, { readonly name: "asset"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }, { readonly name: "withdrawNonce"; readonly type: "uint256"; }, { readonly name: "deadline"; readonly type: "uint256"; }]; }; export declare const ADD_DATA_TYPES: { readonly AddData: readonly [{ readonly name: "ownerAddress"; readonly type: "address"; }, { readonly name: "scope"; readonly type: "string"; }, { readonly name: "dataHash"; readonly type: "bytes32"; }, { readonly name: "metadataHash"; readonly type: "bytes32"; }, { readonly name: "expectedVersion"; readonly type: "uint256"; }]; }; export declare const RECORD_DATA_ACCESS_TYPES: { readonly RecordDataAccess: readonly [{ readonly name: "ownerAddress"; readonly type: "address"; }, { readonly name: "scope"; readonly type: "string"; }, { readonly name: "version"; readonly type: "uint256"; }, { readonly name: "accessor"; readonly type: "address"; }, { readonly name: "recordId"; readonly type: "bytes32"; }]; }; export interface GrantRegistrationMessage { grantorAddress: `0x${string}`; granteeId: `0x${string}`; scopes: string[]; grantVersion: bigint; expiresAt: bigint; } export interface GrantRevocationMessage { grantorAddress: `0x${string}`; grantId: `0x${string}`; grantVersion: bigint; } export interface ServerRegistrationMessage { ownerAddress: `0x${string}`; serverAddress: `0x${string}`; publicKey: string; serverUrl: string; } export interface BuilderRegistrationMessage { ownerAddress: `0x${string}`; granteeAddress: `0x${string}`; publicKey: string; appUrl: string; } export interface GenericPaymentMessage { payerAddress: `0x${string}`; opType: string; opId: `0x${string}`; asset: `0x${string}`; amount: bigint; paymentNonce: bigint; } /** EIP-712 message authorizing a withdrawal of an account's escrow balance. */ export interface WithdrawAuthorizationMessage { /** The escrow account to debit and the withdrawal recipient. */ account: `0x${string}`; /** Native VANA sentinel or the ERC-20 asset contract. */ asset: `0x${string}`; /** Base-unit amount. */ amount: bigint; /** Caller-managed, strictly increasing nonce for newly accepted intents. */ withdrawNonce: bigint; /** Unix seconds. Bounds first acceptance; exact accepted retries remain valid. */ deadline: bigint; } /** Builds the typed data a wallet must sign before calling the withdraw API. */ export declare function buildWithdrawAuthorizationTypedData(config: DataPortabilityGatewayConfig, message: WithdrawAuthorizationMessage): { domain: TypedDataDomain; types: { readonly WithdrawAuthorization: readonly [{ readonly name: "account"; readonly type: "address"; }, { readonly name: "asset"; readonly type: "address"; }, { readonly name: "amount"; readonly type: "uint256"; }, { readonly name: "withdrawNonce"; readonly type: "uint256"; }, { readonly name: "deadline"; readonly type: "uint256"; }]; }; primaryType: "WithdrawAuthorization"; message: WithdrawAuthorizationMessage; }; export interface AddDataMessage { ownerAddress: `0x${string}`; scope: string; dataHash: `0x${string}`; metadataHash: `0x${string}`; expectedVersion: bigint; } export interface RecordDataAccessMessage { ownerAddress: `0x${string}`; scope: string; version: bigint; accessor: `0x${string}`; recordId: `0x${string}`; }