diff --git a/README.md b/README.md index a1e582d5b3..ced48748cc 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ This creates a CSV file with the EVM network params in your data directory. cargo run --bin antctl -- local run --build --clean --rewards-address ``` -The EVM Network parameters are loaded from the CSV file in your data directory automatically when the `local` option is passed to the `antctl` command. +The EVM Network parameters are loaded from the CSV file in your data directory automatically when the `local` mode is enabled. ##### 4. Verify node status @@ -142,117 +142,6 @@ Now to download the files again: cargo run --bin ant -- --local file download ``` -### Registers - -Registers are one of the network's data types. The workspace here has an example app demonstrating -their use by two users to exchange text messages in a crude chat application. - -In the first terminal, using the registers example, Alice creates a register: - -``` -cargo run --example registers -- --local --user alice --reg-nickname myregister -``` - -Alice can now write a message to the register and see anything written by anyone else. For example -she might enter the text "Hello, who's there?" which is written to the register and then shown as -the "Latest value", in her terminal: - -``` -Register address: "50f4c9d55aa1f4fc19149a86e023cd189e509519788b4ad8625a1ce62932d1938cf4242e029cada768e7af0123a98c25973804d84ad397ca65cb89d6580d04ff07e5b196ea86f882b925be6ade06fc8d" -Register owned by: PublicKey(0cf4..08a5) -Register permissions: Permissions { anyone_can_write: true, writers: {PublicKey(0cf4..08a5)} } - -Current total number of items in Register: 0 -Latest value (more than one if concurrent writes were made): --------------- --------------- - -Enter a blank line to receive updates, or some text to be written. -Hello, who's there? -Writing msg (offline) to Register: 'Hello, who's there?' -Syncing with SAFE in 2s... -synced! - -Current total number of items in Register: 1 -Latest value (more than one if concurrent writes were made): --------------- -[Alice]: Hello, who's there? --------------- - -Enter a blank line to receive updates, or some text to be written. - -``` - -For anyone else to write to the same register they need to know its xor address, so to communicate -with her friend Bob, Alice needs to find a way to send it to Bob. In her terminal, this is the -value starting "50f4..." in the output above. This value will be different each time you run the -example to create a register. - -Having received the xor address, in another terminal Bob can access the same register to see the -message Alice has written, and he can write back by running this command with the address received -from Alice. (Note that the command should all be on one line): - -``` -cargo run --example registers -- --local --user bob --reg-address 50f4c9d55aa1f4fc19149a86e023cd189e509519788b4ad8625a1ce62932d1938cf4242e029cada768e7af0123a98c25973804d84ad397ca65cb89d6580d04ff07e5b196ea86f882b925be6ade06fc8d -``` - -After retrieving the register and displaying the message from Alice, Bob can reply and at any time, -Alice or Bob can send another message and see any new messages which have been written, or enter a -blank line to poll for updates. - -Here's Bob writing from his terminal: - -``` -Latest value (more than one if concurrent writes were made): --------------- -[Alice]: Hello, who's there? --------------- - -Enter a blank line to receive updates, or some text to be written. -hi Alice, this is Bob! -``` - -Alice will see Bob's message when she either enters a blank line or writes another message herself. - -### Inspect a Register - -A second example, `register_inspect` allows you to view its structure and content. To use this with -the above example you again provide the address of the register. For example: - -``` -cargo run --example register_inspect -- --local --reg-address 50f4c9d55aa1f4fc19149a86e023cd189e509519788b4ad8625a1ce62932d1938cf4242e029cada768e7af0123a98c25973804d84ad397ca65cb89d6580d04ff07e5b196ea86f882b925be6ade06fc8d -``` - -After printing a summary of the register, this example will display -the structure of the register each time you press Enter, including the following: - -``` -Enter a blank line to print the latest register structure (or 'Q' to quit) - -Syncing with SAFE... -synced! -====================== -Root (Latest) Node(s): -[ 0] Node("4eadd9"..) Entry("[alice]: this is alice 3") -[ 3] Node("f05112"..) Entry("[bob]: this is bob 3") -====================== -Register Structure: -(In general, earlier nodes are more indented) -[ 0] Node("4eadd9"..) Entry("[alice]: this is alice 3") - [ 1] Node("f5afb2"..) Entry("[alice]: this is alice 2") - [ 2] Node("7693eb"..) Entry("[alice]: hello this is alice") -[ 3] Node("f05112"..) Entry("[bob]: this is bob 3") - [ 4] Node("8c3cce"..) Entry("[bob]: this is bob 2") - [ 5] Node("c7f9fc"..) Entry("[bob]: this is bob 1") - [ 1] Node("f5afb2"..) Entry("[alice]: this is alice 2") - [ 2] Node("7693eb"..) Entry("[alice]: hello this is alice") -====================== -``` - -Each increase in indentation shows the children of the node above. -The numbers in square brackets are just to make it easier to see -where a node occurs more than once. - ### RPC The node manager launches each node process with a remote procedure call (RPC) service. The diff --git a/autonomi/nodejs/dist/graphEntry.d.ts b/autonomi/nodejs/dist/graphEntry.d.ts new file mode 100644 index 0000000000..cf5edea7fb --- /dev/null +++ b/autonomi/nodejs/dist/graphEntry.d.ts @@ -0,0 +1,9 @@ +import { GraphEntryOptions, PaymentOption } from './types'; +export declare class GraphEntry { + private nativeList; + private constructor(); + static create(address: string): Promise; + get(): Promise; + put(options: GraphEntryOptions, payment: PaymentOption): Promise; + getCost(key: string): Promise; +} diff --git a/autonomi/nodejs/dist/linkedList.js b/autonomi/nodejs/dist/graphEntry.js similarity index 88% rename from autonomi/nodejs/dist/linkedList.js rename to autonomi/nodejs/dist/graphEntry.js index c17c9b45a8..b4dff59764 100644 --- a/autonomi/nodejs/dist/linkedList.js +++ b/autonomi/nodejs/dist/graphEntry.js @@ -1,7 +1,7 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.GarphEntry = void 0; -class GarphEntry { +exports.GraphEntry = void 0; +class GraphEntry { constructor(nativeList) { this.nativeList = nativeList; } @@ -22,4 +22,4 @@ class GarphEntry { throw new Error('Not implemented'); } } -exports.GarphEntry = GarphEntry; +exports.GraphEntry = GraphEntry; diff --git a/autonomi/nodejs/dist/linkedList.d.ts b/autonomi/nodejs/dist/linkedList.d.ts deleted file mode 100644 index 21330fcc23..0000000000 --- a/autonomi/nodejs/dist/linkedList.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { GarphEntryOptions, PaymentOption } from './types'; -export declare class GarphEntry { - private nativeList; - private constructor(); - static create(address: string): Promise; - get(): Promise; - put(options: GarphEntryOptions, payment: PaymentOption): Promise; - getCost(key: string): Promise; -} diff --git a/nodejs/README.md b/nodejs/README.md index 3eac715e8a..ec2269511b 100644 --- a/nodejs/README.md +++ b/nodejs/README.md @@ -69,9 +69,9 @@ dataGetPublic(address: string): Promise #### Graph Operations ```typescript -GarphEntryGet(address: string): Promise -GarphEntryPut(options: GarphEntryOptions, payment: PaymentOption): Promise -GarphEntryCost(key: string): Promise +GraphEntryGet(address: string): Promise +GraphEntryPut(options: GraphEntryOptions, payment: PaymentOption): Promise +GraphEntryCost(key: string): Promise ``` #### Pointer Operations diff --git a/nodejs/src/client.ts b/nodejs/src/client.ts index 62f8322bc2..de5f385ba9 100644 --- a/nodejs/src/client.ts +++ b/nodejs/src/client.ts @@ -1,4 +1,4 @@ -import { NetworkConfig, PaymentOption, GarphEntryOptions, PointerOptions, VaultOptions, UserData } from './types'; +import { NetworkConfig, PaymentOption, GraphEntryOptions, PointerOptions, VaultOptions, UserData } from './types'; export class Client { private nativeClient: any; // Will be replaced with actual native binding type @@ -29,7 +29,7 @@ export class Client { throw new Error('Not implemented'); } - async graphEntryPut(options: GarphEntryOptions, payment: PaymentOption): Promise { + async graphEntryPut(options: GraphEntryOptions, payment: PaymentOption): Promise { // TODO: Implement native binding call throw new Error('Not implemented'); } diff --git a/nodejs/src/index.ts b/nodejs/src/index.ts index 8849a59383..460dc50882 100644 --- a/nodejs/src/index.ts +++ b/nodejs/src/index.ts @@ -1,6 +1,6 @@ export * from './client'; export * from './types'; export * from './wallet'; -export * from './GarphEntry'; +export * from './GraphEntry'; export * from './pointer'; export * from './vault'; \ No newline at end of file diff --git a/nodejs/src/types.ts b/nodejs/src/types.ts index 254e005157..bc3718f036 100644 --- a/nodejs/src/types.ts +++ b/nodejs/src/types.ts @@ -8,7 +8,7 @@ export interface PaymentOption { wallet: string; } -export interface GarphEntryOptions { +export interface GraphEntryOptions { owner: PublicKey; counter: number; target: string; diff --git a/nodejs/tests/client.test.ts b/nodejs/tests/client.test.ts index 3f856e11ea..d1d4cd699f 100644 --- a/nodejs/tests/client.test.ts +++ b/nodejs/tests/client.test.ts @@ -7,18 +7,18 @@ describe('Client', () => { }); }); - describe('GarphEntryOperations', () => { - it('should throw not implemented error for GarphEntryGet', async () => { + describe('GraphEntryOperations', () => { + it('should throw not implemented error for GraphEntryGet', async () => { const client = await Client.connect({ peers: [] }).catch(() => null); if (!client) return; - await expect(client.GarphEntryGet('address')).rejects.toThrow('Not implemented'); + await expect(client.GraphEntryGet('address')).rejects.toThrow('Not implemented'); }); - it('should throw not implemented error for GarphEntryPut', async () => { + it('should throw not implemented error for GraphEntryPut', async () => { const client = await Client.connect({ peers: [] }).catch(() => null); if (!client) return; await expect( - client.GarphEntryPut( + client.GraphEntryPut( { owner: 'owner', counter: 0,