@shapeshiftoss/hdwallet-keepkey 1.62.39 → 1.62.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +6 -6
- package/dist/cjs/.tsbuildinfo +1 -0
- package/dist/{adapter.d.ts → cjs/adapter.d.ts} +6 -7
- package/dist/cjs/adapter.js +146 -0
- package/dist/{binance.d.ts → cjs/binance.d.ts} +3 -4
- package/dist/cjs/binance.js +144 -0
- package/dist/{bitcoin.d.ts → cjs/bitcoin.d.ts} +3 -4
- package/dist/cjs/bitcoin.js +549 -0
- package/dist/{bnbencoding.d.ts → cjs/bnbencoding.d.ts} +3 -2
- package/dist/{bnbencoding.js → cjs/bnbencoding.js} +22 -22
- package/dist/{cosmos.d.ts → cjs/cosmos.d.ts} +4 -5
- package/dist/cjs/cosmos.js +219 -0
- package/dist/{eos.d.ts → cjs/eos.d.ts} +3 -4
- package/dist/cjs/eos.js +244 -0
- package/dist/{ethereum.d.ts → cjs/ethereum.d.ts} +4 -5
- package/dist/cjs/ethereum.js +264 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/{index.js → cjs/index.js} +0 -1
- package/dist/{keepkey.d.ts → cjs/keepkey.d.ts} +45 -20
- package/dist/cjs/keepkey.js +959 -0
- package/dist/{mayachain.d.ts → cjs/mayachain.d.ts} +4 -5
- package/dist/cjs/mayachain.js +169 -0
- package/dist/{osmosis.d.ts → cjs/osmosis.d.ts} +4 -5
- package/dist/cjs/osmosis.js +270 -0
- package/dist/cjs/package.json +1 -0
- package/dist/{ripple.d.ts → cjs/ripple.d.ts} +3 -4
- package/dist/cjs/ripple.js +104 -0
- package/dist/{thorchain.d.ts → cjs/thorchain.d.ts} +4 -5
- package/dist/cjs/thorchain.js +169 -0
- package/dist/{transport.d.ts → cjs/transport.d.ts} +2 -3
- package/dist/cjs/transport.js +333 -0
- package/dist/{typeRegistry.d.ts → cjs/typeRegistry.d.ts} +2 -3
- package/dist/{typeRegistry.js → cjs/typeRegistry.js} +26 -13
- package/dist/{utils.d.ts → cjs/utils.d.ts} +1 -2
- package/dist/{utils.js → cjs/utils.js} +7 -8
- package/dist/esm/.tsbuildinfo +1 -0
- package/dist/esm/adapter.d.ts +35 -0
- package/dist/esm/adapter.js +119 -0
- package/dist/esm/binance.d.ts +5 -0
- package/dist/esm/binance.js +112 -0
- package/dist/esm/bitcoin.d.ts +11 -0
- package/dist/esm/bitcoin.js +511 -0
- package/dist/esm/bnbencoding.d.ts +11 -0
- package/dist/esm/bnbencoding.js +103 -0
- package/dist/esm/cosmos.d.ts +6 -0
- package/dist/esm/cosmos.js +187 -0
- package/dist/esm/eos.d.ts +5 -0
- package/dist/esm/eos.js +212 -0
- package/dist/esm/ethereum.d.ts +17 -0
- package/dist/esm/ethereum.js +229 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/keepkey.d.ts +177 -0
- package/dist/esm/keepkey.js +925 -0
- package/dist/esm/mayachain.d.ts +6 -0
- package/dist/esm/mayachain.js +137 -0
- package/dist/esm/osmosis.d.ts +6 -0
- package/dist/esm/osmosis.js +238 -0
- package/dist/esm/ripple.d.ts +5 -0
- package/dist/esm/ripple.js +72 -0
- package/dist/esm/thorchain.d.ts +6 -0
- package/dist/esm/thorchain.js +137 -0
- package/dist/esm/transport.d.ts +55 -0
- package/dist/esm/transport.js +306 -0
- package/dist/esm/typeRegistry.d.ts +4 -0
- package/dist/esm/typeRegistry.js +47 -0
- package/dist/esm/utils.d.ts +6 -0
- package/dist/esm/utils.js +56 -0
- package/package.json +33 -19
- package/dist/adapter.d.ts.map +0 -1
- package/dist/adapter.js +0 -175
- package/dist/adapter.js.map +0 -1
- package/dist/binance.d.ts.map +0 -1
- package/dist/binance.js +0 -146
- package/dist/binance.js.map +0 -1
- package/dist/bitcoin.d.ts.map +0 -1
- package/dist/bitcoin.js +0 -568
- package/dist/bitcoin.js.map +0 -1
- package/dist/bnbencoding.d.ts.map +0 -1
- package/dist/bnbencoding.js.map +0 -1
- package/dist/cosmos.d.ts.map +0 -1
- package/dist/cosmos.js +0 -230
- package/dist/cosmos.js.map +0 -1
- package/dist/eos.d.ts.map +0 -1
- package/dist/eos.js +0 -247
- package/dist/eos.js.map +0 -1
- package/dist/ethereum.d.ts.map +0 -1
- package/dist/ethereum.js +0 -281
- package/dist/ethereum.js.map +0 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/keepkey.d.ts.map +0 -1
- package/dist/keepkey.js +0 -1027
- package/dist/keepkey.js.map +0 -1
- package/dist/mayachain.d.ts.map +0 -1
- package/dist/mayachain.js +0 -180
- package/dist/mayachain.js.map +0 -1
- package/dist/osmosis.d.ts.map +0 -1
- package/dist/osmosis.js +0 -278
- package/dist/osmosis.js.map +0 -1
- package/dist/ripple.d.ts.map +0 -1
- package/dist/ripple.js +0 -111
- package/dist/ripple.js.map +0 -1
- package/dist/thorchain.d.ts.map +0 -1
- package/dist/thorchain.js +0 -180
- package/dist/thorchain.js.map +0 -1
- package/dist/transport.d.ts.map +0 -1
- package/dist/transport.js +0 -365
- package/dist/transport.js.map +0 -1
- package/dist/typeRegistry.d.ts.map +0 -1
- package/dist/typeRegistry.js.map +0 -1
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as MayachainMessages from '@keepkey/device-protocol/lib/messages-mayachain_pb';
|
|
2
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
3
|
+
import type { Transport } from './transport.js';
|
|
4
|
+
export declare function mayachainGetAccountPaths(msg: core.MayachainGetAccountPaths): core.MayachainAccountPath[];
|
|
5
|
+
export declare function mayachainGetAddress(transport: Transport, msg: MayachainMessages.MayachainGetAddress.AsObject): Promise<string>;
|
|
6
|
+
export declare function mayachainSignTx(transport: Transport, msg: core.MayachainSignTx): Promise<core.MayachainSignedTx>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as Messages from '@keepkey/device-protocol/lib/messages_pb';
|
|
2
|
+
import * as MayachainMessages from '@keepkey/device-protocol/lib/messages-mayachain_pb';
|
|
3
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
4
|
+
import bs58check from 'bs58check';
|
|
5
|
+
import PLazy from 'p-lazy';
|
|
6
|
+
const protoTxBuilder = PLazy.from(() => import('@shapeshiftoss/proto-tx-builder'));
|
|
7
|
+
export function mayachainGetAccountPaths(msg) {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
addressNList: [
|
|
11
|
+
0x80000000 + 44,
|
|
12
|
+
0x80000000 + core.slip44ByCoin('Mayachain'),
|
|
13
|
+
0x80000000 + msg.accountIdx,
|
|
14
|
+
0,
|
|
15
|
+
0,
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
export async function mayachainGetAddress(transport, msg) {
|
|
21
|
+
const getAddr = new MayachainMessages.MayachainGetAddress();
|
|
22
|
+
getAddr.setAddressNList(msg.addressNList);
|
|
23
|
+
getAddr.setShowDisplay(msg.showDisplay !== false);
|
|
24
|
+
if (msg.testnet !== undefined)
|
|
25
|
+
getAddr.setTestnet(msg.testnet);
|
|
26
|
+
const response = await transport.call(Messages.MessageType.MESSAGETYPE_MAYACHAINGETADDRESS, getAddr, {
|
|
27
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
28
|
+
});
|
|
29
|
+
const mayachainAddress = response.proto;
|
|
30
|
+
return core.mustBeDefined(mayachainAddress.getAddress());
|
|
31
|
+
}
|
|
32
|
+
export async function mayachainSignTx(transport, msg) {
|
|
33
|
+
const address = await mayachainGetAddress(transport, { addressNList: msg.addressNList });
|
|
34
|
+
const getPublicKeyMsg = new Messages.GetPublicKey();
|
|
35
|
+
getPublicKeyMsg.setAddressNList(msg.addressNList);
|
|
36
|
+
getPublicKeyMsg.setEcdsaCurveName('secp256k1');
|
|
37
|
+
const response = await transport.call(Messages.MessageType.MESSAGETYPE_GETPUBLICKEY, getPublicKeyMsg, {
|
|
38
|
+
msgTimeout: core.DEFAULT_TIMEOUT,
|
|
39
|
+
});
|
|
40
|
+
const pubkeyMsg = response.proto;
|
|
41
|
+
const pubkey = bs58check.decode(core.mustBeDefined(pubkeyMsg.getXpub())).subarray(45);
|
|
42
|
+
return transport.lockDuring(async () => {
|
|
43
|
+
const signTx = new MayachainMessages.MayachainSignTx();
|
|
44
|
+
signTx.setAddressNList(msg.addressNList);
|
|
45
|
+
signTx.setAccountNumber(msg.account_number);
|
|
46
|
+
signTx.setChainId(msg.chain_id);
|
|
47
|
+
signTx.setFeeAmount(parseInt(msg.tx.fee.amount[0].amount));
|
|
48
|
+
signTx.setGas(parseInt(msg.tx.fee.gas));
|
|
49
|
+
signTx.setSequence(msg.sequence);
|
|
50
|
+
if (msg.tx.memo !== undefined)
|
|
51
|
+
signTx.setMemo(msg.tx.memo);
|
|
52
|
+
signTx.setMsgCount(1);
|
|
53
|
+
let resp = await transport.call(Messages.MessageType.MESSAGETYPE_MAYACHAINSIGNTX, signTx, {
|
|
54
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
55
|
+
omitLock: true,
|
|
56
|
+
});
|
|
57
|
+
for (const m of msg.tx.msg) {
|
|
58
|
+
if (resp.message_enum !== Messages.MessageType.MESSAGETYPE_MAYACHAINMSGREQUEST) {
|
|
59
|
+
throw new Error(`Unexpected response: ${resp.message_type}`);
|
|
60
|
+
}
|
|
61
|
+
const msgAck = new MayachainMessages.MayachainMsgAck();
|
|
62
|
+
switch (m.type) {
|
|
63
|
+
case 'mayachain/MsgSend': {
|
|
64
|
+
if (m.value.amount.length !== 1) {
|
|
65
|
+
throw new Error('Multiple amounts per MsgSend not supported');
|
|
66
|
+
}
|
|
67
|
+
const denom = m.value.amount[0].denom;
|
|
68
|
+
if (denom !== 'cacao')
|
|
69
|
+
throw new Error(`Unsupported denomination: ${denom}`);
|
|
70
|
+
const send = new MayachainMessages.MayachainMsgSend();
|
|
71
|
+
send.setFromAddress(m.value.from_address);
|
|
72
|
+
send.setToAddress(m.value.to_address);
|
|
73
|
+
send.setAmount(m.value.amount[0].amount);
|
|
74
|
+
send.setDenom(denom);
|
|
75
|
+
msgAck.setSend(send);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
case 'mayachain/MsgDeposit': {
|
|
79
|
+
if (m.value.coins.length !== 1) {
|
|
80
|
+
throw new Error('Multiple amounts per MsgDeposit not supported');
|
|
81
|
+
}
|
|
82
|
+
const coinAsset = m.value.coins[0].asset;
|
|
83
|
+
if (coinAsset !== 'MAYA.CACAO')
|
|
84
|
+
throw new Error(`Unsupported coin asset: ${coinAsset}`);
|
|
85
|
+
const deposit = new MayachainMessages.MayachainMsgDeposit();
|
|
86
|
+
deposit.setAsset(m.value.coins[0].asset);
|
|
87
|
+
deposit.setAmount(m.value.coins[0].amount);
|
|
88
|
+
deposit.setMemo(m.value.memo);
|
|
89
|
+
deposit.setSigner(m.value.signer);
|
|
90
|
+
msgAck.setDeposit(deposit);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
default:
|
|
94
|
+
throw new Error(`Message ${m.type} is not yet supported`);
|
|
95
|
+
}
|
|
96
|
+
resp = await transport.call(Messages.MessageType.MESSAGETYPE_MAYACHAINMSGACK, msgAck, {
|
|
97
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
98
|
+
omitLock: true,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (resp.message_enum !== Messages.MessageType.MESSAGETYPE_MAYACHAINSIGNEDTX) {
|
|
102
|
+
throw new Error(`Unexpected response: ${resp.message_type}`);
|
|
103
|
+
}
|
|
104
|
+
const signedTx = resp.proto;
|
|
105
|
+
const offlineSigner = {
|
|
106
|
+
async getAccounts() {
|
|
107
|
+
return [
|
|
108
|
+
{
|
|
109
|
+
address,
|
|
110
|
+
algo: 'secp256k1',
|
|
111
|
+
pubkey,
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
},
|
|
115
|
+
async signAmino(signerAddress, signDoc) {
|
|
116
|
+
if (signerAddress !== address)
|
|
117
|
+
throw new Error('expected signerAddress to match address');
|
|
118
|
+
return {
|
|
119
|
+
signed: signDoc,
|
|
120
|
+
signature: {
|
|
121
|
+
pub_key: {
|
|
122
|
+
type: 'tendermint/PubKeySecp256k1',
|
|
123
|
+
value: signedTx.getPublicKey_asB64(),
|
|
124
|
+
},
|
|
125
|
+
signature: signedTx.getSignature_asB64(),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
const signerData = {
|
|
131
|
+
sequence: Number(msg.sequence),
|
|
132
|
+
accountNumber: Number(msg.account_number),
|
|
133
|
+
chainId: msg.chain_id,
|
|
134
|
+
};
|
|
135
|
+
return (await protoTxBuilder).sign(address, msg.tx, offlineSigner, signerData, 'maya');
|
|
136
|
+
});
|
|
137
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as OsmosisMessages from '@keepkey/device-protocol/lib/messages-osmosis_pb';
|
|
2
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
3
|
+
import type { Transport } from './transport.js';
|
|
4
|
+
export declare function osmosisGetAccountPaths(msg: core.OsmosisGetAccountPaths): core.OsmosisAccountPath[];
|
|
5
|
+
export declare function osmosisGetAddress(transport: Transport, msg: OsmosisMessages.OsmosisGetAddress.AsObject): Promise<string>;
|
|
6
|
+
export declare function osmosisSignTx(transport: Transport, msg: core.OsmosisSignTx): Promise<any>;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import * as Messages from '@keepkey/device-protocol/lib/messages_pb';
|
|
2
|
+
import * as OsmosisMessages from '@keepkey/device-protocol/lib/messages-osmosis_pb';
|
|
3
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
4
|
+
import { sortTxFields } from '@shapeshiftoss/hdwallet-core';
|
|
5
|
+
import bs58check from 'bs58check';
|
|
6
|
+
import PLazy from 'p-lazy';
|
|
7
|
+
const protoTxBuilder = PLazy.from(() => import('@shapeshiftoss/proto-tx-builder'));
|
|
8
|
+
export function osmosisGetAccountPaths(msg) {
|
|
9
|
+
return [
|
|
10
|
+
{
|
|
11
|
+
addressNList: [
|
|
12
|
+
0x80000000 + 44,
|
|
13
|
+
0x80000000 + core.slip44ByCoin('Osmo'),
|
|
14
|
+
0x80000000 + msg.accountIdx,
|
|
15
|
+
0,
|
|
16
|
+
0,
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
export async function osmosisGetAddress(transport, msg) {
|
|
22
|
+
const getAddr = new OsmosisMessages.OsmosisGetAddress();
|
|
23
|
+
getAddr.setAddressNList(msg.addressNList);
|
|
24
|
+
getAddr.setShowDisplay(msg.showDisplay !== false);
|
|
25
|
+
const response = await transport.call(Messages.MessageType.MESSAGETYPE_OSMOSISGETADDRESS, getAddr, {
|
|
26
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
27
|
+
});
|
|
28
|
+
const osmosisAddress = response.proto;
|
|
29
|
+
return core.mustBeDefined(osmosisAddress.getAddress());
|
|
30
|
+
}
|
|
31
|
+
export async function osmosisSignTx(transport, msg) {
|
|
32
|
+
const address = await osmosisGetAddress(transport, {
|
|
33
|
+
addressNList: msg.addressNList,
|
|
34
|
+
showDisplay: false,
|
|
35
|
+
});
|
|
36
|
+
const getPublicKeyMsg = new Messages.GetPublicKey();
|
|
37
|
+
getPublicKeyMsg.setAddressNList(msg.addressNList);
|
|
38
|
+
getPublicKeyMsg.setEcdsaCurveName('secp256k1');
|
|
39
|
+
const pubkeyMsg = (await transport.call(Messages.MessageType.MESSAGETYPE_GETPUBLICKEY, getPublicKeyMsg, {
|
|
40
|
+
msgTimeout: core.DEFAULT_TIMEOUT,
|
|
41
|
+
})).proto;
|
|
42
|
+
const pubkey = bs58check.decode(core.mustBeDefined(pubkeyMsg.getXpub())).slice(45);
|
|
43
|
+
return transport.lockDuring(async () => {
|
|
44
|
+
const signTx = new OsmosisMessages.OsmosisSignTx();
|
|
45
|
+
signTx.setAddressNList(msg.addressNList);
|
|
46
|
+
signTx.setAccountNumber(msg.account_number);
|
|
47
|
+
signTx.setChainId(msg.chain_id);
|
|
48
|
+
signTx.setFeeAmount(parseInt(msg.tx.fee.amount[0].amount));
|
|
49
|
+
signTx.setGas(parseInt(msg.tx.fee.gas));
|
|
50
|
+
signTx.setSequence(msg.sequence);
|
|
51
|
+
if (msg.tx.memo !== undefined) {
|
|
52
|
+
signTx.setMemo(msg.tx.memo);
|
|
53
|
+
}
|
|
54
|
+
signTx.setMsgCount(1);
|
|
55
|
+
let resp = await transport.call(Messages.MessageType.MESSAGETYPE_OSMOSISSIGNTX, signTx, {
|
|
56
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
57
|
+
omitLock: true,
|
|
58
|
+
});
|
|
59
|
+
for (const m of msg.tx.msg) {
|
|
60
|
+
if (resp.message_enum !== Messages.MessageType.MESSAGETYPE_OSMOSISMSGREQUEST) {
|
|
61
|
+
throw new Error(`osmosis: unexpected response ${resp.message_type}`);
|
|
62
|
+
}
|
|
63
|
+
let ack;
|
|
64
|
+
switch (m.type) {
|
|
65
|
+
case 'cosmos-sdk/MsgSend': {
|
|
66
|
+
// Transfer
|
|
67
|
+
if (m.value.amount.length !== 1) {
|
|
68
|
+
throw new Error('osmosis: Multiple amounts per msg not supported');
|
|
69
|
+
}
|
|
70
|
+
const denom = m.value.amount[0].denom;
|
|
71
|
+
if (denom !== 'uosmo') {
|
|
72
|
+
throw new Error('osmosis: Unsupported denomination: ' + denom);
|
|
73
|
+
}
|
|
74
|
+
const send = new OsmosisMessages.OsmosisMsgSend();
|
|
75
|
+
send.setFromAddress(m.value.from_address);
|
|
76
|
+
send.setToAddress(m.value.to_address);
|
|
77
|
+
send.setDenom(m.value.amount[0].denom);
|
|
78
|
+
send.setAmount(m.value.amount[0].amount);
|
|
79
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
80
|
+
ack.setSend(send);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
case 'cosmos-sdk/MsgDelegate': {
|
|
84
|
+
// Delegate
|
|
85
|
+
const denom = m.value.amount.denom;
|
|
86
|
+
if (denom !== 'uosmo') {
|
|
87
|
+
throw new Error('osmosis: Unsupported denomination: ' + denom);
|
|
88
|
+
}
|
|
89
|
+
const delegate = new OsmosisMessages.OsmosisMsgDelegate();
|
|
90
|
+
delegate.setDelegatorAddress(m.value.delegator_address);
|
|
91
|
+
delegate.setValidatorAddress(m.value.validator_address);
|
|
92
|
+
delegate.setDenom(m.value.amount.denom);
|
|
93
|
+
delegate.setAmount(m.value.amount.amount);
|
|
94
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
95
|
+
ack.setDelegate(delegate);
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
case 'cosmos-sdk/MsgUndelegate': {
|
|
99
|
+
// Undelegate
|
|
100
|
+
const denom = m.value.amount.denom;
|
|
101
|
+
if (denom !== 'uosmo') {
|
|
102
|
+
throw new Error('osmosis: Unsupported denomination: ' + denom);
|
|
103
|
+
}
|
|
104
|
+
const undelegate = new OsmosisMessages.OsmosisMsgUndelegate();
|
|
105
|
+
undelegate.setDelegatorAddress(m.value.delegator_address);
|
|
106
|
+
undelegate.setValidatorAddress(m.value.validator_address);
|
|
107
|
+
undelegate.setDenom(m.value.amount.denom);
|
|
108
|
+
undelegate.setAmount(m.value.amount.amount);
|
|
109
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
110
|
+
ack.setUndelegate(undelegate);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
case 'cosmos-sdk/MsgBeginRedelegate': {
|
|
114
|
+
// Redelegate
|
|
115
|
+
const denom = m.value.amount.denom;
|
|
116
|
+
if (denom !== 'uosmo') {
|
|
117
|
+
throw new Error('osmosis: Unsupported denomination: ' + denom);
|
|
118
|
+
}
|
|
119
|
+
const redelegate = new OsmosisMessages.OsmosisMsgRedelegate();
|
|
120
|
+
redelegate.setDelegatorAddress(m.value.delegator_address);
|
|
121
|
+
redelegate.setValidatorSrcAddress(m.value.validator_src_address);
|
|
122
|
+
redelegate.setValidatorDstAddress(m.value.validator_dst_address);
|
|
123
|
+
redelegate.setAmount(m.value.amount.amount);
|
|
124
|
+
redelegate.setDenom(m.value.amount.denom);
|
|
125
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
126
|
+
ack.setRedelegate(redelegate);
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case 'cosmos-sdk/MsgWithdrawDelegationReward': {
|
|
130
|
+
// Rewards
|
|
131
|
+
const rewards = new OsmosisMessages.OsmosisMsgRewards();
|
|
132
|
+
rewards.setDelegatorAddress(m.value.delegator_address);
|
|
133
|
+
rewards.setValidatorAddress(m.value.validator_address);
|
|
134
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
135
|
+
ack.setRewards(rewards);
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case 'osmosis/gamm/join-pool': {
|
|
139
|
+
// LP add
|
|
140
|
+
const lpAdd = new OsmosisMessages.OsmosisMsgLPAdd();
|
|
141
|
+
lpAdd.setSender(m.value.sender);
|
|
142
|
+
lpAdd.setPoolId(m.value.pool_id);
|
|
143
|
+
lpAdd.setShareOutAmount(m.value.share_out_amount);
|
|
144
|
+
lpAdd.setDenomInMaxA(m.value.token_in_maxs[0].denom);
|
|
145
|
+
lpAdd.setAmountInMaxA(m.value.token_in_maxs[0].amount);
|
|
146
|
+
lpAdd.setDenomInMaxB(m.value.token_in_maxs[1].denom);
|
|
147
|
+
lpAdd.setAmountInMaxB(m.value.token_in_maxs[1].amount);
|
|
148
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
149
|
+
ack.setLpAdd(lpAdd);
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
case 'osmosis/gamm/exit-pool': {
|
|
153
|
+
// LP remove
|
|
154
|
+
const lpRemove = new OsmosisMessages.OsmosisMsgLPRemove();
|
|
155
|
+
lpRemove.setSender(m.value.sender);
|
|
156
|
+
lpRemove.setPoolId(m.value.pool_id);
|
|
157
|
+
lpRemove.setShareInAmount(m.value.share_in_amount);
|
|
158
|
+
lpRemove.setDenomOutMinA(m.value.token_out_mins[0].denom);
|
|
159
|
+
lpRemove.setAmountOutMinA(m.value.token_out_mins[0].amount);
|
|
160
|
+
lpRemove.setDenomOutMinB(m.value.token_out_mins[1].denom);
|
|
161
|
+
lpRemove.setAmountOutMinB(m.value.token_out_mins[1].amount);
|
|
162
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
163
|
+
ack.setLpRemove(lpRemove);
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
case 'cosmos-sdk/MsgTransfer': {
|
|
167
|
+
// IBC Transfer
|
|
168
|
+
const ibcTransfer = new OsmosisMessages.OsmosisMsgIBCTransfer();
|
|
169
|
+
ibcTransfer.setReceiver(m.value.receiver);
|
|
170
|
+
ibcTransfer.setSender(m.value.sender);
|
|
171
|
+
ibcTransfer.setSourceChannel(m.value.source_channel);
|
|
172
|
+
ibcTransfer.setSourcePort(m.value.source_port);
|
|
173
|
+
ibcTransfer.setRevisionHeight(m.value.timeout_height.revision_height);
|
|
174
|
+
ibcTransfer.setRevisionNumber(m.value.timeout_height.revision_number);
|
|
175
|
+
ibcTransfer.setAmount(m.value.token.amount);
|
|
176
|
+
ibcTransfer.setDenom(m.value.token.denom);
|
|
177
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
178
|
+
ack.setIbcTransfer(ibcTransfer);
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case 'osmosis/gamm/swap-exact-amount-in': {
|
|
182
|
+
// Swap
|
|
183
|
+
const swap = new OsmosisMessages.OsmosisMsgSwap();
|
|
184
|
+
swap.setSender(m.value.sender);
|
|
185
|
+
swap.setPoolId(m.value.routes[0].pool_id);
|
|
186
|
+
swap.setTokenOutDenom(m.value.routes[0].token_out_denom);
|
|
187
|
+
swap.setTokenInDenom(m.value.token_in.denom);
|
|
188
|
+
swap.setTokenInAmount(m.value.token_in.amount);
|
|
189
|
+
swap.setTokenOutMinAmount(m.value.token_out_min_amount);
|
|
190
|
+
ack = new OsmosisMessages.OsmosisMsgAck();
|
|
191
|
+
ack.setSwap(swap);
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
default:
|
|
195
|
+
throw new Error(`osmosis: Message ${m.type} is not yet supported`);
|
|
196
|
+
}
|
|
197
|
+
resp = await transport.call(Messages.MessageType.MESSAGETYPE_OSMOSISMSGACK, ack, {
|
|
198
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
199
|
+
omitLock: true,
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (resp.message_enum !== Messages.MessageType.MESSAGETYPE_OSMOSISSIGNEDTX) {
|
|
203
|
+
throw new Error(`osmosis: unexpected response ${resp.message_type}`);
|
|
204
|
+
}
|
|
205
|
+
const signedTx = resp.proto;
|
|
206
|
+
const offlineSigner = {
|
|
207
|
+
async getAccounts() {
|
|
208
|
+
return [
|
|
209
|
+
{
|
|
210
|
+
address,
|
|
211
|
+
algo: 'secp256k1',
|
|
212
|
+
pubkey,
|
|
213
|
+
},
|
|
214
|
+
];
|
|
215
|
+
},
|
|
216
|
+
async signAmino(signerAddress, signDoc) {
|
|
217
|
+
if (signerAddress !== address)
|
|
218
|
+
throw new Error('expected signerAddress to match address');
|
|
219
|
+
return {
|
|
220
|
+
signed: signDoc,
|
|
221
|
+
signature: {
|
|
222
|
+
pub_key: {
|
|
223
|
+
type: 'tendermint/PubKeySecp256k1',
|
|
224
|
+
value: signedTx.getPublicKey_asB64(),
|
|
225
|
+
},
|
|
226
|
+
signature: signedTx.getSignature_asB64(),
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
const signerData = {
|
|
232
|
+
sequence: Number(msg.sequence),
|
|
233
|
+
accountNumber: Number(msg.account_number),
|
|
234
|
+
chainId: msg.chain_id,
|
|
235
|
+
};
|
|
236
|
+
return (await protoTxBuilder).sign(address, sortTxFields(msg.tx), offlineSigner, signerData, 'osmo');
|
|
237
|
+
});
|
|
238
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
2
|
+
import type { Transport } from './transport.js';
|
|
3
|
+
export declare function rippleGetAccountPaths(msg: core.RippleGetAccountPaths): core.RippleAccountPath[];
|
|
4
|
+
export declare function rippleSignTx(transport: Transport, msg: core.RippleSignTx): Promise<core.RippleSignedTx>;
|
|
5
|
+
export declare function rippleGetAddress(transport: Transport, msg: core.RippleGetAddress): Promise<string>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as Messages from '@keepkey/device-protocol/lib/messages_pb';
|
|
2
|
+
import * as RippleMessages from '@keepkey/device-protocol/lib/messages-ripple_pb';
|
|
3
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
4
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
5
|
+
export function rippleGetAccountPaths(msg) {
|
|
6
|
+
return [
|
|
7
|
+
{
|
|
8
|
+
addressNList: [
|
|
9
|
+
0x80000000 + 44,
|
|
10
|
+
0x80000000 + core.slip44ByCoin('Ripple'),
|
|
11
|
+
0x80000000 + msg.accountIdx,
|
|
12
|
+
0,
|
|
13
|
+
0,
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
export async function rippleSignTx(transport, msg) {
|
|
19
|
+
return transport.lockDuring(async () => {
|
|
20
|
+
const signTx = new RippleMessages.RippleSignTx();
|
|
21
|
+
signTx.setAddressNList(msg.addressNList);
|
|
22
|
+
signTx.setFee(parseInt(msg.tx.value.fee.amount[0].amount));
|
|
23
|
+
signTx.setSequence(parseInt(msg.sequence));
|
|
24
|
+
signTx.setLastLedgerSequence(parseInt(msg.lastLedgerSequence));
|
|
25
|
+
const payment = new RippleMessages.RipplePayment();
|
|
26
|
+
payment.setAmount(parseInt(msg.payment.amount));
|
|
27
|
+
payment.setDestination(msg.payment.destination);
|
|
28
|
+
if (msg.payment.destinationTag !== undefined)
|
|
29
|
+
payment.setDestinationTag(parseInt(msg.payment.destinationTag));
|
|
30
|
+
signTx.setPayment(payment);
|
|
31
|
+
const resp = await transport.call(Messages.MessageType.MESSAGETYPE_RIPPLESIGNTX, signTx, {
|
|
32
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
33
|
+
omitLock: true,
|
|
34
|
+
});
|
|
35
|
+
for (const m of msg.tx.value.msg) {
|
|
36
|
+
if (m.type === 'ripple-sdk/MsgSend') {
|
|
37
|
+
if (m.value.amount.length !== 1) {
|
|
38
|
+
throw new Error('ripple: Multiple amounts per msg not supported');
|
|
39
|
+
}
|
|
40
|
+
const denom = m.value.amount[0].denom;
|
|
41
|
+
if (denom !== 'drop') {
|
|
42
|
+
throw new Error('ripple: Unsupported denomination: ' + denom);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
throw new Error(`ripple: Message ${m.type} is not yet supported`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (resp.message_enum !== Messages.MessageType.MESSAGETYPE_RIPPLESIGNEDTX) {
|
|
50
|
+
throw new Error(`ripple: unexpected response ${resp.message_type}`);
|
|
51
|
+
}
|
|
52
|
+
const signedTx = resp.proto;
|
|
53
|
+
const signed = cloneDeep(msg.tx);
|
|
54
|
+
signed.value.signatures = [
|
|
55
|
+
{
|
|
56
|
+
serializedTx: signedTx.getSerializedTx_asB64(),
|
|
57
|
+
signature: signedTx.getSignature_asB64(),
|
|
58
|
+
},
|
|
59
|
+
];
|
|
60
|
+
return signed;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export async function rippleGetAddress(transport, msg) {
|
|
64
|
+
const getAddr = new RippleMessages.RippleGetAddress();
|
|
65
|
+
getAddr.setAddressNList(msg.addressNList);
|
|
66
|
+
getAddr.setShowDisplay(msg.showDisplay !== false);
|
|
67
|
+
const response = await transport.call(Messages.MessageType.MESSAGETYPE_RIPPLEGETADDRESS, getAddr, {
|
|
68
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
69
|
+
});
|
|
70
|
+
const rippleAddress = response.proto;
|
|
71
|
+
return core.mustBeDefined(rippleAddress.getAddress());
|
|
72
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as ThorchainMessages from '@keepkey/device-protocol/lib/messages-thorchain_pb';
|
|
2
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
3
|
+
import type { Transport } from './transport.js';
|
|
4
|
+
export declare function thorchainGetAccountPaths(msg: core.ThorchainGetAccountPaths): core.ThorchainAccountPath[];
|
|
5
|
+
export declare function thorchainGetAddress(transport: Transport, msg: ThorchainMessages.ThorchainGetAddress.AsObject): Promise<string>;
|
|
6
|
+
export declare function thorchainSignTx(transport: Transport, msg: core.ThorchainSignTx): Promise<any>;
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import * as Messages from '@keepkey/device-protocol/lib/messages_pb';
|
|
2
|
+
import * as ThorchainMessages from '@keepkey/device-protocol/lib/messages-thorchain_pb';
|
|
3
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
4
|
+
import bs58check from 'bs58check';
|
|
5
|
+
import PLazy from 'p-lazy';
|
|
6
|
+
const protoTxBuilder = PLazy.from(() => import('@shapeshiftoss/proto-tx-builder'));
|
|
7
|
+
export function thorchainGetAccountPaths(msg) {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
addressNList: [
|
|
11
|
+
0x80000000 + 44,
|
|
12
|
+
0x80000000 + core.slip44ByCoin('Thorchain'),
|
|
13
|
+
0x80000000 + msg.accountIdx,
|
|
14
|
+
0,
|
|
15
|
+
0,
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
export async function thorchainGetAddress(transport, msg) {
|
|
21
|
+
const getAddr = new ThorchainMessages.ThorchainGetAddress();
|
|
22
|
+
getAddr.setAddressNList(msg.addressNList);
|
|
23
|
+
getAddr.setShowDisplay(msg.showDisplay !== false);
|
|
24
|
+
if (msg.testnet !== undefined)
|
|
25
|
+
getAddr.setTestnet(msg.testnet);
|
|
26
|
+
const response = await transport.call(Messages.MessageType.MESSAGETYPE_THORCHAINGETADDRESS, getAddr, {
|
|
27
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
28
|
+
});
|
|
29
|
+
const thorchainAddress = response.proto;
|
|
30
|
+
return core.mustBeDefined(thorchainAddress.getAddress());
|
|
31
|
+
}
|
|
32
|
+
export async function thorchainSignTx(transport, msg) {
|
|
33
|
+
const address = await thorchainGetAddress(transport, { addressNList: msg.addressNList });
|
|
34
|
+
const getPublicKeyMsg = new Messages.GetPublicKey();
|
|
35
|
+
getPublicKeyMsg.setAddressNList(msg.addressNList);
|
|
36
|
+
getPublicKeyMsg.setEcdsaCurveName('secp256k1');
|
|
37
|
+
const response = await transport.call(Messages.MessageType.MESSAGETYPE_GETPUBLICKEY, getPublicKeyMsg, {
|
|
38
|
+
msgTimeout: core.DEFAULT_TIMEOUT,
|
|
39
|
+
});
|
|
40
|
+
const pubkeyMsg = response.proto;
|
|
41
|
+
const pubkey = bs58check.decode(core.mustBeDefined(pubkeyMsg.getXpub())).slice(45);
|
|
42
|
+
return transport.lockDuring(async () => {
|
|
43
|
+
const signTx = new ThorchainMessages.ThorchainSignTx();
|
|
44
|
+
signTx.setAddressNList(msg.addressNList);
|
|
45
|
+
signTx.setAccountNumber(msg.account_number);
|
|
46
|
+
signTx.setChainId(msg.chain_id);
|
|
47
|
+
signTx.setFeeAmount(parseInt(msg.tx.fee.amount[0].amount));
|
|
48
|
+
signTx.setGas(parseInt(msg.tx.fee.gas));
|
|
49
|
+
signTx.setSequence(msg.sequence);
|
|
50
|
+
if (msg.tx.memo !== undefined)
|
|
51
|
+
signTx.setMemo(msg.tx.memo);
|
|
52
|
+
signTx.setMsgCount(1);
|
|
53
|
+
let resp = await transport.call(Messages.MessageType.MESSAGETYPE_THORCHAINSIGNTX, signTx, {
|
|
54
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
55
|
+
omitLock: true,
|
|
56
|
+
});
|
|
57
|
+
for (const m of msg.tx.msg) {
|
|
58
|
+
if (resp.message_enum !== Messages.MessageType.MESSAGETYPE_THORCHAINMSGREQUEST) {
|
|
59
|
+
throw new Error(`THORChain: unexpected response ${resp.message_type}`);
|
|
60
|
+
}
|
|
61
|
+
let ack;
|
|
62
|
+
if (m.type === 'thorchain/MsgSend') {
|
|
63
|
+
if (m.value.amount.length !== 1) {
|
|
64
|
+
throw new Error('THORChain: Multiple amounts per MsgSend not supported');
|
|
65
|
+
}
|
|
66
|
+
const denom = m.value.amount[0].denom;
|
|
67
|
+
if (denom !== 'rune') {
|
|
68
|
+
throw new Error('THORChain: Unsupported denomination: ' + denom);
|
|
69
|
+
}
|
|
70
|
+
const send = new ThorchainMessages.ThorchainMsgSend();
|
|
71
|
+
send.setFromAddress(m.value.from_address);
|
|
72
|
+
send.setToAddress(m.value.to_address);
|
|
73
|
+
send.setAmount(m.value.amount[0].amount);
|
|
74
|
+
ack = new ThorchainMessages.ThorchainMsgAck();
|
|
75
|
+
ack.setSend(send);
|
|
76
|
+
}
|
|
77
|
+
else if (m.type === 'thorchain/MsgDeposit') {
|
|
78
|
+
if (m.value.coins.length !== 1) {
|
|
79
|
+
throw new Error('THORChain: Multiple amounts per MsgDeposit not supported');
|
|
80
|
+
}
|
|
81
|
+
const coinAsset = m.value.coins[0].asset;
|
|
82
|
+
if (!['THOR.RUNE', 'THOR.TCY', 'THOR.RUJI'].includes(coinAsset)) {
|
|
83
|
+
throw new Error('THORChain: Unsupported coin asset: ' + coinAsset);
|
|
84
|
+
}
|
|
85
|
+
const deposit = new ThorchainMessages.ThorchainMsgDeposit();
|
|
86
|
+
deposit.setAsset(m.value.coins[0].asset);
|
|
87
|
+
deposit.setAmount(m.value.coins[0].amount);
|
|
88
|
+
deposit.setMemo(m.value.memo);
|
|
89
|
+
deposit.setSigner(m.value.signer);
|
|
90
|
+
ack = new ThorchainMessages.ThorchainMsgAck();
|
|
91
|
+
ack.setDeposit(deposit);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
throw new Error(`THORChain: Message ${m.type} is not yet supported`);
|
|
95
|
+
}
|
|
96
|
+
resp = await transport.call(Messages.MessageType.MESSAGETYPE_THORCHAINMSGACK, ack, {
|
|
97
|
+
msgTimeout: core.LONG_TIMEOUT,
|
|
98
|
+
omitLock: true,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
if (resp.message_enum !== Messages.MessageType.MESSAGETYPE_THORCHAINSIGNEDTX) {
|
|
102
|
+
throw new Error(`THORChain: unexpected response ${resp.message_type}`);
|
|
103
|
+
}
|
|
104
|
+
const signedTx = resp.proto;
|
|
105
|
+
const offlineSigner = {
|
|
106
|
+
async getAccounts() {
|
|
107
|
+
return [
|
|
108
|
+
{
|
|
109
|
+
address,
|
|
110
|
+
algo: 'secp256k1',
|
|
111
|
+
pubkey,
|
|
112
|
+
},
|
|
113
|
+
];
|
|
114
|
+
},
|
|
115
|
+
async signAmino(signerAddress, signDoc) {
|
|
116
|
+
if (signerAddress !== address)
|
|
117
|
+
throw new Error('expected signerAddress to match address');
|
|
118
|
+
return {
|
|
119
|
+
signed: signDoc,
|
|
120
|
+
signature: {
|
|
121
|
+
pub_key: {
|
|
122
|
+
type: 'tendermint/PubKeySecp256k1',
|
|
123
|
+
value: signedTx.getPublicKey_asB64(),
|
|
124
|
+
},
|
|
125
|
+
signature: signedTx.getSignature_asB64(),
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
const signerData = {
|
|
131
|
+
sequence: Number(msg.sequence),
|
|
132
|
+
accountNumber: Number(msg.account_number),
|
|
133
|
+
chainId: msg.chain_id,
|
|
134
|
+
};
|
|
135
|
+
return (await protoTxBuilder).sign(address, msg.tx, offlineSigner, signerData, 'thor');
|
|
136
|
+
});
|
|
137
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import * as core from '@shapeshiftoss/hdwallet-core';
|
|
2
|
+
import * as jspb from 'google-protobuf';
|
|
3
|
+
export interface TransportDelegate {
|
|
4
|
+
isOpened(): Promise<boolean>;
|
|
5
|
+
getDeviceID(): Promise<string>;
|
|
6
|
+
connect(): Promise<void>;
|
|
7
|
+
tryConnectDebugLink?(): Promise<boolean>;
|
|
8
|
+
disconnect(): Promise<void>;
|
|
9
|
+
writeChunk(buf: Uint8Array, debugLink?: boolean): Promise<void>;
|
|
10
|
+
readChunk(debugLink?: boolean): Promise<Uint8Array>;
|
|
11
|
+
}
|
|
12
|
+
export declare class Transport extends core.Transport {
|
|
13
|
+
debugLink: boolean;
|
|
14
|
+
userActionRequired: boolean;
|
|
15
|
+
delegate: TransportDelegate;
|
|
16
|
+
callInProgress: {
|
|
17
|
+
main?: Promise<any>;
|
|
18
|
+
debug?: Promise<any>;
|
|
19
|
+
};
|
|
20
|
+
constructor(keyring: core.Keyring, delegate: TransportDelegate);
|
|
21
|
+
static create(keyring: core.Keyring, delegate: TransportDelegate): Promise<Transport>;
|
|
22
|
+
isOpened(): Promise<boolean>;
|
|
23
|
+
getDeviceID(): Promise<string>;
|
|
24
|
+
connect(): Promise<void>;
|
|
25
|
+
tryConnectDebugLink(): Promise<boolean>;
|
|
26
|
+
disconnect(): Promise<void>;
|
|
27
|
+
private write;
|
|
28
|
+
private read;
|
|
29
|
+
getVendor(): string;
|
|
30
|
+
getEntropy(length: number): Uint8Array;
|
|
31
|
+
getFirmwareHash(firmware: Uint8Array): Promise<Uint8Array>;
|
|
32
|
+
/**
|
|
33
|
+
* Utility function to cancel all pending calls whenver one of them is cancelled.
|
|
34
|
+
*/
|
|
35
|
+
cancellable(inProgress?: Promise<any>): Promise<void>;
|
|
36
|
+
lockDuring<T>(action: () => Promise<T>): Promise<T>;
|
|
37
|
+
handleCancellableResponse(): Promise<core.Event>;
|
|
38
|
+
readResponse(debugLink: boolean): Promise<core.Event>;
|
|
39
|
+
call(msgTypeEnum: number, msg: jspb.Message, options?: {
|
|
40
|
+
msgTimeout?: number;
|
|
41
|
+
omitLock?: boolean;
|
|
42
|
+
noWait?: false;
|
|
43
|
+
debugLink?: boolean;
|
|
44
|
+
}): Promise<core.Event>;
|
|
45
|
+
call(msgTypeEnum: number, msg: jspb.Message, options: {
|
|
46
|
+
msgTimeout?: number;
|
|
47
|
+
omitLock?: boolean;
|
|
48
|
+
noWait: true;
|
|
49
|
+
debugLink?: boolean;
|
|
50
|
+
}): Promise<undefined>;
|
|
51
|
+
cancel(): Promise<void>;
|
|
52
|
+
protected toMessageBuffer(msgTypeEnum: number, msg: jspb.Message): Uint8Array;
|
|
53
|
+
protected fromMessageBuffer(buf: Uint8Array): [number, jspb.Message];
|
|
54
|
+
protected static failureMessageFactory(e?: Error | string): Uint8Array;
|
|
55
|
+
}
|