#!/bin/bash

set -e

# Base URL for creating a deBridge DLN order and simulating hook execution
BASE_URL="<https://dln.debridge.finance/v1.0/dln/order/create-tx>"
# Does not create an order or simulate or generate calldata
BASE_QUOTE_URL="<https://dln.debridge.finance/v1.0/dln/order/quote>"

DEST_EVM_MULTICALL_DATA="0xf87ef80000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000024b760faf9000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003e41fad948c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000124f8000000000000000000000000000000000000000000000000000000000000249f0000000000000000000000000000000000000000000000000000000000000c3500000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001634ff9813a89059ebceea3d22f6aaac6017326ce7bdac65268f8c43ab1c6076bb9778d3e448868e292fd5cc78570008fec1ebeba200528aefaacfb04d8921721591bffff00fb7b2266726f6d4173736574223a7b2261646472657373223a22307865656565656565656565656565656565656565656565656565656565656565656565656565656565222c22616d6f756e74223a7b2276616c7565223a22493462796238454141413d3d227d2c22636861696e4964223a7b2276616c7565223a2269513d3d227d7d2c22746f5374616b65223a7b2261646472657373223a22307831616442393530643862423364413462453130343231314435414230333836323865343737664536222c22616d6f756e74223a7b2276616c7565223a2244304a41227d2c22636861696e4964223a7b2276616c7565223a224f413d3d227d7d7d022888e8d1a6aceef5654411f42da98fc4841c913e9020189dc19053917530528affff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

# Hook configuration for ERC-4337 EntryPoint interaction
DLN_HOOK=$(cat <<EOF
{
    "type": "evm_transaction_call",
    "data": {
        "to": "0xEa749Fd6bA492dbc14c24FE8A3d08769229b896c",
        "calldata": "$DEST_EVM_MULTICALL_DATA",
        "gas": 30000000
    }
}
EOF
)

# Encode DLN_HOOK properly
DLN_HOOK_ENCODED=$(echo "$DLN_HOOK" | jq -c | jq -sRr '@uri')

# URL parameters
PARAMS=(
    "srcChainId=137"  # Polygon
    "srcChainTokenIn=0x0000000000000000000000000000000000000000"  # Native MATIC
    "srcChainTokenInAmount=100000000000000000"
    "dstChainId=56"  # BSC
    "dstChainTokenOut=0x0000000000000000000000000000000000000000"  # Native BNB
    "dstChainTokenOutAmount=auto"
    "affiliateFeePercent=0"
    "dstChainTokenOutRecipient=0x388b635c58Ee82a6748A2033f4520E6976064CE3"
    "senderAddress=0x388b635c58Ee82a6748A2033f4520E6976064CE3"
    "~~srcChainOrderAuthorityAddress~~=0x388b635c58Ee82a6748A2033f4520E6976064CE3"
    "srcAllowedCancelBeneficiary=0x388b635c58Ee82a6748A2033f4520E6976064CE3"
    "dstChainOrderAuthorityAddress=0x388b635c58Ee82a6748A2033f4520E6976064CE3"
    "dlnHook=$DLN_HOOK_ENCODED"
    "prependOperatingExpenses=true"
)

# Construct the full URL with parameters
FULL_URL="${BASE_URL}?$(IFS='&'; echo "${PARAMS[*]}")"

# debug Echo the properly escaped curl command
# printf 'curl -s -X GET %q -H "accept: application/json"\\n' "$FULL_URL"

# Execute the curl command
curl -s -X GET "${FULL_URL}" \\
    -H "accept: application/json"

https://dln.debridge.finance/v1.0#/

CLI Workflow

Prerequisite your default chain should point to chain-id 137 (Polygon)

1. CLI sign xchain userOps

# Polygon -> BSC
# Note maxFeePerGas/maxPriorityFeePerGas values on 2nd userOp
go run main.go sign --c bsc --u '[           
   {
      "s-ender":"0x388b635c58Ee82a6748A2033f4520E6976064CE3",
      "nonce":"0x8",
      "initCode":"0x",
      "callData":"{\\"fromAsset\\":{\\"address\\":\\"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\\",\\"amount\\":{\\"value\\":\\"I4byb8EAAA==\\"},\\"chainId\\":{\\"value\\":\\"iQ==\\"}},\\"toStake\\":{\\"address\\":\\"0x1adB950d8bB3dA4bE104211D5AB038628e477fE6\\",\\"amount\\":{\\"value\\":\\"D0JA\\"},\\"chainId\\":{\\"value\\":\\"OA==\\"}}}",
      "callGasLimit":"0xc3500",
      "verificationGasLimit":"0x1d4c0",
      "preVerificationGas":"0x186a0",
      "maxFeePerGas":"0x0",
      "maxPriorityFeePerGas":"0x0",
      "paymasterAndData":"0x",
      "signature":"0x"
   },
   {
      "sender":"0x388b635c58Ee82a6748A2033f4520E6976064CE3",
      "nonce":"0x2",
      "initCode":"0x",
      "callData":"{\\"fromAsset\\":{\\"address\\":\\"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee\\",\\"amount\\":{\\"value\\":\\"I4byb8EAAA==\\"},\\"chainId\\":{\\"value\\":\\"iQ==\\"}},\\"toStake\\":{\\"address\\":\\"0x1adB950d8bB3dA4bE104211D5AB038628e477fE6\\",\\"amount\\":{\\"value\\":\\"D0JA\\"},\\"chainId\\":{\\"value\\":\\"OA==\\"}}}",
      "callGasLimit":"1200000",
      "verificationGasLimit":"150000",
      "preVerificationGas":"50000",
      "maxFeePerGas":"1500000000",
      "maxPriorityFeePerGas":"1500000000",
      "paymasterAndData":"0x",
      "signature":"0x"
   }
]'

2. Multicall generation with funding rather than Safe multisend

Multicall doc: https://docs.squidrouter.com/api-and-sdk-integration/key-concepts/hooks/using-the-full-erc20-or-native-balance-in-a-call

#!/bin/zsh

# Addresses configuration
WALLET_ADDRESS="0x388b635c58Ee82a6748A2033f4520E6976064CE3"
ENTRYPOINT_ADDRESS="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789"
NATIVE_TOKEN="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"

# handleOps)
USER_OP_CALLDATA="0x1fad948c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000124f8000000000000000000000000000000000000000000000000000000000000249f0000000000000000000000000000000000000000000000000000000000000c3500000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001634ff9813a89059ebceea3d22f6aaac6017326ce7bdac65268f8c43ab1c6076bb9778d3e448868e292fd5cc78570008fec1ebeba200528aefaacfb04d8921721591bffff00fb7b2266726f6d4173736574223a7b2261646472657373223a22307865656565656565656565656565656565656565656565656565656565656565656565656565656565222c22616d6f756e74223a7b2276616c7565223a22493462796238454141413d3d227d2c22636861696e4964223a7b2276616c7565223a2269513d3d227d7d2c22746f5374616b65223a7b2261646472657373223a22307831616442393530643862423364413462453130343231314435414230333836323865343737664536222c22616d6f756e74223a7b2276616c7565223a2244304a41227d2c22636861696e4964223a7b2276616c7565223a224f413d3d227d7d7d022888e8d1a6aceef5654411f42da98fc4841c913e9020189dc19053917530528affff0000000000000000000000000000000000000000000000000000000000"

echo "Generating Multicall components..."

# Step 1: Generate Call 1 components (EntryPoint deposit)
printf "\\nStep 1: EntryPoint deposit call components"
DEPOSIT_CALLDATA=$(cast calldata "depositTo(address)" $WALLET_ADDRESS)
echo "Deposit calldata: $DEPOSIT_CALLDATA"

DEPOSIT_PAYLOAD=$(cast abi-encode "payload(address,uint256)" $NATIVE_TOKEN 0)
echo "Deposit payload: $DEPOSIT_PAYLOAD"

# Step 2: Add the destination userOps handleOps calldata
printf "\\nStep 2: Generating final multicall calldata"
MULTICALL_ARRAY="[(2,$ENTRYPOINT_ADDRESS,0,$DEPOSIT_CALLDATA,$DEPOSIT_PAYLOAD),(0,$ENTRYPOINT_ADDRESS,0,$USER_OP_CALLDATA,0x)]"
#MULTICALL_ARRAY="[(2,$ENTRYPOINT_ADDRESS,0,$DEPOSIT_CALLDATA,$DEPOSIT_PAYLOAD),(1,$USDC_ADDRESS,0,$TRANSFER_CALLDATA,$TRANSFER_PAYLOAD),(0,$ENTRYPOINT_ADDRESS,0,$USER_OP_CALLDATA,0x)]"

# Step 3: Generate the final multicall calldata
printf "\\nStep 3: Generating final encoded calldata"
FINAL_CALLDATA=$(cast calldata "run((uint8,address,uint256,bytes,bytes)[])" "$MULTICALL_ARRAY")

# Output results
echo "Multicall calldata:"
echo "$FINAL_CALLDATA"

# Optional: Save to file
printf "\\nSaving results to multicall_output.txt"
{
    echo "Components:"
    echo "==========="
    echo "Deposit Calldata: $DEPOSIT_CALLDATA"
    echo "Deposit Payload: $DEPOSIT_PAYLOAD"
    echo "Transfer Calldata: $TRANSFER_CALLDATA"
    echo "Transfer Payload: $TRANSFER_PAYLOAD"
    printf "\\nFinal Multicall Calldata:"
    echo "======================="
    echo "$FINAL_CALLDATA"
}

Create deBridge order request (script above):

Generate multicall calldata and use it below

curl -s -X GET <https://dln.debridge.finance/v1.0/dln/order/create-tx\\?srcChainId=137\\&srcChainTokenIn=0x0000000000000000000000000000000000000000\\&srcChainTokenInAmount=100000000000000000\\&dstChainId=56\\&dstChainTokenOut=0x0000000000000000000000000000000000000000\\&dstChainTokenOutAmount=auto\\&affiliateFeePercent=0\\&dstChainTokenOutRecipient=0x388b635c58Ee82a6748A2033f4520E6976064CE3\\&senderAddress=0x388b635c58Ee82a6748A2033f4520E6976064CE3\\&srcChainOrderAuthorityAddress=0x388b635c58Ee82a6748A2033f4520E6976064CE3\\&srcAllowedCancelBeneficiary=0x388b635c58Ee82a6748A2033f4520E6976064CE3\\&dstChainOrderAuthorityAddress=0x388b635c58Ee82a6748A2033f4520E6976064CE3\\&dlnHook=%7B%22type%22%3A%22evm_transaction_call%22%2C%22data%22%3A%7B%22to%22%3A%220xEa749Fd6bA492dbc14c24FE8A3d08769229b896c%22%2C%22calldata%22%3A%220xf87ef80000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000024b760faf9000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003e41fad948c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000124f8000000000000000000000000000000000000000000000000000000000000249f0000000000000000000000000000000000000000000000000000000000000c3500000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001634ff9813a89059ebceea3d22f6aaac6017326ce7bdac65268f8c43ab1c6076bb9778d3e448868e292fd5cc78570008fec1ebeba200528aefaacfb04d8921721591bffff00fb7b2266726f6d4173736574223a7b2261646472657373223a22307865656565656565656565656565656565656565656565656565656565656565656565656565656565222c22616d6f756e74223a7b2276616c7565223a22493462796238454141413d3d227d2c22636861696e4964223a7b2276616c7565223a2269513d3d227d7d2c22746f5374616b65223a7b2261646472657373223a22307831616442393530643862423364413462453130343231314435414230333836323865343737664536222c22616d6f756e74223a7b2276616c7565223a2244304a41227d2c22636861696e4964223a7b2276616c7565223a224f413d3d227d7d7d022888e8d1a6aceef5654411f42da98fc4841c913e9020189dc19053917530528affff0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000%22%2C%22gas%22%3A10000%7D%7D%0A\\&prependOperatingExpenses=true> -H "accept: application/json"

deBridge Response copy values

...
  "tx": {
    "value": "4732164016831923440",
    "data": "0x4d8160ba00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003abbaac0167504f000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000001ff3684f28c67538d4d072c2273400000000000000000000000000000000000000000000000000000000000001600000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c335900000000000000000000000000000000000000000000000000000000002cd1c3000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce3000000000000000000000000ef4fb24ad0916217251f553c0596f8edc630eb6600000000000000000000000000000000000000000000000000000000000006a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005042213bc0b000000000000000000000000ff4b330c5bc3811b66d8864cf8078d8f2db20dd600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003abbaac0167504f0000000000000000000000000ff4b330c5bc3811b66d8864cf8078d8f2db20dd600000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000004241fff991f000000000000000000000000663dc15d3c1ac63ff12e45ab68fea3f0a883c2510000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c335900000000000000000000000000000000000000000000000000000000002cd17800000000000000000000000000000000000000000000000000000000000000a03a32666f127de42823cc70e500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000010438c9c147000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000000000000027100000000000000000000000000d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000024d0e30db00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e48d68a156000000000000000000000000ff4b330c5bc3811b66d8864cf8078d8f2db20dd6000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c0d500b1d8e8ef31e21c99d1db9a6444d3adf1270000000643c499c542cef5e3811e1192ce70d8cc03d5c33590000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000064c876d21d000000000000000000000000950db30641e5d2deca6662b35f417b4841ff89e80000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c335900000000000000000000000000000000000000000000000000000000002d470c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ce4b930370100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000193a88d38b40000000000000000000000000000000000000000000000000000000000000c2000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c400000000000000000000000000000000000000000000000000000000000000c600000000000000000000000003c499c542cef5e3811e1192ce70d8cc03d5c335900000000000000000000000000000000000000000000000000000000002cd1c3000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000007476f025fef1000000000000000000000000000000000000000000000000000000000000003800000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce300000000000000000000000000000000000000000000000000000000000001e0000000000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000b20000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014388b635c58ee82a6748a2033f4520e6976064ce30000000000000000000000000000000000000000000000000000000000000000000000000000000000000014388b635c58ee82a6748a2033f4520e6976064ce30000000000000000000000000000000000000000000000000000000000000000000000000000000000000014555ce236c0220695b68341bc48c68d52210cc35b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000881010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000007800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000ea749fd6ba492dbc14c24fe8a3d08769229b896c00000000000000000000000000000000000000000000000000000000001e8480000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000006c4f87ef80000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000020000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000024b760faf9000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce3000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000004c000000000000000000000000000000000000000000000000000000000000003e41fad948c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce300000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000388b635c58ee82a6748a2033f4520e6976064ce30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001800000000000000000000000000000000000000000000000000000000000124f8000000000000000000000000000000000000000000000000000000000000249f0000000000000000000000000000000000000000000000000000000000000c3500000000000000000000000000000000000000000000000000000000059682f000000000000000000000000000000000000000000000000000000000059682f0000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001634ff9813a89059ebceea3d22f6aaac6017326ce7bdac65268f8c43ab1c6076bb9778d3e448868e292fd5cc78570008fec1ebeba200528aefaacfb04d8921721591bffff00fb7b2266726f6d4173736574223a7b2261646472657373223a22307865656565656565656565656565656565656565656565656565656565656565656565656565656565222c22616d6f756e74223a7b2276616c7565223a22493462796238454141413d3d227d2c22636861696e4964223a7b2276616c7565223a2269513d3d227d7d2c22746f5374616b65223a7b2261646472657373223a22307831616442393530643862423364413462453130343231314435414230333836323865343737664536222c22616d6f756e74223a7b2276616c7565223a2244304a41227d2c22636861696e4964223a7b2276616c7565223a224f413d3d227d7d7d022888e8d1a6aceef5654411f42da98fc4841c913e9020189dc19053917530528affff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014388b635c58ee82a6748a2033f4520e6976064ce30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000420101000000458ed9bba8362a38000000000000000000000000f1fe25f07674000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "to": "0x663DC15D3C1aC63ff12E45Ab68FeA3F0a883C251"
  },

Generate final calldata from values above

cast calldata "xCall(uint256,address,bytes)" \\
  <value> \\
  0x663DC15D3C1aC63ff12E45Ab68FeA3F0a883C251 \\
<0x4d8160ba000000...>

CLI submit on chain