Skip to content

Issue with script.integrity Attribute Causing Errors #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Codam-02 opened this issue Oct 30, 2024 · 0 comments
Open

Issue with script.integrity Attribute Causing Errors #1

Codam-02 opened this issue Oct 30, 2024 · 0 comments

Comments

@Codam-02
Copy link

Codam-02 commented Oct 30, 2024

After resolving a timeout error by adding a useEffect call and making minor adjustments, I'm encountering an issue with the script.integrity attribute.

According to the official documentation, the recommended value for this attribute is sha256-cuUqfbhmgeDDfwx+QGh6ncdr9kAxv8M+MLftyZ+lj9k=, but setting it this way throws an error:
Screenshot 2024-10-29 103539

When I try leaving script.integrity blank as a workaround, a different error appears:
Screenshot 2024-10-29 102734

This is the discussed code snippet:

    ```

const script = document.createElement('script');
script.src = "https://cdn.mayan.finance/mayan_widget_v_1_2_3.js";
script.integrity = "sha256-cuUqfbhmgeDDfwx+QGh6ncdr9kAxv8M+MLftyZ+lj9k=";
script.crossOrigin = "anonymous";

    script.onload = () => {
        const config = {
            appIdentity: {
                name: 'SkyTrade',
                icon: '',
                uri: 'https://sky.trade/',
            },
            rpcs: {
                solana: process.env.NEXT_PUBLIC_RPC_TARGET,
                ethereum: 'https://sepolia.infura.io/v3/060fcd8bc2ae459c99523251e06536b3',
            },
            sourceChains: ['ethereum'],
            destinationChains: ['solana'],
        };
        window.MayanSwap?.init('swap_widget', config);
        console.log("Mayan swap mounted!");
    };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant