@layerzerolabs/lz-sui-sdk-v2
Version:
50 lines (42 loc) • 1.6 kB
text/typescript
import { SuiClient } from '@mysten/sui/client'
import { Transaction, TransactionResult } from '@mysten/sui/transactions'
import { ModuleManager } from '../../module-manager'
import { ObjectOptions } from '../../types'
const MODULE_NAME = 'blocked_msglib_ptb_builder'
export class BlockedMessageLibPtbBuilder {
public packageId: string
public readonly client: SuiClient
private readonly objects: ObjectOptions
constructor(
packageId: string,
client: SuiClient,
objects: ObjectOptions,
private readonly moduleManager: ModuleManager
) {
this.packageId = packageId
this.client = client
this.objects = objects
}
// === View Functions ===
/**
* Creates a transaction to get PTB builder info
* @param tx - The transaction to add the move call to
* @returns Transaction result containing PTB builder information
*/
getPtbBuilderInfoMoveCall(tx: Transaction): TransactionResult {
return tx.moveCall({
target: this.#target('get_ptb_builder_info'),
arguments: [tx.object(this.objects.blockedMessageLibPtbBuilder), tx.object(this.objects.blockedMessageLib)],
})
}
/**
* Generate the full target path for move calls
* @param name - The function name to call
* @param module_name - The module name (defaults to MODULE_NAME)
* @returns The full module path for the move call
* @private
*/
#target(name: string, module_name = MODULE_NAME): string {
return `${this.packageId}::${module_name}::${name}`
}
}