Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"test": "jest"
},
"devDependencies": {
"@ton-community/blueprint": "^0.0.2",
"@ton-community/sandbox": "^0.2.0",
"@ton-community/test-utils": "^0.0.2",
"@ton/blueprint": "^0.24.0",
"@ton/sandbox": "^0.22.0",
"@ton/test-utils": "^0.4.2",
"@ton/core": "^0.59.0",
"@ton/crypto": "^3.3.0",
"@ton/ton": "^15.0.0",
"@types/jest": "^29.2.6",
"@types/node": "^18.11.18",
"jest": "^29.3.1",
"prettier": "^2.8.3",
"ton": "^13.3.0",
"ton-core": "^0.46.0",
"ton-crypto": "^3.2.0",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
Expand Down
4 changes: 2 additions & 2 deletions scripts/deployDistributor.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {Address, toNano} from 'ton-core'
import {Address, toNano} from '@ton/core'
import {Distributor} from '../wrappers/Distributor'
import {compile, NetworkProvider} from '@ton-community/blueprint'
import {compile, NetworkProvider} from '@ton/blueprint'

export async function run(provider: NetworkProvider) {
let myAddress = Address.parse('EQBhoQiXKyy4iFcbVHZ1s2YcdiuSEfwNdemBtm7eBNet4-in')
Expand Down
16 changes: 8 additions & 8 deletions tests/Distributor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {Blockchain} from '@ton-community/sandbox'
import {beginCell, Cell, SendMode, toNano} from 'ton-core'
import {Blockchain} from '@ton/sandbox'
import {beginCell, Cell, SendMode, toNano} from '@ton/core'
import {Distributor} from '../wrappers/Distributor'
import '@ton-community/test-utils'
import {compile} from '@ton-community/blueprint'
import {randomAddress} from "@ton-community/test-utils";
import '@ton/test-utils'
import {compile} from '@ton/blueprint'
import {randomAddress} from "@ton/test-utils";

function commentBody(comment: string) {
return beginCell()
Expand Down Expand Up @@ -74,21 +74,21 @@ describe('Distributor', () => {
const result = await sender.send({
to: distributor.address,
value: toNano('1'),
sendMode: SendMode.PAY_GAS_SEPARATLY,
sendMode: SendMode.PAY_GAS_SEPARATELY,
})

expect(result.transactions).toHaveTransaction({
from: distributor.address,
to: firstShareAddress,
value: (v) => v !== undefined && v > toNano('1') / 2n - toNano('0.01'),
body: (body) => body.equals(commentBody('first half'))
body: (body:any) => body.equals(commentBody('first half'))
})

expect(result.transactions).toHaveTransaction({
from: distributor.address,
to: secondShareAddress,
value: (v) => v !== undefined && v > toNano('1') / 2n - toNano('0.01'),
body: (body) => body.equals(commentBody('second half'))
body: (body:any) => body.equals(commentBody('second half'))
})
})

Expand Down
2 changes: 1 addition & 1 deletion wrappers/Distributor.compile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CompilerConfig} from '@ton-community/blueprint'
import {CompilerConfig} from '@ton/blueprint'

export const compile: CompilerConfig = {
targets: ['contracts/distributor.fc'],
Expand Down
10 changes: 5 additions & 5 deletions wrappers/Distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DictionaryValue,
Sender,
SendMode, toNano
} from "ton-core";
} from "@ton/core";
import {crc32, crc32str} from "../utils/crc32";

export type DistributorShare = {
Expand Down Expand Up @@ -94,31 +94,31 @@ export class Distributor implements Contract {
async sendDeploy(provider: ContractProvider, via: Sender, value: bigint) {
await provider.internal(via, {
value,
sendMode: SendMode.PAY_GAS_SEPARATLY,
sendMode: SendMode.PAY_GAS_SEPARATELY,
body: beginCell().endCell(),
})
}

async sendUpdateData(provider: ContractProvider, via: Sender, newData: Cell) {
await provider.internal(via, {
value: toNano('0.05'),
sendMode: SendMode.PAY_GAS_SEPARATLY,
sendMode: SendMode.PAY_GAS_SEPARATELY,
body: beginCell().storeUint(crc32str('op::update_data'), 32).storeRef(newData).endCell(),
})
}

async sendUpdateCode(provider: ContractProvider, via: Sender, newCode: Cell) {
await provider.internal(via, {
value: toNano('0.05'),
sendMode: SendMode.PAY_GAS_SEPARATLY,
sendMode: SendMode.PAY_GAS_SEPARATELY,
body: beginCell().storeUint(crc32str("op::update_code"), 32).storeRef(newCode).endCell(),
})
}

async sendTopup(provider: ContractProvider, via: Sender, value: bigint) {
await provider.internal(via, {
value,
sendMode: SendMode.PAY_GAS_SEPARATLY,
sendMode: SendMode.PAY_GAS_SEPARATELY,
body: beginCell().storeUint(crc32str("op::topup"), 32).endCell(),
})
}
Expand Down