Skip to content

Commit fb4ba4d

Browse files
committed
regenerate protobuf files
1 parent e9cd6b2 commit fb4ba4d

14 files changed

Lines changed: 1361 additions & 12967 deletions

keepkeylib/mayachain.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import base64
2+
import schema
3+
import copy
4+
5+
tx_schema = schema.Schema({
6+
"tx": schema.Schema({
7+
"fee": schema.Schema({
8+
"amount": schema.Schema([{
9+
"denom": "cacao",
10+
"amount": str
11+
}]),
12+
"gas": str
13+
}),
14+
"memo": str,
15+
# NOTE: this needs to be 'msgs' when signing, but 'msg' when broadcasting.
16+
"msg": schema.Schema([{
17+
"type": "mayachain/MsgSend",
18+
"value": schema.Schema({
19+
"from_address": str,
20+
"to_address": str,
21+
"amount": schema.Schema([{
22+
"denom": str,
23+
"amount": str
24+
}])
25+
})
26+
}]),
27+
schema.Optional("signatures"): None,
28+
}),
29+
"type": "cosmos-sdk/StdTx",
30+
"mode": "sync"
31+
})
32+
33+
def mayachain_parse_tx(tx):
34+
validated = tx_schema.validate(tx)
35+
36+
stdtx = validated['tx']
37+
38+
return {
39+
'fee': stdtx['fee']['amount'][0]['amount'],
40+
'gas': stdtx['fee']['gas'],
41+
'msgs': stdtx['msg'],
42+
'memo': stdtx['memo']
43+
}
44+
45+
46+
def mayachain_append_sig(tx, public_key, signature):
47+
tx = copy.deepcopy(tx)
48+
49+
tx['tx']['signatures'] = [{
50+
"pub_key": {
51+
"type": "tendermint/PubKeySecp256k1",
52+
"value": base64.b64encode(public_key)
53+
},
54+
"signature": base64.b64encode(signature)
55+
}]
56+
57+
return tx

0 commit comments

Comments
 (0)