Metafi JS SDK
Developer PortalMore Docs ⏷About Us ⏷Help & Resources ⏷
  • What's new in this version?
  • Get Started
  • SDK Reference
    • Login
    • EstimateTransferTokensGas
    • TransferTokens
    • CallGenericReadFunction
    • CallGenericWriteFunction
    • CallGenericWriteFunctionTest
    • CallGaslessFunction
    • RetrieveUser
    • RegisterToken
    • Disconnect
    • Other Functions
      • RetrievePrivateKey
      • DeleteUser
  • Constants
    • Chain
    • Asset
Powered by GitBook
On this page
  • Description
  • Details
  • Signature
  • Arguments
  • Return Value
  • Example
  1. SDK Reference
  2. Other Functions

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

Parameter
Type
Definition

apiKey

String

walletAddress

String

The public wallet address for which you would like to export the private key. The wallet address can be retrieved from the RetrieveUser endpoint.

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;
PreviousOther FunctionsNextDeleteUser

Last updated 2 years ago

The API Key generated from the

Developer Portal