Comparing version 11.10.0 to 11.11.0
@@ -6,2 +6,3 @@ /// <reference types="node" /> | ||
import { StackItem } from "../block/stack"; | ||
import { Cell } from "../boc/Cell"; | ||
export declare type TonClient4Parameters = { | ||
@@ -130,2 +131,12 @@ /** | ||
}>; | ||
getAccountTransactions(address: Address, lt: BN, hash: Buffer): Promise<{ | ||
block: { | ||
workchain: number; | ||
seqno: number; | ||
shard: string; | ||
rootHash: string; | ||
fileHash: string; | ||
}; | ||
tx: Cell; | ||
}[]>; | ||
getConfig(seqno: number, ids?: number[]): Promise<{ | ||
@@ -132,0 +143,0 @@ config: { |
@@ -90,2 +90,18 @@ "use strict"; | ||
} | ||
async getAccountTransactions(address, lt, hash) { | ||
let res = await axios_1.default.get(__classPrivateFieldGet(this, _TonClient4_endpoint, "f") + '/account/' + address.toFriendly({ urlSafe: true }) + '/tx/' + lt.toString(10) + '/' + (0, toUrlSafe_1.toUrlSafe)(hash.toString('base64')), { adapter: __classPrivateFieldGet(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet(this, _TonClient4_timeout, "f") }); | ||
if (!transactionsCodec.is(res.data)) { | ||
throw Error('Mailformed response'); | ||
} | ||
let data = res.data; | ||
let tx = []; | ||
let cells = Cell_1.Cell.fromBoc(Buffer.from(data.boc, 'base64')); | ||
for (let i = 0; i < data.blocks.length; i++) { | ||
tx.push({ | ||
block: data.blocks[i], | ||
tx: cells[i] | ||
}); | ||
} | ||
return tx; | ||
} | ||
async getConfig(seqno, ids) { | ||
@@ -261,1 +277,11 @@ let tail = ''; | ||
}); | ||
const transactionsCodec = t.type({ | ||
blocks: t.array(t.type({ | ||
workchain: t.number, | ||
seqno: t.number, | ||
shard: t.string, | ||
rootHash: t.string, | ||
fileHash: t.string | ||
})), | ||
boc: t.string | ||
}); |
@@ -45,2 +45,5 @@ "use strict"; | ||
}); | ||
it('should account transactions', async () => { | ||
await client.getAccountTransactions(Address_1.Address.parse('EQCo6VT63H1vKJTiUo6W4M8RrTURCyk5MdbosuL5auEqpz-C'), new bn_js_1.default(27668319000001), Buffer.from('x2/3cqpuYzOC0CZU9bNMfGG84FT/huceZpcrcr2Bvgc=', 'base64')); | ||
}); | ||
}); |
{ | ||
"name": "ton", | ||
"version": "11.10.0", | ||
"version": "11.11.0", | ||
"repository": "https://github.com/tonwhales/ton.git", | ||
@@ -5,0 +5,0 @@ "author": "Steve Korshakov <steve@korshakov.com>", |
423752
10930