submitTransaction
This endpoint forms a transaction for users of an INTU vault to sign
submitTransaction
This allows us to form a transaction for participants to sign. The base64 string output is what we store in the smart contract. Most of this input will come from a form you create on your page.
The other information will come from the getVaults function.
- Example included to propose sending an NFT at the bottom of this page!
import { submitTransaction, getVaults } from "@intuweb3/web-exp";
let myVaults = getVaults("0x12345_user_address", provider)
let nonce = myVaults[i].transactionCount // the first nonce in a vault should always be 0
let value = ethers.utils.parseEther(String(AMOUNTFROMYOURFORM))._hex // in eth
let to = FROMYOURFORM
let chainId = FROMYOURFORM
let data = 0x1...
let gasPrice = "" // or an amount of your choosing
let gas = "" // or an amount of your choosing
await submitTransaction(to, value, chainId, nonce, data, gasPrice, gas, vaultAddress, signer, notes?)
Input | Type of Input | Description |
---|---|---|
to | string | The address to send funds to |
value | string | The amount to send to the address (in eth) |
chainId | string | number | The network ID to send the transaction on |
nonce | string | number | Current transaction nonce of the vault's EOA |
data | string | Send an NFT or contract interaction - In encoded form - Example: https://docs.sequence.xyz/wallet/guides/send-erc721/ |
gasPrice | string | number | Blank if you want current market conditions |
gas | string | number | Blank if you want current market conditions |
signer | object | Signer object from ethers |
notes | string | Optional, gives you the option to store additional data with the transaction |
//example for sending a simple transaction
import { submitTransaction, getVaults } from "@intuweb3/web-exp";
let myVaults = getVaults("0x12345_user_address", provider);
let chainId = "1";
let value = "0.00001";
let to = "0x12345";
let gasPrice = 100000; //or leave blank and we'll figure it out
let gas = 21000; //or leave blank and we'll figure it out
let nonce = await provider.getTransactionCount(myVaults[0].getTransactionCount);
let data = "";
await submitTransaction(
to, //contract address - the contract that launched the NFT Iwas trying to transfer
value, //always 0 for contract interaction I think...
String(chainId),
String(nonce),
data, // encodedData
gasPrice, // ""
gas, // ""
myVaultAddress, //address of vault you are interacting with
signer
);
//example for sending a NFT!
import { submitTransaction, getVaults } from "@intuweb3/web-exp";
let myVaults = getVaults("0x12345_user_address", provider);
const erc721Interface = new ethers.utils.Interface(["function safeTransferFrom(address _from, address _to, uint256 _tokenId)"]); //boilerplate
const encodedData = erc721Interface.encodeFunctionData("safeTransferFrom", [
"0x1111111111111111111111111111111111111111",
"0x2222222222222222222222222222222222222222",
4, //token id
]); // we just plug this const into the data field of submitTransaction
await submitTransaction(
to, //contract address - the contract that launched the NFT Iwas trying to transfer
value, //always 0 for contract interaction I think...
String(chainId),
String(nonce),
data, // encodedData
gasPrice, // ""
gas, // ""
myVaultAddress, //address of vault you are interacting with
signer
);