Skip to content

Commit

Permalink
Refactor validateTypes usage for consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
tmalahie committed Dec 10, 2024
1 parent fae5cfa commit 2f9d13b
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,23 @@ exports.generateKeys = function generateKeys(bitcoinNetwork) {
};

exports.restoreBackup = function (backupPath, password, targetDir) {
validateTypes(
{ backupPath, password, targetDir },
{ backupPath: "string", password: "string", targetDir: "string" },
);
const params = {
assetId,
amount,
durationSeconds,
transportEndpoints,
minConfirmations,
};
const expectedTypes = {
assetId: "string?",
amount: "u64?",
durationSeconds: "u32?",
transportEndpoints: "array[string]",
minConfirmations: "u8",
};
validateTypes(params, expectedTypes);
lib.rgblib_restore_backup(backupPath, password, targetDir);
}
};

exports.restoreKeys = function (bitcoinNetwork, mnemonic) {
validateEnumValues(
Expand Down

0 comments on commit 2f9d13b

Please sign in to comment.