Browse Source

lib_dependecies_update

master
AlexG 2 years ago
parent
commit
4d64c49945
  1. 10
      package.json
  2. 2
      sources/jetton.spec.ts
  3. 2
      sources/jetton.tact
  4. 48
      sources/utils/print.ts
  5. 11
      sources/utils/randomAddress.ts

10
package.json

@ -1,9 +1,9 @@
{
"name": "tact-template",
"name": "tact-jetton",
"version": "1.0.0",
"main": "index.js",
"repository": "https://github.com/ton-community/tact-template.git",
"author": "Steve Korshakov <steve@korshakov.com>",
"repository": "https://github.com/Reveloper/tact-jetton",
"author": "Alex Golev <flexorise@gmail.com>",
"license": "MIT",
"scripts": {
"build": "tact --config tact.config.json",
@ -18,9 +18,9 @@
"jest": "^29.3.1",
"prando": "^6.0.1",
"qs": "^6.11.0",
"ton": "^13.2.0",
"ton": "^13.3.0",
"ton-contract-executor": "^0.6.0",
"ton-core": "^0.36.1",
"ton-core": "^0.45.0",
"ton-crypto": "^3.2.0",
"ton-emulator": "^1.2.0",
"ton-nodejs": "^1.4.3",

2
sources/jetton.spec.ts

@ -1,6 +1,6 @@
import { toNano, beginCell } from "ton-core";
import { ContractSystem } from "ton-emulator";
import {SampleJetton, SampleJetton_init} from './output/jetton_SampleJetton';
import {SampleJetton} from './output/jetton_SampleJetton';
describe('jetton', () => {
it('should deploy', async () => {

2
sources/jetton.tact

@ -6,8 +6,6 @@ message Mint {
contract SampleJetton with Jetton {
// storage#_ balance:Grams owner_address:MsgAddressInt jetton_master_address:MsgAddressInt jetton_wallet_code:^Cell = Storage
totalSupply: Int as coins;
owner: Address;
content: Cell?;

48
sources/utils/print.ts

@ -1,48 +0,0 @@
import { Address, Cell, contractAddress, StateInit } from "ton";
import BN from 'bn.js';
import qs from 'qs';
export function printSeparator() {
console.log("========================================================================================");
}
export function printHeader(name: string) {
printSeparator();
console.log('Contract: ' + name);
printSeparator();
}
export function printAddress(address: Address, testnet: boolean = true) {
console.log("Address: " + address.toFriendly({ testOnly: testnet }));
console.log("Explorer: " + "https://" + (testnet ? 'testnet.' : '') + "tonwhales.com/explorer/address/" + address.toFriendly({ testOnly: testnet }));
printSeparator();
}
export function printDeploy(init: { code: Cell, data: Cell }, amount: BN, command: Cell | string, testnet: boolean = true) {
// Resolve target address
let to = contractAddress({ workchain: 0, initialCode: init.code, initialData: init.data });
// Resovle init
let cell = new Cell();
new StateInit(init).writeTo(cell);
let initStr = cell.toBoc({ idx: false }).toString("base64");
let link: string;
if (typeof command === 'string') {
link = `https://${testnet ? 'test.' : ''}tonhub.com/transfer/` + to.toFriendly({ testOnly: testnet }) + "?" + qs.stringify({
text: command,
amount: amount.toString(10),
init: initStr
});
} else {
link = `https://${testnet ? 'test.' : ''}tonhub.com/transfer/` + to.toFriendly({ testOnly: testnet }) + "?" + qs.stringify({
text: "Deploy contract",
amount: amount.toString(10),
init: initStr,
bin: command.toBoc({ idx: false }).toString('base64'),
});
}
console.log("Deploy: " + link);
printSeparator();
}

11
sources/utils/randomAddress.ts

@ -1,11 +0,0 @@
import Prando from "prando";
import { Address } from "ton";
export function randomAddress(workchain: number, seed: string) {
const random = new Prando(seed);
const hash = Buffer.alloc(32);
for (let i = 0; i < hash.length; i++) {
hash[i] = random.nextInt(0, 255);
}
return new Address(workchain, hash);
}
Loading…
Cancel
Save