RetrievePrivateKey

Description

Downloads the user's private key as a .txt file. Please ensure that the user is made aware of the risks of exporting their private key before allowing them to pick this option.

Details

Signature

async RetrievePrivateKey(apiKey, walletAddress)

Arguments

Return Value

This function returns a Promise that resolves to the following object:

{
    "statusCode": 1/0,
    "data": "data" // always null
    "error": "error" // error if any, else null
}

Example

import { RetrievePrivateKey } from '@metafi/metafi-js-package';

function App() {

    const handleRetrievePrivateKey = async () => {
        var result = await RetrievePrivateKey("WALLET-ADDRESS", "YOUR-API-KEY");
        console.log("result after retrieving private key", result);
    }
    
    return (
        <div>
	    <button onClick={handleRetrievePrivateKey}>Download Your Private Key</button>
        </div>
    );
}

export default App;

Last updated