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 13.7.0 to 13.8.0

dist/utils/fees.d.ts

17

dist/client/api/HttpApi.d.ts

@@ -58,4 +58,6 @@ /// <reference types="node" />

}>]>;
message: z.ZodString;
}, "strip", z.ZodTypeAny, {
value: string;
message: string;
fwd_fee: string;

@@ -82,2 +84,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -164,4 +167,6 @@ source: string;

}>]>;
message: z.ZodString;
}, "strip", z.ZodTypeAny, {
value: string;
message: string;
fwd_fee: string;

@@ -188,2 +193,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -254,4 +260,6 @@ source: string;

}>]>;
message: z.ZodString;
}, "strip", z.ZodTypeAny, {
value: string;
message: string;
fwd_fee: string;

@@ -278,2 +286,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -311,2 +320,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -334,2 +344,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -367,2 +378,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -390,2 +402,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -475,2 +488,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -498,2 +512,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -578,2 +593,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -601,2 +617,3 @@ source: string;

value: string;
message: string;
fwd_fee: string;

@@ -603,0 +620,0 @@ source: string;

3

dist/client/api/HttpApi.js

@@ -84,3 +84,4 @@ "use strict";

body_hash: zod_1.z.string(),
msg_data: messageData
msg_data: messageData,
message: zod_1.z.string()
});

@@ -87,0 +88,0 @@ const transaction = zod_1.z.object({

@@ -264,30 +264,55 @@ "use strict";

_TonClient_api = new WeakMap();
function parseStack(src) {
let stack = [];
for (let s of src) {
if (s[0] === 'num') {
let val = s[1];
if (val.startsWith('-')) {
stack.push({ type: 'int', value: -BigInt(val.slice(1)) });
}
else {
stack.push({ type: 'int', value: BigInt(val) });
}
function parseStackEntry(s) {
switch (s["@type"]) {
case "tvm.stackEntryNumber":
return { type: 'int', value: BigInt(s.number.number) };
case "tvm.stackEntryCell":
return { type: 'cell', cell: core_1.Cell.fromBase64(s.cell) };
case 'tvm.stackEntryTuple':
return { type: 'tuple', items: s.tuple.elements.map(parseStackEntry) };
default:
throw Error("Unsupported item type: " + s["@type"]);
}
}
function parseStackItem(s) {
if (s[0] === 'num') {
let val = s[1];
if (val.startsWith('-')) {
return { type: 'int', value: -BigInt(val.slice(1)) };
}
else if (s[0] === 'null') {
stack.push({ type: 'null' });
}
else if (s[0] === 'cell') {
stack.push({ type: 'cell', cell: core_1.Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] });
}
else if (s[0] === 'slice') {
stack.push({ type: 'slice', cell: core_1.Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] });
}
else if (s[0] === 'builder') {
stack.push({ type: 'builder', cell: core_1.Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] });
}
else {
throw Error('Unsupported stack item type: ' + s[0]);
return { type: 'int', value: BigInt(val) };
}
}
else if (s[0] === 'null') {
return { type: 'null' };
}
else if (s[0] === 'cell') {
return { type: 'cell', cell: core_1.Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] };
}
else if (s[0] === 'slice') {
return { type: 'slice', cell: core_1.Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] };
}
else if (s[0] === 'builder') {
return { type: 'builder', cell: core_1.Cell.fromBoc(Buffer.from(s[1].bytes, 'base64'))[0] };
}
else if (s[0] === 'tuple' || s[0] === 'list') {
// toncenter.com missbehaviour
if (s[1].elements.length === 0) {
return { type: 'null' };
}
return {
type: s[0],
items: s[1].elements.map(parseStackEntry)
};
}
else {
throw Error('Unsupported stack item type: ' + s[0]);
}
}
function parseStack(src) {
let stack = [];
for (let s of src) {
stack.push(parseStackItem(s));
}
return new core_1.TupleReader(stack);

@@ -294,0 +319,0 @@ }

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

import { Address, Cell, Contract, ContractProvider, Transaction, TupleItem, TupleReader } from "@ton/core";
import { z } from 'zod';
export declare type TonClient4Parameters = {

@@ -206,2 +207,11 @@ /**

/**
* Load parsed account transactions
* @param address address
* @param lt last transaction lt
* @param hash last transaction hash
* @param count number of transactions to load
* @returns parsed transactions
*/
getAccountTransactionsParsed(address: Address, lt: bigint, hash: Buffer, count?: number): Promise<ParsedTransactions>;
/**
* Get network config

@@ -292,1 +302,834 @@ * @param seqno block sequence number

}
declare const blocksCodec: z.ZodArray<z.ZodObject<{
workchain: z.ZodNumber;
seqno: z.ZodNumber;
shard: z.ZodString;
rootHash: z.ZodString;
fileHash: z.ZodString;
}, "strip", z.ZodTypeAny, {
workchain: number;
shard: string;
seqno: number;
fileHash: string;
rootHash: string;
}, {
workchain: number;
shard: string;
seqno: number;
fileHash: string;
rootHash: string;
}>, "many">;
declare const parsedTransactionCodec: z.ZodObject<{
address: z.ZodString;
lt: z.ZodString;
hash: z.ZodString;
prevTransaction: z.ZodObject<{
lt: z.ZodString;
hash: z.ZodString;
}, "strip", z.ZodTypeAny, {
lt: string;
hash: string;
}, {
lt: string;
hash: string;
}>;
time: z.ZodNumber;
outMessagesCount: z.ZodNumber;
oldStatus: z.ZodUnion<[z.ZodLiteral<"uninitialized">, z.ZodLiteral<"frozen">, z.ZodLiteral<"active">, z.ZodLiteral<"non-existing">]>;
newStatus: z.ZodUnion<[z.ZodLiteral<"uninitialized">, z.ZodLiteral<"frozen">, z.ZodLiteral<"active">, z.ZodLiteral<"non-existing">]>;
fees: z.ZodString;
update: z.ZodObject<{
oldHash: z.ZodString;
newHash: z.ZodString;
}, "strip", z.ZodTypeAny, {
oldHash: string;
newHash: string;
}, {
oldHash: string;
newHash: string;
}>;
inMessage: z.ZodUnion<[z.ZodObject<{
body: z.ZodString;
info: z.ZodUnion<[z.ZodObject<{
type: z.ZodLiteral<"internal">;
value: z.ZodString;
dest: z.ZodString;
src: z.ZodString;
bounced: z.ZodBoolean;
bounce: z.ZodBoolean;
ihrDisabled: z.ZodBoolean;
createdAt: z.ZodNumber;
createdLt: z.ZodString;
fwdFee: z.ZodString;
ihrFee: z.ZodString;
}, "strip", z.ZodTypeAny, {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
}, {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"external-in">;
dest: z.ZodString;
src: z.ZodUnion<[z.ZodObject<{
bits: z.ZodNumber;
data: z.ZodString;
}, "strip", z.ZodTypeAny, {
data: string;
bits: number;
}, {
data: string;
bits: number;
}>, z.ZodNull]>;
importFee: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
}, {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"external-out">;
dest: z.ZodUnion<[z.ZodObject<{
bits: z.ZodNumber;
data: z.ZodString;
}, "strip", z.ZodTypeAny, {
data: string;
bits: number;
}, {
data: string;
bits: number;
}>, z.ZodNull]>;
}, "strip", z.ZodTypeAny, {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
}, {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
}>]>;
init: z.ZodUnion<[z.ZodObject<{
splitDepth: z.ZodUnion<[z.ZodNumber, z.ZodNull]>;
code: z.ZodUnion<[z.ZodString, z.ZodNull]>;
data: z.ZodUnion<[z.ZodString, z.ZodNull]>;
special: z.ZodUnion<[z.ZodObject<{
tick: z.ZodBoolean;
tock: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
tick: boolean;
tock: boolean;
}, {
tick: boolean;
tock: boolean;
}>, z.ZodNull]>;
}, "strip", z.ZodTypeAny, {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
}, {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
}>, z.ZodNull]>;
}, "strip", z.ZodTypeAny, {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
}, {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
}>, z.ZodNull]>;
outMessages: z.ZodArray<z.ZodObject<{
body: z.ZodString;
info: z.ZodUnion<[z.ZodObject<{
type: z.ZodLiteral<"internal">;
value: z.ZodString;
dest: z.ZodString;
src: z.ZodString;
bounced: z.ZodBoolean;
bounce: z.ZodBoolean;
ihrDisabled: z.ZodBoolean;
createdAt: z.ZodNumber;
createdLt: z.ZodString;
fwdFee: z.ZodString;
ihrFee: z.ZodString;
}, "strip", z.ZodTypeAny, {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
}, {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"external-in">;
dest: z.ZodString;
src: z.ZodUnion<[z.ZodObject<{
bits: z.ZodNumber;
data: z.ZodString;
}, "strip", z.ZodTypeAny, {
data: string;
bits: number;
}, {
data: string;
bits: number;
}>, z.ZodNull]>;
importFee: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
}, {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"external-out">;
dest: z.ZodUnion<[z.ZodObject<{
bits: z.ZodNumber;
data: z.ZodString;
}, "strip", z.ZodTypeAny, {
data: string;
bits: number;
}, {
data: string;
bits: number;
}>, z.ZodNull]>;
}, "strip", z.ZodTypeAny, {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
}, {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
}>]>;
init: z.ZodUnion<[z.ZodObject<{
splitDepth: z.ZodUnion<[z.ZodNumber, z.ZodNull]>;
code: z.ZodUnion<[z.ZodString, z.ZodNull]>;
data: z.ZodUnion<[z.ZodString, z.ZodNull]>;
special: z.ZodUnion<[z.ZodObject<{
tick: z.ZodBoolean;
tock: z.ZodBoolean;
}, "strip", z.ZodTypeAny, {
tick: boolean;
tock: boolean;
}, {
tick: boolean;
tock: boolean;
}>, z.ZodNull]>;
}, "strip", z.ZodTypeAny, {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
}, {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
}>, z.ZodNull]>;
}, "strip", z.ZodTypeAny, {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
}, {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
}>, "many">;
parsed: z.ZodObject<{
seqno: z.ZodUnion<[z.ZodNumber, z.ZodNull]>;
body: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
type: z.ZodLiteral<"comment">;
comment: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "comment";
comment: string;
}, {
type: "comment";
comment: string;
}>, z.ZodObject<{
type: z.ZodLiteral<"payload">;
cell: z.ZodString;
}, "strip", z.ZodTypeAny, {
type: "payload";
cell: string;
}, {
type: "payload";
cell: string;
}>]>, z.ZodNull]>;
status: z.ZodUnion<[z.ZodLiteral<"success">, z.ZodLiteral<"failed">, z.ZodLiteral<"pending">]>;
dest: z.ZodUnion<[z.ZodString, z.ZodNull]>;
kind: z.ZodUnion<[z.ZodLiteral<"out">, z.ZodLiteral<"in">]>;
amount: z.ZodString;
resolvedAddress: z.ZodString;
bounced: z.ZodBoolean;
mentioned: z.ZodArray<z.ZodString, "many">;
}, "strip", z.ZodTypeAny, {
status: "success" | "failed" | "pending";
seqno: number | null;
body: {
type: "comment";
comment: string;
} | {
type: "payload";
cell: string;
} | null;
dest: string | null;
bounced: boolean;
kind: "out" | "in";
amount: string;
resolvedAddress: string;
mentioned: string[];
}, {
status: "success" | "failed" | "pending";
seqno: number | null;
body: {
type: "comment";
comment: string;
} | {
type: "payload";
cell: string;
} | null;
dest: string | null;
bounced: boolean;
kind: "out" | "in";
amount: string;
resolvedAddress: string;
mentioned: string[];
}>;
operation: z.ZodObject<{
address: z.ZodString;
comment: z.ZodOptional<z.ZodString>;
items: z.ZodArray<z.ZodUnion<[z.ZodObject<{
kind: z.ZodLiteral<"ton">;
amount: z.ZodString;
}, "strip", z.ZodTypeAny, {
kind: "ton";
amount: string;
}, {
kind: "ton";
amount: string;
}>, z.ZodObject<{
kind: z.ZodLiteral<"token">;
amount: z.ZodString;
}, "strip", z.ZodTypeAny, {
kind: "token";
amount: string;
}, {
kind: "token";
amount: string;
}>]>, "many">;
op: z.ZodOptional<z.ZodObject<{
type: z.ZodUnion<[z.ZodLiteral<"jetton::excesses">, z.ZodLiteral<"jetton::transfer">, z.ZodLiteral<"jetton::transfer_notification">, z.ZodLiteral<"deposit">, z.ZodLiteral<"deposit::ok">, z.ZodLiteral<"withdraw">, z.ZodLiteral<"withdraw::all">, z.ZodLiteral<"withdraw::delayed">, z.ZodLiteral<"withdraw::ok">, z.ZodLiteral<"airdrop">]>;
options: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
}, "strip", z.ZodTypeAny, {
type: "jetton::excesses" | "jetton::transfer" | "jetton::transfer_notification" | "deposit" | "deposit::ok" | "withdraw" | "withdraw::all" | "withdraw::delayed" | "withdraw::ok" | "airdrop";
options?: Record<string, string> | undefined;
}, {
type: "jetton::excesses" | "jetton::transfer" | "jetton::transfer_notification" | "deposit" | "deposit::ok" | "withdraw" | "withdraw::all" | "withdraw::delayed" | "withdraw::ok" | "airdrop";
options?: Record<string, string> | undefined;
}>>;
}, "strip", z.ZodTypeAny, {
items: ({
kind: "ton";
amount: string;
} | {
kind: "token";
amount: string;
})[];
address: string;
comment?: string | undefined;
op?: {
type: "jetton::excesses" | "jetton::transfer" | "jetton::transfer_notification" | "deposit" | "deposit::ok" | "withdraw" | "withdraw::all" | "withdraw::delayed" | "withdraw::ok" | "airdrop";
options?: Record<string, string> | undefined;
} | undefined;
}, {
items: ({
kind: "ton";
amount: string;
} | {
kind: "token";
amount: string;
})[];
address: string;
comment?: string | undefined;
op?: {
type: "jetton::excesses" | "jetton::transfer" | "jetton::transfer_notification" | "deposit" | "deposit::ok" | "withdraw" | "withdraw::all" | "withdraw::delayed" | "withdraw::ok" | "airdrop";
options?: Record<string, string> | undefined;
} | undefined;
}>;
}, "strip", z.ZodTypeAny, {
lt: string;
hash: string;
fees: string;
address: string;
prevTransaction: {
lt: string;
hash: string;
};
time: number;
outMessagesCount: number;
oldStatus: "active" | "uninitialized" | "frozen" | "non-existing";
newStatus: "active" | "uninitialized" | "frozen" | "non-existing";
update: {
oldHash: string;
newHash: string;
};
inMessage: {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
} | null;
outMessages: {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
}[];
parsed: {
status: "success" | "failed" | "pending";
seqno: number | null;
body: {
type: "comment";
comment: string;
} | {
type: "payload";
cell: string;
} | null;
dest: string | null;
bounced: boolean;
kind: "out" | "in";
amount: string;
resolvedAddress: string;
mentioned: string[];
};
operation: {
items: ({
kind: "ton";
amount: string;
} | {
kind: "token";
amount: string;
})[];
address: string;
comment?: string | undefined;
op?: {
type: "jetton::excesses" | "jetton::transfer" | "jetton::transfer_notification" | "deposit" | "deposit::ok" | "withdraw" | "withdraw::all" | "withdraw::delayed" | "withdraw::ok" | "airdrop";
options?: Record<string, string> | undefined;
} | undefined;
};
}, {
lt: string;
hash: string;
fees: string;
address: string;
prevTransaction: {
lt: string;
hash: string;
};
time: number;
outMessagesCount: number;
oldStatus: "active" | "uninitialized" | "frozen" | "non-existing";
newStatus: "active" | "uninitialized" | "frozen" | "non-existing";
update: {
oldHash: string;
newHash: string;
};
inMessage: {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
} | null;
outMessages: {
body: string;
init: {
data: string | null;
code: string | null;
splitDepth: number | null;
special: {
tick: boolean;
tock: boolean;
} | null;
} | null;
info: {
value: string;
type: "internal";
dest: string;
src: string;
bounced: boolean;
bounce: boolean;
ihrDisabled: boolean;
createdAt: number;
createdLt: string;
fwdFee: string;
ihrFee: string;
} | {
type: "external-in";
dest: string;
src: {
data: string;
bits: number;
} | null;
importFee: string;
} | {
type: "external-out";
dest: {
data: string;
bits: number;
} | null;
};
}[];
parsed: {
status: "success" | "failed" | "pending";
seqno: number | null;
body: {
type: "comment";
comment: string;
} | {
type: "payload";
cell: string;
} | null;
dest: string | null;
bounced: boolean;
kind: "out" | "in";
amount: string;
resolvedAddress: string;
mentioned: string[];
};
operation: {
items: ({
kind: "ton";
amount: string;
} | {
kind: "token";
amount: string;
})[];
address: string;
comment?: string | undefined;
op?: {
type: "jetton::excesses" | "jetton::transfer" | "jetton::transfer_notification" | "deposit" | "deposit::ok" | "withdraw" | "withdraw::all" | "withdraw::delayed" | "withdraw::ok" | "airdrop";
options?: Record<string, string> | undefined;
} | undefined;
};
}>;
export declare type ParsedTransaction = z.infer<typeof parsedTransactionCodec>;
export declare type ParsedTransactions = {
blocks: z.infer<typeof blocksCodec>;
transactions: ParsedTransaction[];
};
export {};

@@ -160,2 +160,24 @@ "use strict";

/**
* Load parsed account transactions
* @param address address
* @param lt last transaction lt
* @param hash last transaction hash
* @param count number of transactions to load
* @returns parsed transactions
*/
async getAccountTransactionsParsed(address, lt, hash, count = 20) {
let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/account/' + address.toString({ urlSafe: true }) + '/tx/parsed/' + lt.toString(10) + '/' + (0, toUrlSafe_1.toUrlSafe)(hash.toString('base64')), {
adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"),
timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f"),
params: {
count
}
});
let parsedTransactionsRes = parsedTransactionsCodec.safeParse(res.data);
if (!parsedTransactionsRes.success) {
throw Error('Mailformed response');
}
return parsedTransactionsRes.data;
}
/**
* Get network config

@@ -506,11 +528,119 @@ * @param seqno block sequence number

});
const blocksCodec = zod_1.z.array(zod_1.z.object({
workchain: zod_1.z.number(),
seqno: zod_1.z.number(),
shard: zod_1.z.string(),
rootHash: zod_1.z.string(),
fileHash: zod_1.z.string()
}));
const transactionsCodec = zod_1.z.object({
blocks: zod_1.z.array(zod_1.z.object({
workchain: zod_1.z.number(),
seqno: zod_1.z.number(),
shard: zod_1.z.string(),
rootHash: zod_1.z.string(),
fileHash: zod_1.z.string()
})),
blocks: blocksCodec,
boc: zod_1.z.string()
});
const parsedAddressExternalCodec = zod_1.z.object({
bits: zod_1.z.number(),
data: zod_1.z.string()
});
const parsedMessageInfoCodec = zod_1.z.union([
zod_1.z.object({
type: zod_1.z.literal('internal'),
value: zod_1.z.string(),
dest: zod_1.z.string(),
src: zod_1.z.string(),
bounced: zod_1.z.boolean(),
bounce: zod_1.z.boolean(),
ihrDisabled: zod_1.z.boolean(),
createdAt: zod_1.z.number(),
createdLt: zod_1.z.string(),
fwdFee: zod_1.z.string(),
ihrFee: zod_1.z.string()
}),
zod_1.z.object({
type: zod_1.z.literal('external-in'),
dest: zod_1.z.string(),
src: zod_1.z.union([parsedAddressExternalCodec, zod_1.z.null()]),
importFee: zod_1.z.string()
}),
zod_1.z.object({
type: zod_1.z.literal('external-out'),
dest: zod_1.z.union([parsedAddressExternalCodec, zod_1.z.null()])
})
]);
const parsedStateInitCodec = zod_1.z.object({
splitDepth: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]),
code: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]),
data: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]),
special: zod_1.z.union([zod_1.z.object({ tick: zod_1.z.boolean(), tock: zod_1.z.boolean() }), zod_1.z.null()])
});
const parsedMessageCodec = zod_1.z.object({
body: zod_1.z.string(),
info: parsedMessageInfoCodec,
init: zod_1.z.union([parsedStateInitCodec, zod_1.z.null()])
});
const accountStatusCodec = zod_1.z.union([zod_1.z.literal('uninitialized'), zod_1.z.literal('frozen'), zod_1.z.literal('active'), zod_1.z.literal('non-existing')]);
const txBodyCodec = zod_1.z.union([
zod_1.z.object({ type: zod_1.z.literal('comment'), comment: zod_1.z.string() }),
zod_1.z.object({ type: zod_1.z.literal('payload'), cell: zod_1.z.string() }),
]);
const parsedOperationItemCodec = zod_1.z.union([
zod_1.z.object({ kind: zod_1.z.literal('ton'), amount: zod_1.z.string() }),
zod_1.z.object({ kind: zod_1.z.literal('token'), amount: zod_1.z.string() })
]);
const supportedMessageTypeCodec = zod_1.z.union([
zod_1.z.literal('jetton::excesses'),
zod_1.z.literal('jetton::transfer'),
zod_1.z.literal('jetton::transfer_notification'),
zod_1.z.literal('deposit'),
zod_1.z.literal('deposit::ok'),
zod_1.z.literal('withdraw'),
zod_1.z.literal('withdraw::all'),
zod_1.z.literal('withdraw::delayed'),
zod_1.z.literal('withdraw::ok'),
zod_1.z.literal('airdrop')
]);
const opCodec = zod_1.z.object({
type: supportedMessageTypeCodec,
options: zod_1.z.optional(zod_1.z.record(zod_1.z.string()))
});
const parsedOperationCodec = zod_1.z.object({
address: zod_1.z.string(),
comment: zod_1.z.optional(zod_1.z.string()),
items: zod_1.z.array(parsedOperationItemCodec),
op: zod_1.z.optional(opCodec)
});
const parsedTransactionCodec = zod_1.z.object({
address: zod_1.z.string(),
lt: zod_1.z.string(),
hash: zod_1.z.string(),
prevTransaction: zod_1.z.object({
lt: zod_1.z.string(),
hash: zod_1.z.string()
}),
time: zod_1.z.number(),
outMessagesCount: zod_1.z.number(),
oldStatus: accountStatusCodec,
newStatus: accountStatusCodec,
fees: zod_1.z.string(),
update: zod_1.z.object({
oldHash: zod_1.z.string(),
newHash: zod_1.z.string()
}),
inMessage: zod_1.z.union([parsedMessageCodec, zod_1.z.null()]),
outMessages: zod_1.z.array(parsedMessageCodec),
parsed: zod_1.z.object({
seqno: zod_1.z.union([zod_1.z.number(), zod_1.z.null()]),
body: zod_1.z.union([txBodyCodec, zod_1.z.null()]),
status: zod_1.z.union([zod_1.z.literal('success'), zod_1.z.literal('failed'), zod_1.z.literal('pending')]),
dest: zod_1.z.union([zod_1.z.string(), zod_1.z.null()]),
kind: zod_1.z.union([zod_1.z.literal('out'), zod_1.z.literal('in')]),
amount: zod_1.z.string(),
resolvedAddress: zod_1.z.string(),
bounced: zod_1.z.boolean(),
mentioned: zod_1.z.array(zod_1.z.string())
}),
operation: parsedOperationCodec
});
const parsedTransactionsCodec = zod_1.z.object({
blocks: blocksCodec,
transactions: zod_1.z.array(parsedTransactionCodec)
});

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

const TonClient4_1 = require("./TonClient4");
const time_1 = require("../utils/time");
let describeConditional = process.env.TEST_CLIENTS ? describe : describe.skip;

@@ -11,3 +12,3 @@ describeConditional('TonClient', () => {

});
const testAddress = core_1.Address.parse('EQCD39VS5jcptHL8vMjEXrzGaRcCVYto7HUn4bpAOg8xqB2N');
const testAddress = core_1.Address.parse('EQBicYUqh1j9Lnqv9ZhECm0XNPaB7_HcwoBb3AJnYYfqB38_');
let seqno;

@@ -26,2 +27,7 @@ beforeAll(async () => {

});
it('should get account parsed transactions', async () => {
let accountLite = await (0, time_1.backoff)(async () => await client.getAccountLite(seqno, testAddress), true);
let parsedTransactions = await (0, time_1.backoff)(async () => await client.getAccountTransactionsParsed(testAddress, BigInt(accountLite.account.last.lt), Buffer.from(accountLite.account.last.hash, 'base64'), 10), true);
console.log(parsedTransactions.transactions.length);
}, 60000);
it('should get config', async () => {

@@ -28,0 +34,0 @@ let config = await client.getConfig(seqno);

@@ -27,1 +27,2 @@ /**

export { GasLimitsPrices, StoragePrices, MsgPrices, WorkchainDescriptor, configParse5, configParse8, configParse12, configParse13, configParse15, configParse16, configParse17, configParse18, configParse28, configParse29, configParse40, configParseBridge, configParseGasLimitsPrices, configParseMasterAddress, configParseMasterAddressRequired, configParseMsgPrices, configParseValidatorSet, configParseWorkchainDescriptor, parseBridge, parseProposalSetup, parseValidatorSet, parseVotingSetup, parseFullConfig, loadConfigParamById, loadConfigParamsAsSlice } from './config/ConfigParser';
export { computeExternalMessageFees, computeFwdFees, computeGasPrices, computeMessageForwardFees, computeStorageFees } from './utils/fees';

@@ -20,3 +20,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.loadConfigParamsAsSlice = exports.loadConfigParamById = exports.parseFullConfig = exports.parseVotingSetup = exports.parseValidatorSet = exports.parseProposalSetup = exports.parseBridge = exports.configParseWorkchainDescriptor = exports.configParseValidatorSet = exports.configParseMsgPrices = exports.configParseMasterAddressRequired = exports.configParseMasterAddress = exports.configParseGasLimitsPrices = exports.configParseBridge = exports.configParse40 = exports.configParse29 = exports.configParse28 = exports.configParse18 = exports.configParse17 = exports.configParse16 = exports.configParse15 = exports.configParse13 = exports.configParse12 = exports.configParse8 = exports.configParse5 = exports.ElectorContract = exports.MultisigWallet = exports.MultisigOrderBuilder = exports.MultisigOrder = exports.JettonWallet = exports.JettonMaster = exports.WalletContractV4 = exports.WalletContractV3R2 = exports.WalletContractV3R1 = exports.WalletContractV2R2 = exports.WalletContractV2R1 = exports.WalletContractV1R3 = exports.WalletContractV1R2 = exports.WalletContractV1R1 = exports.TonClient4 = exports.TonClient = exports.HttpApi = void 0;
exports.computeStorageFees = exports.computeMessageForwardFees = exports.computeGasPrices = exports.computeFwdFees = exports.computeExternalMessageFees = exports.loadConfigParamsAsSlice = exports.loadConfigParamById = exports.parseFullConfig = exports.parseVotingSetup = exports.parseValidatorSet = exports.parseProposalSetup = exports.parseBridge = exports.configParseWorkchainDescriptor = exports.configParseValidatorSet = exports.configParseMsgPrices = exports.configParseMasterAddressRequired = exports.configParseMasterAddress = exports.configParseGasLimitsPrices = exports.configParseBridge = exports.configParse40 = exports.configParse29 = exports.configParse28 = exports.configParse18 = exports.configParse17 = exports.configParse16 = exports.configParse15 = exports.configParse13 = exports.configParse12 = exports.configParse8 = exports.configParse5 = exports.ElectorContract = exports.MultisigWallet = exports.MultisigOrderBuilder = exports.MultisigOrder = exports.JettonWallet = exports.JettonMaster = exports.WalletContractV4 = exports.WalletContractV3R2 = exports.WalletContractV3R1 = exports.WalletContractV2R2 = exports.WalletContractV2R1 = exports.WalletContractV1R3 = exports.WalletContractV1R2 = exports.WalletContractV1R1 = exports.TonClient4 = exports.TonClient = exports.HttpApi = void 0;
__exportStar(require("@ton/core"), exports);

@@ -104,1 +104,10 @@ //

Object.defineProperty(exports, "loadConfigParamsAsSlice", { enumerable: true, get: function () { return ConfigParser_1.loadConfigParamsAsSlice; } });
//
// Fees
//
var fees_1 = require("./utils/fees");
Object.defineProperty(exports, "computeExternalMessageFees", { enumerable: true, get: function () { return fees_1.computeExternalMessageFees; } });
Object.defineProperty(exports, "computeFwdFees", { enumerable: true, get: function () { return fees_1.computeFwdFees; } });
Object.defineProperty(exports, "computeGasPrices", { enumerable: true, get: function () { return fees_1.computeGasPrices; } });
Object.defineProperty(exports, "computeMessageForwardFees", { enumerable: true, get: function () { return fees_1.computeMessageForwardFees; } });
Object.defineProperty(exports, "computeStorageFees", { enumerable: true, get: function () { return fees_1.computeStorageFees; } });

@@ -9,4 +9,6 @@ /**

/// <reference types="node" />
import { MessageRelaxed } from "@ton/core";
import { MessageRelaxed, OutAction, Builder } from "@ton/core";
import { Maybe } from "../../utils/maybe";
import { Wallet5SendArgs } from "../WalletContractV5";
import { OutActionExtended } from "../WalletV5Utils";
export declare function createWalletTransferV1(args: {

@@ -41,1 +43,5 @@ seqno: number;

}): import("@ton/core").Cell;
export declare function createWalletTransferV5(args: Wallet5SendArgs & {
actions: (OutAction | OutActionExtended)[];
walletId: (builder: Builder) => void;
}): import("@ton/core").Cell;

@@ -10,5 +10,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.createWalletTransferV4 = exports.createWalletTransferV3 = exports.createWalletTransferV2 = exports.createWalletTransferV1 = void 0;
exports.createWalletTransferV5 = exports.createWalletTransferV4 = exports.createWalletTransferV3 = exports.createWalletTransferV2 = exports.createWalletTransferV1 = void 0;
const core_1 = require("@ton/core");
const crypto_1 = require("@ton/crypto");
const WalletContractV5_1 = require("../WalletContractV5");
const WalletV5Utils_1 = require("../WalletV5Utils");
function createWalletTransferV1(args) {

@@ -124,1 +126,31 @@ // Create message

exports.createWalletTransferV4 = createWalletTransferV4;
function createWalletTransferV5(args) {
// Check number of actions
if (args.actions.length > 255) {
throw Error("Maximum number of OutActions in a single request is 255");
}
if (!('secretKey' in args) || !args.secretKey) {
return (0, core_1.beginCell)()
.storeUint(WalletContractV5_1.WalletContractV5.opCodes.auth_extension, 32)
.store((0, WalletV5Utils_1.storeOutListExtended)(args.actions))
.endCell();
}
const message = (0, core_1.beginCell)().store(args.walletId);
if (args.seqno === 0) {
for (let i = 0; i < 32; i++) {
message.storeBit(1);
}
}
else {
message.storeUint(args.timeout || Math.floor(Date.now() / 1e3) + 60, 32); // Default timeout: 60 seconds
}
message.storeUint(args.seqno, 32).store((0, WalletV5Utils_1.storeOutListExtended)(args.actions));
// Sign message
const signature = (0, crypto_1.sign)(message.endCell().hash(), args.secretKey);
return (0, core_1.beginCell)()
.storeUint(WalletContractV5_1.WalletContractV5.opCodes.auth_signed, 32)
.storeBuffer(signature)
.storeBuilder(message)
.endCell();
}
exports.createWalletTransferV5 = createWalletTransferV5;
{
"name": "@ton/ton",
"version": "13.7.0",
"version": "13.8.0",
"repository": "https://github.com/ton-org/ton.git",

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

"@release-it/keep-a-changelog": "^3.1.0",
"@ton/core": "^0.52.2",
"@ton/core": "^0.53.0",
"@ton/crypto": "3.2.0",

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

"peerDependencies": {
"@ton/core": ">=0.51.0",
"@ton/core": ">=0.53.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