@taquito/taquito
Version:
High level functionality that builds upon the other packages in the Tezos Typescript Library Suite.
421 lines (420 loc) • 14 kB
TypeScript
import { OperationObject, InternalOperationResultKindEnum, OpKind, TransactionOperationParameter, MichelsonV1Expression, BallotVote, PvmKind } from '@taquito/rpc';
import { BlockIdentifier } from '../read-provider/interface';
export { OpKind } from '@taquito/rpc';
export declare type withKind<T, K extends OpKind> = T & {
kind: K;
};
export declare type ParamsWithKind = withKind<OriginateParams, OpKind.ORIGINATION> | withKind<DelegateParams, OpKind.DELEGATION> | withKind<TransferParams, OpKind.TRANSACTION> | withKind<ActivationParams, OpKind.ACTIVATION> | withKind<RegisterGlobalConstantParams, OpKind.REGISTER_GLOBAL_CONSTANT> | withKind<IncreasePaidStorageParams, OpKind.INCREASE_PAID_STORAGE> | withKind<TxRollupOriginateParams, OpKind.TX_ROLLUP_ORIGINATION> | withKind<TxRollupBatchParams, OpKind.TX_ROLLUP_SUBMIT_BATCH> | withKind<TransferTicketParams, OpKind.TRANSFER_TICKET> | withKind<UpdateConsensusKeyParams, OpKind.UPDATE_CONSENSUS_KEY> | withKind<SmartRollupAddMessagesParams, OpKind.SMART_ROLLUP_ADD_MESSAGES> | withKind<FailingNoopParams, OpKind.FAILING_NOOP> | withKind<SmartRollupOriginateParamsWithProof, OpKind.SMART_ROLLUP_ORIGINATE>;
export declare type ParamsWithKindExtended = ParamsWithKind | withKind<RevealParams, OpKind.REVEAL>;
export declare const attachKind: <T, K extends OpKind>(op: T, kind: K) => withKind<T, K>;
export declare const findWithKind: <T extends {
kind: OpKind;
}, K extends OpKind>(arr: T[], kind: K) => (T & {
kind: K;
}) | undefined;
export declare const isKind: <T extends {
kind: OpKind;
}, K extends OpKind>(op: T, kind: K) => op is withKind<T, K>;
export declare type RPCOpWithFee = RPCTransferOperation | RPCOriginationOperation | RPCDelegateOperation | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation | RPCTxRollupOriginationOperation | RPCTxRollupBatchOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCSmartRollupOriginateOperation;
export declare type RPCOpWithSource = RPCTransferOperation | RPCOriginationOperation | RPCDelegateOperation | RPCRevealOperation | RPCRegisterGlobalConstantOperation | RPCIncreasePaidStorageOperation | RPCTxRollupOriginationOperation | RPCTxRollupBatchOperation | RPCTransferTicketOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCSmartRollupOriginateOperation;
export declare const isOpWithFee: <T extends {
kind: OpKind;
}>(op: T) => op is withKind<T, OpKind.ORIGINATION | OpKind.DELEGATION | OpKind.REVEAL | OpKind.TRANSACTION | OpKind.ENDORSEMENT | OpKind.PREENDORSEMENT | OpKind.SET_DEPOSITS_LIMIT | OpKind.DOUBLE_PREENDORSEMENT_EVIDENCE | OpKind.ENDORSEMENT_WITH_SLOT | OpKind.SEED_NONCE_REVELATION | OpKind.DOUBLE_ENDORSEMENT_EVIDENCE | OpKind.DOUBLE_BAKING_EVIDENCE | OpKind.PROPOSALS | OpKind.BALLOT | OpKind.REGISTER_GLOBAL_CONSTANT | OpKind.TX_ROLLUP_ORIGINATION | OpKind.TX_ROLLUP_SUBMIT_BATCH | OpKind.TX_ROLLUP_COMMIT | OpKind.TX_ROLLUP_RETURN_BOND | OpKind.TX_ROLLUP_FINALIZE_COMMITMENT | OpKind.TX_ROLLUP_REMOVE_COMMITMENT | OpKind.TX_ROLLUP_REJECTION | OpKind.TX_ROLLUP_DISPATCH_TICKETS | OpKind.TRANSFER_TICKET | OpKind.INCREASE_PAID_STORAGE | OpKind.UPDATE_CONSENSUS_KEY | OpKind.DRAIN_DELEGATE | OpKind.VDF_REVELATION | OpKind.EVENT | OpKind.TICKET_UPDATES | OpKind.SMART_ROLLUP_ORIGINATE | OpKind.SMART_ROLLUP_ADD_MESSAGES | OpKind.SMART_ROLLUP_EXECUTE_OUTBOX_MESSAGE | OpKind.SMART_ROLLUP_PUBLISH | OpKind.SMART_ROLLUP_CEMENT | OpKind.SMART_ROLLUP_RECOVER_BOND | OpKind.SMART_ROLLUP_REFUTE | OpKind.SMART_ROLLUP_TIMEOUT>;
export declare const isOpRequireReveal: <T extends {
kind: OpKind;
}>(op: T) => op is withKind<T, OpKind.ORIGINATION | OpKind.DELEGATION | OpKind.TRANSACTION | OpKind.EVENT>;
export declare type SourceKinds = InternalOperationResultKindEnum;
export declare const isSourceOp: <T extends {
kind: OpKind;
}>(op: T) => op is withKind<T, InternalOperationResultKindEnum>;
export declare const hasMetadata: <T extends {
kind: OpKind;
}, K>(op: T) => op is T & {
metadata: K;
};
export declare const hasMetadataWithResult: <T extends {
kind: OpKind;
}, K>(op: T) => op is T & {
metadata: {
operation_result: K;
};
};
export declare const hasMetadataWithInternalOperationResult: <T extends {
kind: OpKind;
}, K>(op: T) => op is T & {
metadata: {
internal_operation_results?: K | undefined;
};
};
export interface GasConsumingOperation {
consumedGas?: string;
gasLimit: number;
}
export interface StorageConsumingOperation {
storageDiff?: string;
storageSize?: string;
storageLimit: number;
}
export interface FeeConsumingOperation {
fee: number;
}
export declare type OriginateParamsBase = {
balance?: string | number;
code: string | object[];
delegate?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
mutez?: boolean;
};
/**
* @description Parameters for originate method
*/
export declare type OriginateParams<TStorage = any> = OriginateParamsBase & ({
init?: never;
/** JS representation of a storage object */
storage: TStorage;
} | {
/** Initial storage object value. Either Micheline or JSON encoded */
init: string | object;
storage?: never;
});
export interface ActivationParams {
pkh: string;
secret: string;
}
/**
* @description RPC origination operation
*/
export interface RPCOriginationOperation {
kind: OpKind.ORIGINATION;
fee: number;
gas_limit: number;
storage_limit: number;
balance: string;
delegate?: string;
source?: string;
script: {
code: any;
storage: any;
};
}
/**
* @description RPC reveal operation
*/
export interface RPCRevealOperation {
kind: OpKind.REVEAL;
fee: number;
public_key: string;
source?: string;
gas_limit: number;
storage_limit: number;
}
export interface RevealParams {
fee?: number;
gasLimit?: number;
storageLimit?: number;
}
/**
* @description Result of a forge operation contains the operation plus its encoded version
*/
export interface ForgedBytes {
opbytes: string;
opOb: OperationObject;
counter: number;
}
/**
* @description Parameters for setDelegate method
*/
export interface DelegateParams {
source: string;
delegate?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
}
/**
* @description Parameters for registerDelegate method
*/
export interface RegisterDelegateParams {
fee?: number;
gasLimit?: number;
storageLimit?: number;
}
/**
* @description RPC delegation operation
*/
export interface RPCDelegateOperation {
kind: OpKind.DELEGATION;
source?: string;
fee: number;
gas_limit: number;
storage_limit: number;
delegate?: string;
}
/**
* @description Parameters for transfer method
*/
export interface TransferParams {
to: string;
source?: string;
amount: number;
fee?: number;
parameter?: TransactionOperationParameter;
gasLimit?: number;
storageLimit?: number;
mutez?: boolean;
}
/**
* @description RPC register global constant operation
*/
export interface RPCRegisterGlobalConstantOperation {
kind: OpKind.REGISTER_GLOBAL_CONSTANT;
fee: number;
gas_limit: number;
storage_limit: number;
source: string;
value: MichelsonV1Expression;
}
/**
* @description Parameters for the `registerGlobalConstant` method
*/
export interface RegisterGlobalConstantParams {
value: MichelsonV1Expression;
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
}
/**
* @description RPC transfer operation
*/
export interface RPCTransferOperation {
kind: OpKind.TRANSACTION;
fee: number;
gas_limit: number;
storage_limit: number;
amount: string;
source?: string;
destination: string;
parameters?: TransactionOperationParameter;
}
/**
* @description RPC activate account operation
*/
export interface RPCActivateOperation {
kind: OpKind.ACTIVATION;
pkh: string;
secret: string;
}
/**
* @description RPC tx rollup origination operation
*/
export interface RPCTxRollupOriginationOperation {
kind: OpKind.TX_ROLLUP_ORIGINATION;
fee: number;
gas_limit: number;
storage_limit: number;
source: string;
tx_rollup_origination: object;
}
/**
* @description Parameters for the `txRollupOriginate` method
*/
export interface TxRollupOriginateParams {
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
}
/**
* @description Parameters for the `txRollupSubmitBatch` method
*/
export interface TxRollupBatchParams {
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
rollup: string;
content: string;
}
/**
* @description RPC tx rollup batch operation
*/
export interface RPCTxRollupBatchOperation {
kind: OpKind.TX_ROLLUP_SUBMIT_BATCH;
fee: number;
gas_limit: number;
storage_limit: number;
source: string;
rollup: string;
content: string;
}
/**
* @description Parameters for the transferTicket contract provider
*/
export interface TransferTicketParams {
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
ticketContents: MichelsonV1Expression;
ticketTy: MichelsonV1Expression;
ticketTicketer: string;
ticketAmount: number;
destination: string;
entrypoint: string;
}
/**
* @description Rpc transfer-ticket operation
*/
export interface RPCTransferTicketOperation {
kind: OpKind.TRANSFER_TICKET;
source?: string;
fee: number;
gas_limit: number;
storage_limit: number;
ticket_contents: MichelsonV1Expression;
ticket_ty: MichelsonV1Expression;
ticket_ticketer: string;
ticket_amount: number;
destination: string;
entrypoint: string;
}
/**
* @description Parameters for the increasePaidStorage method
*/
export interface IncreasePaidStorageParams {
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
amount: number;
destination: string;
}
/**
* @description RPC IncreasePaidStorage operation
*/
export interface RPCIncreasePaidStorageOperation {
kind: OpKind.INCREASE_PAID_STORAGE;
source: string;
fee: number;
gas_limit: number;
storage_limit: number;
amount: number;
destination: string;
}
/**
* @description Parameters for the DrainDelegate method
*/
export interface DrainDelegateParams {
consensus_key: string;
delegate: string;
destination: string;
}
/**
* @description RPC DrainDelegate operation
*/
export interface RPCDrainDelegateOperation {
kind: OpKind.DRAIN_DELEGATE;
consensus_key: string;
delegate: string;
destination: string;
}
/**
* @description Ballot operation params
*/
export interface BallotParams {
source?: string;
proposal: string;
ballot: BallotVote;
}
export interface RPCBallotOperation {
kind: OpKind.BALLOT;
source: string;
period: number;
proposal: string;
ballot: BallotVote;
}
export interface ProposalsParams {
source?: string;
proposals: string[];
}
export interface RPCProposalsOperation {
kind: OpKind.PROPOSALS;
source: string;
period: number;
proposals: string[];
}
export interface UpdateConsensusKeyParams {
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
pk: string;
}
export interface RPCUpdateConsensusKeyOperation {
kind: OpKind.UPDATE_CONSENSUS_KEY;
source: string;
fee: number;
gas_limit: number;
storage_limit: number;
pk: string;
}
export interface RPCSmartRollupAddMessagesOperation {
kind: OpKind.SMART_ROLLUP_ADD_MESSAGES;
source: string;
fee: number;
gas_limit: number;
storage_limit: number;
message: string[];
}
export interface SmartRollupAddMessagesParams {
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
message: string[];
}
export interface SmartRollupOriginateParams {
source?: string;
fee?: number;
gasLimit?: number;
storageLimit?: number;
pvmKind: PvmKind;
kernel: string;
parametersType: MichelsonV1Expression;
}
export interface SmartRollupOriginateParamsWithProof extends SmartRollupOriginateParams {
originationProof: string;
}
export interface RPCSmartRollupOriginateOperation {
kind: OpKind.SMART_ROLLUP_ORIGINATE;
source: string;
fee: number;
gas_limit: number;
storage_limit: number;
pvm_kind: PvmKind;
kernel: string;
origination_proof: string;
parameters_ty: MichelsonV1Expression;
}
/**
* @description RPC failing noop operation
*/
export interface RPCFailingNoopOperation {
kind: OpKind.FAILING_NOOP;
arbitrary: string;
}
/**
* @description Parameters for the `failingNoop` method
*/
export interface FailingNoopParams {
arbitrary: string;
basedOnBlock: BlockIdentifier;
}
export declare type RPCOperation = RPCOriginationOperation | RPCTransferOperation | RPCDelegateOperation | RPCRevealOperation | RPCActivateOperation | RPCRegisterGlobalConstantOperation | RPCTransferTicketOperation | RPCIncreasePaidStorageOperation | RPCDrainDelegateOperation | RPCBallotOperation | RPCProposalsOperation | RPCUpdateConsensusKeyOperation | RPCSmartRollupAddMessagesOperation | RPCFailingNoopOperation | RPCSmartRollupOriginateOperation;
export declare type PrepareOperationParams = {
operation: RPCOperation | RPCOperation[];
source?: string;
};