@kimafinance/kima-transaction-api 1.0.24-beta.1 → 1.0.26-beta.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/build/index.d.ts CHANGED
@@ -23,6 +23,11 @@ interface Props {
23
23
  symbol: CurrencyOptions;
24
24
  amount: number;
25
25
  fee: number;
26
+ htlcCreationHash: string;
27
+ htlcCreationVout: number;
28
+ htlcExpirationTimestamp: string;
29
+ htlcVersion: string;
30
+ senderPubKey: Uint8Array;
26
31
  }
27
- export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }: Props): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
32
+ export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }: Props): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
28
33
  export {};
package/build/index.js CHANGED
@@ -25,7 +25,7 @@ var CurrencyOptions;
25
25
  function sleep(ms) {
26
26
  return new Promise((resolve) => setTimeout(resolve, ms));
27
27
  }
28
- async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }) {
28
+ async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }) {
29
29
  const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
30
30
  const client = await (0, common_1.TxClient)(wallet);
31
31
  const [firstAccount] = await wallet.getAccounts();
@@ -38,6 +38,11 @@ async function submitKimaTransaction({ originChain, originAddress, targetChain,
38
38
  symbol,
39
39
  amount: amount.toString(),
40
40
  fee: fee.toString(),
41
+ htlcCreationHash,
42
+ htlcCreationVout,
43
+ htlcExpirationTimestamp,
44
+ htlcVersion,
45
+ senderPubKey,
41
46
  };
42
47
  let msg = await client.msgRequestTransaction(params);
43
48
  const result = await client.signAndBroadcast([msg]);
@@ -55,7 +60,7 @@ async function submitKimaTransaction({ originChain, originAddress, targetChain,
55
60
  creator: firstAccount.address,
56
61
  txId,
57
62
  txHash: result.transactionHash,
58
- txType: "request_transaction"
63
+ txType: "request_transaction",
59
64
  });
60
65
  console.log(msg);
61
66
  let hashResult;
@@ -9,6 +9,16 @@ export interface MsgRequestTransaction {
9
9
  symbol: string;
10
10
  amount: string;
11
11
  fee: string;
12
+ /** the timestamp when the HTLC contract expires and the user can reclaim the funds locked there */
13
+ htlcExpirationTimestamp: string;
14
+ /** the txhash locking the funds in the HTLC */
15
+ htlcCreationHash: string;
16
+ /** the output index of the locked funds in the HTLC creation transaction */
17
+ htlcCreationVout: number;
18
+ /** a version denoting which HTLC script version is being using for the HTLC transaction */
19
+ htlcVersion: string;
20
+ /** for bitcoin transaction this is the public key of the sender */
21
+ senderPubKey: Uint8Array;
12
22
  }
13
23
  export interface MsgRequestTransactionResponse {
14
24
  code: string;
@@ -44,6 +54,16 @@ export interface MsgRequestProvisionTransaction {
44
54
  symbol: string;
45
55
  amount: string;
46
56
  options: string;
57
+ /** BTC transaction */
58
+ htlcExpirationTimestamp: string;
59
+ /** the txhash locking the funds in the HTLC */
60
+ htlcCreationHash: string;
61
+ /** the output index of the locked funds in the HTLC creation transaction */
62
+ htlcCreationVout: number;
63
+ /** a version denoting which HTLC script version is being using for the HTLC transaction */
64
+ htlcVersion: string;
65
+ /** the (compressed) public key of the sender */
66
+ senderPubKey: Uint8Array;
47
67
  }
48
68
  export interface MsgRequestProvisionTransactionResponse {
49
69
  code: string;
@@ -117,6 +137,11 @@ export declare const MsgRequestTransaction: {
117
137
  symbol?: string | undefined;
118
138
  amount?: string | undefined;
119
139
  fee?: string | undefined;
140
+ htlcExpirationTimestamp?: string | undefined;
141
+ htlcCreationHash?: string | undefined;
142
+ htlcCreationVout?: number | undefined;
143
+ htlcVersion?: string | undefined;
144
+ senderPubKey?: Uint8Array | undefined;
120
145
  } & {
121
146
  creator?: string | undefined;
122
147
  originChain?: string | undefined;
@@ -126,6 +151,11 @@ export declare const MsgRequestTransaction: {
126
151
  symbol?: string | undefined;
127
152
  amount?: string | undefined;
128
153
  fee?: string | undefined;
154
+ htlcExpirationTimestamp?: string | undefined;
155
+ htlcCreationHash?: string | undefined;
156
+ htlcCreationVout?: number | undefined;
157
+ htlcVersion?: string | undefined;
158
+ senderPubKey?: Uint8Array | undefined;
129
159
  } & { [K in Exclude<keyof I, keyof MsgRequestTransaction>]: never; }>(object: I): MsgRequestTransaction;
130
160
  };
131
161
  export declare const MsgRequestTransactionResponse: {
@@ -219,6 +249,11 @@ export declare const MsgRequestProvisionTransaction: {
219
249
  symbol?: string | undefined;
220
250
  amount?: string | undefined;
221
251
  options?: string | undefined;
252
+ htlcExpirationTimestamp?: string | undefined;
253
+ htlcCreationHash?: string | undefined;
254
+ htlcCreationVout?: number | undefined;
255
+ htlcVersion?: string | undefined;
256
+ senderPubKey?: Uint8Array | undefined;
222
257
  } & {
223
258
  creator?: string | undefined;
224
259
  chain?: string | undefined;
@@ -226,6 +261,11 @@ export declare const MsgRequestProvisionTransaction: {
226
261
  symbol?: string | undefined;
227
262
  amount?: string | undefined;
228
263
  options?: string | undefined;
264
+ htlcExpirationTimestamp?: string | undefined;
265
+ htlcCreationHash?: string | undefined;
266
+ htlcCreationVout?: number | undefined;
267
+ htlcVersion?: string | undefined;
268
+ senderPubKey?: Uint8Array | undefined;
229
269
  } & { [K in Exclude<keyof I, keyof MsgRequestProvisionTransaction>]: never; }>(object: I): MsgRequestProvisionTransaction;
230
270
  };
231
271
  export declare const MsgRequestProvisionTransactionResponse: {
package/build/kima/tx.js CHANGED
@@ -18,6 +18,11 @@ function createBaseMsgRequestTransaction() {
18
18
  symbol: "",
19
19
  amount: "",
20
20
  fee: "",
21
+ htlcExpirationTimestamp: "",
22
+ htlcCreationHash: "",
23
+ htlcCreationVout: 0,
24
+ htlcVersion: "",
25
+ senderPubKey: new Uint8Array(),
21
26
  };
22
27
  }
23
28
  exports.MsgRequestTransaction = {
@@ -46,6 +51,21 @@ exports.MsgRequestTransaction = {
46
51
  if (message.fee !== "") {
47
52
  writer.uint32(66).string(message.fee);
48
53
  }
54
+ if (message.htlcExpirationTimestamp !== "") {
55
+ writer.uint32(74).string(message.htlcExpirationTimestamp);
56
+ }
57
+ if (message.htlcCreationHash !== "") {
58
+ writer.uint32(82).string(message.htlcCreationHash);
59
+ }
60
+ if (message.htlcCreationVout !== 0) {
61
+ writer.uint32(88).uint32(message.htlcCreationVout);
62
+ }
63
+ if (message.htlcVersion !== "") {
64
+ writer.uint32(98).string(message.htlcVersion);
65
+ }
66
+ if (message.senderPubKey.length !== 0) {
67
+ writer.uint32(106).bytes(message.senderPubKey);
68
+ }
49
69
  return writer;
50
70
  },
51
71
  decode(input, length) {
@@ -79,6 +99,21 @@ exports.MsgRequestTransaction = {
79
99
  case 8:
80
100
  message.fee = reader.string();
81
101
  break;
102
+ case 9:
103
+ message.htlcExpirationTimestamp = reader.string();
104
+ break;
105
+ case 10:
106
+ message.htlcCreationHash = reader.string();
107
+ break;
108
+ case 11:
109
+ message.htlcCreationVout = reader.uint32();
110
+ break;
111
+ case 12:
112
+ message.htlcVersion = reader.string();
113
+ break;
114
+ case 13:
115
+ message.senderPubKey = reader.bytes();
116
+ break;
82
117
  default:
83
118
  reader.skipType(tag & 7);
84
119
  break;
@@ -90,24 +125,57 @@ exports.MsgRequestTransaction = {
90
125
  return {
91
126
  creator: isSet(object.creator) ? String(object.creator) : "",
92
127
  originChain: isSet(object.originChain) ? String(object.originChain) : "",
93
- originAddress: isSet(object.originAddress) ? String(object.originAddress) : "",
128
+ originAddress: isSet(object.originAddress)
129
+ ? String(object.originAddress)
130
+ : "",
94
131
  targetChain: isSet(object.targetChain) ? String(object.targetChain) : "",
95
- targetAddress: isSet(object.targetAddress) ? String(object.targetAddress) : "",
132
+ targetAddress: isSet(object.targetAddress)
133
+ ? String(object.targetAddress)
134
+ : "",
96
135
  symbol: isSet(object.symbol) ? String(object.symbol) : "",
97
136
  amount: isSet(object.amount) ? String(object.amount) : "",
98
137
  fee: isSet(object.fee) ? String(object.fee) : "",
138
+ htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
139
+ ? String(object.htlcExpirationTimestamp)
140
+ : "",
141
+ htlcCreationHash: isSet(object.htlcCreationHash)
142
+ ? String(object.htlcCreationHash)
143
+ : "",
144
+ htlcCreationVout: isSet(object.htlcCreationVout)
145
+ ? Number(object.htlcCreationVout)
146
+ : 0,
147
+ htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
148
+ senderPubKey: isSet(object.senderPubKey)
149
+ ? bytesFromBase64(object.senderPubKey)
150
+ : new Uint8Array(),
99
151
  };
100
152
  },
101
153
  toJSON(message) {
102
154
  const obj = {};
103
155
  message.creator !== undefined && (obj.creator = message.creator);
104
- message.originChain !== undefined && (obj.originChain = message.originChain);
105
- message.originAddress !== undefined && (obj.originAddress = message.originAddress);
106
- message.targetChain !== undefined && (obj.targetChain = message.targetChain);
107
- message.targetAddress !== undefined && (obj.targetAddress = message.targetAddress);
156
+ message.originChain !== undefined &&
157
+ (obj.originChain = message.originChain);
158
+ message.originAddress !== undefined &&
159
+ (obj.originAddress = message.originAddress);
160
+ message.targetChain !== undefined &&
161
+ (obj.targetChain = message.targetChain);
162
+ message.targetAddress !== undefined &&
163
+ (obj.targetAddress = message.targetAddress);
108
164
  message.symbol !== undefined && (obj.symbol = message.symbol);
109
165
  message.amount !== undefined && (obj.amount = message.amount);
110
166
  message.fee !== undefined && (obj.fee = message.fee);
167
+ message.htlcExpirationTimestamp !== undefined &&
168
+ (obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
169
+ message.htlcCreationHash !== undefined &&
170
+ (obj.htlcCreationHash = message.htlcCreationHash);
171
+ message.htlcCreationVout !== undefined &&
172
+ (obj.htlcCreationVout = Math.round(message.htlcCreationVout));
173
+ message.htlcVersion !== undefined &&
174
+ (obj.htlcVersion = message.htlcVersion);
175
+ message.senderPubKey !== undefined &&
176
+ (obj.senderPubKey = base64FromBytes(message.senderPubKey !== undefined
177
+ ? message.senderPubKey
178
+ : new Uint8Array()));
111
179
  return obj;
112
180
  },
113
181
  fromPartial(object) {
@@ -120,6 +188,11 @@ exports.MsgRequestTransaction = {
120
188
  message.symbol = object.symbol ?? "";
121
189
  message.amount = object.amount ?? "";
122
190
  message.fee = object.fee ?? "";
191
+ message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
192
+ message.htlcCreationHash = object.htlcCreationHash ?? "";
193
+ message.htlcCreationVout = object.htlcCreationVout ?? 0;
194
+ message.htlcVersion = object.htlcVersion ?? "";
195
+ message.senderPubKey = object.senderPubKey ?? new Uint8Array();
123
196
  return message;
124
197
  },
125
198
  };
@@ -297,7 +370,10 @@ exports.MsgFinalizeTransactionResponse = {
297
370
  return message;
298
371
  },
299
372
  fromJSON(object) {
300
- return { code: isSet(object.code) ? String(object.code) : "", msg: isSet(object.msg) ? String(object.msg) : "" };
373
+ return {
374
+ code: isSet(object.code) ? String(object.code) : "",
375
+ msg: isSet(object.msg) ? String(object.msg) : "",
376
+ };
301
377
  },
302
378
  toJSON(message) {
303
379
  const obj = {};
@@ -425,7 +501,10 @@ exports.MsgFinalizeProvisionTransactionResponse = {
425
501
  return message;
426
502
  },
427
503
  fromJSON(object) {
428
- return { code: isSet(object.code) ? String(object.code) : "", msg: isSet(object.msg) ? String(object.msg) : "" };
504
+ return {
505
+ code: isSet(object.code) ? String(object.code) : "",
506
+ msg: isSet(object.msg) ? String(object.msg) : "",
507
+ };
429
508
  },
430
509
  toJSON(message) {
431
510
  const obj = {};
@@ -441,7 +520,19 @@ exports.MsgFinalizeProvisionTransactionResponse = {
441
520
  },
442
521
  };
443
522
  function createBaseMsgRequestProvisionTransaction() {
444
- return { creator: "", chain: "", fromAddress: "", symbol: "", amount: "", options: "" };
523
+ return {
524
+ creator: "",
525
+ chain: "",
526
+ fromAddress: "",
527
+ symbol: "",
528
+ amount: "",
529
+ options: "",
530
+ htlcExpirationTimestamp: "",
531
+ htlcCreationHash: "",
532
+ htlcCreationVout: 0,
533
+ htlcVersion: "",
534
+ senderPubKey: new Uint8Array(),
535
+ };
445
536
  }
446
537
  exports.MsgRequestProvisionTransaction = {
447
538
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -463,6 +554,21 @@ exports.MsgRequestProvisionTransaction = {
463
554
  if (message.options !== "") {
464
555
  writer.uint32(50).string(message.options);
465
556
  }
557
+ if (message.htlcExpirationTimestamp !== "") {
558
+ writer.uint32(58).string(message.htlcExpirationTimestamp);
559
+ }
560
+ if (message.htlcCreationHash !== "") {
561
+ writer.uint32(66).string(message.htlcCreationHash);
562
+ }
563
+ if (message.htlcCreationVout !== 0) {
564
+ writer.uint32(72).uint32(message.htlcCreationVout);
565
+ }
566
+ if (message.htlcVersion !== "") {
567
+ writer.uint32(82).string(message.htlcVersion);
568
+ }
569
+ if (message.senderPubKey.length !== 0) {
570
+ writer.uint32(90).bytes(message.senderPubKey);
571
+ }
466
572
  return writer;
467
573
  },
468
574
  decode(input, length) {
@@ -490,6 +596,21 @@ exports.MsgRequestProvisionTransaction = {
490
596
  case 6:
491
597
  message.options = reader.string();
492
598
  break;
599
+ case 7:
600
+ message.htlcExpirationTimestamp = reader.string();
601
+ break;
602
+ case 8:
603
+ message.htlcCreationHash = reader.string();
604
+ break;
605
+ case 9:
606
+ message.htlcCreationVout = reader.uint32();
607
+ break;
608
+ case 10:
609
+ message.htlcVersion = reader.string();
610
+ break;
611
+ case 11:
612
+ message.senderPubKey = reader.bytes();
613
+ break;
493
614
  default:
494
615
  reader.skipType(tag & 7);
495
616
  break;
@@ -505,16 +626,42 @@ exports.MsgRequestProvisionTransaction = {
505
626
  symbol: isSet(object.symbol) ? String(object.symbol) : "",
506
627
  amount: isSet(object.amount) ? String(object.amount) : "",
507
628
  options: isSet(object.options) ? String(object.options) : "",
629
+ htlcExpirationTimestamp: isSet(object.htlcExpirationTimestamp)
630
+ ? String(object.htlcExpirationTimestamp)
631
+ : "",
632
+ htlcCreationHash: isSet(object.htlcCreationHash)
633
+ ? String(object.htlcCreationHash)
634
+ : "",
635
+ htlcCreationVout: isSet(object.htlcCreationVout)
636
+ ? Number(object.htlcCreationVout)
637
+ : 0,
638
+ htlcVersion: isSet(object.htlcVersion) ? String(object.htlcVersion) : "",
639
+ senderPubKey: isSet(object.senderPubKey)
640
+ ? bytesFromBase64(object.senderPubKey)
641
+ : new Uint8Array(),
508
642
  };
509
643
  },
510
644
  toJSON(message) {
511
645
  const obj = {};
512
646
  message.creator !== undefined && (obj.creator = message.creator);
513
647
  message.chain !== undefined && (obj.chain = message.chain);
514
- message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
648
+ message.fromAddress !== undefined &&
649
+ (obj.fromAddress = message.fromAddress);
515
650
  message.symbol !== undefined && (obj.symbol = message.symbol);
516
651
  message.amount !== undefined && (obj.amount = message.amount);
517
652
  message.options !== undefined && (obj.options = message.options);
653
+ message.htlcExpirationTimestamp !== undefined &&
654
+ (obj.htlcExpirationTimestamp = message.htlcExpirationTimestamp);
655
+ message.htlcCreationHash !== undefined &&
656
+ (obj.htlcCreationHash = message.htlcCreationHash);
657
+ message.htlcCreationVout !== undefined &&
658
+ (obj.htlcCreationVout = Math.round(message.htlcCreationVout));
659
+ message.htlcVersion !== undefined &&
660
+ (obj.htlcVersion = message.htlcVersion);
661
+ message.senderPubKey !== undefined &&
662
+ (obj.senderPubKey = base64FromBytes(message.senderPubKey !== undefined
663
+ ? message.senderPubKey
664
+ : new Uint8Array()));
518
665
  return obj;
519
666
  },
520
667
  fromPartial(object) {
@@ -525,6 +672,11 @@ exports.MsgRequestProvisionTransaction = {
525
672
  message.symbol = object.symbol ?? "";
526
673
  message.amount = object.amount ?? "";
527
674
  message.options = object.options ?? "";
675
+ message.htlcExpirationTimestamp = object.htlcExpirationTimestamp ?? "";
676
+ message.htlcCreationHash = object.htlcCreationHash ?? "";
677
+ message.htlcCreationVout = object.htlcCreationVout ?? 0;
678
+ message.htlcVersion = object.htlcVersion ?? "";
679
+ message.senderPubKey = object.senderPubKey ?? new Uint8Array();
528
680
  return message;
529
681
  },
530
682
  };
@@ -625,13 +777,16 @@ exports.MsgCancelTransaction = {
625
777
  fromJSON(object) {
626
778
  return {
627
779
  creator: isSet(object.creator) ? String(object.creator) : "",
628
- transactionId: isSet(object.transactionId) ? String(object.transactionId) : "",
780
+ transactionId: isSet(object.transactionId)
781
+ ? String(object.transactionId)
782
+ : "",
629
783
  };
630
784
  },
631
785
  toJSON(message) {
632
786
  const obj = {};
633
787
  message.creator !== undefined && (obj.creator = message.creator);
634
- message.transactionId !== undefined && (obj.transactionId = message.transactionId);
788
+ message.transactionId !== undefined &&
789
+ (obj.transactionId = message.transactionId);
635
790
  return obj;
636
791
  },
637
792
  fromPartial(object) {
@@ -675,7 +830,10 @@ exports.MsgCancelTransactionResponse = {
675
830
  return message;
676
831
  },
677
832
  fromJSON(object) {
678
- return { code: isSet(object.code) ? String(object.code) : "", msg: isSet(object.msg) ? String(object.msg) : "" };
833
+ return {
834
+ code: isSet(object.code) ? String(object.code) : "",
835
+ msg: isSet(object.msg) ? String(object.msg) : "",
836
+ };
679
837
  },
680
838
  toJSON(message) {
681
839
  const obj = {};
@@ -794,7 +952,10 @@ exports.MsgSetTxHashResponse = {
794
952
  return message;
795
953
  },
796
954
  fromJSON(object) {
797
- return { code: isSet(object.code) ? String(object.code) : "", msg: isSet(object.msg) ? String(object.msg) : "" };
955
+ return {
956
+ code: isSet(object.code) ? String(object.code) : "",
957
+ msg: isSet(object.msg) ? String(object.msg) : "",
958
+ };
798
959
  },
799
960
  toJSON(message) {
800
961
  const obj = {};
@@ -873,7 +1034,8 @@ exports.MsgSetTxProcess = {
873
1034
  const obj = {};
874
1035
  message.creator !== undefined && (obj.creator = message.creator);
875
1036
  message.txId !== undefined && (obj.txId = Math.round(message.txId));
876
- message.timestamp !== undefined && (obj.timestamp = Math.round(message.timestamp));
1037
+ message.timestamp !== undefined &&
1038
+ (obj.timestamp = Math.round(message.timestamp));
877
1039
  message.msgId !== undefined && (obj.msgId = message.msgId);
878
1040
  message.txType !== undefined && (obj.txType = message.txType);
879
1041
  return obj;
@@ -922,7 +1084,14 @@ exports.MsgSetTxProcessResponse = {
922
1084
  },
923
1085
  };
924
1086
  function createBaseMsgRequestDrainTransaction() {
925
- return { creator: "", toChain: "", toAddress: "", symbol: "", amount: "", options: "" };
1087
+ return {
1088
+ creator: "",
1089
+ toChain: "",
1090
+ toAddress: "",
1091
+ symbol: "",
1092
+ amount: "",
1093
+ options: "",
1094
+ };
926
1095
  }
927
1096
  exports.MsgRequestDrainTransaction = {
928
1097
  encode(message, writer = minimal_1.default.Writer.create()) {
@@ -1183,7 +1352,10 @@ exports.MsgFinalizeDrainTransactionResponse = {
1183
1352
  return message;
1184
1353
  },
1185
1354
  fromJSON(object) {
1186
- return { code: isSet(object.code) ? String(object.code) : "", msg: isSet(object.msg) ? String(object.msg) : "" };
1355
+ return {
1356
+ code: isSet(object.code) ? String(object.code) : "",
1357
+ msg: isSet(object.msg) ? String(object.msg) : "",
1358
+ };
1187
1359
  },
1188
1360
  toJSON(message) {
1189
1361
  const obj = {};
@@ -1204,11 +1376,13 @@ class MsgClientImpl {
1204
1376
  this.rpc = rpc;
1205
1377
  this.RequestTransaction = this.RequestTransaction.bind(this);
1206
1378
  this.FinalizeTransaction = this.FinalizeTransaction.bind(this);
1207
- this.RequestProvisionTransaction = this.RequestProvisionTransaction.bind(this);
1379
+ this.RequestProvisionTransaction =
1380
+ this.RequestProvisionTransaction.bind(this);
1208
1381
  this.CancelTransaction = this.CancelTransaction.bind(this);
1209
1382
  this.SetTxHash = this.SetTxHash.bind(this);
1210
1383
  this.SetTxProcess = this.SetTxProcess.bind(this);
1211
- this.FinalizeProvisionTransaction = this.FinalizeProvisionTransaction.bind(this);
1384
+ this.FinalizeProvisionTransaction =
1385
+ this.FinalizeProvisionTransaction.bind(this);
1212
1386
  this.RequestDrainTransaction = this.RequestDrainTransaction.bind(this);
1213
1387
  this.FinalizeDrainTransaction = this.FinalizeDrainTransaction.bind(this);
1214
1388
  }
@@ -1274,6 +1448,31 @@ var globalThis = (() => {
1274
1448
  }
1275
1449
  throw "Unable to locate global object";
1276
1450
  })();
1451
+ function bytesFromBase64(b64) {
1452
+ if (globalThis.Buffer) {
1453
+ return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1454
+ }
1455
+ else {
1456
+ const bin = globalThis.atob(b64);
1457
+ const arr = new Uint8Array(bin.length);
1458
+ for (let i = 0; i < bin.length; ++i) {
1459
+ arr[i] = bin.charCodeAt(i);
1460
+ }
1461
+ return arr;
1462
+ }
1463
+ }
1464
+ function base64FromBytes(arr) {
1465
+ if (globalThis.Buffer) {
1466
+ return globalThis.Buffer.from(arr).toString("base64");
1467
+ }
1468
+ else {
1469
+ const bin = [];
1470
+ arr.forEach((byte) => {
1471
+ bin.push(String.fromCharCode(byte));
1472
+ });
1473
+ return globalThis.btoa(bin.join(""));
1474
+ }
1475
+ }
1277
1476
  function longToNumber(long) {
1278
1477
  if (long.gt(Number.MAX_SAFE_INTEGER)) {
1279
1478
  throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kimafinance/kima-transaction-api",
3
- "version": "1.0.24-beta.1",
3
+ "version": "1.0.26-beta.1",
4
4
  "description": "A wrapper around Kima's API, enabling sending and monitoring transactions (Beta version)",
5
5
  "repository": "https://github.com/kima-finance/kima-transaction-api",
6
6
  "author": "",
package/src/index.ts CHANGED
@@ -29,6 +29,11 @@ interface Props {
29
29
  symbol: CurrencyOptions;
30
30
  amount: number;
31
31
  fee: number;
32
+ htlcCreationHash: string;
33
+ htlcCreationVout: number;
34
+ htlcExpirationTimestamp: string;
35
+ htlcVersion: string;
36
+ senderPubKey: Uint8Array;
32
37
  }
33
38
 
34
39
  function sleep(ms: number) {
@@ -43,6 +48,11 @@ export async function submitKimaTransaction({
43
48
  symbol,
44
49
  amount,
45
50
  fee,
51
+ htlcCreationHash,
52
+ htlcCreationVout,
53
+ htlcExpirationTimestamp,
54
+ htlcVersion,
55
+ senderPubKey,
46
56
  }: Props) {
47
57
  const wallet = await DirectSecp256k1HdWallet.fromMnemonic(
48
58
  process.env.KIMA_BACKEND_MNEMONIC as string,
@@ -59,6 +69,11 @@ export async function submitKimaTransaction({
59
69
  symbol,
60
70
  amount: amount.toString(),
61
71
  fee: fee.toString(),
72
+ htlcCreationHash,
73
+ htlcCreationVout,
74
+ htlcExpirationTimestamp,
75
+ htlcVersion,
76
+ senderPubKey,
62
77
  };
63
78
 
64
79
  let msg = await client.msgRequestTransaction(params);
@@ -80,7 +95,7 @@ export async function submitKimaTransaction({
80
95
  creator: firstAccount.address,
81
96
  txId,
82
97
  txHash: result.transactionHash,
83
- txType: "request_transaction"
98
+ txType: "request_transaction",
84
99
  });
85
100
 
86
101
  console.log(msg);