Getting Started

Learn how to send transactions using our SDK

Follow these steps to start using our SDK today!!

Step1: Clone the repository

This can be done using the following command:

git clone https://github.com/expand-network/sdk-nodejs.git

Install the project dependencies using the following command:

npm i

Step2: File creation

Once Step1 has been completed, the user can create a javascript file in the root directory and subsequently insert the provided code into the file in order to execute a transaction on the Ethereum network.

const {signTransaction,sendTransaction} = require('./src/index');

async function transfer() {
    const rawTransaction = await signTransaction({
        from: 'SENDER_WALLET_ADDRESS',
        to: 'RECEIVER_WALLET_ADDRESS',
        value: '1', // in wei
        gas: '50000',
    },{
        privateKey: 'YOUR_PRIVATE_KEY',
        xApiKey : 'YOUR_API_KEY',
        chainId : "1" // 5 for goerli
    }).then(rawTransaction => sendTransaction({
        rawTransaction: rawTransaction.rawTransaction,
        xApiKey : 'YOUR_API_KEY',
        chainId:"1" // 5 for goerli
    })).then(res => console.log(res));
}

transfer()

Upon completion of the transaction, the user will be provided with the transaction hash.

For further details, please refer here.

Last updated