godprotocol 1.0.789 → 1.0.791

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/readme.md CHANGED
@@ -10,111 +10,134 @@ npm install godprotocol --save
10
10
 
11
11
  ### Brief Description
12
12
 
13
- This package is developing a framework for the Web 4.0
14
- It is to help provide multiple compute instances for servers and also data flexibility and transactions.
13
+ God Protocol makes data sharing and processing easy for apps. With simple APIs, developers can add advanced features like AI, distribution, and scaling. Here are the main endpoints:
15
14
 
16
- You can get overall comprehension in just 4 method calls.
15
+ ### Endpoints
17
16
 
18
- ## Create an Account
17
+ - [**/create_account:**](#create_account) Create a new machine account.
18
+ - [**/load:**](#load) Load and send an instruction sequence to the server.
19
+ - [**/run:**](#run) Execute the instruction sequence.
20
+ - [**/parse:**](#parse) Retrieve and process results from the server.
19
21
 
20
- Accounts comes with their own VM, thereby providing concurrency on processes being executed.
22
+ ---
23
+
24
+ ## /create_account
25
+
26
+ The /create_account endpoint creates a new account in the God Protocol. This account is necessary for using other features and handling data and tasks in the decentralised system.
27
+
28
+ ### Example Usage
21
29
 
22
30
  ```js
23
- import start from "godprotocol";
31
+ import manager from "godprotocol";
24
32
 
25
- // Create an initial account
26
- let initiator = start(`name`, { private: true || false });
27
- // if private is set to `true`, communication to the account instance must be validated by sigining with the private key.
28
- // N.B your keypairs are generated offline.
33
+ let account = manager.add_account("name");
34
+ let private_account = manager.add_account("public_key", { private: true });
29
35
  ```
30
36
 
31
- | `Parameters` | Type | Description |
32
- | ------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
33
- | `name` | string | Account names can be any valid variable string. Such as a Public Key |
34
- | `private` | object:boolean | default `false`, if set to true, then any payloads sent to the account must be signed using the private key belonging to the account `name` |
37
+ ### Parameters
38
+
39
+ - `name` (string): The name to associate with the new account.
40
+ - `meta` (object): Optional. Configuration object for account settings. Use `{ private: true }` to create a [private account](https://godprotocol-web.vercel.app/accounts/private).
41
+
42
+ | Parameter | Possible Values | Default Value | Type | Description |
43
+ | --------- | ---------------- | ------------- | ------- | ------------------------------------------------------------- |
44
+ | `name` | Any string | `initiator` | string | The name to associate with the new account. |
45
+ | `meta` | `{private:true}` | `{}` | object | Optional. Configuration object for account settings. |
46
+ | `private` | `true`, `false` | `false` | boolean | Nested in `meta`. Specifies if the account should be private. |
35
47
 
36
- ## Load Instructions
48
+ ## /load
37
49
 
38
- The load method is the second in the pipeline,
39
- It is used to set your programs into the network web,
40
- where its data can continue to be accessed, and subsequent
41
- calls can be made on the loaded program.
50
+ The /load endpoint in the God Protocol framework loads a program with specified instructions and manages associated accounts.
42
51
 
43
- ### Usage
52
+ ### Example Usage
44
53
 
45
54
  ```js
46
- initiator.load(
47
- {
48
- instructions: ["link Account/initiator/Datatypes/Number", "write 7", "pop"],
49
- account: `public_key`,
55
+ account.load({
56
+ program: {
57
+ instructions: ["instruction1", "instruction2"],
58
+ account: "account_id",
50
59
  },
51
- cb
52
- );
60
+ signature: "signature_string",
61
+ callback: () => {
62
+ // Callback function logic
63
+ },
64
+ });
53
65
  ```
54
66
 
55
- Type `method`
67
+ | **Paramters** | **Possible Values** | **Default Value** | **Type** | **Description** |
68
+ | ---------------------- | ----------------------------------- | ----------------- | ---------------------- | ----------------------------------------------------------------- |
69
+ | `program` | `{ instructions: [], account: "" }` | None | object | Object containing program instructions and associated account. |
70
+ | `program.instructions` | Array of strings | [] | array | Array of program instructions. |
71
+ | `program.account` | Any string | `"initiator"` | string | Associated account for program execution. |
72
+ | `signature` | String | None | string | Optional. Signature for private account access. |
73
+ | `callback` | Function or `account.run{}` | None | `function` or `object` | Optional. Function to call upon completion of the load operation. |
56
74
 
57
- | `Parameters` | Type | Destructure | Description |
58
- | ------------ | -------- | -------------- | -------------------------------------------------------------------------------------------------------------------- |
59
- | `program` | object | `instructions` | An array of opcode-operands generated by the [`Loader Sequence`](https://godprotocol-web.vercel.app/loader_sequence) |
60
- | | | `account` | Account instance to load and execute the program in. |
61
- | `cb` | function | | A function that is called with the blocks mined during the execution. |
75
+ Description:
76
+ The /load endpoint loads a program with instructions (program.instructions) and links it to an account (program.account). For private accounts, include a signature of the `program` for access. Optionally, provide a callback function to handle completion events, which may include additional execution payload (account.run).
62
77
 
63
- ## Run Program
78
+ ## `/run`
64
79
 
65
- The run is technically the second in the pipeline.
80
+ The /run endpoint runs a program in the provided payload, physical address, and account details.
66
81
 
67
- ### Usage
82
+ ### Example Usage
68
83
 
69
84
  ```js
70
- initiator.run(
71
- {
72
- physical_address: "Account/initiator/Datatypes/Number", // This points to a chain
73
- query: { blocks: 0 }, // Basically saying, index 0 block in physical_address chain, run again its instructions.
74
- account: `public_key`,
85
+ account.run({
86
+ payload: {
87
+ physical_address: "Accounts/name/path",
88
+ account: "account_id",
89
+ query: `blocks:0`,
90
+ },
91
+ signature: "signature_string",
92
+ callback: () => {
93
+ // Callback function logic
75
94
  },
76
- cb
77
- );
78
- // N.B If query is missing, then VM starts execution from the block-index-0
95
+ });
79
96
  ```
80
97
 
81
- Type `method`
82
-
83
- | `Parameters` | Type | Destructure | Description |
84
- | ------------ | -------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
85
- | `payload` | object | `physical_address` | [`Physical Addresses`](https://godprotocol-web.vercel.app/physical_address) are logical namespace locations of tokens. They are derived from the high-level representation of the program's instructions. |
86
- | | object | `query` | A valid blockweb explorer query, you can read the explorer documentation [here](https://godprotocol-web.vercel.app/explorer) |
87
- | | string | `account` | Account instance to execute the instructions in. |
88
- | `cb` | function | | A function that is called with the blocks mined during the execution. |
98
+ | Parameters | Possible Values | Default Value | Type | Descriptions |
99
+ | -------------------------- | ----------------------------------------------------------------------------- | ------------- | ---------------------- | ------------------------------------------------------------------- |
100
+ | `payload` | `{ physical_address: "", account: "", query: "" }` | None | object | Object containing the physical address, account, and query details. |
101
+ | `payload.physical_address` | Any [`physical_address`](https://godprotocol-web.vercel.app/physical_address) | None | string | The physical address path for the account. |
102
+ | `payload.account` | Any string | None | string | Associated account for execution. |
103
+ | `payload.query` | [`Query Strings`](https://godprotocol-web.vercel.app/explorer/query) | None | string | Query string to specify blocks or other parameters. |
104
+ | `signature` | String | None | string | Optional. Signature for private account access. |
105
+ | `callback` | Function or `account.run{}` | None | `function` or `object` | Optional. Function to call upon execution completion. |
89
106
 
90
- ## Parse Result
107
+ **Description:**
108
+ The /run endpoint in the God Protocol framework allows users to execute a program with a specified payload, which includes the physical address (`payload.physical_address`), associated account (`payload.account`), and query (`payload.query`). If the account is private, a payload `signature` is required. An optional `callback` function can be provided to handle completion events, which may include further execution instructions (`account.run`).
91
109
 
92
- The parse is technically the third of the pipeline. It takes like parameters as the `run` method.
110
+ ## /parse Endpoint
93
111
 
94
- ### Usage
112
+ The /parse endpoint parses data from a specified payload and returns matched blocks or the entire chain if no query is included.
95
113
 
96
- It is used to retrieve blocks and chains, and also extract their properties.
114
+ ### Example Usage
97
115
 
98
116
  ```js
99
- initiator.parse(
100
- {
101
- physical_address: "Account/initiator/Datatypes/Number", // This points to a chain
102
- query: { blocks: 0 }, // Basically saying, index 0 block in physical_address chain, retrieve it.
103
- account: `public_key`,
117
+ account.parse({
118
+ payload: {
119
+ physical_address: "Accounts/name/path",
120
+ account: "account_id",
121
+ query: "blocks:0",
104
122
  },
105
- cb
106
- );
107
- // N.B If query isn't provided, then you parse the chain.
123
+ signature: "signature_string",
124
+ callback: () => {
125
+ // Callback function logic
126
+ },
127
+ });
108
128
  ```
109
129
 
110
- Type `method`
111
-
112
- | `Parameters` | Type | Destructure | Description |
113
- | ------------ | -------- | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
114
- | `payload` | object | `physical_address` | [`Physical Addresses`](https://godprotocol-web.vercel.app/physical_address) are logical namespace locations of tokens. They are derived from the high-level representation of the program's instructions. |
115
- | | object | `query` | A valid blockweb explorer query, you can read the explorer documentation [here](https://godprotocol-web.vercel.app/explorer) |
116
- | | string | `account` | Account instance to execute the instructions in. |
117
- | `cb` | function | | A function that is called with the blocks mined during the execution. |
130
+ | Parameters | Possible Values | Default Value | Type | Descriptions |
131
+ | -------------------------- | ----------------------------------------------------------------------------- | ------------- | ---------------------- | ------------------------------------------------------------------- |
132
+ | `payload` | `{ physical_address: "", account: "", query: "" }` | None | object | Object containing the physical address, account, and query details. |
133
+ | `payload.physical_address` | Any [`physical_address`](https://godprotocol-web.vercel.app/physical_address) | None | string | The physical address path for the account. |
134
+ | `payload.account` | Any string | None | string | Associated account for execution. |
135
+ | `payload.query` | [`Query Strings`](https://godprotocol-web.vercel.app/explorer/query) | None | string | Query string to specify blocks or other parameters. |
136
+ | `signature` | String | None | string | Optional. Signature for private account access. |
137
+ | `callback` | Function or `account.run{}` | None | `function` or `object` | Optional. Function to call upon execution completion. |
138
+
139
+ **Description:**
140
+ The /parse endpoint in the God Protocol framework parses data from the specified payload, which includes the physical address (`payload.physical_address`), associated account (`payload.account`), and an optional query (`payload.query`). If the account is private, a payload `signature` is required. An optional `callback` function can be provided to handle completion events, which may include further execution instructions (`account.run`). This endpoint returns the matched block to the callback if a query is included, or the entire chain of the path if no query is provided.
118
141
 
119
142
  See the [package source](https://github.com/immanuel-savvy/godprotocol.git) for more details.
120
143