Documentation Index
Fetch the complete documentation index at: https://docs.dynamic.xyz/docs/llms.txt
Use this file to discover all available pages before exploring further.
Import an existing private key to create a new WaaS wallet account.
Usage
import { importWaasPrivateKey } from '@dynamic-labs-sdk/client/waas';
const importPrivateKey = async (privateKey) => {
await importWaasPrivateKey({
chain: 'EVM', // or other chains like 'SOL'
privateKey,
thresholdSignatureScheme, // default is TWO_OF_TWO, but you can choose other `ThresholdSignatureScheme` like TWO_OF_THREE
});
};
import { importWaasPrivateKey } from '@dynamic-labs-sdk/client/waas';
import { useState } from 'react';
function ImportPrivateKeyForm() {
const [privateKey, setPrivateKey] = useState('');
const [status, setStatus] = useState('');
const handleImport = async () => {
await importWaasPrivateKey({
chain: 'EVM',
privateKey,
});
setStatus('Imported successfully');
setPrivateKey('');
};
return (
<div>
<input
type="password"
value={privateKey}
onChange={(e) => setPrivateKey(e.target.value)}
placeholder="Enter private key"
/>
<button onClick={handleImport} disabled={!privateKey}>
Import
</button>
{status && <p>{status}</p>}
</div>
);
}
Error Handling
- If you didn’t add the WaaS extension for the specified chain, it will throw a
NoWalletProviderFoundError.