Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any document for metadata_serialized and code? #2

Open
xiaozzz opened this issue Aug 26, 2022 · 1 comment
Open

any document for metadata_serialized and code? #2

xiaozzz opened this issue Aug 26, 2022 · 1 comment

Comments

@xiaozzz
Copy link

xiaozzz commented Aug 26, 2022

hi, i see your PR aptos-labs/aptos-core#3522, and really appreicate your work.
the aptos team breaking change stuck my dapp :( so i need your new deployer.
how to use your repo from cli? can you give a tutorial or an example?

metadata_serialized: vector<u8>,
code: vector<vector<u8>>,
@leina05
Copy link

leina05 commented Aug 30, 2022

Hey @macalinao, I've also been struggling to call deployer::publish_package_txn using the TS SDK. What I've been trying is this:

async function publishModulesToResourceAccount(accountFrom, pathsToBytecode) {
  let modules = [];
  for (let p of pathsToBytecode) {
    console.log(p);
    const moduleHex = fs.readFileSync(p).toString("hex");
    modules.push(
      new TxnBuilderTypes.Module(new HexString(moduleHex).toUint8Array())
    );
  }
  const codeSerializer = new BCS.Serializer();
  BCS.serializeVector(modules, codeSerializer);

  const entryFunctionPayload =
    new TxnBuilderTypes.TransactionPayloadEntryFunction(
      TxnBuilderTypes.EntryFunction.natural(
        `${APTOS_DEPLOYER_ADDRESS}::deployer`,
        "publish_package_txn",
        [],
        [
          BCS.bcsSerializeBytes(new Uint8Array([])),
          BCS.bcsSerializeStr("amm"),
          codeSerializer.getBytes(),
        ]
      )
    );
  return await executeTransaction(accountFrom, entryFunctionPayload);
}

But the tx always fails with VM status: Move abort in 0x1::util: 0x10001. Wondering if you might have an example of calling the entry function from TS that has worked recently? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants