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

37 lines
700 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.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
2020-11-09 17:42:22 +00:00
await client.call('Filecoin.MpoolPushMessage', [inmsg, null])
2019-08-09 15:59:12 +00:00
}
export default pushMessage