-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: messages as getter and init() parameters (#792)
- Loading branch information
1 parent
69ed55b
commit e132278
Showing
7 changed files
with
93 additions
and
1 deletion.
There are no files selected for viewing
Validating CODEOWNERS rules …
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
@tact-lang/compiler-reviewers | ||
* @tact-lang/compiler-reviewers | ||
|
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
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
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,17 @@ | ||
message InitData { | ||
seller: Address; | ||
nonce: Int as uint64; | ||
} | ||
|
||
contract Test { | ||
seller: Address; | ||
|
||
init(i: InitData) { | ||
self.seller = i.seller; | ||
} | ||
|
||
receive() { | ||
// deploy | ||
} | ||
} | ||
|
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
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,37 @@ | ||
import { toNano } from "@ton/core"; | ||
import { Blockchain, SandboxContract, TreasuryContract } from "@ton/sandbox"; | ||
import { InitData, Test } from "./contracts/output/init-of-message_Test"; | ||
import "@ton/test-utils"; | ||
|
||
describe("init-of-message", () => { | ||
let blockchain: Blockchain; | ||
let treasure: SandboxContract<TreasuryContract>; | ||
let contract: SandboxContract<Test>; | ||
|
||
beforeEach(async () => { | ||
blockchain = await Blockchain.create(); | ||
treasure = await blockchain.treasury("treasure"); | ||
|
||
const msg: InitData = { | ||
$$type: "InitData", | ||
seller: treasure.address, | ||
nonce: 0n, | ||
}; | ||
contract = blockchain.openContract(await Test.fromInit(msg)); | ||
|
||
const deployResult = await contract.send( | ||
treasure.getSender(), | ||
{ value: toNano("10") }, | ||
null, | ||
); | ||
|
||
expect(deployResult.transactions).toHaveTransaction({ | ||
from: treasure.address, | ||
to: contract.address, | ||
success: true, | ||
deploy: true, | ||
}); | ||
}); | ||
|
||
it("should deploy when given a message as init", async () => {}); | ||
}); |
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