|
| 1 | +<script lang="ts"> |
| 2 | + import { toNano, type Sender } from "ton-core"; |
| 3 | + import { Blockchain, type SandboxContract } from "@ton-community/sandbox"; |
| 4 | + import { getExample } from "$lib/helpers"; |
| 5 | + import store from "$lib/store"; |
| 6 | +
|
| 7 | + import markdown from "./content.md?raw"; |
| 8 | + import tactCode from "./contract.tact?raw"; |
| 9 | + import { Emit } from "./Emit"; |
| 10 | +
|
| 11 | + let sender: Sender; |
| 12 | + let contract: SandboxContract<Emit>; |
| 13 | +
|
| 14 | + $store = { |
| 15 | + markdown, |
| 16 | + tactCode, |
| 17 | + deploy: async () => { |
| 18 | + const blockchain = await Blockchain.create(); |
| 19 | + const deployer = await blockchain.treasury("deployer"); |
| 20 | + sender = deployer.getSender(); |
| 21 | + contract = blockchain.openContract(await Emit.fromInit()); |
| 22 | + const addresses = { |
| 23 | + [deployer.address.toString()]: "deployer", |
| 24 | + [contract.address.toString()]: "contract", |
| 25 | + }; |
| 26 | + return [[contract], addresses, [await contract.send(deployer.getSender(), { value: toNano(1) }, { $$type: "Deploy", queryId: 0n })]]; |
| 27 | + }, |
| 28 | + messages: { |
| 29 | + action: async () => { |
| 30 | + return [await contract.send(sender, { value: toNano(1) }, "action")]; |
| 31 | + }, |
| 32 | + transfer: async () => { |
| 33 | + return [await contract.send(sender, { value: toNano(1) }, "transfer")]; |
| 34 | + }, |
| 35 | + stake: async () => { |
| 36 | + return [await contract.send(sender, { value: toNano(1) }, "stake")]; |
| 37 | + }, |
| 38 | + }, |
| 39 | + getters: {}, |
| 40 | + prev: getExample(import.meta.url).prev, |
| 41 | + next: getExample(import.meta.url).next, |
| 42 | + }; |
| 43 | +</script> |
0 commit comments