2024-12-08 21:57:35 +03:00

30 lines
965 B
TypeScript

import { Address, beginCell, Cell, Contract, contractAddress, ContractProvider, Sender, SendMode } from '@ton/core';
export type BridgeConfig = {};
export function bridgeConfigToCell(config: BridgeConfig): Cell {
return beginCell().endCell();
}
export class Bridge implements Contract {
constructor(readonly address: Address, readonly init?: { code: Cell; data: Cell }) {}
static createFromAddress(address: Address) {
return new Bridge(address);
}
static createFromConfig(config: BridgeConfig, code: Cell, workchain = 0) {
const data = bridgeConfigToCell(config);
const init = { code, data };
return new Bridge(contractAddress(workchain, init), init);
}
async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) {
await provider.internal(via, {
value,
sendMode: SendMode.PAY_GAS_SEPARATELY,
body: beginCell().endCell(),
});
}
}