godprotocol 1.1.32 → 1.2.1

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.
Files changed (71) hide show
  1. package/Datatypes/arr.js +559 -254
  2. package/Datatypes/bool.js +8 -5
  3. package/Datatypes/callable.js +1 -1
  4. package/Datatypes/cls.js +193 -24
  5. package/Datatypes/conf.js +2 -2
  6. package/Datatypes/err.js +25 -0
  7. package/Datatypes/func.js +89 -13
  8. package/Datatypes/functions/storage.js +572 -12
  9. package/Datatypes/functions/wallet.js +49 -0
  10. package/Datatypes/instance.js +87 -122
  11. package/Datatypes/num.js +192 -153
  12. package/Datatypes/str.js +188 -122
  13. package/Datatypes/twa.js +346 -71
  14. package/Datatypes/voi.js +9 -4
  15. package/Index.js +1 -1
  16. package/Instances/account.js +0 -0
  17. package/Instances/event.js +0 -0
  18. package/Instances/fold.js +103 -0
  19. package/Instances/folder_queries.js +46 -0
  20. package/Instances/response.js +31 -0
  21. package/Objects/Account.js +160 -110
  22. package/Objects/Blockweb.js +6 -11
  23. package/Objects/Callable.js +223 -188
  24. package/Objects/Chain.js +127 -142
  25. package/Objects/Datatypes.js +114 -588
  26. package/Objects/Manager.js +349 -39
  27. package/Objects/Oracle.js +287 -210
  28. package/Objects/Repository.js +12 -33
  29. package/Objects/Trinity.js +9 -7
  30. package/Objects/Utils.js +8 -8
  31. package/Objects/Virtual_machine.js +320 -320
  32. package/README.md +0 -0
  33. package/callables/functions/assert.js +10 -0
  34. package/callables/functions/display.js +2 -3
  35. package/callables/functions/env.js +5 -0
  36. package/callables/functions/event.js +14 -0
  37. package/callables/functions/exit.js +3 -2
  38. package/callables/functions/folder.js +15 -0
  39. package/callables/functions/get_uid.js +6 -0
  40. package/callables/functions/hash.js +7 -0
  41. package/callables/functions/import_.js +62 -0
  42. package/callables/functions/local.js +9 -0
  43. package/callables/functions/net.js +33 -18
  44. package/callables/functions/parse.js +35 -0
  45. package/callables/functions/query.js +12 -0
  46. package/callables/functions/render.js +9 -13
  47. package/callables/functions/servers.js +10 -0
  48. package/callables/functions/spawn.js +7 -0
  49. package/callables/functions/store.js +75 -0
  50. package/callables/functions/super_.js +24 -0
  51. package/callables/functions/typeof.js +32 -0
  52. package/callables/functions/wait.js +9 -0
  53. package/callables/register.js +193 -8
  54. package/html/create.js +110 -0
  55. package/html/index.js +114 -0
  56. package/html/load.js +165 -0
  57. package/html/parse.js +171 -0
  58. package/html/run.js +151 -0
  59. package/html/util.js +5 -0
  60. package/package.json +5 -3
  61. package/repos/fs.js +114 -0
  62. package/repos/github.js +73 -0
  63. package/repos/ram.js +47 -0
  64. package/utils/create_server.js +66 -26
  65. package/utils/hash.js +3 -2
  66. package/utils/ops.js +2 -0
  67. package/utils/oracle_handlers.js +7 -0
  68. package/utils/services.js +18 -51
  69. package/utils/socket_server.js +36 -0
  70. package/utils/vm_utils.js +241 -137
  71. package/callables/functions/assign.js +0 -6
package/Objects/Oracle.js CHANGED
@@ -1,268 +1,345 @@
1
- import fs from "fs";
2
- import { hash } from "../utils/hash";
3
-
1
+ import Fs from "godprotocol/repos/fs.js";
2
+ import Github from "godprotocol/repos/github.js";
3
+ import Handlers from "godprotocol/utils/oracle_handlers.js";
4
+ import { post_request } from "godprotocol/utils/services.js";
5
+
6
+ class Oracle extends Handlers{
7
+ constructor(server, mirror) {
8
+ super();
9
+
10
+ this.server = server
11
+ this.mirror = mirror;
12
+ this.repos = new Array()
13
+ this.remotes = new Array()
14
+ }
4
15
 
5
- class Fs {
6
- constructor(oracle) {
7
- this.oracle = oracle;
16
+ add_repo = async (repository)=>{
17
+ let {filter, repo} = repository
18
+ if (await this.get_repo(repo.type, repo.options.name))
19
+ return;
8
20
 
9
- this.fs = fs;
10
- this.base = __dirname;
11
- }
21
+ switch(repo.type){
22
+ case 'fs':
23
+ repo = new Fs(repo.options)
24
+ break
25
+ case 'github':
26
+ repo = new Github(repo.options)
27
+ break
28
+ }
29
+ this.repos.push({filter, repo})
12
30
 
13
- is_directory=async path=>{
14
- if(!await this.exists(path, {pure:true}))return false;
31
+ if(!this.manager) return;
32
+ if (this.server_match(this.manager.server, this.server)){
33
+ for (let r=0; r< this.remotes.length; r++){
34
+ let remote = this.remotes[r]
15
35
 
16
- try {
17
- const stats = this.fs.statSync(`${this.base}/${path}`);
18
- return stats.isDirectory();
19
- } catch (err) {
20
- // console.error(`Error checking path: ${err.message}`);
21
- return false; // Handle error, e.g., path doesn't exist
36
+ await this.fetch({
37
+ method: 'add_repo',
38
+ arg: {...repo}
39
+ }, remote)
40
+ }
41
+ } else {
42
+ await this.fetch({
43
+ method: 'add_repo',
44
+ arg: {...repo}
45
+ }, this.server)
22
46
  }
23
47
  }
24
48
 
25
- exists = async (path, options={}) => {
26
- return this.fs.existsSync(`${this.base}/${path}`);
27
- };
28
-
29
- mkdir = async (path) => {
30
- path = `${this.base}/${path}`;
49
+ call = async(payload)=>{
50
+ let {method, arg} = payload, result = {};
51
+
52
+ switch(method){
53
+ case 'update_servers':
54
+ let addr = `.oracle/${arg.account}/.configs`
55
+ let servers = await this.get_from_repos(addr)
56
+ if (servers){
57
+ servers = JSON.parse(servers)
58
+ if (servers.find(s=>this.server_match(s, arg.server))){
59
+ return
60
+ }
61
+ servers.push(arg.server)
62
+ }else servers = [arg.server]
63
+
64
+ await this.set_to_repos(addr, JSON.stringify(servers))
65
+ break;
66
+ case 'update_accounts':
67
+ let a_addr = `.oracle/${arg.address}/.configs`
68
+ let accs = await this.get_from_repos(a_addr)
69
+ if (accs){
70
+ accs = JSON.parse(accs)
71
+ if (accs.includes(arg.account)){
72
+ return
73
+ }
74
+ accs.push(arg.account)
75
+ }else accs = [arg.account]
76
+
77
+ await this.set_to_repos(a_addr, JSON.stringify(accs))
78
+ break
79
+ case 'get_accounts':
80
+ result = this.get_accounts(arg.address, true)
81
+ break
82
+ case 'get_servers':
83
+ result = this.get_servers(arg.account, true)
84
+ break
85
+ case 'write':
86
+ await this.set_to_repos(`${arg.prefix}/${arg.path}`, arg.content)
87
+ break;
88
+ case 'read':
89
+ let res = await this.get_from_repos(`${arg.prefix}/${arg.path}`)
90
+ result = {content: res}
91
+ break;
92
+ case 'fs':
93
+ let repo = await this.get_repo('fs', arg.name)
94
+ result = await repo.call(arg.payload)
95
+ break
96
+ case 'sync':
97
+ let repos = this.string_repos()
98
+ await this.push_remote(arg.manager_server)
99
+ result = {repos}
100
+ break
101
+ case 'add_repo':
102
+ await this.add_repo(arg)
103
+ break
104
+ }
31
105
 
32
- !(await this.exists(path, {pure:true})) && this.fs.mkdirSync(path, { recursive: true });
33
- };
106
+ return result
107
+ }
34
108
 
35
- read = async(path)=>{
36
- let content;
37
- try{
38
- content = this.fs.readFileSync(`${this.base}/${path}`, {encoding:'utf-8'})
39
- content = JSON.parse(content)
40
- }catch(e){}
109
+ push_remote = async(remote)=>{
110
+ if (this.remotes.find(rem=>this.server_match(rem, remote))) return;
41
111
 
42
- return content;
112
+ this.remotes.push(remote)
43
113
  }
44
114
 
45
- retrieve = async(path, options)=>{
46
- let config, result;
47
- if (options.current){
48
- config = {current: path}
49
- }else{
50
- config = await this.read(`${path}/.config`) || {};
51
-
52
- if (!config.current) {
53
- if (options.config){
54
- return
55
- }
56
- }
57
- }
58
-
59
- if (options.sibling){
60
- if (config.sibling){
61
- let res = await this.read(`${config.sibling}`)
62
- result = res.content
63
- }
64
- }else{
65
- if (config.current){
66
- let res = await this.read(`${config.current}/.config`)
67
-
68
- let value = await this.read(`${config.current}/${res.index-1}`)
69
- if(!value && res.current && !res.current.includes('/')){
70
- value = await this.read(`${config.current}/${res.current}`)
71
- }
72
- if(options.config){
73
- result = typeof value.content === 'string'? JSON.parse(value.content): value.content;
74
- }
75
- }
115
+ string_repos = ()=>{
116
+ let repos = new Array();
117
+ for(let r=0; r< this.repos.length; r++){
118
+ let {filter, repo} = this.repos[r];
119
+ repos.push({filter, repo:{type: repo.type, options: repo.objectify()}})
76
120
  }
121
+ return repos;
122
+ }
77
123
 
78
- return result
124
+ get_repo = async(type, name) => {
125
+ for (let r=0; r< this.repos.length; r++){
126
+ let {repo} = this.repos[r]
127
+
128
+ if (repo.type === type && repo.name === name)
129
+ return repo
130
+ }
79
131
  }
80
132
 
81
- write = async(path, content, options={})=>{
82
- let addr;
83
- if (options.config){
84
- await this.mkdir(path);
85
-
86
- let conf_path = `${path}/.config`
87
- let hash = await this.oracle.hash(content)
88
- let conf = await this.read(conf_path) || {index: 0}
89
- let obj = {content, sibling: conf.current}
90
- let current = `${path}/${hash}`
91
- conf.current = current;
92
- await this.write(conf_path, JSON.stringify(conf))
93
-
94
- await this.mkdir(current)
95
- let current_conff = `${current}/.config`
96
- let conff = await this.read(current_conff) || {index: 0}
97
- await this.write(`${current}/${conff.index}`, JSON.stringify(obj))
98
- conff.index++
99
-
100
- await this.write(current_conff, JSON.stringify(conff))
101
- addr = current
102
- }else {
103
- this.fs.writeFileSync(`${this.base}/${path}`, content)
104
- addr = path;
133
+ fetch = async(payload, server)=>{
134
+ let res;
135
+ try{
136
+ res = await post_request({
137
+ options: {
138
+ ...server,
139
+ path: '/oracle'
140
+ },
141
+ data: JSON.stringify(payload)
142
+ })
143
+ }catch(e){
144
+ console.log(e)
105
145
  }
106
146
 
107
- return addr;
147
+ return res;
108
148
  }
109
149
 
110
- store = async(content, {path, type, hash: hash_, is_instance})=>{
111
- if (!type) type = this.oracle.get_type(content)
150
+ set_to_repos = async(address, content)=>{
151
+ for (let r=0; r< this.repos.length; r++){
152
+ let repo = this.repos[r]
112
153
 
113
- let result, hash = hash_;
114
- switch(type){
115
- case 'array':
116
- hash = hash || await this.oracle.hash(content)
117
- let arr_path = `${path}/${hash}`
118
- await this.mkdir(arr_path)
154
+ if (!repo.filter || address.match(repo.filter)){
155
+ await repo.repo.write_file(address, content)
156
+ }
157
+ }
158
+ }
119
159
 
120
- let arr = []
121
- for (let i=0; i< content.length; i++){
122
- let item = content[i]
160
+ get_from_repos = async(address)=>{
161
+ for (let r=0; r< this.repos.length; r++){
162
+ let repo = this.repos[r]
163
+
164
+ if (!repo.filter || address.match(repo.filter)){
165
+ let content = await repo.repo.read_file(address)
166
+ if (content) return content;
167
+ }
168
+ }
169
+ }
123
170
 
124
- let item_path = `${arr_path}/${i}`
125
- await this.mkdir(item_path)
126
- item = await this.store(item, {path: item_path})
171
+ read = async(path, options={})=>{
172
+ let {address, account, prefix} = options;
173
+ prefix = prefix || '.storage'
127
174
 
128
- let conf = await this.read(`${item_path}/.config`)
129
- if(!conf) conf = {index:0}
130
- else conf.index++
175
+ let has = (await this.get_accounts(address)).includes(account)
176
+
177
+ if(!has) return;
178
+
179
+ let servers = await this.get_servers(account)
180
+ for (let s=0; s< servers.length; s++){
181
+ let server = servers[s]
182
+ if (this.server_match(server, this.server)){
183
+ let res = await this.fetch({
184
+ method: 'read',
185
+ arg: {path, prefix}
186
+ }, server)
187
+
188
+ if(res && res.content){
189
+ return res.content
190
+ }else break;
191
+ }
192
+ }
193
+ for (let s=0; s< servers.length; s++){
194
+ let server = servers[s]
195
+ if (this.server_match(server, this.server)){
196
+ continue
197
+ }
131
198
 
132
- await this.write(`${item_path}/${conf.index}`, item)
133
- await this.write(`${item_path}/.config`, JSON.stringify(conf));
199
+ let res = await this.fetch({
200
+ method: 'read',
201
+ arg: {path, prefix}
202
+ }, server)
203
+ if(res && res.content){
204
+ return res.content
205
+ }
206
+ }
207
+ }
134
208
 
135
- arr.push(conf.index)
136
- }
137
- let aconf = await this.read(`${path}/.config`) || {}
138
- let arr_hash = await this.oracle.hash(arr)
139
- let arr_conf = await this.read(`${arr_path}/.config`) || {index: 0}
140
- await this.write(`${arr_path}/${arr_hash}`, JSON.stringify({content:arr, type: is_instance? 'instance': type, previous: arr_conf.current, indice: aconf.indice}))
141
- arr_conf.current = arr_hash
142
- arr_conf.sibling = aconf.current;
209
+ write = async(path, content, options={})=>{
210
+ let {account, address, prefix} = options
211
+ prefix = prefix || '.storage'
143
212
 
144
- await this.write(`${arr_path}/.config`, JSON.stringify(arr_conf));
213
+ await this.update_accounts(address, account)
214
+ let servers = await this.get_servers(account)
145
215
 
146
- aconf.current = arr_path;
147
- await this.write(`${path}/.config`, JSON.stringify(aconf))
148
-
149
- result = arr_path
216
+ for (let s=0; s< servers.length; s++){
217
+ let server = servers[s]
150
218
 
151
- break;
152
- case 'twain':
153
- hash = hash || await this.oracle.hash(content)
154
- let twa_path = `${path}/${hash}`
155
- await this.mkdir(twa_path)
156
-
157
- let twa = {}
158
- for (let prop in content){
159
- let value = content[prop];
160
- let p_hash = await this.oracle.hash(prop)
161
- let pair_path = `${twa_path}/${p_hash}`
162
- await this.mkdir(pair_path)
163
- let p_addr = await this.store(prop, {path: pair_path})
164
- let val_addr = await this.store(value, {path: pair_path})
165
-
166
- let pair = [p_addr, val_addr]
167
-
168
- let conf = await this.read(`${pair_path}/.config`)
169
- if (!conf){
170
- conf = {index: 0}
171
- }else if (!Object.keys(conf).includes('index'))conf.index = 0
172
- else {
173
- conf.index++
174
- }
175
-
176
- await this.write(`${pair_path}/${conf.index}`, JSON.stringify(pair))
219
+ await this.fetch({
220
+ method: 'write',
221
+ arg: {path, content, prefix}
222
+ }, server)
223
+ }
224
+ }
177
225
 
178
- twa[p_hash] = conf.index;
179
- await this.write(`${pair_path}/.config`, JSON.stringify(conf));
180
- }
181
-
182
- let pconf = await this.read(`${path}/.config`) || {}
226
+ get_servers = async(account, mirroring)=>{
227
+ let addr = `.oracle/${account}/.configs`
228
+ let servers = await this.get_from_repos(addr)
229
+ servers = servers ? JSON.parse(servers) : []
230
+
231
+ if(!mirroring && !servers.length && this.mirror){
232
+ servers = await this.fetch({
233
+ method: 'get_servers',
234
+ arg: {account}
235
+ }, this.mirror)
236
+ if (servers.length){
237
+ await this.set_to_repos(addr, JSON.stringify(servers))
238
+ await this.update_servers(account, [...servers])
239
+ }
240
+ }
241
+ return servers
242
+ }
183
243
 
184
- let twa_hash = await this.oracle.hash(twa)
185
- let twa_conf = await this.read(`${twa_path}/.config`) || {index: 0}
186
- await this.write(`${twa_path}/${twa_hash}`, JSON.stringify({content:twa, type: is_instance? 'instance': type, previous: twa_conf.current, indice: pconf.indice}))
187
- twa_conf.current = twa_hash
188
- twa_conf.sibling = pconf.current;
244
+ update_servers = async(account, servers)=>{
245
+ servers = servers || await this.get_servers(account)
246
+
247
+ if (servers.find(s=>this.server_match(s, this.server))){
248
+ return
249
+ }
189
250
 
190
- await this.write(`${twa_path}/.config`, JSON.stringify(twa_conf));
251
+ servers.push(this.server)
252
+ for (let s=0; s< servers.length; s++){
253
+ let server = servers[s]
191
254
 
192
- pconf.current = twa_path;
193
- await this.write(`${path}/.config`, JSON.stringify(pconf))
194
-
195
- result = twa_path
196
- break;
197
- case 'string':
198
- hash = await this.oracle.hash(content)
199
- result = await this.write(`${path}/${hash}`, content)
200
- break
201
- case 'number':
202
- hash = await this.oracle.hash(`0${content}`)
203
- result = await this.write(`${path}/${hash}`, JSON.stringify(content))
204
- break
205
- case 'boolean':
206
- hash = await this.oracle.hash(`0${content}`)
207
- result = await this.write(`${path}/${hash}`, JSON.stringify(content))
208
- break
255
+ await this.fetch({
256
+ method: 'update_servers',
257
+ arg: {account, server: this.server},
258
+ }, server)
209
259
  }
210
260
 
211
- return result;
261
+ return servers
212
262
  }
213
- }
214
263
 
215
- class Oracle {
216
- constructor(manager) {
264
+ get_accounts = async(address, mirroring)=>{
265
+ let addr = `.oracle/${address}/.configs`
266
+ let accounts = await this.get_from_repos(addr)
267
+
268
+ accounts = accounts ? JSON.parse(accounts) : []
217
269
 
218
- this.manager = manager;
270
+ if (!mirroring && !accounts.length && this.mirror){
271
+ accounts = await this.fetch({
272
+ method: 'get_accounts',
273
+ arg: {address}
274
+ }, this.mirror)
275
+ }
219
276
 
220
- this.fs = new Fs(this);
277
+ return accounts
221
278
  }
222
279
 
223
- read = async(path, options)=>{
224
- let result = await this.fs.retrieve(path, options)
280
+ update_accounts = async(address, account)=>{
281
+ let accounts = await this.get_accounts(address)
282
+
283
+ if (accounts.includes(account)){
284
+ return
285
+ }
225
286
 
226
- return result;
227
- }
287
+ accounts.push(account)
228
288
 
229
- write = async(path, content, options={})=>{
230
- let type = this.get_type(content), addr;
289
+ let servers = await this.get_servers_from_address(address, accounts)
290
+
291
+ for (let s=0; s< servers.length; s++){
292
+ let server = servers[s]
231
293
 
232
- if(options.config){
233
- return await this.fs.write(path, JSON.stringify(content), {config: true})
294
+ await this.fetch({
295
+ method: 'update_accounts',
296
+ arg: {address, account},
297
+ }, server)
234
298
  }
235
299
 
236
- if (options.hash) path = `${path}/${options.hash}`
300
+ return accounts
301
+ }
237
302
 
238
- addr = await this.fs.store(content, {path, type, has_hash: options.hash, is_instance: options.is_instance})
303
+ get_servers_from_address = async(address, accounts)=>{
304
+ accounts = accounts || await this.get_accounts(address)
305
+
306
+ let servers = []
307
+ for (let a=0; a< accounts.length; a++){
308
+ let acc = accounts[a]
309
+ let servers_ = await this.get_servers(acc)
310
+ servers_.map(serv=>{
311
+ if(!servers.find(s=>this.server_match(s, serv)))
312
+ servers.push(serv)
313
+ })
314
+ }
239
315
 
240
- return addr;
316
+ return servers
241
317
  }
242
318
 
243
- hash = async(value, alg)=>{
244
- if (typeof value !== 'string')value = JSON.stringify(value)
245
-
246
- return hash(value, alg)
319
+ server_match = (s1, s2)=>{
320
+ return s1.hostname === s2.hostname && s1.port === s2.port
247
321
  }
248
322
 
249
- sync = async () => {
250
- this.manager.path = `${this.manager.trinity.game}/${this.manager.name}`;
251
- await this.fs.mkdir(this.manager.path)
252
- };
253
-
254
- get_type = (content)=>{
255
- let type = typeof content;
323
+ set_manager = async(manager)=>{
324
+ console.log(`Manager:${manager.name} Oracle running at ${this.server.hostname}:${this.server.port}`)
256
325
 
257
- if (content == null) return 'void'
258
-
259
- if (type === 'object'){
260
- if (Array.isArray(content)) type = 'array'
261
- else if (!content) type = 'void'
262
- else type = 'twain'
326
+ if (!this.server_match(this.server, manager.server)){
327
+ let response = await this.fetch({
328
+ method: 'sync',
329
+ arg: {manager_server: manager.server}
330
+ }, this.server)
331
+
332
+ for (let r=0; r< response.repos.length; r++){
333
+ let repository = response.repos[r]
334
+
335
+ await this.add_repo(repository)
336
+ }
263
337
  }
264
- return type;
265
338
  }
339
+
340
+ sync = async () => {
341
+
342
+ };
266
343
  }
267
344
 
268
345
  export default Oracle;
@@ -1,38 +1,17 @@
1
- import { get_request, post_request } from "../utils/services";
2
-
3
- class Repository {
4
- constructor(manager) {
5
- this.manager = manager;
6
-
7
- this.gds = this.manager.oracle.gds;
1
+ class Repository{
2
+ constructor(){
8
3
  }
9
4
 
10
- read_address = async (address) => {
11
- let content = await this.manager.oracle.fs.read_file(`${address}`);
12
-
13
- try {
14
- content = JSON.parse(content);
15
- } catch (err) {}
16
-
17
- return content;
18
- };
5
+ objectify = ()=>{
6
+ let obj = {}
7
+ if (this.type === 'fs'){
8
+ obj.name = this.name;
9
+ obj.remote = this.remote
10
+ obj.__dirname = this.__dirname
11
+ }
19
12
 
20
- sync = async () => {
21
- };
22
-
23
- create_or_update_file = async (path, content, message, sha) => {
24
-
25
- };
26
-
27
- get_file_sha = async (path) => {
28
-
29
- };
30
-
31
- write_file = async (path, content, message = "") => {
32
- await this.manager.oracle.fs.write_file(path, content)
33
-
34
- return path
35
- };
13
+ return obj
14
+ }
36
15
  }
37
16
 
38
- export default Repository;
17
+ export default Repository;
@@ -1,4 +1,4 @@
1
- import Manager from "./Manager";
1
+ import Manager from "./Manager.js";
2
2
 
3
3
  class Trinity {
4
4
  constructor(game) {
@@ -7,18 +7,20 @@ class Trinity {
7
7
  }
8
8
 
9
9
  add_manager = async (name, options) => {
10
+ let mgr = this.managers[name];
11
+ if(mgr) return manager
12
+
10
13
  let manager = new Manager(name, {...options, trinity: this});
11
- let mgrs = this.managers[name];
12
- if (!mgrs) {
13
- mgrs = new Array();
14
- this.managers[name] = mgrs;
15
- }
16
14
  await manager.sync();
17
15
 
18
- mgrs.push(manager);
16
+ this.managers[name] = manager;
19
17
 
20
18
  return manager;
21
19
  };
20
+
21
+ get_manager = (name)=>{
22
+ return this.managers[name]
23
+ }
22
24
  }
23
25
 
24
26
  export default Trinity;
package/Objects/Utils.js CHANGED
@@ -1,14 +1,14 @@
1
1
  class Utils{
2
- constructor(){}
3
-
4
- resolve_addr = (addr)=>{
5
- if (!addr)return addr;
2
+ on = async(event_name, filter, handler) => {
3
+
4
+ }
6
5
 
7
- if (!addr.startsWith(this.physical_address)){
8
- addr = `${this.physical_address}/${addr}`
9
- }
6
+ reload = async(payload)=>{
7
+ let {address} = payload;
10
8
 
11
- return addr;
9
+ let res = await this.manager.oracle.read(`${address}/air`, {address, prefix: '.codes', account: this.physical_address})
10
+
11
+ await this.load({address: address.slice(this.physical_address.length+1), sequence: res, compiler: true, from_reload: true})
12
12
  }
13
13
  }
14
14