Skip to content

Commit

Permalink
Merge pull request #404 from permaweb/jfrain99/remove-tx2
Browse files Browse the repository at this point in the history
fix(weavedrive): remove tx2 data items
  • Loading branch information
jfrain99 authored Dec 4, 2024
2 parents fd79cc7 + ae26cf4 commit 3d4de37
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 434 deletions.
63 changes: 21 additions & 42 deletions extensions/weavedrive/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,33 @@
local drive = { _version = "0.0.1" }

function drive.getBlock(height)
local block = io.open("/block/" .. height)
if not block then
return nil, "Block Header not found!"
end
local headers = require('json').decode(
block:read(
block:seek('end')
)
)
block:close()
return headers
local block = io.open("/block/" .. height)
if not block then
return nil, "Block Header not found!"
end
local headers = require("json").decode(block:read(block:seek("end")))
block:close()
return headers
end

function drive.getTx(txId)
local file = io.open('/tx/' .. txId)
if not file then
return nil, "File not found!"
end
local contents = require('json').decode(
file:read(
file:seek('end')
)
)
file:close()
return contents
local file = io.open("/tx/" .. txId)
if not file then
return nil, "File not found!"
end
local contents = require("json").decode(file:read(file:seek("end")))
file:close()
return contents
end

function drive.getData(txId)
local file = io.open('/data/' .. txId)
if not file then
return nil, "File not found!"
end
local contents = file:read(
file:seek('end')
)
file:close()
return contents
local file = io.open("/data/" .. txId)
if not file then
return nil, "File not found!"
end
local contents = file:read(file:seek("end"))
file:close()
return contents
end

function drive.getDataItem(txId)
local file = io.open('/tx2/' .. txId)
if not file then
return nil, "File not found!"
end
local contents = file:read(
file:seek('end')
)
file:close()
return contents
end
return drive
Loading

0 comments on commit 3d4de37

Please sign in to comment.