Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: bump holochain client to 0.16.x #114

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@
"webpack-cli": "^4.10.0"
},
"dependencies": {
"@holo-host/comb": "^0.3.2",
"@holo-host/web-sdk": "^0.6.18-prerelease",
"@holochain/client": "0.14.1",
"semver": "^7.5.1"
"@holo-host/comb": "0.3.2",
"@holochain/client": "0.16.10",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"semver": "^7.5.1",
"stream-browserify": "^3.0.0"
}
}
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Emittery from "emittery"
import semverSatisfies from 'semver/functions/satisfies'
import { AppInfoResponse, AppAgentClient, AppAgentCallZomeRequest, AppCreateCloneCellRequest, CreateCloneCellResponse, AgentPubKey, AppEnableCloneCellRequest, AppDisableCloneCellRequest, EnableCloneCellResponse, DisableCloneCellResponse, AppSignal, decodeHashFromBase64 } from '@holochain/client'
import { AppInfoResponse, AppAgentClient, AppAgentCallZomeRequest, AppCreateCloneCellRequest, CreateCloneCellResponse, AgentPubKey, AppEnableCloneCellRequest, AppDisableCloneCellRequest, EnableCloneCellResponse, DisableCloneCellResponse, AppSignal, decodeHashFromBase64, NetworkInfoResponse, AppAgentNetworkInfoRequest } from '@holochain/client'

const COMPATIBLE_CHAPERONE_VERSION = '>=0.1.1 <0.2.0'

Expand Down Expand Up @@ -192,6 +192,8 @@ class WebSdkApi implements AppAgentClient {

appInfo = (): Promise<AppInfoResponse> => this.#child.call('appInfo')

networkInfo = (args: AppAgentNetworkInfoRequest): Promise<NetworkInfoResponse> => this.#child.call('networkInfo', args)

callZome = async (args: AppAgentCallZomeRequest): Promise<any> => this.#child.call('callZome', args).then(unwrap)

createCloneCell = (args: AppCreateCloneCellRequest): Promise<CreateCloneCellResponse> => this.#child.call('createCloneCell', args).then(unwrap)
Expand Down
26 changes: 26 additions & 0 deletions tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,32 @@ describe('test API endpoints', () => {
expect(response).toMatchObject(expectedResponse)
})

it("should call network_info", async () => {
const expectedResponse = [
{
fetch_pool_info: {
op_bytes_to_fetch: 1,
num_ops_to_fetch: 1,
},
current_number_of_peers: 1,
arc_size: 1,
total_network_peers: 1,
bytes_since_last_time_queried: 1,
completed_rounds_since_last_time_queried: 1,
}
]

mock_comb.nextResponse(expectedResponse)

const response = await holo.networkInfo({
dnas: ['dna_hash'],
});

log.debug("Response: %s", response)

expect(response).toBeDefined()
})

it("should sign payloads", async () => {
const payload = { mockPayload: 'value' }
const expectedResponse = {
Expand Down
15 changes: 6 additions & 9 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ module.exports = {
},

resolve: {
extensions: [".ts", ".js"]
extensions: [".ts", ".js"],
fallback: {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
buffer: require.resolve("buffer/"),
},
},

module: {
Expand All @@ -37,12 +42,4 @@ module.exports = {

plugins: [
],

externals: {
"node:crypto": {
commonjs: 'node:crypto',
commonjs2: 'node:crypto',
amd: 'node:crypto',
}
},
};
Loading
Loading