Submit Ticket

Here is a detailed explanation of the parameters for the submitTicket API:

Body

Signature:

To obtain a correct interface signature, we need to follow these 5 steps:

  1. Construct the body parameter object correctly according to the requirements.

  2. Concatenate the parameters of the complete body parameter object, sorted alphabetically, using '&' as a separator. For example: chan=FSN&hash=0x4190dc4627cb4e97292...

  3. Prefix the string generated in step 2 with EvmAddress=...&{result of step 2}, for example: EvmAddress=0x42a6685ef29886Cbcb595Aa903f00dea0d1787d8&chan=FSN&hash=0x4190dc4627...

  4. Apply keccak256 hashing to the result of step 3.

  5. Sign the result of step 4 with the wallet.

get Signature examples:

sortParams = (params, evmAddress) => {
    let keys = Object.keys(params)
    if(!keys.length) return undefined
    keys = keys.sort();
    const keyValList = []
    for (const key of keys) {
        const val = params[key];
        if(val) {
            keyValList.push(`${key}=${val}`)
        }
    }
    const data = keyValList.join('&')
    const raw = `EvmAddress=${evmAddress}&${data}`
    return raw
}

// step 1
const bodyParams = {
    chain: "FSN",
    hash: "0x4190dc4627cb4e97292b6b718d718d3c3af93f14477346efc181ff549f69f794"
}

// step 2 & setp3
let raw = sortParams(bodyParams, '0x42a6685ef29886Cbcb595Aa903f00dea0d1787d8') as string;
console.log(raw) // EvmAddress=0x42a6685ef29886Cbcb595Aa903f00dea0d1787d8&chan=FSN&hash=0x4190dc4627cb4e97292b6b718d718d3c3af93f14477346efc181ff549f69f794

// step4
raw = keccak256(toHex(raw));
console.log(raw) // 0x86a444bc2c6104a3aadcf82c00dc6328fea2bd3472298369dedcbdb592ad257d

// step5 Calling wallet message signing
// Calculates an Ethereum-specific signature in EIP-191 format: keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)).
// Note: The signature should not include the prefix '0x'.
let signature = wallet.signMessage(raw)

Last updated