@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/src/types.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
|
|
2
|
+
export enum SupportedNetworks {
|
|
3
|
+
ETHEREUM = "ETH",
|
|
4
|
+
POLYGON = "POL",
|
|
5
|
+
AVALANCHE = "AVX",
|
|
6
|
+
SOLANA = "SOL",
|
|
7
|
+
BSC = "BSC",
|
|
8
|
+
ARBITRIUM = "ARB",
|
|
9
|
+
OPTIMISM = "OPT",
|
|
10
|
+
POLYGON_ZKEVM = "ZKE",
|
|
11
|
+
BITCOIN = "BTC",
|
|
12
|
+
BERA = "BERA",
|
|
13
|
+
CFX = "CFX",
|
|
14
|
+
TRON = "TRX",
|
|
15
|
+
FIAT = "FIAT",
|
|
16
|
+
CREDITCARD = "CC",
|
|
17
|
+
BASE = "BASE",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export enum CurrencyOptions {
|
|
21
|
+
USDT = "USDT",
|
|
22
|
+
USDC = "USDC",
|
|
23
|
+
USDK = "USDK",
|
|
24
|
+
EURC = "EURC",
|
|
25
|
+
EURK = "EURK",
|
|
26
|
+
EUR = "EUR",
|
|
27
|
+
USD = "USD",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface RequestHtlcReclaimProps {
|
|
31
|
+
senderAddress: string;
|
|
32
|
+
txHash: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface RequestHtlcLockProps {
|
|
36
|
+
fromAddress: string;
|
|
37
|
+
senderPubkey: string;
|
|
38
|
+
amount: string;
|
|
39
|
+
htlcTimeout: string;
|
|
40
|
+
txHash: string;
|
|
41
|
+
htlcAddress: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface RequestTransferTxProps {
|
|
45
|
+
originChain: SupportedNetworks;
|
|
46
|
+
originAddress: string;
|
|
47
|
+
targetChain: SupportedNetworks;
|
|
48
|
+
targetAddress: string;
|
|
49
|
+
originSymbol: CurrencyOptions;
|
|
50
|
+
targetSymbol: CurrencyOptions;
|
|
51
|
+
amount: string; // number in whole units i.e. "12.34"
|
|
52
|
+
fee: string; // number in whole units i.e "0.061234"
|
|
53
|
+
htlcCreationHash?: string;
|
|
54
|
+
htlcCreationVout?: number;
|
|
55
|
+
htlcExpirationTimestamp?: string;
|
|
56
|
+
htlcVersion?: string;
|
|
57
|
+
senderPubKey?: Uint8Array;
|
|
58
|
+
options: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface RequestSwapTxProps {
|
|
62
|
+
originChain: SupportedNetworks;
|
|
63
|
+
originAddress: string;
|
|
64
|
+
targetChain: SupportedNetworks;
|
|
65
|
+
targetAddress: string;
|
|
66
|
+
originSymbol: CurrencyOptions;
|
|
67
|
+
targetSymbol: CurrencyOptions;
|
|
68
|
+
amountIn: string;
|
|
69
|
+
amountOut: string;
|
|
70
|
+
fee: string;
|
|
71
|
+
dex: string;
|
|
72
|
+
slippage: string;
|
|
73
|
+
options: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function sleep(ms: number) {
|
|
77
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
78
|
+
}
|
package/build/api/htlc-lock.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface RequestHtlcLockProps {
|
|
2
|
-
fromAddress: string;
|
|
3
|
-
senderPubkey: string;
|
|
4
|
-
amount: string;
|
|
5
|
-
htlcTimeout: string;
|
|
6
|
-
txHash: string;
|
|
7
|
-
htlcAddress: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Create an HTCL transaction
|
|
11
|
-
*
|
|
12
|
-
* @export
|
|
13
|
-
* @async
|
|
14
|
-
* @param {RequestHtlcLockProps} param0
|
|
15
|
-
* @param {string} param0.fromAddress - The creator wallet address
|
|
16
|
-
* @param {string} param0.senderPubkey - The creator wallet public key
|
|
17
|
-
* @param {string} param0.amount - The total amount to be locked including fees
|
|
18
|
-
* @param {string} param0.htlcTimeout - The time in seconds the HTLC will be valid for
|
|
19
|
-
* @param {string} param0.txHash - The transaction hash of the HTLC lock
|
|
20
|
-
* @param {string} param0.htlcAddress - The HTLC address
|
|
21
|
-
* @returns {Promise<DeliverTxResponse>}
|
|
22
|
-
*/
|
|
23
|
-
export declare function submitHtlcLock({ fromAddress, senderPubkey, amount, htlcTimeout, txHash, htlcAddress, }: RequestHtlcLockProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
package/build/api/htlc-lock.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submitHtlcLock = void 0;
|
|
4
|
-
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
5
|
-
const common_1 = require("../kima/common");
|
|
6
|
-
/**
|
|
7
|
-
* Create an HTCL transaction
|
|
8
|
-
*
|
|
9
|
-
* @export
|
|
10
|
-
* @async
|
|
11
|
-
* @param {RequestHtlcLockProps} param0
|
|
12
|
-
* @param {string} param0.fromAddress - The creator wallet address
|
|
13
|
-
* @param {string} param0.senderPubkey - The creator wallet public key
|
|
14
|
-
* @param {string} param0.amount - The total amount to be locked including fees
|
|
15
|
-
* @param {string} param0.htlcTimeout - The time in seconds the HTLC will be valid for
|
|
16
|
-
* @param {string} param0.txHash - The transaction hash of the HTLC lock
|
|
17
|
-
* @param {string} param0.htlcAddress - The HTLC address
|
|
18
|
-
* @returns {Promise<DeliverTxResponse>}
|
|
19
|
-
*/
|
|
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;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export interface RequestHtlcReclaimProps {
|
|
2
|
-
senderAddress: string;
|
|
3
|
-
txHash: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Cancel an HTCL lock by user taking back the funds
|
|
7
|
-
* @export
|
|
8
|
-
* @async
|
|
9
|
-
* @param {RequestHtlcReclaimProps} param0
|
|
10
|
-
* @param {string} param0.senderAddress - The creator wallet address
|
|
11
|
-
* @param {string} param0.txHash - The transaction hash of the HTLC lock
|
|
12
|
-
* @returns {Promise<DeliverTxResponse>}
|
|
13
|
-
*/
|
|
14
|
-
export declare function HtlcReclaim({ senderAddress, txHash, }: RequestHtlcReclaimProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HtlcReclaim = void 0;
|
|
4
|
-
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
5
|
-
const common_1 = require("../kima/common");
|
|
6
|
-
/**
|
|
7
|
-
* Cancel an HTCL lock by user taking back the funds
|
|
8
|
-
* @export
|
|
9
|
-
* @async
|
|
10
|
-
* @param {RequestHtlcReclaimProps} param0
|
|
11
|
-
* @param {string} param0.senderAddress - The creator wallet address
|
|
12
|
-
* @param {string} param0.txHash - The transaction hash of the HTLC lock
|
|
13
|
-
* @returns {Promise<DeliverTxResponse>}
|
|
14
|
-
*/
|
|
15
|
-
async function HtlcReclaim({ senderAddress, txHash, }) {
|
|
16
|
-
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
17
|
-
const client = await (0, common_1.TxClient)(wallet);
|
|
18
|
-
const [firstAccount] = await wallet.getAccounts();
|
|
19
|
-
const params = {
|
|
20
|
-
creator: firstAccount.address,
|
|
21
|
-
senderAddress,
|
|
22
|
-
txHash,
|
|
23
|
-
};
|
|
24
|
-
let msg = await client.msgHtlcReclaim(params);
|
|
25
|
-
const result = await client.signAndBroadcast([msg]);
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
exports.HtlcReclaim = HtlcReclaim;
|
package/build/api/submit.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export declare enum SupportedNetworks {
|
|
2
|
-
ARBITRIUM = "ARB",
|
|
3
|
-
AVALANCHE = "AVX",
|
|
4
|
-
BSC = "BSC",
|
|
5
|
-
BTC = "BTC",
|
|
6
|
-
ETHEREUM = "ETH",
|
|
7
|
-
OPTIMISM = "OPT",
|
|
8
|
-
POLYGON = "POL",
|
|
9
|
-
SOLANA = "SOL",
|
|
10
|
-
TRON = "TRX"
|
|
11
|
-
}
|
|
12
|
-
export declare enum CurrencyOptions {
|
|
13
|
-
USDT = "USDT",
|
|
14
|
-
USDC = "USDC",
|
|
15
|
-
USDK = "USDK"
|
|
16
|
-
}
|
|
17
|
-
export interface RequestTxProps {
|
|
18
|
-
originChain: SupportedNetworks;
|
|
19
|
-
originAddress: string;
|
|
20
|
-
targetChain: SupportedNetworks;
|
|
21
|
-
targetAddress: string;
|
|
22
|
-
originSymbol: CurrencyOptions;
|
|
23
|
-
targetSymbol: CurrencyOptions;
|
|
24
|
-
amount: number;
|
|
25
|
-
fee: number;
|
|
26
|
-
htlcCreationHash: string;
|
|
27
|
-
htlcCreationVout: number;
|
|
28
|
-
htlcExpirationTimestamp: string;
|
|
29
|
-
htlcVersion: string;
|
|
30
|
-
senderPubKey: Uint8Array;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Create a Kima transfer transaction. The HTLC parameters are only required on Bitcoin, use blank strings (or zeros) for other chains.
|
|
34
|
-
* The approval or HTLC transaction must be completed before submitting the Kima transaction or it will fail.
|
|
35
|
-
*
|
|
36
|
-
* @export
|
|
37
|
-
* @async
|
|
38
|
-
* @param {RequestTxProps} param0
|
|
39
|
-
* @param {SupportedNetworks} param0.originChain - The chain the funds are being transferred from
|
|
40
|
-
* @param {string} param0.originAddress - The user wallet address
|
|
41
|
-
* @param {SupportedNetworks} param0.targetChain - The chain the funds are being transferred to
|
|
42
|
-
* @param {string} param0.targetAddress - The destination wallet address
|
|
43
|
-
* @param {CurrencyOptions} param0.originSymbol - The starting token symbol
|
|
44
|
-
* @param {CurrencyOptions} param0.targetSymbol - The destination token symbol
|
|
45
|
-
* @param {number} param0.amount - amount of tokens to be transferred
|
|
46
|
-
* @param {number} param0.fee - The total fees to be paid
|
|
47
|
-
* @param {string} param0.htlcCreationHash - (if applicable) The transaction hash of the HTLC lock
|
|
48
|
-
* @param {number} param0.htlcCreationVout - (if applicable) The vout of the HTLC lock
|
|
49
|
-
* @param {string} param0.htlcExpirationTimestamp - (if applicable) The expiration timestamp of the HTLC lock
|
|
50
|
-
* @param {string} param0.htlcVersion - (if applicable) The version of the HTLC lock
|
|
51
|
-
* @param {Uint8Array} param0.senderPubKey - (if HTLC) The creator wallet public key
|
|
52
|
-
* @returns {Promise<DeliverTxResponse>}
|
|
53
|
-
*/
|
|
54
|
-
export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }: RequestTxProps): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
|
package/build/api/submit.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.submitKimaTransaction = exports.CurrencyOptions = exports.SupportedNetworks = void 0;
|
|
4
|
-
const proto_signing_1 = require("@cosmjs/proto-signing");
|
|
5
|
-
const common_1 = require("../kima/common");
|
|
6
|
-
const utils_1 = require("../utils");
|
|
7
|
-
var SupportedNetworks;
|
|
8
|
-
(function (SupportedNetworks) {
|
|
9
|
-
SupportedNetworks["ARBITRIUM"] = "ARB";
|
|
10
|
-
SupportedNetworks["AVALANCHE"] = "AVX";
|
|
11
|
-
SupportedNetworks["BSC"] = "BSC";
|
|
12
|
-
SupportedNetworks["BTC"] = "BTC";
|
|
13
|
-
SupportedNetworks["ETHEREUM"] = "ETH";
|
|
14
|
-
SupportedNetworks["OPTIMISM"] = "OPT";
|
|
15
|
-
SupportedNetworks["POLYGON"] = "POL";
|
|
16
|
-
SupportedNetworks["SOLANA"] = "SOL";
|
|
17
|
-
SupportedNetworks["TRON"] = "TRX";
|
|
18
|
-
})(SupportedNetworks = exports.SupportedNetworks || (exports.SupportedNetworks = {}));
|
|
19
|
-
var CurrencyOptions;
|
|
20
|
-
(function (CurrencyOptions) {
|
|
21
|
-
CurrencyOptions["USDT"] = "USDT";
|
|
22
|
-
CurrencyOptions["USDC"] = "USDC";
|
|
23
|
-
CurrencyOptions["USDK"] = "USDK";
|
|
24
|
-
})(CurrencyOptions = exports.CurrencyOptions || (exports.CurrencyOptions = {}));
|
|
25
|
-
/**
|
|
26
|
-
* Create a Kima transfer transaction. The HTLC parameters are only required on Bitcoin, use blank strings (or zeros) for other chains.
|
|
27
|
-
* The approval or HTLC transaction must be completed before submitting the Kima transaction or it will fail.
|
|
28
|
-
*
|
|
29
|
-
* @export
|
|
30
|
-
* @async
|
|
31
|
-
* @param {RequestTxProps} param0
|
|
32
|
-
* @param {SupportedNetworks} param0.originChain - The chain the funds are being transferred from
|
|
33
|
-
* @param {string} param0.originAddress - The user wallet address
|
|
34
|
-
* @param {SupportedNetworks} param0.targetChain - The chain the funds are being transferred to
|
|
35
|
-
* @param {string} param0.targetAddress - The destination wallet address
|
|
36
|
-
* @param {CurrencyOptions} param0.originSymbol - The starting token symbol
|
|
37
|
-
* @param {CurrencyOptions} param0.targetSymbol - The destination token symbol
|
|
38
|
-
* @param {number} param0.amount - amount of tokens to be transferred
|
|
39
|
-
* @param {number} param0.fee - The total fees to be paid
|
|
40
|
-
* @param {string} param0.htlcCreationHash - (if applicable) The transaction hash of the HTLC lock
|
|
41
|
-
* @param {number} param0.htlcCreationVout - (if applicable) The vout of the HTLC lock
|
|
42
|
-
* @param {string} param0.htlcExpirationTimestamp - (if applicable) The expiration timestamp of the HTLC lock
|
|
43
|
-
* @param {string} param0.htlcVersion - (if applicable) The version of the HTLC lock
|
|
44
|
-
* @param {Uint8Array} param0.senderPubKey - (if HTLC) The creator wallet public key
|
|
45
|
-
* @returns {Promise<DeliverTxResponse>}
|
|
46
|
-
*/
|
|
47
|
-
async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, originSymbol, targetSymbol, amount, fee, htlcCreationHash, htlcCreationVout, htlcExpirationTimestamp, htlcVersion, senderPubKey, }) {
|
|
48
|
-
const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
|
|
49
|
-
const client = await (0, common_1.TxClient)(wallet);
|
|
50
|
-
const [firstAccount] = await wallet.getAccounts();
|
|
51
|
-
const params = {
|
|
52
|
-
creator: firstAccount.address,
|
|
53
|
-
originChain,
|
|
54
|
-
originAddress,
|
|
55
|
-
targetChain,
|
|
56
|
-
targetAddress,
|
|
57
|
-
originSymbol,
|
|
58
|
-
targetSymbol,
|
|
59
|
-
amount: amount.toString(),
|
|
60
|
-
fee: fee.toString(),
|
|
61
|
-
htlcCreationHash,
|
|
62
|
-
htlcCreationVout,
|
|
63
|
-
htlcExpirationTimestamp,
|
|
64
|
-
htlcVersion,
|
|
65
|
-
senderPubKey,
|
|
66
|
-
options: "",
|
|
67
|
-
};
|
|
68
|
-
let msg = await client.msgRequestTransaction(params);
|
|
69
|
-
const result = await client.signAndBroadcast([msg]);
|
|
70
|
-
let txId = 1;
|
|
71
|
-
for (const event of result.events) {
|
|
72
|
-
if (event.type === "transaction_requested") {
|
|
73
|
-
for (const attr of event.attributes) {
|
|
74
|
-
if (attr.key === "txId") {
|
|
75
|
-
txId = +attr.value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
msg = await client.msgSetTxHash({
|
|
81
|
-
creator: firstAccount.address,
|
|
82
|
-
txId,
|
|
83
|
-
txHash: result.transactionHash,
|
|
84
|
-
txType: "request_transaction",
|
|
85
|
-
});
|
|
86
|
-
console.log(msg);
|
|
87
|
-
let hashResult;
|
|
88
|
-
do {
|
|
89
|
-
hashResult = await client.signAndBroadcast([msg]);
|
|
90
|
-
await (0, utils_1.sleep)(1000);
|
|
91
|
-
} while (hashResult.code !== 0);
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
exports.submitKimaTransaction = submitKimaTransaction;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var globalThis = (() => {
|
|
4
|
-
if (typeof globalThis !== "undefined") {
|
|
5
|
-
return globalThis;
|
|
6
|
-
}
|
|
7
|
-
if (typeof self !== "undefined") {
|
|
8
|
-
return self;
|
|
9
|
-
}
|
|
10
|
-
if (typeof window !== "undefined") {
|
|
11
|
-
return window;
|
|
12
|
-
}
|
|
13
|
-
if (typeof global !== "undefined") {
|
|
14
|
-
return global;
|
|
15
|
-
}
|
|
16
|
-
throw "Unable to locate global object";
|
|
17
|
-
})();
|
|
18
|
-
exports.default = globalThis;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const minimal_1 = __importDefault(require("protobufjs/minimal"));
|
|
7
|
-
const long_1 = __importDefault(require("long"));
|
|
8
|
-
if (minimal_1.default.util.Long !== long_1.default) {
|
|
9
|
-
minimal_1.default.util.Long = long_1.default;
|
|
10
|
-
minimal_1.default.configure();
|
|
11
|
-
}
|
|
12
|
-
exports.default = minimal_1.default;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import _m0 from "../../config/probuff.config";
|
|
2
|
-
export interface MsgCancelTransaction {
|
|
3
|
-
creator: string;
|
|
4
|
-
transactionId: string;
|
|
5
|
-
}
|
|
6
|
-
export interface MsgCancelTransactionResponse {
|
|
7
|
-
code: string;
|
|
8
|
-
msg: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const MsgCancelTransaction: {
|
|
11
|
-
encode(message: MsgCancelTransaction, writer?: _m0.Writer): _m0.Writer;
|
|
12
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelTransaction;
|
|
13
|
-
fromJSON(object: any): MsgCancelTransaction;
|
|
14
|
-
toJSON(message: MsgCancelTransaction): unknown;
|
|
15
|
-
fromPartial<I extends {
|
|
16
|
-
creator?: string | undefined;
|
|
17
|
-
transactionId?: string | undefined;
|
|
18
|
-
} & {
|
|
19
|
-
creator?: string | undefined;
|
|
20
|
-
transactionId?: string | undefined;
|
|
21
|
-
} & { [K in Exclude<keyof I, keyof MsgCancelTransaction>]: never; }>(object: I): MsgCancelTransaction;
|
|
22
|
-
};
|
|
23
|
-
export declare const MsgCancelTransactionResponse: {
|
|
24
|
-
encode(message: MsgCancelTransactionResponse, writer?: _m0.Writer): _m0.Writer;
|
|
25
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): MsgCancelTransactionResponse;
|
|
26
|
-
fromJSON(object: any): MsgCancelTransactionResponse;
|
|
27
|
-
toJSON(message: MsgCancelTransactionResponse): unknown;
|
|
28
|
-
fromPartial<I extends {
|
|
29
|
-
code?: string | undefined;
|
|
30
|
-
msg?: string | undefined;
|
|
31
|
-
} & {
|
|
32
|
-
code?: string | undefined;
|
|
33
|
-
msg?: string | undefined;
|
|
34
|
-
} & { [K in Exclude<keyof I, keyof MsgCancelTransactionResponse>]: never; }>(object: I): MsgCancelTransactionResponse;
|
|
35
|
-
};
|
package/build/kima/tx/cancel.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MsgCancelTransactionResponse = exports.MsgCancelTransaction = void 0;
|
|
7
|
-
const probuff_config_1 = __importDefault(require("../../config/probuff.config"));
|
|
8
|
-
const utils_1 = require("../../utils");
|
|
9
|
-
function createBaseMsgCancelTransaction() {
|
|
10
|
-
return { creator: "", transactionId: "" };
|
|
11
|
-
}
|
|
12
|
-
exports.MsgCancelTransaction = {
|
|
13
|
-
encode(message, writer = probuff_config_1.default.Writer.create()) {
|
|
14
|
-
if (message.creator !== "") {
|
|
15
|
-
writer.uint32(10).string(message.creator);
|
|
16
|
-
}
|
|
17
|
-
if (message.transactionId !== "") {
|
|
18
|
-
writer.uint32(18).string(message.transactionId);
|
|
19
|
-
}
|
|
20
|
-
return writer;
|
|
21
|
-
},
|
|
22
|
-
decode(input, length) {
|
|
23
|
-
const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
|
|
24
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
25
|
-
const message = createBaseMsgCancelTransaction();
|
|
26
|
-
while (reader.pos < end) {
|
|
27
|
-
const tag = reader.uint32();
|
|
28
|
-
switch (tag >>> 3) {
|
|
29
|
-
case 1:
|
|
30
|
-
message.creator = reader.string();
|
|
31
|
-
break;
|
|
32
|
-
case 2:
|
|
33
|
-
message.transactionId = reader.string();
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
reader.skipType(tag & 7);
|
|
37
|
-
break;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return message;
|
|
41
|
-
},
|
|
42
|
-
fromJSON(object) {
|
|
43
|
-
return {
|
|
44
|
-
creator: (0, utils_1.isSet)(object.creator) ? String(object.creator) : "",
|
|
45
|
-
transactionId: (0, utils_1.isSet)(object.transactionId)
|
|
46
|
-
? String(object.transactionId)
|
|
47
|
-
: "",
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
toJSON(message) {
|
|
51
|
-
const obj = {};
|
|
52
|
-
message.creator !== undefined && (obj.creator = message.creator);
|
|
53
|
-
message.transactionId !== undefined &&
|
|
54
|
-
(obj.transactionId = message.transactionId);
|
|
55
|
-
return obj;
|
|
56
|
-
},
|
|
57
|
-
fromPartial(object) {
|
|
58
|
-
const message = createBaseMsgCancelTransaction();
|
|
59
|
-
message.creator = object.creator ?? "";
|
|
60
|
-
message.transactionId = object.transactionId ?? "";
|
|
61
|
-
return message;
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
function createBaseMsgCancelTransactionResponse() {
|
|
65
|
-
return { code: "", msg: "" };
|
|
66
|
-
}
|
|
67
|
-
exports.MsgCancelTransactionResponse = {
|
|
68
|
-
encode(message, writer = probuff_config_1.default.Writer.create()) {
|
|
69
|
-
if (message.code !== "") {
|
|
70
|
-
writer.uint32(10).string(message.code);
|
|
71
|
-
}
|
|
72
|
-
if (message.msg !== "") {
|
|
73
|
-
writer.uint32(18).string(message.msg);
|
|
74
|
-
}
|
|
75
|
-
return writer;
|
|
76
|
-
},
|
|
77
|
-
decode(input, length) {
|
|
78
|
-
const reader = input instanceof probuff_config_1.default.Reader ? input : new probuff_config_1.default.Reader(input);
|
|
79
|
-
let end = length === undefined ? reader.len : reader.pos + length;
|
|
80
|
-
const message = createBaseMsgCancelTransactionResponse();
|
|
81
|
-
while (reader.pos < end) {
|
|
82
|
-
const tag = reader.uint32();
|
|
83
|
-
switch (tag >>> 3) {
|
|
84
|
-
case 1:
|
|
85
|
-
message.code = reader.string();
|
|
86
|
-
break;
|
|
87
|
-
case 2:
|
|
88
|
-
message.msg = reader.string();
|
|
89
|
-
break;
|
|
90
|
-
default:
|
|
91
|
-
reader.skipType(tag & 7);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return message;
|
|
96
|
-
},
|
|
97
|
-
fromJSON(object) {
|
|
98
|
-
return {
|
|
99
|
-
code: (0, utils_1.isSet)(object.code) ? String(object.code) : "",
|
|
100
|
-
msg: (0, utils_1.isSet)(object.msg) ? String(object.msg) : "",
|
|
101
|
-
};
|
|
102
|
-
},
|
|
103
|
-
toJSON(message) {
|
|
104
|
-
const obj = {};
|
|
105
|
-
message.code !== undefined && (obj.code = message.code);
|
|
106
|
-
message.msg !== undefined && (obj.msg = message.msg);
|
|
107
|
-
return obj;
|
|
108
|
-
},
|
|
109
|
-
fromPartial(object) {
|
|
110
|
-
const message = createBaseMsgCancelTransactionResponse();
|
|
111
|
-
message.code = object.code ?? "";
|
|
112
|
-
message.msg = object.msg ?? "";
|
|
113
|
-
return message;
|
|
114
|
-
},
|
|
115
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import _m0 from "../../config/probuff.config";
|
|
2
|
-
export interface MsgFinalizeDrainTransaction {
|
|
3
|
-
creator: string;
|
|
4
|
-
txId: number;
|
|
5
|
-
txHash: string;
|
|
6
|
-
success: boolean;
|
|
7
|
-
signedKey: string;
|
|
8
|
-
errReason: string;
|
|
9
|
-
}
|
|
10
|
-
export interface MsgFinalizeDrainTransactionResponse {
|
|
11
|
-
code: string;
|
|
12
|
-
msg: string;
|
|
13
|
-
}
|
|
14
|
-
export declare const MsgFinalizeDrainTransaction: {
|
|
15
|
-
encode(message: MsgFinalizeDrainTransaction, writer?: _m0.Writer): _m0.Writer;
|
|
16
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeDrainTransaction;
|
|
17
|
-
fromJSON(object: any): MsgFinalizeDrainTransaction;
|
|
18
|
-
toJSON(message: MsgFinalizeDrainTransaction): unknown;
|
|
19
|
-
fromPartial<I extends {
|
|
20
|
-
creator?: string | undefined;
|
|
21
|
-
txId?: number | undefined;
|
|
22
|
-
txHash?: string | undefined;
|
|
23
|
-
success?: boolean | undefined;
|
|
24
|
-
signedKey?: string | undefined;
|
|
25
|
-
errReason?: string | undefined;
|
|
26
|
-
} & {
|
|
27
|
-
creator?: string | undefined;
|
|
28
|
-
txId?: number | undefined;
|
|
29
|
-
txHash?: string | undefined;
|
|
30
|
-
success?: boolean | undefined;
|
|
31
|
-
signedKey?: string | undefined;
|
|
32
|
-
errReason?: string | undefined;
|
|
33
|
-
} & { [K in Exclude<keyof I, keyof MsgFinalizeDrainTransaction>]: never; }>(object: I): MsgFinalizeDrainTransaction;
|
|
34
|
-
};
|
|
35
|
-
export declare const MsgFinalizeDrainTransactionResponse: {
|
|
36
|
-
encode(message: MsgFinalizeDrainTransactionResponse, writer?: _m0.Writer): _m0.Writer;
|
|
37
|
-
decode(input: _m0.Reader | Uint8Array, length?: number): MsgFinalizeDrainTransactionResponse;
|
|
38
|
-
fromJSON(object: any): MsgFinalizeDrainTransactionResponse;
|
|
39
|
-
toJSON(message: MsgFinalizeDrainTransactionResponse): unknown;
|
|
40
|
-
fromPartial<I extends {
|
|
41
|
-
code?: string | undefined;
|
|
42
|
-
msg?: string | undefined;
|
|
43
|
-
} & {
|
|
44
|
-
code?: string | undefined;
|
|
45
|
-
msg?: string | undefined;
|
|
46
|
-
} & { [K in Exclude<keyof I, keyof MsgFinalizeDrainTransactionResponse>]: never; }>(object: I): MsgFinalizeDrainTransactionResponse;
|
|
47
|
-
};
|