The constructor function takes a NetworkConfig object as a parameter and assigns it to the networkInformation property.
A NetworkConfig object that contains information about the network on which the Supra client is running.
Fund an account with the node's faucet. The request is sent on any network; a node that does not serve
the faucet answers with an error status, which is thrown as a SupraAPIError. The faucet answers before its
transaction executes: pass the returned hash to supra.transaction.waitForTransaction before spending the funds.
The address to fund.
A Promise that resolves to a FaucetTransactionResponse object, the hash of the faucet transaction.
import { SupraClient,Network } from "supra-ts-sdk";
const supra = new SupraClient({ network: Network.TESTNET });
async function runExample() {
const accountAddress = "0x1";
const faucetResponse = await supra.faucet.fundAccountWithFaucet({ accountAddress: accountAddress });
console.log(faucetResponse);
}
runExample().catch(console.error);
Read a faucet transaction by its hash.
The hash returned by fundAccountWithFaucet.
A Promise that resolves to the faucet transaction.
import { SupraClient,Network } from "supra-ts-sdk";
const supra = new SupraClient({ network: Network.TESTNET });
async function runExample() {
const { hash } = await supra.faucet.fundAccountWithFaucet({ accountAddress: "0x1" });
const transaction = await supra.faucet.getFaucetTransaction({ transactionHash: hash });
console.log(transaction.status);
}
runExample().catch(console.error);
The Faucet class provides methods for funding accounts on the Supra network.