import { AccountTransactionPayloadJSON, ConfigureBakerPayloadJSON, ConfigureDelegationPayloadJSON, DeployModulePayloadJSON, InitContractPayloadJSON, RegisterDataPayloadJSON, SimpleTransferPayloadJSON, SimpleTransferWithMemoPayloadJSON, TokenUpdatePayloadJSON, UpdateContractPayloadJSON } from '../accountTransactions.js'; import { Cursor } from '../deserializationHelpers.js'; import { type AccountTransactionPayload, AccountTransactionType, type ConfigureBakerPayload, type ConfigureDelegationPayload, type DeployModulePayload, type InitContractPayload, type RegisterDataPayload, type SimpleTransferPayload, type SimpleTransferWithMemoPayload, type TokenUpdatePayload, TransactionKindString, type UpdateContractPayload, type UpdateCredentialKeysPayload, type UpdateCredentialsPayload } from '../types.js'; import { DataBlob } from '../types/DataBlob.js'; type PayloadJSON = { type: T; } & P; /** * A simple transfer transaction payload. */ export type Transfer = SimpleTransferPayload & { readonly type: AccountTransactionType.Transfer; }; /** * A transfer transaction payload with a memo. */ export type TransferWithMemo = SimpleTransferWithMemoPayload & { readonly type: AccountTransactionType.TransferWithMemo; }; /** * Creates a transfer payload with memo. * @param payload the transfer with memo payload * @returns a transfer with memo payload */ export declare function transfer(payload: SimpleTransferWithMemoPayload): TransferWithMemo; /** * Creates a transfer payload with memo. * @param payload the transfer payload * @param memo the memo to attach * @returns a transfer with memo payload */ export declare function transfer(payload: SimpleTransferPayload, memo: DataBlob): TransferWithMemo; /** * Creates a transfer payload. * @param payload the transfer payload * @returns a transfer payload */ export declare function transfer(payload: SimpleTransferPayload): Transfer; declare function transferToJSON({ type, ...transfer }: Transfer): PayloadJSON; declare function transferWithMemoToJSON({ type, ...transferWithMemo }: TransferWithMemo): PayloadJSON; /** * A deploy module transaction payload. */ export type DeployModule = DeployModulePayload & { readonly type: AccountTransactionType.DeployModule; }; /** * Creates a deploy module payload. * @param payload the module deployment payload * @returns a deploy module payload */ export declare function deployModule(payload: DeployModulePayload): DeployModule; declare function deployModuleToJSON({ type, ...value }: DeployModule): PayloadJSON; /** * An init contract transaction payload. */ export type InitContract = InitContractPayload & { readonly type: AccountTransactionType.InitContract; }; /** * Creates an init contract payload. * @param payload the contract initialization payload * @returns an init contract payload */ export declare function initContract(payload: InitContractPayload): InitContract; declare function initContractToJSON({ type, ...value }: InitContract): PayloadJSON; /** * An update contract transaction payload. */ export type UpdateContract = UpdateContractPayload & { readonly type: AccountTransactionType.Update; }; /** * Creates an update contract payload. * @param payload the contract update payload * @returns an update contract payload */ export declare function updateContract(payload: UpdateContractPayload): UpdateContract; declare function updateContractToJSON({ type, ...value }: UpdateContract): PayloadJSON; /** * An update credentials transaction payload. */ export type UpdateCredentials = UpdateCredentialsPayload & { readonly type: AccountTransactionType.UpdateCredentials; }; /** * Creates an update credentials payload. * @param payload the credentials update payload * @returns an update credentials payload */ export declare function updateCredentials(payload: UpdateCredentialsPayload): UpdateCredentials; declare function updateCredentialsToJSON({ type, ...value }: UpdateCredentials): PayloadJSON; /** * An update credential keys transaction payload. */ export type UpdateCredentialKeys = UpdateCredentialKeysPayload & { readonly type: AccountTransactionType.UpdateCredentialKeys; }; /** * Creates an update credential keys payload. * @param payload containing update credential keys payload fields * @returns payload object for update credential keys */ export declare function updateCredentialKeys(payload: UpdateCredentialKeysPayload): UpdateCredentialKeys; /** * A register data transaction payload. */ export type RegisterData = RegisterDataPayload & { readonly type: AccountTransactionType.RegisterData; }; /** * Creates a register data payload. * @param payload the data registration payload * @returns a register data payload */ export declare function registerData(payload: RegisterDataPayload): RegisterData; declare function registerDataToJSON({ type, ...value }: RegisterData): PayloadJSON; /** * A configure delegation transaction payload. */ export type ConfigureDelegation = ConfigureDelegationPayload & { readonly type: AccountTransactionType.ConfigureDelegation; }; /** * Creates a configure delegation payload. * @param payload the delegation configuration payload * @returns a configure delegation payload */ export declare function configureDelegation(payload: ConfigureDelegationPayload): ConfigureDelegation; declare function configureDelegationToJSON({ type, ...value }: ConfigureDelegation): PayloadJSON; /** * A configure validator (baker) transaction payload. */ export type ConfigureValidator = ConfigureBakerPayload & { readonly type: AccountTransactionType.ConfigureBaker; }; /** * Creates a configure validator (baker) payload. * @param payload the validator configuration payload * @returns a configure validator payload */ export declare function configureValidator(payload: ConfigureBakerPayload): ConfigureValidator; declare function configureValidatorToJSON({ type, ...value }: ConfigureValidator): PayloadJSON; /** * A token update transaction payload. */ export type TokenUpdate = TokenUpdatePayload & { readonly type: AccountTransactionType.TokenUpdate; }; /** * Creates a token update payload. * @param payload the token update payload * @returns a token update payload */ export declare function tokenUpdate(payload: TokenUpdatePayload): TokenUpdate; declare function tokenUpdateToJSON({ type, ...value }: TokenUpdate): PayloadJSON; type Payload = Transfer | TransferWithMemo | DeployModule | InitContract | UpdateContract | UpdateCredentials | UpdateCredentialKeys | RegisterData | ConfigureDelegation | ConfigureValidator | TokenUpdate; /** * Union type of all supported transaction payloads. */ export type Type = Payload; /** * JSON representation of a transaction payload. */ export type JSON = ReturnType | ReturnType | ReturnType | ReturnType | ReturnType | ReturnType | ReturnType | ReturnType | ReturnType | ReturnType; /** * Creates a typed transaction payload from a transaction type and raw payload data. * * NOTE: this does _not_ check the payload structure, and thus assumes that the `type` and `payload` * given actually match. * * @param type the transaction type * @param payload the raw transaction payload * * @returns the typed transaction payload * @throws if the transaction type is not supported */ export declare function create(type: AccountTransactionType, payload: AccountTransactionPayload): Payload; /** * Converts a transaction payload to its intermediary JSON representation. * * Please note that `bigint`s are used internally, and representing these must be handled by the caller * e.g. by using a tool such as `json-bigint`. * * @param payload the payload to convert * @returns the JSON representation * @throws if the transaction type is not supported */ export declare function toJSON(payload: Transfer): ReturnType; export declare function toJSON(payload: TransferWithMemo): ReturnType; export declare function toJSON(payload: DeployModule): ReturnType; export declare function toJSON(payload: InitContract): ReturnType; export declare function toJSON(payload: UpdateContract): ReturnType; export declare function toJSON(payload: UpdateCredentials): ReturnType; export declare function toJSON(payload: RegisterData): ReturnType; export declare function toJSON(payload: ConfigureDelegation): ReturnType; export declare function toJSON(payload: ConfigureValidator): ReturnType; export declare function toJSON(payload: TokenUpdate): ReturnType; export declare function toJSON(payload: Payload): JSON; /** * Converts a intermediary JSON representation created from {@linkcode toJSON} to a transaction payload. * * @param json the JSON to convert * * @returns the transaction payload * @throws if the JSON is invalid or the transaction type is not supported */ export declare function fromJSON(json: unknown): Payload; /** * Converts a {@linkcode Payload} to a JSON string. * * @param payload - the payload to convert * @returns the JSON string */ export declare function toJSONString(payload: Payload): string; /** * Converts a JSON string payload representation to a {@linkcode Payload}. * * @param jsonString - the json string to convert * * @returns the JSON string * @throws if the JSON is invalid or the transaction type is not supported */ export declare function fromJSONString(jsonString: string): Payload; /** * Serializes a transaction payload to the encoding expected by concordium nodes. * @param payload the payload to serialize * @returns the serialized payload as a byte array */ export declare function serialize(payload: Payload): Uint8Array; /** * Returns the size in bytes of a serialized transaction payload. * @param payload the payload to measure * @returns the size in bytes */ export declare function sizeOf(payload: Payload): number; /** * Deserializes a transaction payload from the byte encoding used by concordium nodes. * @param value the bytes to deserialize, either as a Cursor or ArrayBuffer * @returns the deserialized payload * @throws if the transaction type is invalid or buffer is not fully consumed */ export declare function deserialize(value: Cursor | ArrayBuffer): Payload; export {};