lotus/lotuspond/front/src/chain/send.js

42 lines
818 B
JavaScript
Raw Normal View History

2019-08-09 15:59:12 +00:00
import util from 'ipld-dag-cbor'
import { Buffer } from 'buffer'
import { Tagged } from 'borc'
async function pushMessage(client, from, inmsg) {
if(!inmsg.GasLimit) {
2019-08-19 14:47:09 +00:00
inmsg.GasLimit = "1000"
2019-08-09 15:59:12 +00:00
}
if(!inmsg.GasPrice) {
inmsg.GasPrice = "0"
}
if(!inmsg.Params) {
inmsg.Params = "oA==" // 0b101_00000: empty cbor map: {}
}
if(!inmsg.Value) {
inmsg.Value = "0"
}
if(!inmsg.Method) {
inmsg.Method = 0
}
/* const msg = [
inmsg.To,
inmsg.From,
inmsg.Nonce,
inmsg.Value,
inmsg.GasPrice,
inmsg.GasLimit,
inmsg.Method,
Buffer.from(inmsg.Params, 'base64'),
]*/
2019-09-16 14:17:08 +00:00
console.log(inmsg)
2019-08-09 15:59:12 +00:00
2019-09-16 14:17:08 +00:00
await client.call('Filecoin.MpoolPushMessage', [inmsg])
2019-08-09 15:59:12 +00:00
}
export default pushMessage