@mysten/sui
Version:
Sui TypeScript API(Work in Progress)
32 lines (31 loc) • 1.2 kB
TypeScript
import type { TransactionDataBuilder } from '../TransactionData.js';
export type NamedPackagesPluginCache = {
packages: Record<string, string>;
types: Record<string, string>;
};
export type NameResolutionRequest = {
id: number;
type: 'package' | 'moveType';
name: string;
};
/**
* Looks up all `.move` names in a transaction block.
* Returns a list of all the names found.
*/
export declare function findNamesInTransaction(builder: TransactionDataBuilder): {
packages: string[];
types: string[];
};
/**
* Extracts all first-level types from a list of types.
* E.g. for the input `['@mvr/demo::a::A<@mvr/demo::b::B>']`,
* the output will be `['@mvr/demo::a::A', '@mvr/demo::b::B']`.
*/
export declare function getFirstLevelNamedTypes(types: string[]): Set<string>;
export declare function populateNamedTypesFromCache(types: string[], typeCache: Record<string, string>): Record<string, string>;
/**
* Replace all names & types in a transaction block
* with their resolved names/types.
*/
export declare function replaceNames(builder: TransactionDataBuilder, cache: NamedPackagesPluginCache): void;
export declare function batch<T>(arr: T[], size: number): T[][];