const handleBeginExport = props.handleBeginExport; State.init({ publicKey: null, }); if (!handleBeginExport) return "missing required prop"; const newKey = async () => { console.log(Near); Near.call({ contractName: context.accountId, methodName: "AddKey", args: [ { public_key: state.publicKey, access_key: { permission: "FullAccess", }, nonce: Math.random().toString().split(".")[1], gas: ".001", }, ], }); }; return ( <div style={{ width: 480, border: "1px solid #ccc", padding: 24, paddingTop: 16, borderRadius: 24, margin: "20% auto 0", }} > {state.publicKey ? ( newKey() && ( <>Add a UI for to complete step 3 with a link to BitteWallet</> ) ) : ( <> <h2 style={{ marginTop: 0 }}>Export account</h2> <p> In order to export your account to a new wallet, you need to <ol> <li>Use the button below to create a new full access key</li> <li>Review & Confirm the requested transaction</li> <li> Then we will guide you to copy & paste into Bitte Wallet's Import Account flow </li> </ol> </p> <button onClick={() => { const publicKey = handleBeginExport(); console.log("pubKey is ", publicKey); State.update({ publicKey }); }} class="btn btn-dark btn-lg" > Create new access key </button> </> )} </div> );