Function encodeToConfigAddress

  • encode a script to an address with args and a key of config

    Parameters

    • args: string

      script args

    • scriptType: "SECP256K1_BLAKE160" | "SECP256K1_BLAKE160_MULTISIG" | "DAO" | "SUDT" | "ANYONE_CAN_PAY" | "OMNILOCK"

      a key of config.SCRIPTS

    Returns string

    Example

    // parse a predefined lock to an address
    encodeToConfigAddress('0x12345678123456781234567812345678', 'SECP256K1_BLAKE160');
    // parse a custom lock to an address
    encodeToConfigAddress('0x12345678123456781234567812345678', 'MY_CUSTOM_LOCK', {
    SCRIPTS: {
    MY_CUSTOM_LOCK: {...}
    }
    })
  • encode a script to an address with args and a key of config

    Type Parameters

    Parameters

    • args: string

      script args

    • scriptType: keyof C["SCRIPTS"]

      a key of config.SCRIPTS

    • options: {
          config?: C;
      }
      • Optional config?: C

    Returns string

    Example

    // parse a predefined lock to an address
    encodeToConfigAddress('0x12345678123456781234567812345678', 'SECP256K1_BLAKE160');
    // parse a custom lock to an address
    encodeToConfigAddress('0x12345678123456781234567812345678', 'MY_CUSTOM_LOCK', {
    SCRIPTS: {
    MY_CUSTOM_LOCK: {...}
    }
    })

Generated using TypeDoc