godprotocol
Version:
A distributed computing environment for Web 4.0 — integrating AI, decentralisation, and virtual computation.
44 lines (29 loc) • 1.3 kB
JavaScript
class Utils{
on = async(event_name, filter, handler) => {
}
reload = async(payload)=>{
let {address} = payload;
let res = await this.manager.oracle.read(`${address}/air`, {address, prefix: '.codes', account: this.physical_address})
await this.load({address: address.slice(this.physical_address.length+1), sequence: res, compiler: true, from_reload: true})
}
get_from_repo = async(address, options) =>{
address = `.storage/${this.physical_address}/${address}/__literal__`
let content = await this.manager.oracle.get_from_repos(address, {count: 1, args: options})
return content && JSON.parse(content)
}
set_to_repo = async(address, content, options) =>{
address = `.storage/${this.physical_address}/${address}/__literal__`
let response = await this.manager.oracle.set_to_repos(address, JSON.stringify(content), {count: 1, args: options})
return response
}
read_file = async(address) =>{
let content = await this.manager.oracle.read(address, {account: this.physical_address})
return content;
}
write_file = async(address, content)=>{
let res = await this.manager.oracle.write(address, JSON.stringify(content), {account: this.physical_address})
}
read = async(address, query)=>{
}
}
export default Utils