Compare commits
No commits in common. "develop" and "master" have entirely different histories.
|
@ -1,13 +0,0 @@
|
||||||
name: Build/Publish
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
- develop
|
|
||||||
- develop-*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
main:
|
|
||||||
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
|
||||||
secrets: inherit
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"preset": [
|
|
||||||
"@lumeweb/presetter-kernel-module-preset"
|
|
||||||
],
|
|
||||||
"config": {
|
|
||||||
"official": true
|
|
||||||
}
|
|
||||||
}
|
|
49
CHANGELOG.md
49
CHANGELOG.md
|
@ -1,49 +0,0 @@
|
||||||
# [0.1.0-develop.12](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.11...v0.1.0-develop.12) (2023-11-16)
|
|
||||||
|
|
||||||
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-10-31)
|
|
||||||
|
|
||||||
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-10-23)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* need to store walletAddress ([71ed20f](https://git.lumeweb.com/LumeWeb/kernel-lavanet/commit/71ed20ff13dbf0cd396dfd6c3a31163a467b4fc4))
|
|
||||||
|
|
||||||
# [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.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.6](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-09-02)
|
|
||||||
|
|
||||||
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-08-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* ensure chain is uppercase since map is indexed by it ([6a3175d](https://git.lumeweb.com/LumeWeb/kernel-lavanet/commit/6a3175dc7b336534fdbfdfb55937e5895b967fb6))
|
|
||||||
|
|
||||||
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-08-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* missing await ([10e83d8](https://git.lumeweb.com/LumeWeb/kernel-lavanet/commit/10e83d8d55fb1925dccc800be7eeae74771fc5b6))
|
|
||||||
|
|
||||||
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-08-21)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* if we have data, set dummy header response, parse data to a uint8array and process as a chunk ([326d382](https://git.lumeweb.com/LumeWeb/kernel-lavanet/commit/326d38275da7a46534ac600bce5b7df6e6be7648))
|
|
||||||
* sdk patch needs to use options object ([9259e67](https://git.lumeweb.com/LumeWeb/kernel-lavanet/commit/9259e6723cfeec4ba1a130b6a594b72240c81fd9))
|
|
||||||
|
|
||||||
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-08-20)
|
|
||||||
|
|
||||||
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/kernel-lavanet/compare/v0.0.1...v0.1.0-develop.1) (2023-08-20)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* initial version ([59ece67](https://git.lumeweb.com/LumeWeb/kernel-lavanet/commit/59ece6720e23869063da00b2a460265a615c2e10))
|
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Hammer Technologies LLC
|
Copyright (c) 2023 LumeWeb
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"name": "@lumeweb/kernel-lavanet",
|
|
||||||
"type": "module",
|
|
||||||
"version": "0.1.0-develop.12",
|
|
||||||
"readme": "ERROR: No README data found!",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-lavanet.git"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"prepare": "presetter bootstrap",
|
|
||||||
"build": "run build",
|
|
||||||
"semantic-release": "semantic-release",
|
|
||||||
"postinstall": "patch-package"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@lavanet/lava-sdk": "^0.26.1",
|
|
||||||
"@lumeweb/kernel-rpc-client": "^0.0.2-develop.18",
|
|
||||||
"@lumeweb/libkernel": "^0.1.0-develop.67"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.44",
|
|
||||||
"patch-package": "^8.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +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() {
|
|
||||||
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 89267e8..90f6a88 100644
|
|
||||||
--- a/node_modules/@lavanet/lava-sdk/bin/src/sdk/sdk.js
|
|
||||||
+++ b/node_modules/@lavanet/lava-sdk/bin/src/sdk/sdk.js
|
|
||||||
@@ -89,6 +89,7 @@ class LavaSDK {
|
|
||||||
if (!this.badgeManager.isActive() || this.privKey != "") {
|
|
||||||
const wallet = yield (0, wallet_1.createWallet)(this.privKey);
|
|
||||||
this.account = yield wallet.getConsumerAccount();
|
|
||||||
+ this.walletAddress = this.account.address;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
const { wallet, privKey } = yield (0, wallet_1.createDynamicWallet)();
|
|
77
src/index.ts
77
src/index.ts
|
@ -1,77 +0,0 @@
|
||||||
import { LavaSDK } from "@lavanet/lava-sdk";
|
|
||||||
import type { ActiveQuery } from "@lumeweb/libkernel/module";
|
|
||||||
import {
|
|
||||||
addHandler,
|
|
||||||
defer,
|
|
||||||
getKey,
|
|
||||||
handlePresentKey as handlePresentKeyModule,
|
|
||||||
} from "@lumeweb/libkernel/module";
|
|
||||||
import {
|
|
||||||
createClient as createRpcClient,
|
|
||||||
RpcNetwork,
|
|
||||||
} from "@lumeweb/kernel-rpc-client";
|
|
||||||
import { bytesToHex, deriveChildKey } from "@lumeweb/libweb";
|
|
||||||
import { hyperTransport } from "./transport.js";
|
|
||||||
|
|
||||||
addHandler("presentKey", handlePresentKey);
|
|
||||||
addHandler("query", handleQuery);
|
|
||||||
|
|
||||||
const chainInstances = new Map<string, LavaSDK>();
|
|
||||||
const moduleReadyDefer = defer();
|
|
||||||
let rpc: RpcNetwork;
|
|
||||||
|
|
||||||
async function handlePresentKey(aq: ActiveQuery) {
|
|
||||||
handlePresentKeyModule({
|
|
||||||
callerInput: {
|
|
||||||
key: aq.callerInput.rootKey,
|
|
||||||
},
|
|
||||||
} as ActiveQuery);
|
|
||||||
rpc = createRpcClient();
|
|
||||||
moduleReadyDefer.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
async function handleQuery(aq: ActiveQuery) {
|
|
||||||
if (!("chain" in aq.callerInput)) {
|
|
||||||
aq.reject("chain missing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!("query" in aq.callerInput)) {
|
|
||||||
aq.reject("query missing");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let { chain, query } = aq.callerInput;
|
|
||||||
|
|
||||||
chain = chain.toUpperCase();
|
|
||||||
|
|
||||||
let lava: LavaSDK;
|
|
||||||
|
|
||||||
if (!chainInstances.has(chain)) {
|
|
||||||
lava = await setupRelayChain(chain);
|
|
||||||
} else {
|
|
||||||
lava = chainInstances.get(chain) as LavaSDK;
|
|
||||||
}
|
|
||||||
|
|
||||||
await rpc.ready;
|
|
||||||
|
|
||||||
try {
|
|
||||||
aq.respond(await lava.sendRelay(query));
|
|
||||||
} catch (e) {
|
|
||||||
aq.reject(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setupRelayChain(chain: string) {
|
|
||||||
const instance = await LavaSDK.create({
|
|
||||||
badge: {
|
|
||||||
// @ts-ignore
|
|
||||||
transport: hyperTransport(rpc),
|
|
||||||
},
|
|
||||||
chainIds: chain,
|
|
||||||
privateKey: bytesToHex(deriveChildKey(await getKey(), "lavanet")),
|
|
||||||
});
|
|
||||||
|
|
||||||
chainInstances.set(chain, instance);
|
|
||||||
|
|
||||||
return instance;
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
import { grpc } from "@improbable-eng/grpc-web";
|
|
||||||
import { RpcNetwork } from "@lumeweb/kernel-rpc-client";
|
|
||||||
import Metadata = grpc.Metadata;
|
|
||||||
|
|
||||||
class HyperTransport implements grpc.Transport {
|
|
||||||
private options: grpc.TransportOptions;
|
|
||||||
private rpc: RpcNetwork;
|
|
||||||
|
|
||||||
constructor(transportOptions: grpc.TransportOptions, rpc: RpcNetwork) {
|
|
||||||
this.options = transportOptions;
|
|
||||||
this.rpc = rpc;
|
|
||||||
}
|
|
||||||
|
|
||||||
cancel(): void {}
|
|
||||||
|
|
||||||
finishSend(): void {}
|
|
||||||
|
|
||||||
async sendMessage(msgBytes: Uint8Array): Promise<void> {
|
|
||||||
const req = this.rpc.simpleQuery({
|
|
||||||
query: {
|
|
||||||
module: "lavanet",
|
|
||||||
method: "badge_request",
|
|
||||||
data: {
|
|
||||||
data: msgBytes,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const ret = await req.result;
|
|
||||||
if (ret.error) {
|
|
||||||
this.options.onEnd({ message: ret.error, name: "", stack: "" });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret.data) {
|
|
||||||
ret.data?.forEach((item: number[]) => {
|
|
||||||
this.options.onChunk(Uint8Array.from(item));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
this.options.onEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
start(metadata: Metadata): void {}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function hyperTransport(rpc: RpcNetwork): grpc.TransportFactory {
|
|
||||||
return (opts: grpc.TransportOptions) => {
|
|
||||||
return new HyperTransport(opts, rpc);
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Reference in New Issue