Compare commits

...

32 Commits

Author SHA1 Message Date
Mark Sinclair 88442c73ec Bump node tester version and add additional yarn install step to fix linting 2025-11-07 20:24:38 +00:00
Mark Sinclair 95168ac280 Update ci-nym-wallet-storybook.yml 2025-11-07 20:13:36 +00:00
Mark Sinclair 2d0b38ed12 Update ci-lint-typescript.yml 2025-11-07 19:49:22 +00:00
Mark Sinclair 18b83e437a Update ci-lint-typescript.yml 2025-11-07 19:18:56 +00:00
Mark Sinclair 1fd73d7dc4 update yarn lock file after TS SDK 1.4.1 publish 2025-11-07 18:27:23 +00:00
Mark Sinclair 4041e3e95c update docs dependencies to SDK 1.4.1 2025-11-07 18:25:04 +00:00
Mark Sinclair b4046a8969 TS SDK 1.4.1 release 2025-11-07 17:48:08 +00:00
Mark Sinclair ea36ef525a update example docs 2025-11-07 16:55:42 +00:00
Mark Sinclair e76986e607 TS SDK 1.4.1-rc3 2025-11-07 16:15:56 +00:00
Mark Sinclair 1d85cf1ad8 improve wasm js tests 2025-11-07 16:13:33 +00:00
Mark Sinclair b49edba86d wasm: rename main to main_js to avoid collision errors in exporting main from tests
see https://github.com/wasm-bindgen/wasm-bindgen/issues/2206
2025-11-07 16:13:06 +00:00
Mark Sinclair 00571c3892 ts-sdk: fix minimatch dependency and correct casing on selfAddress function call 2025-11-07 14:30:06 +00:00
Mark Sinclair 0257cb050a TS SDK 1.4.1-rc2 2025-11-07 14:29:19 +00:00
Mark Sinclair 503b7c5307 add back version complexity for CI 2025-11-05 15:59:51 +00:00
Mark Sinclair a86b3a3ee3 simplify version dependencies and add dist to dev mode 2025-11-05 15:46:53 +00:00
Mark Sinclair 6841516bf2 TS SDK 1.4.1-rc1 2025-11-05 12:23:45 +00:00
Mark Sinclair 0e97d6c040 limit packages published to only wasm clients 2025-11-04 19:41:45 +00:00
Mark Sinclair 854dccd79c bump versions to rc0 2025-11-04 19:40:04 +00:00
Mark Sinclair a792313b68 try disable typedoc because of minimatch errors 2025-11-04 18:15:45 +00:00
Mark Sinclair 7778adb493 Update publish-sdk-npm.yml 2025-11-04 14:57:24 +00:00
Mark Sinclair 33988b5164 Update publish-sdk-npm.yml 2025-11-04 14:52:22 +00:00
Mark Sinclair 284c25ff5a Update publish-sdk-npm.yml 2025-11-04 14:48:28 +00:00
Mark Sinclair 9d72229fa6 Update publish-sdk-npm.yml 2025-11-04 14:42:36 +00:00
Mark Sinclair da8d14ae84 bump versions to rc 2025-10-31 14:29:21 +00:00
Mark Sinclair 2e4f7bbc70 pin minimatch typings to fix lint errors 2025-10-25 00:24:29 +01:00
Mark Sinclair cbafe4adcf update go 2025-10-24 23:57:20 +01:00
Mark Sinclair 967b6c8e34 ts: fix linting errors 2025-10-24 23:26:17 +01:00
Mark Sinclair c3dad4231d ts-sdk: contract clients: update and re-run autogen 2025-10-24 23:25:35 +01:00
Mark Sinclair ba8ed878c9 remove bump version tool from workspace 2025-10-24 20:29:40 +01:00
Mark Sinclair 744860d4f9 Release Typescript SDK v1.4.1 2025-10-24 19:56:01 +01:00
Mark Sinclair 0013e7ac40 wasm: mix-fetch: fix up internal tester 2025-10-24 19:55:51 +01:00
Mark Sinclair 0fcc42e02d wasm: mix-fetch: remove harbour master client and use Nym API client 2025-10-24 19:55:51 +01:00
76 changed files with 4507 additions and 7287 deletions
+10 -9
View File
@@ -6,16 +6,14 @@ on:
paths: paths:
- "ts-packages/**" - "ts-packages/**"
- "sdk/typescript/**" - "sdk/typescript/**"
- "nym-connect/desktop/src/**"
- "nym-connect/desktop/package.json"
- "nym-wallet/src/**" - "nym-wallet/src/**"
- "nym-wallet/package.json" - "nym-wallet/package.json"
- "explorer/**" - "explorer-v2/**"
- ".github/workflows/ci-lint-typescript.yml" - ".github/workflows/ci-lint-typescript.yml"
jobs: jobs:
build: build:
runs-on: ubuntu-22.04 runs-on: arc-linux-latest
env: env:
RUSTUP_PERMIT_COPY_RENAME: 1 RUSTUP_PERMIT_COPY_RENAME: 1
steps: steps:
@@ -25,6 +23,7 @@ jobs:
- uses: actions/setup-node@v4 - uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
- name: Setup yarn - name: Setup yarn
run: npm install -g yarn run: npm install -g yarn
@@ -37,14 +36,12 @@ jobs:
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Install wasm-opt - name: Install wasm-opt
uses: ./.github/actions/install-wasm-opt run: cargo install wasm-opt
with:
version: '116'
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v6
with: with:
go-version: "1.23.7" go-version: "1.24.6"
- name: Install - name: Install
run: yarn run: yarn
@@ -52,7 +49,11 @@ jobs:
- name: Build packages - name: Build packages
run: yarn build:ci run: yarn build:ci
- name: Install again
run: yarn
- name: Lint - name: Lint
run: yarn lint run: yarn lint
- name: Typecheck with tsc - name: Typecheck with tsc
run: yarn tsc run: yarn tsc
@@ -8,7 +8,7 @@ on:
jobs: jobs:
build: build:
runs-on: custom-linux runs-on: arc-linux-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
+7 -4
View File
@@ -4,7 +4,7 @@ on:
jobs: jobs:
publish: publish:
runs-on: arc-ubuntu-22.04 runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@@ -17,10 +17,13 @@ jobs:
- name: Setup yarn - name: Setup yarn
run: npm install -g yarn run: npm install -g yarn
- name: Install Rust stable - name: Install rust toolchain
uses: actions-rs/toolchain@v1 uses: actions-rs/toolchain@v1
with: with:
profile: minimal
toolchain: stable toolchain: stable
override: true
components: rustfmt, clippy
- name: Install wasm-pack - name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
@@ -29,9 +32,9 @@ jobs:
run: cargo install wasm-opt run: cargo install wasm-opt
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v5 uses: actions/setup-go@v6
with: with:
go-version: "1.23.7" go-version: "1.24.6"
- name: Install dependencies - name: Install dependencies
run: yarn run: yarn
Generated
+8 -7
View File
@@ -2262,7 +2262,7 @@ dependencies = [
"libc", "libc",
"option-ext", "option-ext",
"redox_users", "redox_users",
"windows-sys 0.59.0", "windows-sys 0.60.2",
] ]
[[package]] [[package]]
@@ -2579,7 +2579,7 @@ dependencies = [
[[package]] [[package]]
name = "extension-storage" name = "extension-storage"
version = "1.4.0-rc.0" version = "1.4.1"
dependencies = [ dependencies = [
"bip39", "bip39",
"console_error_panic_hook", "console_error_panic_hook",
@@ -4478,7 +4478,7 @@ dependencies = [
[[package]] [[package]]
name = "mix-fetch-wasm" name = "mix-fetch-wasm"
version = "1.4.0-rc.0" version = "1.4.1"
dependencies = [ dependencies = [
"async-trait", "async-trait",
"futures", "futures",
@@ -4488,6 +4488,7 @@ dependencies = [
"nym-ordered-buffer", "nym-ordered-buffer",
"nym-service-providers-common", "nym-service-providers-common",
"nym-socks5-requests", "nym-socks5-requests",
"nym-validator-client",
"rand 0.8.5", "rand 0.8.5",
"serde", "serde",
"serde-wasm-bindgen 0.6.5", "serde-wasm-bindgen 0.6.5",
@@ -5283,7 +5284,7 @@ dependencies = [
[[package]] [[package]]
name = "nym-client-wasm" name = "nym-client-wasm"
version = "1.4.0-rc.0" version = "1.4.1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"futures", "futures",
@@ -6642,7 +6643,7 @@ dependencies = [
[[package]] [[package]]
name = "nym-node-tester-wasm" name = "nym-node-tester-wasm"
version = "1.3.0-rc.0" version = "1.3.1"
dependencies = [ dependencies = [
"futures", "futures",
"js-sys", "js-sys",
@@ -7823,9 +7824,9 @@ checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e"
[[package]] [[package]]
name = "openssl-sys" name = "openssl-sys"
version = "0.9.109" version = "0.9.110"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" checksum = "0a9f0075ba3c21b09f8e8b2026584b1d18d49388648f2fbbf3c97ea8deced8e2"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
+1 -1
View File
@@ -150,7 +150,7 @@ members = [
"tools/internal/contract-state-importer/importer-cli", "tools/internal/contract-state-importer/importer-cli",
"tools/internal/contract-state-importer/importer-contract", "tools/internal/contract-state-importer/importer-contract",
"tools/internal/mixnet-connectivity-check", "tools/internal/mixnet-connectivity-check",
# "tools/internal/sdk-version-bump", # "tools/internal/sdk-version-bump",
"tools/internal/ssl-inject", "tools/internal/ssl-inject",
"tools/internal/testnet-manager", "tools/internal/testnet-manager",
"tools/internal/testnet-manager/dkg-bypass-contract", "tools/internal/testnet-manager/dkg-bypass-contract",
+4 -4
View File
@@ -107,16 +107,16 @@ sdk-wasm-build:
$(MAKE) -C nym-browser-extension/storage wasm-pack $(MAKE) -C nym-browser-extension/storage wasm-pack
$(MAKE) -C wasm/client $(MAKE) -C wasm/client
$(MAKE) -C wasm/node-tester $(MAKE) -C wasm/node-tester
# $(MAKE) -C wasm/mix-fetch $(MAKE) -C wasm/mix-fetch
$(MAKE) -C wasm/zknym-lib $(MAKE) -C wasm/zknym-lib
# $(MAKE) -C wasm/full-nym-wasm # $(MAKE) -C wasm/full-nym-wasm
# run this from npm/yarn to ensure tools are in the path, e.g. yarn build:sdk from root of repo # run this from npm/yarn to ensure tools are in the path, e.g. yarn build:sdk from root of repo
sdk-typescript-build: sdk-typescript-build:
npx lerna run --scope @nymproject/sdk build --stream npx lerna run --scope @nymproject/sdk build --stream
# npx lerna run --scope @nymproject/mix-fetch build --stream npx lerna run --scope @nymproject/mix-fetch build --stream
# npx lerna run --scope @nymproject/node-tester build --stream npx lerna run --scope @nymproject/node-tester build --stream
# yarn --cwd sdk/typescript/codegen/contract-clients build yarn --cwd sdk/typescript/codegen/contract-clients build
# NOTE: These targets are part of the main workspace (but not as wasm32-unknown-unknown) # NOTE: These targets are part of the main workspace (but not as wasm32-unknown-unknown)
WASM_CRATES = extension-storage nym-client-wasm nym-node-tester-wasm zknym-lib WASM_CRATES = extension-storage nym-client-wasm nym-node-tester-wasm zknym-lib
@@ -1,27 +1,26 @@
```ts copy filename="mixFetchExample.tsx" ```tsx copy filename="mixFetchExample.tsx"
import React, { useState } from 'react'; import React, { useState } from "react";
import CircularProgress from '@mui/material/CircularProgress'; import CircularProgress from "@mui/material/CircularProgress";
import Button from '@mui/material/Button'; import Button from "@mui/material/Button";
import TextField from '@mui/material/TextField'; import TextField from "@mui/material/TextField";
import Typography from '@mui/material/Typography'; import Typography from "@mui/material/Typography";
import Box from '@mui/material/Box'; import Box from "@mui/material/Box";
import { mixFetch } from '@nymproject/mix-fetch-full-fat'; import { mixFetch } from "@nymproject/mix-fetch-full-fat";
import Stack from '@mui/material/Stack'; import Stack from "@mui/material/Stack";
import Paper from '@mui/material/Paper'; import Paper from "@mui/material/Paper";
import type { SetupMixFetchOps } from '@nymproject/mix-fetch'; import type { SetupMixFetchOps } from "@nymproject/mix-fetch-full-fat";
const defaultUrl = 'https://nym.com/favicon.svg'; const defaultUrl = "https://nymtech.net/.wellknown/network-requester/exit-policy.txt";
const args = { mode: 'unsafe-ignore-cors' }; const args = { mode: "unsafe-ignore-cors" };
const mixFetchOptions: SetupMixFetchOps = { const mixFetchOptions: SetupMixFetchOps = {
preferredGateway: '6Gb7ftQdKveMjPyrxDXeAtfYAX7Zg5mVZHtnRC5MmZ1B', // with WSS preferredGateway: "2xU4CBE6QiiYt6EyBXSALwxkNvM7gqJfjHXaMkjiFmYW", // with WSS
preferredNetworkRequester: // preferredNetworkRequester:
'8rRGWy54oC8drFL9DepMegBt2DLrsqQwCoHMXt9nsnTo.2XjCPVbb4FpQ9hNRcXwb9mTzEAVVk1zf1tcch3wdtNEA@6Gb7ftQdKveMjPyrxDXeAtfYAX7Zg5mVZHtnRC5MmZ1B', // "CTDxrcXgrZHWyCWnuCgjpJPghQUcEVz1HkhUr5mGdFnT.3UAww1YWNyVNYNWFQL1LaHYouQtDiXBGK5GiDZgpXkTK@2RFtU5BwxvJJXagAWAEuaPgb5ZVPRoy2542TT93Edw6v",
mixFetchOverride: { mixFetchOverride: {
requestTimeoutMs: 60_000, requestTimeoutMs: 60_000,
}, },
forceTls: true, // force WSS forceTls: true, // force WSS
extra: {},
}; };
export const MixFetch = () => { export const MixFetch = () => {
@@ -45,7 +44,7 @@ export const MixFetch = () => {
}; };
return ( return (
<div style={{ marginTop: '1rem' }}> <div style={{ marginTop: "1rem" }}>
<Stack direction="row"> <Stack direction="row">
<TextField <TextField
disabled={busy} disabled={busy}
@@ -56,7 +55,12 @@ export const MixFetch = () => {
defaultValue={defaultUrl} defaultValue={defaultUrl}
onChange={(e) => setUrl(e.target.value)} onChange={(e) => setUrl(e.target.value)}
/> />
<Button variant="outlined" disabled={busy} sx={{ marginLeft: '1rem' }} onClick={handleFetch}> <Button
variant="outlined"
disabled={busy}
sx={{ marginLeft: "1rem" }}
onClick={handleFetch}
>
Fetch Fetch
</Button> </Button>
</Stack> </Stack>
@@ -1,15 +1,19 @@
```ts copy filename="MixnetWASMClientExample.tsx" ```ts copy filename="MixnetWASMClientExample.tsx"
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from "react";
import { createNymMixnetClient, NymMixnetClient, Payload } from '@nymproject/sdk-full-fat'; import {
import Box from '@mui/material/Box'; createNymMixnetClient,
import CircularProgress from '@mui/material/CircularProgress'; NymMixnetClient,
import Paper from '@mui/material/Paper'; Payload,
import Typography from '@mui/material/Typography'; } from "@nymproject/sdk-full-fat";
import Stack from '@mui/material/Stack'; import Box from "@mui/material/Box";
import TextField from '@mui/material/TextField'; import CircularProgress from "@mui/material/CircularProgress";
import Button from '@mui/material/Button'; import Paper from "@mui/material/Paper";
import Typography from "@mui/material/Typography";
import Stack from "@mui/material/Stack";
import TextField from "@mui/material/TextField";
import Button from "@mui/material/Button";
const nymApiUrl = 'https://validator.nymtech.net/api'; const nymApiUrl = "https://validator.nymtech.net/api";
export const Traffic = () => { export const Traffic = () => {
const [nym, setNym] = useState<NymMixnetClient>(); const [nym, setNym] = useState<NymMixnetClient>();
@@ -17,27 +21,31 @@ export const Traffic = () => {
const [recipient, setRecipient] = useState<string>(); const [recipient, setRecipient] = useState<string>();
const [payload, setPayload] = useState<Payload>(); const [payload, setPayload] = useState<Payload>();
const [receivedMessage, setReceivedMessage] = useState<string>(); const [receivedMessage, setReceivedMessage] = useState<string>();
const [buttonEnabled, setButtonEnabled] = useState<boolean>(false);
const init = async () => { const init = async () => {
const client = await createNymMixnetClient(); const client = await createNymMixnetClient();
setNym(client); setNym(client);
// start the client and connect to a gateway
await client?.client.start({ await client?.client.start({
clientId: crypto.randomUUID(), clientId: crypto.randomUUID(),
nymApiUrl, nymApiUrl,
forceTls: true, // force WSS forceTls: true, // force WSS
}); });
// check when is connected and set the self address
client?.events.subscribeToConnected((e) => { client?.events.subscribeToConnected((e) => {
const { address } = e.args; const { address } = e.args;
setSelfAddress(address); setSelfAddress(address);
}); });
// show whether the client is ready or not
client?.events.subscribeToLoaded((e) => { client?.events.subscribeToLoaded((e) => {
console.log('Client ready: ', e.args); console.log("Client ready: ", e.args);
}); });
// show message payload content when received
client?.events.subscribeToTextMessageReceivedEvent((e) => { client?.events.subscribeToTextMessageReceivedEvent((e) => {
console.log(e.args.payload); console.log(e.args.payload);
setReceivedMessage(e.args.payload); setReceivedMessage(e.args.payload);
@@ -48,7 +56,8 @@ export const Traffic = () => {
await nym?.client.stop(); await nym?.client.stop();
}; };
const send = () => nym.client.send({ payload, recipient }); const send = () =>
payload && recipient && nym?.client.send({ payload, recipient });
useEffect(() => { useEffect(() => {
init(); init();
@@ -57,9 +66,17 @@ export const Traffic = () => {
}; };
}, []); }, []);
useEffect(() => {
if (recipient && payload) {
setButtonEnabled(true);
} else {
setButtonEnabled(false);
}
}, [recipient, payload]);
if (!nym || !selfAddress) { if (!nym || !selfAddress) {
return ( return (
<Box sx={{ display: 'flex' }}> <Box sx={{ display: "flex" }}>
<CircularProgress /> <CircularProgress />
</Box> </Box>
); );
@@ -67,10 +84,10 @@ export const Traffic = () => {
return ( return (
<Box padding={3}> <Box padding={3}>
<Paper style={{ marginTop: '1rem', padding: '2rem' }}> <Paper style={{ marginTop: "1rem", padding: "2rem" }}>
<Stack spacing={3}> <Stack spacing={3}>
<Typography variant="body1">My self address is:</Typography> <Typography variant="body1">My self address is:</Typography>
<Typography variant="body1">{selfAddress || 'loading'}</Typography> <Typography variant="body1">{selfAddress || "loading"}</Typography>
<Typography variant="h5">Communication through the Mixnet</Typography> <Typography variant="h5">Communication through the Mixnet</Typography>
<TextField <TextField
type="text" type="text"
@@ -83,15 +100,22 @@ export const Traffic = () => {
placeholder="Message to send" placeholder="Message to send"
multiline multiline
rows={4} rows={4}
onChange={(e) => setPayload({ message: e.target.value, mimeType: 'text/plain' })} onChange={(e) =>
setPayload({ message: e.target.value, mimeType: "text/plain" })
}
size="small" size="small"
/> />
<Button variant="outlined" onClick={() => send()} disabled={!payload || !recipient} sx={{width: 'fit-content'}}> <Button
variant="outlined"
onClick={() => send()}
disabled={!buttonEnabled}
sx={{ width: "fit-content" }}
>
Send Send
</Button> </Button>
</Stack> </Stack>
{receivedMessage && ( {receivedMessage && (
<Stack spacing={3} style={{ marginTop: '1rem' }}> <Stack spacing={3} style={{ marginTop: "1rem" }}>
<Typography variant="h5">Message Received!</Typography> <Typography variant="h5">Message Received!</Typography>
<Typography fontFamily="monospace">{receivedMessage}</Typography> <Typography fontFamily="monospace">{receivedMessage}</Typography>
</Stack> </Stack>
+4 -4
View File
@@ -9,13 +9,13 @@ import Stack from "@mui/material/Stack";
import Paper from "@mui/material/Paper"; import Paper from "@mui/material/Paper";
import type { SetupMixFetchOps } from "@nymproject/mix-fetch-full-fat"; import type { SetupMixFetchOps } from "@nymproject/mix-fetch-full-fat";
const defaultUrl = "https://nym.com/favicon.svg"; const defaultUrl = "https://nymtech.net/.wellknown/network-requester/exit-policy.txt";
const args = { mode: "unsafe-ignore-cors" }; const args = { mode: "unsafe-ignore-cors" };
const mixFetchOptions: SetupMixFetchOps = { const mixFetchOptions: SetupMixFetchOps = {
preferredGateway: "6Gb7ftQdKveMjPyrxDXeAtfYAX7Zg5mVZHtnRC5MmZ1B", // with WSS preferredGateway: "2xU4CBE6QiiYt6EyBXSALwxkNvM7gqJfjHXaMkjiFmYW", // with WSS
preferredNetworkRequester: // preferredNetworkRequester:
"8rRGWy54oC8drFL9DepMegBt2DLrsqQwCoHMXt9nsnTo.2XjCPVbb4FpQ9hNRcXwb9mTzEAVVk1zf1tcch3wdtNEA@6Gb7ftQdKveMjPyrxDXeAtfYAX7Zg5mVZHtnRC5MmZ1B", // "CTDxrcXgrZHWyCWnuCgjpJPghQUcEVz1HkhUr5mGdFnT.3UAww1YWNyVNYNWFQL1LaHYouQtDiXBGK5GiDZgpXkTK@2RFtU5BwxvJJXagAWAEuaPgb5ZVPRoy2542TT93Edw6v",
mixFetchOverride: { mixFetchOverride: {
requestTimeoutMs: 60_000, requestTimeoutMs: 60_000,
}, },
+2 -2
View File
@@ -38,8 +38,8 @@
"@nextui-org/accordion": "^2.0.40", "@nextui-org/accordion": "^2.0.40",
"@nextui-org/react": "^2.4.8", "@nextui-org/react": "^2.4.8",
"@nymproject/contract-clients": ">=1.2.4-rc.2 || ^1", "@nymproject/contract-clients": ">=1.2.4-rc.2 || ^1",
"@nymproject/mix-fetch-full-fat": ">=1.2.4-rc.2 || ^1", "@nymproject/mix-fetch-full-fat": ">=1.5.1-rc.0 || ^1.4.1",
"@nymproject/sdk-full-fat": ">=1.2.4-rc.2 || ^1", "@nymproject/sdk-full-fat": ">=1.5.1-rc.0 || ^1.4.1",
"@redocly/cli": "^1.25.15", "@redocly/cli": "^1.25.15",
"@types/mdx": "^2.0.13", "@types/mdx": "^2.0.13",
"chain-registry": "^1.19.0", "chain-registry": "^1.19.0",
+10 -10
View File
@@ -78,11 +78,11 @@ importers:
specifier: '>=1.2.4-rc.2 || ^1' specifier: '>=1.2.4-rc.2 || ^1'
version: 1.4.1 version: 1.4.1
'@nymproject/mix-fetch-full-fat': '@nymproject/mix-fetch-full-fat':
specifier: '>=1.2.4-rc.2 || ^1' specifier: '>=1.5.1-rc.0 || ^1.4.1'
version: 1.2.3 version: 1.4.1
'@nymproject/sdk-full-fat': '@nymproject/sdk-full-fat':
specifier: '>=1.2.4-rc.2 || ^1' specifier: '>=1.5.1-rc.0 || ^1.4.1'
version: 1.2.3 version: 1.4.1
'@redocly/cli': '@redocly/cli':
specifier: ^1.25.15 specifier: ^1.25.15
version: 1.34.5(ajv@8.17.1) version: 1.34.5(ajv@8.17.1)
@@ -1679,11 +1679,11 @@ packages:
'@nymproject/contract-clients@1.4.1': '@nymproject/contract-clients@1.4.1':
resolution: {integrity: sha512-HuJZ4Hv+Rl6ZZEtCHKgurNLJapM+QQRJlGkevFH2a4UdqUqF9omUkUi3AVes4679dPoSFgvA7plyVSDBdbgV6w==} resolution: {integrity: sha512-HuJZ4Hv+Rl6ZZEtCHKgurNLJapM+QQRJlGkevFH2a4UdqUqF9omUkUi3AVes4679dPoSFgvA7plyVSDBdbgV6w==}
'@nymproject/mix-fetch-full-fat@1.2.3': '@nymproject/mix-fetch-full-fat@1.4.1':
resolution: {integrity: sha512-5yAQhw33LC0cNsyV0Rj+LIa2kvJY+8jsfgOSr1aeKNfQ7dG4fngWkKnGUbPGzhUTJjqgXPTwNVeJSd6hwGim+g==} resolution: {integrity: sha512-AMa21sEd9FELqAJe1lCyHPqxxbc13ApiJ1P/exAslQjiFPb/de/3Ow0FHqKGNPrwyVRS/T2pSzjQ3l8TddiEBA==}
'@nymproject/sdk-full-fat@1.2.3': '@nymproject/sdk-full-fat@1.4.1':
resolution: {integrity: sha512-lheA1Zk020o2t95FPVZfdUR0aSI52aD0aJQs074fjH16QkoNNEMotzhJGAnsnnczVg3bpddKghNpCLyDOWvg9A==} resolution: {integrity: sha512-dh5bvMUj3m8nEssvO8Nl66WpcJAjwRZrGNwqfczJWLG4nX3Vt95tPLv4v0/Z1W3DQWQFW6WmEPPYHNjl18V/fA==}
'@opentelemetry/api-logs@0.53.0': '@opentelemetry/api-logs@0.53.0':
resolution: {integrity: sha512-8HArjKx+RaAI8uEIgcORbZIPklyh1YLjPSBus8hjRmvLi6DeFzgOcdZ7KwPabKj8mXF8dX0hyfAyGfycz0DbFw==} resolution: {integrity: sha512-8HArjKx+RaAI8uEIgcORbZIPklyh1YLjPSBus8hjRmvLi6DeFzgOcdZ7KwPabKj8mXF8dX0hyfAyGfycz0DbFw==}
@@ -9247,9 +9247,9 @@ snapshots:
'@nymproject/contract-clients@1.4.1': {} '@nymproject/contract-clients@1.4.1': {}
'@nymproject/mix-fetch-full-fat@1.2.3': {} '@nymproject/mix-fetch-full-fat@1.4.1': {}
'@nymproject/sdk-full-fat@1.2.3': {} '@nymproject/sdk-full-fat@1.4.1': {}
'@opentelemetry/api-logs@0.53.0': '@opentelemetry/api-logs@0.53.0':
dependencies: dependencies:
+16 -16
View File
@@ -2,23 +2,23 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
basePath: "/explorer", basePath: "/explorer",
assetPrefix: "/explorer", assetPrefix: "/explorer",
trailingSlash: false, trailingSlash: false,
async redirects() { async redirects() {
return [ return [
// Change the basePath to /explorer // Change the basePath to /explorer
{ {
source: "/", source: "/",
destination: "/explorer", destination: "/explorer",
basePath: false, basePath: false,
permanent: true, permanent: true,
}, },
]; ];
}, },
}; };
module.exports = nextConfig module.exports = nextConfig;
@@ -1,5 +1,6 @@
"use client"; "use client";
import type { IObservatoryNode } from "@/app/api/types"; import type { IObservatoryNode } from "@/app/api/types";
import { NYM_ACCOUNT_ADDRESS } from "@/app/api/urls";
import { Search } from "@mui/icons-material"; import { Search } from "@mui/icons-material";
import { import {
Autocomplete, Autocomplete,
@@ -13,7 +14,6 @@ import { useQuery } from "@tanstack/react-query";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useState } from "react"; import { useState } from "react";
import { fetchObservatoryNodes } from "../../app/api"; import { fetchObservatoryNodes } from "../../app/api";
import { NYM_ACCOUNT_ADDRESS } from "@/app/api/urls";
const NodeAndAddressSearch = () => { const NodeAndAddressSearch = () => {
const router = useRouter(); const router = useRouter();
@@ -50,7 +50,7 @@ const NodeAndAddressSearch = () => {
} }
} catch { } catch {
setErrorText( setErrorText(
"No node found with the provided Name, Node ID or Identity Key. Please check your input and try again." "No node found with the provided Name, Node ID or Identity Key. Please check your input and try again.",
); );
setIsLoading(false); // Stop loading setIsLoading(false); // Stop loading
@@ -58,7 +58,7 @@ const NodeAndAddressSearch = () => {
} }
} else { } else {
setErrorText( setErrorText(
"No node found with the provided Name, Node ID or Identity Key. Please check your input and try again." "No node found with the provided Name, Node ID or Identity Key. Please check your input and try again.",
); );
setIsLoading(false); // Stop loading setIsLoading(false); // Stop loading
@@ -68,7 +68,7 @@ const NodeAndAddressSearch = () => {
// Check if it's a node identity key // Check if it's a node identity key
if (nymNodes) { if (nymNodes) {
const matchingNode = nymNodes.find( const matchingNode = nymNodes.find(
(node) => node.identity_key === inputValue (node) => node.identity_key === inputValue,
); );
if (matchingNode) { if (matchingNode) {
@@ -77,13 +77,13 @@ const NodeAndAddressSearch = () => {
} }
} }
setErrorText( setErrorText(
"No node found with the provided Name, Node ID or Identity Key. Please check your input and try again." "No node found with the provided Name, Node ID or Identity Key. Please check your input and try again.",
); );
setIsLoading(false); setIsLoading(false);
} }
} catch (error) { } catch (error) {
setErrorText( setErrorText(
"No node found with the provided Name, Node ID or Identity Key. Please check your input and try again." "No node found with the provided Name, Node ID or Identity Key. Please check your input and try again.",
); );
console.error(error); console.error(error);
setIsLoading(false); // Stop loading setIsLoading(false); // Stop loading
@@ -92,7 +92,7 @@ const NodeAndAddressSearch = () => {
// Handle search input change // Handle search input change
const handleSearchInputChange = ( const handleSearchInputChange = (
event: React.ChangeEvent<HTMLInputElement> event: React.ChangeEvent<HTMLInputElement>,
) => { ) => {
const value = event.target.value; const value = event.target.value;
setInputValue(value); setInputValue(value);
@@ -107,7 +107,7 @@ const NodeAndAddressSearch = () => {
const filteredNodes = nymNodes.filter((node) => const filteredNodes = nymNodes.filter((node) =>
node.self_description?.moniker node.self_description?.moniker
?.toLowerCase() ?.toLowerCase()
.includes(value.toLowerCase()) .includes(value.toLowerCase()),
); );
setSearchOptions(filteredNodes); setSearchOptions(filteredNodes);
} else { } else {
@@ -118,7 +118,7 @@ const NodeAndAddressSearch = () => {
// Handle node selection from dropdown // Handle node selection from dropdown
const handleNodeSelect = ( const handleNodeSelect = (
event: React.SyntheticEvent, event: React.SyntheticEvent,
value: string | IObservatoryNode | null value: string | IObservatoryNode | null,
) => { ) => {
if (value && typeof value !== "string") { if (value && typeof value !== "string") {
setIsLoading(true); // Show loading spinner setIsLoading(true); // Show loading spinner
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "extension-storage" name = "extension-storage"
version = "1.4.0-rc.0" version = "1.4.1"
edition = "2024" edition = "2024"
license = "Apache-2.0" license = "Apache-2.0"
repository = "https://github.com/nymtech/nym" repository = "https://github.com/nymtech/nym"
+5 -1
View File
@@ -32,7 +32,7 @@
"@mui/styles": "^5.2.2", "@mui/styles": "^5.2.2",
"@mui/utils": "^5.7.0", "@mui/utils": "^5.7.0",
"@nymproject/mui-theme": "^1.0.0", "@nymproject/mui-theme": "^1.0.0",
"@nymproject/node-tester": "^1.2.3", "@nymproject/node-tester": "^1.3.1",
"@nymproject/react": "^1.0.0", "@nymproject/react": "^1.0.0",
"@nymproject/types": "^1.0.0", "@nymproject/types": "^1.0.0",
"@storybook/react": "^6.5.15", "@storybook/react": "^6.5.15",
@@ -80,6 +80,7 @@
"@types/big.js": "^6.1.6", "@types/big.js": "^6.1.6",
"@types/bs58": "^4.0.1", "@types/bs58": "^4.0.1",
"@types/jest": "^27.0.1", "@types/jest": "^27.0.1",
"@types/minimatch": "5.1.2",
"@types/node": "^16.7.13", "@types/node": "^16.7.13",
"@types/qrcode.react": "^1.0.2", "@types/qrcode.react": "^1.0.2",
"@types/react": "^18.0.26", "@types/react": "^18.0.26",
@@ -131,5 +132,8 @@
"webpack-favicons": "^1.3.8", "webpack-favicons": "^1.3.8",
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"resolutions": {
"@types/minimatch": "5.1.2"
},
"private": false "private": false
} }
+22 -26
View File
@@ -1,32 +1,32 @@
import React from 'react'; import React from 'react';
import { Box, Typography, Grid, Link, Card, CardContent, Stack } from '@mui/material'; import { Box, Typography, Grid, Link, Card, CardContent, Stack } from '@mui/material';
import { NymCard } from '..';
import BitfinexIcon from 'src/svg-icons/bitfinex.svg'; import BitfinexIcon from 'src/svg-icons/bitfinex.svg';
import KrakenIcon from 'src/svg-icons/kraken.svg'; import KrakenIcon from 'src/svg-icons/kraken.svg';
import BybitIcon from 'src/svg-icons/bybit.svg'; import BybitIcon from 'src/svg-icons/bybit.svg';
import GateIcon from 'src/svg-icons/gate22.svg'; import GateIcon from 'src/svg-icons/gate22.svg';
import HTXIcon from 'src/svg-icons/htx.svg'; import HTXIcon from 'src/svg-icons/htx.svg';
import { NymCard } from '..';
const ExchangeCard = ({ const ExchangeCard = ({
name, name,
tokenType, tokenType,
url, url,
IconComponent IconComponent,
}: { }: {
name: string; name: string;
tokenType: string; tokenType: string;
url: string; url: string;
IconComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>; IconComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
}) => ( }) => (
<Card <Card
variant="outlined" variant="outlined"
sx={{ sx={{
height: '100%', height: '100%',
transition: 'all 0.2s ease-in-out', transition: 'all 0.2s ease-in-out',
'&:hover': { '&:hover': {
transform: 'translateY(-2px)', transform: 'translateY(-2px)',
boxShadow: 2, boxShadow: 2,
} },
}} }}
> >
<CardContent sx={{ p: 3 }}> <CardContent sx={{ p: 3 }}>
@@ -51,17 +51,17 @@ const ExchangeCard = ({
<Typography variant="body2" sx={{ color: 'text.secondary' }}> <Typography variant="body2" sx={{ color: 'text.secondary' }}>
{tokenType} {tokenType}
</Typography> </Typography>
<Link <Link
href={url} href={url}
target="_blank" target="_blank"
variant="body2" variant="body2"
data-testid="link-get-nym" data-testid="link-get-nym"
sx={{ sx={{
textDecoration: 'underline', textDecoration: 'underline',
fontWeight: 500, fontWeight: 500,
'&:hover': { '&:hover': {
textDecoration: 'none', textDecoration: 'none',
} },
}} }}
> >
GET NYM GET NYM
@@ -78,44 +78,40 @@ export const Tutorial = () => {
name: 'Bitfinex', name: 'Bitfinex',
tokenType: 'Native NYM, ERC-20', tokenType: 'Native NYM, ERC-20',
url: 'https://www.bitfinex.com/', url: 'https://www.bitfinex.com/',
IconComponent: BitfinexIcon IconComponent: BitfinexIcon,
}, },
{ {
name: 'Kraken', name: 'Kraken',
tokenType: 'Native NYM', tokenType: 'Native NYM',
url: 'https://www.kraken.com/', url: 'https://www.kraken.com/',
IconComponent: KrakenIcon IconComponent: KrakenIcon,
}, },
{ {
name: 'Bybit', name: 'Bybit',
tokenType: 'ERC-20', tokenType: 'ERC-20',
url: 'https://www.bybit.com/en/', url: 'https://www.bybit.com/en/',
IconComponent: BybitIcon IconComponent: BybitIcon,
}, },
{ {
name: 'Gate.io', name: 'Gate.io',
tokenType: 'ERC-20', tokenType: 'ERC-20',
url: 'https://www.gate.io/', url: 'https://www.gate.io/',
IconComponent: GateIcon IconComponent: GateIcon,
}, },
{ {
name: 'HTX', name: 'HTX',
tokenType: 'ERC-20', tokenType: 'ERC-20',
url: 'https://www.htx.com/', url: 'https://www.htx.com/',
IconComponent: HTXIcon IconComponent: HTXIcon,
}, },
]; ];
return ( return (
<NymCard <NymCard borderless title="Where you can get NYM tokens" sx={{ mt: 4 }}>
borderless
title="Where you can get NYM tokens"
sx={{ mt: 4 }}
>
<Typography mb={3} fontSize={14} sx={{ color: 'text.secondary' }}> <Typography mb={3} fontSize={14} sx={{ color: 'text.secondary' }}>
You can get NYM tokens from these exchanges You can get NYM tokens from these exchanges
</Typography> </Typography>
<Grid container spacing={3}> <Grid container spacing={3}>
{exchanges.map((exchange) => ( {exchanges.map((exchange) => (
<Grid item xs={12} md={6} lg={4} key={exchange.name}> <Grid item xs={12} md={6} lg={4} key={exchange.name}>
+43 -42
View File
@@ -1,66 +1,67 @@
{ {
"name": "@nymproject/nymsphere", "name": "@nymproject/nymsphere",
"version": "1.0.0", "version": "1.0.1",
"private": true,
"license": "Apache 2.0", "license": "Apache 2.0",
"workspaces": [
"sdk/typescript/packages/**",
"sdk/typescript/examples/**",
"ts-packages/*",
"nym-wallet",
"explorer-nextjs",
"explorer-v2",
"types",
"clients/validator",
"sdk/typescript/packages/**",
"sdk/typescript/examples/**",
"sdk/typescript/codegen/**"
],
"scripts": { "scripts": {
"nuke": "npx rimraf **/node_modules node_modules", "audit:fix": "npm_config_yes=true npx yarn-audit-fix -- --dry-run",
"scrub": "npx rimraf **/dist dist",
"clean": "lerna run clean",
"build": "run-s build:types build:packages", "build": "run-s build:types build:packages",
"build:wasm": "make sdk-wasm-build", "build:ci": "run-s build:types build:packages build:wasm build:ci:sdk",
"build:types": "lerna run --scope @nymproject/types build --stream", "build:ci:sdk": "lerna run --scope '{@nymproject/sdk,@nymproject/node-tester,@nymproject/sdk-react,@nymproject/mix-fetch,@nymproject/nodejs-client,@nymproject/mix-fetch-node}' build --stream",
"build:packages": "run-s build:packages:theme build:packages:react",
"build:packages:theme": "lerna run --scope @nymproject/mui-theme build",
"build:packages:react": "lerna run --scope @nymproject/react build",
"build:playground": "lerna run --scope @nymproject/react storybook:build --stream",
"build:ci:storybook": "yarn build && yarn dev:on && run-p build:playground && yarn build:ci:storybook:collect-artifacts ", "build:ci:storybook": "yarn build && yarn dev:on && run-p build:playground && yarn build:ci:storybook:collect-artifacts ",
"build:ci:storybook:collect-artifacts": "mkdir -p ts-packages/dist && mv sdk/typescript/packages/react-components/storybook-static ts-packages/dist/storybook ", "build:ci:storybook:collect-artifacts": "mkdir -p ts-packages/dist && mv sdk/typescript/packages/react-components/storybook-static ts-packages/dist/storybook ",
"prebuild:ci": "yarn dev:on && yarn", "build:packages": "run-s build:packages:theme build:packages:react",
"build:ci": "run-s build:types build:packages build:wasm build:ci:sdk", "build:packages:react": "lerna run --scope @nymproject/react build",
"postbuild:ci": "yarn dev:off", "build:packages:theme": "lerna run --scope @nymproject/mui-theme build",
"build:ci:sdk": "lerna run --scope '{@nymproject/sdk,@nymproject/node-tester,@nymproject/sdk-react,@nymproject/mix-fetch,@nymproject/nodejs-client,@nymproject/mix-fetch-node}' build --stream", "build:playground": "lerna run --scope @nymproject/react storybook:build --stream",
"build:types": "lerna run --scope @nymproject/types build --stream",
"build:wasm": "make sdk-wasm-build",
"clean": "lerna run clean",
"dev:off": "node sdk/typescript/scripts/dev-mode-remove.mjs",
"dev:on": "node sdk/typescript/scripts/dev-mode-add.mjs",
"docs:prod:build": "run-s docs:prod:build:ws", "docs:prod:build": "run-s docs:prod:build:ws",
"docs:prod:build:ws": "lerna run docs:prod:build --stream", "docs:prod:build:ws": "lerna run docs:prod:build --stream",
"sdk:build": "./sdk/typescript/scripts/build-prod-sdk.sh",
"sdk:publish": "./sdk/typescript/scripts/publish.sh",
"lint": "lerna run lint --stream", "lint": "lerna run lint --stream",
"lint:fix": "lerna run lint:fix --stream", "lint:fix": "lerna run lint:fix --stream",
"nuke": "npx rimraf **/node_modules node_modules",
"postbuild:ci": "yarn dev:off",
"prebuild:ci": "yarn dev:on && yarn",
"scrub": "npx rimraf **/dist dist",
"sdk:build": "./sdk/typescript/scripts/build-prod-sdk.sh",
"sdk:publish": "./sdk/typescript/scripts/publish.sh",
"sdk:versions:add-rc": "cargo run -p sdk-version-bump --pre-release",
"sdk:versions:bump": "cargo run -p sdk-version-bump bump-version",
"sdk:versions:remove-rc": "cargo run -p sdk-version-bump remove-suffix",
"tsc": "lerna run tsc --stream", "tsc": "lerna run tsc --stream",
"types:lint:fix": "lerna run lint:fix --scope @nymproject/types --scope @nymproject/nym-wallet-app", "types:lint:fix": "lerna run lint:fix --scope @nymproject/types --scope @nymproject/nym-wallet-app"
"audit:fix": "npm_config_yes=true npx yarn-audit-fix -- --dry-run", },
"dev:on": "node sdk/typescript/scripts/dev-mode-add.mjs", "dependencies": {
"dev:off": "node sdk/typescript/scripts/dev-mode-remove.mjs" "lucide-react": "^0.453.0"
}, },
"devDependencies": { "devDependencies": {
"@npmcli/node-gyp": "^3.0.0", "@npmcli/node-gyp": "^3.0.0",
"@types/minimatch": "^6.0.0", "@types/minimatch": "5.1.2",
"lerna": "^7.3.0", "lerna": "^7.3.0",
"node-gyp": "^9.3.1", "node-gyp": "^9.3.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"tslog": "3.3.3" "tslog": "3.3.3"
}, },
"dependencies": { "private": true,
"lucide-react": "^0.453.0"
},
"resolutions": { "resolutions": {
"@cosmjs/amino": "^0.32.4", "@cosmjs/amino": "^0.32.4",
"@cosmjs/cosmwasm-stargate": "^0.32.4",
"@cosmjs/proto-signing": "^0.32.4", "@cosmjs/proto-signing": "^0.32.4",
"@cosmjs/stargate": "^0.32.4", "@cosmjs/stargate": "^0.32.4",
"@cosmjs/cosmwasm-stargate": "^0.32.4", "cosmjs-types": "^0.9.0",
"cosmjs-types": "^0.9.0" "@types/minimatch": "5.1.2"
} },
} "workspaces": [
"ts-packages/*",
"nym-wallet",
"explorer-nextjs",
"explorer-v2",
"types",
"sdk/typescript/packages/mix-fetch/internal-dev",
"sdk/typescript/packages/react-components",
"sdk/typescript/packages/mui-theme"
]
}
@@ -3,13 +3,11 @@ import codegen from '@cosmwasm/ts-codegen';
codegen codegen
.default({ .default({
contracts: [ contracts: [
{ name: 'coconut-bandwidth', dir: '../../../../contracts/coconut-bandwidth' }, { name: 'ecash', dir: '../../../../contracts/ecash' },
{ name: 'coconut-dkg', dir: '../../../../contracts/coconut-dkg' }, { name: 'coconut-dkg', dir: '../../../../contracts/coconut-dkg' },
{ name: 'mixnet', dir: '../../../../contracts/mixnet' }, { name: 'mixnet', dir: '../../../../contracts/mixnet' },
{ name: 'cw3-flex-multisig', dir: '../../../../contracts/multisig/cw3-flex-multisig' }, { name: 'cw3-flex-multisig', dir: '../../../../contracts/multisig/cw3-flex-multisig' },
{ name: 'cw4-group', dir: '../../../../contracts/multisig/cw4-group' }, { name: 'cw4-group', dir: '../../../../contracts/multisig/cw4-group' },
{ name: 'name-service', dir: '../../../../contracts/name-service' },
{ name: 'service-provider-directory', dir: '../../../../contracts/service-provider-directory' },
{ name: 'vesting', dir: '../../../../contracts/vesting' }, { name: 'vesting', dir: '../../../../contracts/vesting' },
], ],
outPath: './src', outPath: './src',
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/contract-clients", "name": "@nymproject/contract-clients",
"version": "1.3.0-rc.0", "version": "1.3.1-rc0",
"description": "A client for all Nym smart contracts", "description": "A client for all Nym smart contracts",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Nym Technologies SA", "author": "Nym Technologies SA",
@@ -18,7 +18,7 @@
"docs:watch": "nodemon --ext ts --watch './src/**/*' --watch './typedoc.json' --exec \"yarn docs:generate\"" "docs:watch": "nodemon --ext ts --watch './src/**/*' --watch './typedoc.json' --exec \"yarn docs:generate\""
}, },
"devDependencies": { "devDependencies": {
"@cosmwasm/ts-codegen": "^0.35.3", "@cosmwasm/ts-codegen": "^1.13.3",
"nodemon": "3.0.1", "nodemon": "3.0.1",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"reload": "^3.2.1", "reload": "^3.2.1",
@@ -27,4 +27,4 @@
}, },
"private": false, "private": false,
"types": "./dist/index.d.ts" "types": "./dist/index.d.ts"
} }
@@ -1,23 +1,58 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient";
import { Coin, StdFee } from "@cosmjs/amino"; import { Coin, StdFee } from "@interchainjs/types";
import { InstantiateMsg, TimeConfiguration, ExecuteMsg, ContractSafeBytes, Addr, QueryMsg, MigrateMsg, PagedDealerResponse, DealerDetails, Timestamp, Uint64, EpochState, Epoch, DealerType, DealerDetailsResponse, PagedDealingsResponse, ContractDealing, NullableInitialReplacementData, InitialReplacementData, PagedVKSharesResponse, ContractVKShare } from "./CoconutDkg.types"; import { InstantiateMsg, TimeConfiguration, ExecuteMsg, ContractSafeBytes, DealingChunkInfo, PartialContractDealing, QueryMsg, MigrateMsg, EpochState, Timestamp, Uint64, StateAdvanceResponse, StateProgress, ContractVersion, Addr, PagedDealerResponse, DealerDetails, Epoch, DealerDealingsStatusResponse, DealerType, DealerDetailsResponse, PagedDealerIndexResponse, DealingChunkResponse, DealingChunkStatusResponse, ChunkSubmissionStatus, DealingStatusResponse, DealingStatus, DealingMetadataResponse, DealingMetadata, PagedDealerAddressesResponse, NullableEpoch, RegisteredDealerDetails, DealerRegistrationDetails, Cw4Contract, State, VkShareResponse, ContractVKShare, PagedVKSharesResponse } from "./CoconutDkg.types";
export interface CoconutDkgReadOnlyInterface { export interface CoconutDkgReadOnlyInterface {
contractAddress: string; contractAddress: string;
getState: () => Promise<State>;
getCurrentEpochState: () => Promise<Epoch>; getCurrentEpochState: () => Promise<Epoch>;
getEpochStateAtHeight: ({
height
}: {
height: number;
}) => Promise<NullableEpoch>;
getCurrentEpochThreshold: () => Promise<Uint64>; getCurrentEpochThreshold: () => Promise<Uint64>;
getInitialDealers: () => Promise<NullableInitialReplacementData>; getEpochThreshold: ({
epochId
}: {
epochId: number;
}) => Promise<Uint64>;
canAdvanceState: () => Promise<StateAdvanceResponse>;
getRegisteredDealer: ({
dealerAddress,
epochId
}: {
dealerAddress: string;
epochId?: number;
}) => Promise<RegisteredDealerDetails>;
getDealerDetails: ({ getDealerDetails: ({
dealerAddress dealerAddress
}: { }: {
dealerAddress: string; dealerAddress: string;
}) => Promise<DealerDetailsResponse>; }) => Promise<DealerDetailsResponse>;
getEpochDealersAddresses: ({
epochId,
limit,
startAfter
}: {
epochId: number;
limit?: number;
startAfter?: string;
}) => Promise<PagedDealerAddressesResponse>;
getEpochDealers: ({
epochId,
limit,
startAfter
}: {
epochId: number;
limit?: number;
startAfter?: string;
}) => Promise<PagedDealerResponse>;
getCurrentDealers: ({ getCurrentDealers: ({
limit, limit,
startAfter startAfter
@@ -25,22 +60,67 @@ export interface CoconutDkgReadOnlyInterface {
limit?: number; limit?: number;
startAfter?: string; startAfter?: string;
}) => Promise<PagedDealerResponse>; }) => Promise<PagedDealerResponse>;
getPastDealers: ({ getDealerIndices: ({
limit, limit,
startAfter startAfter
}: { }: {
limit?: number; limit?: number;
startAfter?: string; startAfter?: string;
}) => Promise<PagedDealerResponse>; }) => Promise<PagedDealerIndexResponse>;
getDealing: ({ getDealingsMetadata: ({
idx, dealer,
limit, dealingIndex,
startAfter epochId
}: { }: {
idx: number; dealer: string;
limit?: number; dealingIndex: number;
startAfter?: string; epochId: number;
}) => Promise<PagedDealingsResponse>; }) => Promise<DealingMetadataResponse>;
getDealerDealingsStatus: ({
dealer,
epochId
}: {
dealer: string;
epochId: number;
}) => Promise<DealerDealingsStatusResponse>;
getDealingStatus: ({
dealer,
dealingIndex,
epochId
}: {
dealer: string;
dealingIndex: number;
epochId: number;
}) => Promise<DealingStatusResponse>;
getDealingChunkStatus: ({
chunkIndex,
dealer,
dealingIndex,
epochId
}: {
chunkIndex: number;
dealer: string;
dealingIndex: number;
epochId: number;
}) => Promise<DealingChunkStatusResponse>;
getDealingChunk: ({
chunkIndex,
dealer,
dealingIndex,
epochId
}: {
chunkIndex: number;
dealer: string;
dealingIndex: number;
epochId: number;
}) => Promise<DealingChunkResponse>;
getVerificationKey: ({
epochId,
owner
}: {
epochId: number;
owner: string;
}) => Promise<VkShareResponse>;
getVerificationKeys: ({ getVerificationKeys: ({
epochId, epochId,
limit, limit,
@@ -50,37 +130,89 @@ export interface CoconutDkgReadOnlyInterface {
limit?: number; limit?: number;
startAfter?: string; startAfter?: string;
}) => Promise<PagedVKSharesResponse>; }) => Promise<PagedVKSharesResponse>;
getCw2ContractVersion: () => Promise<GetCw2ContractVersionResponse>;
} }
export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface { export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface {
client: CosmWasmClient; client: ICosmWasmClient;
contractAddress: string; contractAddress: string;
constructor(client: ICosmWasmClient, contractAddress: string) {
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client; this.client = client;
this.contractAddress = contractAddress; this.contractAddress = contractAddress;
this.getState = this.getState.bind(this);
this.getCurrentEpochState = this.getCurrentEpochState.bind(this); this.getCurrentEpochState = this.getCurrentEpochState.bind(this);
this.getEpochStateAtHeight = this.getEpochStateAtHeight.bind(this);
this.getCurrentEpochThreshold = this.getCurrentEpochThreshold.bind(this); this.getCurrentEpochThreshold = this.getCurrentEpochThreshold.bind(this);
this.getInitialDealers = this.getInitialDealers.bind(this); this.getEpochThreshold = this.getEpochThreshold.bind(this);
this.canAdvanceState = this.canAdvanceState.bind(this);
this.getRegisteredDealer = this.getRegisteredDealer.bind(this);
this.getDealerDetails = this.getDealerDetails.bind(this); this.getDealerDetails = this.getDealerDetails.bind(this);
this.getEpochDealersAddresses = this.getEpochDealersAddresses.bind(this);
this.getEpochDealers = this.getEpochDealers.bind(this);
this.getCurrentDealers = this.getCurrentDealers.bind(this); this.getCurrentDealers = this.getCurrentDealers.bind(this);
this.getPastDealers = this.getPastDealers.bind(this); this.getDealerIndices = this.getDealerIndices.bind(this);
this.getDealing = this.getDealing.bind(this); this.getDealingsMetadata = this.getDealingsMetadata.bind(this);
this.getDealerDealingsStatus = this.getDealerDealingsStatus.bind(this);
this.getDealingStatus = this.getDealingStatus.bind(this);
this.getDealingChunkStatus = this.getDealingChunkStatus.bind(this);
this.getDealingChunk = this.getDealingChunk.bind(this);
this.getVerificationKey = this.getVerificationKey.bind(this);
this.getVerificationKeys = this.getVerificationKeys.bind(this); this.getVerificationKeys = this.getVerificationKeys.bind(this);
this.getCw2ContractVersion = this.getCw2ContractVersion.bind(this);
} }
getState = async (): Promise<State> => {
return this.client.queryContractSmart(this.contractAddress, {
get_state: {}
});
};
getCurrentEpochState = async (): Promise<Epoch> => { getCurrentEpochState = async (): Promise<Epoch> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
get_current_epoch_state: {} get_current_epoch_state: {}
}); });
}; };
getEpochStateAtHeight = async ({
height
}: {
height: number;
}): Promise<NullableEpoch> => {
return this.client.queryContractSmart(this.contractAddress, {
get_epoch_state_at_height: {
height
}
});
};
getCurrentEpochThreshold = async (): Promise<Uint64> => { getCurrentEpochThreshold = async (): Promise<Uint64> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
get_current_epoch_threshold: {} get_current_epoch_threshold: {}
}); });
}; };
getInitialDealers = async (): Promise<NullableInitialReplacementData> => { getEpochThreshold = async ({
epochId
}: {
epochId: number;
}): Promise<Uint64> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
get_initial_dealers: {} get_epoch_threshold: {
epoch_id: epochId
}
});
};
canAdvanceState = async (): Promise<StateAdvanceResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
can_advance_state: {}
});
};
getRegisteredDealer = async ({
dealerAddress,
epochId
}: {
dealerAddress: string;
epochId?: number;
}): Promise<RegisteredDealerDetails> => {
return this.client.queryContractSmart(this.contractAddress, {
get_registered_dealer: {
dealer_address: dealerAddress,
epoch_id: epochId
}
}); });
}; };
getDealerDetails = async ({ getDealerDetails = async ({
@@ -94,6 +226,40 @@ export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface {
} }
}); });
}; };
getEpochDealersAddresses = async ({
epochId,
limit,
startAfter
}: {
epochId: number;
limit?: number;
startAfter?: string;
}): Promise<PagedDealerAddressesResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_epoch_dealers_addresses: {
epoch_id: epochId,
limit,
start_after: startAfter
}
});
};
getEpochDealers = async ({
epochId,
limit,
startAfter
}: {
epochId: number;
limit?: number;
startAfter?: string;
}): Promise<PagedDealerResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_epoch_dealers: {
epoch_id: epochId,
limit,
start_after: startAfter
}
});
};
getCurrentDealers = async ({ getCurrentDealers = async ({
limit, limit,
startAfter startAfter
@@ -108,34 +274,119 @@ export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface {
} }
}); });
}; };
getPastDealers = async ({ getDealerIndices = async ({
limit, limit,
startAfter startAfter
}: { }: {
limit?: number; limit?: number;
startAfter?: string; startAfter?: string;
}): Promise<PagedDealerResponse> => { }): Promise<PagedDealerIndexResponse> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
get_past_dealers: { get_dealer_indices: {
limit, limit,
start_after: startAfter start_after: startAfter
} }
}); });
}; };
getDealing = async ({ getDealingsMetadata = async ({
idx, dealer,
limit, dealingIndex,
startAfter epochId
}: { }: {
idx: number; dealer: string;
limit?: number; dealingIndex: number;
startAfter?: string; epochId: number;
}): Promise<PagedDealingsResponse> => { }): Promise<DealingMetadataResponse> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
get_dealing: { get_dealings_metadata: {
idx, dealer,
limit, dealing_index: dealingIndex,
start_after: startAfter epoch_id: epochId
}
});
};
getDealerDealingsStatus = async ({
dealer,
epochId
}: {
dealer: string;
epochId: number;
}): Promise<DealerDealingsStatusResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_dealer_dealings_status: {
dealer,
epoch_id: epochId
}
});
};
getDealingStatus = async ({
dealer,
dealingIndex,
epochId
}: {
dealer: string;
dealingIndex: number;
epochId: number;
}): Promise<DealingStatusResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_dealing_status: {
dealer,
dealing_index: dealingIndex,
epoch_id: epochId
}
});
};
getDealingChunkStatus = async ({
chunkIndex,
dealer,
dealingIndex,
epochId
}: {
chunkIndex: number;
dealer: string;
dealingIndex: number;
epochId: number;
}): Promise<DealingChunkStatusResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_dealing_chunk_status: {
chunk_index: chunkIndex,
dealer,
dealing_index: dealingIndex,
epoch_id: epochId
}
});
};
getDealingChunk = async ({
chunkIndex,
dealer,
dealingIndex,
epochId
}: {
chunkIndex: number;
dealer: string;
dealingIndex: number;
epochId: number;
}): Promise<DealingChunkResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_dealing_chunk: {
chunk_index: chunkIndex,
dealer,
dealing_index: dealingIndex,
epoch_id: epochId
}
});
};
getVerificationKey = async ({
epochId,
owner
}: {
epochId: number;
owner: string;
}): Promise<VkShareResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_verification_key: {
epoch_id: epochId,
owner
} }
}); });
}; };
@@ -156,91 +407,142 @@ export class CoconutDkgQueryClient implements CoconutDkgReadOnlyInterface {
} }
}); });
}; };
getCw2ContractVersion = async (): Promise<GetCw2ContractVersionResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_cw2_contract_version: {}
});
};
} }
export interface CoconutDkgInterface extends CoconutDkgReadOnlyInterface { export interface CoconutDkgInterface extends CoconutDkgReadOnlyInterface {
contractAddress: string; contractAddress: string;
sender: string; sender: string;
initiateDkg: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
registerDealer: ({ registerDealer: ({
announceAddress, announceAddress,
bteKeyWithProof, bteKeyWithProof,
identityKey,
resharing resharing
}: { }: {
announceAddress: string; announceAddress: string;
bteKeyWithProof: string; bteKeyWithProof: string;
identityKey: string;
resharing: boolean; resharing: boolean;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
commitDealing: ({ commitDealingsMetadata: ({
dealingBytes, chunks,
dealingIndex,
resharing resharing
}: { }: {
dealingBytes: ContractSafeBytes; chunks: DealingChunkInfo[];
dealingIndex: number;
resharing: boolean; resharing: boolean;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
commitDealingsChunk: ({
chunk
}: {
chunk: PartialContractDealing;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
commitVerificationKeyShare: ({ commitVerificationKeyShare: ({
resharing, resharing,
share share
}: { }: {
resharing: boolean; resharing: boolean;
share: string; share: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
verifyVerificationKeyShare: ({ verifyVerificationKeyShare: ({
owner, owner,
resharing resharing
}: { }: {
owner: Addr; owner: string;
resharing: boolean; resharing: boolean;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
surpassedThreshold: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; advanceEpochState: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
advanceEpochState: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; triggerReset: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
triggerResharing: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
transferOwnership: ({
transferTo
}: {
transferTo: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateAnnounceAddress: ({
newAddress
}: {
newAddress: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
} }
export class CoconutDkgClient extends CoconutDkgQueryClient implements CoconutDkgInterface { export class CoconutDkgClient extends CoconutDkgQueryClient implements CoconutDkgInterface {
client: SigningCosmWasmClient; client: ISigningCosmWasmClient;
sender: string; sender: string;
contractAddress: string; contractAddress: string;
constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) {
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress); super(client, contractAddress);
this.client = client; this.client = client;
this.sender = sender; this.sender = sender;
this.contractAddress = contractAddress; this.contractAddress = contractAddress;
this.initiateDkg = this.initiateDkg.bind(this);
this.registerDealer = this.registerDealer.bind(this); this.registerDealer = this.registerDealer.bind(this);
this.commitDealing = this.commitDealing.bind(this); this.commitDealingsMetadata = this.commitDealingsMetadata.bind(this);
this.commitDealingsChunk = this.commitDealingsChunk.bind(this);
this.commitVerificationKeyShare = this.commitVerificationKeyShare.bind(this); this.commitVerificationKeyShare = this.commitVerificationKeyShare.bind(this);
this.verifyVerificationKeyShare = this.verifyVerificationKeyShare.bind(this); this.verifyVerificationKeyShare = this.verifyVerificationKeyShare.bind(this);
this.surpassedThreshold = this.surpassedThreshold.bind(this);
this.advanceEpochState = this.advanceEpochState.bind(this); this.advanceEpochState = this.advanceEpochState.bind(this);
this.triggerReset = this.triggerReset.bind(this);
this.triggerResharing = this.triggerResharing.bind(this);
this.transferOwnership = this.transferOwnership.bind(this);
this.updateAnnounceAddress = this.updateAnnounceAddress.bind(this);
} }
initiateDkg = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
initiate_dkg: {}
}, fee_, memo_, funds_);
};
registerDealer = async ({ registerDealer = async ({
announceAddress, announceAddress,
bteKeyWithProof, bteKeyWithProof,
identityKey,
resharing resharing
}: { }: {
announceAddress: string; announceAddress: string;
bteKeyWithProof: string; bteKeyWithProof: string;
identityKey: string;
resharing: boolean; resharing: boolean;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
register_dealer: { register_dealer: {
announce_address: announceAddress, announce_address: announceAddress,
bte_key_with_proof: bteKeyWithProof, bte_key_with_proof: bteKeyWithProof,
identity_key: identityKey,
resharing resharing
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
commitDealing = async ({ commitDealingsMetadata = async ({
dealingBytes, chunks,
dealingIndex,
resharing resharing
}: { }: {
dealingBytes: ContractSafeBytes; chunks: DealingChunkInfo[];
dealingIndex: number;
resharing: boolean; resharing: boolean;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
commit_dealing: { commit_dealings_metadata: {
dealing_bytes: dealingBytes, chunks,
dealing_index: dealingIndex,
resharing resharing
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
};
commitDealingsChunk = async ({
chunk
}: {
chunk: PartialContractDealing;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
commit_dealings_chunk: {
chunk
}
}, fee_, memo_, funds_);
}; };
commitVerificationKeyShare = async ({ commitVerificationKeyShare = async ({
resharing, resharing,
@@ -248,36 +550,63 @@ export class CoconutDkgClient extends CoconutDkgQueryClient implements CoconutDk
}: { }: {
resharing: boolean; resharing: boolean;
share: string; share: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
commit_verification_key_share: { commit_verification_key_share: {
resharing, resharing,
share share
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
verifyVerificationKeyShare = async ({ verifyVerificationKeyShare = async ({
owner, owner,
resharing resharing
}: { }: {
owner: Addr; owner: string;
resharing: boolean; resharing: boolean;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
verify_verification_key_share: { verify_verification_key_share: {
owner, owner,
resharing resharing
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
surpassedThreshold = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { advanceEpochState = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
surpassed_threshold: {}
}, fee, memo, _funds);
};
advanceEpochState = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
advance_epoch_state: {} advance_epoch_state: {}
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
} triggerReset = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
trigger_reset: {}
}, fee_, memo_, funds_);
};
triggerResharing = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
trigger_resharing: {}
}, fee_, memo_, funds_);
};
transferOwnership = async ({
transferTo
}: {
transferTo: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
transfer_ownership: {
transfer_to: transferTo
}
}, fee_, memo_, funds_);
};
updateAnnounceAddress = async ({
newAddress
}: {
newAddress: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_announce_address: {
new_address: newAddress
}
}, fee_, memo_, funds_);
};
}
@@ -1,11 +1,12 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
export interface InstantiateMsg { export interface InstantiateMsg {
group_addr: string; group_addr: string;
key_size: number;
mix_denom: string; mix_denom: string;
multisig_addr: string; multisig_addr: string;
time_configuration?: TimeConfiguration | null; time_configuration?: TimeConfiguration | null;
@@ -19,16 +20,24 @@ export interface TimeConfiguration {
verification_key_validation_time_secs: number; verification_key_validation_time_secs: number;
} }
export type ExecuteMsg = { export type ExecuteMsg = {
initiate_dkg: {};
} | {
register_dealer: { register_dealer: {
announce_address: string; announce_address: string;
bte_key_with_proof: string; bte_key_with_proof: string;
identity_key: string;
resharing: boolean; resharing: boolean;
}; };
} | { } | {
commit_dealing: { commit_dealings_metadata: {
dealing_bytes: ContractSafeBytes; chunks: DealingChunkInfo[];
dealing_index: number;
resharing: boolean; resharing: boolean;
}; };
} | {
commit_dealings_chunk: {
chunk: PartialContractDealing;
};
} | { } | {
commit_verification_key_share: { commit_verification_key_share: {
resharing: boolean; resharing: boolean;
@@ -36,41 +45,115 @@ export type ExecuteMsg = {
}; };
} | { } | {
verify_verification_key_share: { verify_verification_key_share: {
owner: Addr; owner: string;
resharing: boolean; resharing: boolean;
}; };
} | {
surpassed_threshold: {};
} | { } | {
advance_epoch_state: {}; advance_epoch_state: {};
} | {
trigger_reset: {};
} | {
trigger_resharing: {};
} | {
transfer_ownership: {
transfer_to: string;
};
} | {
update_announce_address: {
new_address: string;
};
}; };
export type ContractSafeBytes = number[]; export type ContractSafeBytes = number[];
export type Addr = string; export interface DealingChunkInfo {
size: number;
}
export interface PartialContractDealing {
chunk_index: number;
data: ContractSafeBytes;
dealing_index: number;
}
export type QueryMsg = { export type QueryMsg = {
get_state: {};
} | {
get_current_epoch_state: {}; get_current_epoch_state: {};
} | {
get_epoch_state_at_height: {
height: number;
};
} | { } | {
get_current_epoch_threshold: {}; get_current_epoch_threshold: {};
} | { } | {
get_initial_dealers: {}; get_epoch_threshold: {
epoch_id: number;
};
} | {
can_advance_state: {};
} | {
get_registered_dealer: {
dealer_address: string;
epoch_id?: number | null;
};
} | { } | {
get_dealer_details: { get_dealer_details: {
dealer_address: string; dealer_address: string;
}; };
} | {
get_epoch_dealers_addresses: {
epoch_id: number;
limit?: number | null;
start_after?: string | null;
};
} | {
get_epoch_dealers: {
epoch_id: number;
limit?: number | null;
start_after?: string | null;
};
} | { } | {
get_current_dealers: { get_current_dealers: {
limit?: number | null; limit?: number | null;
start_after?: string | null; start_after?: string | null;
}; };
} | { } | {
get_past_dealers: { get_dealer_indices: {
limit?: number | null; limit?: number | null;
start_after?: string | null; start_after?: string | null;
}; };
} | { } | {
get_dealing: { get_dealings_metadata: {
idx: number; dealer: string;
limit?: number | null; dealing_index: number;
start_after?: string | null; epoch_id: number;
};
} | {
get_dealer_dealings_status: {
dealer: string;
epoch_id: number;
};
} | {
get_dealing_status: {
dealer: string;
dealing_index: number;
epoch_id: number;
};
} | {
get_dealing_chunk_status: {
chunk_index: number;
dealer: string;
dealing_index: number;
epoch_id: number;
};
} | {
get_dealing_chunk: {
chunk_index: number;
dealer: string;
dealing_index: number;
epoch_id: number;
};
} | {
get_verification_key: {
epoch_id: number;
owner: string;
}; };
} | { } | {
get_verification_keys: { get_verification_keys: {
@@ -78,22 +161,11 @@ export type QueryMsg = {
limit?: number | null; limit?: number | null;
start_after?: string | null; start_after?: string | null;
}; };
} | {
get_cw2_contract_version: {};
}; };
export interface MigrateMsg {} export interface MigrateMsg {}
export interface PagedDealerResponse { export type EpochState = ("waiting_initialisation" | "in_progress") | {
dealers: DealerDetails[];
per_page: number;
start_next_after?: Addr | null;
}
export interface DealerDetails {
address: Addr;
announce_address: string;
assigned_index: number;
bte_public_key_with_proof: string;
}
export type Timestamp = Uint64;
export type Uint64 = number;
export type EpochState = "in_progress" | {
public_key_submission: { public_key_submission: {
resharing: boolean; resharing: boolean;
}; };
@@ -114,36 +186,132 @@ export type EpochState = "in_progress" | {
resharing: boolean; resharing: boolean;
}; };
}; };
export type Timestamp = Uint64;
export type Uint64 = number;
export interface StateAdvanceResponse {
current_state: EpochState;
deadline?: Timestamp | null;
is_complete: boolean;
progress: StateProgress;
reached_deadline: boolean;
}
export interface StateProgress {
registered_dealers: number;
registered_resharing_dealers: number;
submitted_dealings: number;
submitted_key_shares: number;
verified_keys: number;
}
export interface ContractVersion {
contract: string;
version: string;
}
export type Addr = string;
export interface PagedDealerResponse {
dealers: DealerDetails[];
per_page: number;
start_next_after?: Addr | null;
}
export interface DealerDetails {
address: Addr;
announce_address: string;
assigned_index: number;
bte_public_key_with_proof: string;
ed25519_identity: string;
}
export interface Epoch { export interface Epoch {
deadline?: Timestamp | null;
epoch_id: number; epoch_id: number;
finish_timestamp: Timestamp;
state: EpochState; state: EpochState;
state_progress: StateProgress;
time_configuration: TimeConfiguration; time_configuration: TimeConfiguration;
} }
export type DealerType = "current" | "past" | "unknown"; export interface DealerDealingsStatusResponse {
all_dealings_fully_submitted: boolean;
dealer: Addr;
dealing_submission_status: {};
epoch_id: number;
}
export type DealerType = "unknown" | {
current: {
assigned_index: number;
};
} | {
past: {
assigned_index: number;
};
};
export interface DealerDetailsResponse { export interface DealerDetailsResponse {
dealer_type: DealerType; dealer_type: DealerType;
details?: DealerDetails | null; details?: DealerDetails | null;
} }
export interface PagedDealingsResponse { export interface PagedDealerIndexResponse {
dealings: ContractDealing[]; indices: [Addr, number][];
per_page: number;
start_next_after?: Addr | null; start_next_after?: Addr | null;
} }
export interface ContractDealing { export interface DealingChunkResponse {
chunk?: ContractSafeBytes | null;
chunk_index: number;
dealer: Addr; dealer: Addr;
dealing: ContractSafeBytes; dealing_index: number;
epoch_id: number;
} }
export type NullableInitialReplacementData = InitialReplacementData | null; export interface DealingChunkStatusResponse {
export interface InitialReplacementData { chunk_index: number;
initial_dealers: Addr[]; dealer: Addr;
initial_height: number; dealing_index: number;
epoch_id: number;
status: ChunkSubmissionStatus;
} }
export interface PagedVKSharesResponse { export interface ChunkSubmissionStatus {
per_page: number; submission_height?: number | null;
shares: ContractVKShare[]; }
export interface DealingStatusResponse {
dealer: Addr;
dealing_index: number;
epoch_id: number;
status: DealingStatus;
}
export interface DealingStatus {
chunk_submission_status: {};
fully_submitted: boolean;
has_metadata: boolean;
}
export interface DealingMetadataResponse {
dealer: Addr;
dealing_index: number;
epoch_id: number;
metadata?: DealingMetadata | null;
}
export interface DealingMetadata {
dealing_index: number;
submitted_chunks: {};
}
export interface PagedDealerAddressesResponse {
dealers: Addr[];
start_next_after?: Addr | null; start_next_after?: Addr | null;
} }
export type NullableEpoch = Epoch | null;
export interface RegisteredDealerDetails {
details?: DealerRegistrationDetails | null;
}
export interface DealerRegistrationDetails {
announce_address: string;
bte_public_key_with_proof: string;
ed25519_identity: string;
}
export type Cw4Contract = Addr;
export interface State {
group_addr: Cw4Contract;
key_size: number;
mix_denom: string;
multisig_addr: Addr;
}
export interface VkShareResponse {
epoch_id: number;
owner: Addr;
share?: ContractVKShare | null;
}
export interface ContractVKShare { export interface ContractVKShare {
announce_address: string; announce_address: string;
epoch_id: number; epoch_id: number;
@@ -151,4 +319,9 @@ export interface ContractVKShare {
owner: Addr; owner: Addr;
share: string; share: string;
verified: boolean; verified: boolean;
}
export interface PagedVKSharesResponse {
per_page: number;
shares: ContractVKShare[];
start_next_after?: Addr | null;
} }
@@ -1,13 +1,12 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient";
import { StdFee } from "@cosmjs/amino"; import { StdFee } from "@interchainjs/types";
import { Executor, Addr, Duration, Uint128, UncheckedDenom, Threshold, Decimal, InstantiateMsg, UncheckedDepositInfo, ExecuteMsg, Expiration, Timestamp, Uint64, CosmosMsgForEmpty, BankMsg, StakingMsg, DistributionMsg, Binary, IbcMsg, WasmMsg, GovMsg, VoteOption, Vote, Coin, Empty, IbcTimeout, IbcTimeoutBlock, MemberChangedHookMsg, MemberDiff, QueryMsg, MigrateMsg, Cw4Contract, Denom, Config, DepositInfo, Status, ThresholdResponse, ProposalListResponseForEmpty, ProposalResponseForEmpty, VoterListResponse, VoterDetail, VoteListResponse, VoteInfo, VoteResponse, VoterResponse } from "./Cw3FlexMultisig.types"; import { Executor, Addr, Duration, Uint128, UncheckedDenom, Threshold, Decimal, InstantiateMsg, UncheckedDepositInfo, ExecuteMsg, Expiration, Timestamp, Uint64, CosmosMsgForEmpty, BankMsg, WasmMsg, Binary, Vote, Coin, Empty, MemberChangedHookMsg, MemberDiff, QueryMsg, MigrateMsg, Cw4Contract, Denom, Config, DepositInfo, Status, ThresholdResponse, ProposalListResponseForEmpty, ProposalResponseForEmpty, VoterListResponse, VoterDetail, VoteListResponse, VoteInfo, VoteResponse, VoterResponse } from "./Cw3FlexMultisig.types";
export interface Cw3FlexMultisigReadOnlyInterface { export interface Cw3FlexMultisigReadOnlyInterface {
contractAddress: string; contractAddress: string;
threshold: () => Promise<ThresholdResponse>; threshold: () => Promise<ThresholdResponse>;
@@ -61,10 +60,9 @@ export interface Cw3FlexMultisigReadOnlyInterface {
config: () => Promise<Config>; config: () => Promise<Config>;
} }
export class Cw3FlexMultisigQueryClient implements Cw3FlexMultisigReadOnlyInterface { export class Cw3FlexMultisigQueryClient implements Cw3FlexMultisigReadOnlyInterface {
client: CosmWasmClient; client: ICosmWasmClient;
contractAddress: string; contractAddress: string;
constructor(client: ICosmWasmClient, contractAddress: string) {
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client; this.client = client;
this.contractAddress = contractAddress; this.contractAddress = contractAddress;
this.threshold = this.threshold.bind(this); this.threshold = this.threshold.bind(this);
@@ -77,7 +75,6 @@ export class Cw3FlexMultisigQueryClient implements Cw3FlexMultisigReadOnlyInterf
this.listVoters = this.listVoters.bind(this); this.listVoters = this.listVoters.bind(this);
this.config = this.config.bind(this); this.config = this.config.bind(this);
} }
threshold = async (): Promise<ThresholdResponse> => { threshold = async (): Promise<ThresholdResponse> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
threshold: {} threshold: {}
@@ -197,36 +194,35 @@ export interface Cw3FlexMultisigInterface extends Cw3FlexMultisigReadOnlyInterfa
latest?: Expiration; latest?: Expiration;
msgs: CosmosMsgForEmpty[]; msgs: CosmosMsgForEmpty[];
title: string; title: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
// vote: ({ vote: ({
// proposalId, proposalId,
// vote vote
// }: { }: {
// proposalId: number; proposalId: number;
// vote: Vote; vote: Vote;
// }, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
execute: ({ execute: ({
proposalId proposalId
}: { }: {
proposalId: number; proposalId: number;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
close: ({ close: ({
proposalId proposalId
}: { }: {
proposalId: number; proposalId: number;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
memberChangedHook: ({ memberChangedHook: ({
diffs diffs
}: { }: {
diffs: MemberDiff[]; diffs: MemberDiff[];
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
} }
export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements Cw3FlexMultisigInterface { export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements Cw3FlexMultisigInterface {
client: SigningCosmWasmClient; client: ISigningCosmWasmClient;
sender: string; sender: string;
contractAddress: string; contractAddress: string;
constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) {
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress); super(client, contractAddress);
this.client = client; this.client = client;
this.sender = sender; this.sender = sender;
@@ -237,7 +233,6 @@ export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements
this.close = this.close.bind(this); this.close = this.close.bind(this);
this.memberChangedHook = this.memberChangedHook.bind(this); this.memberChangedHook = this.memberChangedHook.bind(this);
} }
propose = async ({ propose = async ({
description, description,
latest, latest,
@@ -248,7 +243,7 @@ export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements
latest?: Expiration; latest?: Expiration;
msgs: CosmosMsgForEmpty[]; msgs: CosmosMsgForEmpty[];
title: string; title: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
propose: { propose: {
description, description,
@@ -256,53 +251,53 @@ export class Cw3FlexMultisigClient extends Cw3FlexMultisigQueryClient implements
msgs, msgs,
title title
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
};
vote = async ({
proposalId,
vote
}: {
proposalId: number;
vote: Vote;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
vote: {
proposal_id: proposalId,
vote
}
}, fee_, memo_, funds_);
}; };
// vote = async ({
// proposalId,
// vote
// }: {
// proposalId: number;
// vote: Vote;
// }, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
// return await this.client.execute(this.sender, this.contractAddress, {
// vote: {
// proposal_id: proposalId,
// vote
// }
// }, fee, memo, _funds);
// };
execute = async ({ execute = async ({
proposalId proposalId
}: { }: {
proposalId: number; proposalId: number;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
execute: { execute: {
proposal_id: proposalId proposal_id: proposalId
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
close = async ({ close = async ({
proposalId proposalId
}: { }: {
proposalId: number; proposalId: number;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
close: { close: {
proposal_id: proposalId proposal_id: proposalId
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
memberChangedHook = async ({ memberChangedHook = async ({
diffs diffs
}: { }: {
diffs: MemberDiff[]; diffs: MemberDiff[];
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
member_changed_hook: { member_changed_hook: {
diffs diffs
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
} }
@@ -1,5 +1,5 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
@@ -84,86 +84,17 @@ export type CosmosMsgForEmpty = {
bank: BankMsg; bank: BankMsg;
} | { } | {
custom: Empty; custom: Empty;
} | {
staking: StakingMsg;
} | {
distribution: DistributionMsg;
} | {
stargate: {
type_url: string;
value: Binary;
[k: string]: unknown;
};
} | {
ibc: IbcMsg;
} | { } | {
wasm: WasmMsg; wasm: WasmMsg;
} | {
gov: GovMsg;
}; };
export type BankMsg = { export type BankMsg = {
send: { send: {
amount: Coin[]; amount: Coin[];
to_address: string; to_address: string;
[k: string]: unknown;
}; };
} | { } | {
burn: { burn: {
amount: Coin[]; amount: Coin[];
[k: string]: unknown;
};
};
export type StakingMsg = {
delegate: {
amount: Coin;
validator: string;
[k: string]: unknown;
};
} | {
undelegate: {
amount: Coin;
validator: string;
[k: string]: unknown;
};
} | {
redelegate: {
amount: Coin;
dst_validator: string;
src_validator: string;
[k: string]: unknown;
};
};
export type DistributionMsg = {
set_withdraw_address: {
address: string;
[k: string]: unknown;
};
} | {
withdraw_delegator_reward: {
validator: string;
[k: string]: unknown;
};
};
export type Binary = string;
export type IbcMsg = {
transfer: {
amount: Coin;
channel_id: string;
timeout: IbcTimeout;
to_address: string;
[k: string]: unknown;
};
} | {
send_packet: {
channel_id: string;
data: Binary;
timeout: IbcTimeout;
[k: string]: unknown;
};
} | {
close_channel: {
channel_id: string;
[k: string]: unknown;
}; };
}; };
export type WasmMsg = { export type WasmMsg = {
@@ -171,7 +102,6 @@ export type WasmMsg = {
contract_addr: string; contract_addr: string;
funds: Coin[]; funds: Coin[];
msg: Binary; msg: Binary;
[k: string]: unknown;
}; };
} | { } | {
instantiate: { instantiate: {
@@ -180,54 +110,30 @@ export type WasmMsg = {
funds: Coin[]; funds: Coin[];
label: string; label: string;
msg: Binary; msg: Binary;
[k: string]: unknown;
}; };
} | { } | {
migrate: { migrate: {
contract_addr: string; contract_addr: string;
msg: Binary; msg: Binary;
new_code_id: number; new_code_id: number;
[k: string]: unknown;
}; };
} | { } | {
update_admin: { update_admin: {
admin: string; admin: string;
contract_addr: string; contract_addr: string;
[k: string]: unknown;
}; };
} | { } | {
clear_admin: { clear_admin: {
contract_addr: string; contract_addr: string;
[k: string]: unknown;
}; };
}; };
export type GovMsg = { export type Binary = string;
vote: {
proposal_id: number;
vote: VoteOption;
[k: string]: unknown;
};
};
export type VoteOption = "yes" | "no" | "abstain" | "no_with_veto";
export type Vote = "yes" | "no" | "abstain" | "veto"; export type Vote = "yes" | "no" | "abstain" | "veto";
export interface Coin { export interface Coin {
amount: Uint128; amount: Uint128;
denom: string; denom: string;
[k: string]: unknown;
}
export interface Empty {
[k: string]: unknown;
}
export interface IbcTimeout {
block?: IbcTimeoutBlock | null;
timestamp?: Timestamp | null;
[k: string]: unknown;
}
export interface IbcTimeoutBlock {
height: number;
revision: number;
[k: string]: unknown;
} }
export interface Empty {}
export interface MemberChangedHookMsg { export interface MemberChangedHookMsg {
diffs: MemberDiff[]; diffs: MemberDiff[];
} }
@@ -1,13 +1,12 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient";
import { Coin, StdFee } from "@cosmjs/amino"; import { Coin, StdFee } from "@interchainjs/types";
import { InstantiateMsg, Member, ExecuteMsg, QueryMsg, MigrateMsg, AdminResponse, HooksResponse, MemberListResponse, MemberResponse, TotalWeightResponse } from "./Cw4Group.types"; import { InstantiateMsg, Member, ExecuteMsg, QueryMsg, MigrateMsg, AdminResponse, HooksResponse, MemberListResponse, MemberResponse, TotalWeightResponse } from "./Cw4Group.types";
export interface Cw4GroupReadOnlyInterface { export interface Cw4GroupReadOnlyInterface {
contractAddress: string; contractAddress: string;
admin: () => Promise<AdminResponse>; admin: () => Promise<AdminResponse>;
@@ -33,10 +32,9 @@ export interface Cw4GroupReadOnlyInterface {
hooks: () => Promise<HooksResponse>; hooks: () => Promise<HooksResponse>;
} }
export class Cw4GroupQueryClient implements Cw4GroupReadOnlyInterface { export class Cw4GroupQueryClient implements Cw4GroupReadOnlyInterface {
client: CosmWasmClient; client: ICosmWasmClient;
contractAddress: string; contractAddress: string;
constructor(client: ICosmWasmClient, contractAddress: string) {
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client; this.client = client;
this.contractAddress = contractAddress; this.contractAddress = contractAddress;
this.admin = this.admin.bind(this); this.admin = this.admin.bind(this);
@@ -45,7 +43,6 @@ export class Cw4GroupQueryClient implements Cw4GroupReadOnlyInterface {
this.member = this.member.bind(this); this.member = this.member.bind(this);
this.hooks = this.hooks.bind(this); this.hooks = this.hooks.bind(this);
} }
admin = async (): Promise<AdminResponse> => { admin = async (): Promise<AdminResponse> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
admin: {} admin: {}
@@ -103,31 +100,30 @@ export interface Cw4GroupInterface extends Cw4GroupReadOnlyInterface {
admin admin
}: { }: {
admin?: string; admin?: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateMembers: ({ updateMembers: ({
add, add,
remove remove
}: { }: {
add: Member[]; add: Member[];
remove: string[]; remove: string[];
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
addHook: ({ addHook: ({
addr addr
}: { }: {
addr: string; addr: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
removeHook: ({ removeHook: ({
addr addr
}: { }: {
addr: string; addr: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
} }
export class Cw4GroupClient extends Cw4GroupQueryClient implements Cw4GroupInterface { export class Cw4GroupClient extends Cw4GroupQueryClient implements Cw4GroupInterface {
client: SigningCosmWasmClient; client: ISigningCosmWasmClient;
sender: string; sender: string;
contractAddress: string; contractAddress: string;
constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) {
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress); super(client, contractAddress);
this.client = client; this.client = client;
this.sender = sender; this.sender = sender;
@@ -137,17 +133,16 @@ export class Cw4GroupClient extends Cw4GroupQueryClient implements Cw4GroupInter
this.addHook = this.addHook.bind(this); this.addHook = this.addHook.bind(this);
this.removeHook = this.removeHook.bind(this); this.removeHook = this.removeHook.bind(this);
} }
updateAdmin = async ({ updateAdmin = async ({
admin admin
}: { }: {
admin?: string; admin?: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_admin: { update_admin: {
admin admin
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
updateMembers = async ({ updateMembers = async ({
add, add,
@@ -155,34 +150,34 @@ export class Cw4GroupClient extends Cw4GroupQueryClient implements Cw4GroupInter
}: { }: {
add: Member[]; add: Member[];
remove: string[]; remove: string[];
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_members: { update_members: {
add, add,
remove remove
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
addHook = async ({ addHook = async ({
addr addr
}: { }: {
addr: string; addr: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
add_hook: { add_hook: {
addr addr
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
removeHook = async ({ removeHook = async ({
addr addr
}: { }: {
addr: string; addr: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
remove_hook: { remove_hook: {
addr addr
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
} }
@@ -1,5 +1,5 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
@@ -0,0 +1,256 @@
/**
* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient";
import { StdFee } from "@interchainjs/types";
import { Uint128, InstantiateMsg, Coin, ExecuteMsg, QueryMsg, MigrateMsg, PagedBlacklistedAccountResponse, BlacklistedAccount, Blacklisting, BlacklistedAccountResponse, DepositResponse, Deposit, PagedDepositsResponse, DepositData, LatestDepositResponse } from "./Ecash.types";
export interface EcashReadOnlyInterface {
contractAddress: string;
getBlacklistedAccount: ({
publicKey
}: {
publicKey: string;
}) => Promise<BlacklistedAccountResponse>;
getBlacklistPaged: ({
limit,
startAfter
}: {
limit?: number;
startAfter?: string;
}) => Promise<PagedBlacklistedAccountResponse>;
getRequiredDepositAmount: () => Promise<Coin>;
getDeposit: ({
depositId
}: {
depositId: number;
}) => Promise<DepositResponse>;
getLatestDeposit: () => Promise<LatestDepositResponse>;
getDepositsPaged: ({
limit,
startAfter
}: {
limit?: number;
startAfter?: number;
}) => Promise<PagedDepositsResponse>;
}
export class EcashQueryClient implements EcashReadOnlyInterface {
client: ICosmWasmClient;
contractAddress: string;
constructor(client: ICosmWasmClient, contractAddress: string) {
this.client = client;
this.contractAddress = contractAddress;
this.getBlacklistedAccount = this.getBlacklistedAccount.bind(this);
this.getBlacklistPaged = this.getBlacklistPaged.bind(this);
this.getRequiredDepositAmount = this.getRequiredDepositAmount.bind(this);
this.getDeposit = this.getDeposit.bind(this);
this.getLatestDeposit = this.getLatestDeposit.bind(this);
this.getDepositsPaged = this.getDepositsPaged.bind(this);
}
getBlacklistedAccount = async ({
publicKey
}: {
publicKey: string;
}): Promise<BlacklistedAccountResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_blacklisted_account: {
public_key: publicKey
}
});
};
getBlacklistPaged = async ({
limit,
startAfter
}: {
limit?: number;
startAfter?: string;
}): Promise<PagedBlacklistedAccountResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_blacklist_paged: {
limit,
start_after: startAfter
}
});
};
getRequiredDepositAmount = async (): Promise<Coin> => {
return this.client.queryContractSmart(this.contractAddress, {
get_required_deposit_amount: {}
});
};
getDeposit = async ({
depositId
}: {
depositId: number;
}): Promise<DepositResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_deposit: {
deposit_id: depositId
}
});
};
getLatestDeposit = async (): Promise<LatestDepositResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_latest_deposit: {}
});
};
getDepositsPaged = async ({
limit,
startAfter
}: {
limit?: number;
startAfter?: number;
}): Promise<PagedDepositsResponse> => {
return this.client.queryContractSmart(this.contractAddress, {
get_deposits_paged: {
limit,
start_after: startAfter
}
});
};
}
export interface EcashInterface extends EcashReadOnlyInterface {
contractAddress: string;
sender: string;
depositTicketBookFunds: ({
identityKey
}: {
identityKey: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
requestRedemption: ({
commitmentBs58,
numberOfTickets
}: {
commitmentBs58: string;
numberOfTickets: number;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
redeemTickets: ({
gw,
n
}: {
gw: string;
n: number;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateAdmin: ({
admin
}: {
admin: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateDepositValue: ({
newDeposit
}: {
newDeposit: Coin;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
proposeToBlacklist: ({
publicKey
}: {
publicKey: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
addToBlacklist: ({
publicKey
}: {
publicKey: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
}
export class EcashClient extends EcashQueryClient implements EcashInterface {
client: ISigningCosmWasmClient;
sender: string;
contractAddress: string;
constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress);
this.client = client;
this.sender = sender;
this.contractAddress = contractAddress;
this.depositTicketBookFunds = this.depositTicketBookFunds.bind(this);
this.requestRedemption = this.requestRedemption.bind(this);
this.redeemTickets = this.redeemTickets.bind(this);
this.updateAdmin = this.updateAdmin.bind(this);
this.updateDepositValue = this.updateDepositValue.bind(this);
this.proposeToBlacklist = this.proposeToBlacklist.bind(this);
this.addToBlacklist = this.addToBlacklist.bind(this);
}
depositTicketBookFunds = async ({
identityKey
}: {
identityKey: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
deposit_ticket_book_funds: {
identity_key: identityKey
}
}, fee_, memo_, funds_);
};
requestRedemption = async ({
commitmentBs58,
numberOfTickets
}: {
commitmentBs58: string;
numberOfTickets: number;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
request_redemption: {
commitment_bs58: commitmentBs58,
number_of_tickets: numberOfTickets
}
}, fee_, memo_, funds_);
};
redeemTickets = async ({
gw,
n
}: {
gw: string;
n: number;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
redeem_tickets: {
gw,
n
}
}, fee_, memo_, funds_);
};
updateAdmin = async ({
admin
}: {
admin: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_admin: {
admin
}
}, fee_, memo_, funds_);
};
updateDepositValue = async ({
newDeposit
}: {
newDeposit: Coin;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
update_deposit_value: {
new_deposit: newDeposit
}
}, fee_, memo_, funds_);
};
proposeToBlacklist = async ({
publicKey
}: {
publicKey: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
propose_to_blacklist: {
public_key: publicKey
}
}, fee_, memo_, funds_);
};
addToBlacklist = async ({
publicKey
}: {
publicKey: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
add_to_blacklist: {
public_key: publicKey
}
}, fee_, memo_, funds_);
};
}
@@ -0,0 +1,106 @@
/**
* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
export type Uint128 = string;
export interface InstantiateMsg {
deposit_amount: Coin;
group_addr: string;
holding_account: string;
multisig_addr: string;
}
export interface Coin {
amount: Uint128;
denom: string;
}
export type ExecuteMsg = {
deposit_ticket_book_funds: {
identity_key: string;
};
} | {
request_redemption: {
commitment_bs58: string;
number_of_tickets: number;
};
} | {
redeem_tickets: {
gw: string;
n: number;
};
} | {
update_admin: {
admin: string;
};
} | {
update_deposit_value: {
new_deposit: Coin;
};
} | {
propose_to_blacklist: {
public_key: string;
};
} | {
add_to_blacklist: {
public_key: string;
};
};
export type QueryMsg = {
get_blacklisted_account: {
public_key: string;
};
} | {
get_blacklist_paged: {
limit?: number | null;
start_after?: string | null;
};
} | {
get_required_deposit_amount: {};
} | {
get_deposit: {
deposit_id: number;
};
} | {
get_latest_deposit: {};
} | {
get_deposits_paged: {
limit?: number | null;
start_after?: number | null;
};
};
export interface MigrateMsg {}
export interface PagedBlacklistedAccountResponse {
accounts: BlacklistedAccount[];
per_page: number;
start_next_after?: string | null;
}
export interface BlacklistedAccount {
info: Blacklisting;
public_key: string;
}
export interface Blacklisting {
finalized_at_height?: number | null;
proposal_id: number;
}
export interface BlacklistedAccountResponse {
account?: Blacklisting | null;
}
export interface DepositResponse {
deposit?: Deposit | null;
id: number;
}
export interface Deposit {
bs58_encoded_ed25519_pubkey: string;
}
export interface PagedDepositsResponse {
deposits: DepositData[];
start_next_after?: number | null;
}
export interface DepositData {
deposit: Deposit;
id: number;
}
export interface LatestDepositResponse {
deposit?: DepositData | null;
}
File diff suppressed because it is too large Load Diff
@@ -1,80 +1,66 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
export type Decimal = string; export type Decimal = string;
export type Percent = Decimal; export type Percent = Decimal;
export type Uint128 = string;
/**
* This instantiates the contract.
*/
export interface InstantiateMsg { export interface InstantiateMsg {
current_nym_node_version: string;
epoch_duration: Duration; epoch_duration: Duration;
epochs_in_interval: number; epochs_in_interval: number;
initial_rewarding_params: InitialRewardingParams; initial_rewarding_params: InitialRewardingParams;
interval_operating_cost?: RangedValueForUint128;
key_validity_in_epochs?: number | null;
profit_margin?: RangedValueForPercent;
rewarding_denom: string; rewarding_denom: string;
rewarding_validator_address: string; rewarding_validator_address: string;
version_score_params?: VersionScoreFormulaParams;
version_score_weights?: OutdatedVersionWeights;
vesting_contract_address: string; vesting_contract_address: string;
} }
export interface Duration { export interface Duration {
nanos: number; nanos: number;
secs: number; secs: number;
[k: string]: unknown;
} }
export interface InitialRewardingParams { export interface InitialRewardingParams {
active_set_size: number;
active_set_work_factor: Decimal; active_set_work_factor: Decimal;
initial_reward_pool: Decimal; initial_reward_pool: Decimal;
initial_staking_supply: Decimal; initial_staking_supply: Decimal;
interval_pool_emission: Percent; interval_pool_emission: Percent;
rewarded_set_size: number; rewarded_set_params: RewardedSetParams;
staking_supply_scale_factor: Percent; staking_supply_scale_factor: Percent;
sybil_resistance: Percent; sybil_resistance: Percent;
} }
export interface RewardedSetParams {
entry_gateways: number;
exit_gateways: number;
mixnodes: number;
standby: number;
}
export interface RangedValueForUint128 {
maximum: Uint128;
minimum: Uint128;
}
export interface RangedValueForPercent {
maximum: Percent;
minimum: Percent;
}
export interface VersionScoreFormulaParams {
penalty: Decimal;
penalty_scaling: Decimal;
}
export interface OutdatedVersionWeights {
major: number;
minor: number;
patch: number;
prerelease: number;
}
export type ExecuteMsg = { export type ExecuteMsg = {
assign_node_layer: { update_admin: {
layer: Layer; admin: string;
mix_id: number;
};
} | {
create_family: {
label: string;
};
} | {
join_family: {
family_head: FamilyHead;
join_permit: MessageSignature;
};
} | {
leave_family: {
family_head: FamilyHead;
};
} | {
kick_family_member: {
member: string;
};
} | {
create_family_on_behalf: {
label: string;
owner_address: string;
};
} | {
join_family_on_behalf: {
family_head: FamilyHead;
join_permit: MessageSignature;
member_address: string;
};
} | {
leave_family_on_behalf: {
family_head: FamilyHead;
member_address: string;
};
} | {
kick_family_member_on_behalf: {
head_address: string;
member: string;
}; };
} | { } | {
update_rewarding_validator_address: { update_rewarding_validator_address: {
@@ -82,12 +68,16 @@ export type ExecuteMsg = {
}; };
} | { } | {
update_contract_state_params: { update_contract_state_params: {
updated_parameters: ContractStateParams; update: ContractStateParamsUpdate;
}; };
} | { } | {
update_active_set_size: { update_current_nym_node_semver: {
active_set_size: number; current_version: string;
};
} | {
update_active_set_distribution: {
force_immediately: boolean; force_immediately: boolean;
update: ActiveSetUpdate;
}; };
} | { } | {
update_rewarding_params: { update_rewarding_params: {
@@ -102,24 +92,23 @@ export type ExecuteMsg = {
}; };
} | { } | {
begin_epoch_transition: {}; begin_epoch_transition: {};
} | {
advance_current_epoch: {
expected_active_set_size: number;
new_rewarded_set: LayerAssignment[];
};
} | { } | {
reconcile_epoch_events: { reconcile_epoch_events: {
limit?: number | null; limit?: number | null;
}; };
} | {
assign_roles: {
assignment: RoleAssignment;
};
} | { } | {
bond_mixnode: { bond_mixnode: {
cost_params: MixNodeCostParams; cost_params: NodeCostParams;
mix_node: MixNode; mix_node: MixNode;
owner_signature: MessageSignature; owner_signature: MessageSignature;
}; };
} | { } | {
bond_mixnode_on_behalf: { bond_mixnode_on_behalf: {
cost_params: MixNodeCostParams; cost_params: NodeCostParams;
mix_node: MixNode; mix_node: MixNode;
owner: string; owner: string;
owner_signature: MessageSignature; owner_signature: MessageSignature;
@@ -146,12 +135,12 @@ export type ExecuteMsg = {
owner: string; owner: string;
}; };
} | { } | {
update_mixnode_cost_params: { update_cost_params: {
new_costs: MixNodeCostParams; new_costs: NodeCostParams;
}; };
} | { } | {
update_mixnode_cost_params_on_behalf: { update_mixnode_cost_params_on_behalf: {
new_costs: MixNodeCostParams; new_costs: NodeCostParams;
owner: string; owner: string;
}; };
} | { } | {
@@ -163,6 +152,8 @@ export type ExecuteMsg = {
new_config: MixNodeConfigUpdate; new_config: MixNodeConfigUpdate;
owner: string; owner: string;
}; };
} | {
migrate_mixnode: {};
} | { } | {
bond_gateway: { bond_gateway: {
gateway: Gateway; gateway: Gateway;
@@ -190,8 +181,24 @@ export type ExecuteMsg = {
owner: string; owner: string;
}; };
} | { } | {
delegate_to_mixnode: { migrate_gateway: {
mix_id: number; cost_params?: NodeCostParams | null;
};
} | {
bond_nym_node: {
cost_params: NodeCostParams;
node: NymNode;
owner_signature: MessageSignature;
};
} | {
unbond_nym_node: {};
} | {
update_node_config: {
update: NodeConfigUpdate;
};
} | {
delegate: {
node_id: number;
}; };
} | { } | {
delegate_to_mixnode_on_behalf: { delegate_to_mixnode_on_behalf: {
@@ -199,8 +206,8 @@ export type ExecuteMsg = {
mix_id: number; mix_id: number;
}; };
} | { } | {
undelegate_from_mixnode: { undelegate: {
mix_id: number; node_id: number;
}; };
} | { } | {
undelegate_from_mixnode_on_behalf: { undelegate_from_mixnode_on_behalf: {
@@ -208,9 +215,9 @@ export type ExecuteMsg = {
mix_id: number; mix_id: number;
}; };
} | { } | {
reward_mixnode: { reward_node: {
mix_id: number; node_id: number;
performance: Percent; params: NodeRewardingParameters;
}; };
} | { } | {
withdraw_operator_reward: {}; withdraw_operator_reward: {};
@@ -220,42 +227,62 @@ export type ExecuteMsg = {
}; };
} | { } | {
withdraw_delegator_reward: { withdraw_delegator_reward: {
mix_id: number; node_id: number;
}; };
} | { } | {
withdraw_delegator_reward_on_behalf: { withdraw_delegator_reward_on_behalf: {
mix_id: number; mix_id: number;
owner: string; owner: string;
}; };
} | {
migrate_vested_mix_node: {};
} | {
migrate_vested_delegation: {
mix_id: number;
};
}; };
export type Layer = "One" | "Two" | "Three"; export type Role = "eg" | "l1" | "l2" | "l3" | "xg" | "stb";
export type FamilyHead = string;
export type MessageSignature = number[]; export type MessageSignature = number[];
export type Uint128 = string; export interface ContractStateParamsUpdate {
export interface ContractStateParams { config_score_params?: ConfigScoreParamsUpdate | null;
minimum_gateway_pledge: Coin; delegations_params?: DelegationsParams | null;
minimum_mixnode_delegation?: Coin | null; operators_params?: OperatorsParamsUpdate | null;
minimum_mixnode_pledge: Coin; }
export interface ConfigScoreParamsUpdate {
version_score_formula_params?: VersionScoreFormulaParams | null;
version_weights?: OutdatedVersionWeights | null;
}
export interface DelegationsParams {
minimum_delegation?: Coin | null;
} }
export interface Coin { export interface Coin {
amount: Uint128; amount: Uint128;
denom: string; denom: string;
[k: string]: unknown; }
export interface OperatorsParamsUpdate {
interval_operating_cost?: RangedValueForUint128 | null;
minimum_pledge?: Coin | null;
profit_margin?: RangedValueForPercent | null;
}
export interface ActiveSetUpdate {
entry_gateways: number;
exit_gateways: number;
mixnodes: number;
} }
export interface IntervalRewardingParamsUpdate { export interface IntervalRewardingParamsUpdate {
active_set_work_factor?: Decimal | null; active_set_work_factor?: Decimal | null;
interval_pool_emission?: Percent | null; interval_pool_emission?: Percent | null;
reward_pool?: Decimal | null; reward_pool?: Decimal | null;
rewarded_set_size?: number | null; rewarded_set_params?: RewardedSetParams | null;
staking_supply?: Decimal | null; staking_supply?: Decimal | null;
staking_supply_scale_factor?: Percent | null; staking_supply_scale_factor?: Percent | null;
sybil_resistance_percent?: Percent | null; sybil_resistance_percent?: Percent | null;
} }
export interface LayerAssignment { export interface RoleAssignment {
layer: Layer; nodes: number[];
mix_id: number; role: Role;
} }
export interface MixNodeCostParams { export interface NodeCostParams {
interval_operating_cost: Coin; interval_operating_cost: Coin;
profit_margin_percent: Percent; profit_margin_percent: Percent;
} }
@@ -291,32 +318,22 @@ export interface GatewayConfigUpdate {
mix_port: number; mix_port: number;
version: string; version: string;
} }
export interface NymNode {
custom_http_port?: number | null;
host: string;
identity_key: string;
}
export interface NodeConfigUpdate {
custom_http_port?: number | null;
host?: string | null;
restore_default_http_port?: boolean;
}
export interface NodeRewardingParameters {
performance: Percent;
work_factor: Decimal;
}
export type QueryMsg = { export type QueryMsg = {
get_all_families_paged: { admin: {};
limit?: number | null;
start_after?: string | null;
};
} | {
get_all_members_paged: {
limit?: number | null;
start_after?: string | null;
};
} | {
get_family_by_head: {
head: string;
};
} | {
get_family_by_label: {
label: string;
};
} | {
get_family_members_by_head: {
head: string;
};
} | {
get_family_members_by_label: {
label: string;
};
} | { } | {
get_contract_version: {}; get_contract_version: {};
} | { } | {
@@ -327,17 +344,19 @@ export type QueryMsg = {
get_state_params: {}; get_state_params: {};
} | { } | {
get_state: {}; get_state: {};
} | {
get_current_nym_node_version: {};
} | {
get_nym_node_version_history: {
limit?: number | null;
start_after?: number | null;
};
} | { } | {
get_rewarding_params: {}; get_rewarding_params: {};
} | { } | {
get_epoch_status: {}; get_epoch_status: {};
} | { } | {
get_current_interval_details: {}; get_current_interval_details: {};
} | {
get_rewarded_set: {
limit?: number | null;
start_after?: number | null;
};
} | { } | {
get_mix_node_bonds: { get_mix_node_bonds: {
limit?: number | null; limit?: number | null;
@@ -389,8 +408,6 @@ export type QueryMsg = {
get_bonded_mixnode_details_by_identity: { get_bonded_mixnode_details_by_identity: {
mix_identity: string; mix_identity: string;
}; };
} | {
get_layer_distribution: {};
} | { } | {
get_gateways: { get_gateways: {
limit?: number | null; limit?: number | null;
@@ -405,9 +422,71 @@ export type QueryMsg = {
address: string; address: string;
}; };
} | { } | {
get_mixnode_delegations: { get_preassigned_gateway_ids: {
limit?: number | null; limit?: number | null;
mix_id: number; start_after?: string | null;
};
} | {
get_nym_node_bonds_paged: {
limit?: number | null;
start_after?: number | null;
};
} | {
get_nym_nodes_detailed_paged: {
limit?: number | null;
start_after?: number | null;
};
} | {
get_unbonded_nym_node: {
node_id: number;
};
} | {
get_unbonded_nym_nodes_paged: {
limit?: number | null;
start_after?: number | null;
};
} | {
get_unbonded_nym_nodes_by_owner_paged: {
limit?: number | null;
owner: string;
start_after?: number | null;
};
} | {
get_unbonded_nym_nodes_by_identity_key_paged: {
identity_key: string;
limit?: number | null;
start_after?: number | null;
};
} | {
get_owned_nym_node: {
address: string;
};
} | {
get_nym_node_details: {
node_id: number;
};
} | {
get_nym_node_details_by_identity_key: {
node_identity: string;
};
} | {
get_node_rewarding_details: {
node_id: number;
};
} | {
get_node_stake_saturation: {
node_id: number;
};
} | {
get_role_assignment: {
role: Role;
};
} | {
get_rewarded_set_metadata: {};
} | {
get_node_delegations: {
limit?: number | null;
node_id: number;
start_after?: string | null; start_after?: string | null;
}; };
} | { } | {
@@ -419,7 +498,7 @@ export type QueryMsg = {
} | { } | {
get_delegation_details: { get_delegation_details: {
delegator: string; delegator: string;
mix_id: number; node_id: number;
proxy?: string | null; proxy?: string | null;
}; };
} | { } | {
@@ -432,26 +511,27 @@ export type QueryMsg = {
address: string; address: string;
}; };
} | { } | {
get_pending_mix_node_operator_reward: { get_pending_node_operator_reward: {
mix_id: number; node_id: number;
}; };
} | { } | {
get_pending_delegator_reward: { get_pending_delegator_reward: {
address: string; address: string;
mix_id: number; node_id: number;
proxy?: string | null; proxy?: string | null;
}; };
} | { } | {
get_estimated_current_epoch_operator_reward: { get_estimated_current_epoch_operator_reward: {
estimated_performance: Percent; estimated_performance: Percent;
mix_id: number; estimated_work?: Decimal | null;
node_id: number;
}; };
} | { } | {
get_estimated_current_epoch_delegator_reward: { get_estimated_current_epoch_delegator_reward: {
address: string; address: string;
estimated_performance: Percent; estimated_performance: Percent;
mix_id: number; estimated_work?: Decimal | null;
proxy?: string | null; node_id: number;
}; };
} | { } | {
get_pending_epoch_events: { get_pending_epoch_events: {
@@ -477,10 +557,18 @@ export type QueryMsg = {
get_signing_nonce: { get_signing_nonce: {
address: string; address: string;
}; };
} | {
get_key_rotation_state: {};
} | {
get_key_rotation_id: {};
}; };
export interface MigrateMsg { export interface MigrateMsg {
unsafe_skip_state_updates?: boolean | null;
vesting_contract_address?: string | null; vesting_contract_address?: string | null;
} }
export interface AdminResponse {
admin?: string | null;
}
export type Addr = string; export type Addr = string;
export interface PagedAllDelegationsResponse { export interface PagedAllDelegationsResponse {
delegations: Delegation[]; delegations: Delegation[];
@@ -490,23 +578,10 @@ export interface Delegation {
amount: Coin; amount: Coin;
cumulative_reward_ratio: Decimal; cumulative_reward_ratio: Decimal;
height: number; height: number;
mix_id: number; node_id: number;
owner: Addr; owner: Addr;
proxy?: Addr | null; proxy?: Addr | null;
} }
export interface PagedFamiliesResponse {
families: Family[];
start_next_after?: string | null;
}
export interface Family {
head: FamilyHead;
label: string;
proxy?: string | null;
}
export interface PagedMembersResponse {
members: [string, FamilyHead][];
start_next_after?: string | null;
}
export interface MixnodeDetailsByIdentityResponse { export interface MixnodeDetailsByIdentityResponse {
identity_key: string; identity_key: string;
mixnode_details?: MixNodeDetails | null; mixnode_details?: MixNodeDetails | null;
@@ -514,12 +589,11 @@ export interface MixnodeDetailsByIdentityResponse {
export interface MixNodeDetails { export interface MixNodeDetails {
bond_information: MixNodeBond; bond_information: MixNodeBond;
pending_changes?: PendingMixNodeChanges; pending_changes?: PendingMixNodeChanges;
rewarding_details: MixNodeRewarding; rewarding_details: NodeRewarding;
} }
export interface MixNodeBond { export interface MixNodeBond {
bonding_height: number; bonding_height: number;
is_unbonding: boolean; is_unbonding: boolean;
layer: Layer;
mix_id: number; mix_id: number;
mix_node: MixNode; mix_node: MixNode;
original_pledge: Coin; original_pledge: Coin;
@@ -527,10 +601,11 @@ export interface MixNodeBond {
proxy?: Addr | null; proxy?: Addr | null;
} }
export interface PendingMixNodeChanges { export interface PendingMixNodeChanges {
cost_params_change?: number | null;
pledge_change?: number | null; pledge_change?: number | null;
} }
export interface MixNodeRewarding { export interface NodeRewarding {
cost_params: MixNodeCostParams; cost_params: NodeCostParams;
delegates: Decimal; delegates: Decimal;
last_rewarded_epoch: number; last_rewarded_epoch: number;
operator: Decimal; operator: Decimal;
@@ -545,9 +620,12 @@ export interface ContractVersion {
export interface ContractBuildInformation { export interface ContractBuildInformation {
build_timestamp: string; build_timestamp: string;
build_version: string; build_version: string;
cargo_debug?: string;
cargo_opt_level?: string;
commit_branch: string; commit_branch: string;
commit_sha: string; commit_sha: string;
commit_timestamp: string; commit_timestamp: string;
contract_name?: string;
rustc_version: string; rustc_version: string;
} }
export interface CurrentIntervalResponse { export interface CurrentIntervalResponse {
@@ -563,11 +641,29 @@ export interface Interval {
epochs_in_interval: number; epochs_in_interval: number;
id: number; id: number;
total_elapsed_epochs: number; total_elapsed_epochs: number;
[k: string]: unknown;
} }
export interface MixNodeDelegationResponse { export interface CurrentNymNodeVersionResponse {
version?: HistoricalNymNodeVersionEntry | null;
}
export interface HistoricalNymNodeVersionEntry {
id: number;
version_information: HistoricalNymNodeVersion;
}
export interface HistoricalNymNodeVersion {
difference_since_genesis: TotalVersionDifference;
introduced_at_height: number;
semver: string;
}
export interface TotalVersionDifference {
major: number;
minor: number;
patch: number;
prerelease: number;
}
export interface NodeDelegationResponse {
delegation?: Delegation | null; delegation?: Delegation | null;
mixnode_still_bonded: boolean; mixnode_still_bonded: boolean;
node_still_bonded: boolean;
} }
export interface PagedDelegatorDelegationsResponse { export interface PagedDelegatorDelegationsResponse {
delegations: Delegation[]; delegations: Delegation[];
@@ -578,7 +674,11 @@ export type EpochState = "in_progress" | {
final_node_id: number; final_node_id: number;
last_rewarded: number; last_rewarded: number;
}; };
} | "reconciling_events" | "advancing_epoch"; } | "reconciling_events" | {
role_assignment: {
next: Role;
};
};
export interface EpochStatus { export interface EpochStatus {
being_advanced_by: Addr; being_advanced_by: Addr;
state: EpochState; state: EpochState;
@@ -590,22 +690,6 @@ export interface EstimatedCurrentEpochRewardResponse {
estimation?: Coin | null; estimation?: Coin | null;
original_stake?: Coin | null; original_stake?: Coin | null;
} }
export interface FamilyByHeadResponse {
family?: Family | null;
head: FamilyHead;
}
export interface FamilyByLabelResponse {
family?: Family | null;
label: string;
}
export interface FamilyMembersByHeadResponse {
head: FamilyHead;
members: string[];
}
export interface FamilyMembersByLabelResponse {
label: string;
members: string[];
}
export interface GatewayBondResponse { export interface GatewayBondResponse {
gateway?: GatewayBond | null; gateway?: GatewayBond | null;
identity: string; identity: string;
@@ -622,10 +706,12 @@ export interface PagedGatewayResponse {
per_page: number; per_page: number;
start_next_after?: string | null; start_next_after?: string | null;
} }
export interface LayerDistribution { export interface KeyRotationIdResponse {
layer1: number; rotation_id: number;
layer2: number; }
layer3: number; export interface KeyRotationState {
initial_epoch_id: number;
validity_epochs: number;
} }
export interface PagedMixnodeBondsResponse { export interface PagedMixnodeBondsResponse {
nodes: MixNodeBond[]; nodes: MixNodeBond[];
@@ -637,22 +723,68 @@ export interface PagedMixnodesDetailsResponse {
per_page: number; per_page: number;
start_next_after?: number | null; start_next_after?: number | null;
} }
export interface PagedMixNodeDelegationsResponse {
delegations: Delegation[];
start_next_after?: string | null;
}
export interface MixnodeDetailsResponse { export interface MixnodeDetailsResponse {
mix_id: number; mix_id: number;
mixnode_details?: MixNodeDetails | null; mixnode_details?: MixNodeDetails | null;
} }
export interface MixnodeRewardingDetailsResponse { export interface MixnodeRewardingDetailsResponse {
mix_id: number; mix_id: number;
rewarding_details?: MixNodeRewarding | null; rewarding_details?: NodeRewarding | null;
}
export interface PagedNodeDelegationsResponse {
delegations: Delegation[];
start_next_after?: string | null;
}
export interface NodeRewardingDetailsResponse {
node_id: number;
rewarding_details?: NodeRewarding | null;
}
export interface StakeSaturationResponse {
current_saturation?: Decimal | null;
node_id: number;
uncapped_saturation?: Decimal | null;
} }
export interface NumberOfPendingEventsResponse { export interface NumberOfPendingEventsResponse {
epoch_events: number; epoch_events: number;
interval_events: number; interval_events: number;
} }
export interface PagedNymNodeBondsResponse {
nodes: NymNodeBond[];
start_next_after?: number | null;
}
export interface NymNodeBond {
bonding_height: number;
is_unbonding: boolean;
node: NymNode;
node_id: number;
original_pledge: Coin;
owner: Addr;
}
export interface NodeDetailsResponse {
details?: NymNodeDetails | null;
node_id: number;
}
export interface NymNodeDetails {
bond_information: NymNodeBond;
pending_changes: PendingNodeChanges;
rewarding_details: NodeRewarding;
}
export interface PendingNodeChanges {
cost_params_change?: number | null;
pledge_change?: number | null;
}
export interface NodeDetailsByIdentityResponse {
details?: NymNodeDetails | null;
identity_key: string;
}
export interface NymNodeVersionHistoryResponse {
history: HistoricalNymNodeVersionEntry[];
start_next_after?: number | null;
}
export interface PagedNymNodeDetailsResponse {
nodes: NymNodeDetails[];
start_next_after?: number | null;
}
export interface GatewayOwnershipResponse { export interface GatewayOwnershipResponse {
address: Addr; address: Addr;
gateway?: GatewayBond | null; gateway?: GatewayBond | null;
@@ -661,32 +793,47 @@ export interface MixOwnershipResponse {
address: Addr; address: Addr;
mixnode_details?: MixNodeDetails | null; mixnode_details?: MixNodeDetails | null;
} }
export interface NodeOwnershipResponse {
address: Addr;
details?: NymNodeDetails | null;
}
export interface PendingRewardResponse { export interface PendingRewardResponse {
amount_earned?: Coin | null; amount_earned?: Coin | null;
amount_earned_detailed?: Decimal | null; amount_earned_detailed?: Decimal | null;
amount_staked?: Coin | null; amount_staked?: Coin | null;
mixnode_still_fully_bonded: boolean; mixnode_still_fully_bonded: boolean;
node_still_fully_bonded: boolean;
} }
export type PendingEpochEventKind = { export type PendingEpochEventKind = {
delegate: { delegate: {
amount: Coin; amount: Coin;
mix_id: number; node_id: number;
owner: Addr; owner: Addr;
proxy?: Addr | null; proxy?: Addr | null;
}; };
} | { } | {
undelegate: { undelegate: {
mix_id: number; node_id: number;
owner: Addr; owner: Addr;
proxy?: Addr | null; proxy?: Addr | null;
}; };
} | { } | {
pledge_more: { nym_node_pledge_more: {
amount: Coin;
node_id: number;
};
} | {
mixnode_pledge_more: {
amount: Coin; amount: Coin;
mix_id: number; mix_id: number;
}; };
} | { } | {
decrease_pledge: { nym_node_decrease_pledge: {
decrease_by: Coin;
node_id: number;
};
} | {
mixnode_decrease_pledge: {
decrease_by: Coin; decrease_by: Coin;
mix_id: number; mix_id: number;
}; };
@@ -695,8 +842,12 @@ export type PendingEpochEventKind = {
mix_id: number; mix_id: number;
}; };
} | { } | {
update_active_set_size: { unbond_nym_node: {
new_size: number; node_id: number;
};
} | {
update_active_set: {
update: ActiveSetUpdate;
}; };
}; };
export interface PendingEpochEventResponse { export interface PendingEpochEventResponse {
@@ -719,7 +870,12 @@ export interface PendingEpochEvent {
export type PendingIntervalEventKind = { export type PendingIntervalEventKind = {
change_mix_cost_params: { change_mix_cost_params: {
mix_id: number; mix_id: number;
new_costs: MixNodeCostParams; new_costs: NodeCostParams;
};
} | {
change_nym_node_cost_params: {
new_costs: NodeCostParams;
node_id: number;
}; };
} | { } | {
update_rewarding_params: { update_rewarding_params: {
@@ -748,15 +904,34 @@ export interface PendingIntervalEvent {
event: PendingIntervalEventData; event: PendingIntervalEventData;
id: number; id: number;
} }
export type RewardedSetNodeStatus = "active" | "standby"; export interface PreassignedGatewayIdsResponse {
export interface PagedRewardedSetResponse { ids: PreassignedId[];
nodes: [number, RewardedSetNodeStatus][]; start_next_after?: string | null;
start_next_after?: number | null; }
export interface PreassignedId {
identity: string;
node_id: number;
}
export interface RolesMetadataResponse {
metadata: RewardedSetMetadata;
}
export interface RewardedSetMetadata {
entry_gateway_metadata: RoleMetadata;
epoch_id: number;
exit_gateway_metadata: RoleMetadata;
fully_assigned: boolean;
layer1_metadata: RoleMetadata;
layer2_metadata: RoleMetadata;
layer3_metadata: RoleMetadata;
standby_metadata: RoleMetadata;
}
export interface RoleMetadata {
highest_id: number;
num_nodes: number;
} }
export interface RewardingParams { export interface RewardingParams {
active_set_size: number;
interval: IntervalRewardParams; interval: IntervalRewardParams;
rewarded_set_size: number; rewarded_set: RewardedSetParams;
} }
export interface IntervalRewardParams { export interface IntervalRewardParams {
active_set_work_factor: Decimal; active_set_work_factor: Decimal;
@@ -769,19 +944,37 @@ export interface IntervalRewardParams {
sybil_resistance: Percent; sybil_resistance: Percent;
} }
export type String = string; export type String = string;
export interface EpochAssignmentResponse {
epoch_id: number;
nodes: number[];
}
export type Uint32 = number; export type Uint32 = number;
export interface StakeSaturationResponse { export interface MixStakeSaturationResponse {
current_saturation?: Decimal | null; current_saturation?: Decimal | null;
mix_id: number; mix_id: number;
uncapped_saturation?: Decimal | null; uncapped_saturation?: Decimal | null;
} }
export interface ContractState { export interface ContractState {
owner: Addr; owner?: Addr | null;
params: ContractStateParams; params: ContractStateParams;
rewarding_denom: string; rewarding_denom: string;
rewarding_validator_address: Addr; rewarding_validator_address: Addr;
vesting_contract_address: Addr; vesting_contract_address: Addr;
} }
export interface ContractStateParams {
config_score_params: ConfigScoreParams;
delegations_params: DelegationsParams;
operators_params: OperatorsParams;
}
export interface ConfigScoreParams {
version_score_formula_params: VersionScoreFormulaParams;
version_weights: OutdatedVersionWeights;
}
export interface OperatorsParams {
interval_operating_cost: RangedValueForUint128;
minimum_pledge: Coin;
profit_margin: RangedValueForPercent;
}
export interface UnbondedMixnodeResponse { export interface UnbondedMixnodeResponse {
mix_id: number; mix_id: number;
unbonded_info?: UnbondedMixnode | null; unbonded_info?: UnbondedMixnode | null;
@@ -797,3 +990,17 @@ export interface PagedUnbondedMixnodesResponse {
per_page: number; per_page: number;
start_next_after?: number | null; start_next_after?: number | null;
} }
export interface UnbondedNodeResponse {
details?: UnbondedNymNode | null;
node_id: number;
}
export interface UnbondedNymNode {
identity_key: string;
node_id: number;
owner: Addr;
unbonding_height: number;
}
export interface PagedUnbondedNymNodesResponse {
nodes: UnbondedNymNode[];
start_next_after?: number | null;
}
@@ -1,13 +1,12 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; import { ICosmWasmClient, ISigningCosmWasmClient } from "./baseClient";
import { StdFee } from "@cosmjs/amino"; import { StdFee } from "@interchainjs/types";
import { InstantiateMsg, ExecuteMsg, FamilyHead, MessageSignature, Uint128, Percent, Decimal, PledgeCap, Coin, MixNodeCostParams, MixNodeConfigUpdate, VestingSpecification, MixNode, Gateway, GatewayConfigUpdate, QueryMsg, Timestamp, Uint64, MigrateMsg, Addr, Account, VestingPeriod, AccountsResponse, BaseVestingAccountInfo, VestingCoinsResponse, AccountVestingCoins, AllDelegationsResponse, VestingDelegation, ContractVersion, ContractBuildInformation, Period, DelegationTimesResponse, NullablePledgeData, PledgeData, OriginalVestingResponse } from "./Vesting.types"; import { InstantiateMsg, ExecuteMsg, Uint128, Percent, Decimal, PledgeCap, MessageSignature, Coin, NodeCostParams, MixNodeConfigUpdate, VestingSpecification, MixNode, Gateway, GatewayConfigUpdate, QueryMsg, Timestamp, Uint64, MigrateMsg, Addr, Account, VestingPeriod, AccountsResponse, BaseVestingAccountInfo, VestingCoinsResponse, AccountVestingCoins, AllDelegationsResponse, VestingDelegation, ContractVersion, ContractBuildInformation, Period, DelegationTimesResponse, NullablePledgeData, PledgeData, OriginalVestingResponse } from "./Vesting.types";
import { GetCw2ContractVersionResponse } from './types';
export interface VestingReadOnlyInterface { export interface VestingReadOnlyInterface {
contractAddress: string; contractAddress: string;
getContractVersion: () => Promise<ContractBuildInformation>; getContractVersion: () => Promise<ContractBuildInformation>;
@@ -156,10 +155,9 @@ export interface VestingReadOnlyInterface {
}) => Promise<AllDelegationsResponse>; }) => Promise<AllDelegationsResponse>;
} }
export class VestingQueryClient implements VestingReadOnlyInterface { export class VestingQueryClient implements VestingReadOnlyInterface {
client: CosmWasmClient; client: ICosmWasmClient;
contractAddress: string; contractAddress: string;
constructor(client: ICosmWasmClient, contractAddress: string) {
constructor(client: CosmWasmClient, contractAddress: string) {
this.client = client; this.client = client;
this.contractAddress = contractAddress; this.contractAddress = contractAddress;
this.getContractVersion = this.getContractVersion.bind(this); this.getContractVersion = this.getContractVersion.bind(this);
@@ -189,7 +187,6 @@ export class VestingQueryClient implements VestingReadOnlyInterface {
this.getDelegationTimes = this.getDelegationTimes.bind(this); this.getDelegationTimes = this.getDelegationTimes.bind(this);
this.getAllDelegations = this.getAllDelegations.bind(this); this.getAllDelegations = this.getAllDelegations.bind(this);
} }
getContractVersion = async (): Promise<ContractBuildInformation> => { getContractVersion = async (): Promise<ContractBuildInformation> => {
return this.client.queryContractSmart(this.contractAddress, { return this.client.queryContractSmart(this.contractAddress, {
get_contract_version: {} get_contract_version: {}
@@ -501,56 +498,34 @@ export class VestingQueryClient implements VestingReadOnlyInterface {
export interface VestingInterface extends VestingReadOnlyInterface { export interface VestingInterface extends VestingReadOnlyInterface {
contractAddress: string; contractAddress: string;
sender: string; sender: string;
createFamily: ({
label
}: {
label: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
joinFamily: ({
familyHead,
joinPermit
}: {
familyHead: FamilyHead;
joinPermit: MessageSignature;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
leaveFamily: ({
familyHead
}: {
familyHead: FamilyHead;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
kickFamilyMember: ({
member
}: {
member: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>;
trackReward: ({ trackReward: ({
address, address,
amount amount
}: { }: {
address: string; address: string;
amount: Coin; amount: Coin;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
claimOperatorReward: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; claimOperatorReward: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
claimDelegatorReward: ({ claimDelegatorReward: ({
mixId mixId
}: { }: {
mixId: number; mixId: number;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateMixnodeCostParams: ({ updateMixnodeCostParams: ({
newCosts newCosts
}: { }: {
newCosts: MixNodeCostParams; newCosts: NodeCostParams;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateMixnodeConfig: ({ updateMixnodeConfig: ({
newConfig newConfig
}: { }: {
newConfig: MixNodeConfigUpdate; newConfig: MixNodeConfigUpdate;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateMixnetAddress: ({ updateMixnetAddress: ({
address address
}: { }: {
address: string; address: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
delegateToMixnode: ({ delegateToMixnode: ({
amount, amount,
mixId, mixId,
@@ -559,14 +534,14 @@ export interface VestingInterface extends VestingReadOnlyInterface {
amount: Coin; amount: Coin;
mixId: number; mixId: number;
onBehalfOf?: string; onBehalfOf?: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
undelegateFromMixnode: ({ undelegateFromMixnode: ({
mixId, mixId,
onBehalfOf onBehalfOf
}: { }: {
mixId: number; mixId: number;
onBehalfOf?: string; onBehalfOf?: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
createAccount: ({ createAccount: ({
cap, cap,
ownerAddress, ownerAddress,
@@ -577,12 +552,12 @@ export interface VestingInterface extends VestingReadOnlyInterface {
ownerAddress: string; ownerAddress: string;
stakingAddress?: string; stakingAddress?: string;
vestingSpec?: VestingSpecification; vestingSpec?: VestingSpecification;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
withdrawVestedCoins: ({ withdrawVestedCoins: ({
amount amount
}: { }: {
amount: Coin; amount: Coin;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
trackUndelegation: ({ trackUndelegation: ({
amount, amount,
mixId, mixId,
@@ -591,7 +566,7 @@ export interface VestingInterface extends VestingReadOnlyInterface {
amount: Coin; amount: Coin;
mixId: number; mixId: number;
owner: string; owner: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
bondMixnode: ({ bondMixnode: ({
amount, amount,
costParams, costParams,
@@ -599,35 +574,35 @@ export interface VestingInterface extends VestingReadOnlyInterface {
ownerSignature ownerSignature
}: { }: {
amount: Coin; amount: Coin;
costParams: MixNodeCostParams; costParams: NodeCostParams;
mixNode: MixNode; mixNode: MixNode;
ownerSignature: MessageSignature; ownerSignature: MessageSignature;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
pledgeMore: ({ pledgeMore: ({
amount amount
}: { }: {
amount: Coin; amount: Coin;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
decreasePledge: ({ decreasePledge: ({
amount amount
}: { }: {
amount: Coin; amount: Coin;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
unbondMixnode: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; unbondMixnode: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
trackUnbondMixnode: ({ trackUnbondMixnode: ({
amount, amount,
owner owner
}: { }: {
amount: Coin; amount: Coin;
owner: string; owner: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
trackDecreasePledge: ({ trackDecreasePledge: ({
amount, amount,
owner owner
}: { }: {
amount: Coin; amount: Coin;
owner: string; owner: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
bondGateway: ({ bondGateway: ({
amount, amount,
gateway, gateway,
@@ -636,52 +611,59 @@ export interface VestingInterface extends VestingReadOnlyInterface {
amount: Coin; amount: Coin;
gateway: Gateway; gateway: Gateway;
ownerSignature: MessageSignature; ownerSignature: MessageSignature;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
unbondGateway: (fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; unbondGateway: (fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
trackUnbondGateway: ({ trackUnbondGateway: ({
amount, amount,
owner owner
}: { }: {
amount: Coin; amount: Coin;
owner: string; owner: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateGatewayConfig: ({ updateGatewayConfig: ({
newConfig newConfig
}: { }: {
newConfig: GatewayConfigUpdate; newConfig: GatewayConfigUpdate;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
transferOwnership: ({ transferOwnership: ({
toAddress toAddress
}: { }: {
toAddress: string; toAddress: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateStakingAddress: ({ updateStakingAddress: ({
toAddress toAddress
}: { }: {
toAddress?: string; toAddress?: string;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
updateLockedPledgeCap: ({ updateLockedPledgeCap: ({
address, address,
cap cap
}: { }: {
address: string; address: string;
cap: PledgeCap; cap: PledgeCap;
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; }, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
trackMigratedMixnode: ({
owner
}: {
owner: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
trackMigratedDelegation: ({
mixId,
owner
}: {
mixId: number;
owner: string;
}, fee_?: number | StdFee | "auto", memo_?: string, funds_?: Coin[]) => Promise<any>;
} }
export class VestingClient extends VestingQueryClient implements VestingInterface { export class VestingClient extends VestingQueryClient implements VestingInterface {
client: SigningCosmWasmClient; client: ISigningCosmWasmClient;
sender: string; sender: string;
contractAddress: string; contractAddress: string;
constructor(client: ISigningCosmWasmClient, sender: string, contractAddress: string) {
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) {
super(client, contractAddress); super(client, contractAddress);
this.client = client; this.client = client;
this.sender = sender; this.sender = sender;
this.contractAddress = contractAddress; this.contractAddress = contractAddress;
this.createFamily = this.createFamily.bind(this);
this.joinFamily = this.joinFamily.bind(this);
this.leaveFamily = this.leaveFamily.bind(this);
this.kickFamilyMember = this.kickFamilyMember.bind(this);
this.trackReward = this.trackReward.bind(this); this.trackReward = this.trackReward.bind(this);
this.claimOperatorReward = this.claimOperatorReward.bind(this); this.claimOperatorReward = this.claimOperatorReward.bind(this);
this.claimDelegatorReward = this.claimDelegatorReward.bind(this); this.claimDelegatorReward = this.claimDelegatorReward.bind(this);
@@ -706,117 +688,71 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
this.transferOwnership = this.transferOwnership.bind(this); this.transferOwnership = this.transferOwnership.bind(this);
this.updateStakingAddress = this.updateStakingAddress.bind(this); this.updateStakingAddress = this.updateStakingAddress.bind(this);
this.updateLockedPledgeCap = this.updateLockedPledgeCap.bind(this); this.updateLockedPledgeCap = this.updateLockedPledgeCap.bind(this);
this.trackMigratedMixnode = this.trackMigratedMixnode.bind(this);
this.trackMigratedDelegation = this.trackMigratedDelegation.bind(this);
} }
createFamily = async ({
label
}: {
label: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
create_family: {
label
}
}, fee, memo, _funds);
};
joinFamily = async ({
familyHead,
joinPermit
}: {
familyHead: FamilyHead;
joinPermit: MessageSignature;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
join_family: {
family_head: familyHead,
join_permit: joinPermit
}
}, fee, memo, _funds);
};
leaveFamily = async ({
familyHead
}: {
familyHead: FamilyHead;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
leave_family: {
family_head: familyHead
}
}, fee, memo, _funds);
};
kickFamilyMember = async ({
member
}: {
member: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => {
return await this.client.execute(this.sender, this.contractAddress, {
kick_family_member: {
member
}
}, fee, memo, _funds);
};
trackReward = async ({ trackReward = async ({
address, address,
amount amount
}: { }: {
address: string; address: string;
amount: Coin; amount: Coin;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
track_reward: { track_reward: {
address, address,
amount amount
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
claimOperatorReward = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { claimOperatorReward = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
claim_operator_reward: {} claim_operator_reward: {}
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
claimDelegatorReward = async ({ claimDelegatorReward = async ({
mixId mixId
}: { }: {
mixId: number; mixId: number;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
claim_delegator_reward: { claim_delegator_reward: {
mix_id: mixId mix_id: mixId
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
updateMixnodeCostParams = async ({ updateMixnodeCostParams = async ({
newCosts newCosts
}: { }: {
newCosts: MixNodeCostParams; newCosts: NodeCostParams;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_mixnode_cost_params: { update_mixnode_cost_params: {
new_costs: newCosts new_costs: newCosts
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
updateMixnodeConfig = async ({ updateMixnodeConfig = async ({
newConfig newConfig
}: { }: {
newConfig: MixNodeConfigUpdate; newConfig: MixNodeConfigUpdate;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_mixnode_config: { update_mixnode_config: {
new_config: newConfig new_config: newConfig
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
updateMixnetAddress = async ({ updateMixnetAddress = async ({
address address
}: { }: {
address: string; address: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_mixnet_address: { update_mixnet_address: {
address address
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
delegateToMixnode = async ({ delegateToMixnode = async ({
amount, amount,
@@ -826,14 +762,14 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
amount: Coin; amount: Coin;
mixId: number; mixId: number;
onBehalfOf?: string; onBehalfOf?: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
delegate_to_mixnode: { delegate_to_mixnode: {
amount, amount,
mix_id: mixId, mix_id: mixId,
on_behalf_of: onBehalfOf on_behalf_of: onBehalfOf
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
undelegateFromMixnode = async ({ undelegateFromMixnode = async ({
mixId, mixId,
@@ -841,13 +777,13 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
}: { }: {
mixId: number; mixId: number;
onBehalfOf?: string; onBehalfOf?: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
undelegate_from_mixnode: { undelegate_from_mixnode: {
mix_id: mixId, mix_id: mixId,
on_behalf_of: onBehalfOf on_behalf_of: onBehalfOf
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
createAccount = async ({ createAccount = async ({
cap, cap,
@@ -859,7 +795,7 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
ownerAddress: string; ownerAddress: string;
stakingAddress?: string; stakingAddress?: string;
vestingSpec?: VestingSpecification; vestingSpec?: VestingSpecification;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
create_account: { create_account: {
cap, cap,
@@ -867,18 +803,18 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
staking_address: stakingAddress, staking_address: stakingAddress,
vesting_spec: vestingSpec vesting_spec: vestingSpec
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
withdrawVestedCoins = async ({ withdrawVestedCoins = async ({
amount amount
}: { }: {
amount: Coin; amount: Coin;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
withdraw_vested_coins: { withdraw_vested_coins: {
amount amount
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
trackUndelegation = async ({ trackUndelegation = async ({
amount, amount,
@@ -888,14 +824,14 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
amount: Coin; amount: Coin;
mixId: number; mixId: number;
owner: string; owner: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
track_undelegation: { track_undelegation: {
amount, amount,
mix_id: mixId, mix_id: mixId,
owner owner
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
bondMixnode = async ({ bondMixnode = async ({
amount, amount,
@@ -904,10 +840,10 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
ownerSignature ownerSignature
}: { }: {
amount: Coin; amount: Coin;
costParams: MixNodeCostParams; costParams: NodeCostParams;
mixNode: MixNode; mixNode: MixNode;
ownerSignature: MessageSignature; ownerSignature: MessageSignature;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
bond_mixnode: { bond_mixnode: {
amount, amount,
@@ -915,34 +851,34 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
mix_node: mixNode, mix_node: mixNode,
owner_signature: ownerSignature owner_signature: ownerSignature
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
pledgeMore = async ({ pledgeMore = async ({
amount amount
}: { }: {
amount: Coin; amount: Coin;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
pledge_more: { pledge_more: {
amount amount
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
decreasePledge = async ({ decreasePledge = async ({
amount amount
}: { }: {
amount: Coin; amount: Coin;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
decrease_pledge: { decrease_pledge: {
amount amount
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
unbondMixnode = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { unbondMixnode = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
unbond_mixnode: {} unbond_mixnode: {}
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
trackUnbondMixnode = async ({ trackUnbondMixnode = async ({
amount, amount,
@@ -950,13 +886,13 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
}: { }: {
amount: Coin; amount: Coin;
owner: string; owner: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
track_unbond_mixnode: { track_unbond_mixnode: {
amount, amount,
owner owner
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
trackDecreasePledge = async ({ trackDecreasePledge = async ({
amount, amount,
@@ -964,13 +900,13 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
}: { }: {
amount: Coin; amount: Coin;
owner: string; owner: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
track_decrease_pledge: { track_decrease_pledge: {
amount, amount,
owner owner
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
bondGateway = async ({ bondGateway = async ({
amount, amount,
@@ -980,19 +916,19 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
amount: Coin; amount: Coin;
gateway: Gateway; gateway: Gateway;
ownerSignature: MessageSignature; ownerSignature: MessageSignature;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
bond_gateway: { bond_gateway: {
amount, amount,
gateway, gateway,
owner_signature: ownerSignature owner_signature: ownerSignature
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
unbondGateway = async (fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { unbondGateway = async (fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
unbond_gateway: {} unbond_gateway: {}
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
trackUnbondGateway = async ({ trackUnbondGateway = async ({
amount, amount,
@@ -1000,46 +936,46 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
}: { }: {
amount: Coin; amount: Coin;
owner: string; owner: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
track_unbond_gateway: { track_unbond_gateway: {
amount, amount,
owner owner
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
updateGatewayConfig = async ({ updateGatewayConfig = async ({
newConfig newConfig
}: { }: {
newConfig: GatewayConfigUpdate; newConfig: GatewayConfigUpdate;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_gateway_config: { update_gateway_config: {
new_config: newConfig new_config: newConfig
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
transferOwnership = async ({ transferOwnership = async ({
toAddress toAddress
}: { }: {
toAddress: string; toAddress: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
transfer_ownership: { transfer_ownership: {
to_address: toAddress to_address: toAddress
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
updateStakingAddress = async ({ updateStakingAddress = async ({
toAddress toAddress
}: { }: {
toAddress?: string; toAddress?: string;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_staking_address: { update_staking_address: {
to_address: toAddress to_address: toAddress
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
updateLockedPledgeCap = async ({ updateLockedPledgeCap = async ({
address, address,
@@ -1047,12 +983,37 @@ export class VestingClient extends VestingQueryClient implements VestingInterfac
}: { }: {
address: string; address: string;
cap: PledgeCap; cap: PledgeCap;
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { }, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, { return await this.client.execute(this.sender, this.contractAddress, {
update_locked_pledge_cap: { update_locked_pledge_cap: {
address, address,
cap cap
} }
}, fee, memo, _funds); }, fee_, memo_, funds_);
}; };
} trackMigratedMixnode = async ({
owner
}: {
owner: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
track_migrated_mixnode: {
owner
}
}, fee_, memo_, funds_);
};
trackMigratedDelegation = async ({
mixId,
owner
}: {
mixId: number;
owner: string;
}, fee_: number | StdFee | "auto" = "auto", memo_?: string, funds_?: Coin[]): Promise<any> => {
return await this.client.execute(this.sender, this.contractAddress, {
track_migrated_delegation: {
mix_id: mixId,
owner
}
}, fee_, memo_, funds_);
};
}
@@ -1,5 +1,5 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
@@ -9,23 +9,6 @@ export interface InstantiateMsg {
mixnet_contract_address: string; mixnet_contract_address: string;
} }
export type ExecuteMsg = { export type ExecuteMsg = {
create_family: {
label: string;
};
} | {
join_family: {
family_head: FamilyHead;
join_permit: MessageSignature;
};
} | {
leave_family: {
family_head: FamilyHead;
};
} | {
kick_family_member: {
member: string;
};
} | {
track_reward: { track_reward: {
address: string; address: string;
amount: Coin; amount: Coin;
@@ -38,7 +21,7 @@ export type ExecuteMsg = {
}; };
} | { } | {
update_mixnode_cost_params: { update_mixnode_cost_params: {
new_costs: MixNodeCostParams; new_costs: NodeCostParams;
}; };
} | { } | {
update_mixnode_config: { update_mixnode_config: {
@@ -79,7 +62,7 @@ export type ExecuteMsg = {
} | { } | {
bond_mixnode: { bond_mixnode: {
amount: Coin; amount: Coin;
cost_params: MixNodeCostParams; cost_params: NodeCostParams;
mix_node: MixNode; mix_node: MixNode;
owner_signature: MessageSignature; owner_signature: MessageSignature;
}; };
@@ -133,9 +116,16 @@ export type ExecuteMsg = {
address: string; address: string;
cap: PledgeCap; cap: PledgeCap;
}; };
} | {
track_migrated_mixnode: {
owner: string;
};
} | {
track_migrated_delegation: {
mix_id: number;
owner: string;
};
}; };
export type FamilyHead = string;
export type MessageSignature = number[];
export type Uint128 = string; export type Uint128 = string;
export type Percent = Decimal; export type Percent = Decimal;
export type Decimal = string; export type Decimal = string;
@@ -144,12 +134,12 @@ export type PledgeCap = {
} | { } | {
absolute: Uint128; absolute: Uint128;
}; };
export type MessageSignature = number[];
export interface Coin { export interface Coin {
amount: Uint128; amount: Uint128;
denom: string; denom: string;
[k: string]: unknown;
} }
export interface MixNodeCostParams { export interface NodeCostParams {
interval_operating_cost: Coin; interval_operating_cost: Coin;
profit_margin_percent: Percent; profit_margin_percent: Percent;
} }
@@ -353,9 +343,12 @@ export interface ContractVersion {
export interface ContractBuildInformation { export interface ContractBuildInformation {
build_timestamp: string; build_timestamp: string;
build_version: string; build_version: string;
cargo_debug?: string;
cargo_opt_level?: string;
commit_branch: string; commit_branch: string;
commit_sha: string; commit_sha: string;
commit_timestamp: string; commit_timestamp: string;
contract_name?: string;
rustc_version: string; rustc_version: string;
} }
export type Period = "before" | { export type Period = "before" | {
@@ -0,0 +1,200 @@
/**
* This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
import { StdFee, Coin } from '@interchainjs/types';
import { DirectSigner } from '@interchainjs/cosmos';
import { getSmartContractState } from 'interchainjs/cosmwasm/wasm/v1/query.rpc.func';
import { executeContract } from 'interchainjs/cosmwasm/wasm/v1/tx.rpc.func';
import { QuerySmartContractStateRequest, QuerySmartContractStateResponse } from 'interchainjs/cosmwasm/wasm/v1/query';
import { MsgExecuteContract } from 'interchainjs/cosmwasm/wasm/v1/tx';
import { Chain } from '@chain-registry/v2-types';
// Encoding utility functions
const fromUint8Array = <T>(uint8Array: Uint8Array): T => {
const text = new TextDecoder().decode(uint8Array);
return JSON.parse(text);
};
const toUint8Array = (obj: any): Uint8Array => {
const text = JSON.stringify(obj);
return new TextEncoder().encode(text);
};
// Chain registry configuration
// The amount under gasPrice represents gas price per unit
export interface ChainConfig {
chain?: Chain;
gasPrice?: {
denom: string;
amount: string;
};
}
// Gas fee calculation utilities
export const calculateGasFromChain = (chain: Chain, gasAmount: string): StdFee => {
try {
const feeTokens = chain.fees?.feeTokens;
if (feeTokens && feeTokens.length > 0) {
const primaryToken = feeTokens[0];
// v2 chain-registry uses camelCase: averageGasPrice, lowGasPrice, fixedMinGasPrice
const gasPrice = primaryToken.averageGasPrice || primaryToken.lowGasPrice || primaryToken.fixedMinGasPrice || 0.025;
const gasAmountNum = parseInt(gasAmount);
const feeAmount = Math.ceil(gasAmountNum * gasPrice).toString();
return {
amount: [{
denom: primaryToken.denom,
amount: feeAmount
}],
gas: gasAmount
};
}
} catch (error) {
console.warn('Failed to calculate gas from chain registry:', error);
}
// Fallback to default
return { amount: [], gas: gasAmount };
};
// Default gas amount - users can easily change this
export let DEFAULT_GAS_AMOUNT = '200000';
// Allow users to set their preferred default gas amount
export const setDefaultGasAmount = (gasAmount: string): void => {
DEFAULT_GAS_AMOUNT = gasAmount;
};
// Get current default gas amount
export const getDefaultGasAmount = (): string => DEFAULT_GAS_AMOUNT;
export const getAutoGasFee = (chainConfig?: ChainConfig): StdFee => {
const gasAmount = DEFAULT_GAS_AMOUNT;
if (chainConfig?.chain) {
return calculateGasFromChain(chainConfig.chain, gasAmount);
}
if (chainConfig?.gasPrice) {
const gasAmountNum = parseInt(gasAmount);
const gasPriceNum = parseFloat(chainConfig.gasPrice.amount);
const feeAmount = Math.ceil(gasAmountNum * gasPriceNum).toString();
return {
amount: [{
denom: chainConfig.gasPrice.denom,
amount: feeAmount
}],
gas: gasAmount
};
}
// Fallback: no fee tokens, just gas amount
return { amount: [], gas: gasAmount };
};
// InterchainJS interfaces for CosmWasm clients
export interface ICosmWasmClient {
queryContractSmart(contractAddr: string, query: any): Promise<any>;
}
export interface ISigningCosmWasmClient extends ICosmWasmClient {
execute(
sender: string,
contractAddress: string,
msg: any,
fee?: number | StdFee | "auto",
memo?: string,
funds?: Coin[],
chainConfig?: ChainConfig
): Promise<any>;
}
export interface ISigningClient {
signAndBroadcast(
signerAddress: string,
messages: any[],
fee: number | StdFee | "auto",
memo?: string
): Promise<any>;
}
// Helper functions to create InterchainJS clients
export function getCosmWasmClient(rpcEndpoint: string): ICosmWasmClient {
return {
queryContractSmart: async (contractAddr: string, query: any) => {
// Create the request object
const request: QuerySmartContractStateRequest = {
address: contractAddr,
queryData: toUint8Array(query)
};
// Execute the query using InterchainJS
const response: QuerySmartContractStateResponse = await getSmartContractState(rpcEndpoint, request);
// Parse and return the result
return fromUint8Array(response.data);
},
};
}
export function getSigningCosmWasmClient(signingClient: DirectSigner, rpcEndpoint?: string): ISigningCosmWasmClient {
return {
queryContractSmart: async (contractAddr: string, query: any) => {
if (!rpcEndpoint) {
throw new Error('rpcEndpoint is required for queryContractSmart in signing client');
}
const request: QuerySmartContractStateRequest = {
address: contractAddr,
queryData: toUint8Array(query)
};
const response: QuerySmartContractStateResponse = await getSmartContractState(rpcEndpoint, request);
return fromUint8Array(response.data);
},
execute: async (
sender: string,
contractAddress: string,
msg: any,
fee?: number | StdFee | "auto",
memo?: string,
funds?: Coin[],
chainConfig?: ChainConfig
) => {
// Handle fee conversion
let finalFee: StdFee;
if (typeof fee === 'number') {
finalFee = { amount: [], gas: fee.toString() };
} else if (fee === 'auto') {
finalFee = getAutoGasFee(chainConfig);
} else if (fee) {
finalFee = fee;
} else {
finalFee = getAutoGasFee(chainConfig);
}
// Create the message object
const message: MsgExecuteContract = {
sender,
contract: contractAddress,
msg: toUint8Array(msg),
funds: funds || []
};
// Execute the transaction using InterchainJS
const result = await executeContract(
signingClient as any,
sender,
message,
finalFee,
memo || ''
);
return result;
},
};
}
@@ -1,35 +1,48 @@
/** /**
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. * This file was automatically generated by @cosmwasm/ts-codegen@1.13.3.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. * and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/ */
import * as _0 from './CoconutBandwidth.types'; import * as _0 from "./Ecash.types";
import * as _1 from './CoconutBandwidth.client'; import * as _1 from "./Ecash.client";
import * as _2 from './CoconutDkg.types'; import * as _2 from "./CoconutDkg.types";
import * as _3 from './CoconutDkg.client'; import * as _3 from "./CoconutDkg.client";
import * as _4 from './Mixnet.types'; import * as _4 from "./Mixnet.types";
import * as _5 from './Mixnet.client'; import * as _5 from "./Mixnet.client";
import * as _6 from './Cw3FlexMultisig.types'; import * as _6 from "./Cw3FlexMultisig.types";
import * as _7 from './Cw3FlexMultisig.client'; import * as _7 from "./Cw3FlexMultisig.client";
import * as _8 from './Cw4Group.types'; import * as _8 from "./Cw4Group.types";
import * as _9 from './Cw4Group.client'; import * as _9 from "./Cw4Group.client";
import * as _10 from './NameService.types'; import * as _10 from "./Vesting.types";
import * as _11 from './NameService.client'; import * as _11 from "./Vesting.client";
import * as _12 from './ServiceProviderDirectory.types'; import * as _12 from "./baseClient";
import * as _13 from './ServiceProviderDirectory.client';
import * as _14 from './Vesting.types';
import * as _15 from './Vesting.client';
export * from './types';
/** @namespace */
export namespace contracts { export namespace contracts {
export const CoconutBandwidth = { ..._0, ..._1 }; export const Ecash = {
export const CoconutDkg = { ..._2, ..._3 }; ..._0,
export const Mixnet = { ..._4, ..._5 }; ..._1
export const Cw3FlexMultisig = { ..._6, ..._7 }; };
export const Cw4Group = { ..._8, ..._9 }; export const CoconutDkg = {
export const NameService = { ..._10, ..._11 }; ..._2,
export const ServiceProviderDirectory = { ..._12, ..._13 }; ..._3
export const Vesting = { ..._14, ..._15 }; };
} export const Mixnet = {
..._4,
..._5
};
export const Cw3FlexMultisig = {
..._6,
..._7
};
export const Cw4Group = {
..._8,
..._9
};
export const Vesting = {
..._10,
..._11
};
export const baseClient = {
..._12
};
}
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-plain-html-parcel", "name": "@nymproject/sdk-example-plain-html-parcel",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "An example project that uses WASM and plain HTML bundled with Parcel v2", "description": "An example project that uses WASM and plain HTML bundled with Parcel v2",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
@@ -15,7 +15,7 @@
"tsc:watch": "tsc --watch" "tsc:watch": "tsc --watch"
}, },
"dependencies": { "dependencies": {
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1" "@nymproject/sdk": ">=1.4.1-rc1 || ^1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.1", "@types/jest": "^27.0.1",
@@ -41,4 +41,4 @@
"private": false, "private": false,
"browserslist": "> 0.5%, last 2 versions, not dead", "browserslist": "> 0.5%, last 2 versions, not dead",
"source": "src/index.html" "source": "src/index.html"
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-plain-html", "name": "@nymproject/sdk-example-plain-html",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "An example project that uses WASM and plain HTML", "description": "An example project that uses WASM and plain HTML",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
@@ -16,7 +16,7 @@
"tsc:watch": "tsc --watch" "tsc:watch": "tsc --watch"
}, },
"dependencies": { "dependencies": {
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1" "@nymproject/sdk": ">=1.4.1-rc1 || ^1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.15.0", "@babel/core": "^7.15.0",
@@ -62,4 +62,4 @@
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"private": false "private": false
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-react-webpack-wasm", "name": "@nymproject/sdk-example-react-webpack-wasm",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "An example project that uses WASM, React, Webpack, Typescript and the Nym theme + components library", "description": "An example project that uses WASM, React, Webpack, Typescript and the Nym theme + components library",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
@@ -20,7 +20,7 @@
"@mui/lab": "^5.0.0-alpha.72", "@mui/lab": "^5.0.0-alpha.72",
"@mui/material": "^5.0.1", "@mui/material": "^5.0.1",
"@mui/styles": "^5.0.1", "@mui/styles": "^5.0.1",
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1", "@nymproject/sdk": ">=1.4.1-rc1 || ^1",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0", "react-dom": "^18.2.0",
"react-dropzone": "^14.2.3", "react-dropzone": "^14.2.3",
@@ -90,4 +90,4 @@
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
} }
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-chrome-extension", "name": "@nymproject/sdk-example-chrome-extension",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "This is an example of how Nym can be used within the context of a Chrome extension.", "description": "This is an example of how Nym can be used within the context of a Chrome extension.",
"license": "ISC", "license": "ISC",
"author": "", "author": "",
@@ -9,7 +9,7 @@
"build": "webpack" "build": "webpack"
}, },
"dependencies": { "dependencies": {
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1" "@nymproject/sdk": ">=1.4.1-rc1 || ^1"
}, },
"devDependencies": { "devDependencies": {
"clean-webpack-plugin": "^4.0.0", "clean-webpack-plugin": "^4.0.0",
@@ -18,4 +18,4 @@
"webpack-cli": "^5.1.4" "webpack-cli": "^5.1.4"
}, },
"private": false "private": false
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-firefox-extension", "name": "@nymproject/sdk-example-firefox-extension",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "This is an example of how Nym can be used within the context of a Firefox extension.", "description": "This is an example of how Nym can be used within the context of a Firefox extension.",
"license": "ISC", "license": "ISC",
"author": "", "author": "",
@@ -9,7 +9,7 @@
"build": "yarn webpack" "build": "yarn webpack"
}, },
"dependencies": { "dependencies": {
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1" "@nymproject/sdk": ">=1.4.1-rc1 || ^1"
}, },
"devDependencies": { "devDependencies": {
"copy-webpack-plugin": "^11.0.0", "copy-webpack-plugin": "^11.0.0",
@@ -18,4 +18,4 @@
"worker-loader": "^3.0.8" "worker-loader": "^3.0.8"
}, },
"private": false "private": false
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/mix-fetch-example-parcel", "name": "@nymproject/mix-fetch-example-parcel",
"version": "1.0.4-rc.2", "version": "1.0.5",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
"build": "parcel build --no-cache --no-content-hash", "build": "parcel build --no-cache --no-content-hash",
@@ -8,9 +8,9 @@
"start": "parcel --no-cache" "start": "parcel --no-cache"
}, },
"dependencies": { "dependencies": {
"@nymproject/mix-fetch": ">=1.2.2-rc.0 || ^1", "@nymproject/mix-fetch": ">=1.4.1-rc1 || ^1",
"parcel": "^2.9.3" "parcel": "^2.9.3"
}, },
"private": false, "private": false,
"source": "src/index.html" "source": "src/index.html"
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-node-tester-plain-html-parcel", "name": "@nymproject/sdk-example-node-tester-plain-html-parcel",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "An example project that uses WASM and plain HTML bundled with Parcel v2", "description": "An example project that uses WASM and plain HTML bundled with Parcel v2",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
@@ -15,7 +15,7 @@
"tsc:watch": "tsc --watch" "tsc:watch": "tsc --watch"
}, },
"dependencies": { "dependencies": {
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1" "@nymproject/sdk": ">=1.4.1-rc1 || ^1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^27.0.1", "@types/jest": "^27.0.1",
@@ -41,4 +41,4 @@
"private": false, "private": false,
"browserslist": "> 0.5%, last 2 versions, not dead", "browserslist": "> 0.5%, last 2 versions, not dead",
"source": "src/index.html" "source": "src/index.html"
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-node-tester-plain-html", "name": "@nymproject/sdk-example-node-tester-plain-html",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "An example project that uses WASM node tester and plain HTML", "description": "An example project that uses WASM node tester and plain HTML",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
@@ -16,7 +16,7 @@
"tsc:watch": "tsc --watch" "tsc:watch": "tsc --watch"
}, },
"dependencies": { "dependencies": {
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1" "@nymproject/sdk": ">=1.4.1-rc1 || ^1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.15.0", "@babel/core": "^7.15.0",
@@ -62,4 +62,4 @@
"webpack-merge": "^5.8.0" "webpack-merge": "^5.8.0"
}, },
"private": false "private": false
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-example-node-tester-react", "name": "@nymproject/sdk-example-node-tester-react",
"version": "1.0.4-rc.2", "version": "1.0.5",
"description": "An example project that uses WASM node tester and React", "description": "An example project that uses WASM node tester and React",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
@@ -11,10 +11,10 @@
"@emotion/styled": "^11.11.0", "@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.0", "@mui/icons-material": "^5.14.0",
"@mui/material": "^5.14.0", "@mui/material": "^5.14.0",
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1", "@nymproject/sdk": ">=1.4.1-rc1 || ^1",
"parcel": "^2.9.3", "parcel": "^2.9.3",
"react": "^18.2.0", "react": "^18.2.0",
"react-dom": "^18.2.0" "react-dom": "^18.2.0"
}, },
"private": false "private": false
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/mix-fetch-node", "name": "@nymproject/mix-fetch-node",
"version": "1.4.0-rc.0", "version": "1.4.1",
"description": "This package is a drop-in replacement for `fetch` in NodeJS to send HTTP requests over the Nym Mixnet.", "description": "This package is a drop-in replacement for `fetch` in NodeJS to send HTTP requests over the Nym Mixnet.",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Nym Technologies SA", "author": "Nym Technologies SA",
@@ -28,7 +28,7 @@
"tsc": "tsc --noEmit true" "tsc": "tsc --noEmit true"
}, },
"dependencies": { "dependencies": {
"@nymproject/mix-fetch-wasm-node": ">=1.2.4-rc.2 || ^1", "@nymproject/mix-fetch-wasm-node": ">=1.4.1-rc.3 || ^1",
"comlink": "^4.3.1", "comlink": "^4.3.1",
"fake-indexeddb": "^5.0.0", "fake-indexeddb": "^5.0.0",
"node-fetch": "^3.3.2", "node-fetch": "^3.3.2",
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/mix-fetch-tester-webpack", "name": "@nymproject/mix-fetch-tester-webpack",
"version": "1.0.4-rc.2", "version": "1.0.5",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
"build": "webpack build --progress --config webpack.prod.js", "build": "webpack build --progress --config webpack.prod.js",
@@ -8,7 +8,7 @@
"start": "webpack serve --progress --port 3000" "start": "webpack serve --progress --port 3000"
}, },
"dependencies": { "dependencies": {
"@nymproject/mix-fetch": ">=1.2.2-rc.0 || ^1" "@nymproject/mix-fetch": ">=1.4.1-rc1 || ^1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.22.10", "@babel/core": "^7.22.10",
@@ -55,4 +55,4 @@
"webpack-merge": "^5.9.0" "webpack-merge": "^5.9.0"
}, },
"private": false "private": false
} }
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/mix-fetch-tester-parcel", "name": "@nymproject/mix-fetch-tester-parcel",
"version": "1.0.4-rc.2", "version": "1.0.5",
"license": "Apache-2.0", "license": "Apache-2.0",
"scripts": { "scripts": {
"build": "npx parcel build --no-cache --no-content-hash", "build": "npx parcel build --no-cache --no-content-hash",
@@ -8,8 +8,8 @@
"start": "npx parcel --no-cache" "start": "npx parcel --no-cache"
}, },
"dependencies": { "dependencies": {
"@nymproject/mix-fetch": ">=1.2.2-rc.0 || ^1" "@nymproject/mix-fetch": ">=1.4.1-rc1 || ^1"
}, },
"private": false, "private": false,
"source": "../src/index.html" "source": "../src/index.html"
} }
@@ -21,6 +21,7 @@ async function main() {
// const addr = // const addr =
// 'EVdJ66jqpoVzmktVecy5UJxsTCEWo5gMn5zDZR7Hm8jy.GXNpoX7RcYcxKvBkV3dSHqC78WaPuWieweRPWzYqNhh5@GAjhJcrd6f1edaqUkfWCff6zdHoqo756qYrc2TfPuCXJ'; // 'EVdJ66jqpoVzmktVecy5UJxsTCEWo5gMn5zDZR7Hm8jy.GXNpoX7RcYcxKvBkV3dSHqC78WaPuWieweRPWzYqNhh5@GAjhJcrd6f1edaqUkfWCff6zdHoqo756qYrc2TfPuCXJ';
// const addr = '7Y9eyF1p1JmzHnd7TVZufnQHkh93ASc9sRBCFY57ZGr8.F8KPyVMVqFQ5yJC3LqeP2ZC7fukzj9a1T426rjo432yT@q2A2cbooyC16YJzvdYaSMH9X3cSiieZNtfBr8cE8Fi1';
const addr = undefined; const addr = undefined;
appendOutput('About to set up mixFetch...'); appendOutput('About to set up mixFetch...');
@@ -54,12 +55,12 @@ async function main() {
appendOutput(JSON.stringify(resp, null, 2)); appendOutput(JSON.stringify(resp, null, 2));
appendOutput(JSON.stringify({ text }, null, 2)); appendOutput(JSON.stringify({ text }, null, 2));
console.log('disconnecting'); // console.log('disconnecting');
await disconnectMixFetch(); // await disconnectMixFetch();
console.log('disconnected! all further usages should fail'); // console.log('disconnected! all further usages should fail');
// get an image // get an image
url = 'https://nymtech.net/favicon.svg'; url = 'https://matrix.org/assets/frontpage/github-mark.svg';
resp = await mixFetch(url, args); resp = await mixFetch(url, args);
console.log({ resp }); console.log({ resp });
const buffer = await resp.arrayBuffer(); const buffer = await resp.arrayBuffer();
@@ -35,7 +35,8 @@ module.exports = mergeWithRules({
{ {
// copy the WASM files, because webpack doesn't do this automatically even though there are // copy the WASM files, because webpack doesn't do this automatically even though there are
// `new URL(..., import.meta.url)` statements in the web worker // `new URL(..., import.meta.url)` statements in the web worker
from: path.resolve(path.dirname(require.resolve('@nymproject/mix-fetch/package.json')), 'dist/esm/*.wasm'), // from: path.resolve(path.dirname(require.resolve('@nymproject/mix-fetch/package.json')), 'dist/esm/*.wasm'),
from: path.resolve(path.dirname(require.resolve('@nymproject/mix-fetch/package.json')), '*.wasm'),
to: '[name][ext]', to: '[name][ext]',
}, },
], ],
@@ -1,7 +1,5 @@
const { mergeWithRules } = require('webpack-merge'); const { mergeWithRules } = require('webpack-merge');
const webpack = require('webpack'); const webpack = require('webpack');
const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const ReactRefreshTypeScript = require('react-refresh-typescript');
const commonConfig = require('./webpack.common'); const commonConfig = require('./webpack.common');
module.exports = mergeWithRules({ module.exports = mergeWithRules({
@@ -22,7 +20,7 @@ module.exports = mergeWithRules({
exclude: /node_modules/, exclude: /node_modules/,
options: { options: {
getCustomTransformers: () => ({ getCustomTransformers: () => ({
before: [ReactRefreshTypeScript()], before: [],
}), }),
// `ts-loader` does not work with HMR unless `transpileOnly` is used. // `ts-loader` does not work with HMR unless `transpileOnly` is used.
// If you need type checking, `ForkTsCheckerWebpackPlugin` is an alternative. // If you need type checking, `ForkTsCheckerWebpackPlugin` is an alternative.
@@ -36,8 +34,6 @@ module.exports = mergeWithRules({
], ],
}, },
plugins: [ plugins: [
new ReactRefreshWebpackPlugin(),
// this can be included automatically by the dev server, however build mode fails if missing // this can be included automatically by the dev server, however build mode fails if missing
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
], ],
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/mix-fetch", "name": "@nymproject/mix-fetch",
"version": "1.4.0-rc.0", "version": "1.4.1",
"description": "This package is a drop-in replacement for `fetch` to send HTTP requests over the Nym Mixnet.", "description": "This package is a drop-in replacement for `fetch` to send HTTP requests over the Nym Mixnet.",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Nym Technologies SA", "author": "Nym Technologies SA",
@@ -34,7 +34,7 @@
"tsc": "tsc --noEmit true" "tsc": "tsc --noEmit true"
}, },
"dependencies": { "dependencies": {
"@nymproject/mix-fetch-wasm": ">=1.2.4-rc.2 || ^1", "@nymproject/mix-fetch-wasm": ">=1.4.1-rc.3 || ^1",
"comlink": "^4.3.1" "comlink": "^4.3.1"
}, },
"devDependencies": { "devDependencies": {
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/node-tester", "name": "@nymproject/node-tester",
"version": "1.3.0-rc.0", "version": "1.3.1",
"description": "This package provides a tester that can send test packets to mixnode that is part of the Nym Mixnet.", "description": "This package provides a tester that can send test packets to mixnode that is part of the Nym Mixnet.",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Nym Technologies SA", "author": "Nym Technologies SA",
@@ -25,7 +25,7 @@
"tsc": "tsc --noEmit true" "tsc": "tsc --noEmit true"
}, },
"dependencies": { "dependencies": {
"@nymproject/nym-node-tester-wasm": ">=1.2.4-rc.2 || ^1", "@nymproject/nym-node-tester-wasm": ">=1.3.1-rc.0 || ^1",
"comlink": "^4.3.1" "comlink": "^4.3.1"
}, },
"devDependencies": { "devDependencies": {
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/nodejs-client", "name": "@nymproject/nodejs-client",
"version": "1.4.0-rc.0", "version": "1.4.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Nym Technologies SA", "author": "Nym Technologies SA",
"files": [ "files": [
@@ -25,7 +25,7 @@
"tsc": "tsc --noEmit true" "tsc": "tsc --noEmit true"
}, },
"dependencies": { "dependencies": {
"@nymproject/nym-client-wasm-node": ">=1.2.4-rc.2 || ^1", "@nymproject/nym-client-wasm-node": ">=1.4.1-rc.3 || ^1",
"comlink": "^4.3.1", "comlink": "^4.3.1",
"fake-indexeddb": "^4.0.2", "fake-indexeddb": "^4.0.2",
"rollup-plugin-polyfill": "^4.2.0", "rollup-plugin-polyfill": "^4.2.0",
@@ -67,7 +67,7 @@ class ClientWrapper {
console.error('Client has not been initialised. Please call `init` first.'); console.error('Client has not been initialised. Please call `init` first.');
return undefined; return undefined;
} }
return this.client.self_address(); return this.client.selfAddress();
}; };
/** /**
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk-react", "name": "@nymproject/sdk-react",
"version": "1.4.0-rc.0", "version": "1.4.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Nym Technologies SA", "author": "Nym Technologies SA",
"files": [ "files": [
@@ -20,7 +20,7 @@
"tsc": "tsc --noEmit true" "tsc": "tsc --noEmit true"
}, },
"dependencies": { "dependencies": {
"@nymproject/sdk": ">=1.2.2-rc.0 || ^1" "@nymproject/sdk": ">=1.4.1-rc.3 || ^1"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.17.5", "@babel/core": "^7.17.5",
@@ -67,4 +67,4 @@
"private": false, "private": false,
"type": "module", "type": "module",
"types": "./dist/index.d.ts" "types": "./dist/index.d.ts"
} }
+9 -5
View File
@@ -1,6 +1,6 @@
{ {
"name": "@nymproject/sdk", "name": "@nymproject/sdk",
"version": "1.4.0-rc.0", "version": "1.4.1",
"license": "Apache-2.0", "license": "Apache-2.0",
"author": "Nym Technologies SA", "author": "Nym Technologies SA",
"files": [ "files": [
@@ -30,11 +30,8 @@
"test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest.config.mjs --no-cache", "test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js -c=jest.config.mjs --no-cache",
"tsc": "tsc --noEmit true" "tsc": "tsc --noEmit true"
}, },
"typeRoots": [
"./node_modules/@types/*"
],
"dependencies": { "dependencies": {
"@nymproject/nym-client-wasm": ">=1.2.4-rc.2 || ^1", "@nymproject/nym-client-wasm": ">=1.4.1-rc.3 || ^1",
"comlink": "^4.3.1" "comlink": "^4.3.1"
}, },
"devDependencies": { "devDependencies": {
@@ -54,6 +51,7 @@
"@rollup/plugin-url": "^8.0.1", "@rollup/plugin-url": "^8.0.1",
"@rollup/plugin-wasm": "^6.1.1", "@rollup/plugin-wasm": "^6.1.1",
"@types/jest": "^27.0.1", "@types/jest": "^27.0.1",
"@types/minimatch": "5.1.2",
"@types/node": "^16.7.13", "@types/node": "^16.7.13",
"@typescript-eslint/eslint-plugin": "^5.13.0", "@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0", "@typescript-eslint/parser": "^5.13.0",
@@ -81,7 +79,13 @@
"typedoc": "^0.24.8", "typedoc": "^0.24.8",
"typescript": "^4.8.4" "typescript": "^4.8.4"
}, },
"resolutions": {
"@types/minimatch": "5.1.2"
},
"private": false, "private": false,
"type": "module", "type": "module",
"typeRoots": [
"./node_modules/@types/*"
],
"types": "./dist/esm/index.d.ts" "types": "./dist/esm/index.d.ts"
} }
@@ -79,7 +79,7 @@ class ClientWrapper {
return undefined; return undefined;
} }
return this.client.self_address(); return this.client.selfAddress();
}; };
/** /**
@@ -39,7 +39,7 @@
"@rollup/plugin-json": "^6.0.0", "@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-typescript": "^11.0.0", "@rollup/plugin-typescript": "^11.0.0",
"@types/minimatch": "^6.0.0", "@types/minimatch": "5.1.2",
"@typescript-eslint/eslint-plugin": "^5.7.0", "@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0", "@typescript-eslint/parser": "^5.7.0",
"axios": "^1.3.3", "axios": "^1.3.3",
+1 -1
View File
@@ -21,7 +21,7 @@ yarn
yarn build:ci:sdk yarn build:ci:sdk
# build documentation # build documentation
yarn docs:prod:build #yarn docs:prod:build
# turn dev mode off # turn dev mode off
yarn dev:off yarn dev:off
+6 -1
View File
@@ -2,7 +2,12 @@ import fs from 'fs';
const packageJson = JSON.parse(fs.readFileSync('package.json').toString()); const packageJson = JSON.parse(fs.readFileSync('package.json').toString());
const devWorkspace = ['sdk/typescript/packages/**', 'sdk/typescript/examples/**', 'sdk/typescript/codegen/**']; const devWorkspace = [
'dist/**',
'sdk/typescript/packages/**',
'sdk/typescript/examples/**',
'sdk/typescript/codegen/**',
];
if (!packageJson.workspaces.includes(devWorkspace)) { if (!packageJson.workspaces.includes(devWorkspace)) {
// add // add
packageJson.workspaces.push(...devWorkspace); packageJson.workspaces.push(...devWorkspace);
+6 -1
View File
@@ -2,7 +2,12 @@ import fs from 'fs';
const packageJson = JSON.parse(fs.readFileSync('package.json').toString()); const packageJson = JSON.parse(fs.readFileSync('package.json').toString());
const devWorkspace = ['sdk/typescript/packages/**', 'sdk/typescript/examples/**', 'sdk/typescript/codegen/**']; const devWorkspace = [
'dist/**',
'sdk/typescript/packages/**',
'sdk/typescript/examples/**',
'sdk/typescript/codegen/**',
];
// remove // remove
packageJson.workspaces = packageJson.workspaces.filter((w) => !devWorkspace.includes(w)); packageJson.workspaces = packageJson.workspaces.filter((w) => !devWorkspace.includes(w));
+3 -3
View File
@@ -29,7 +29,7 @@ packages=(
"wasm/extension-storage" "wasm/extension-storage"
"node/wasm/client" "node/wasm/client"
"node/wasm/mix-fetch" #"node/wasm/mix-fetch"
"ts/sdk/mix-fetch/cjs" "ts/sdk/mix-fetch/cjs"
"ts/sdk/mix-fetch/cjs-full-fat" "ts/sdk/mix-fetch/cjs-full-fat"
@@ -49,7 +49,7 @@ packages=(
"ts/sdk/sdk/esm" "ts/sdk/sdk/esm"
"ts/sdk/sdk/esm-full-fat" "ts/sdk/sdk/esm-full-fat"
"ts/sdk/contract-clients" #"ts/sdk/contract-clients"
) )
pushd () { pushd () {
@@ -66,7 +66,7 @@ for item in "${packages[@]}"
do do
pushd "$item" pushd "$item"
jq -r '. | "📦 " + .version + " " +.name' < package.json jq -r '. | "📦 " + .version + " " +.name' < package.json
popd popd
done done
echo "" echo ""
+13 -5
View File
@@ -1,7 +1,7 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net> // Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use anyhow::{bail, Context}; use anyhow::{Context, bail};
use semver::{Prerelease, Version}; use semver::{Prerelease, Version};
use std::collections::HashSet; use std::collections::HashSet;
use std::path::Path; use std::path::Path;
@@ -72,7 +72,9 @@ pub(crate) fn try_bump_raw_prerelease(raw: &str) -> anyhow::Result<Prerelease> {
impl VersionBumpExt for Version { impl VersionBumpExt for Version {
fn try_bump_prerelease(&self) -> anyhow::Result<Self> { fn try_bump_prerelease(&self) -> anyhow::Result<Self> {
if self.pre.is_empty() { if self.pre.is_empty() {
bail!("the current version ({self}) does not have pre-release data set - are you sure you followed the release process correctly?") bail!(
"the current version ({self}) does not have pre-release data set - are you sure you followed the release process correctly?"
)
} }
Ok(Version { Ok(Version {
@@ -86,7 +88,9 @@ impl VersionBumpExt for Version {
fn try_bump_patch_without_pre(&self) -> anyhow::Result<Self> { fn try_bump_patch_without_pre(&self) -> anyhow::Result<Self> {
if !self.pre.is_empty() { if !self.pre.is_empty() {
bail!("the current version ({self}) has pre-release data set - are you sure you followed the release process correctly?") bail!(
"the current version ({self}) has pre-release data set - are you sure you followed the release process correctly?"
)
} }
let mut updated = self.clone(); let mut updated = self.clone();
@@ -96,7 +100,9 @@ impl VersionBumpExt for Version {
fn set_initial_release_candidate(&self) -> anyhow::Result<Self> { fn set_initial_release_candidate(&self) -> anyhow::Result<Self> {
if !self.pre.is_empty() { if !self.pre.is_empty() {
bail!("the current version ({self}) has pre-release data set - are you sure you followed the release process correctly?") bail!(
"the current version ({self}) has pre-release data set - are you sure you followed the release process correctly?"
)
} }
Ok(Version { Ok(Version {
major: self.major, major: self.major,
@@ -109,7 +115,9 @@ impl VersionBumpExt for Version {
fn try_remove_prerelease(&self) -> anyhow::Result<Self> { fn try_remove_prerelease(&self) -> anyhow::Result<Self> {
if self.pre.is_empty() { if self.pre.is_empty() {
bail!("the current version ({self}) does not have pre-release data set - are you sure you followed the release process correctly?") bail!(
"the current version ({self}) does not have pre-release data set - are you sure you followed the release process correctly?"
)
} }
Ok(Version { Ok(Version {
major: self.major, major: self.major,
+2 -2
View File
@@ -3,8 +3,8 @@
use crate::helpers::try_bump_raw_prerelease; use crate::helpers::try_bump_raw_prerelease;
use crate::json_types::DepsSet; use crate::json_types::DepsSet;
use crate::{json_types, ReleasePackage}; use crate::{ReleasePackage, json_types};
use anyhow::{bail, Context}; use anyhow::{Context, bail};
use semver::{Comparator, Prerelease, Version, VersionReq}; use semver::{Comparator, Prerelease, Version, VersionReq};
use std::collections::HashSet; use std::collections::HashSet;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
+1 -1
View File
@@ -4,7 +4,7 @@ authors = [
"Dave Hrycyszyn <futurechimp@users.noreply.github.com>", "Dave Hrycyszyn <futurechimp@users.noreply.github.com>",
"Jedrzej Stuczynski <andrew@nymtech.net>", "Jedrzej Stuczynski <andrew@nymtech.net>",
] ]
version = "1.4.0-rc.0" version = "1.4.1"
edition = "2021" edition = "2021"
keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy"] keywords = ["nym", "sphinx", "wasm", "webassembly", "privacy"]
license = "Apache-2.0" license = "Apache-2.0"
+6 -1
View File
@@ -1,7 +1,9 @@
all: build build-node all: build build-node
build: build: test build-wasm
build-wasm:
wasm-pack build --scope nymproject --target web --out-dir ../../dist/wasm/client wasm-pack build --scope nymproject --target web --out-dir ../../dist/wasm/client
wasm-opt -Oz -o ../../dist/wasm/client/nym_client_wasm_bg.wasm ../../dist/wasm/client/nym_client_wasm_bg.wasm wasm-opt -Oz -o ../../dist/wasm/client/nym_client_wasm_bg.wasm ../../dist/wasm/client/nym_client_wasm_bg.wasm
@@ -16,3 +18,6 @@ build-package-json-node:
node build-node.mjs node build-node.mjs
build-node: build-rust-node build-package-json-node build-node: build-rust-node build-package-json-node
test:
wasm-pack test --node
+44 -5
View File
@@ -58,7 +58,25 @@ pub fn encode_payload_with_headers(
Ok(metadata) => { Ok(metadata) => {
let metadata = metadata.as_bytes().to_vec(); let metadata = metadata.as_bytes().to_vec();
let size = (metadata.len() as u64).to_be_bytes().to_vec(); let size = (metadata.len() as u64).to_be_bytes().to_vec();
Ok([size, metadata, payload].concat()) if size.len() != 8 {
return Err(JsValue::from(JsError::new(
format!("Size as big endian u8 is {} instead of 8", size.len()).as_str(),
)));
}
let metadata_length = metadata.len();
let payload_length = payload.len();
let encoded = [size, metadata, payload].concat();
if encoded.len() != (8 + metadata_length + payload_length) {
return Err(JsValue::from(JsError::new(
format!(
"Total size {} != {} (8 + {metadata_length} + {payload_length})",
encoded.len(),
8 + metadata_length + payload_length
)
.as_str(),
)));
}
Ok(encoded)
} }
Err(e) => Err(JsValue::from(JsError::new( Err(e) => Err(JsValue::from(JsError::new(
format!("Could not encode message: {e}").as_str(), format!("Could not encode message: {e}").as_str(),
@@ -90,7 +108,7 @@ pub fn decode_payload(message: Vec<u8>) -> Result<IEncodedPayload, JsValue> {
} }
pub(crate) fn parse_payload(message: &[u8]) -> anyhow::Result<(EncodedPayloadMetadata, &[u8])> { pub(crate) fn parse_payload(message: &[u8]) -> anyhow::Result<(EncodedPayloadMetadata, &[u8])> {
// 1st 8 bytes are the size (as u64 big endian) // 1st 8 bytes are the size of the metadata field (as u64 big endian)
let mut size = [0u8; 8]; let mut size = [0u8; 8];
if message.len() < 8 { if message.len() < 8 {
bail!("Message is too short to contain size information") bail!("Message is too short to contain size information")
@@ -98,10 +116,23 @@ pub(crate) fn parse_payload(message: &[u8]) -> anyhow::Result<(EncodedPayloadMet
size.clone_from_slice(&message[0..8]); size.clone_from_slice(&message[0..8]);
let metadata_size = u64::from_be_bytes(size) as usize; let metadata_size = u64::from_be_bytes(size) as usize;
if metadata_size + 8 != message.len() { if metadata_size + 8 > message.len() {
return Err(anyhow::anyhow!(format!( return Err(anyhow::anyhow!(format!(
"Metadata size: {}, exceeds message with length of: {}", "Metadata size: {} bytes + 8 bytes ({} bytes) > {} bytes, message length. Did you pass the entire message for decoding?",
metadata_size, metadata_size,
metadata_size + 8,
message.len()
),));
}
let payload_size = message.len() - (8 + metadata_size);
if payload_size + metadata_size + 8 != message.len() {
return Err(anyhow::anyhow!(format!(
"Payload size {} + Metadata size {} + 8 ({}) != {} message length",
payload_size,
metadata_size,
payload_size + metadata_size + 8,
message.len() message.len()
),)); ),));
} }
@@ -275,7 +306,7 @@ mod tests {
let error = result.unwrap_err(); let error = result.unwrap_err();
assert_eq!( assert_eq!(
error.to_string(), error.to_string(),
"Metadata size: 20, exceeds message with length of: 18" "Metadata size: 20 bytes + 8 bytes (28 bytes) > 18 bytes, message length. Did you pass the entire message for decoding?"
); );
} }
@@ -294,6 +325,14 @@ mod tests {
message.extend_from_slice(serialized_metadata.as_bytes()); message.extend_from_slice(serialized_metadata.as_bytes());
message.extend_from_slice(&payload_data); message.extend_from_slice(&payload_data);
wasm_utils::console_log!("message length: {}", message.len());
wasm_utils::console_log!("metadata length: {}", metadata_length);
wasm_utils::console_log!("payload length: {}", payload_data.len());
wasm_utils::console_log!(
"8 + metadata_length + payload_length = {}",
payload_data.len() + metadata_length as usize + 8
);
let (parsed_metadata, parsed_payload) = parse_payload(&message).unwrap(); let (parsed_metadata, parsed_payload) = parse_payload(&message).unwrap();
assert_eq!(parsed_metadata.mime_type, metadata.mime_type); assert_eq!(parsed_metadata.mime_type, metadata.mime_type);
+1 -1
View File
@@ -20,7 +20,7 @@ use wasm_utils::set_panic_hook;
#[wasm_bindgen(start)] #[wasm_bindgen(start)]
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
pub fn main() { pub fn main_js() {
wasm_utils::console_log!("[rust main]: setting panic hook"); wasm_utils::console_log!("[rust main]: setting panic hook");
set_panic_hook(); set_panic_hook();
wasm_utils::console_log!("[rust main]: rust module loaded"); wasm_utils::console_log!("[rust main]: rust module loaded");
+2 -1
View File
@@ -1,7 +1,7 @@
[package] [package]
name = "mix-fetch-wasm" name = "mix-fetch-wasm"
authors = ["Jedrzej Stuczynski <andrew@nymtech.net>"] authors = ["Jedrzej Stuczynski <andrew@nymtech.net>"]
version = "1.4.0-rc.0" version = "1.4.1"
edition = "2021" edition = "2021"
keywords = ["nym", "fetch", "wasm", "webassembly", "privacy"] keywords = ["nym", "fetch", "wasm", "webassembly", "privacy"]
license = "Apache-2.0" license = "Apache-2.0"
@@ -32,6 +32,7 @@ nym-http-api-client = { path = "../../common/http-api-client" }
nym-socks5-requests = { path = "../../common/socks5/requests" } nym-socks5-requests = { path = "../../common/socks5/requests" }
nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" } nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" }
nym-service-providers-common = { path = "../../service-providers/common" } nym-service-providers-common = { path = "../../service-providers/common" }
nym-validator-client = { path = "../../common/client-libs/validator-client", default-features = false }
wasm-client-core = { path = "../../common/wasm/client-core" } wasm-client-core = { path = "../../common/wasm/client-core" }
wasm-utils = { path = "../../common/wasm/utils" } wasm-utils = { path = "../../common/wasm/utils" }
+3 -5
View File
@@ -1,9 +1,7 @@
module go-mix-conn module go-mix-conn
go 1.23.0 go 1.24.0
toolchain go1.23.3 require golang.org/x/net v0.46.0
require golang.org/x/net v0.38.0 require golang.org/x/text v0.30.0 // indirect
require golang.org/x/text v0.23.0 // indirect
+4
View File
@@ -1,4 +1,8 @@
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4=
golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210=
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
+3 -3
View File
@@ -1,10 +1,10 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net> // Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use crate::harbourmaster::HarbourMasterApiError;
use crate::RequestId; use crate::RequestId;
use nym_ordered_buffer::OrderedMessageError; use nym_ordered_buffer::OrderedMessageError;
use nym_socks5_requests::ConnectionError; use nym_socks5_requests::ConnectionError;
use nym_validator_client::nym_api::error::NymAPIError;
use thiserror::Error; use thiserror::Error;
use wasm_client_core::error::WasmCoreError; use wasm_client_core::error::WasmCoreError;
use wasm_client_core::ClientCoreError; use wasm_client_core::ClientCoreError;
@@ -22,9 +22,9 @@ pub enum MixFetchError {
NoNetworkRequesters, NoNetworkRequesters,
#[error("could not query for the service providers: {source}")] #[error("could not query for the service providers: {source}")]
HarbourmasterError { ValidatorClientError {
#[from] #[from]
source: HarbourMasterApiError, source: NymAPIError,
}, },
#[error("failed to parse mix fetch config options: {source}")] #[error("failed to parse mix fetch config options: {source}")]
+6 -4
View File
@@ -94,10 +94,12 @@ pub fn setup_mix_fetch(opts: MixFetchOpts) -> Promise {
} }
future_to_promise(async move { future_to_promise(async move {
let network_requester_address = let network_requester_address = get_network_requester(
get_network_requester(opts.base.preferred_network_requester.clone()) opts.nym_api_url.clone(),
.await opts.base.preferred_network_requester.clone(),
.map_promise_err()?; )
.await
.map_promise_err()?;
console_log!("going to use {network_requester_address} network requester"); console_log!("going to use {network_requester_address} network requester");
-59
View File
@@ -1,59 +0,0 @@
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: Apache-2.0
// this exists inside mix-fetch rather than being made into repo-wide library since it's a temporary solution
// until the API is finalised and endpoints are moved to nym-api
use async_trait::async_trait;
use nym_http_api_client::{ApiClient, HttpClientError, NO_PARAMS};
use serde::Deserialize;
pub use nym_http_api_client::Client;
pub type HarbourMasterApiError = HttpClientError;
mod routes {
pub const API_VERSION: &str = "v1";
pub const SERVICES: &str = "services";
pub const NEW: &str = "new";
}
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
pub trait HarbourMasterApiClientExt: ApiClient {
// since it's a temporary thing don't worry about paging.
async fn get_services_new(&self) -> Result<PagedResult<ServiceNew>, HarbourMasterApiError> {
self.get_json(
&[routes::API_VERSION, routes::SERVICES, routes::NEW],
NO_PARAMS,
)
.await
}
}
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
impl HarbourMasterApiClientExt for Client {}
// https://gitlab.nymte.ch/nym/shipyard-test-and-earn/-/blob/main/harbour-master/src/http/mod.rs#L13
#[allow(dead_code)]
#[derive(Debug, Deserialize)]
pub struct PagedResult<T> {
pub page: u32,
pub size: u32,
pub total: i32,
pub items: Vec<T>,
}
// https://gitlab.nymte.ch/nym/shipyard-test-and-earn/-/blob/main/harbour-master/src/http/services.rs#L32
#[allow(dead_code)]
#[derive(Debug, Deserialize)]
pub struct ServiceNew {
pub service_provider_client_id: String,
pub ip_address: String,
pub last_successful_ping_utc: String,
pub last_updated_utc: String,
pub routing_score: f32,
}
+21 -9
View File
@@ -2,36 +2,48 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
use crate::error::MixFetchError; use crate::error::MixFetchError;
use crate::harbourmaster; use crate::error::MixFetchError::NoNetworkRequesters;
use crate::harbourmaster::HarbourMasterApiClientExt; use nym_http_api_client::Client;
use nym_validator_client::nym_api::NymApiClientExt;
use rand::seq::SliceRandom; use rand::seq::SliceRandom;
use rand::thread_rng; use rand::thread_rng;
use wasm_utils::console_log; use wasm_utils::console_log;
// since this client is temporary (and will be properly integrated into nym-api eventually), // since this client is temporary (and will be properly integrated into nym-api eventually),
// we're using hardcoded URL for mainnet // we're using hardcoded URL for mainnet
const HARBOUR_MASTER: &str = "https://harbourmaster.nymtech.net"; const NYM_API_URL: &str = "https://validator.nymtech.net/api/";
pub(crate) async fn get_network_requester( pub(crate) async fn get_network_requester(
nym_api_url: Option<String>,
preferred: Option<String>, preferred: Option<String>,
) -> Result<String, MixFetchError> { ) -> Result<String, MixFetchError> {
if let Some(sp) = preferred { if let Some(sp) = preferred {
return Ok(sp); return Ok(sp);
} }
let client = harbourmaster::Client::new_url(HARBOUR_MASTER, None)?; let client = Client::new(
let providers = client.get_services_new().await?; url::Url::parse(&nym_api_url.unwrap_or(NYM_API_URL.to_string()))?,
None,
);
let nodes = client.get_all_described_nodes().await?;
let providers: Vec<_> = nodes
.iter()
.filter_map(|node| {
node.description
.network_requester
.clone()
.map(|n| n.address)
})
.collect();
console_log!( console_log!(
"obtained list of {} service providers on the network", "obtained list of {} service providers on the network",
providers.items.len() providers.len()
); );
// this will only return a `None` if the list is empty // this will only return a `None` if the list is empty
let mut rng = thread_rng(); let mut rng = thread_rng();
providers providers
.items
.choose(&mut rng) .choose(&mut rng)
.map(|service| &service.service_provider_client_id) .ok_or(NoNetworkRequesters)
.cloned() .cloned()
.ok_or(MixFetchError::NoNetworkRequesters)
} }
-2
View File
@@ -14,8 +14,6 @@ mod fetch;
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
mod go_bridge; mod go_bridge;
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
mod harbourmaster;
#[cfg(target_arch = "wasm32")]
mod helpers; mod helpers;
#[cfg(target_arch = "wasm32")] #[cfg(target_arch = "wasm32")]
mod request_writer; mod request_writer;
+1 -1
View File
@@ -1,7 +1,7 @@
[package] [package]
name = "nym-node-tester-wasm" name = "nym-node-tester-wasm"
authors = ["Jedrzej Stuczynski <andrew@nymtech.net>"] authors = ["Jedrzej Stuczynski <andrew@nymtech.net>"]
version = "1.3.0-rc.0" version = "1.3.1"
edition = "2021" edition = "2021"
keywords = ["nym", "sphinx", "webassembly", "privacy", "tester"] keywords = ["nym", "sphinx", "webassembly", "privacy", "tester"]
license = "Apache-2.0" license = "Apache-2.0"
+1590 -5673
View File
File diff suppressed because it is too large Load Diff