Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

eosjs: missing table_def.indexes #493

Open
MikkySnow opened this issue Feb 8, 2019 · 2 comments
Open

eosjs: missing table_def.indexes #493

MikkySnow opened this issue Feb 8, 2019 · 2 comments
Assignees
Labels
documentation Requires attention of documentation team. e.g. documentation is expected to be generated.

Comments

@MikkySnow
Copy link

I'm trying to deploy contract using eosjs. setcode part is working, but I'm having trouble with setabi. When I deploy abi without any tables, it works. But if there will be at least one table, the error Error: missing table_def.indexes (type=index_def[]) appears

`async function deploy(deployer, contract) {
const buffer = new Serialize.SerialBuffer({
textEncoder: api().textEncoder,
textDecoder: api().textDecoder,
});

let abiDefinition = api().abiTypes.get('abi_def');
let abi = abiDefinition.fields.reduce(
    (acc, {name: fieldName}) => Object.assign(acc, {[fieldName]: acc[fieldName] || []}),
    contract.abi,
);
abiDefinition.serialize(buffer, abi);
let forSend = Buffer.from(buffer.asUint8Array()).toString(`hex`);

await api([deployer.private_key]).transact({
    actions: [{
        account: network.system_account,
        name: 'setabi',
        authorization: [{
            actor: deployer.name,
            permission: 'active',
        }],
        data: {
            account: deployer.name,
            abi: forSend
        }
    }]
}, transact_conf);

}`

contract is object containing abi and wasm for contract
eosjs version is 20.0.0-beta3

@tbfleming tbfleming added the docs label Sep 20, 2019
@tbfleming
Copy link
Contributor

The reducer above probably needs additional rules to add the missing fields.

@tbfleming
Copy link
Contributor

#588 is related

@lparisc lparisc added documentation Requires attention of documentation team. e.g. documentation is expected to be generated. and removed docs labels Mar 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Requires attention of documentation team. e.g. documentation is expected to be generated.
Projects
None yet
Development

No branches or pull requests

4 participants