🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

ton-ledger

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ton-ledger - npm Package Compare versions

Comparing version

to
2.1.0

23

dist/TonTransport.d.ts

@@ -22,2 +22,25 @@ /// <reference types="node" />

amount: BN;
} | {
type: 'transfer-ownership';
queryId: BN | null;
address: Address;
} | {
type: 'create-proposal';
queryId: BN | null;
id: number | null;
proposal: Cell;
metadata: Cell;
} | {
type: 'vote-proposal';
queryId: BN | null;
id: number;
vote: 'yes' | 'no' | 'abstain';
} | {
type: 'execute-proposal';
queryId: BN | null;
id: number;
} | {
type: 'abort-proposal';
queryId: BN | null;
id: number;
};

@@ -24,0 +47,0 @@ export declare class TonTransport {

187

dist/TonTransport.js

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

writeUint64(transaction.amount),
writeUint8(transaction.to.workChain === -1 ? 0xff : transaction.to.workChain),
transaction.to.hash,
writeAddress(transaction.to),
writeUint8(transaction.bounce ? 1 : 0),

@@ -215,3 +214,3 @@ writeUint8(transaction.sendMode),

writeUint8(1),
writeUint32(0x01)
writeUint32(0x02)
]);

@@ -248,3 +247,3 @@ // Build cells and hints

writeUint8(1),
writeUint32(0x01)
writeUint32(0x03)
]);

@@ -282,2 +281,170 @@ // Build cells and hints

}
else if (transaction.payload.type === 'transfer-ownership') {
hints = Buffer.concat([
writeUint8(1),
writeUint32(0x04)
]);
// Build cells and hints
let b = (0, ton_1.beginCell)()
.storeUint(0x295e75a9, 32);
let d = Buffer.alloc(0);
// Query ID
if (transaction.payload.queryId !== null) {
d = Buffer.concat([d, writeUint8(1), writeUint64(transaction.payload.queryId)]);
b = b.storeUint(transaction.payload.queryId, 64);
}
else {
d = Buffer.concat([d, writeUint8(0)]);
}
// Address
d = Buffer.concat([d,
writeAddress(transaction.payload.address),
]);
b = b.storeAddress(transaction.payload.address);
// Complete
payload = b.endCell();
hints = Buffer.concat([
hints,
writeUint16(d.length),
d
]);
}
else if (transaction.payload.type === 'create-proposal') {
hints = Buffer.concat([
writeUint8(1),
writeUint32(0x05)
]);
// Build cells and hints
let b = (0, ton_1.beginCell)()
.storeUint(0xc1387443, 32);
let d = Buffer.alloc(0);
// Query ID
if (transaction.payload.queryId !== null) {
d = Buffer.concat([d, writeUint8(1), writeUint64(transaction.payload.queryId)]);
b = b.storeUint(transaction.payload.queryId, 64);
}
else {
d = Buffer.concat([d, writeUint8(0)]);
}
// Proposal ID
if (transaction.payload.id !== null) {
d = Buffer.concat([d, writeUint8(1), writeUint32(transaction.payload.id)]);
b = b.storeUint(transaction.payload.id, 32);
}
else {
d = Buffer.concat([d, writeUint8(0)]);
}
// Proposal
d = Buffer.concat([d,
writeCellRef(transaction.payload.proposal)
]);
b = b.storeRef(transaction.payload.proposal);
// Proposal
d = Buffer.concat([d,
writeCellRef(transaction.payload.metadata)
]);
b = b.storeRef(transaction.payload.metadata);
// Complete
payload = b.endCell();
hints = Buffer.concat([
hints,
writeUint16(d.length),
d
]);
}
else if (transaction.payload.type === 'vote-proposal') {
hints = Buffer.concat([
writeUint8(1),
writeUint32(0x06)
]);
// Build cells and hints
let b = (0, ton_1.beginCell)()
.storeUint(0xb5a563c1, 32);
let d = Buffer.alloc(0);
// Query ID
if (transaction.payload.queryId !== null) {
d = Buffer.concat([d, writeUint8(1), writeUint64(transaction.payload.queryId)]);
b = b.storeUint(transaction.payload.queryId, 64);
}
else {
d = Buffer.concat([d, writeUint8(0)]);
}
// ID
d = Buffer.concat([d, writeUint32(transaction.payload.id)]);
b = b.storeUint(transaction.payload.id, 32);
// Vote
let voteKey = 0x00;
if (transaction.payload.vote === 'yes') {
voteKey = 0x01;
}
else if (transaction.payload.vote === 'abstain') {
voteKey = 0x02;
}
// Store
d = Buffer.concat([d, writeUint8(voteKey)]);
b = b.storeUint(voteKey, 2);
// Complete
payload = b.endCell();
hints = Buffer.concat([
hints,
writeUint16(d.length),
d
]);
}
else if (transaction.payload.type === 'execute-proposal') {
hints = Buffer.concat([
writeUint8(1),
writeUint32(0x07)
]);
// Build cells and hints
let b = (0, ton_1.beginCell)()
.storeUint(0x93ff9cd3, 32);
let d = Buffer.alloc(0);
// Query ID
if (transaction.payload.queryId !== null) {
d = Buffer.concat([d, writeUint8(1), writeUint64(transaction.payload.queryId)]);
b = b.storeUint(transaction.payload.queryId, 64);
}
else {
d = Buffer.concat([d, writeUint8(0)]);
}
// ID
d = Buffer.concat([d, writeUint32(transaction.payload.id)]);
b = b.storeUint(transaction.payload.id, 32);
// Complete
payload = b.endCell();
hints = Buffer.concat([
hints,
writeUint16(d.length),
d
]);
}
else if (transaction.payload.type === 'abort-proposal') {
hints = Buffer.concat([
writeUint8(1),
writeUint32(0x08)
]);
// Build cells and hints
let b = (0, ton_1.beginCell)()
.storeUint(0x5ce656a5, 32);
let d = Buffer.alloc(0);
// Query ID
if (transaction.payload.queryId !== null) {
d = Buffer.concat([d, writeUint8(1), writeUint64(transaction.payload.queryId)]);
b = b.storeUint(transaction.payload.queryId, 64);
}
else {
d = Buffer.concat([d, writeUint8(0)]);
}
// ID
d = Buffer.concat([d, writeUint32(transaction.payload.id)]);
b = b.storeUint(transaction.payload.id, 32);
// Complete
payload = b.endCell();
hints = Buffer.concat([
hints,
writeUint16(d.length),
d
]);
}
}

@@ -420,1 +587,13 @@ //

}
function writeAddress(address) {
return Buffer.concat([
writeUint8(address.workChain === -1 ? 0xff : address.workChain),
address.hash
]);
}
function writeCellRef(ref) {
return Buffer.concat([
writeUint16(ref.getMaxDepth()),
ref.hash()
]);
}

2

package.json
{
"name": "ton-ledger",
"version": "2.0.0",
"version": "2.1.0",
"repository": "https://github.com/ton-foundation/ton-ledger-ts.git",

@@ -5,0 +5,0 @@ "author": "Steve Korshakov <steve@korshakov.com>",