what is window.cardano
mailtodanish opened this issue · comments
what is difference in window.cardano and Loader.cardano? I am not able to understand window.cardano please give some light on it...
I guess same script in JS is like below.
const txhash = await this._blockfrostRequest({
endpoint: `/tx/submit`,
headers: {
"Content-Type": "application/cbor",
},
body: Buffer.from(signedTx.to_bytes(), "hex"),
networkId: networkId,
method: "POST",
});
return txhash;
Loader.Cardano is the loaded WebAssembly cardano serialization lib;
window is the global object in a browser environment; window.cardano is an object injected when a wallet extension is present it should contain only the wallet accessor, the code has been updated to support the last CIP-0030 and that part is similar to WalletObject.submitTx
where WalletObject is setted once the wallet is enabled; as an example using: window.cardano.selectedWallet.enable().then( walletObj => WalletObject = walletObj )