@kimafinance/kima-transaction-api 1.0.2 → 1.0.4
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 +4 -5
- package/package.json +32 -32
- package/src/index.ts +15 -9
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Kima Transaction API
|
|
2
2
|
|
|
3
|
-
A wrapper around Kima's API, enabling sending and monitoring transactions
|
|
3
|
+
A wrapper around Kima's API, enabling sending and monitoring transactions. This is for beta version
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -17,10 +17,10 @@ import { submitKimaTransaction, SupportNetworks, CurrencyOptions } from '@kimafi
|
|
|
17
17
|
|
|
18
18
|
const txResult = await submitKimaTransaction({
|
|
19
19
|
originAddress: "0x1234123412341234123412341234123412341234",
|
|
20
|
-
originChain:
|
|
20
|
+
originChain: 'ETH',
|
|
21
21
|
targetAddress: "0x1234123412341234123412341234123412341234",
|
|
22
|
-
targetChain:
|
|
23
|
-
symbol:
|
|
22
|
+
targetChain: 'POL',
|
|
23
|
+
symbol: 'USDK',
|
|
24
24
|
amount: 100,
|
|
25
25
|
fee: 0.3
|
|
26
26
|
})
|
|
@@ -43,5 +43,4 @@ const txResult = await submitKimaTransaction({
|
|
|
43
43
|
## Environment Variables
|
|
44
44
|
|
|
45
45
|
`KIMA_BACKEND_MNEMONIC` : Seed phrase of developer wallet. This wallet must have KIMA token to submit a transaction to kima chain.
|
|
46
|
-
|
|
47
46
|
`KIMA_BACKEND_NODE_PROVIDER` : Node provider for kima chain
|
package/package.json
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@kimafinance/kima-transaction-api",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A wrapper around Kima's API, enabling sending and monitoring transactions",
|
|
5
|
-
"author": "",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"main": "build/index.js",
|
|
8
|
-
"source": "src/index.ts",
|
|
9
|
-
"engines": {
|
|
10
|
-
"node": ">=10"
|
|
11
|
-
},
|
|
12
|
-
"scripts": {
|
|
13
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
-
"dev": "nodemon",
|
|
15
|
-
"build": "rimraf ./build && tsc",
|
|
16
|
-
"start": "npm run build && node build/index.js"
|
|
17
|
-
},
|
|
18
|
-
"keywords": [],
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@types/node": "^18.11.9",
|
|
21
|
-
"nodemon": "^2.0.20",
|
|
22
|
-
"rimraf": "^3.0.2",
|
|
23
|
-
"ts-node": "^10.9.1",
|
|
24
|
-
"typescript": "^4.9.3"
|
|
25
|
-
},
|
|
26
|
-
"dependencies": {
|
|
27
|
-
"@cosmjs/cosmwasm-stargate": "^0.29.4",
|
|
28
|
-
"@cosmjs/proto-signing": "^0.29.4",
|
|
29
|
-
"@cosmjs/stargate": "^0.29.4",
|
|
30
|
-
"dotenv": "^16.0.3"
|
|
31
|
-
}
|
|
32
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@kimafinance/kima-transaction-api",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "A wrapper around Kima's API, enabling sending and monitoring transactions (Beta version)",
|
|
5
|
+
"author": "",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"main": "build/index.js",
|
|
8
|
+
"source": "src/index.ts",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=10"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
14
|
+
"dev": "nodemon",
|
|
15
|
+
"build": "rimraf ./build && tsc",
|
|
16
|
+
"start": "npm run build && node build/index.js"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [],
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"@types/node": "^18.11.9",
|
|
21
|
+
"nodemon": "^2.0.20",
|
|
22
|
+
"rimraf": "^3.0.2",
|
|
23
|
+
"ts-node": "^10.9.1",
|
|
24
|
+
"typescript": "^4.9.3"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@cosmjs/cosmwasm-stargate": "^0.29.4",
|
|
28
|
+
"@cosmjs/proto-signing": "^0.29.4",
|
|
29
|
+
"@cosmjs/stargate": "^0.29.4",
|
|
30
|
+
"dotenv": "^16.0.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,23 +2,29 @@ import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
|
|
|
2
2
|
import { TxClient } from "./kima/common";
|
|
3
3
|
import { MsgRequestTransaction } from "./kima/tx";
|
|
4
4
|
|
|
5
|
-
export enum
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
export enum SupportedNetworks {
|
|
6
|
+
ETHEREUM = "ETH",
|
|
7
|
+
POLYGON = "POL",
|
|
8
|
+
AVALANCHE = "AVX",
|
|
9
|
+
SOLANA = "SOL",
|
|
10
|
+
FUSE = "FUS",
|
|
11
|
+
CELO = "CEL",
|
|
12
|
+
BSC = "BSC",
|
|
13
|
+
ARBITRIUM = "ARB",
|
|
14
|
+
OPTIMISM = "OPT",
|
|
15
|
+
POLYGON_ZKEVM = "ZKE",
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
export enum CurrencyOptions {
|
|
13
|
-
USDK = "USDK",
|
|
14
19
|
USDT = "USDT",
|
|
15
20
|
USDC = "USDC",
|
|
21
|
+
USDK = "USDK",
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
interface Props {
|
|
19
|
-
originChain:
|
|
25
|
+
originChain: SupportedNetworks;
|
|
20
26
|
originAddress: string;
|
|
21
|
-
targetChain:
|
|
27
|
+
targetChain: SupportedNetworks;
|
|
22
28
|
targetAddress: string;
|
|
23
29
|
symbol: CurrencyOptions;
|
|
24
30
|
amount: number;
|
|
@@ -72,7 +78,7 @@ export async function submitKimaTransaction({
|
|
|
72
78
|
txHash: result.transactionHash,
|
|
73
79
|
});
|
|
74
80
|
|
|
75
|
-
|
|
81
|
+
await client.signAndBroadcast([msg]);
|
|
76
82
|
|
|
77
83
|
return result;
|
|
78
84
|
}
|