Skip to content

Commit

Permalink
Messages are now nested in their own namespace (#93)
Browse files Browse the repository at this point in the history
  • Loading branch information
BjrInt committed Nov 24, 2022
1 parent 52f3c7e commit 3e2eb82
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 2 additions & 7 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import * as accounts from "./accounts/index";
import * as aggregate from "./messages/aggregate/index";
import * as post from "./messages/post/index";
import * as store from "./messages/store/index";
import * as forget from "./messages/forget/index";
import * as program from "./messages/program/index";

import { messages } from "./messages";
import * as Ledger from "./accounts/providers/Ledger";

export { accounts, Ledger, aggregate, post, store, forget, program };
export { accounts, Ledger, messages };
7 changes: 7 additions & 0 deletions src/messages/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
import { BaseMessage } from "./message";
import * as aggregate from "./aggregate";
import * as forget from "./forget";
import * as post from "./post";
import * as program from "./program";
import * as store from "./store";

export const messages = { aggregate, forget, post, program, store };

/**
* Extracts some fields from an Aleph message to sign it using an account.
Expand Down
8 changes: 4 additions & 4 deletions testsAuto/accounts/substrate.auto.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as bip39 from "bip39";
import assert = require("assert");
import assert from "assert";
import { mnemonicToMiniSecret } from "@polkadot/util-crypto";

import { testsFunc } from "../index";
import { accounts, aggregate } from "../../src";
import { accounts, messages } from "../../src";
import { DEFAULT_API_V2 } from "../../src/global";
import { Chain, ItemType } from "../../src/messages/message";

Expand Down Expand Up @@ -50,7 +50,7 @@ async function PublishAggregate(): Promise<boolean> {
body: "Typescript sdk",
};

await aggregate.Publish({
await messages.aggregate.Publish({
account: account,
key: key,
content: content,
Expand All @@ -65,7 +65,7 @@ async function PublishAggregate(): Promise<boolean> {
body: string;
};
};
const amends = await aggregate.Get<exceptedType>({
const amends = await messages.aggregate.Get<exceptedType>({
APIServer: DEFAULT_API_V2,
address: account.address,
keys: [key],
Expand Down

0 comments on commit 3e2eb82

Please sign in to comment.