Main.ts 920 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import {
  2. Address,
  3. beginCell,
  4. Cell,
  5. Contract,
  6. contractAddress,
  7. ContractProvider,
  8. Sender,
  9. SendMode,
  10. } from "@ton/core";
  11. export type MainConfig = {};
  12. export function mainConfigToCell(config: MainConfig): Cell {
  13. return beginCell().endCell();
  14. }
  15. export class Main implements Contract {
  16. constructor(
  17. readonly address: Address,
  18. readonly init?: { code: Cell; data: Cell }
  19. ) {}
  20. static createFromAddress(address: Address) {
  21. return new Main(address);
  22. }
  23. static createFromConfig(config: MainConfig, code: Cell, workchain = 0) {
  24. const data = mainConfigToCell(config);
  25. const init = { code, data };
  26. return new Main(contractAddress(workchain, init), init);
  27. }
  28. async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) {
  29. await provider.internal(via, {
  30. value,
  31. sendMode: SendMode.PAY_GAS_SEPARATELY,
  32. body: beginCell().endCell(),
  33. });
  34. }
  35. }