Comparing version 4.16.0 to 4.17.0
/// <reference types="node" /> | ||
import { Address } from '../..'; | ||
import * as t from 'io-ts'; | ||
declare const message: t.TypeC<{ | ||
source: t.StringC; | ||
destination: t.StringC; | ||
value: t.StringC; | ||
fwd_fee: t.StringC; | ||
ihr_fee: t.StringC; | ||
created_lt: t.StringC; | ||
body_hash: t.StringC; | ||
msg_data: t.UnionC<[t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataRaw">; | ||
body: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataText">; | ||
text: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataDecryptedText">; | ||
text: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataEncryptedText">; | ||
text: t.StringC; | ||
}>]>; | ||
}>; | ||
declare const getTransactions: t.ArrayC<t.TypeC<{ | ||
data: t.StringC; | ||
utime: t.NumberC; | ||
transaction_id: t.TypeC<{ | ||
lt: t.StringC; | ||
hash: t.StringC; | ||
}>; | ||
fee: t.StringC; | ||
storage_fee: t.StringC; | ||
other_fee: t.StringC; | ||
in_msg: t.UnionC<[t.UndefinedC, t.TypeC<{ | ||
source: t.StringC; | ||
destination: t.StringC; | ||
value: t.StringC; | ||
fwd_fee: t.StringC; | ||
ihr_fee: t.StringC; | ||
created_lt: t.StringC; | ||
body_hash: t.StringC; | ||
msg_data: t.UnionC<[t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataRaw">; | ||
body: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataText">; | ||
text: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataDecryptedText">; | ||
text: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataEncryptedText">; | ||
text: t.StringC; | ||
}>]>; | ||
}>]>; | ||
out_msgs: t.ArrayC<t.TypeC<{ | ||
source: t.StringC; | ||
destination: t.StringC; | ||
value: t.StringC; | ||
fwd_fee: t.StringC; | ||
ihr_fee: t.StringC; | ||
created_lt: t.StringC; | ||
body_hash: t.StringC; | ||
msg_data: t.UnionC<[t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataRaw">; | ||
body: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataText">; | ||
text: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataDecryptedText">; | ||
text: t.StringC; | ||
}>, t.TypeC<{ | ||
'@type': t.LiteralC<"msg.dataEncryptedText">; | ||
text: t.StringC; | ||
}>]>; | ||
}>>; | ||
}>>; | ||
export declare type HTTPTransaction = t.TypeOf<typeof getTransactions>[number]; | ||
export declare type HTTPMessage = t.TypeOf<typeof message>; | ||
export declare class HttpApi { | ||
@@ -35,2 +115,15 @@ readonly endpoint: string; | ||
body_hash: string; | ||
msg_data: { | ||
'@type': "msg.dataRaw"; | ||
body: string; | ||
} | { | ||
'@type': "msg.dataText"; | ||
text: string; | ||
} | { | ||
'@type': "msg.dataDecryptedText"; | ||
text: string; | ||
} | { | ||
'@type': "msg.dataEncryptedText"; | ||
text: string; | ||
}; | ||
} | undefined; | ||
@@ -45,2 +138,15 @@ out_msgs: { | ||
body_hash: string; | ||
msg_data: { | ||
'@type': "msg.dataRaw"; | ||
body: string; | ||
} | { | ||
'@type': "msg.dataText"; | ||
text: string; | ||
} | { | ||
'@type': "msg.dataDecryptedText"; | ||
text: string; | ||
} | { | ||
'@type': "msg.dataEncryptedText"; | ||
text: string; | ||
}; | ||
}[]; | ||
@@ -56,1 +162,2 @@ }[]>; | ||
} | ||
export {}; |
@@ -45,2 +45,30 @@ "use strict"; | ||
}); | ||
const messageData = t.union([ | ||
t.type({ | ||
'@type': t.literal('msg.dataRaw'), | ||
'body': t.string | ||
}), | ||
t.type({ | ||
'@type': t.literal('msg.dataText'), | ||
'text': t.string | ||
}), | ||
t.type({ | ||
'@type': t.literal('msg.dataDecryptedText'), | ||
'text': t.string | ||
}), | ||
t.type({ | ||
'@type': t.literal('msg.dataEncryptedText'), | ||
'text': t.string | ||
}) | ||
]); | ||
const message = t.type({ | ||
source: t.string, | ||
destination: t.string, | ||
value: t.string, | ||
fwd_fee: t.string, | ||
ihr_fee: t.string, | ||
created_lt: t.string, | ||
body_hash: t.string, | ||
msg_data: messageData | ||
}); | ||
const getTransactions = t.array(t.type({ | ||
@@ -56,20 +84,4 @@ data: t.string, | ||
other_fee: t.string, | ||
in_msg: t.union([t.undefined, t.type({ | ||
source: t.string, | ||
destination: t.string, | ||
value: t.string, | ||
fwd_fee: t.string, | ||
ihr_fee: t.string, | ||
created_lt: t.string, | ||
body_hash: t.string | ||
})]), | ||
out_msgs: t.array(t.type({ | ||
source: t.string, | ||
destination: t.string, | ||
value: t.string, | ||
fwd_fee: t.string, | ||
ihr_fee: t.string, | ||
created_lt: t.string, | ||
body_hash: t.string | ||
})) | ||
in_msg: t.union([t.undefined, message]), | ||
out_msgs: t.array(message) | ||
})); | ||
@@ -76,0 +88,0 @@ class HttpApi { |
@@ -75,3 +75,8 @@ "use strict"; | ||
value: new bn_js_1.BN(t.value), | ||
createdLt: t.created_lt | ||
createdLt: t.created_lt, | ||
body: (t.msg_data['@type'] === 'msg.dataRaw' | ||
? { type: 'data', data: Buffer.from(t.msg_data.body, 'base64') } | ||
: (t.msg_data['@type'] === 'msg.dataText' | ||
? { type: 'text', text: Buffer.from(t.msg_data.text, 'base64').toString('utf-8') } | ||
: null)) | ||
}; | ||
@@ -78,0 +83,0 @@ } |
@@ -0,3 +1,11 @@ | ||
/// <reference types="node" /> | ||
import BN from "bn.js"; | ||
import { Address } from ".."; | ||
export declare type TonMessageData = { | ||
type: 'text'; | ||
text: string; | ||
} | { | ||
type: 'data'; | ||
data: Buffer; | ||
}; | ||
export declare type TonMessage = { | ||
@@ -10,2 +18,3 @@ source: Address | null; | ||
createdLt: string; | ||
body: TonMessageData | null; | ||
}; | ||
@@ -12,0 +21,0 @@ export declare type TonTransaction = { |
@@ -9,3 +9,3 @@ export { BitString } from './boc/BitString'; | ||
export { KeyStore, KeyRecord } from './keystore/KeyStore'; | ||
export { TonTransaction, TonMessage } from './client/TonTransaction'; | ||
export { TonTransaction, TonMessage, TonMessageData } from './client/TonTransaction'; | ||
export { SendMode } from './client/SendMode'; | ||
@@ -12,0 +12,0 @@ export { Message } from './messages/Message'; |
{ | ||
"name": "ton", | ||
"version": "4.16.0", | ||
"version": "4.17.0", | ||
"repository": "https://github.com/ex3ndr/ton.git", | ||
@@ -5,0 +5,0 @@ "author": "Steve Korshakov <steve@korshakov.com>", |
204808
5036