bnb-chain / greenfield-js-sdk

JS SDK for Greenfield

Home Page:https://docs.bnbchain.org/greenfield-js-sdk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems with offchain Auth

AndrewChupin opened this issue · comments

During offchain auth I get an error, deployment on localhost:8082:

    const providers = await gf.client.sp.getStorageProviders()
                            const provider = window.ethereum

                            const { code, body, message }  = await gf.client.offchainauth.genOffChainAuthKeyPairAndUpload(
                                {
                                    sps: providers
                                        .map((item) => {
                                            return {
                                                address: item.operatorAddress,
                                                endpoint: item.endpoint,
                                                name: item.description.moniker,
                                            }
                                        }),
                                    chainId: net.chain?.id || 0,
                                    expirationMs: 7 * 24 * 60 * 60 * 1000,
                                    domain: window.location.origin,
                                    address: address,
                                },
                                provider
                            )

                            if (code !== 0) {
                                console.log('gen offchainauth key pair error', message);
                                return;
                            }

Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.

commented

It looks like there was an error loading the zk wasm file

Is that how you use it:

const client = Client.create(GRPC_URL, String(GREEN_CHAIN_ID), {
  zkCryptoUrl:
    'https://unpkg.com/@bnb-chain/greenfield-zk-crypto@0.0.3/dist/node/zk-crypto.wasm',
});

doc: https://docs.bnbchain.org/greenfield-js-sdk/client/greenfield-client/

Yeah, it works thanks