import { BigMapKeyType, MichelsonMap, MichelsonMapKey, Schema } from '@taquito/michelson-encoder'; import { SaplingDiffResponse } from '@taquito/rpc'; import { OperationBatch } from '../batch/rpc-batch-provider'; import { Context } from '../context'; import { DelegateOperation } from '../operations/delegate-operation'; import { OriginationOperation } from '../operations/origination-operation'; import { RegisterGlobalConstantOperation } from '../operations/register-global-constant-operation'; import { RevealOperation } from '../operations/reveal-operation'; import { TransactionOperation } from '../operations/transaction-operation'; import { DelegateParams, OriginateParams, TransferParams, RegisterDelegateParams, ParamsWithKind, RevealParams, RegisterGlobalConstantParams, IncreasePaidStorageParams, TransferTicketParams, DrainDelegateParams, BallotParams, ProposalsParams, UpdateConsensusKeyParams, UpdateCompanionKeyParams, SmartRollupAddMessagesParams, SmartRollupOriginateParams, SmartRollupExecuteOutboxMessageParams, FailingNoopParams, StakeParams, UnstakeParams, FinalizeUnstakeParams } from '../operations/types'; import { ContractAbstraction, ContractStorageType, DefaultContractType } from './contract'; import { IncreasePaidStorageOperation } from '../operations/increase-paid-storage-operation'; import { TransferTicketOperation } from '../operations/transfer-ticket-operation'; import { DrainDelegateOperation } from '../operations'; import { BallotOperation } from '../operations'; import { ProposalsOperation } from '../operations/proposals-operation'; import { UpdateConsensusKeyOperation } from '../operations/update-consensus-key-operation'; import { UpdateCompanionKeyOperation } from '../operations/update-companion-key-operation'; import { SmartRollupAddMessagesOperation } from '../operations/smart-rollup-add-messages-operation'; import { SmartRollupOriginateOperation } from '../operations/smart-rollup-originate-operation'; import { SmartRollupExecuteOutboxMessageOperation } from '../operations/smart-rollup-execute-outbox-message-operation'; import { FailingNoopOperation } from '../operations/failing-noop-operation'; import type { BlockIdentifier } from '../read-provider/interface'; export type ContractSchema = Schema | unknown; export interface StorageProvider { /** * * Return a well formatted json object of the contract storage * * @param contract contract address you want to get the storage from * @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script */ getStorage(contract: string, schema?: ContractSchema, block?: BlockIdentifier): Promise; /** * * Return a well formatted json object of a big map value * * @param id Big Map ID * @param keyToEncode key to query (will be encoded properly according to the schema) * @param schema Big Map schema (can be determined using your contract type) * @param block optional block level to fetch the value from * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr */ getBigMapKeyByID(id: string, keyToEncode: BigMapKeyType, schema: Schema, block?: BlockIdentifier): Promise; /** * * Fetch multiple values in a big map * * @param id Big Map ID * @param keysToEncode Array of keys to query (will be encoded properly according to the schema) * @param schema Big Map schema (can be determined using your contract type) * @param block optional block level to fetch the values from * @param batchSize optional batch size representing the number of requests to execute in parallel * @returns An object containing the keys queried in the big map and their value in a well-formatted JSON object format * */ getBigMapKeysByID(id: string, keysToEncode: Array, schema: Schema, block?: BlockIdentifier, batchSize?: number): Promise>; /** * * Return a well formatted json object of a sapling state * * @param id Sapling state ID * @param block optional block level to fetch the value from * */ getSaplingDiffByID(id: string, block?: BlockIdentifier): Promise; } export interface ContractProvider extends StorageProvider { /** * * Originate a new contract according to the script in parameters. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param contract Originate operation parameter */ originate(contract: OriginateParams>): Promise>; /** * * Set the delegate for a contract. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param params SetDelegate operation parameter */ setDelegate(params: DelegateParams): Promise; /** * * Register the current address as delegate. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param params RegisterDelegate operation parameter */ registerDelegate(params: RegisterDelegateParams): Promise; /** * * Transfer tz from current address to a specific address. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param params Transfer operation parameter */ transfer(params: TransferParams): Promise; /** * * Stake tz from current address to a specific address. Built on top of the existing transaction operation * * @returns An operation handle with the result from the rpc node * * @param params Stake pseudo-operation parameter */ stake(params: StakeParams): Promise; /** * * Unstake tz from current address to a specific address. Built on top of the existing transaction operation * * @returns An operation handle with the result from the rpc node * * @param params Unstake pseudo-operation parameter */ unstake(params: UnstakeParams): Promise; /** * * Finalize unstake tz from current address to a specific address. Built on top of the existing transaction operation * * @returns An operation handle with the result from the rpc node * * @param params Finalize unstake pseudo-operation parameter */ finalizeUnstake(params: FinalizeUnstakeParams): Promise; /** * * Transfer tickets from an implicit account to a contract or another implicit account. * * @returns An operation handle with the result from the rpc node * * @param params TransferTicket operation parameter */ transferTicket(params: TransferTicketParams): Promise; /** * * Reveal the current address. Will throw an error if the address is already revealed. * @returns An operation handle with the result from the rpc node * * @param params Reveal operation parameter */ reveal(params: RevealParams): Promise; at>(address: string, contractAbstractionComposer?: (abs: ContractAbstraction, context: Context) => T): Promise; /** * * Batch a group of operation together. Operations will be applied in the order in which they are added to the batch * * @param params List of operation to batch together */ batch(params?: ParamsWithKind[]): OperationBatch; /** * * Register a Micheline expression in a global table of constants. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param params registerGlobalConstant operation parameter */ registerGlobalConstant(params: RegisterGlobalConstantParams): Promise; /** * * Increase the amount of bytes in a smart contract storage by paying a fee * * @returns An operation handle with the result from the rpc node * * @param params IncreasePaidStorage operation parameter */ increasePaidStorage(params: IncreasePaidStorageParams): Promise; /** * * Submit a drain delegate operation * * @returns An operation handle with the result from the RPC node * * @param params DrainDelegate operation parameter */ drainDelegate(params: DrainDelegateParams): Promise; /** * * Submit ballot for an ongoing proposal * * @returns An operation handle with the result from the RPC node * * @param params Ballot operation parameter */ ballot(params: BallotParams): Promise; /** * * Submit proposal * * @returns An operation handle with the result from the RPC node * * @param params Proposals operation parameter */ proposals(params: ProposalsParams): Promise; /** * * Update consensus key * @returns An operation handle with the result from the RPC node * * @param params UpdateConsensusKey operation parameter */ updateConsensusKey(params: UpdateConsensusKeyParams): Promise; /** * * Update companion key * @returns An operation handle with the result from the RPC node * * @param params UpdateCompanionKey operation parameter */ updateCompanionKey(params: UpdateCompanionKeyParams): Promise; /** * * Smart Rollup Add Messages * * @returns An operation handle with the result from the RPC node * * @param params smartRollupAddMessages operation parameter */ smartRollupAddMessages(params: SmartRollupAddMessagesParams): Promise; /** * Smart rollup originate * * @returns An operation handle with the result from the RPC node * * @param params smartRollupOriginate operation parameter */ smartRollupOriginate(params: SmartRollupOriginateParams): Promise; /** * Execute a message from a smart rollup's outbox of a cemented commitment * * @returns An operation handle with the result from the RPC node * * @param params smartRollupExecuteOutboxMessage operation parameter */ smartRollupExecuteOutboxMessage(params: SmartRollupExecuteOutboxMessageParams): Promise; /** * * Send arbitrary data inside a failing_noop operation that's guaranteed to fail. * * @returns An operation handle with the result from the rpc node * * @param params FailingNoop operation parameter */ failingNoop(params: FailingNoopParams): Promise; }