Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/tonweb.js

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions dist/types/contract/wallet/v5/wallet-v5-contract.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Cell } from '../../../boc/cell';
import { HttpProvider } from '../../../providers/http-provider';
import { WalletContract, WalletContractOptions, WalletContractMethods } from '../wallet-contract';

export interface WalletV5ContractMethods extends WalletContractMethods {
getWalletId: () => Promise<number>;
getSeqno: () => Promise<number>;
getIsSignatureAuthAllowed: () => Promise<number>;
getExtensions: () => Promise<Cell>;
getExtensionsList: () => Promise<string[]>;
}

export declare class WalletV5Contract extends WalletContract<WalletContractOptions, WalletV5ContractMethods> {
constructor(provider: HttpProvider, options: WalletContractOptions);
getName(): string;
getWalletId(): Promise<number>;
getSeqno(): Promise<number>;
getIsSignatureAuthAllowed(): Promise<number>;
getExtensions(): Promise<Cell>;
getExtensionsList(): Promise<string[]>;
}
42 changes: 21 additions & 21 deletions src/contract/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {Cell} = require("../boc");
const {Address, bytesToBase64, bytesToHex, BN} = require("../utils");
const { Cell } = require("../boc");
const { Address, bytesToBase64, bytesToHex, BN } = require("../utils");

class Contract {
/**
Expand Down Expand Up @@ -72,10 +72,10 @@ class Contract {
* @return {Cell}
*/
static createStateInit(code,
data,
library = null,
splitDepth = null,
ticktock = null) {
data,
library = null,
splitDepth = null,
ticktock = null) {
if (library)
throw "Library in state init is not implemented";
if (splitDepth)
Expand Down Expand Up @@ -119,16 +119,16 @@ class Contract {
* @return {Cell}
*/
static createInternalMessageHeader(dest,
gramValue = 0,
ihrDisabled = true,
bounce = null,
bounced = false,
src = null,
currencyCollection = null,
ihrFees = 0,
fwdFees = 0,
createdLt = 0,
createdAt = 0) {
gramValue = 0,
ihrDisabled = true,
bounce = null,
bounced = false,
src = null,
currencyCollection = null,
ihrFees = 0,
fwdFees = 0,
createdLt = 0,
createdAt = 0) {
const message = new Cell();
message.bits.writeBit(false);
message.bits.writeBit(ihrDisabled);
Expand Down Expand Up @@ -161,8 +161,8 @@ class Contract {
* @return {Cell}
*/
static createExternalMessageHeader(dest,
src = null,
importFee = 0) {
src = null,
importFee = 0) {
const message = new Cell();
message.bits.writeUint(2, 2);
message.bits.writeAddress(src ? new Address(src) : null);
Expand Down Expand Up @@ -206,7 +206,7 @@ class Contract {
* @param body? {Cell}
* @return {Cell}
*/
static createCommonMsgInfo(header, stateInit = null, body = null) {
static createCommonMsgInfo(header, stateInit = null, body = null, bodyIsRef = false) {
const commonMsgInfo = new Cell();
commonMsgInfo.writeCell(header);

Expand All @@ -227,7 +227,7 @@ class Contract {
}
// TODO we also should check for free refs here
if (body) {
if ((commonMsgInfo.bits.getFreeBits() >= body.bits.getUsedBits()) && (commonMsgInfo.refs.length + body.refs.length <= 4)) {
if (!bodyIsRef && (commonMsgInfo.bits.getFreeBits() >= body.bits.getUsedBits()) && (commonMsgInfo.refs.length + body.refs.length <= 4)) {
commonMsgInfo.bits.writeBit(false);
commonMsgInfo.writeCell(body);
} else {
Expand Down Expand Up @@ -279,4 +279,4 @@ class Contract {
}
}

module.exports = {Contract};
module.exports = { Contract };
Loading