createSmartContract

Create an unsigned transaction to deploy smart contract

Usage

visionWeb.transactionBuilder.createSmartContract(options, address);

Parameters

ParameterDescriptionTypeDefault
optionsDescriptions are below.object-
addressAccount address.stringDefault account address

options parameters

ParameterDescriptionTypeDefault
feeLimitThe maximum VS burns for resource consumption.number20000000
callValueThe VS transfer to the contract for each call.number0
tokenIdThe id of vrc10 token transfer to the contract (Optional).string""
tokenValueThe amount of vrc10 token transfer to the contract for each call (Optional).number0
userFeePercentageConsume user's resource percentage. It should be an integer between [0, 100]. if 0, means it does not consume user's resource until the developer's resource has been used up.number100
originEntropyLimitThe maximum resource consumption of the creator in one execution or creation.number10000000
abiAbi.object | array-
bytecodeBytecode.string""
parametersThe list of the parameters of the constructor, It should be converted hexString after encoded according to ABI encoder. If constructor has no parameter, this can be optional.array[]
nameContract name string.string""
permissionIdOptional, for multi-signature use.number0

Returns

Object

Example

const options = {
  abi: contractObj.abi,
  bytecode: contractObj.bytecode,
  feeLimit: 100000000,
  callValue: 0,
  userFeePercentage: 0,
  originEntropyLimit: 1,
  parameters: [10000000, 'vzz', 18],
};
visionWeb.transactionBuilder.createSmartContract(options);
> {
  visible: false,
  txID: 'c65e546e5131f4f43b81027050dc12ff8397f5e11a3d6086d545398a61cb9521',
  contract_address: '46abc7cf9727128215713c08cd9b89fc1ffbfe540b',
  raw_data: {
    contract: [ [Object] ],
    ref_block_bytes: '460e',
    ref_block_hash: 'df122c6f54acc9a8',
    expiration: 1608466422000,
    fee_limit: 100000000,
    timestamp: 1608466362463
  },
  raw_data_hex: '0a02460e2208df122c6f54acc9a840f0b1c780e82e5aca03081e12c5030a30747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e437265617465536d617274436f6e74726163741290030a15462d7a77f8bef6fe225bf5e353dd6a380f588a149612f6020a15462d7a77f8bef6fe225bf5e353dd6a380f588a14961a2b0a063004380140040a211a08776974686472617722111206616d6f756e741a0775696e743235363002400322ad02608060405234801561001057600080fd5b50d3801561001d57600080fd5b50d2801561002a57600080fd5b5060f4806100396000396000f3fe608060405260043610601c5760003560e01c80632e1a7d4d14601e575b005b348015602957600080fd5b50d38015603557600080fd5b50d28015604157600080fd5b50606b60048036036020811015605657600080fd5b8101908080359060200190929190505050606d565b005b6509184e72a000811115607f57600080fd5b3373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051600060405180830381858888f1935050505015801560c4573d6000803e3d6000fd5b505056fea165627a7a72305820d25d6a32e28beb09d310ed1dd5003acb630ea202a90e018b8cb62545a8a755600029400170dfe0c380e82e900180c2d72f'
}