I am attempting to deploy a smart contract on my substrate chain through polkadotJS.
const unsub = await code
.tx.new( { gasLimit: 200000, value: 5000 }, true)
.signAndSend(alicePair, (result) => {
if (result.status.isInBlock || result.status.isFinalized) {
// here we have an additional field in the result, containing the blueprint
blueprint = result.blueprint;
unsub();
}else{console.log(result)}
})
However, the if statement fails and i get returned this:
CodeSubmittableResult {
dispatchError: undefined,
dispatchInfo: undefined,
events: [],
status: Type {
registry: TypeRegistry { createdAtHash: undefined },
createdAtHash: undefined,
isFuture: [Getter],
asFuture: [Getter],
isReady: [Getter],
asReady: [Getter],
isBroadcast: [Getter],
asBroadcast: [Getter],
isInBlock: [Getter],
asInBlock: [Getter],
isRetracted: [Getter],
asRetracted: [Getter],
isFinalityTimeout: [Getter],
asFinalityTimeout: [Getter],
isFinalized: [Getter],
asFinalized: [Getter],
isUsurped: [Getter],
asUsurped: [Getter],
isDropped: [Getter],
asDropped: [Getter],
isInvalid: [Getter],
asInvalid: [Getter]
},
blueprint: undefined,
contract: undefined
}
I have no idea what to make of this and I'm clueless of what's wrong here. The contract can be successfully deployed through their UI (when I do this I can visual feedback that a contract on there. In this same UI I can see the amount of transaction raise by 1 everytime I run the code.
So does anyone know what information I can get out of this result or maybe what I am doing wrong? It's hard to follow the docs because it's outdated.