bvs-nitro-did/bvsTest.js

42 lines
1.3 KiB
JavaScript

require("dotenv").config({quiet: true});
const bvs = require("./bvs");
// bvs.getAccountInfo().then(accountInfo => {
// console.log(`Validated BulkVS Token. Account Contact is ${accountInfo["Main Contact"].Name}`)
// }).catch(error => {
// console.error("Error validating BVS_TOKEN:", error);
// process.exit(1);
// })
// bvs.getAllDIDs().then(dids => {
// console.log(`Fetched ${dids.length} DIDs from BulkVS.`);
// console.log(dids);
// }).catch(error => {
// console.error("Error fetching DIDs:", error);
// });
bvs.getPremiumDIDs().then(dids => {
console.log(`Fetched ${dids.length} premium DIDs from BulkVS.`);
console.log(dids);
}).catch(error => {
console.error("Error fetching premium DIDs:", error);
});
bvs.searchPurchasableDIDs("910").then(dids => {
console.log(`Fetched ${dids.length} DIDs from BulkVS with user ID 610548.`);
console.log(dids.map(did => did.TN))
// console.log(dids)
// Test purchase the first one, if there is one
if (dids.length > 0) {
// bvs.purchaseDID(dids[0].TN, 8949849456165).then((data) => {
// console.log(`Successfully purchased DID ${dids[0].TN}`);
// console.log(data)
// }).catch(error => {
// console.error(`Error purchasing DID ${dids[0].TN}:`, error);
// });
}
}).catch(error => {
console.error("Error fetching DIDs with user ID 610548:", error);
});
console.log(bvs.deleteDID("15803163827"));