From 4d9029057b96d491c76a0c8773636803fa3cfbd0 Mon Sep 17 00:00:00 2001 From: Nikolay Dorofeev Date: Tue, 14 Nov 2023 19:43:03 +0400 Subject: [PATCH] Deploy test post to test how it looks like on getgems --- .../scripts/deployDSocialNetworkAccount.ts | 24 ------ contracts/scripts/deployDSocialNetworkPost.ts | 22 ------ contracts/scripts/deployTestSocialNetwork.ts | 73 +++++++++++++++++++ 3 files changed, 73 insertions(+), 46 deletions(-) delete mode 100644 contracts/scripts/deployDSocialNetworkAccount.ts delete mode 100644 contracts/scripts/deployDSocialNetworkPost.ts create mode 100644 contracts/scripts/deployTestSocialNetwork.ts diff --git a/contracts/scripts/deployDSocialNetworkAccount.ts b/contracts/scripts/deployDSocialNetworkAccount.ts deleted file mode 100644 index d713fef0..00000000 --- a/contracts/scripts/deployDSocialNetworkAccount.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { toNano } from 'ton-core' -import { NetworkProvider } from '@ton-community/blueprint' -import { DSocialNetworkAccount } from '../wrappers/DSocialNetworkAccount' - -export async function run(provider: NetworkProvider) { - const dSocialNetworkAccount = provider.open( - await DSocialNetworkAccount.fromInit() - ) - - await dSocialNetworkAccount.send( - provider.sender(), - { - value: toNano('0.05') - }, - { - $$type: 'Deploy', - queryId: 0n - } - ) - - await provider.waitForDeploy(dSocialNetworkAccount.address) - - // run methods on `dSocialNetworkAccount` -} diff --git a/contracts/scripts/deployDSocialNetworkPost.ts b/contracts/scripts/deployDSocialNetworkPost.ts deleted file mode 100644 index c0db6579..00000000 --- a/contracts/scripts/deployDSocialNetworkPost.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { toNano } from 'ton-core' -import { NetworkProvider } from '@ton-community/blueprint' -import { DSocialNetworkPost } from '../wrappers/DSocialNetworkPost' - -export async function run(provider: NetworkProvider) { - const dSocialNetworkPost = provider.open(await DSocialNetworkPost.fromInit()) - - await dSocialNetworkPost.send( - provider.sender(), - { - value: toNano('0.05') - }, - { - $$type: 'Deploy', - queryId: 0n - } - ) - - await provider.waitForDeploy(dSocialNetworkPost.address) - - // run methods on `dSocialNetworkPost` -} diff --git a/contracts/scripts/deployTestSocialNetwork.ts b/contracts/scripts/deployTestSocialNetwork.ts new file mode 100644 index 00000000..571032ae --- /dev/null +++ b/contracts/scripts/deployTestSocialNetwork.ts @@ -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() + 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) +}