@kimafinance/kima-transaction-api 1.0.31-beta.1 → 1.3.2
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 +3 -1
- package/build/index.js +9 -3
- package/package.json +1 -1
- package/src/index.ts +12 -1
package/build/index.d.ts
CHANGED
|
@@ -43,6 +43,8 @@ interface RequestTxProps {
|
|
|
43
43
|
htlcExpirationTimestamp: string;
|
|
44
44
|
htlcVersion: string;
|
|
45
45
|
senderPubKey: Uint8Array;
|
|
46
|
+
options: string;
|
|
46
47
|
}
|
|
47
|
-
export declare function
|
|
48
|
+
export declare function getCreatorAddress(): Promise<import("@cosmjs/proto-signing").AccountData>;
|
|
49
|
+
export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, options, }: RequestTxProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
48
50
|
export {};
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submitKimaTransaction = exports.submitHtlcLock = exports.HtlcReclaim = exports.CurrencyOptions = exports.SupportedNetworks = void 0;
|
|
3
|
+
exports.submitKimaTransaction = exports.getCreatorAddress = exports.submitHtlcLock = exports.HtlcReclaim = exports.CurrencyOptions = exports.SupportedNetworks = void 0;
|
|
4
4
|
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
5
5
|
const common_1 = require("./kima/common");
|
|
6
6
|
var SupportedNetworks;
|
|
@@ -57,7 +57,13 @@ exports.submitHtlcLock = submitHtlcLock;
|
|
|
57
57
|
function sleep(ms) {
|
|
58
58
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
59
59
|
}
|
|
60
|
-
async function
|
|
60
|
+
async function getCreatorAddress() {
|
|
61
|
+
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
62
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
63
|
+
return firstAccount;
|
|
64
|
+
}
|
|
65
|
+
exports.getCreatorAddress = getCreatorAddress;
|
|
66
|
+
async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, options, }) {
|
|
61
67
|
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
62
68
|
const client = await (0, common_1.TxClient)(wallet);
|
|
63
69
|
const [firstAccount] = await wallet.getAccounts();
|
|
@@ -76,7 +82,7 @@ async function submitKimaTransaction({ originChain, originAddress, targetChain,
|
|
|
76
82
|
htlcExpirationTimestamp,
|
|
77
83
|
htlcVersion,
|
|
78
84
|
senderPubKey,
|
|
79
|
-
options
|
|
85
|
+
options,
|
|
80
86
|
};
|
|
81
87
|
let msg = await client.msgRequestTransaction(params);
|
|
82
88
|
const result = await client.signAndBroadcast([msg]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kimafinance/kima-transaction-api",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.2",
|
|
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
|
@@ -105,12 +105,22 @@ interface RequestTxProps {
|
|
|
105
105
|
htlcExpirationTimestamp: string;
|
|
106
106
|
htlcVersion: string;
|
|
107
107
|
senderPubKey: Uint8Array;
|
|
108
|
+
options: string;
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
function sleep(ms: number) {
|
|
111
112
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
export async function getCreatorAddress() {
|
|
116
|
+
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(
|
|
117
|
+
process.env.KIMA_BACKEND_MNEMONIC as string,
|
|
118
|
+
{ prefix: "kima" }
|
|
119
|
+
);
|
|
120
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
121
|
+
return firstAccount
|
|
122
|
+
}
|
|
123
|
+
|
|
114
124
|
export async function submitKimaTransaction({
|
|
115
125
|
originChain,
|
|
116
126
|
originAddress,
|
|
@@ -125,6 +135,7 @@ export async function submitKimaTransaction({
|
|
|
125
135
|
htlcExpirationTimestamp,
|
|
126
136
|
htlcVersion,
|
|
127
137
|
senderPubKey,
|
|
138
|
+
options,
|
|
128
139
|
}: RequestTxProps) {
|
|
129
140
|
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(
|
|
130
141
|
process.env.KIMA_BACKEND_MNEMONIC as string,
|
|
@@ -147,7 +158,7 @@ export async function submitKimaTransaction({
|
|
|
147
158
|
htlcExpirationTimestamp,
|
|
148
159
|
htlcVersion,
|
|
149
160
|
senderPubKey,
|
|
150
|
-
options
|
|
161
|
+
options,
|
|
151
162
|
};
|
|
152
163
|
|
|
153
164
|
let msg = await client.msgRequestTransaction(params);
|