Hethers
  • Documentation
  • Getting Started
  • Application Programming Interface
    • Providers
      • Provider
        • Accounts Methods
        • Logs Methods
        • Network Status Methods
        • Transactions Methods
        • Event Emitter Methods
        • Base Provider
        • HederaProvider
      • Types
    • Contract Interaction
      • Contract
      • ContractFactory
      • Example: ERC-20 Contract
    • Utilities
      • Accounts
      • Addresses
      • Application Binary Interface
        • AbiCoder
        • ABI Formats
        • Fragments
        • Interface
      • BigNumber
      • Byte Manipulation
      • Constants
      • Display Logic and Input
      • Encoding Utilities
      • FixedNumber
      • Hashing Algorithms
      • HD Wallet
      • Logging
      • Property Utilities
      • Signing Key
      • Strings
      • Transactions
      • Web Utilities
      • Wordlists
    • Signers
  • Contributing
  • Other Resources
Powered by GitBook
On this page
  1. Application Programming Interface
  2. Providers
  3. Provider

Transactions Methods

PreviousNetwork Status MethodsNextEvent Emitter Methods

Last updated 3 years ago

provider.getTransaction( transactionIdOrTimestamp ) ⇒ Promise<>

Returns the transaction with hash or null if the transaction is unknown.

This method will query the mirrornode API(by transactionId or consensus timestamp) for the transaction record. If the transaction was only recently sent and not yet mined, this method may also return null.

await provider.getTransaction("0.0.29562194-1645089473-013219243");
// or equivalent
await provider.getTransaction("1645089484.120533000");
// {
//   chainId: 291,
//   hash: '0x9903e295d101ef2a0450e4d7a8eb7fb0ddc63cb136941506aa95a02a92bc399213282b75332aa2d8baec113a67bbfad5',
//   timestamp: '1645089484.120533000',
//   transactionId: '0.0.29562194-1645089473-013219243',
//   from: '0x0000000000000000000000000000000001c31552',
//   to: '0x0000000000000000000000000000000001c5179f',
//   data: '0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806370a082311161007157806370a082311461014157806395d89b411461016a578063a0712d6814610172578063a457c2d714610187578063a9059cbb1461019a578063dd62ed3e146101ad57600080fd5b806306fdde03146100b9578063095ea7b3146100d757806318160ddd146100fa57806323b872dd1461010c578063313ce5671461011f578063395093511461012e575b600080fd5b6100c16101e6565b6040516100ce9190610936565b60405180910390f35b6100ea6100e53660046108f3565b610278565b60405190151581526020016100ce565b6002545b6040519081526020016100ce565b6100ea61011a3660046108b7565b61028e565b604051601281526020016100ce565b6100ea61013c3660046108f3565b61033d565b6100fe61014f366004610862565b6001600160a01b031660009081526020819052604090205490565b6100c1610379565b61018561018036600461091d565b610388565b005b6100ea6101953660046108f3565b6103ce565b6100ea6101a83660046108f3565b610467565b6100fe6101bb366004610884565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101f5906109b1565b80601f0160208091040260200160405190810160405280929190818152602001828054610221906109b1565b801561026e5780601f106102435761010080835404028352916020019161026e565b820191906000526020600020905b81548152906001019060200180831161025157829003601f168201915b5050505050905090565b6000610285338484610474565b50600192915050565b600061029b848484610598565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103255760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b6103328533858403610474565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909161028591859061037490869061098b565b610474565b6060600480546101f5906109b1565b60408051338152602081018390527f0f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d4121396885910160405180910390a16103cb3382610767565b50565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156104505760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b606482015260840161031c565b61045d3385858403610474565b5060019392505050565b6000610285338484610598565b6001600160a01b0383166104d65760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161031c565b6001600160a01b0382166105375760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161031c565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105fc5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161031c565b6001600160a01b03821661065e5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161031c565b6001600160a01b038316600090815260208190526040902054818110156106d65760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161031c565b6001600160a01b0380851660009081526020819052604080822085850390559185168152908120805484929061070d90849061098b565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161075991815260200190565b60405180910390a350505050565b6001600160a01b0382166107bd5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640161031c565b80600260008282546107cf919061098b565b90915550506001600160a01b038216600090815260208190526040812080548392906107fc90849061098b565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b80356001600160a01b038116811461085d57600080fd5b919050565b60006020828403121561087457600080fd5b61087d82610846565b9392505050565b6000806040838503121561089757600080fd5b6108a083610846565b91506108ae60208401610846565b90509250929050565b6000806000606084860312156108cc57600080fd5b6108d584610846565b92506108e360208501610846565b9150604084013590509250925092565b6000806040838503121561090657600080fd5b61090f83610846565b946020939093013593505050565b60006020828403121561092f57600080fd5b5035919050565b600060208083528351808285015260005b8181101561096357858101830151858201604001528201610947565b81811115610975576000604083870101525b50601f01601f1916929092016040019392505050565b600082198211156109ac57634e487b7160e01b600052601160045260246000fd5b500190565b600181811c908216806109c557607f821691505b602082108114156109e657634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220a89138010396e5c52a2e58663294560a5b37fe1fb303e2dc2199cfbb5765afec64736f6c63430008070033',
//   gasLimit: BigNumber { _hex: '0x0493e0', _isBigNumber: true },
//   value: BigNumber { _hex: '0x00', _isBigNumber: true },
//   customData: {
//     gas_used: 240000,
//     logs: [ [Object], [Object] ],
//     result: 'SUCCESS',
//     accountAddress: null,
//     transfersList: []
//   },
//   wait: null
// }

Submits signedTransaction to the network to be mined. The transaction must be signed, and be valid (i.e. the validStart timestamp is correct and the account has sufficient balance to pay for the transaction).

const signedTx = "0x0add012ada010a700a1a0a0b08b9c2f3900610fde1b37e12090800100018ea9a8a09180012060800100018031880a8d6b907220208783200423e0a090800100018ce9dd50c20e0a71242050880ceda034a2000000000000000000000000000000000000000000000000000000000000000646a046d656d6f12660a640a20049d07fb89aa8f5e54eccd7b92846d9839404e8c0af8489a9a511422be958b2f1a409d4cd005a0a4a1cc95401a48aaba8fdfa6522c2f71a294e37f5a810244bf7f240a7d64d88b47244d1a5f33b5acfbbb7fa5da9026f790001fee627e43305c200f";
await provider.sendTransaction(signedTx);
// {
//   transactionId: '0.0.19041642-1646059833-265089277',
//   hash: '0xa53c4eab796c78e541c777b590e73246f18e93b3bdae2859df43e1518920853b46878565c1144dc0b67b074b1f438e5d',
//   from: '0x0000000000000000000000000000000001228d6a',
//   gasLimit: BigNumber { _hex: '0x0493e0', _isBigNumber: true },
//   value: BigNumber { _hex: '0x00', _isBigNumber: true },
//   data: '0x0000000000000000000000000000000000000000000000000000000000000064',
//   chainId: 0,
//   r: '',
//   s: '',
//   v: 0,
//   customData: { contractId: '0000000000000000000000000000000001d6567d' },
//   wait: [Function]
// }

Returns a Promise which will not resolve until the transaction is finalised (mined). This method will block until the transaction is finalised (mined) or until a given timeout has been exceeded.

provider.sendTransaction( signedTransaction ) ⇒ Promise<>

provider.waitForTransaction( transactionIdOrTimestamp [ , timeout ] ) ⇒ Promise<>

TransactionResponse
TransactionResponse
TransactionReceipt