Skip to content

Commit

Permalink
Deploy test post to test how it looks like on getgems
Browse files Browse the repository at this point in the history
  • Loading branch information
d0rich committed Nov 14, 2023
1 parent 502dc25 commit 4d90290
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 46 deletions.
24 changes: 0 additions & 24 deletions contracts/scripts/deployDSocialNetworkAccount.ts

This file was deleted.

22 changes: 0 additions & 22 deletions contracts/scripts/deployDSocialNetworkPost.ts

This file was deleted.

73 changes: 73 additions & 0 deletions contracts/scripts/deployTestSocialNetwork.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { toNano, Dictionary } from 'ton-core'
import { NetworkProvider } from '@ton-community/blueprint'
import { DSocialNetworkMaster } from '../wrappers/DSocialNetworkMaster'
import {
DSocialNetworkAccount,
NftMetadataAttribute
} from '../wrappers/DSocialNetworkAccount'
import { DSocialNetworkPost } from '../wrappers/DSocialNetworkPost'

export async function run(provider: NetworkProvider) {
const dMaster = provider.open(await DSocialNetworkMaster.fromInit())

await dMaster.send(
provider.sender(),
{
value: toNano('0.05')
},
{
$$type: 'Deploy',
queryId: 0n
}
)

await provider.waitForDeploy(dMaster.address)

await dMaster.send(
provider.sender(),
{ value: toNano('0.5') },
{
$$type: 'RegisterAccount',
query_id: 0n,
account_name: 'test',
account_description: 'Test account description'
}
)

const accountAddress = await dMaster.getGetAccountAddressByIndex(0n)

const dAccount = provider.open(
DSocialNetworkAccount.fromAddress(accountAddress!)
)

await provider.waitForDeploy(dAccount.address)

const attributes = Dictionary.empty<bigint, NftMetadataAttribute>()
attributes.set(0n, {
$$type: 'NftMetadataAttribute',
trait_type: 'content',
value: 'This is my first post'
})

await dAccount.send(
provider.sender(),
{ value: toNano('0.5') },
{
$$type: 'MintNft',
query_id: 0n,
individual_content: {
$$type: 'NftMetadata',
name: 'Test post',
description: 'Test post description',
image: 'https://test.com/image.png',
content_url: 'https://test.com/content.txt',
attributes
}
}
)

const postAddress = await dAccount.getGetNftAddressByIndex(0n)

const dPost = provider.open(DSocialNetworkPost.fromAddress(postAddress!))
await provider.waitForDeploy(dPost.address)
}

0 comments on commit 4d90290

Please sign in to comment.