@kimafinance/kima-transaction-api 1.0.23-beta.1 → 1.0.25-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.
@@ -1,32 +1,32 @@
1
- name: CI
2
- on:
3
- push:
4
- branches:
5
- - main
6
- jobs:
7
- build:
8
- runs-on: ubuntu-latest
9
- permissions:
10
- contents: read
11
- id-token: write
12
-
13
- steps:
14
- - uses: actions/checkout@v2
15
- - uses: actions/setup-node@v1
16
- with:
17
- node-version: 18
18
- registry-url: https://registry.npmjs.org/
19
-
20
- - name: test
21
- run: |
22
- echo ${{ secrets.NPM_TOKEN }}
23
-
24
- - name: Build the npm module and publish to npmjs.org
25
- run: |
26
-
27
- npm install
28
- npm start
29
- npm publish --provenance
30
-
31
- env:
32
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
1
+ name: CI
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ contents: read
11
+ id-token: write
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - uses: actions/setup-node@v1
16
+ with:
17
+ node-version: 18
18
+ registry-url: https://registry.npmjs.org/
19
+
20
+ - name: test
21
+ run: |
22
+ echo ${{ secrets.NPM_TOKEN }}
23
+
24
+ - name: Build the npm module and publish to npmjs.org
25
+ run: |
26
+
27
+ npm install
28
+ npm start
29
+ npm publish --provenance
30
+
31
+ env:
32
+ NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
package/LICENSE.md CHANGED
@@ -1,73 +1,73 @@
1
- Business Source License 1.1
2
-
3
- Copyright © 2023, Diversifi Technologies Ltd.
4
-
5
- License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
6
- "Business Source License" is a trademark of MariaDB Corporation Ab.
7
-
8
- Terms
9
-
10
- The Licensor hereby grants you the right to copy, modify, create derivative
11
- works, redistribute, and make non-production use of the Licensed Work. The
12
- Licensor may make an Additional Use Grant, above, permitting limited
13
- production use.
14
-
15
- Effective on the Change Date, or the fourth anniversary of the first publicly
16
- available distribution of a specific version of the Licensed Work under this
17
- License, whichever comes first, the Licensor hereby grants you rights under
18
- the terms of the Change License, and the rights granted in the paragraph
19
- above terminate.
20
-
21
- If your use of the Licensed Work does not comply with the requirements
22
- currently in effect as described in this License, you must purchase a
23
- commercial license from the Licensor, its affiliated entities, or authorized
24
- resellers, or you must refrain from using the Licensed Work.
25
-
26
- All copies of the original and modified Licensed Work, and derivative works
27
- of the Licensed Work, are subject to this License. This License applies
28
- separately for each version of the Licensed Work and the Change Date may vary
29
- for each version of the Licensed Work released by Licensor.
30
-
31
- You must conspicuously display this License on each original or modified copy
32
- of the Licensed Work. If you receive the Licensed Work in original or
33
- modified form from a third party, the terms and conditions set forth in this
34
- License apply to your use of that work.
35
-
36
- Any use of the Licensed Work in violation of this License will automatically
37
- terminate your rights under this License for the current and all other
38
- versions of the Licensed Work.
39
-
40
- This License does not grant you any right in any trademark or logo of
41
- Licensor or its affiliates (provided that you may use a trademark or logo of
42
- Licensor as expressly required by this License).
43
-
44
- TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
45
- AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
46
- EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
47
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
48
- TITLE.
49
-
50
- MariaDB hereby grants you permission to use this License’s text to license
51
- your works, and to refer to it using the trademark “Business Source License”,
52
- as long as you comply with the Covenants of Licensor below.
53
-
54
- Covenants of Licensor
55
-
56
- In consideration of the right to use this License’s text and the “Business
57
- Source License” name and trademark, Licensor covenants to MariaDB, and to all
58
- other recipients of the licensed work to be provided by Licensor:
59
-
60
- 1. To specify as the Change License the GPL Version 2.0 or any later version,
61
- or a license that is compatible with GPL Version 2.0 or a later version,
62
- where “compatible” means that software provided under the Change License can
63
- be included in a program with software provided under GPL Version 2.0 or a
64
- later version. Licensor may specify additional Change Licenses without
65
- limitation.
66
-
67
- 2. To either: (a) specify an additional grant of rights to use that does not
68
- impose any additional restriction on the right granted in this License, as
69
- the Additional Use Grant; or (b) insert the text “None”.
70
-
71
- 3. To specify a Change Date.
72
-
73
- 4. Not to modify this License in any other way.
1
+ Business Source License 1.1
2
+
3
+ Copyright © 2023, Diversifi Technologies Ltd.
4
+
5
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
6
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
7
+
8
+ Terms
9
+
10
+ The Licensor hereby grants you the right to copy, modify, create derivative
11
+ works, redistribute, and make non-production use of the Licensed Work. The
12
+ Licensor may make an Additional Use Grant, above, permitting limited
13
+ production use.
14
+
15
+ Effective on the Change Date, or the fourth anniversary of the first publicly
16
+ available distribution of a specific version of the Licensed Work under this
17
+ License, whichever comes first, the Licensor hereby grants you rights under
18
+ the terms of the Change License, and the rights granted in the paragraph
19
+ above terminate.
20
+
21
+ If your use of the Licensed Work does not comply with the requirements
22
+ currently in effect as described in this License, you must purchase a
23
+ commercial license from the Licensor, its affiliated entities, or authorized
24
+ resellers, or you must refrain from using the Licensed Work.
25
+
26
+ All copies of the original and modified Licensed Work, and derivative works
27
+ of the Licensed Work, are subject to this License. This License applies
28
+ separately for each version of the Licensed Work and the Change Date may vary
29
+ for each version of the Licensed Work released by Licensor.
30
+
31
+ You must conspicuously display this License on each original or modified copy
32
+ of the Licensed Work. If you receive the Licensed Work in original or
33
+ modified form from a third party, the terms and conditions set forth in this
34
+ License apply to your use of that work.
35
+
36
+ Any use of the Licensed Work in violation of this License will automatically
37
+ terminate your rights under this License for the current and all other
38
+ versions of the Licensed Work.
39
+
40
+ This License does not grant you any right in any trademark or logo of
41
+ Licensor or its affiliates (provided that you may use a trademark or logo of
42
+ Licensor as expressly required by this License).
43
+
44
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
45
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
46
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
47
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
48
+ TITLE.
49
+
50
+ MariaDB hereby grants you permission to use this License’s text to license
51
+ your works, and to refer to it using the trademark “Business Source License”,
52
+ as long as you comply with the Covenants of Licensor below.
53
+
54
+ Covenants of Licensor
55
+
56
+ In consideration of the right to use this License’s text and the “Business
57
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
58
+ other recipients of the licensed work to be provided by Licensor:
59
+
60
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
61
+ or a license that is compatible with GPL Version 2.0 or a later version,
62
+ where “compatible” means that software provided under the Change License can
63
+ be included in a program with software provided under GPL Version 2.0 or a
64
+ later version. Licensor may specify additional Change Licenses without
65
+ limitation.
66
+
67
+ 2. To either: (a) specify an additional grant of rights to use that does not
68
+ impose any additional restriction on the right granted in this License, as
69
+ the Additional Use Grant; or (b) insert the text “None”.
70
+
71
+ 3. To specify a Change Date.
72
+
73
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -1,51 +1,51 @@
1
- # Kima Transaction API
2
-
3
- [![Build & Deploy](https://github.com/kima-finance/kima-transaction-api/actions/workflows/dev_auto_publish_npm.yml/badge.svg)](https://github.com/kima-finance/kima-transaction-api/actions/workflows/dev_auto_publish_npm.yml)
4
- [![npm version](https://img.shields.io/npm/v/%40kimafinance/kima-transaction-api)](https://www.npmjs.com/package/@kimafinance/kima-transaction-api/)
5
- [![Download NPM](https://img.shields.io/npm/dm/%40kimafinance/kima-transaction-api.svg?style=flat)](https://www.npmjs.com/package/@kimafinance/kima-transaction-api/)
6
-
7
- A wrapper around Kima's API, enabling sending and monitoring transactions. This is for beta version
8
-
9
- ## Install
10
-
11
- ```bash
12
- npm install --save @kimafinance/kima-transaction-api
13
- yarn add @kimafinance/kima-transaction-api
14
- ```
15
-
16
- ## Usage
17
-
18
- ```ts
19
- import {
20
- submitKimaTransaction,
21
- SupportNetworks,
22
- CurrencyOptions,
23
- } from "@kimafinance/kima-transaction-backend";
24
-
25
- const txResult = await submitKimaTransaction({
26
- originAddress: "0x1234123412341234123412341234123412341234",
27
- originChain: "ETH",
28
- targetAddress: "0x1234123412341234123412341234123412341234",
29
- targetChain: "POL",
30
- symbol: "USDK",
31
- amount: 100,
32
- fee: 0.3,
33
- });
34
- ```
35
-
36
- ## Available Functions
37
-
38
- `submitKimaTransaction` : Submit a transaction to transfer liquidity from one change to another.
39
-
40
- - `originAddress`: sending address
41
- - `originChain`: sending chain
42
- - `targetAddress`: receiving address
43
- - `targetChain`: receiving chain
44
- - `symbol`: token symbol
45
- - `amount`: amount of token to transfer
46
- - `fee`: amount of token that kima consumes to pay gas fee for pulling & releasing token transactions
47
-
48
- ## Environment Variables
49
-
50
- `KIMA_BACKEND_MNEMONIC` : Seed phrase of developer wallet. This wallet must have KIMA token to submit a transaction to kima chain.
51
- `KIMA_BACKEND_NODE_PROVIDER` : Node provider for kima chain
1
+ # Kima Transaction API
2
+
3
+ [![Build & Deploy](https://github.com/kima-finance/kima-transaction-api/actions/workflows/dev_auto_publish_npm.yml/badge.svg)](https://github.com/kima-finance/kima-transaction-api/actions/workflows/dev_auto_publish_npm.yml)
4
+ [![npm version](https://img.shields.io/npm/v/%40kimafinance/kima-transaction-api)](https://www.npmjs.com/package/@kimafinance/kima-transaction-api/)
5
+ [![Download NPM](https://img.shields.io/npm/dm/%40kimafinance/kima-transaction-api.svg?style=flat)](https://www.npmjs.com/package/@kimafinance/kima-transaction-api/)
6
+
7
+ A wrapper around Kima's API, enabling sending and monitoring transactions. This is for beta version
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ npm install --save @kimafinance/kima-transaction-api
13
+ yarn add @kimafinance/kima-transaction-api
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import {
20
+ submitKimaTransaction,
21
+ SupportNetworks,
22
+ CurrencyOptions,
23
+ } from "@kimafinance/kima-transaction-backend";
24
+
25
+ const txResult = await submitKimaTransaction({
26
+ originAddress: "0x1234123412341234123412341234123412341234",
27
+ originChain: "ETH",
28
+ targetAddress: "0x1234123412341234123412341234123412341234",
29
+ targetChain: "POL",
30
+ symbol: "USDK",
31
+ amount: 100,
32
+ fee: 0.3,
33
+ });
34
+ ```
35
+
36
+ ## Available Functions
37
+
38
+ `submitKimaTransaction` : Submit a transaction to transfer liquidity from one change to another.
39
+
40
+ - `originAddress`: sending address
41
+ - `originChain`: sending chain
42
+ - `targetAddress`: receiving address
43
+ - `targetChain`: receiving chain
44
+ - `symbol`: token symbol
45
+ - `amount`: amount of token to transfer
46
+ - `fee`: amount of token that kima consumes to pay gas fee for pulling & releasing token transactions
47
+
48
+ ## Environment Variables
49
+
50
+ `KIMA_BACKEND_MNEMONIC` : Seed phrase of developer wallet. This wallet must have KIMA token to submit a transaction to kima chain.
51
+ `KIMA_BACKEND_NODE_PROVIDER` : Node provider for kima chain
package/build/index.d.ts CHANGED
@@ -1,28 +1,28 @@
1
- export declare enum SupportedNetworks {
2
- ETHEREUM = "ETH",
3
- POLYGON = "POL",
4
- AVALANCHE = "AVX",
5
- SOLANA = "SOL",
6
- FUSE = "FUS",
7
- CELO = "CEL",
8
- BSC = "BSC",
9
- ARBITRIUM = "ARB",
10
- OPTIMISM = "OPT",
11
- POLYGON_ZKEVM = "ZKE"
12
- }
13
- export declare enum CurrencyOptions {
14
- USDT = "USDT",
15
- USDC = "USDC",
16
- USDK = "USDK"
17
- }
18
- interface Props {
19
- originChain: SupportedNetworks;
20
- originAddress: string;
21
- targetChain: SupportedNetworks;
22
- targetAddress: string;
23
- symbol: CurrencyOptions;
24
- amount: number;
25
- fee: number;
26
- }
27
- export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }: Props): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
28
- export {};
1
+ export declare enum SupportedNetworks {
2
+ ETHEREUM = "ETH",
3
+ POLYGON = "POL",
4
+ AVALANCHE = "AVX",
5
+ SOLANA = "SOL",
6
+ FUSE = "FUS",
7
+ CELO = "CEL",
8
+ BSC = "BSC",
9
+ ARBITRIUM = "ARB",
10
+ OPTIMISM = "OPT",
11
+ POLYGON_ZKEVM = "ZKE"
12
+ }
13
+ export declare enum CurrencyOptions {
14
+ USDT = "USDT",
15
+ USDC = "USDC",
16
+ USDK = "USDK"
17
+ }
18
+ interface Props {
19
+ originChain: SupportedNetworks;
20
+ originAddress: string;
21
+ targetChain: SupportedNetworks;
22
+ targetAddress: string;
23
+ symbol: CurrencyOptions;
24
+ amount: number;
25
+ fee: number;
26
+ }
27
+ export declare function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }: Props): Promise<import("@cosmjs/stargate").DeliverTxResponse>;
28
+ export {};
package/build/index.js CHANGED
@@ -1,68 +1,73 @@
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
- var SupportedNetworks;
7
- (function (SupportedNetworks) {
8
- SupportedNetworks["ETHEREUM"] = "ETH";
9
- SupportedNetworks["POLYGON"] = "POL";
10
- SupportedNetworks["AVALANCHE"] = "AVX";
11
- SupportedNetworks["SOLANA"] = "SOL";
12
- SupportedNetworks["FUSE"] = "FUS";
13
- SupportedNetworks["CELO"] = "CEL";
14
- SupportedNetworks["BSC"] = "BSC";
15
- SupportedNetworks["ARBITRIUM"] = "ARB";
16
- SupportedNetworks["OPTIMISM"] = "OPT";
17
- SupportedNetworks["POLYGON_ZKEVM"] = "ZKE";
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
- function sleep(ms) {
26
- return new Promise((resolve) => setTimeout(resolve, ms));
27
- }
28
- async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }) {
29
- const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
30
- const client = await (0, common_1.TxClient)(wallet);
31
- const [firstAccount] = await wallet.getAccounts();
32
- const params = {
33
- creator: firstAccount.address,
34
- originChain,
35
- originAddress,
36
- targetChain,
37
- targetAddress,
38
- symbol,
39
- amount: amount.toString(),
40
- fee: fee.toString(),
41
- };
42
- let msg = await client.msgRequestTransaction(params);
43
- const result = await client.signAndBroadcast([msg]);
44
- let txId = 1;
45
- for (const event of result.events) {
46
- if (event.type === "transaction_requested") {
47
- for (const attr of event.attributes) {
48
- if (attr.key === "txId") {
49
- txId = +attr.value;
50
- }
51
- }
52
- }
53
- }
54
- msg = await client.msgSetTxHash({
55
- creator: firstAccount.address,
56
- txId,
57
- txHash: result.transactionHash,
58
- txType: "request_transaction"
59
- });
60
- console.log(msg);
61
- let hashResult;
62
- do {
63
- hashResult = await client.signAndBroadcast([msg]);
64
- await sleep(1000);
65
- } while (hashResult.code !== 0);
66
- return result;
67
- }
68
- exports.submitKimaTransaction = submitKimaTransaction;
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
+ var SupportedNetworks;
7
+ (function (SupportedNetworks) {
8
+ SupportedNetworks["ETHEREUM"] = "ETH";
9
+ SupportedNetworks["POLYGON"] = "POL";
10
+ SupportedNetworks["AVALANCHE"] = "AVX";
11
+ SupportedNetworks["SOLANA"] = "SOL";
12
+ SupportedNetworks["FUSE"] = "FUS";
13
+ SupportedNetworks["CELO"] = "CEL";
14
+ SupportedNetworks["BSC"] = "BSC";
15
+ SupportedNetworks["ARBITRIUM"] = "ARB";
16
+ SupportedNetworks["OPTIMISM"] = "OPT";
17
+ SupportedNetworks["POLYGON_ZKEVM"] = "ZKE";
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
+ function sleep(ms) {
26
+ return new Promise((resolve) => setTimeout(resolve, ms));
27
+ }
28
+ async function submitKimaTransaction({ originChain, originAddress, targetChain, targetAddress, symbol, amount, fee, }) {
29
+ const wallet = await proto_signing_1.DirectSecp256k1HdWallet.fromMnemonic(process.env.KIMA_BACKEND_MNEMONIC, { prefix: "kima" });
30
+ const client = await (0, common_1.TxClient)(wallet);
31
+ const [firstAccount] = await wallet.getAccounts();
32
+ const params = {
33
+ creator: firstAccount.address,
34
+ originChain,
35
+ originAddress,
36
+ targetChain,
37
+ targetAddress,
38
+ symbol,
39
+ amount: amount.toString(),
40
+ fee: fee.toString(),
41
+ htlcCreationHash: "",
42
+ htlcCreationVout: 0,
43
+ htlcExpirationTimestamp: "",
44
+ htlcVersion: "",
45
+ senderPubKey: new Uint8Array(0),
46
+ };
47
+ let msg = await client.msgRequestTransaction(params);
48
+ const result = await client.signAndBroadcast([msg]);
49
+ let txId = 1;
50
+ for (const event of result.events) {
51
+ if (event.type === "transaction_requested") {
52
+ for (const attr of event.attributes) {
53
+ if (attr.key === "txId") {
54
+ txId = +attr.value;
55
+ }
56
+ }
57
+ }
58
+ }
59
+ msg = await client.msgSetTxHash({
60
+ creator: firstAccount.address,
61
+ txId,
62
+ txHash: result.transactionHash,
63
+ txType: "request_transaction",
64
+ });
65
+ console.log(msg);
66
+ let hashResult;
67
+ do {
68
+ hashResult = await client.signAndBroadcast([msg]);
69
+ await sleep(1000);
70
+ } while (hashResult.code !== 0);
71
+ return result;
72
+ }
73
+ exports.submitKimaTransaction = submitKimaTransaction;
@@ -1,14 +1,14 @@
1
- import { StdFee } from "@cosmjs/stargate";
2
- import { Registry, OfflineSigner, EncodeObject } from "@cosmjs/proto-signing";
3
- import { MsgRequestTransaction, MsgSetTxHash } from "./tx";
4
- interface SignAndBroadcastOptions {
5
- fee: StdFee;
6
- memo?: string;
7
- }
8
- export declare const registry: Registry;
9
- export declare const TxClient: (wallet: OfflineSigner) => Promise<{
10
- signAndBroadcast: (msgs: EncodeObject[], { fee, memo }?: SignAndBroadcastOptions) => Promise<import("@cosmjs/stargate").DeliverTxResponse>;
11
- msgRequestTransaction: (data: MsgRequestTransaction) => EncodeObject;
12
- msgSetTxHash: (data: MsgSetTxHash) => EncodeObject;
13
- }>;
14
- export {};
1
+ import { StdFee } from "@cosmjs/stargate";
2
+ import { Registry, OfflineSigner, EncodeObject } from "@cosmjs/proto-signing";
3
+ import { MsgRequestTransaction, MsgSetTxHash } from "./tx";
4
+ interface SignAndBroadcastOptions {
5
+ fee: StdFee;
6
+ memo?: string;
7
+ }
8
+ export declare const registry: Registry;
9
+ export declare const TxClient: (wallet: OfflineSigner) => Promise<{
10
+ signAndBroadcast: (msgs: EncodeObject[], { fee, memo }?: SignAndBroadcastOptions) => Promise<import("@cosmjs/stargate").DeliverTxResponse>;
11
+ msgRequestTransaction: (data: MsgRequestTransaction) => EncodeObject;
12
+ msgSetTxHash: (data: MsgSetTxHash) => EncodeObject;
13
+ }>;
14
+ export {};
@@ -1,36 +1,36 @@
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.TxClient = exports.registry = void 0;
7
- const stargate_1 = require("@cosmjs/stargate");
8
- const dotenv_1 = __importDefault(require("dotenv"));
9
- const proto_signing_1 = require("@cosmjs/proto-signing");
10
- const tx_1 = require("./tx");
11
- dotenv_1.default.config();
12
- const defaultFee = {
13
- amount: [],
14
- gas: "2000000",
15
- };
16
- const types = [
17
- ["/kimablockchain.transaction.MsgRequestTransaction", tx_1.MsgRequestTransaction],
18
- ["/kimablockchain.transaction.MsgSetTxHash", tx_1.MsgSetTxHash],
19
- ];
20
- exports.registry = new proto_signing_1.Registry(types);
21
- const TxClient = async (wallet) => {
22
- const client = await stargate_1.SigningStargateClient.connectWithSigner(process.env.KIMA_BACKEND_NODE_PROVIDER, wallet, { registry: exports.registry });
23
- const { address } = (await wallet.getAccounts())[0];
24
- return {
25
- signAndBroadcast: (msgs, { fee, memo } = { fee: defaultFee, memo: "" }) => client.signAndBroadcast(address, msgs, fee, memo),
26
- msgRequestTransaction: (data) => ({
27
- typeUrl: "/kimablockchain.transaction.MsgRequestTransaction",
28
- value: tx_1.MsgRequestTransaction.fromPartial(data),
29
- }),
30
- msgSetTxHash: (data) => ({
31
- typeUrl: "/kimablockchain.transaction.MsgSetTxHash",
32
- value: tx_1.MsgSetTxHash.fromPartial(data),
33
- }),
34
- };
35
- };
36
- exports.TxClient = TxClient;
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.TxClient = exports.registry = void 0;
7
+ const stargate_1 = require("@cosmjs/stargate");
8
+ const dotenv_1 = __importDefault(require("dotenv"));
9
+ const proto_signing_1 = require("@cosmjs/proto-signing");
10
+ const tx_1 = require("./tx");
11
+ dotenv_1.default.config();
12
+ const defaultFee = {
13
+ amount: [],
14
+ gas: "4000000",
15
+ };
16
+ const types = [
17
+ ["/kimablockchain.transaction.MsgRequestTransaction", tx_1.MsgRequestTransaction],
18
+ ["/kimablockchain.transaction.MsgSetTxHash", tx_1.MsgSetTxHash],
19
+ ];
20
+ exports.registry = new proto_signing_1.Registry(types);
21
+ const TxClient = async (wallet) => {
22
+ const client = await stargate_1.SigningStargateClient.connectWithSigner(process.env.KIMA_BACKEND_NODE_PROVIDER, wallet, { registry: exports.registry });
23
+ const { address } = (await wallet.getAccounts())[0];
24
+ return {
25
+ signAndBroadcast: (msgs, { fee, memo } = { fee: defaultFee, memo: "" }) => client.signAndBroadcast(address, msgs, fee, memo),
26
+ msgRequestTransaction: (data) => ({
27
+ typeUrl: "/kimablockchain.transaction.MsgRequestTransaction",
28
+ value: tx_1.MsgRequestTransaction.fromPartial(data),
29
+ }),
30
+ msgSetTxHash: (data) => ({
31
+ typeUrl: "/kimablockchain.transaction.MsgSetTxHash",
32
+ value: tx_1.MsgSetTxHash.fromPartial(data),
33
+ }),
34
+ };
35
+ };
36
+ exports.TxClient = TxClient;