async deploy(options) {
          if (!this.signer) throw new Error("signer not found");
          if (!this.bytecode) throw new Error("bytecode not found");
          const opts = {
            ...this.options,
            ...options,
          };
          const operation = {
            upload_contract: {
              contract_id: Contract.computeContractId(this.signer.getAddress()),
              bytecode: this.bytecode,
            },
          };
          // return operation if send is false
          if (
            !(opts === null || opts === void 0 ? void 0 : opts.sendTransaction)
          )
            return { operation };
          const transaction = await this.signer.encodeTransaction({
            ...opts,
            operations: [operation],
          });
          const transactionResponse = await this.signer.sendTransaction(
            transaction
          );
          return { operation, transaction, transactionResponse };
        }
/**
         * Function to deploy a new smart contract.
         * The Bytecode must be defined in the constructor of the class
         * @example
         * ```ts
         * const privateKey = "f186a5de49797bfd52dc42505c33d75a46822ed5b60046e09d7c336242e20200";
         * const provider = new Provider(["http://api.koinos.io:8080"]);
         * const signer = new Signer({ privateKey, provider });
         * const bytecode = new Uint8Array([1, 2, 3, 4]);
         * const contract = new Contract({ signer, provider, bytecode });
         * const { transactionResponse } = await contract.deploy();
         * // wait to be mined
         * const blockId = await transactionResponse.wait();
         * console.log(`Contract uploaded in block id ${blockId}`);
         * ```
         */
Function to deploy a new smart contract.
Function to deploy a new smart contract .
async deploy(options) {
          if (!this.signer) throw new Error("signer not found");
          if (!this.bytecode) throw new Error("bytecode not found");
          const opts = {
            ...this.options,
            ...options,
          };
          const operation = {
            upload_contract: {
              contract_id: Contract.computeContractId(this.signer.getAddress()),
              bytecode: this.bytecode,
            },
          };
          if (
            !(opts === null || opts === void 0 ? void 0 : opts.sendTransaction)
          )
            return { operation };
          const transaction = await this.signer.encodeTransaction({
            ...opts,
            operations: [operation],
          });
          const transactionResponse = await this.signer.sendTransaction(
            transaction
          );
          return { operation, transaction, transactionResponse };
        }
async deploy ( options ) { if ( ! this . signer ) throw new Error ( "signer not found" ) ; if ( ! this . bytecode ) throw new Error ( "bytecode not found" ) ; const opts = { ... this . options , ... options , } ; const operation = { upload_contract : { contract_id : Contract . computeContractId ( this . signer . getAddress ( ) ) , bytecode : this . bytecode , } , } ; if ( ! ( opts === null || opts === void 0 ? void 0 : opts . sendTransaction ) ) return { operation } ; const transaction = await this . signer . encodeTransaction ( { ... opts , operations : [ operation ] , } ) ; const transactionResponse = await this . signer . sendTransaction ( transaction ) ; return { operation , transaction , transactionResponse } ; }
Function to deploy a new smart contract.
Function to deploy a new smart contract .
// return operation if send is false