// Disclaimer: This snippet runs on a shared environment. Execution times will vary
// Replace with an actual private key
const pvk = '0xd2827f4c3778758eb51719a698464aaffd10a5c7cf816c1de83c5e446bfc1111';
const asset = '1858476204501659870681251187806966130514471238263';
const uni = '0';
const nonce = '0';
const updated_asset_props = {
image: 'ipfs://QmPCHHeL1i6ZCUnQ1RdvQ5G3qccsjgQF8GkJrWAm54kdtB',
};
require("utf-8-validate")
const identity = require('freeverse-crypto-js');
const { updateAssetOp, AtomicAssetOps } = require('freeverse-apisigner-js');
// create web3 account from your private key
// (other forms of creating web3 account could be subsituted)
const universe_owner_account = identity.accountFromPrivateKey(pvk);
// instantiate the class to create the required mutation:
const assetOps = new AtomicAssetOps({ universeId: uni });
const op = updateAssetOp({
nonce,
assetId: asset,
props: updated_asset_props,
metadata: null,
});
assetOps.push({ op });
const sig = assetOps.sign({ web3Account: universe_owner_account });
const mutation = assetOps.mutation({ signature: sig });
`
Mutation to be sent to GraphQL endpoint:
${mutation}
`