Closed ewagmig closed 5 years ago
tx :
{
"type": "qbase/txs/stdtx",
"value": {
"itx": [
{
"type": "transfer/txs/TxTransfer",
"value": {
"senders": [
{
"addr": "address1l6juaqy9fk0dps0fn5dcg4fpy36zmryp8my4ux",
"qos": "100000",
"qscs": null
}
],
"receivers": [
{
"addr": "address10xwx06gnrt3dlz7hfrx6a8wx3gyeghxm54rv7a",
"qos": "100000",
"qscs": null
}
]
}
}
],
"sigature": [
{
"pubkey": {
"type": "tendermint/PubKeyEd25519",
"value": "h/a8Rcm87kf2/Od5UPGffcGFMht6kDoeEr/4C8RcPuU="
},
"signature": "ekTFe+0JdwS41RaO+9JUtqzb4NPdoPNqPEE/CLnicXzxJUAup/X5P8Htp5hfmlwvtWoZtPDvH/8iSPwVHMUSAg==",
"nonce": "3"
}
],
"chainid": "capricorn-3000",
"maxgas": "100000"
}
}
tx
above@tendermint/amino-js
to marshal the tx
, e.g. import { marshalTx, unmarshalTx } from '@tendermint/amino-js';
Gopherjs build large js file which could not be used by the front end. So the other step is in need to extend the cosmos/amino-js
project with qos/qbase codec.
Let see what would happen next~
The flow is clear with iteration with Wenshun and the agreements are as below:
The message
type could be declared and registered in cosmos/amino-js
extension part with QOS
special characters.
Encode the message
into type as input of below sign
method
// Sign a message.
var message = nacl.util.decodeUTF8('Hello!');
var signedMessage = nacl.sign(message, myKeyPair.secretKey);
Use the corresponding marshal method e.g. QosMarshaTx
to marshal the tx body into Amino Bytes
Broadcast the Amino Bytes to the chain
The compiled js body is too large to be employed! Refer to other native js library: https://github.com/cybercongress/js-amino
Transaction transfer
done. Continue with delegation transaction type.
tx :
{
"type": "qbase/txs/stdtx",
"value": {
"itx": [
{
"type": "stake/txs/TxCreateDelegation",
"value": {
"Delegator": "address1u6g62jxqcjla9yzffs9kpwlyvtwyd0fk44vd8a",
"ValidatorOwner": "address1u6g62jxqcjla9yzffs9kpwlyvtwyd0fk44vd8a",
"Amount": "800000000",
"IsCompound": false
}
}
],
"sigature": [
{
"pubkey": {
"type": "tendermint/PubKeyEd25519",
"value": "39DIZhCJ8A6WBM3M9btt6kuH8yXm2l7Vm7z3R/XJsbs="
},
"signature": "3yfl9gCTY3YI2AHInBXYhPNje6JfAD4DfM128Rm2+zz3DFaa0/1DzEU2eqPI3mptMd1JDn7tsikD/t/TTi92Bg==",
"nonce": "2"
}
],
"chainid": "aquarius-1000",
"maxgas": "9223372036854775807"
}
}
then the re-delegation transaction type. tx:
{
"type": "qbase/txs/stdtx",
"value": {
"itx": [
{
"type": "stake/txs/TxCreateReDelegation",
"value": {
"Delegator": "address1nrm24vxav0u58jpt04v7vtavrjjxww60x9ym7p",
"FromValidatorOwner": "address1nrm24vxav0u58jpt04v7vtavrjjxww60x9ym7p",
"ToValidatorOwner": "address1kv9pn2snpmue4gjr787lhaznjuxpj9vt0t34mf",
"Amount": "10000000",
"IsRedelegateAll": false,
"IsCompound": false
}
}
],
"sigature": [
{
"pubkey": {
"type": "tendermint/PubKeyEd25519",
"value": "9fpQTirTSpYNHw4qu6CdN456oEZeb5AM0PxIMRZre2s="
},
"signature": "Xz5rEgMr2ZYfNRnjjgk1P8WP3l+WhaJozqv4p9ykSBYO5swMHJFQ3vn/9qT/8+gUoROmlmu0pBZJVnfUGZjkAA==",
"nonce": "7"
}
],
"chainid": "aquarius-1000",
"maxgas": "9223372036854775807"
}
}
to be continued with the following new tx types:
unbond-delegate
approve
Tianfei well continue with the latest code restructuring in QOS chain
The Delegation transaction has been completed
approve tx:
{"type":"qbase/txs/stdtx","value":{"itx":[{"type":"approve/txs/TxCreateApprove","value":{"Approve":{"from":"address1v26ael2jh0q7aetuk45yqf3jcyyywg2g6wq2tv","to":"address1nzv9awha9606jp5rpqe2kujckddpyauggu56ru","qos":"10000","qscs":null}}}],"sigature":[{"pubkey":{"type":"tendermint/PubKeyEd25519","value":"lUW+X+53gcSLC1B4DvtdzoN/JmjthOJM+eZF/uKGx1k="},"signature":"e5cpV8nkb673gNiDMu+rPZEvZE3deURPunS8Up3fz1givqHWS6rRQWkOj9MLhATelywwV1NYOE06iNyiiifqAQ==","nonce":"10"}],"chainid":"aquarius-1000","maxgas":"2000000"}}
All tx types had completed.