Skip to content

Add ways to access the Bytes version of an ABI #114

@aaroncox

Description

@aaroncox

The setcode action on the system contract requires you pass in Bytes. If you have the ABI, you need to manually serialize it to get the bytes version (code below). The ABI class should have some method/getter that returns these values instead of requiring this boilerplate code.

const abi = ABI.from({
    version: 'eosio::abi/1.0',
    types: [],
    variants: [],
    structs: [],
    actions: [],
    tables: [],
    ricardian_clauses: [],
})

const result = Serializer.encode({
    object: abi,
    type: ABI,
})

console.log(result) // Bytes object
console.log(result.array) // Uint8Array
console.log(String(result)) // hex encoded string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions