Skip to content

types

SuiWasm

typescript
export class SuiWasm {
  private constructor();
  free(): void;
  new_bytes(bytes: Uint8Array, type_tag: string): CallArgument;
  static new_wasm(): SuiWasm;
  set_tracer_enable(v: boolean, trace_location: string): void;
  reset_gas_cost(): void;
  get_gas_cost(): bigint;
  get_gas_report(): string;
  refresh_vm(): void;
  publish_module(binary: Uint8Array): void;
  setup_storage(): void;
  add_source_map(binary: Uint8Array): void;
  add_source_map_json(json: string): void;
  add_source_code(code: string): void;
  call_return_bcs(account_address: string, module: string, _function: string, ty_args: string[], args: CallArgument[]): CallArgument[];
}

MoveGen

typescript
export class MoveGen {
  private constructor();
  free(): void;
  static new(): MoveGen;
  static toml_edit_dependencies(toml_string: string, key0: string, key1: string, key2: string, value1: string): string;
  register_module(module: string, binary: Uint8Array): void;
  build_bytecode_model(): void;
  run_move_gen(out: string): void;
  run_move_tx_gen(out: string): void;
  run_module_gen(out: string, package_id: string, binary: Uint8Array): void;
}

StructClass

typescript
export interface StructClass {
    $type: string

    from(v: any): any;
    serialize_bcs(): any
    return_bcs(): any
    into_value(): any
    serialize(arg: any): any
    get_bcs(): any
    get_value(): any
    from_bcs_t(arg: any): any
    from_bcs(arg: any): any
    from_bcs_vector(args: any): any
    from_bcs_vector_t(args: any): any
}

StructClass used for Move struct auto binding type or boxed primitive type

boxed primitive type is used in generic structs or generic functions

Address

typescript
export class Address implements StructClass {
    value: string;
    readonly $type: string = "address";

    static $type() {
        return "address";
    }

    constructor(value: string) {
        this.value = value;
    }
}

boxed primitive type for Move type address

Boolean

typescript
export class Boolean implements StructClass {
    value: boolean;
    readonly $type: string = "bool";

    static $type() {
        return "bool";
    }

    constructor(value: boolean) {
        this.value = value;
    }
}

boxed primitive type for Move type bool

Ascii

typescript
export class Ascii implements StructClass {
    value: string;
    readonly $type: string = "0x1::ascii::String";

    static $type() {
        return "0x1::ascii::String";
    }

    constructor(value: string) {
        this.value = value;
    }
}

boxed primitive type for Move type 0x1::ascii::String

String

typescript
export class String implements StructClass {
    value: string;
    readonly $type: string = "0x1::string::String";

    static $type() {
        return "0x1::string::String";
    }

    constructor(value: string) {
        this.value = value;
    }

    into_uint8array(): Uint8Array {
        return new TextEncoder().encode(this.value)
    }

    into_u8array(): U8[] {
        let uint8 = new TextEncoder().encode(this.value)
        let r: U8[] = [];
        for (var i = 0; i < uint8.length; i++) {
            r.push(new U8(uint8[i]))
        }
        return r;
    }
}

boxed primitive type for Move type 0x1::string::String

U8

typescript
export class U8 implements StructClass {
    value: number;
    readonly $type: string = "u8";

    static $type() {
        return "u8";
    }

    constructor(value: number) {
        this.value = value;
    }
}

boxed primitive type for Move type u8

U16

typescript
export class U16 implements StructClass {
    value: number;
    readonly $type: string = "u16";

    static $type() {
        return "u16";
    }

    constructor(value: number) {
        this.value = value;
    }
}

boxed primitive type for Move type u16

U32

typescript
export class U32 implements StructClass {
    value: number;
    readonly $type: string = "u32";

    static $type() {
        return "u32";
    }

    constructor(value: number) {
        this.value = value;
    }
}

boxed primitive type for Move type u32

U64

typescript
export class U64 implements StructClass {
    value: string | number | bigint;
    readonly $type: string = "u64";

    static $type() {
        return "u64";
    }

    constructor(value: string | number | bigint) {
        this.value = value;
    }
}

boxed primitive type for Move type u64

U128

typescript
export class U128 implements StructClass {
    value: string | number | bigint;
    readonly $type: string = "u128";

    static $type() {
        return "u128";
    }

    constructor(value: string | number | bigint) {
        this.value = value;
    }
}

boxed primitive type for Move type u128

U256

typescript
export class U256 implements StructClass {
    value: string | number | bigint;
    readonly $type: string = "u256";

    static $type() {
        return "u256";
    }

    constructor(value: string | number | bigint) {
        this.value = value;
    }
}

boxed primitive type for Move type u256

Released under the MIT License.