kernel-lavanet/patches/@lavanet+lava-sdk+0.21.1.patch

47 lines
2.4 KiB
Diff

diff --git a/node_modules/@lavanet/lava-sdk/bin/src/badge/fetchBadge.js b/node_modules/@lavanet/lava-sdk/bin/src/badge/fetchBadge.js
index 0c3063a..5e9cd0c 100644
--- a/node_modules/@lavanet/lava-sdk/bin/src/badge/fetchBadge.js
+++ b/node_modules/@lavanet/lava-sdk/bin/src/badge/fetchBadge.js
@@ -24,6 +24,7 @@ class BadgeManager {
this.badgeServerAddress = "";
this.projectId = "";
this.active = true;
+ this.transport = transport;
if (!options) {
this.active = false;
return;
@@ -52,7 +53,7 @@ class BadgeManager {
request: request,
host: this.badgeServerAddress,
metadata: this.authentication ? this.authentication : {},
- transport: browser_1.default,
+ transport: this.transport ?? browser_1.default,
onMessage: (message) => {
resolve(message);
},
diff --git a/node_modules/@lavanet/lava-sdk/bin/src/sdk/sdk.js b/node_modules/@lavanet/lava-sdk/bin/src/sdk/sdk.js
index 53bfa7d..4ef0fd7 100644
--- a/node_modules/@lavanet/lava-sdk/bin/src/sdk/sdk.js
+++ b/node_modules/@lavanet/lava-sdk/bin/src/sdk/sdk.js
@@ -47,9 +47,6 @@ class LavaSDK {
if (!badge && !privateKey) {
throw errors_1.default.errPrivKeyAndBadgeNotInitialized;
}
- else if (badge && privateKey) {
- throw errors_1.default.errPrivKeyAndBadgeBothInitialized;
- }
// Initialize local attributes
this.debugMode = options.debug ? options.debug : false; // enabling debug prints mainly used for development / debugging
this.secure = options.secure !== undefined ? options.secure : true;
@@ -148,8 +145,8 @@ class LavaSDK {
return __awaiter(this, void 0, void 0, function* () {
const start = performance.now();
if (this.badgeManager.isActive()) {
- const { wallet, privKey } = yield (0, wallet_1.createDynamicWallet)();
- this.privKey = privKey;
+ const wallet = yield (0, wallet_1.createWallet)(this.privKey);
+ const account = yield wallet.getConsumerAccount();
this.walletAddress = (yield wallet.getConsumerAccount()).address;
const badgeResponse = yield this.fetchNewBadge();
this.currentEpochBadge = badgeResponse.getBadge();