How to use the icon-sdk-js.SignedTransaction function in icon-sdk-js

To help you get started, we’ve selected a few icon-sdk-js examples, based on popular ways it is used in public projects.

github icon-project / icon-sdk-js / quickstart / example / js / IcxTransactionExample.js View on Github external
async sendTransaction() {
        // Build raw transaction object
        const transaction = await this.buildICXTransaction();
        // Create signature of the transaction
        const signedTransaction = new SignedTransaction(transaction, this.wallet);
        // Read params to transfer to nodes
        const signedTransactionProperties = JSON.stringify(signedTransaction.getProperties()).split(",").join(", \n")
        document.getElementById('I01-1').innerHTML = `<b>Signed Transaction</b>: ${signedTransactionProperties}`;
        // Send transaction
        this.txHash = await this.iconService.sendTransaction(signedTransaction).execute();
        console.log(this.txHash)
        document.getElementById('I03-1').innerHTML = this.txHash;
        // Print transaction hash
        document.getElementById('I01-2').innerHTML = `<b>Transfer Request Complete.</b> Tx hash is ${this.txHash}`;
    }
github icon-project / icon-sdk-js / quickstart / example / js / DeployAndTransferTokenExample.js View on Github external
async deployScore() {
        // Build raw transaction object
        const transaction = await this.buildDeployTransaction();
        // Create signature of the transaction
        const signedTransaction = new SignedTransaction(transaction, this.wallet);
        // Read params to transfer to nodes
        const signedTransactionProperties = JSON.stringify(signedTransaction.getProperties()).split(",").join(", \n")
        document.getElementById('D01-2').innerHTML = `<b>Signed Transaction</b>: ${signedTransactionProperties}`;
        // Send transaction
        this.deployTxHash = await this.iconService.sendTransaction(signedTransaction).execute();
        document.getElementById('D02-1').innerHTML = this.deployTxHash;
        // Print transaction hash
        document.getElementById('D01-3').innerHTML = `<b>Transfer Request Complete.</b> Tx hash is ${this.deployTxHash}`;
    }
github icon-project / icon-sdk-js / quickstart / example / js / DeployAndTransferTokenExample.js View on Github external
async sendTransaction() {
        if (!this.scoreAddress) {
            document.getElementById('D03-1').innerHTML = 'Deploy ST Token and check deployment transaction first.';
            return;
        }

        // Build raw transaction object
        const transaction = await this.buildTokenTransaction();
        // Create signature of the transaction
        const signedTransaction = new SignedTransaction(transaction, this.wallet);
        // Read params to transfer to nodes
        const signedTransactionProperties = JSON.stringify(signedTransaction.getProperties()).split(",").join(", \n")
        document.getElementById('D03-1').innerHTML = `<b>Signed Transaction</b>: ${signedTransactionProperties}`;
        // Send transaction
        this.transactionTxHash = await this.iconService.sendTransaction(signedTransaction).execute();
        document.getElementById('D05-1').innerHTML = this.transactionTxHash;
        // Print transaction hash
        document.getElementById('D03-2').innerHTML = `<b>Transfer Request Complete.</b> Tx hash is ${this.transactionTxHash}`;
    }