UNPKG

@agoric/zoe

Version:

Zoe: the Smart Contract Framework for Offer Enforcement

180 lines • 7.79 kB
type SeatData = { proposal: ProposalRecord; initialAllocation: Allocation; seatHandle: SeatHandle; offerArgs?: object; }; /** * Given an allocation, withdraw payments to create a payout */ type WithdrawPayments = (allocation: Allocation) => PaymentPKeywordRecord; type WithdrawFacet = { withdrawPayments: (allocation: Allocation) => PaymentPKeywordRecord; }; type InstanceAdminHelper = { exitZoeSeatAdmin: (zoeSeatAdmin: ZoeSeatAdmin) => void; hasExited: (zoeSeatAdmin: ZoeSeatAdmin) => boolean; }; type ZoeSeatAdminKit = { userSeat: UserSeat; zoeSeatAdmin: ZoeSeatAdmin; }; /** * Make the Zoe seat admin, user seat and a notifier */ type MakeZoeSeatAdminKit = (initialAllocation: Allocation, instanceAdminHelper: InstanceAdminHelper, proposal: ProposalRecord, withdrawFacet: WithdrawFacet, exitObj: ERef<ExitObj>, offerResult?: ERef<unknown>, baggage: Baggage) => ZoeSeatAdminKit; type ZoeSeatAdminExit = (completion?: Completion) => void; type ZoeSeatAdminMethods = { replaceAllocation: (allocation: Allocation) => void; exit: ZoeSeatAdminExit; /** * called with the reason * for calling fail on this seat, where reason is normally an instanceof Error. */ fail: ShutdownWithFailure; getExitSubscriber: () => Subscriber<AmountKeywordRecord>; }; type ZoeSeatAdmin = RemotableObject & ZoeSeatAdminMethods; type HandleOfferResult = { offerResultPromise: Promise<Passable>; exitObj: ExitObj; }; /** * The seatHandle may be created in either the Zoe or ZCF vat, * depending on whether the seat comes from a normal offer or a * request by the contract for an "empty" seat. */ type InstanceAdmin = { assertAcceptingOffers: () => void; makeUserSeat: (invitationHandle: InvitationHandle, initialAllocation: Allocation, proposal: ProposalRecord, offerArgs?: object) => UserSeat; makeNoEscrowSeat: MakeNoEscrowSeat; getInstance: () => Instance; getPublicFacet: () => object; getIssuers: () => IssuerKeywordRecord; getBrands: () => BrandKeywordRecord; getTerms: () => object; getOfferFilter: () => string[]; getInstallation: () => Installation; exitAllSeats: (completion: Completion) => void; failAllSeats: ShutdownWithFailure; stopAcceptingOffers: () => void; isBlocked: (string: string) => boolean; initDelayedState: (handleOfferObj: HandleOfferObj, publicFacet: unknown) => void; setOfferFilter: (strings: string[]) => void; }; /** * The seatHandle may be created in either the Zoe or ZCF vat, * depending on whether the seat comes from a normal offer or a * request by the contract for an "empty" seat. */ type HandleOfferObj = { handleOffer: (invitationHandle: InvitationHandle, seatData: SeatData) => HandleOfferResult; }; type ZoeInstanceAdminMakeInvitation = (invitationHandle: InvitationHandle, description: string, customDetails?: Record<string, any> | undefined, proposalShape?: Pattern) => Invitation; type ZoeInstanceAdmin = { makeInvitation: ZoeInstanceAdminMakeInvitation; saveIssuer: <I extends Issuer>(issuerP: ERef<I>, keyword: Keyword) => Promise<I extends Issuer<infer K, infer M> ? ZoeIssuerRecord<K, M> : never>; makeZoeMint: MakeZoeMint; registerFeeMint: RegisterFeeMint; makeNoEscrowSeat: MakeNoEscrowSeat; replaceAllocations: ReplaceAllocations; exitAllSeats: (completion: Completion) => void; failAllSeats: ShutdownWithFailure; exitSeat: (seatHandle: SeatHandle, completion: Completion) => void; failSeat: (seatHandle: SeatHandle, reason: Error) => void; stopAcceptingOffers: () => void; setOfferFilter: (strings: Array<string>) => void; getOfferFilter: () => Array<string>; getExitSubscriber: (seatHandle: SeatHandle) => Subscriber<AmountKeywordRecord>; repairContractCompletionWatcher: () => void; }; type RegisterFeeMint = (keyword: Keyword, allegedFeeMintAccess: FeeMintAccess) => ZoeMint<"nat">; type WrapIssuerKitWithZoeMint = (keyword: Keyword, localIssuerKit: IssuerKit) => any; type MakeZoeMint = (keyword: Keyword, assetKind?: globalThis.AssetKind | undefined, displayInfo?: globalThis.AdditionalDisplayInfo | undefined, options?: Partial<{ elementShape: Pattern; recoverySetsOption: import("@agoric/ertp").RecoverySetsOption; }> | undefined) => ZoeMint; type MakeNoEscrowSeat = (initialAllocation: Allocation, proposal: ProposalRecord, exitObj: ExitObj, seatHandle: SeatHandle) => UserSeat; type ReplaceAllocations = (seatHandleAllocations: SeatHandleAllocation[]) => any; type SeatHandleAllocation = { seatHandle: SeatHandle; allocation: Allocation; }; type ZoeMint<K extends AssetKind = globalThis.AssetKind> = { getIssuerRecord: () => IssuerRecord<K>; mintAndEscrow: (totalToMint: Amount<K>) => void; /** * Note that the burning is asynchronous, and so may not have happened by * the time withdrawAndBurn returns. We rely on our other bookkeeping so that * these assets are assumed burned elsewhere, so no one will try to access * them even before they are actually burned. */ withdrawAndBurn: (totalToBurn: Amount<K>) => void; }; type ZCFRoot = { startZcf: StartZcf; restartContract: RestartContract; }; type ExecuteContractResult = { creatorFacet: object; creatorInvitation?: Promise<globalThis.Invitation> | undefined; publicFacet: object; handleOfferObj: HandleOfferObj; }; type StartZcf = (zoeInstanceAdmin: ERef<ZoeInstanceAdmin>, instanceRecordFromZoe: InstanceRecord, issuerStorageFromZoe: IssuerRecords, privateArgs?: object) => Promise<ExecuteContractResult>; type RestartContract = (privateArgs?: object) => Promise<ExecuteUpgradeableContractResult>; type MakeExitObj = (proposal: ProposalRecord, zoeSeatAdmin: ZCFSeat) => ExitObj; type ExitObj = { exit: () => void; }; type SeatHandle = Handle<"Seat">; /** * Get the assetKind for a brand known by Zoe * * To be deleted when brands have a property for assetKind */ type GetAssetKindByBrand = (brand: Brand) => AssetKind; type IssuerRecords = Array<ZoeIssuerRecord>; type MakeZCFSeat = (seatData: SeatData) => ZCFSeat; /** * Drops all of the references in the seat-related weakStores by * dropping the stores */ type DropAllReferences = () => void; type ZcfSeatManager = { makeZCFSeat: MakeZCFSeat; dropAllReferences: DropAllReferences; }; type ZcfMintReallocator = { reallocate: (zcfSeat: ZCFSeat, newAllocation: Allocation) => void; }; /** * Add an issuer and its keyword to the instanceRecord for the * contract instance */ type InstanceStateAddIssuer = (keyword: Keyword, issuerRecord: ZoeIssuerRecord) => void; type InstanceState = { addIssuer: InstanceStateAddIssuer; getInstanceRecord: () => InstanceRecord; getTerms: () => AnyTerms; getInstallation: () => Installation; getIssuers: () => IssuerKeywordRecord; getBrands: () => BrandKeywordRecord; assertUniqueKeyword: (keyword: Keyword) => void; }; import type { RemotableObject } from '@endo/pass-style'; import type { Passable } from '@endo/pass-style'; import type { Pattern } from '@endo/patterns'; import type { ShutdownWithFailure } from '@agoric/swingset-vat'; import type { Baggage } from '@agoric/vat-data'; import type { IssuerOptionsRecord } from '@agoric/ertp'; import type { IssuerRecord } from '@agoric/ertp'; import type { Allocation } from './types-index.js'; import type { PaymentPKeywordRecord } from './types-index.js'; import type { UserSeat } from './types-index.js'; import type { Completion } from './types-index.js'; import type { ZoeIssuerRecord } from './types-index.js'; import type { InvitationHandle } from './types.js'; import type { BrandKeywordRecord } from './types.js'; import type { AnyTerms } from './types.js'; //# sourceMappingURL=internal-types.d.ts.map