Comparing version 0.20.0 to 0.21.0
@@ -8,3 +8,3 @@ import { Address } from "../address/Address"; | ||
to: Address | string; | ||
value: bigint; | ||
value: bigint | string; | ||
bounce?: Maybe<boolean>; | ||
@@ -15,3 +15,3 @@ init?: Maybe<{ | ||
}>; | ||
body?: Cell; | ||
body?: Cell | string; | ||
}): InternalMessage; | ||
@@ -18,0 +18,0 @@ export declare function external(src: { |
@@ -13,2 +13,3 @@ "use strict"; | ||
const Builder_1 = require("../boc/Builder"); | ||
const convert_1 = require("../utils/convert"); | ||
function internal(src) { | ||
@@ -31,10 +32,26 @@ // Resolve bounce | ||
} | ||
// Resolve value | ||
let value; | ||
if (typeof src.value === 'string') { | ||
value = (0, convert_1.toNano)(src.value); | ||
} | ||
else { | ||
value = src.value; | ||
} | ||
// Resolve body | ||
let body = new EmptyMessage_1.EmptyMessage(); | ||
if (typeof src.body === 'string') { | ||
body = new CommentMessage_1.CommentMessage(src.body); | ||
} | ||
else if (src.body) { | ||
body = new CellMessage_1.CellMessage(src.body); | ||
} | ||
// Create message | ||
return new InternalMessage_1.InternalMessage({ | ||
to: to, | ||
value: src.value, | ||
value, | ||
bounce: src.bounce || false, | ||
body: new CommonMessageInfo_1.CommonMessageInfo({ | ||
stateInit: src.init ? new StateInit_1.StateInit(src.init) : null, | ||
body: src.body ? new CellMessage_1.CellMessage(src.body) : new EmptyMessage_1.EmptyMessage() | ||
body | ||
}) | ||
@@ -41,0 +58,0 @@ }); |
{ | ||
"name": "ton-core", | ||
"version": "0.20.0", | ||
"version": "0.21.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/ton-community/ton-core.git", |
@@ -12,9 +12,11 @@ import { Address } from "../address/Address"; | ||
import { beginCell } from "../boc/Builder"; | ||
import { toNano } from "../utils/convert"; | ||
import { Message } from "./Message"; | ||
export function internal(src: { | ||
to: Address | string, | ||
value: bigint, | ||
value: bigint | string, | ||
bounce?: Maybe<boolean>, | ||
init?: Maybe<{ code?: Maybe<Cell>, data?: Maybe<Cell> }>, | ||
body?: Cell | ||
body?: Cell | string | ||
}) { | ||
@@ -38,10 +40,26 @@ | ||
// Resolve value | ||
let value: bigint; | ||
if (typeof src.value === 'string') { | ||
value = toNano(src.value); | ||
} else { | ||
value = src.value; | ||
} | ||
// Resolve body | ||
let body: Message = new EmptyMessage(); | ||
if (typeof src.body === 'string') { | ||
body = new CommentMessage(src.body); | ||
} else if (src.body) { | ||
body = new CellMessage(src.body); | ||
} | ||
// Create message | ||
return new InternalMessage({ | ||
to: to, | ||
value: src.value, | ||
value, | ||
bounce: src.bounce || false, | ||
body: new CommonMessageInfo({ | ||
stateInit: src.init ? new StateInit(src.init) : null, | ||
body: src.body ? new CellMessage(src.body) : new EmptyMessage() | ||
body | ||
}) | ||
@@ -48,0 +66,0 @@ }); |
796060
12898