Problem on deploying smart contract using SDK

hi guys,

I am trying to deploy smart contract using the SDK but I am getting some error. It would be really great if someone could help here.

const NODE_URL = '' 
const COMPILER_URL = ''
const node = await Node({ url: NODE_URL, internalUrl: NODE_INTERNAL_URL })
    // created the client
    const client = await ContractWithAE({ 
        nodes: [{ name: 'testNode', instance: node }],
        compilerUrl: COMPILER_URL, 
        keypair })

    // got the bytecode
    const bytecode = await client.contractCompile(code)
    console.log(`Obtained bytecode: ${bytecode.bytecode}`)

    // here is the problem : this line says ` TypeError: t.split is not a function`
    const deployed = await client.contractDeploy(bytecode, code, init = []) 


TypeError: t.split is not a function

Hey @nduchak.chain Can you help here, please?

this looks overly complicated. You can just use const contract = await client.getContractInstance(...) and then call await contract.methods.init(...).

1 Like