@kimafinance/kima-transaction-api 1.4.1 → 1.4.3
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 +37 -3
- package/build/index.d.ts +6 -3
- package/build/index.js +91 -17
- package/build/kima/common.d.ts +3 -4
- package/build/kima/common.js +15 -12
- package/build/kima/swap_tx.d.ts +387 -0
- package/build/kima/swap_tx.js +1109 -0
- package/build/kima/transfer_tx.d.ts +674 -0
- package/build/kima/transfer_tx.js +2170 -0
- package/build/types.d.ts +68 -0
- package/build/types.js +34 -0
- package/package.json +10 -10
- package/src/index.ts +167 -3
- package/src/kima/common.ts +22 -5
- package/src/kima/swap_tx.ts +1353 -0
- package/src/kima/transfer_tx.ts +2945 -0
- package/src/types.ts +78 -0
- package/build/api/htlc-lock.d.ts +0 -23
- package/build/api/htlc-lock.js +0 -37
- package/build/api/htlc-reclaim.d.ts +0 -14
- package/build/api/htlc-reclaim.js +0 -28
- package/build/api/submit.d.ts +0 -54
- package/build/api/submit.js +0 -94
- package/build/config/global-this.config.d.ts +0 -2
- package/build/config/global-this.config.js +0 -18
- package/build/config/probuff.config.d.ts +0 -2
- package/build/config/probuff.config.js +0 -12
- package/build/kima/tx/cancel.d.ts +0 -35
- package/build/kima/tx/cancel.js +0 -115
- package/build/kima/tx/drain-finalize.d.ts +0 -47
- package/build/kima/tx/drain-finalize.js +0 -155
- package/build/kima/tx/drain.d.ts +0 -50
- package/build/kima/tx/drain.js +0 -164
- package/build/kima/tx/finalize.d.ts +0 -47
- package/build/kima/tx/finalize.js +0 -155
- package/build/kima/tx/htlc-lock.d.ts +0 -42
- package/build/kima/tx/htlc-lock.js +0 -152
- package/build/kima/tx/htlc-reclaim.d.ts +0 -30
- package/build/kima/tx/htlc-reclaim.js +0 -105
- package/build/kima/tx/index.d.ts +0 -1
- package/build/kima/tx/index.js +0 -4
- package/build/kima/tx/liquidity-provision.d.ts +0 -30
- package/build/kima/tx/liquidity-provision.js +0 -102
- package/build/kima/tx/message-service.d.ts +0 -54
- package/build/kima/tx/message-service.js +0 -117
- package/build/kima/tx/provision-finalize.d.ts +0 -47
- package/build/kima/tx/provision-finalize.js +0 -155
- package/build/kima/tx/provision.d.ts +0 -70
- package/build/kima/tx/provision.js +0 -230
- package/build/kima/tx/request.d.ts +0 -63
- package/build/kima/tx/request.js +0 -222
- package/build/kima/tx/response.d.ts +0 -21
- package/build/kima/tx/response.js +0 -69
- package/build/kima/tx/rpc.d.ts +0 -0
- package/build/kima/tx/rpc.js +0 -1
- package/build/kima/tx/set-hash.d.ts +0 -42
- package/build/kima/tx/set-hash.js +0 -130
- package/build/kima/tx/set-process.d.ts +0 -37
- package/build/kima/tx/set-process.js +0 -121
- package/build/kima/tx/transfer-limit.d.ts +0 -30
- package/build/kima/tx/transfer-limit.js +0 -102
- package/build/kima/tx/withdraw.d.ts +0 -47
- package/build/kima/tx/withdraw.js +0 -155
- package/build/utils.d.ts +0 -17
- package/build/utils.js +0 -49
- package/src/api/htlc-lock.ts +0 -57
- package/src/api/htlc-reclaim.ts +0 -39
- package/src/api/submit.ts +0 -132
- package/src/config/global-this.config.ts +0 -20
- package/src/config/probuff.config.ts +0 -9
- package/src/kima/tx/cancel.ts +0 -147
- package/src/kima/tx/drain-finalize.ts +0 -191
- package/src/kima/tx/drain.ts +0 -201
- package/src/kima/tx/finalize.ts +0 -191
- package/src/kima/tx/htlc-lock.ts +0 -183
- package/src/kima/tx/htlc-reclaim.ts +0 -132
- package/src/kima/tx/index.ts +0 -1
- package/src/kima/tx/liquidity-provision.ts +0 -132
- package/src/kima/tx/message-service.ts +0 -278
- package/src/kima/tx/provision-finalize.ts +0 -191
- package/src/kima/tx/provision.ts +0 -279
- package/src/kima/tx/request.ts +0 -256
- package/src/kima/tx/response.ts +0 -83
- package/src/kima/tx/rpc.ts +0 -0
- package/src/kima/tx/set-hash.ts +0 -162
- package/src/kima/tx/set-process.ts +0 -151
- package/src/kima/tx/transfer-limit.ts +0 -132
- package/src/kima/tx/withdraw.ts +0 -191
- package/src/utils.ts +0 -67
package/README.md
CHANGED
|
@@ -17,12 +17,13 @@ yarn add @kimafinance/kima-transaction-api
|
|
|
17
17
|
|
|
18
18
|
```ts
|
|
19
19
|
import {
|
|
20
|
-
|
|
20
|
+
submitKimaTransferTransaction,
|
|
21
|
+
submitKimaSwapTransaction,
|
|
21
22
|
SupportNetworks,
|
|
22
23
|
CurrencyOptions,
|
|
23
24
|
} from "@kimafinance/kima-transaction-api";
|
|
24
25
|
|
|
25
|
-
const txResult = await
|
|
26
|
+
const txResult = await submitKimaTransferTransaction({
|
|
26
27
|
originAddress: "0x1234123412341234123412341234123412341234",
|
|
27
28
|
originChain: "ETH",
|
|
28
29
|
originSymbol: "USDK",
|
|
@@ -44,11 +45,30 @@ const txResult = await submitKimaTransaction({
|
|
|
44
45
|
transactionIdSignature: "", // optional: used to validate transaction idempotency
|
|
45
46
|
}
|
|
46
47
|
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const txResult = await submitKimaSwapTransaction({
|
|
51
|
+
originAddress: "0x1234123412341234123412341234123412341234",
|
|
52
|
+
originChain: "ETH",
|
|
53
|
+
originSymbol: "USDK",
|
|
54
|
+
targetAddress: "0x1234123412341234123412341234123412341234",
|
|
55
|
+
targetChain: "POL",
|
|
56
|
+
targetSymbol: "USDK",
|
|
57
|
+
amountIn: "100",
|
|
58
|
+
amountOut: "100",
|
|
59
|
+
fee: "0.3",
|
|
60
|
+
dex: "uniswap", // required to send empty strings for now
|
|
61
|
+
slippage: "0.05",
|
|
62
|
+
options: {
|
|
63
|
+
signature: "", // required: generated signature from the approval message
|
|
64
|
+
feeId: "", // required: id returned from calculated fee in fcs
|
|
65
|
+
}
|
|
66
|
+
});
|
|
47
67
|
```
|
|
48
68
|
|
|
49
69
|
## Available Functions
|
|
50
70
|
|
|
51
|
-
`
|
|
71
|
+
`submitKimaTransferTransaction` : Submit a transaction to transfer liquidity from one change to another.
|
|
52
72
|
|
|
53
73
|
- `originAddress`: sending address
|
|
54
74
|
- `originChain`: sending chain
|
|
@@ -59,6 +79,20 @@ const txResult = await submitKimaTransaction({
|
|
|
59
79
|
- `amount`: amount of token to transfer
|
|
60
80
|
- `fee`: amount of token that kima consumes to pay gas fee for pulling & releasing token transactions
|
|
61
81
|
|
|
82
|
+
`submitKimaSwapTransaction` : Submit a transaction to swap token from one chain to another.
|
|
83
|
+
|
|
84
|
+
- `originAddress`: sending address
|
|
85
|
+
- `originChain`: sending chain
|
|
86
|
+
- `originSymbol`: sending token symbol
|
|
87
|
+
- `targetAddress`: receiving address
|
|
88
|
+
- `targetChain`: receiving chain
|
|
89
|
+
- `targetSymbol`: receiving token symbol
|
|
90
|
+
- `amountIn`: amount of token to swap
|
|
91
|
+
- `amountOut`: expected amount of token to receive
|
|
92
|
+
- `fee`: amount of token that kima consumes to pay gas fee for pulling & swapping token transactions
|
|
93
|
+
- `dex`: the name of the dex that user wants to interact with (optional)
|
|
94
|
+
- `slippage`: maximum acceptable slippage parameter
|
|
95
|
+
|
|
62
96
|
## Environment Variables
|
|
63
97
|
|
|
64
98
|
`KIMA_BACKEND_MNEMONIC` : Seed phrase of developer wallet. This wallet must have KIMA token to submit a transaction to kima chain.
|
package/build/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
import { RequestHtlcReclaimProps, RequestHtlcLockProps, RequestTransferTxProps, RequestSwapTxProps } from "./types";
|
|
2
|
+
export declare function HtlcReclaim({ senderAddress, txHash, }: RequestHtlcReclaimProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
3
|
+
export declare function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }: RequestHtlcLockProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
4
|
+
export declare function getCreatorAddress(): Promise<import("@cosmjs/proto-signing").AccountData>;
|
|
5
|
+
export declare function submitKimaTransferTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, options, }: RequestTransferTxProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
6
|
+
export declare function submitKimaSwapTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amountIn, amountOut, fee, dex, slippage, options, }: RequestSwapTxProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
package/build/index.js
CHANGED
|
@@ -1,19 +1,93 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
exports.submitKimaSwapTransaction = exports.submitKimaTransferTransaction = exports.getCreatorAddress = exports.submitHtlcLock = exports.HtlcReclaim = void 0;
|
|
4
|
+
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
5
|
+
const common_1 = require("./kima/common");
|
|
6
|
+
async function HtlcReclaim({ senderAddress, txHash, }) {
|
|
7
|
+
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
8
|
+
const client = await (0, common_1.TxClient)(wallet);
|
|
9
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
10
|
+
const params = {
|
|
11
|
+
creator: firstAccount.address,
|
|
12
|
+
senderAddress,
|
|
13
|
+
txHash,
|
|
14
|
+
};
|
|
15
|
+
let msg = await client.msgHtlcReclaim(params);
|
|
16
|
+
const result = await client.signAndBroadcast([msg]);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
exports.HtlcReclaim = HtlcReclaim;
|
|
20
|
+
async function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }) {
|
|
21
|
+
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
22
|
+
const client = await (0, common_1.TxClient)(wallet);
|
|
23
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
24
|
+
const params = {
|
|
25
|
+
creator: firstAccount.address,
|
|
26
|
+
fromAddress,
|
|
27
|
+
senderPubkey,
|
|
28
|
+
amount,
|
|
29
|
+
htlcTimeout,
|
|
30
|
+
htlcAddress,
|
|
31
|
+
txHash,
|
|
32
|
+
};
|
|
33
|
+
let msg = await client.msgRequestHtlcLock(params);
|
|
34
|
+
const result = await client.signAndBroadcast([msg]);
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
exports.submitHtlcLock = submitHtlcLock;
|
|
38
|
+
async function getCreatorAddress() {
|
|
39
|
+
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
40
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
41
|
+
return firstAccount;
|
|
42
|
+
}
|
|
43
|
+
exports.getCreatorAddress = getCreatorAddress;
|
|
44
|
+
async function submitKimaTransferTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout = 0, htlcExpirationTimestamp, htlcVersion = "", senderPubKey, options, }) {
|
|
45
|
+
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
46
|
+
const client = await (0, common_1.TxClient)(wallet);
|
|
47
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
48
|
+
const params = {
|
|
49
|
+
creator: firstAccount.address,
|
|
50
|
+
originChain,
|
|
51
|
+
originAddress,
|
|
52
|
+
targetChain,
|
|
53
|
+
targetAddress,
|
|
54
|
+
originSymbol,
|
|
55
|
+
targetSymbol,
|
|
56
|
+
amount: amount,
|
|
57
|
+
fee: fee,
|
|
58
|
+
htlcCreationHash: htlcCreationHash || "",
|
|
59
|
+
htlcCreationVout: htlcCreationVout || 0,
|
|
60
|
+
htlcExpirationTimestamp: htlcExpirationTimestamp || "",
|
|
61
|
+
htlcVersion,
|
|
62
|
+
senderPubKey: senderPubKey || new Uint8Array(),
|
|
63
|
+
options,
|
|
64
|
+
};
|
|
65
|
+
const msgTx = await client.msgRequestTransaction(params);
|
|
66
|
+
const result = await client.signAndBroadcast([msgTx]);
|
|
67
|
+
return result;
|
|
68
|
+
}
|
|
69
|
+
exports.submitKimaTransferTransaction = submitKimaTransferTransaction;
|
|
70
|
+
async function submitKimaSwapTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amountIn, amountOut, fee, dex, slippage, options, }) {
|
|
71
|
+
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
72
|
+
const client = await (0, common_1.TxClient)(wallet);
|
|
73
|
+
const [firstAccount] = await wallet.getAccounts();
|
|
74
|
+
const params = {
|
|
75
|
+
creator: firstAccount.address,
|
|
76
|
+
originChain,
|
|
77
|
+
originAddress,
|
|
78
|
+
targetChain,
|
|
79
|
+
targetAddress,
|
|
80
|
+
originSymbol,
|
|
81
|
+
targetSymbol,
|
|
82
|
+
amountIn: amountIn,
|
|
83
|
+
amountOut: amountOut,
|
|
84
|
+
fee: fee,
|
|
85
|
+
dex: dex,
|
|
86
|
+
slippage: slippage,
|
|
87
|
+
options: options,
|
|
88
|
+
};
|
|
89
|
+
const msgTx = await client.msgRequestSwapTransaction(params);
|
|
90
|
+
const result = await client.signAndBroadcast([msgTx]);
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
exports.submitKimaSwapTransaction = submitKimaSwapTransaction;
|
package/build/kima/common.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Registry, OfflineSigner, EncodeObject } from "@cosmjs/proto-signing";
|
|
2
|
-
import { MsgRequestTransaction } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { MsgSetTxHash } from "./tx/set-hash";
|
|
5
|
-
import { MsgHtlcReclaim } from "./tx/htlc-reclaim";
|
|
2
|
+
import { MsgRequestHtlcLock, MsgRequestTransaction, MsgSetTxHash, MsgHtlcReclaim } from "./transfer_tx";
|
|
3
|
+
import { MsgRequestSwapTransaction } from "./swap_tx";
|
|
6
4
|
export declare const registry: Registry;
|
|
7
5
|
export declare const TxClient: (wallet: OfflineSigner) => Promise<{
|
|
8
6
|
signAndBroadcast: (msgs: EncodeObject[]) => Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
@@ -10,4 +8,5 @@ export declare const TxClient: (wallet: OfflineSigner) => Promise<{
|
|
|
10
8
|
msgRequestHtlcLock: (data: MsgRequestHtlcLock) => EncodeObject;
|
|
11
9
|
msgSetTxHash: (data: MsgSetTxHash) => EncodeObject;
|
|
12
10
|
msgHtlcReclaim: (data: MsgHtlcReclaim) => EncodeObject;
|
|
11
|
+
msgRequestSwapTransaction: (data: MsgRequestSwapTransaction) => EncodeObject;
|
|
13
12
|
}>;
|
package/build/kima/common.js
CHANGED
|
@@ -7,20 +7,19 @@ exports.TxClient = exports.registry = void 0;
|
|
|
7
7
|
const stargate_1 = require("@cosmjs/stargate");
|
|
8
8
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
9
|
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const set_hash_1 = require("./tx/set-hash");
|
|
13
|
-
const htlc_reclaim_1 = require("./tx/htlc-reclaim");
|
|
10
|
+
const transfer_tx_1 = require("./transfer_tx");
|
|
11
|
+
const swap_tx_1 = require("./swap_tx");
|
|
14
12
|
dotenv_1.default.config();
|
|
15
13
|
const defaultFee = {
|
|
16
14
|
amount: [(0, proto_signing_1.coin)(200, "uKIMA")],
|
|
17
15
|
gas: "200000", // Gas limit
|
|
18
16
|
};
|
|
19
17
|
const types = [
|
|
20
|
-
["/kimablockchain.transaction.MsgRequestTransaction",
|
|
21
|
-
["/kimablockchain.transaction.MsgRequestHtlcLock",
|
|
22
|
-
["/kimablockchain.transaction.MsgSetTxHash",
|
|
23
|
-
["/kimablockchain.transaction.MsgHtlcReclaim",
|
|
18
|
+
["/kimablockchain.transaction.MsgRequestTransaction", transfer_tx_1.MsgRequestTransaction],
|
|
19
|
+
["/kimablockchain.transaction.MsgRequestHtlcLock", transfer_tx_1.MsgRequestHtlcLock],
|
|
20
|
+
["/kimablockchain.transaction.MsgSetTxHash", transfer_tx_1.MsgSetTxHash],
|
|
21
|
+
["/kimablockchain.transaction.MsgHtlcReclaim", transfer_tx_1.MsgHtlcReclaim],
|
|
22
|
+
["/kimablockchain.swap.MsgRequestSwapTransaction", swap_tx_1.MsgRequestSwapTransaction],
|
|
24
23
|
];
|
|
25
24
|
exports.registry = new proto_signing_1.Registry(types);
|
|
26
25
|
const TxClient = async (wallet) => {
|
|
@@ -33,19 +32,23 @@ const TxClient = async (wallet) => {
|
|
|
33
32
|
},
|
|
34
33
|
msgRequestTransaction: (data) => ({
|
|
35
34
|
typeUrl: "/kimablockchain.transaction.MsgRequestTransaction",
|
|
36
|
-
value:
|
|
35
|
+
value: transfer_tx_1.MsgRequestTransaction.fromPartial(data),
|
|
37
36
|
}),
|
|
38
37
|
msgRequestHtlcLock: (data) => ({
|
|
39
38
|
typeUrl: "/kimablockchain.transaction.MsgRequestHtlcLock",
|
|
40
|
-
value:
|
|
39
|
+
value: transfer_tx_1.MsgRequestHtlcLock.fromPartial(data),
|
|
41
40
|
}),
|
|
42
41
|
msgSetTxHash: (data) => ({
|
|
43
42
|
typeUrl: "/kimablockchain.transaction.MsgSetTxHash",
|
|
44
|
-
value:
|
|
43
|
+
value: transfer_tx_1.MsgSetTxHash.fromPartial(data),
|
|
45
44
|
}),
|
|
46
45
|
msgHtlcReclaim: (data) => ({
|
|
47
46
|
typeUrl: "/kimablockchain.transaction.MsgHtlcReclaim",
|
|
48
|
-
value:
|
|
47
|
+
value: transfer_tx_1.MsgHtlcReclaim.fromPartial(data),
|
|
48
|
+
}),
|
|
49
|
+
msgRequestSwapTransaction: (data) => ({
|
|
50
|
+
typeUrl: "/kimablockchain.swap.MsgRequestSwapTransaction",
|
|
51
|
+
value: swap_tx_1.MsgRequestSwapTransaction.fromPartial(data),
|
|
49
52
|
}),
|
|
50
53
|
};
|
|
51
54
|
};
|
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import _m0 from "protobufjs/minimal";
|
|
2
|
+
export declare const protobufPackage = "kimablockchain.swap";
|
|
3
|
+
export interface MsgRequestSwapTransaction {
|
|
4
|
+
creator: string;
|
|
5
|
+
/** the origin chain of the swap transaction */
|
|
6
|
+
originChain: string;
|
|
7
|
+
/** the origin address of the swap transaction */
|
|
8
|
+
originAddress: string;
|
|
9
|
+
/** the target chain of the swap transaction */
|
|
10
|
+
targetChain: string;
|
|
11
|
+
/** the target address of the swap transaction */
|
|
12
|
+
targetAddress: string;
|
|
13
|
+
/** the origin symbol of the swap transaction */
|
|
14
|
+
originSymbol: string;
|
|
15
|
+
/** the target symbol of the swap transaction */
|
|
16
|
+
targetSymbol: string;
|
|
17
|
+
/** the amount in of the swap transaction */
|
|
18
|
+
amountIn: string;
|
|
19
|
+
/** the amount out of the swap transaction */
|
|
20
|
+
amountOut: string;
|
|
21
|
+
/** the fee of the swap transaction */
|
|
22
|
+
fee: string;
|
|
23
|
+
/** the dex of the swap transaction */
|
|
24
|
+
dex: string;
|
|
25
|
+
/** the slippage of the swap transaction */
|
|
26
|
+
slippage: string;
|
|
27
|
+
/** the options of the swap transaction */
|
|
28
|
+
options: string;
|
|
29
|
+
}
|
|
30
|
+
export interface MsgRequestSwapTransactionResponse {
|
|
31
|
+
code: string;
|
|
32
|
+
msg: string;
|
|
33
|
+
txId: number;
|
|
34
|
+
}
|
|
35
|
+
export interface MsgSetTxToProcess {
|
|
36
|
+
creator: string;
|
|
37
|
+
txId: number;
|
|
38
|
+
timestamp: number;
|
|
39
|
+
msgId: string;
|
|
40
|
+
handleId: number;
|
|
41
|
+
/** swap transaction type */
|
|
42
|
+
txType: string;
|
|
43
|
+
/** the fee id for the transaction */
|
|
44
|
+
feeId: string;
|
|
45
|
+
/** the origin gas fee of the transaction */
|
|
46
|
+
originGasFee: string;
|
|
47
|
+
/** the target gas fee of the transaction */
|
|
48
|
+
targetGasFee: string;
|
|
49
|
+
/** the kima processing fee of the transaction */
|
|
50
|
+
kimaProcessingFee: string;
|
|
51
|
+
/** the total fee of the transaction */
|
|
52
|
+
totalFee: string;
|
|
53
|
+
/** the pegged to of the transaction */
|
|
54
|
+
peggedTo: string;
|
|
55
|
+
/** the expiration of the transaction */
|
|
56
|
+
expiration: number;
|
|
57
|
+
}
|
|
58
|
+
export interface MsgSetTxToProcessResponse {
|
|
59
|
+
code: string;
|
|
60
|
+
msg: string;
|
|
61
|
+
}
|
|
62
|
+
export interface MsgFinalizeSwapTransaction {
|
|
63
|
+
creator: string;
|
|
64
|
+
txId: number;
|
|
65
|
+
txHash: string;
|
|
66
|
+
success: boolean;
|
|
67
|
+
errReason: string;
|
|
68
|
+
tssMsgId: string;
|
|
69
|
+
/** request_swap, request_swap_refund */
|
|
70
|
+
txType: string;
|
|
71
|
+
/** pull, release, refund */
|
|
72
|
+
payType: string;
|
|
73
|
+
}
|
|
74
|
+
export interface MsgFinalizeSwapTransactionResponse {
|
|
75
|
+
code: string;
|
|
76
|
+
msg: string;
|
|
77
|
+
}
|
|
78
|
+
export interface MsgSwapObserveVote {
|
|
79
|
+
creator: string;
|
|
80
|
+
txHash: string;
|
|
81
|
+
chainId: string;
|
|
82
|
+
tokenSymbol: string;
|
|
83
|
+
from: string;
|
|
84
|
+
to: string;
|
|
85
|
+
amount: string;
|
|
86
|
+
payType: string;
|
|
87
|
+
kimaTxId: number;
|
|
88
|
+
tssMsgId: string;
|
|
89
|
+
txType: string;
|
|
90
|
+
succeed: boolean;
|
|
91
|
+
failReason: string;
|
|
92
|
+
reserved: string;
|
|
93
|
+
}
|
|
94
|
+
export interface MsgSwapObserveVoteResponse {
|
|
95
|
+
code: string;
|
|
96
|
+
msg: string;
|
|
97
|
+
}
|
|
98
|
+
export interface MsgCleanPendingSwapTransaction {
|
|
99
|
+
creator: string;
|
|
100
|
+
}
|
|
101
|
+
export interface MsgCleanPendingSwapTransactionResponse {
|
|
102
|
+
code: string;
|
|
103
|
+
msg: string;
|
|
104
|
+
}
|
|
105
|
+
export interface MsgUpdateSwapTransactionStatus {
|
|
106
|
+
creator: string;
|
|
107
|
+
txId: string;
|
|
108
|
+
status: string;
|
|
109
|
+
reason: string;
|
|
110
|
+
}
|
|
111
|
+
export interface MsgUpdateSwapTransactionStatusResponse {
|
|
112
|
+
code: string;
|
|
113
|
+
msg: string;
|
|
114
|
+
}
|
|
115
|
+
export declare const MsgRequestSwapTransaction: {
|
|
116
|
+
encode(message: MsgRequestSwapTransaction, writer?: _m0.Writer): _m0.Writer;
|
|
117
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestSwapTransaction;
|
|
118
|
+
fromJSON(object: any): MsgRequestSwapTransaction;
|
|
119
|
+
toJSON(message: MsgRequestSwapTransaction): unknown;
|
|
120
|
+
fromPartial<I extends {
|
|
121
|
+
creator?: string | undefined;
|
|
122
|
+
originChain?: string | undefined;
|
|
123
|
+
originAddress?: string | undefined;
|
|
124
|
+
targetChain?: string | undefined;
|
|
125
|
+
targetAddress?: string | undefined;
|
|
126
|
+
originSymbol?: string | undefined;
|
|
127
|
+
targetSymbol?: string | undefined;
|
|
128
|
+
amountIn?: string | undefined;
|
|
129
|
+
amountOut?: string | undefined;
|
|
130
|
+
fee?: string | undefined;
|
|
131
|
+
dex?: string | undefined;
|
|
132
|
+
slippage?: string | undefined;
|
|
133
|
+
options?: string | undefined;
|
|
134
|
+
} & {
|
|
135
|
+
creator?: string | undefined;
|
|
136
|
+
originChain?: string | undefined;
|
|
137
|
+
originAddress?: string | undefined;
|
|
138
|
+
targetChain?: string | undefined;
|
|
139
|
+
targetAddress?: string | undefined;
|
|
140
|
+
originSymbol?: string | undefined;
|
|
141
|
+
targetSymbol?: string | undefined;
|
|
142
|
+
amountIn?: string | undefined;
|
|
143
|
+
amountOut?: string | undefined;
|
|
144
|
+
fee?: string | undefined;
|
|
145
|
+
dex?: string | undefined;
|
|
146
|
+
slippage?: string | undefined;
|
|
147
|
+
options?: string | undefined;
|
|
148
|
+
} & { [K in Exclude<keyof I, keyof MsgRequestSwapTransaction>]: never; }>(object: I): MsgRequestSwapTransaction;
|
|
149
|
+
};
|
|
150
|
+
export declare const MsgRequestSwapTransactionResponse: {
|
|
151
|
+
encode(message: MsgRequestSwapTransactionResponse, writer?: _m0.Writer): _m0.Writer;
|
|
152
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgRequestSwapTransactionResponse;
|
|
153
|
+
fromJSON(object: any): MsgRequestSwapTransactionResponse;
|
|
154
|
+
toJSON(message: MsgRequestSwapTransactionResponse): unknown;
|
|
155
|
+
fromPartial<I extends {
|
|
156
|
+
code?: string | undefined;
|
|
157
|
+
msg?: string | undefined;
|
|
158
|
+
txId?: number | undefined;
|
|
159
|
+
} & {
|
|
160
|
+
code?: string | undefined;
|
|
161
|
+
msg?: string | undefined;
|
|
162
|
+
txId?: number | undefined;
|
|
163
|
+
} & { [K in Exclude<keyof I, keyof MsgRequestSwapTransactionResponse>]: never; }>(object: I): MsgRequestSwapTransactionResponse;
|
|
164
|
+
};
|
|
165
|
+
export declare const MsgSetTxToProcess: {
|
|
166
|
+
encode(message: MsgSetTxToProcess, writer?: _m0.Writer): _m0.Writer;
|
|
167
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetTxToProcess;
|
|
168
|
+
fromJSON(object: any): MsgSetTxToProcess;
|
|
169
|
+
toJSON(message: MsgSetTxToProcess): unknown;
|
|
170
|
+
fromPartial<I extends {
|
|
171
|
+
creator?: string | undefined;
|
|
172
|
+
txId?: number | undefined;
|
|
173
|
+
timestamp?: number | undefined;
|
|
174
|
+
msgId?: string | undefined;
|
|
175
|
+
handleId?: number | undefined;
|
|
176
|
+
txType?: string | undefined;
|
|
177
|
+
feeId?: string | undefined;
|
|
178
|
+
originGasFee?: string | undefined;
|
|
179
|
+
targetGasFee?: string | undefined;
|
|
180
|
+
kimaProcessingFee?: string | undefined;
|
|
181
|
+
totalFee?: string | undefined;
|
|
182
|
+
peggedTo?: string | undefined;
|
|
183
|
+
expiration?: number | undefined;
|
|
184
|
+
} & {
|
|
185
|
+
creator?: string | undefined;
|
|
186
|
+
txId?: number | undefined;
|
|
187
|
+
timestamp?: number | undefined;
|
|
188
|
+
msgId?: string | undefined;
|
|
189
|
+
handleId?: number | undefined;
|
|
190
|
+
txType?: string | undefined;
|
|
191
|
+
feeId?: string | undefined;
|
|
192
|
+
originGasFee?: string | undefined;
|
|
193
|
+
targetGasFee?: string | undefined;
|
|
194
|
+
kimaProcessingFee?: string | undefined;
|
|
195
|
+
totalFee?: string | undefined;
|
|
196
|
+
peggedTo?: string | undefined;
|
|
197
|
+
expiration?: number | undefined;
|
|
198
|
+
} & { [K in Exclude<keyof I, keyof MsgSetTxToProcess>]: never; }>(object: I): MsgSetTxToProcess;
|
|
199
|
+
};
|
|
200
|
+
export declare const MsgSetTxToProcessResponse: {
|
|
201
|
+
encode(message: MsgSetTxToProcessResponse, writer?: _m0.Writer): _m0.Writer;
|
|
202
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetTxToProcessResponse;
|
|
203
|
+
fromJSON(object: any): MsgSetTxToProcessResponse;
|
|
204
|
+
toJSON(message: MsgSetTxToProcessResponse): unknown;
|
|
205
|
+
fromPartial<I extends {
|
|
206
|
+
code?: string | undefined;
|
|
207
|
+
msg?: string | undefined;
|
|
208
|
+
} & {
|
|
209
|
+
code?: string | undefined;
|
|
210
|
+
msg?: string | undefined;
|
|
211
|
+
} & { [K in Exclude<keyof I, keyof MsgSetTxToProcessResponse>]: never; }>(object: I): MsgSetTxToProcessResponse;
|
|
212
|
+
};
|
|
213
|
+
export declare const MsgFinalizeSwapTransaction: {
|
|
214
|
+
encode(message: MsgFinalizeSwapTransaction, writer?: _m0.Writer): _m0.Writer;
|
|
215
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeSwapTransaction;
|
|
216
|
+
fromJSON(object: any): MsgFinalizeSwapTransaction;
|
|
217
|
+
toJSON(message: MsgFinalizeSwapTransaction): unknown;
|
|
218
|
+
fromPartial<I extends {
|
|
219
|
+
creator?: string | undefined;
|
|
220
|
+
txId?: number | undefined;
|
|
221
|
+
txHash?: string | undefined;
|
|
222
|
+
success?: boolean | undefined;
|
|
223
|
+
errReason?: string | undefined;
|
|
224
|
+
tssMsgId?: string | undefined;
|
|
225
|
+
txType?: string | undefined;
|
|
226
|
+
payType?: string | undefined;
|
|
227
|
+
} & {
|
|
228
|
+
creator?: string | undefined;
|
|
229
|
+
txId?: number | undefined;
|
|
230
|
+
txHash?: string | undefined;
|
|
231
|
+
success?: boolean | undefined;
|
|
232
|
+
errReason?: string | undefined;
|
|
233
|
+
tssMsgId?: string | undefined;
|
|
234
|
+
txType?: string | undefined;
|
|
235
|
+
payType?: string | undefined;
|
|
236
|
+
} & { [K in Exclude<keyof I, keyof MsgFinalizeSwapTransaction>]: never; }>(object: I): MsgFinalizeSwapTransaction;
|
|
237
|
+
};
|
|
238
|
+
export declare const MsgFinalizeSwapTransactionResponse: {
|
|
239
|
+
encode(message: MsgFinalizeSwapTransactionResponse, writer?: _m0.Writer): _m0.Writer;
|
|
240
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeSwapTransactionResponse;
|
|
241
|
+
fromJSON(object: any): MsgFinalizeSwapTransactionResponse;
|
|
242
|
+
toJSON(message: MsgFinalizeSwapTransactionResponse): unknown;
|
|
243
|
+
fromPartial<I extends {
|
|
244
|
+
code?: string | undefined;
|
|
245
|
+
msg?: string | undefined;
|
|
246
|
+
} & {
|
|
247
|
+
code?: string | undefined;
|
|
248
|
+
msg?: string | undefined;
|
|
249
|
+
} & { [K in Exclude<keyof I, keyof MsgFinalizeSwapTransactionResponse>]: never; }>(object: I): MsgFinalizeSwapTransactionResponse;
|
|
250
|
+
};
|
|
251
|
+
export declare const MsgSwapObserveVote: {
|
|
252
|
+
encode(message: MsgSwapObserveVote, writer?: _m0.Writer): _m0.Writer;
|
|
253
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSwapObserveVote;
|
|
254
|
+
fromJSON(object: any): MsgSwapObserveVote;
|
|
255
|
+
toJSON(message: MsgSwapObserveVote): unknown;
|
|
256
|
+
fromPartial<I extends {
|
|
257
|
+
creator?: string | undefined;
|
|
258
|
+
txHash?: string | undefined;
|
|
259
|
+
chainId?: string | undefined;
|
|
260
|
+
tokenSymbol?: string | undefined;
|
|
261
|
+
from?: string | undefined;
|
|
262
|
+
to?: string | undefined;
|
|
263
|
+
amount?: string | undefined;
|
|
264
|
+
payType?: string | undefined;
|
|
265
|
+
kimaTxId?: number | undefined;
|
|
266
|
+
tssMsgId?: string | undefined;
|
|
267
|
+
txType?: string | undefined;
|
|
268
|
+
succeed?: boolean | undefined;
|
|
269
|
+
failReason?: string | undefined;
|
|
270
|
+
reserved?: string | undefined;
|
|
271
|
+
} & {
|
|
272
|
+
creator?: string | undefined;
|
|
273
|
+
txHash?: string | undefined;
|
|
274
|
+
chainId?: string | undefined;
|
|
275
|
+
tokenSymbol?: string | undefined;
|
|
276
|
+
from?: string | undefined;
|
|
277
|
+
to?: string | undefined;
|
|
278
|
+
amount?: string | undefined;
|
|
279
|
+
payType?: string | undefined;
|
|
280
|
+
kimaTxId?: number | undefined;
|
|
281
|
+
tssMsgId?: string | undefined;
|
|
282
|
+
txType?: string | undefined;
|
|
283
|
+
succeed?: boolean | undefined;
|
|
284
|
+
failReason?: string | undefined;
|
|
285
|
+
reserved?: string | undefined;
|
|
286
|
+
} & { [K in Exclude<keyof I, keyof MsgSwapObserveVote>]: never; }>(object: I): MsgSwapObserveVote;
|
|
287
|
+
};
|
|
288
|
+
export declare const MsgSwapObserveVoteResponse: {
|
|
289
|
+
encode(message: MsgSwapObserveVoteResponse, writer?: _m0.Writer): _m0.Writer;
|
|
290
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSwapObserveVoteResponse;
|
|
291
|
+
fromJSON(object: any): MsgSwapObserveVoteResponse;
|
|
292
|
+
toJSON(message: MsgSwapObserveVoteResponse): unknown;
|
|
293
|
+
fromPartial<I extends {
|
|
294
|
+
code?: string | undefined;
|
|
295
|
+
msg?: string | undefined;
|
|
296
|
+
} & {
|
|
297
|
+
code?: string | undefined;
|
|
298
|
+
msg?: string | undefined;
|
|
299
|
+
} & { [K in Exclude<keyof I, keyof MsgSwapObserveVoteResponse>]: never; }>(object: I): MsgSwapObserveVoteResponse;
|
|
300
|
+
};
|
|
301
|
+
export declare const MsgCleanPendingSwapTransaction: {
|
|
302
|
+
encode(message: MsgCleanPendingSwapTransaction, writer?: _m0.Writer): _m0.Writer;
|
|
303
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCleanPendingSwapTransaction;
|
|
304
|
+
fromJSON(object: any): MsgCleanPendingSwapTransaction;
|
|
305
|
+
toJSON(message: MsgCleanPendingSwapTransaction): unknown;
|
|
306
|
+
fromPartial<I extends {
|
|
307
|
+
creator?: string | undefined;
|
|
308
|
+
} & {
|
|
309
|
+
creator?: string | undefined;
|
|
310
|
+
} & { [K in Exclude<keyof I, "creator">]: never; }>(object: I): MsgCleanPendingSwapTransaction;
|
|
311
|
+
};
|
|
312
|
+
export declare const MsgCleanPendingSwapTransactionResponse: {
|
|
313
|
+
encode(message: MsgCleanPendingSwapTransactionResponse, writer?: _m0.Writer): _m0.Writer;
|
|
314
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCleanPendingSwapTransactionResponse;
|
|
315
|
+
fromJSON(object: any): MsgCleanPendingSwapTransactionResponse;
|
|
316
|
+
toJSON(message: MsgCleanPendingSwapTransactionResponse): unknown;
|
|
317
|
+
fromPartial<I extends {
|
|
318
|
+
code?: string | undefined;
|
|
319
|
+
msg?: string | undefined;
|
|
320
|
+
} & {
|
|
321
|
+
code?: string | undefined;
|
|
322
|
+
msg?: string | undefined;
|
|
323
|
+
} & { [K in Exclude<keyof I, keyof MsgCleanPendingSwapTransactionResponse>]: never; }>(object: I): MsgCleanPendingSwapTransactionResponse;
|
|
324
|
+
};
|
|
325
|
+
export declare const MsgUpdateSwapTransactionStatus: {
|
|
326
|
+
encode(message: MsgUpdateSwapTransactionStatus, writer?: _m0.Writer): _m0.Writer;
|
|
327
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateSwapTransactionStatus;
|
|
328
|
+
fromJSON(object: any): MsgUpdateSwapTransactionStatus;
|
|
329
|
+
toJSON(message: MsgUpdateSwapTransactionStatus): unknown;
|
|
330
|
+
fromPartial<I extends {
|
|
331
|
+
creator?: string | undefined;
|
|
332
|
+
txId?: string | undefined;
|
|
333
|
+
status?: string | undefined;
|
|
334
|
+
reason?: string | undefined;
|
|
335
|
+
} & {
|
|
336
|
+
creator?: string | undefined;
|
|
337
|
+
txId?: string | undefined;
|
|
338
|
+
status?: string | undefined;
|
|
339
|
+
reason?: string | undefined;
|
|
340
|
+
} & { [K in Exclude<keyof I, keyof MsgUpdateSwapTransactionStatus>]: never; }>(object: I): MsgUpdateSwapTransactionStatus;
|
|
341
|
+
};
|
|
342
|
+
export declare const MsgUpdateSwapTransactionStatusResponse: {
|
|
343
|
+
encode(message: MsgUpdateSwapTransactionStatusResponse, writer?: _m0.Writer): _m0.Writer;
|
|
344
|
+
decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateSwapTransactionStatusResponse;
|
|
345
|
+
fromJSON(object: any): MsgUpdateSwapTransactionStatusResponse;
|
|
346
|
+
toJSON(message: MsgUpdateSwapTransactionStatusResponse): unknown;
|
|
347
|
+
fromPartial<I extends {
|
|
348
|
+
code?: string | undefined;
|
|
349
|
+
msg?: string | undefined;
|
|
350
|
+
} & {
|
|
351
|
+
code?: string | undefined;
|
|
352
|
+
msg?: string | undefined;
|
|
353
|
+
} & { [K in Exclude<keyof I, keyof MsgUpdateSwapTransactionStatusResponse>]: never; }>(object: I): MsgUpdateSwapTransactionStatusResponse;
|
|
354
|
+
};
|
|
355
|
+
/** Msg defines the Msg service. */
|
|
356
|
+
export interface Msg {
|
|
357
|
+
RequestSwapTransaction(request: MsgRequestSwapTransaction): Promise<MsgRequestSwapTransactionResponse>;
|
|
358
|
+
SetTxToProcess(request: MsgSetTxToProcess): Promise<MsgSetTxToProcessResponse>;
|
|
359
|
+
FinalizeSwapTransaction(request: MsgFinalizeSwapTransaction): Promise<MsgFinalizeSwapTransactionResponse>;
|
|
360
|
+
SwapObserveVote(request: MsgSwapObserveVote): Promise<MsgSwapObserveVoteResponse>;
|
|
361
|
+
CleanPendingSwapTransaction(request: MsgCleanPendingSwapTransaction): Promise<MsgCleanPendingSwapTransactionResponse>;
|
|
362
|
+
UpdateSwapTransactionStatus(request: MsgUpdateSwapTransactionStatus): Promise<MsgUpdateSwapTransactionStatusResponse>;
|
|
363
|
+
}
|
|
364
|
+
export declare class MsgClientImpl implements Msg {
|
|
365
|
+
private readonly rpc;
|
|
366
|
+
constructor(rpc: Rpc);
|
|
367
|
+
RequestSwapTransaction(request: MsgRequestSwapTransaction): Promise<MsgRequestSwapTransactionResponse>;
|
|
368
|
+
SetTxToProcess(request: MsgSetTxToProcess): Promise<MsgSetTxToProcessResponse>;
|
|
369
|
+
FinalizeSwapTransaction(request: MsgFinalizeSwapTransaction): Promise<MsgFinalizeSwapTransactionResponse>;
|
|
370
|
+
SwapObserveVote(request: MsgSwapObserveVote): Promise<MsgSwapObserveVoteResponse>;
|
|
371
|
+
CleanPendingSwapTransaction(request: MsgCleanPendingSwapTransaction): Promise<MsgCleanPendingSwapTransactionResponse>;
|
|
372
|
+
UpdateSwapTransactionStatus(request: MsgUpdateSwapTransactionStatus): Promise<MsgUpdateSwapTransactionStatusResponse>;
|
|
373
|
+
}
|
|
374
|
+
interface Rpc {
|
|
375
|
+
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
|
376
|
+
}
|
|
377
|
+
type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
|
|
378
|
+
export type DeepPartial<T> = T extends Builtin ? T : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
|
|
379
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
380
|
+
} : Partial<T>;
|
|
381
|
+
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
|
382
|
+
export type Exact<P, I extends P> = P extends Builtin ? P : P & {
|
|
383
|
+
[K in keyof P]: Exact<P[K], I[K]>;
|
|
384
|
+
} & {
|
|
385
|
+
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
|
386
|
+
};
|
|
387
|
+
export {};
|