Try Cobo WaaS Skill in your AI coding assistant (Claude Code, Cursor, etc.). Describe your needs in natural language to auto-generate production-ready SDK code and debug faster đ
public func recoverPrivateKeys(addressInfos: [AddressInfo]) throws -> [PrivateKeyInfo]
Future<List<PrivateKeyInfo>> recoverPrivateKeys(List<AddressInfo> addressInfos) async
let addressInfos: [AddressInfo] = [
AddressInfo(bip32Path: "m/44/1/1/0/0", pubKey: "xpub6FRrW2AzsDQcVQPNCCQgiB7xSQ9UseQfrRCJdD9qjWswrNBmY1MysLdMYxpWbB1mnGJTwLCZWCfA4ko2kQNN37CPSzidD1c9aZCBXjTzfQn")
AddressInfo(bip32Path: "m/44/1/1/0/1", pubKey: "xpub6FRrW2AzsDQcZahYm2GgsDz7VtqgkvNwR58boDejvwSuCYZ2ZRVvqP6Gaqef6hMGxKtkvj3PfcRxagKSycuh6XX7kJ3Bzc2vUrEAA4at5Jc")
]
do {
let privateKeyInfos = try recoverKey?.recoverPrivateKeys(addressInfos: addressInfos)
if let privateKeyInfos = privateKeyInfos {
for privateKeyInfo in privateKeyInfos {
print("Private Key Info: \(privateKeyInfo)")
}
} else {
print("Failed to recover private keys.")
}
} catch {
print("Error: \(error)")
}
final List<AddressInfo> addressInfos = [
AddressInfo(
bip32Path: "m/44/1/1/0/0",
pubKey: "xpub6FRrW2AzsDQcVQPNCCQgiB7xSQ9UseQfrRCJdD9qjWswrNBmY1MysLdMYxpWbB1mnGJTwLCZWCfA4ko2kQNN37CPSzidD1c9aZCBXjTzfQn"
),
AddressInfo(
bip32Path: "m/44/1/1/0/1",
pubKey: "xpub6FRrW2AzsDQcZahYm2GgsDz7VtqgkvNwR58boDejvwSuCYZ2ZRVvqP6Gaqef6hMGxKtkvj3PfcRxagKSycuh6XX7kJ3Bzc2vUrEAA4at5Jc"
),
];
try {
final privateKeyInfos = await recoverKey?.recoverPrivateKeys(addressInfos: addressInfos);
for (final privateKeyInfo in privateKeyInfos) {
print("Private Key Info: $privateKeyInfo");
}
} catch (error) {
print("Error: $error");
}
Parameters
object[]
A list of address information objects, each containing the BIP32 path and the optional root extended public key, required to recover the corresponding private keys.
Show child attributes
Show child attributes
string
The BIP32 path of the address.
For example:
m/44/1/1/0/0.string
The extended public key of the address. This parameter is optional and can be left empty. If provided, the derived public key will be compared against this value during the key derivation process. A mismatch will result in an error.
Response
object[]
The list of objects containing the recovered private keys and their corresponding addresses.
Show child attributes
Show child attributes
string
The BIP32 path for the address.
For example:
m/44/1/1/0/0.string
The extended public key for the address.
For example:
xpub6FRrW2AzsDQcVQPNCCQgiB7xSQ9UseQfrRCJdD9qjWswrNBmY1MysLdMYxpWbB1mnGJTwLCZWCfA4ko2kQNN37CPSzidD1c9aZCBXjTzfQn.