Skip to content

Commit 984f1ea

Browse files
fix(initialize): add logo to initialize util
1 parent dbc3ec5 commit 984f1ea

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

spec/ant_spec.lua

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ local originalState = {
1515
records = { ["@"] = { transactionId = fake_address, ttlSeconds = 900 } },
1616
balances = { [fake_address] = 1 },
1717
owner = fake_address,
18+
logo = string.rep("1", 43),
1819
}
1920

2021
describe("Arweave Name Token", function()
@@ -40,6 +41,7 @@ describe("Arweave Name Token", function()
4041
assert.are.same(_G.Ticker, originalState.ticker)
4142
assert.are.same(_G.Description, originalState.description)
4243
assert.are.same(_G.Keywords, originalState.keywords)
44+
assert.are.same(_G.Logo, originalState.logo)
4345
end)
4446

4547
it("Transfers tokens between accounts", function()

src/common/initialize.lua

+7
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ local initialize = {}
1212
--- owner: string,
1313
--- controllers: string[],
1414
--- records: table<string, Record>,
15+
--- logo: string,
1516
---}
1617

1718
--- Initializes the ANT state from a JSON string
@@ -27,6 +28,8 @@ function initialize.initializeANTState(state)
2728
local description = encoded.description
2829
local keywords = encoded.keywords
2930
local owner = encoded.owner
31+
local logo = encoded.logo or ""
32+
3033
assert(type(name) == "string", "name must be a string")
3134
assert(type(ticker) == "string", "ticker must be a string")
3235
assert(type(description) == "string", "description must be a string")
@@ -38,6 +41,8 @@ function initialize.initializeANTState(state)
3841
assert(type(controllers) == "table", "controllers must be a table")
3942
assert(type(records) == "table", "records must be a table")
4043
assert(type(owner) == "string", "owner must be a string")
44+
assert(type(logo) == "string", "logo must be a string")
45+
4146
for k, v in pairs(records) do
4247
utils.validateUndername(k)
4348
assert(type(v) == "table", "records values must be tables")
@@ -56,6 +61,7 @@ function initialize.initializeANTState(state)
5661
Records = records
5762
Initialized = true
5863
Owner = owner
64+
Logo = logo
5965

6066
return json.encode({
6167
name = Name,
@@ -67,6 +73,7 @@ function initialize.initializeANTState(state)
6773
records = Records,
6874
owner = Owner,
6975
initialized = Initialized,
76+
logo = Logo,
7077
})
7178
end
7279

test/boot.test.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ describe('BOOT ANT', async () => {
2424
);
2525
}
2626
const antState = {
27+
logo: 'logo'.padEnd(43, '1'),
2728
name: 'Test Process',
2829
ticker: 'TEST',
2930
description: 'TEST DESCRIPTION',
@@ -81,6 +82,7 @@ describe('BOOT ANT', async () => {
8182
assert.strictEqual(state.Ticker, antState.ticker);
8283
assert.strictEqual(state.Name, antState.name);
8384
assert.strictEqual(state.Owner, antState.owner);
85+
assert.strictEqual(state.Logo, antState.logo);
8486
assert.deepEqual(state.Controllers, antState.controllers);
8587
assert.deepEqual(state.Keywords, antState.keywords);
8688
assert.deepEqual(state.Balances, antState.balances);

0 commit comments

Comments
 (0)