-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
I'm trying to deploy a compiled fa_coin package to testnet using a sponsored transaction (package deployed by one account, fee payed by another).
See this transaction: 0x2dd173dc63f94801fa4349238e95d83b176b0205cb05ed6fde3184347fbacd70
All indications in my debugging are that the raw transaction to publish the package is getting constructed and the transaction is getting signed and submitted. However, I seem to be getting an error waiting for the transaction to settle:
AptosApiError: Request to [Fullnode]: GET https://api.testnet.aptoslabs.com/v1/accounts/0xbf5d895db6fb2107f1cc7a5d432b703d91ef4ce2fee1998726da75f3bab69ddf/module/fa_coin failed with: {"message":"Module not found by Address(0xbf5d895db6fb2107f1cc7a5d432b703d91ef4ce2fee1998726da75f3bab69ddf), Module name(fa_coin) and Ledger version(6932789945)","error_code":"module_not_found","vm_error_code":null}
As evidenced by the transaction above both sender and fee payer see the call to publish the package, and the fee payer has more than sufficient APT to cover gas costs.
let rawTx: AnyRawTransaction;
try {
rawTx = await aptos.transaction.build.simple({
sender: deployerAccount.accountAddress,
withFeePayer: true,
data: {
function: "0x1::code::publish_package_txn",
functionArguments: [metadataBytes, moduleBytecode],
},
});
console.log("Raw transaction constructed.");
} catch (error) {
console.error("Error constructing raw transaction:", error);
rawTx = {} as AnyRawTransaction;
}
//
// This is a sponsored transaction, so we need to sign it with both the deployer and sponsor accounts...
//
const deployerAuthenticator = aptos.transaction.sign({ signer: deployerAccount, transaction: rawTx });
const sponsorAuthenticator = aptos.transaction.signAsFeePayer({ signer: sponsorAccount, transaction: rawTx });
let commitedTx: any;
try {
commitedTx = await aptos.transaction.submit.simple({
transaction: rawTx,
senderAuthenticator: deployerAuthenticator,
feePayerAuthenticator: sponsorAuthenticator,
});
console.log("Transaction committed.");
console.log("Transaction hash:", commitedTx.hash);
} catch (error) {
console.error("Error committing transaction:", error);
commitedTx = {} as any;
}
try {
await aptos.waitForTransaction({
transactionHash: commitedTx.hash,
});
console.log("Transaction confirmed.");
} catch (error) {
console.error("Error waiting for transaction:", error);
}
//
// Write resulting module address to disk...
//
const metadataAddress = await getMetadata(deployerAccount);
console.log("Metadata address:", metadataAddress);
await storeContractAddress(deployerAccount.accountAddress.toString(), metadataAddress);
Execution is failing at await aptos.waitForTransaction. Assume that [metadataBytes, moduleBytecode] are valid. Any thoughts?