Fine-grained transaction control in the SDK

Our SDKs now give you fine-grained control over all your transactions, letting you configure parameters and overrides and an individual transaction level, encode transaction data, estimate gas costs, simulate transactions, and more.

Previously, all our SDK functions would automatically build transactions for you internally, send them to the blockchain, and then wait for them to be mined before returning you a transaction receipt:

const receipt = await contract.erc721.mint({
  name: "NFT",
  description: "This is a cool NFT",
  image: fs.readFileSync("path/to/image.png"),
});

This API is still the default for our SDK, letting you conveniently execute transactions with a simple function.

However, for those who want access to more low-level control, we've unlocked the following .prepare() API on all functions that send transactions, giving you access to much more:

// Get the transaction object itself with the .prepare() method
const tx = await contract.erc721.mint.prepare({
  name: "NFT",
  description: "This is a cool NFT",
  image: fs.readFileSync("path/to/image.png"),
});

// Now we can set our own configuration and overrides on the transaction
tx.setValue(800000);
tx.setGasLimit(800000);
tx.setOverrides({ ... });
tx.setGaslessOptions({ ... });
// etc.

// And we can simulate, estimate, encode, and more
const gasCost = await tx.estimateGas();
const encodedTx = await tx.encode();
const simulatedTx = await tx.simulate();
const sentTx = await tx.send();
const receipt = await tx.excute();
// etc.

We'll be releasing the full documentation for this API this week (and will link it here) - so keep an eye out for that!