New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ton/ton

Package Overview
Dependencies
Maintainers
4
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ton/ton - npm Package Compare versions

Comparing version 15.1.0 to 15.2.0

dist/utils/testWallets.d.ts

5

dist/client/api/HttpApi.d.ts

@@ -443,2 +443,7 @@ /**

balance: string | number;
extra_currencies: {
'@type': "extraCurrency";
id: number;
amount: string;
}[];
state: "active" | "uninitialized" | "frozen";

@@ -445,0 +450,0 @@ last_transaction_id: {

@@ -29,2 +29,7 @@ "use strict";

balance: zod_1.z.union([zod_1.z.number(), zod_1.z.string()]),
extra_currencies: zod_1.z.array(zod_1.z.object({
'@type': zod_1.z.literal("extraCurrency"),
id: zod_1.z.number(),
amount: zod_1.z.string()
})),
state: zod_1.z.union([zod_1.z.literal('active'), zod_1.z.literal('uninitialized'), zod_1.z.literal('frozen')]),

@@ -31,0 +36,0 @@ data: zod_1.z.string(),

@@ -200,2 +200,7 @@ /**

balance: bigint;
extra_currencies: {
'@type': "extraCurrency";
id: number;
amount: string;
}[];
state: "active" | "uninitialized" | "frozen";

@@ -202,0 +207,0 @@ code: Buffer | null;

@@ -238,2 +238,3 @@ "use strict";

balance,
extra_currencies: info.extra_currencies,
state,

@@ -344,2 +345,3 @@ code: info.code !== '' ? Buffer.from(info.code, 'base64') : null,

let last = state.lastTransaction ? { lt: BigInt(state.lastTransaction.lt), hash: Buffer.from(state.lastTransaction.hash, 'base64') } : null;
let ecMap = null;
let storage;

@@ -367,4 +369,11 @@ if (state.state === 'active') {

}
if (state.extra_currencies.length > 0) {
ecMap = {};
for (let ec of state.extra_currencies) {
ecMap[ec.id] = BigInt(ec.amount);
}
}
return {
balance,
extracurrency: ecMap,
last,

@@ -436,2 +445,3 @@ state: storage,

sendMode: message.sendMode,
extracurrency: message.extracurrency,
init: neededInit,

@@ -438,0 +448,0 @@ body

@@ -37,2 +37,13 @@ "use strict";

});
it('should get extra currency info', async () => {
// EC is rolled out only in testned yet
let testClient = new TonClient_1.TonClient({
endpoint: 'https://testnet.toncenter.com/api/v2/jsonRPC'
});
let testAddr = core_1.Address.parse("0:D36CFC9E0C57F43C1A719CB9F540ED87A694693AE1535B7654B645F52814AFD7");
let res = await testClient.getContractState(testAddr);
let expectedEc = res.extra_currencies.find(e => e.id == 100);
expect(expectedEc).not.toBeUndefined();
expect(BigInt(expectedEc.amount)).toBe(10000000n);
});
it('should locate source/result tx', async () => {

@@ -39,0 +50,0 @@ let source = core_1.Address.parse('UQDDT0TOC4PMp894jtCo3-d1-8ltSjXMX2EuWww_pCNibsUH');

34

dist/client/TonClient4.d.ts

@@ -99,2 +99,3 @@ /**

coins: string;
currencies: Record<string, string>;
};

@@ -143,2 +144,3 @@ state: {

coins: string;
currencies: Record<string, string>;
};

@@ -780,2 +782,3 @@ state: {

seqno: number | null;
amount: string;
body: {

@@ -791,3 +794,2 @@ type: "comment";

kind: "out" | "in";
amount: string;
resolvedAddress: string;

@@ -798,2 +800,3 @@ mentioned: string[];

seqno: number | null;
amount: string;
body: {

@@ -809,3 +812,2 @@ type: "comment";

kind: "out" | "in";
amount: string;
resolvedAddress: string;

@@ -821,7 +823,7 @@ mentioned: string[];

}, "strip", z.ZodTypeAny, {
amount: string;
kind: "ton";
}, {
amount: string;
}, {
kind: "ton";
amount: string;
}>, z.ZodObject<{

@@ -831,7 +833,7 @@ kind: z.ZodLiteral<"token">;

}, "strip", z.ZodTypeAny, {
amount: string;
kind: "token";
}, {
amount: string;
}, {
kind: "token";
amount: string;
}>]>, "many">;

@@ -850,7 +852,7 @@ op: z.ZodOptional<z.ZodObject<{

items: ({
amount: string;
kind: "ton";
} | {
amount: string;
} | {
kind: "token";
amount: string;
})[];

@@ -865,7 +867,7 @@ address: string;

items: ({
amount: string;
kind: "ton";
} | {
amount: string;
} | {
kind: "token";
amount: string;
})[];

@@ -977,2 +979,3 @@ address: string;

seqno: number | null;
amount: string;
body: {

@@ -988,3 +991,2 @@ type: "comment";

kind: "out" | "in";
amount: string;
resolvedAddress: string;

@@ -995,7 +997,7 @@ mentioned: string[];

items: ({
amount: string;
kind: "ton";
} | {
amount: string;
} | {
kind: "token";
amount: string;
})[];

@@ -1107,2 +1109,3 @@ address: string;

seqno: number | null;
amount: string;
body: {

@@ -1118,3 +1121,2 @@ type: "comment";

kind: "out" | "in";
amount: string;
resolvedAddress: string;

@@ -1125,7 +1127,7 @@ mentioned: string[];

items: ({
amount: string;
kind: "ton";
} | {
amount: string;
} | {
kind: "token";
amount: string;
})[];

@@ -1132,0 +1134,0 @@ address: string;

@@ -317,4 +317,13 @@ "use strict";

}
let ecMap = null;
if (state.account.balance.currencies) {
ecMap = {};
let currencies = state.account.balance.currencies;
for (let [k, v] of Object.entries(currencies)) {
ecMap[Number(k)] = BigInt(v);
}
}
return {
balance: BigInt(state.account.balance.coins),
extracurrency: ecMap,
last: last,

@@ -394,2 +403,3 @@ state: storage

value,
extracurrency: message.extracurrency,
bounce,

@@ -496,3 +506,4 @@ sendMode: message.sendMode,

balance: zod_1.z.object({
coins: zod_1.z.string()
coins: zod_1.z.string(),
currencies: zod_1.z.record(zod_1.z.string(), zod_1.z.string())
}),

@@ -524,3 +535,4 @@ last: zod_1.z.union([

balance: zod_1.z.object({
coins: zod_1.z.string()
coins: zod_1.z.string(),
currencies: zod_1.z.record(zod_1.z.string(), zod_1.z.string())
}),

@@ -527,0 +539,0 @@ last: zod_1.z.union([

@@ -38,2 +38,27 @@ "use strict";

});
it('should get extra currency info', async () => {
let testAddresses = [
"-1:0000000000000000000000000000000000000000000000000000000000000000",
"0:C4CAC12F5BC7EEF4CF5EC84EE68CCF860921A06CA0395EC558E53E37B13C3B08",
"0:F5FFA780ACEE2A41663C1E32F50D771327275A42FC9D3FAB4F4D9CDE11CCA897"
].map(a => core_1.Address.parse(a));
let knownEc = [239, 4294967279];
let expectedEc = [
{ 239: 663333333334n, 4294967279: 998444444446n },
{ 239: 989097920n },
{ 239: 666666666n, 4294967279: 777777777n }
];
for (let i = 0; i < testAddresses.length; i++) {
let res = await (0, time_1.backoff)(async () => await client.getAccount(seqno, testAddresses[i]), false);
let resLite = await (0, time_1.backoff)(async () => await client.getAccountLite(seqno, testAddresses[i]), false);
let expected = expectedEc[i];
for (let testEc of knownEc) {
let expCur = expected[testEc];
if (expCur) {
expect(BigInt(res.account.balance.currencies[testEc])).toEqual(expCur);
expect(BigInt(resLite.account.balance.currencies[testEc])).toEqual(expCur);
}
}
}
});
it('should run method', async () => {

@@ -40,0 +65,0 @@ let result = await client.runMethod(seqno, testAddress, 'seqno');

@@ -196,2 +196,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -198,0 +199,0 @@ body: args.body,

@@ -15,2 +15,3 @@ "use strict";

const createTestClient4_1 = require("../../utils/createTestClient4");
const testWallets_1 = require("../../utils/testWallets");
const getExtensionsArray = async (wallet) => {

@@ -56,3 +57,21 @@ try {

await wallet.send(transfer);
await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
});
it('should perform extra currency transfer', async () => {
const seqno = await wallet.getSeqno();
const transfer = wallet.createTransfer({
seqno,
secretKey: walletKey.secretKey,
sendMode: core_1.SendMode.PAY_GAS_SEPARATELY + core_1.SendMode.IGNORE_ERRORS,
messages: [(0, core_1.internal)({
bounce: false,
to: 'UQB-2r0kM28L4lmq-4V8ppQGcnO1tXC7FZmbnDzWZVBkp6jE',
value: '0.01',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello extra currency w5beta!'
})]
});
await wallet.send(transfer);
await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
});
it('should perform single transfer with async signing', async () => {

@@ -59,0 +78,0 @@ const seqno = await wallet.getSeqno();

@@ -192,2 +192,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -194,0 +195,0 @@ body: args.body,

@@ -15,2 +15,3 @@ "use strict";

const WalletContractV5R1_1 = require("./WalletContractV5R1");
const testWallets_1 = require("../../utils/testWallets");
const getExtensionsArray = async (wallet) => {

@@ -58,3 +59,21 @@ try {

await wallet.send(transfer);
await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
});
it('should perform extra currency transfer', async () => {
const seqno = await wallet.getSeqno();
const transfer = wallet.createTransfer({
seqno,
secretKey: walletKey.secretKey,
sendMode: core_1.SendMode.PAY_GAS_SEPARATELY + core_1.SendMode.IGNORE_ERRORS,
messages: [(0, core_1.internal)({
bounce: false,
to: 'UQB-2r0kM28L4lmq-4V8ppQGcnO1tXC7FZmbnDzWZVBkp6jE',
value: '0.01',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello extra currency w5r1!'
})]
});
await wallet.send(transfer);
await (0, testWallets_1.tillNextSeqno)(wallet, seqno);
});
it('should perform single transfer with async signing', async () => {

@@ -61,0 +80,0 @@ const seqno = await wallet.getSeqno();

@@ -90,2 +90,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -92,0 +93,0 @@ body: args.body,

@@ -14,2 +14,3 @@ "use strict";

const WalletContractV1R1_1 = require("./WalletContractV1R1");
const testWallets_1 = require("../utils/testWallets");
describe('WalletContractV1R1', () => {

@@ -44,3 +45,25 @@ it('should has balance and correct address', async () => {

await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
it('should perform extra currency transfer', async () => {
// Create contract
let client = (0, createTestClient4_1.createTestClient4)();
let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
let contract = client.open(WalletContractV1R1_1.WalletContractV1R1.create({ workchain: 0, publicKey: key.publicKey }));
// Prepare transfer
let seqno = await contract.getSeqno();
let transfer = contract.createTransfer({
seqno,
secretKey: key.secretKey,
message: (0, core_1.internal)({
to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
value: '0.01',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello, extra currency v1r1!'
})
});
// Perform transfer
await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
});

@@ -91,2 +91,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -93,0 +94,0 @@ body: args.body,

@@ -14,2 +14,3 @@ "use strict";

const WalletContractV1R2_1 = require("./WalletContractV1R2");
const testWallets_1 = require("../utils/testWallets");
describe('WalletContractV1R2', () => {

@@ -44,3 +45,25 @@ it('should has balance and correct address', async () => {

await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
it('should perform extra currency transfer', async () => {
// Create contract
let client = (0, createTestClient4_1.createTestClient4)();
let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
let contract = client.open(WalletContractV1R2_1.WalletContractV1R2.create({ workchain: 0, publicKey: key.publicKey }));
// Prepare transfer
let seqno = await contract.getSeqno();
let transfer = contract.createTransfer({
seqno,
secretKey: key.secretKey,
message: (0, core_1.internal)({
to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
value: '0.01',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello, extra currency v1r2!'
})
});
// Perform transfer
await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
});

@@ -92,2 +92,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -94,0 +95,0 @@ body: args.body,

@@ -14,2 +14,3 @@ "use strict";

const WalletContractV2R1_1 = require("./WalletContractV2R1");
const testWallets_1 = require("../utils/testWallets");
describe('WalletContractV2R1', () => {

@@ -44,3 +45,25 @@ it('should has balance and correct address', async () => {

await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
it('should perform extra currency transfer', async () => {
// Create contract
let client = (0, createTestClient4_1.createTestClient4)();
let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
let contract = client.open(WalletContractV2R1_1.WalletContractV2R1.create({ workchain: 0, publicKey: key.publicKey }));
// Prepare transfer
let seqno = await contract.getSeqno();
let transfer = contract.createTransfer({
seqno,
secretKey: key.secretKey,
messages: [(0, core_1.internal)({
to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
value: '0.01',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello, extra currency v2r1!'
})]
});
// Perform transfer
await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
});

@@ -92,2 +92,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -94,0 +95,0 @@ body: args.body,

@@ -14,2 +14,3 @@ "use strict";

const WalletContractV2R2_1 = require("./WalletContractV2R2");
const testWallets_1 = require("../utils/testWallets");
describe('WalletContractV2R2', () => {

@@ -44,3 +45,25 @@ it('should has balance and correct address', async () => {

await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
it('should perfrorm extra currency transfer', async () => {
// Create contract
let client = (0, createTestClient4_1.createTestClient4)();
let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
let contract = client.open(WalletContractV2R2_1.WalletContractV2R2.create({ workchain: 0, publicKey: key.publicKey }));
// Prepare transfer
let seqno = await contract.getSeqno();
let transfer = contract.createTransfer({
seqno,
secretKey: key.secretKey,
messages: [(0, core_1.internal)({
to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
value: '0.01',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello, extra currency v2r2!'
})]
});
// Perform transfer
await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
});

@@ -94,2 +94,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -96,0 +97,0 @@ body: args.body,

@@ -14,2 +14,3 @@ "use strict";

const WalletContractV3R1_1 = require("./WalletContractV3R1");
const testWallets_1 = require("../utils/testWallets");
describe('WalletContractV3R1', () => {

@@ -44,3 +45,25 @@ it('should has balance and correct address', async () => {

await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
it('should perform extra currency transfer', async () => {
// Create contract
let client = (0, createTestClient4_1.createTestClient4)();
let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
let contract = client.open(WalletContractV3R1_1.WalletContractV3R1.create({ workchain: 0, publicKey: key.publicKey }));
// Prepare transfer
let seqno = await contract.getSeqno();
let transfer = contract.createTransfer({
seqno,
secretKey: key.secretKey,
messages: [(0, core_1.internal)({
to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
value: '0.05',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello, extra currency v3r1!'
})]
});
// Perform transfer
await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
});

@@ -94,2 +94,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -96,0 +97,0 @@ body: args.body,

@@ -14,2 +14,3 @@ "use strict";

const WalletContractV3R2_1 = require("./WalletContractV3R2");
const testWallets_1 = require("../utils/testWallets");
describe('WalletContractV3R1', () => {

@@ -44,3 +45,25 @@ it('should has balance and correct address', async () => {

await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
it('should perform extra currency transfer', async () => {
// Create contract
let client = (0, createTestClient4_1.createTestClient4)();
let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
let contract = client.open(WalletContractV3R2_1.WalletContractV3R2.create({ workchain: 0, publicKey: key.publicKey }));
// Prepare transfer
let seqno = await contract.getSeqno();
let transfer = contract.createTransfer({
seqno,
secretKey: key.secretKey,
messages: [(0, core_1.internal)({
to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
value: '0.05',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello, extra currency v3r2!'
})]
});
// Perform transfer
await contract.send(transfer);
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
});

@@ -95,2 +95,3 @@ "use strict";

value: args.value,
extracurrency: args.extracurrency,
init: args.init,

@@ -97,0 +98,0 @@ body: args.body,

@@ -11,2 +11,3 @@ "use strict";

const randomTestKey_1 = require("../utils/randomTestKey");
const testWallets_1 = require("../utils/testWallets");
const WalletContractV4_1 = require("./WalletContractV4");

@@ -48,3 +49,27 @@ const createTestClient4_1 = require("../utils/createTestClient4");

await contract.send(transfer);
// Awaiting update
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
it('should perform extra currency transfer', async () => {
// Create contract
let client = (0, createTestClient4_1.createTestClient4)();
let key = (0, randomTestKey_1.randomTestKey)('v4-treasure');
let contract = client.open(WalletContractV4_1.WalletContractV4.create({ workchain: 0, publicKey: key.publicKey }));
// Prepare transfer
let seqno = await contract.getSeqno();
let transfer = contract.createTransfer({
seqno,
secretKey: key.secretKey,
messages: [(0, core_1.internal)({
to: 'kQD6oPnzaaAMRW24R8F0_nlSsJQni0cGHntR027eT9_sgtwt',
value: '0.01',
extracurrency: { 100: BigInt(10 ** 6) },
body: 'Hello extra currency v4'
})]
});
// Perform transfer
await contract.send(transfer);
// Awaiting update
await (0, testWallets_1.tillNextSeqno)(contract, seqno);
});
});
{
"name": "@ton/ton",
"version": "15.1.0",
"version": "15.2.0",
"repository": "https://github.com/ton-org/ton.git",

@@ -19,3 +19,3 @@ "author": "Whales Corp. <developers@whalescorp.com>",

"@release-it/keep-a-changelog": "^5.0.0",
"@ton/core": "^0.59.0",
"@ton/core": "^0.60.0",
"@ton/crypto": "3.2.0",

@@ -51,3 +51,3 @@ "@ton/emulator": "^2.1.1",

"peerDependencies": {
"@ton/core": ">=0.59.0",
"@ton/core": ">=0.60.0",
"@ton/crypto": ">=3.2.0"

@@ -54,0 +54,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc