diff --git a/contracts/contracts/d_social_network_account.tact b/contracts/contracts/d_social_network_account.tact index d293a09e..4f8cea03 100644 --- a/contracts/contracts/d_social_network_account.tact +++ b/contracts/contracts/d_social_network_account.tact @@ -27,7 +27,7 @@ contract DSocialNetworkAccount with NftCollection, NftCollectionRoyaltyExtention image: "", name: "", description: "", - social_links: emptyMap() + social_links: "[]" }; } diff --git a/contracts/contracts/d_social_network_master.tact b/contracts/contracts/d_social_network_master.tact index e0262dea..59f3b77f 100644 --- a/contracts/contracts/d_social_network_master.tact +++ b/contracts/contracts/d_social_network_master.tact @@ -5,7 +5,7 @@ import "./messages_d.tact"; import "./d_social_network_account.tact"; contract DSocialNetworkMaster with Deployable, OwnableTransferable, Accounting { - version: String = "v0.0.1"; + version: String = "v0.0.1-metadata-arrays-as-json-string"; owner: Address; next_account_index: Int as uint32 = 0; @@ -57,7 +57,7 @@ contract DSocialNetworkMaster with Deployable, OwnableTransferable, Accounting image: "some-image-link", name: msg.account_name, description: msg.account_description, - social_links: emptyMap() + social_links: msg.social_links }; } } diff --git a/contracts/contracts/d_social_network_post.tact b/contracts/contracts/d_social_network_post.tact index 6279cee4..273e3a51 100644 --- a/contracts/contracts/d_social_network_post.tact +++ b/contracts/contracts/d_social_network_post.tact @@ -20,7 +20,7 @@ contract DSocialNetworkPost with NftItem { name: "", description: "", content_url: "", - attributes: emptyMap() + attributes: "[]" }; self.is_initialized = false; } diff --git a/contracts/contracts/lib/messages_nft.tact b/contracts/contracts/lib/messages_nft.tact index 7f658536..5922385e 100644 --- a/contracts/contracts/lib/messages_nft.tact +++ b/contracts/contracts/lib/messages_nft.tact @@ -10,7 +10,7 @@ struct NftCollectionMetadata { image: String; name: String; description: String; - social_links: map; + social_links: String; } message MintNft { @@ -49,7 +49,7 @@ struct NftMetadata { description: String; image: String; content_url: String; - attributes: map; + attributes: String; } message InitializeNft { diff --git a/contracts/contracts/messages_d.tact b/contracts/contracts/messages_d.tact index 03918567..4735bfe8 100644 --- a/contracts/contracts/messages_d.tact +++ b/contracts/contracts/messages_d.tact @@ -6,6 +6,7 @@ message RegisterAccount { query_id: Int as uint64; account_name: String; account_description: String; + social_links: String; } // Account contract diff --git a/contracts/scripts/deployTestSocialNetwork.ts b/contracts/scripts/deployTestSocialNetwork.ts index 571032ae..6ff60503 100644 --- a/contracts/scripts/deployTestSocialNetwork.ts +++ b/contracts/scripts/deployTestSocialNetwork.ts @@ -1,10 +1,7 @@ -import { toNano, Dictionary } from 'ton-core' +import { toNano } from 'ton-core' import { NetworkProvider } from '@ton-community/blueprint' import { DSocialNetworkMaster } from '../wrappers/DSocialNetworkMaster' -import { - DSocialNetworkAccount, - NftMetadataAttribute -} from '../wrappers/DSocialNetworkAccount' +import { DSocialNetworkAccount } from '../wrappers/DSocialNetworkAccount' import { DSocialNetworkPost } from '../wrappers/DSocialNetworkPost' export async function run(provider: NetworkProvider) { @@ -30,7 +27,8 @@ export async function run(provider: NetworkProvider) { $$type: 'RegisterAccount', query_id: 0n, account_name: 'test', - account_description: 'Test account description' + account_description: 'Test account description', + social_links: JSON.stringify(['https://d0rich.t.me/']) } ) @@ -42,13 +40,6 @@ export async function run(provider: NetworkProvider) { await provider.waitForDeploy(dAccount.address) - const attributes = Dictionary.empty() - attributes.set(0n, { - $$type: 'NftMetadataAttribute', - trait_type: 'content', - value: 'This is my first post' - }) - await dAccount.send( provider.sender(), { value: toNano('0.5') }, @@ -61,7 +52,9 @@ export async function run(provider: NetworkProvider) { description: 'Test post description', image: 'https://test.com/image.png', content_url: 'https://test.com/content.txt', - attributes + attributes: JSON.stringify([ + { trait_type: 'content', value: 'This is my first post' } + ]) } } ) diff --git a/contracts/tests/DSocialNetworkAccount.spec.ts b/contracts/tests/DSocialNetworkAccount.spec.ts index c4f988c3..403b9774 100644 --- a/contracts/tests/DSocialNetworkAccount.spec.ts +++ b/contracts/tests/DSocialNetworkAccount.spec.ts @@ -1,10 +1,7 @@ import { Blockchain, SandboxContract } from '@ton-community/sandbox' -import { toNano, Dictionary } from 'ton-core' +import { toNano } from 'ton-core' import { DSocialNetworkMaster } from '../wrappers/DSocialNetworkMaster' -import { - DSocialNetworkAccount, - NftMetadataAttribute -} from '../wrappers/DSocialNetworkAccount' +import { DSocialNetworkAccount } from '../wrappers/DSocialNetworkAccount' import '@ton-community/test-utils' import { DSocialNetworkPost } from '../wrappers/DSocialNetworkPost' @@ -41,7 +38,8 @@ describe('DSocialNetworkMaster', () => { $$type: 'RegisterAccount', query_id: 0n, account_name: 'test', - account_description: 'Test account description' + account_description: 'Test account description', + social_links: JSON.stringify(['https://d0rich.t.me/']) } ) @@ -69,12 +67,6 @@ describe('DSocialNetworkMaster', () => { }) it('should create post', async () => { - const attributes = Dictionary.empty() - attributes.set(0n, { - $$type: 'NftMetadataAttribute', - trait_type: 'content', - value: 'This is my first post' - }) const registerResult = await dAccount.send( deployer.getSender(), { value: toNano('0.5') }, @@ -87,7 +79,9 @@ describe('DSocialNetworkMaster', () => { description: 'Test post description', image: 'https://test.com/image.png', content_url: 'https://test.com/content.txt', - attributes + attributes: JSON.stringify([ + { trait_type: 'content', value: 'This is my first post' } + ]) } } ) diff --git a/contracts/tests/DSocialNetworkMaster.spec.ts b/contracts/tests/DSocialNetworkMaster.spec.ts index 1abea3d5..a51f570a 100644 --- a/contracts/tests/DSocialNetworkMaster.spec.ts +++ b/contracts/tests/DSocialNetworkMaster.spec.ts @@ -44,7 +44,8 @@ describe('DSocialNetworkMaster', () => { $$type: 'RegisterAccount', query_id: 0n, account_name: 'test', - account_description: 'Test account description' + account_description: 'Test account description', + social_links: JSON.stringify(['https://d0rich.t.me/']) } )