Compare commits

..

No commits in common. "v0.1.0-develop.9" and "v0.1.0-develop.8" have entirely different histories.

6 changed files with 89 additions and 4629 deletions

View File

@ -1,5 +1,3 @@
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-10-23)
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-09-04) # [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-09-04)
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-03) # [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-09-03)

4638
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "@lumeweb/kernel-lavanet", "name": "@lumeweb/kernel-lavanet",
"type": "module", "type": "module",
"version": "0.1.0-develop.9", "version": "0.1.0-develop.8",
"readme": "ERROR: No README data found!", "readme": "ERROR: No README data found!",
"repository": { "repository": {
"type": "git", "type": "git",
@ -14,9 +14,9 @@
"postinstall": "patch-package" "postinstall": "patch-package"
}, },
"dependencies": { "dependencies": {
"@lavanet/lava-sdk": "^0.25.6", "@lavanet/lava-sdk": "^0.21.1",
"@lumeweb/kernel-rpc-client": "^0.0.2-develop.18", "@lumeweb/kernel-rpc-client": "^0.0.2-develop.17",
"@lumeweb/libkernel": "^0.1.0-develop.67" "@lumeweb/libkernel": "^0.1.0-develop.39"
}, },
"devDependencies": { "devDependencies": {
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.44", "@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.44",

View File

@ -0,0 +1,46 @@
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..b989837 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 = options?.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();

View File

@ -1,13 +0,0 @@
diff --git a/node_modules/@lavanet/lava-sdk/bin/src/badge/badgeManager.js b/node_modules/@lavanet/lava-sdk/bin/src/badge/badgeManager.js
index aae75cf..96939be 100644
--- a/node_modules/@lavanet/lava-sdk/bin/src/badge/badgeManager.js
+++ b/node_modules/@lavanet/lava-sdk/bin/src/badge/badgeManager.js
@@ -35,7 +35,7 @@ class BadgeManager {
if (options.authentication) {
this.authentication.append("Authorization", options.authentication);
}
- this.transport = transport;
+ this.transport = transport || options.transport;
this.badgeGeneratorClient = new badges_pb_service_1.BadgeGeneratorClient(this.badgeServerAddress, this.getTransportWrapped());
}
isActive() {

View File

@ -40,14 +40,14 @@ async function handleQuery(aq: ActiveQuery) {
return; return;
} }
let { chain, query } = aq.callerInput; let { chain, query, rpcInterface = undefined } = aq.callerInput;
chain = chain.toUpperCase(); chain = chain.toUpperCase();
let lava: LavaSDK; let lava: LavaSDK;
if (!chainInstances.has(chain)) { if (!chainInstances.has(chain)) {
lava = await setupRelayChain(chain); lava = await setupRelayChain(chain, rpcInterface);
} else { } else {
lava = chainInstances.get(chain) as LavaSDK; lava = chainInstances.get(chain) as LavaSDK;
} }
@ -61,14 +61,15 @@ async function handleQuery(aq: ActiveQuery) {
} }
} }
async function setupRelayChain(chain: string) { async function setupRelayChain(chain: string, rpcInterface?: string) {
const instance = await LavaSDK.create({ const instance = await LavaSDK.create({
chainID: chain,
privateKey: bytesToHex(deriveChildKey(await getKey(), "lavanet")),
badge: { badge: {
// @ts-ignore // @ts-ignore
transport: hyperTransport(rpc), transport: hyperTransport(rpc),
}, },
chainIds: chain, rpcInterface,
privateKey: bytesToHex(deriveChildKey(await getKey(), "lavanet")),
}); });
chainInstances.set(chain, instance); chainInstances.set(chain, instance);