-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy test post to test how it looks like on getgems
- Loading branch information
Showing
3 changed files
with
73 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} |