Compare commits

..

41 Commits

Author SHA1 Message Date
semantic-release-bot ca5348ee64 chore(release): 0.1.0-develop.12 [skip ci]
# [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)
2023-11-16 23:11:05 +00:00
Derrick Hammer a75e8916a5
Merge remote-tracking branch 'origin/develop' into develop 2023-11-16 18:09:58 -05:00
Derrick Hammer 53504f7e4d
dep: update lava 2023-11-16 18:09:49 -05:00
semantic-release-bot a12a46ab65 chore(release): 0.1.0-develop.11 [skip ci]
# [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)
2023-10-31 23:45:12 +00:00
Derrick Hammer 0f5fb2f564
Merge remote-tracking branch 'origin/develop' into develop 2023-10-31 19:43:50 -04:00
Derrick Hammer 982e81a8e8
dep: update lava 2023-10-31 19:32:42 -04:00
semantic-release-bot 519bbf9316 chore(release): 0.1.0-develop.10 [skip ci]
# [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](71ed20ff13))
2023-10-23 23:44:29 +00:00
Derrick Hammer b6071312b7
Merge remote-tracking branch 'origin/develop' into develop 2023-10-23 19:43:00 -04:00
Derrick Hammer 8df32ad402
refactor: rewrite how the data is processes, as it's an array of chunks now 2023-10-23 19:42:46 -04:00
Derrick Hammer 71ed20ff13
fix: need to store walletAddress 2023-10-23 19:42:03 -04:00
semantic-release-bot b436ed06bf chore(release): 0.1.0-develop.9 [skip ci]
# [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)
2023-10-23 16:39:12 +00:00
Derrick Hammer ec1479b3c8
Merge remote-tracking branch 'origin/develop' into develop 2023-10-23 12:37:47 -04:00
Derrick Hammer fd2251bdde
refactor: upgrade lavanet 2023-10-23 12:37:34 -04:00
Derrick Hammer 90a90e9c80
dep: update deps 2023-10-23 12:37:16 -04:00
semantic-release-bot 6f256495da chore(release): 0.1.0-develop.8 [skip ci]
# [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)
2023-09-04 10:37:26 +00:00
Derrick Hammer 5e57fe15ca
Merge remote-tracking branch 'origin/develop' into develop 2023-09-04 06:36:05 -04:00
Derrick Hammer 46a7d0cd7a
dep: update kernel-rpc-client 2023-09-04 06:35:56 -04:00
semantic-release-bot 024207f419 chore(release): 0.1.0-develop.7 [skip ci]
# [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)
2023-09-03 05:34:46 +00:00
Derrick Hammer 7168baf893
Merge remote-tracking branch 'origin/develop' into develop 2023-09-03 01:33:12 -04:00
Derrick Hammer d5da11f4a6
dep: update deps 2023-09-03 01:33:02 -04:00
semantic-release-bot fb35d9404d chore(release): 0.1.0-develop.6 [skip ci]
# [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)
2023-09-02 17:53:28 +00:00
Derrick Hammer bdc7600444
Merge remote-tracking branch 'origin/develop' into develop 2023-09-02 13:52:04 -04:00
Derrick Hammer 4639a43e42
dep: update deps 2023-09-02 13:51:59 -04:00
semantic-release-bot 606e767515 chore(release): 0.1.0-develop.5 [skip ci]
# [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](6a3175dc7b))
2023-08-21 06:51:40 +00:00
Derrick Hammer 63a0201809
Merge remote-tracking branch 'origin/develop' into develop 2023-08-21 02:50:21 -04:00
Derrick Hammer 6a3175dc7b
fix: ensure chain is uppercase since map is indexed by it 2023-08-21 02:50:16 -04:00
semantic-release-bot 41270fd335 chore(release): 0.1.0-develop.4 [skip ci]
# [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](10e83d8d55))
2023-08-21 06:46:41 +00:00
Derrick Hammer 3f5dfd4261
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	npm-shrinkwrap.json
2023-08-21 02:44:37 -04:00
Derrick Hammer 10e83d8d55
fix: missing await 2023-08-21 02:44:09 -04:00
semantic-release-bot 449838ce83 chore(release): 0.1.0-develop.3 [skip ci]
# [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](326d38275d))
* sdk patch needs to use options object ([9259e67](9259e6723c))
2023-08-21 00:11:01 +00:00
Derrick Hammer 37baedf27e
Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	npm-shrinkwrap.json
2023-08-20 20:08:55 -04:00
Derrick Hammer 326d38275d
fix: if we have data, set dummy header response, parse data to a uint8array and process as a chunk 2023-08-20 20:08:31 -04:00
Derrick Hammer 3e28aa782a
ci: add missing scripts 2023-08-20 20:07:14 -04:00
Derrick Hammer 9259e6723c
fix: sdk patch needs to use options object 2023-08-20 20:06:53 -04:00
semantic-release-bot 821232889d chore(release): 0.1.0-develop.2 [skip ci]
# [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)
2023-08-20 12:59:51 +00:00
Derrick Hammer 0c0d717439
Merge remote-tracking branch 'origin/develop' into develop 2023-08-20 08:58:33 -04:00
Derrick Hammer a71f1cb155
refactor: remove metadata field 2023-08-20 08:58:23 -04:00
semantic-release-bot 819c7395b7 chore(release): 0.1.0-develop.1 [skip ci]
# [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](59ece6720e))
2023-08-20 09:40:47 +00:00
Derrick Hammer f77db1cf7d
chore: update LICENSE 2023-08-20 05:31:46 -04:00
Derrick Hammer 72c6072c41
ci: setup 2023-08-20 05:31:09 -04:00
Derrick Hammer 59ece6720e
feat: initial version 2023-08-20 05:29:40 -04:00
9 changed files with 25479 additions and 1 deletions

13
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,13 @@
name: Build/Publish
on:
push:
branches:
- master
- develop
- develop-*
jobs:
main:
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
secrets: inherit

8
.presetterrc.json Normal file
View File

@ -0,0 +1,8 @@
{
"preset": [
"@lumeweb/presetter-kernel-module-preset"
],
"config": {
"official": true
}
}

49
CHANGELOG.md Normal file
View File

@ -0,0 +1,49 @@
# [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))

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023 LumeWeb
Copyright (c) 2023 Hammer Technologies LLC
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:

25230
npm-shrinkwrap.json generated Normal file

File diff suppressed because it is too large Load Diff

25
package.json Normal file
View File

@ -0,0 +1,25 @@
{
"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"
}
}

View File

@ -0,0 +1,25 @@
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 Normal file
View File

@ -0,0 +1,77 @@
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;
}

51
src/transport.ts Normal file
View File

@ -0,0 +1,51 @@
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);
};
}