@kimafinance/kima-transaction-api 1.4.0 → 1.4.1
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/README.md +19 -5
- package/build/api/htlc-lock.d.ts +23 -0
- package/build/api/htlc-lock.js +37 -0
- package/build/api/htlc-reclaim.d.ts +14 -0
- package/build/api/htlc-reclaim.js +28 -0
- package/build/api/submit.d.ts +54 -0
- package/build/api/submit.js +94 -0
- package/build/config/global-this.config.d.ts +2 -0
- package/build/config/global-this.config.js +18 -0
- package/build/config/probuff.config.d.ts +2 -0
- package/build/config/probuff.config.js +12 -0
- package/build/index.d.ts +3 -50
- package/build/index.js +17 -121
- package/build/kima/common.d.ts +4 -1
- package/build/kima/common.js +12 -9
- package/build/kima/tx/cancel.d.ts +35 -0
- package/build/kima/tx/cancel.js +115 -0
- package/build/kima/tx/drain-finalize.d.ts +47 -0
- package/build/kima/tx/drain-finalize.js +155 -0
- package/build/kima/tx/drain.d.ts +50 -0
- package/build/kima/tx/drain.js +164 -0
- package/build/kima/tx/finalize.d.ts +47 -0
- package/build/kima/tx/finalize.js +155 -0
- package/build/kima/tx/htlc-lock.d.ts +42 -0
- package/build/kima/tx/htlc-lock.js +152 -0
- package/build/kima/tx/htlc-reclaim.d.ts +30 -0
- package/build/kima/tx/htlc-reclaim.js +105 -0
- package/build/kima/tx/index.d.ts +1 -0
- package/build/kima/tx/index.js +4 -0
- package/build/kima/tx/liquidity-provision.d.ts +30 -0
- package/build/kima/tx/liquidity-provision.js +102 -0
- package/build/kima/tx/message-service.d.ts +54 -0
- package/build/kima/tx/message-service.js +117 -0
- package/build/kima/tx/provision-finalize.d.ts +47 -0
- package/build/kima/tx/provision-finalize.js +155 -0
- package/build/kima/tx/provision.d.ts +70 -0
- package/build/kima/tx/provision.js +230 -0
- package/build/kima/tx/request.d.ts +63 -0
- package/build/kima/tx/request.js +222 -0
- package/build/kima/tx/response.d.ts +21 -0
- package/build/kima/tx/response.js +69 -0
- package/build/kima/tx/rpc.d.ts +0 -0
- package/build/kima/tx/rpc.js +1 -0
- package/build/kima/tx/set-hash.d.ts +42 -0
- package/build/kima/tx/set-hash.js +130 -0
- package/build/kima/tx/set-process.d.ts +37 -0
- package/build/kima/tx/set-process.js +121 -0
- package/build/kima/tx/transfer-limit.d.ts +30 -0
- package/build/kima/tx/transfer-limit.js +102 -0
- package/build/kima/tx/withdraw.d.ts +47 -0
- package/build/kima/tx/withdraw.js +155 -0
- package/build/utils.d.ts +17 -0
- package/build/utils.js +49 -0
- package/package.json +10 -10
- package/src/api/htlc-lock.ts +57 -0
- package/src/api/htlc-reclaim.ts +39 -0
- package/src/api/submit.ts +132 -0
- package/src/config/global-this.config.ts +20 -0
- package/src/config/probuff.config.ts +9 -0
- package/src/index.ts +3 -206
- package/src/kima/common.ts +5 -12
- package/src/kima/tx/cancel.ts +147 -0
- package/src/kima/tx/drain-finalize.ts +191 -0
- package/src/kima/tx/drain.ts +201 -0
- package/src/kima/tx/finalize.ts +191 -0
- package/src/kima/tx/htlc-lock.ts +183 -0
- package/src/kima/tx/htlc-reclaim.ts +132 -0
- package/src/kima/tx/index.ts +1 -0
- package/src/kima/tx/liquidity-provision.ts +132 -0
- package/src/kima/tx/message-service.ts +278 -0
- package/src/kima/tx/provision-finalize.ts +191 -0
- package/src/kima/tx/provision.ts +279 -0
- package/src/kima/tx/request.ts +256 -0
- package/src/kima/tx/response.ts +83 -0
- package/src/kima/tx/rpc.ts +0 -0
- package/src/kima/tx/set-hash.ts +162 -0
- package/src/kima/tx/set-process.ts +151 -0
- package/src/kima/tx/transfer-limit.ts +132 -0
- package/src/kima/tx/withdraw.ts +191 -0
- package/src/utils.ts +67 -0
- package/build/kima/tx.d.ts +0 -674
- package/build/kima/tx.js +0 -2170
- package/src/kima/tx.ts +0 -2945
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import _m0 from "../../config/probuff.config";
|
|
2
|
+
import { base64FromBytes, bytesFromBase64, DeepPartial, Exact, isSet, longToNumber } from "../../utils";
|
|
3
|
+
|
|
4
|
+
export interface MsgRequestProvisionTransaction {
|
|
5
|
+
creator: string;
|
|
6
|
+
chain: string;
|
|
7
|
+
fromAddress: string;
|
|
8
|
+
symbol: string;
|
|
9
|
+
amount: string;
|
|
10
|
+
options: string;
|
|
11
|
+
/** BTC transaction */
|
|
12
|
+
htlcExpirationTimestamp: string;
|
|
13
|
+
/** the txhash locking the funds in the HTLC */
|
|
14
|
+
htlcCreationHash: string;
|
|
15
|
+
/** the output index of the locked funds in the HTLC creation transaction */
|
|
16
|
+
htlcCreationVout: number;
|
|
17
|
+
/** a version denoting which HTLC script version is being using for the HTLC transaction */
|
|
18
|
+
htlcVersion: string;
|
|
19
|
+
/** the (compressed) public key of the sender */
|
|
20
|
+
senderPubKey: Uint8Array;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface MsgRequestProvisionTransactionResponse {
|
|
24
|
+
code: string;
|
|
25
|
+
msg: string;
|
|
26
|
+
txId: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function createBaseMsgRequestProvisionTransaction(): MsgRequestProvisionTransaction {
|
|
30
|
+
return {
|
|
31
|
+
creator: "",
|
|
32
|
+
chain: "",
|
|
33
|
+
fromAddress: "",
|
|
34
|
+
symbol: "",
|
|
35
|
+
amount: "",
|
|
36
|
+
options: "",
|
|
37
|
+
htlcExpirationTimestamp: "",
|
|
38
|
+
htlcCreationHash: "",
|
|
39
|
+
htlcCreationVout: 0,
|
|
40
|
+
htlcVersion: "",
|
|
41
|
+
senderPubKey: new Uint8Array(),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const MsgRequestProvisionTransaction = {
|
|
46
|
+
encode(
|
|
47
|
+
message: MsgRequestProvisionTransaction,
|
|
48
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
49
|
+
): _m0.Writer {
|
|
50
|
+
if (message.creator !== "") {
|
|
51
|
+
writer.uint32(10).string(message.creator);
|
|
52
|
+
}
|
|
53
|
+
if (message.chain !== "") {
|
|
54
|
+
writer.uint32(18).string(message.chain);
|
|
55
|
+
}
|
|
56
|
+
if (message.fromAddress !== "") {
|
|
57
|
+
writer.uint32(26).string(message.fromAddress);
|
|
58
|
+
}
|
|
59
|
+
if (message.symbol !== "") {
|
|
60
|
+
writer.uint32(34).string(message.symbol);
|
|
61
|
+
}
|
|
62
|
+
if (message.amount !== "") {
|
|
63
|
+
writer.uint32(42).string(message.amount);
|
|
64
|
+
}
|
|
65
|
+
if (message.options !== "") {
|
|
66
|
+
writer.uint32(50).string(message.options);
|
|
67
|
+
}
|
|
68
|
+
if (message.htlcExpirationTimestamp !== "") {
|
|
69
|
+
writer.uint32(58).string(message.htlcExpirationTimestamp);
|
|
70
|
+
}
|
|
71
|
+
if (message.htlcCreationHash !== "") {
|
|
72
|
+
writer.uint32(66).string(message.htlcCreationHash);
|
|
73
|
+
}
|
|
74
|
+
if (message.htlcCreationVout !== 0) {
|
|
75
|
+
writer.uint32(72).uint32(message.htlcCreationVout);
|
|
76
|
+
}
|
|
77
|
+
if (message.htlcVersion !== "") {
|
|
78
|
+
writer.uint32(82).string(message.htlcVersion);
|
|
79
|
+
}
|
|
80
|
+
if (message.senderPubKey.length !== 0) {
|
|
81
|
+
writer.uint32(90).bytes(message.senderPubKey);
|
|
82
|
+
}
|
|
83
|
+
return writer;
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
decode(
|
|
87
|
+
input: _m0.Reader | Uint8Array,
|
|
88
|
+
length?: number
|
|
89
|
+
): MsgRequestProvisionTransaction {
|
|
90
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
91
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
92
|
+
const message = createBaseMsgRequestProvisionTransaction();
|
|
93
|
+
while (reader.pos < end) {
|
|
94
|
+
const tag = reader.uint32();
|
|
95
|
+
switch (tag >>> 3) {
|
|
96
|
+
case 1:
|
|
97
|
+
message.creator = reader.string();
|
|
98
|
+
break;
|
|
99
|
+
case 2:
|
|
100
|
+
message.chain = reader.string();
|
|
101
|
+
break;
|
|
102
|
+
case 3:
|
|
103
|
+
message.fromAddress = reader.string();
|
|
104
|
+
break;
|
|
105
|
+
case 4:
|
|
106
|
+
message.symbol = reader.string();
|
|
107
|
+
break;
|
|
108
|
+
case 5:
|
|
109
|
+
message.amount = reader.string();
|
|
110
|
+
break;
|
|
111
|
+
case 6:
|
|
112
|
+
message.options = reader.string();
|
|
113
|
+
break;
|
|
114
|
+
case 7:
|
|
115
|
+
message.htlcExpirationTimestamp = reader.string();
|
|
116
|
+
break;
|
|
117
|
+
case 8:
|
|
118
|
+
message.htlcCreationHash = reader.string();
|
|
119
|
+
break;
|
|
120
|
+
case 9:
|
|
121
|
+
message.htlcCreationVout = reader.uint32();
|
|
122
|
+
break;
|
|
123
|
+
case 10:
|
|
124
|
+
message.htlcVersion = reader.string();
|
|
125
|
+
break;
|
|
126
|
+
case 11:
|
|
127
|
+
message.senderPubKey = reader.bytes();
|
|
128
|
+
break;
|
|
129
|
+
default:
|
|
130
|
+
reader.skipType(tag & 7);
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return message;
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
fromJSON(object: any): MsgRequestProvisionTransaction {
|
|
138
|
+
return {
|
|
139
|
+
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
140
|
+
chain: isSet(object.chain) ? String(object.chain) : "",
|
|
141
|
+
fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
|
|
142
|
+
symbol: isSet(object.symbol) ? String(object.symbol) : "",
|
|
143
|
+
amount: isSet(object.amount) ? String(object.amount) : "",
|
|
144
|
+
options: isSet(object.options) ? String(object.options) : "",
|
|
145
|
+
htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
|
|
146
|
+
? String(object.htlcExpirationTimestamp)
|
|
147
|
+
: "",
|
|
148
|
+
htlcCreationHash: isSet(object.htlcCreationHash)
|
|
149
|
+
? String(object.htlcCreationHash)
|
|
150
|
+
: "",
|
|
151
|
+
htlcCreationVout: isSet(object.htlcCreationVout)
|
|
152
|
+
? Number(object.htlcCreationVout)
|
|
153
|
+
: 0,
|
|
154
|
+
htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
|
|
155
|
+
senderPubKey: isSet(object.senderPubKey)
|
|
156
|
+
? bytesFromBase64(object.senderPubKey)
|
|
157
|
+
: new Uint8Array(),
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
toJSON(message: MsgRequestProvisionTransaction): unknown {
|
|
162
|
+
const obj: any = {};
|
|
163
|
+
message.creator !== undefined && (obj.creator = message.creator);
|
|
164
|
+
message.chain !== undefined && (obj.chain = message.chain);
|
|
165
|
+
message.fromAddress !== undefined &&
|
|
166
|
+
(obj.fromAddress = message.fromAddress);
|
|
167
|
+
message.symbol !== undefined && (obj.symbol = message.symbol);
|
|
168
|
+
message.amount !== undefined && (obj.amount = message.amount);
|
|
169
|
+
message.options !== undefined && (obj.options = message.options);
|
|
170
|
+
message.htlcExpirationTimestamp !== undefined &&
|
|
171
|
+
(obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
|
|
172
|
+
message.htlcCreationHash !== undefined &&
|
|
173
|
+
(obj.htlcCreationHash = message.htlcCreationHash);
|
|
174
|
+
message.htlcCreationVout !== undefined &&
|
|
175
|
+
(obj.htlcCreationVout = Math.round(message.htlcCreationVout));
|
|
176
|
+
message.htlcVersion !== undefined &&
|
|
177
|
+
(obj.htlcVersion = message.htlcVersion);
|
|
178
|
+
message.senderPubKey !== undefined &&
|
|
179
|
+
(obj.senderPubKey = base64FromBytes(
|
|
180
|
+
message.senderPubKey !== undefined
|
|
181
|
+
? message.senderPubKey
|
|
182
|
+
: new Uint8Array()
|
|
183
|
+
));
|
|
184
|
+
return obj;
|
|
185
|
+
},
|
|
186
|
+
|
|
187
|
+
fromPartial<I extends Exact<DeepPartial<MsgRequestProvisionTransaction>, I>>(
|
|
188
|
+
object: I
|
|
189
|
+
): MsgRequestProvisionTransaction {
|
|
190
|
+
const message = createBaseMsgRequestProvisionTransaction();
|
|
191
|
+
message.creator = object.creator ?? "";
|
|
192
|
+
message.chain = object.chain ?? "";
|
|
193
|
+
message.fromAddress = object.fromAddress ?? "";
|
|
194
|
+
message.symbol = object.symbol ?? "";
|
|
195
|
+
message.amount = object.amount ?? "";
|
|
196
|
+
message.options = object.options ?? "";
|
|
197
|
+
message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
|
|
198
|
+
message.htlcCreationHash = object.htlcCreationHash ?? "";
|
|
199
|
+
message.htlcCreationVout = object.htlcCreationVout ?? 0;
|
|
200
|
+
message.htlcVersion = object.htlcVersion ?? "";
|
|
201
|
+
message.senderPubKey = object.senderPubKey ?? new Uint8Array();
|
|
202
|
+
return message;
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
function createBaseMsgRequestProvisionTransactionResponse(): MsgRequestProvisionTransactionResponse {
|
|
207
|
+
return { code: "", msg: "", txId: 0 };
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export const MsgRequestProvisionTransactionResponse = {
|
|
211
|
+
encode(
|
|
212
|
+
message: MsgRequestProvisionTransactionResponse,
|
|
213
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
214
|
+
): _m0.Writer {
|
|
215
|
+
if (message.code !== "") {
|
|
216
|
+
writer.uint32(10).string(message.code);
|
|
217
|
+
}
|
|
218
|
+
if (message.msg !== "") {
|
|
219
|
+
writer.uint32(18).string(message.msg);
|
|
220
|
+
}
|
|
221
|
+
if (message.txId !== 0) {
|
|
222
|
+
writer.uint32(24).uint64(message.txId);
|
|
223
|
+
}
|
|
224
|
+
return writer;
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
decode(
|
|
228
|
+
input: _m0.Reader | Uint8Array,
|
|
229
|
+
length?: number
|
|
230
|
+
): MsgRequestProvisionTransactionResponse {
|
|
231
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
232
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
233
|
+
const message = createBaseMsgRequestProvisionTransactionResponse();
|
|
234
|
+
while (reader.pos < end) {
|
|
235
|
+
const tag = reader.uint32();
|
|
236
|
+
switch (tag >>> 3) {
|
|
237
|
+
case 1:
|
|
238
|
+
message.code = reader.string();
|
|
239
|
+
break;
|
|
240
|
+
case 2:
|
|
241
|
+
message.msg = reader.string();
|
|
242
|
+
break;
|
|
243
|
+
case 3:
|
|
244
|
+
message.txId = longToNumber(reader.uint64() as Long);
|
|
245
|
+
break;
|
|
246
|
+
default:
|
|
247
|
+
reader.skipType(tag & 7);
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return message;
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
fromJSON(object: any): MsgRequestProvisionTransactionResponse {
|
|
255
|
+
return {
|
|
256
|
+
code: isSet(object.code) ? String(object.code) : "",
|
|
257
|
+
msg: isSet(object.msg) ? String(object.msg) : "",
|
|
258
|
+
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
259
|
+
};
|
|
260
|
+
},
|
|
261
|
+
|
|
262
|
+
toJSON(message: MsgRequestProvisionTransactionResponse): unknown {
|
|
263
|
+
const obj: any = {};
|
|
264
|
+
message.code !== undefined && (obj.code = message.code);
|
|
265
|
+
message.msg !== undefined && (obj.msg = message.msg);
|
|
266
|
+
message.txId !== undefined && (obj.txId = Math.round(message.txId));
|
|
267
|
+
return obj;
|
|
268
|
+
},
|
|
269
|
+
|
|
270
|
+
fromPartial<
|
|
271
|
+
I extends Exact<DeepPartial<MsgRequestProvisionTransactionResponse>, I>
|
|
272
|
+
>(object: I): MsgRequestProvisionTransactionResponse {
|
|
273
|
+
const message = createBaseMsgRequestProvisionTransactionResponse();
|
|
274
|
+
message.code = object.code ?? "";
|
|
275
|
+
message.msg = object.msg ?? "";
|
|
276
|
+
message.txId = object.txId ?? 0;
|
|
277
|
+
return message;
|
|
278
|
+
},
|
|
279
|
+
};
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import _m0 from "../../config/probuff.config";
|
|
2
|
+
import { base64FromBytes, bytesFromBase64, DeepPartial, Exact, isSet } from "../../utils";
|
|
3
|
+
|
|
4
|
+
export interface MsgRequestTransaction {
|
|
5
|
+
creator: string;
|
|
6
|
+
originChain: string;
|
|
7
|
+
originAddress: string;
|
|
8
|
+
targetChain: string;
|
|
9
|
+
targetAddress: string;
|
|
10
|
+
originSymbol: string;
|
|
11
|
+
targetSymbol: string;
|
|
12
|
+
amount: string;
|
|
13
|
+
fee: string;
|
|
14
|
+
/** the timestamp when the HTLC contract expires and the user can reclaim the funds locked there */
|
|
15
|
+
htlcExpirationTimestamp: string;
|
|
16
|
+
/** the txhash locking the funds in the HTLC */
|
|
17
|
+
htlcCreationHash: string;
|
|
18
|
+
/** the output index of the locked funds in the HTLC creation transaction */
|
|
19
|
+
htlcCreationVout: number;
|
|
20
|
+
/** a version denoting which HTLC script version is being using for the HTLC transaction */
|
|
21
|
+
htlcVersion: string;
|
|
22
|
+
/** for bitcoin transaction this is the public key of the sender */
|
|
23
|
+
senderPubKey: Uint8Array;
|
|
24
|
+
/** additional data JSON object */
|
|
25
|
+
options: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function createBaseMsgRequestTransaction(): MsgRequestTransaction {
|
|
29
|
+
return {
|
|
30
|
+
creator: "",
|
|
31
|
+
originChain: "",
|
|
32
|
+
originAddress: "",
|
|
33
|
+
targetChain: "",
|
|
34
|
+
targetAddress: "",
|
|
35
|
+
originSymbol: "",
|
|
36
|
+
targetSymbol: "",
|
|
37
|
+
amount: "",
|
|
38
|
+
fee: "",
|
|
39
|
+
htlcExpirationTimestamp: "",
|
|
40
|
+
htlcCreationHash: "",
|
|
41
|
+
htlcCreationVout: 0,
|
|
42
|
+
htlcVersion: "",
|
|
43
|
+
senderPubKey: new Uint8Array(),
|
|
44
|
+
options: "",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const MsgRequestTransaction = {
|
|
49
|
+
encode(
|
|
50
|
+
message: MsgRequestTransaction,
|
|
51
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
52
|
+
): _m0.Writer {
|
|
53
|
+
if (message.creator !== "") {
|
|
54
|
+
writer.uint32(10).string(message.creator);
|
|
55
|
+
}
|
|
56
|
+
if (message.originChain !== "") {
|
|
57
|
+
writer.uint32(18).string(message.originChain);
|
|
58
|
+
}
|
|
59
|
+
if (message.originAddress !== "") {
|
|
60
|
+
writer.uint32(26).string(message.originAddress);
|
|
61
|
+
}
|
|
62
|
+
if (message.targetChain !== "") {
|
|
63
|
+
writer.uint32(34).string(message.targetChain);
|
|
64
|
+
}
|
|
65
|
+
if (message.targetAddress !== "") {
|
|
66
|
+
writer.uint32(42).string(message.targetAddress);
|
|
67
|
+
}
|
|
68
|
+
if (message.originSymbol !== "") {
|
|
69
|
+
writer.uint32(50).string(message.originSymbol);
|
|
70
|
+
}
|
|
71
|
+
if (message.targetSymbol !== "") {
|
|
72
|
+
writer.uint32(58).string(message.targetSymbol);
|
|
73
|
+
}
|
|
74
|
+
if (message.amount !== "") {
|
|
75
|
+
writer.uint32(66).string(message.amount);
|
|
76
|
+
}
|
|
77
|
+
if (message.fee !== "") {
|
|
78
|
+
writer.uint32(74).string(message.fee);
|
|
79
|
+
}
|
|
80
|
+
if (message.htlcExpirationTimestamp !== "") {
|
|
81
|
+
writer.uint32(82).string(message.htlcExpirationTimestamp);
|
|
82
|
+
}
|
|
83
|
+
if (message.htlcCreationHash !== "") {
|
|
84
|
+
writer.uint32(90).string(message.htlcCreationHash);
|
|
85
|
+
}
|
|
86
|
+
if (message.htlcCreationVout !== 0) {
|
|
87
|
+
writer.uint32(96).uint32(message.htlcCreationVout);
|
|
88
|
+
}
|
|
89
|
+
if (message.htlcVersion !== "") {
|
|
90
|
+
writer.uint32(106).string(message.htlcVersion);
|
|
91
|
+
}
|
|
92
|
+
if (message.senderPubKey.length !== 0) {
|
|
93
|
+
writer.uint32(114).bytes(message.senderPubKey);
|
|
94
|
+
}
|
|
95
|
+
if (message.options !== "") {
|
|
96
|
+
writer.uint32(122).string(message.options);
|
|
97
|
+
}
|
|
98
|
+
return writer;
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
decode(
|
|
102
|
+
input: _m0.Reader | Uint8Array,
|
|
103
|
+
length?: number
|
|
104
|
+
): MsgRequestTransaction {
|
|
105
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
106
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
107
|
+
const message = createBaseMsgRequestTransaction();
|
|
108
|
+
while (reader.pos < end) {
|
|
109
|
+
const tag = reader.uint32();
|
|
110
|
+
switch (tag >>> 3) {
|
|
111
|
+
case 1:
|
|
112
|
+
message.creator = reader.string();
|
|
113
|
+
break;
|
|
114
|
+
case 2:
|
|
115
|
+
message.originChain = reader.string();
|
|
116
|
+
break;
|
|
117
|
+
case 3:
|
|
118
|
+
message.originAddress = reader.string();
|
|
119
|
+
break;
|
|
120
|
+
case 4:
|
|
121
|
+
message.targetChain = reader.string();
|
|
122
|
+
break;
|
|
123
|
+
case 5:
|
|
124
|
+
message.targetAddress = reader.string();
|
|
125
|
+
break;
|
|
126
|
+
case 6:
|
|
127
|
+
message.originSymbol = reader.string();
|
|
128
|
+
break;
|
|
129
|
+
case 7:
|
|
130
|
+
message.targetSymbol = reader.string();
|
|
131
|
+
break;
|
|
132
|
+
case 8:
|
|
133
|
+
message.amount = reader.string();
|
|
134
|
+
break;
|
|
135
|
+
case 9:
|
|
136
|
+
message.fee = reader.string();
|
|
137
|
+
break;
|
|
138
|
+
case 10:
|
|
139
|
+
message.htlcExpirationTimestamp = reader.string();
|
|
140
|
+
break;
|
|
141
|
+
case 11:
|
|
142
|
+
message.htlcCreationHash = reader.string();
|
|
143
|
+
break;
|
|
144
|
+
case 12:
|
|
145
|
+
message.htlcCreationVout = reader.uint32();
|
|
146
|
+
break;
|
|
147
|
+
case 13:
|
|
148
|
+
message.htlcVersion = reader.string();
|
|
149
|
+
break;
|
|
150
|
+
case 14:
|
|
151
|
+
message.senderPubKey = reader.bytes();
|
|
152
|
+
break;
|
|
153
|
+
case 15:
|
|
154
|
+
message.options = reader.string();
|
|
155
|
+
break;
|
|
156
|
+
default:
|
|
157
|
+
reader.skipType(tag & 7);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return message;
|
|
162
|
+
},
|
|
163
|
+
|
|
164
|
+
fromJSON(object: any): MsgRequestTransaction {
|
|
165
|
+
return {
|
|
166
|
+
creator: isSet(object.creator) ? String(object.creator) : "",
|
|
167
|
+
originChain: isSet(object.originChain) ? String(object.originChain) : "",
|
|
168
|
+
originAddress: isSet(object.originAddress)
|
|
169
|
+
? String(object.originAddress)
|
|
170
|
+
: "",
|
|
171
|
+
targetChain: isSet(object.targetChain) ? String(object.targetChain) : "",
|
|
172
|
+
targetAddress: isSet(object.targetAddress)
|
|
173
|
+
? String(object.targetAddress)
|
|
174
|
+
: "",
|
|
175
|
+
originSymbol: isSet(object.originSymbol)
|
|
176
|
+
? String(object.originSymbol)
|
|
177
|
+
: "",
|
|
178
|
+
targetSymbol: isSet(object.targetSymbol)
|
|
179
|
+
? String(object.targetSymbol)
|
|
180
|
+
: "",
|
|
181
|
+
amount: isSet(object.amount) ? String(object.amount) : "",
|
|
182
|
+
fee: isSet(object.fee) ? String(object.fee) : "",
|
|
183
|
+
htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
|
|
184
|
+
? String(object.htlcExpirationTimestamp)
|
|
185
|
+
: "",
|
|
186
|
+
htlcCreationHash: isSet(object.htlcCreationHash)
|
|
187
|
+
? String(object.htlcCreationHash)
|
|
188
|
+
: "",
|
|
189
|
+
htlcCreationVout: isSet(object.htlcCreationVout)
|
|
190
|
+
? Number(object.htlcCreationVout)
|
|
191
|
+
: 0,
|
|
192
|
+
htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
|
|
193
|
+
senderPubKey: isSet(object.senderPubKey)
|
|
194
|
+
? bytesFromBase64(object.senderPubKey)
|
|
195
|
+
: new Uint8Array(),
|
|
196
|
+
options: isSet(object.options) ? String(object.options) : "",
|
|
197
|
+
};
|
|
198
|
+
},
|
|
199
|
+
|
|
200
|
+
toJSON(message: MsgRequestTransaction): unknown {
|
|
201
|
+
const obj: any = {};
|
|
202
|
+
message.creator !== undefined && (obj.creator = message.creator);
|
|
203
|
+
message.originChain !== undefined &&
|
|
204
|
+
(obj.originChain = message.originChain);
|
|
205
|
+
message.originAddress !== undefined &&
|
|
206
|
+
(obj.originAddress = message.originAddress);
|
|
207
|
+
message.targetChain !== undefined &&
|
|
208
|
+
(obj.targetChain = message.targetChain);
|
|
209
|
+
message.targetAddress !== undefined &&
|
|
210
|
+
(obj.targetAddress = message.targetAddress);
|
|
211
|
+
message.originSymbol !== undefined &&
|
|
212
|
+
(obj.originSymbol = message.originSymbol);
|
|
213
|
+
message.targetSymbol !== undefined &&
|
|
214
|
+
(obj.targetSymbol = message.targetSymbol);
|
|
215
|
+
message.amount !== undefined && (obj.amount = message.amount);
|
|
216
|
+
message.fee !== undefined && (obj.fee = message.fee);
|
|
217
|
+
message.htlcExpirationTimestamp !== undefined &&
|
|
218
|
+
(obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
|
|
219
|
+
message.htlcCreationHash !== undefined &&
|
|
220
|
+
(obj.htlcCreationHash = message.htlcCreationHash);
|
|
221
|
+
message.htlcCreationVout !== undefined &&
|
|
222
|
+
(obj.htlcCreationVout = Math.round(message.htlcCreationVout));
|
|
223
|
+
message.htlcVersion !== undefined &&
|
|
224
|
+
(obj.htlcVersion = message.htlcVersion);
|
|
225
|
+
message.senderPubKey !== undefined &&
|
|
226
|
+
(obj.senderPubKey = base64FromBytes(
|
|
227
|
+
message.senderPubKey !== undefined
|
|
228
|
+
? message.senderPubKey
|
|
229
|
+
: new Uint8Array()
|
|
230
|
+
));
|
|
231
|
+
message.options !== undefined && (obj.options = message.options);
|
|
232
|
+
return obj;
|
|
233
|
+
},
|
|
234
|
+
|
|
235
|
+
fromPartial<I extends Exact<DeepPartial<MsgRequestTransaction>, I>>(
|
|
236
|
+
object: I
|
|
237
|
+
): MsgRequestTransaction {
|
|
238
|
+
const message = createBaseMsgRequestTransaction();
|
|
239
|
+
message.creator = object.creator ?? "";
|
|
240
|
+
message.originChain = object.originChain ?? "";
|
|
241
|
+
message.originAddress = object.originAddress ?? "";
|
|
242
|
+
message.targetChain = object.targetChain ?? "";
|
|
243
|
+
message.targetAddress = object.targetAddress ?? "";
|
|
244
|
+
message.originSymbol = object.originSymbol ?? "";
|
|
245
|
+
message.targetSymbol = object.targetSymbol ?? "";
|
|
246
|
+
message.amount = object.amount ?? "";
|
|
247
|
+
message.fee = object.fee ?? "";
|
|
248
|
+
message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
|
|
249
|
+
message.htlcCreationHash = object.htlcCreationHash ?? "";
|
|
250
|
+
message.htlcCreationVout = object.htlcCreationVout ?? 0;
|
|
251
|
+
message.htlcVersion = object.htlcVersion ?? "";
|
|
252
|
+
message.senderPubKey = object.senderPubKey ?? new Uint8Array();
|
|
253
|
+
message.options = object.options ?? "";
|
|
254
|
+
return message;
|
|
255
|
+
},
|
|
256
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import _m0 from "../../config/probuff.config";
|
|
2
|
+
import { DeepPartial, Exact, isSet, longToNumber } from "../../utils";
|
|
3
|
+
|
|
4
|
+
export interface MsgRequestTransactionResponse {
|
|
5
|
+
code: string;
|
|
6
|
+
msg: string;
|
|
7
|
+
txId: number;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function createBaseMsgRequestTransactionResponse(): MsgRequestTransactionResponse {
|
|
11
|
+
return { code: "", msg: "", txId: 0 };
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const MsgRequestTransactionResponse = {
|
|
15
|
+
encode(
|
|
16
|
+
message: MsgRequestTransactionResponse,
|
|
17
|
+
writer: _m0.Writer = _m0.Writer.create()
|
|
18
|
+
): _m0.Writer {
|
|
19
|
+
if (message.code !== "") {
|
|
20
|
+
writer.uint32(10).string(message.code);
|
|
21
|
+
}
|
|
22
|
+
if (message.msg !== "") {
|
|
23
|
+
writer.uint32(18).string(message.msg);
|
|
24
|
+
}
|
|
25
|
+
if (message.txId !== 0) {
|
|
26
|
+
writer.uint32(24).uint64(message.txId);
|
|
27
|
+
}
|
|
28
|
+
return writer;
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
decode(
|
|
32
|
+
input: _m0.Reader | Uint8Array,
|
|
33
|
+
length?: number
|
|
34
|
+
): MsgRequestTransactionResponse {
|
|
35
|
+
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
36
|
+
let end = length === undefined ? reader.len : reader.pos + length;
|
|
37
|
+
const message = createBaseMsgRequestTransactionResponse();
|
|
38
|
+
while (reader.pos < end) {
|
|
39
|
+
const tag = reader.uint32();
|
|
40
|
+
switch (tag >>> 3) {
|
|
41
|
+
case 1:
|
|
42
|
+
message.code = reader.string();
|
|
43
|
+
break;
|
|
44
|
+
case 2:
|
|
45
|
+
message.msg = reader.string();
|
|
46
|
+
break;
|
|
47
|
+
case 3:
|
|
48
|
+
message.txId = longToNumber(reader.uint64() as Long);
|
|
49
|
+
break;
|
|
50
|
+
default:
|
|
51
|
+
reader.skipType(tag & 7);
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return message;
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
fromJSON(object: any): MsgRequestTransactionResponse {
|
|
59
|
+
return {
|
|
60
|
+
code: isSet(object.code) ? String(object.code) : "",
|
|
61
|
+
msg: isSet(object.msg) ? String(object.msg) : "",
|
|
62
|
+
txId: isSet(object.txId) ? Number(object.txId) : 0,
|
|
63
|
+
};
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
toJSON(message: MsgRequestTransactionResponse): unknown {
|
|
67
|
+
const obj: any = {};
|
|
68
|
+
message.code !== undefined && (obj.code = message.code);
|
|
69
|
+
message.msg !== undefined && (obj.msg = message.msg);
|
|
70
|
+
message.txId !== undefined && (obj.txId = Math.round(message.txId));
|
|
71
|
+
return obj;
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
fromPartial<I extends Exact<DeepPartial<MsgRequestTransactionResponse>, I>>(
|
|
75
|
+
object: I
|
|
76
|
+
): MsgRequestTransactionResponse {
|
|
77
|
+
const message = createBaseMsgRequestTransactionResponse();
|
|
78
|
+
message.code = object.code ?? "";
|
|
79
|
+
message.msg = object.msg ?? "";
|
|
80
|
+
message.txId = object.txId ?? 0;
|
|
81
|
+
return message;
|
|
82
|
+
},
|
|
83
|
+
};
|
|
File without changes
|