Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escape special characters +-&|!(){}[]^"~*?:\ - e.g. \+ \* \!
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
How do I deploy a custom contract with TonWeb?

Given a smart contract, how do I deploy it using the TonWeb SDK?


This question was imported from Telegram Chat: https://t.me/tondev_eng/8841

  
  
Posted one year ago
Votes Newest

Answers


You can use the tonweb-contract component of the TonWeb package.

First, create your contract class:

import {Contract} from 'web3-eth-contract';

export class MyContract extends Contract {
    constructor(provider, options) {
				// insert the bytes of your code here
        options.code = hexToBytes('abcd..');
        super(provider, options);

				// add definitions of the functions of the contract
        this.method.myMethod = ...
    }

    // @override
    createDataCell() {
    }
    
    // @override
    createSigningMessage(options) {
    }
}

Later you can deploy with an instance of the contract:

const contract = new MyContract(provider, options)
const deployMethod = contract.deploy(keyPair.secretKey);
await deployMethod.send();
  
  
Posted one year ago
Jeremy
394 × 5 Administrator