JSPM

@secux/app-dash

2.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 4
    • Score
      100M100P100Q24723F
    • License MIT

    SecuX Hardware Wallet DASH API

    Package Exports

    • @secux/app-dash

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@secux/app-dash) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    @secux/app-dash

    SecuX Hardware Wallet DASH API

    Usage

    import { SecuxDASH, ScriptType } from "@secux/app-dash";

    First, create instance of ITransport


    Examples

    1. Get address by BIP32 path
    // native segwit address (default script: P2WPKH)
    const address = SecuxDASH.getAddress(
        device,
        "m/84'/5'/0'/0/0",
        // optional object
        { 
            // define specific script
            script: ScriptType.P2WPKH  
        }
    );
    
    // segwit address (default script: P2SH_P2WPKH)
    const address = SecuxDASH.getAddress(
        device, 
        "m/49'/5'/0'/0/0"
    );
    
    // legacy address (default script: P2PKH)
    const address = SecuxDASH.getAddress(
        device, 
        "m/44'/5'/0'/0/0"
    );
    1. sign transaction (support legacy transaction currently)
    const inputs = [
        {
            hash: "d1471f2c9ab2b7d1814c80f18f270efa779a489d696ee8db2ee13360111e486d",
            vout: 0,
            // for p2pkh, the raw transaction of utxo is needed
            txHex: "01000000014dbd59d6ed38562107fbeb0220e31edb8c1ba8b73a34b2f824f512a24b3cbf91010000006b483045022100fa1bd6657fe88fb2b830c40b2841f7a6bfa3f154ad5913ff4aea1e2d3e139a0802207f43cb96d1cd5aa0744cb5092b01ab807fa800a798443f10ed590610925ca7160121025abaf3afa351406dc55d646c40da53c0f2fe9736ebcf6fca232a122c21b6c897ffffffff02a0860100000000001976a914c9340fea78f10172d839a2c6f4fa38dda161ef5588ac7a499300000000001976a914784ab02b6007b8847900a3543f53b597482d52a288ac00000000",
            satoshis: 100000,
            path: "m/44'/5'/0'/0/0"
        },
        {
            hash: "cfdf9cac901d2b58d94b5794f71505ad13ef54739174a46657a11b74013b63de",
            vout: 0,
            // for p2pkh, the raw transaction of utxo is needed
            txHex: "010000000106f0f36dc6ca008844b02e35f8f61eff042bc2dc95c03ed9555a652e504b4b25000000006b483045022100cf8c5e46bc32224a2bbac92e1fc45bbfe568dd4ea73176f5d78b4dac1e90e023022019efabf3c096a00c54d8073dc452defb826498bb230ca83b966ae94705ce6975012102b92ed8814ae5dc22c33ff0049aed40d8b9d98eaef09ac555e2f86fbb9fe7aa49ffffffff01b0840100000000001976a9145f2595bafb0ce9c9869963fb67b9100bd2235f9e88ac00000000",
            satoshis: 99504,
            path: "m/44'/5'/2'/0/0"
        }
    ];
    
    const out = {
        address: "XefQmd7TDrF8cMUqTBuP5FUfA1frnUc8pW",
        satoshis: 99999
    };
    
    // or send to another account
    // const out = {
    //     path: "m/44'/5'/2'/0/2",
    //     satoshis: 99999
    // };
    
    const utxo = {
        path: "m/44'/5'/3'/0/4",
        satoshis: 88888
    };
    
    
    const { raw_tx, signature } = await SecuxDASH.signTransaction(
        device,
        inputs,
        {
            to: out,
            utxo: utxo
        }
    );

    API doc

    SecuxDASH

    DASH package for SecuX device

    Kind: global class


    SecuxDASH.getAddress(trans, path, [option])string

    Get address derived by given BIP32 path

    Kind: static method of SecuxDASH
    Returns: string - address

    Param Type Description
    trans ITransport
    path string BIP32
    [option] AddressOption


    SecuxDASH.signTransaction(trans, inputs, outputs)object

    Create transaction and Sign

    Kind: static method of SecuxDASH
    Returns: object - signed
    string - signed.raw_tx
    Array<Buffer> - signed.signature

    Param Type
    trans ITransport
    inputs Array<txInput>
    outputs txOutput