Desplegar contrato SDK s

Tengo este error, y he revisado la documentacion, donde dice que para desplegar un contrato, se debe pasar el bytecode (string), source (string), initState (array), options (object), se lo estoy pasando asi y me sale error… alguien que me pueda ayudar… Gracias!

async deploy () {
console.log(Deploying contract...)
try {
const callOpts = {
fee: null,
ttl: 55,
gas: 1000000,
amount: 0,
deposit: 0,
const deployObj = ["${}","${this.symbol}",${this.decimals},${this.total_supply}]
const deployed = await this.client.contractDeploy(this.byteCode,this.contractCode,deployObj,callOpts)
console.log(‘deployed contract address:’, deployed.address)
return deployed

 } catch (err) {


1 Like

Hey, sorry I don’t speak any spanish, but I hope I can help anyways.

Your deployObj format seems to be incorrect, this has to be a tuple of values as string. Also as a second parameter you would statically use 'sophia' as your contract is in Sophia.

await this.client.contractDeploy(this.byteCode, 'sophia', {initState: `("${}", "${this.symbol}", ${this.decimals}, ${this.total_supply})`})

The options parameter is optional and good default values are chosen.

I hope this helps :slight_smile:

Hola @Cristhen, espero que la respuesta de piwo te sea de ayuda, si necesitas más información para solventar el error comentanos por acá. Feliz inicio de semana.

same mistake

Hello, what version of the SDK are you using? Also what is the updated code for your contract call?

@Albert/aepp-sdk": "^2.4.0

const deployed = await this.client.contractDeploy(this.byteCode, “sophia”, {initState: ("${}", "${this.symbol}", ${this.decimals}, ${this.total_supply})})

Hey, in 2.4.0 we change contract interface so you need to deploy it like this:

const contract = await this.client.getContractInstance(sourceCode)
await contract.deploy([ `("${}", "${this.symbol}", ${this.decimals}, ${this.total_supply})` ], options)