@gear-js/api
Version:
A JavaScript library that provides functionality to connect GEAR Component APIs.
35 lines (34 loc) • 1.17 kB
TypeScript
import { Option } from '@polkadot/types';
import { HexString } from '@polkadot/util/types';
import { CodeUploadResult, GearCoreCodeMetadataCodeMetadata } from '../types';
import { GearTransaction } from './Transaction';
export declare class GearCode extends GearTransaction {
/**
* ### Submit code without initialization
* @param code
* @returns Code hash
*/
upload(code: Uint8Array): Promise<CodeUploadResult>;
/**
* ### Check that codeId exists on chain
* @param codeId
*/
exists(codeId: string): Promise<boolean>;
/**
* ### Get code storage
* @param codeId
*/
storage(codeId: HexString): Promise<Option<GearCoreCodeMetadataCodeMetadata>>;
/**
* ### Get static pages of code
* @param codeId
*/
staticPages(codeId: HexString): Promise<number | null>;
/**
* ### Get all ids of codes uploaded on connected chain
* @returns array of code ids uploaded on chain
*/
all(count?: number): Promise<HexString[]>;
metaHash(codeId: HexString): Promise<HexString>;
metaHashFromWasm(wasm: ArrayBuffer | HexString | Uint8Array): Promise<`0x${string}`>;
}