- Install the package
npm install @bwarelabs/blast-sdk-js
- Initialize
const config: BlastConfig = {
projectId: '<insert-your-project-id-here>',
network: BlastNetwork.ETH_MAINNET,
rateLimit: BlastSubscriptionPlan.Free,
};
const blast = new Blast(config);- Ready to go!
const gasPrice = await blast.apiProvider.eth.getGasPrice();https://docs.blastapi.io/blast-documentation/blast-sdk
The Blast object has 2 providers:
blast.apiProviderblast.wsProvider
Both of them are wrappers over Web3 (web3js).
Therefore, they support the same calls as the Web3 provider, for an easy integration with your app.
The network specified in config must have this form BlastNetwork.<network> (ex: BlastNetwork.ETH_MAINNET).
The SDK currently supports the following networks:
ARBITUM_GOERLIARBITUM_ONEARBITUM_NOVAARBITUM_SEPOLIAASTAR_MAINNETBASE_GOERLIBASE_MAINNETBSC_MAINNETBSC_TESTNETETH_MAINNETETH_SEPOLIAETH_GOERLIEVMOS_MAINNETFANTOM_MAINNETFANTOM_TESTNETGNOSIS_MAINNETLINEA_GOERLILINEA_MAINNETMANTLE_GOERLIMANTLE_MAINNETMETIS_MAINNETMOONBASE_ALPHAMOONBEAM_MAINNETMOONRIVER_MAINNETOKTC_MAINNETOPTIMISM_MAINNETOPTIMISM_GOERLIPALM_MAINNETPALM_TESTNETPOLYGON_MAINNETPOLYGON_TESTNETSCROLL_ALPHANETSCROLL_MAINNETSCROLL_SEPOLIASHIDEN_MAINNETSHIDEN_SHIBUYA
In order to use the new builder api create the blast config as above and run one of the blast methods
const config: BlastConfig = {
projectId: '<insert-your-project-id-here>',
network: BlastNetwork.ETH_MAINNET,
rateLimit: BlastSubscriptionPlan.Free,
};
const blast = new Blast(config);const result = await blast.builder.getTransaction('0x067ce4942cb3c65fe74e21063c35f786eb666712ba5d074d2dff56a6d28c1ba3')
console.log(result)The builder api works only on supported networks
The Builder API supports only the following networks:
ARBITUM_ONEBASE_MAINNETETH_MAINNETOPTIMISM_MAINNET