unisat-wallet / dev-support

14 stars 11 forks source link

Getting CORS error in testnet #11

Closed LuisRivera1699 closed 2 months ago

LuisRivera1699 commented 2 months ago

Hello, I'm making a deploying site for my users and when calling the deploy order I'm getting CORS Error. This is my code, hope you can help me.

`const deployJSON = { "receiveAddress": account.address, "feeRate": 1, "outputValue": 546, "devAddress": "", "devFee": 0, "brc20Ticker": tick, "brc20Max": max, "brc20Limit": lim };

// send inscription request
try {
    const response = await axios({
        method: 'post',
        url: 'https://open-api-testnet.unisat.io/v2/inscribe/order/create/brc20-deploy',
        headers: {
            "Authorization": "Bearer {API_KEY}",
            "Content-Type": "application/json",
        },
        data: deployJSON
    }); 

    console.log(response);
} catch (error) {
    console.log("Error while inscription for xverse: ", error);
    openSnackbar(
        <div style={{ maxWidth: 500 }}>
            <p>Error occured. </p>
            <p>{error.message}</p>
        </div>,
        "error"
    );
}`
Joobi424-bit commented 2 months ago

https://open-api-testnet.unisat.io/v2/inscribe/order/create/brc20-deploy

abangZ commented 2 months ago

check your request header. if you javescript, the "Authorization" should be Bearer ${YOUR_API_KEY}