@xchainjs/xchain-thorchain 0.23.0 → 0.24.0
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/CHANGELOG.md +11 -0
- package/README.md +21 -16
- package/lib/client.d.ts +7 -40
- package/lib/index.esm.js +5809 -668
- package/lib/index.js +5810 -668
- package/lib/types/messages.d.ts +8 -9
- package/lib/util.d.ts +47 -24
- package/package.json +10 -6
package/lib/types/messages.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { StdSignature } from 'cosmos-client/x/auth';
|
|
1
|
+
import { cosmosclient, proto } from '@cosmos-client/core';
|
|
2
|
+
import { Asset } from '@xchainjs/xchain-util';
|
|
4
3
|
export declare type MsgCoin = {
|
|
5
|
-
asset:
|
|
4
|
+
asset: Asset;
|
|
6
5
|
amount: string;
|
|
7
6
|
};
|
|
8
|
-
export declare class MsgNativeTx
|
|
7
|
+
export declare class MsgNativeTx {
|
|
9
8
|
coins: MsgCoin[];
|
|
10
9
|
memo: string;
|
|
11
|
-
signer: AccAddress;
|
|
12
|
-
constructor(coins: MsgCoin[], memo: string, signer: AccAddress);
|
|
10
|
+
signer: cosmosclient.AccAddress;
|
|
11
|
+
constructor(coins: MsgCoin[], memo: string, signer: cosmosclient.AccAddress);
|
|
13
12
|
}
|
|
14
13
|
/**
|
|
15
14
|
* This creates MsgNativeTx from json.
|
|
@@ -32,8 +31,8 @@ export declare type ThorchainDepositResponse = AminoWrapping<{
|
|
|
32
31
|
memo: string;
|
|
33
32
|
signer: string;
|
|
34
33
|
}>[];
|
|
35
|
-
fee:
|
|
36
|
-
signatures:
|
|
34
|
+
fee: proto.cosmos.tx.v1beta1.Fee;
|
|
35
|
+
signatures: string[];
|
|
37
36
|
memo: string;
|
|
38
37
|
timeout_height: string;
|
|
39
38
|
}>;
|
package/lib/util.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
+
import { cosmosclient, proto } from '@cosmos-client/core';
|
|
1
2
|
import { Address, Balance, Fees, Network, TxHash } from '@xchainjs/xchain-client';
|
|
2
3
|
import { CosmosSDKClient, TxLog } from '@xchainjs/xchain-cosmos';
|
|
3
|
-
import { Asset } from '@xchainjs/xchain-util';
|
|
4
|
-
import { Msg } from 'cosmos-client';
|
|
5
|
-
import { StdTx } from 'cosmos-client/x/auth';
|
|
6
|
-
import { MsgMultiSend, MsgSend } from 'cosmos-client/x/bank';
|
|
4
|
+
import { Asset, BaseAmount } from '@xchainjs/xchain-util';
|
|
7
5
|
import { ChainId, ChainIds, ClientUrl, ExplorerUrls, TxData } from './types';
|
|
8
6
|
import { MsgNativeTx } from './types/messages';
|
|
9
7
|
export declare const DECIMAL = 8;
|
|
@@ -31,20 +29,6 @@ export declare const getDenom: (asset: Asset) => string;
|
|
|
31
29
|
* @returns {Asset|null} The asset of the given denomination.
|
|
32
30
|
*/
|
|
33
31
|
export declare const assetFromDenom: (denom: string) => Asset | null;
|
|
34
|
-
/**
|
|
35
|
-
* Type guard for MsgSend
|
|
36
|
-
*
|
|
37
|
-
* @param {Msg} msg
|
|
38
|
-
* @returns {boolean} `true` or `false`.
|
|
39
|
-
*/
|
|
40
|
-
export declare const isMsgSend: (msg: Msg) => msg is MsgSend;
|
|
41
|
-
/**
|
|
42
|
-
* Type guard for MsgMultiSend
|
|
43
|
-
*
|
|
44
|
-
* @param {Msg} msg
|
|
45
|
-
* @returns {boolean} `true` or `false`.
|
|
46
|
-
*/
|
|
47
|
-
export declare const isMsgMultiSend: (msg: Msg) => msg is MsgMultiSend;
|
|
48
32
|
/**
|
|
49
33
|
* Response guard for transaction broadcast
|
|
50
34
|
*
|
|
@@ -61,11 +45,13 @@ export declare const isBroadcastSuccess: (response: unknown) => boolean;
|
|
|
61
45
|
**/
|
|
62
46
|
export declare const getPrefix: (network: Network) => "thor" | "sthor" | "tthor";
|
|
63
47
|
/**
|
|
64
|
-
* Register
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
* Register type for encoding `MsgDeposit` messages
|
|
49
|
+
*/
|
|
50
|
+
export declare const registerDepositCodecs: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* Register type for encoding `MsgSend` messages
|
|
67
53
|
*/
|
|
68
|
-
export declare const
|
|
54
|
+
export declare const registerSendCodecs: () => void;
|
|
69
55
|
/**
|
|
70
56
|
* Parse transaction data from event logs
|
|
71
57
|
*
|
|
@@ -99,7 +85,24 @@ export declare const getChainId: (nodeUrl: string) => Promise<ChainId>;
|
|
|
99
85
|
*/
|
|
100
86
|
export declare const getChainIds: (client: ClientUrl) => Promise<ChainIds>;
|
|
101
87
|
/**
|
|
102
|
-
*
|
|
88
|
+
* Builds final unsigned TX
|
|
89
|
+
*
|
|
90
|
+
* @param cosmosSdk - CosmosSDK
|
|
91
|
+
* @param txBody - txBody with encoded Msgs
|
|
92
|
+
* @param signerPubkey - signerPubkey string
|
|
93
|
+
* @param sequence - account sequence
|
|
94
|
+
* @param gasLimit - transaction gas limit
|
|
95
|
+
* @returns
|
|
96
|
+
*/
|
|
97
|
+
export declare const buildUnsignedTx: ({ cosmosSdk, txBody, signerPubkey, sequence, gasLimit, }: {
|
|
98
|
+
cosmosSdk: cosmosclient.CosmosSDK;
|
|
99
|
+
txBody: proto.cosmos.tx.v1beta1.TxBody;
|
|
100
|
+
signerPubkey: proto.google.protobuf.Any;
|
|
101
|
+
sequence: cosmosclient.Long;
|
|
102
|
+
gasLimit: string;
|
|
103
|
+
}) => cosmosclient.TxBuilder;
|
|
104
|
+
/**
|
|
105
|
+
* Structure a MsgDeposit
|
|
103
106
|
*
|
|
104
107
|
* @param {MsgNativeTx} msgNativeTx Msg of type `MsgNativeTx`.
|
|
105
108
|
* @param {string} nodeUrl Node url
|
|
@@ -113,7 +116,27 @@ export declare const buildDepositTx: ({ msgNativeTx, nodeUrl, chainId, }: {
|
|
|
113
116
|
msgNativeTx: MsgNativeTx;
|
|
114
117
|
nodeUrl: string;
|
|
115
118
|
chainId: ChainId;
|
|
116
|
-
}) => Promise<
|
|
119
|
+
}) => Promise<proto.cosmos.tx.v1beta1.TxBody>;
|
|
120
|
+
/**
|
|
121
|
+
* Structure a MsgSend
|
|
122
|
+
*
|
|
123
|
+
* @param fromAddress - required, from address string
|
|
124
|
+
* @param toAddress - required, to address string
|
|
125
|
+
* @param assetAmount - required, asset amount string (e.g. "10000")
|
|
126
|
+
* @param assetDenom - required, asset denom string (e.g. "rune")
|
|
127
|
+
* @param memo - optional, memo string
|
|
128
|
+
*
|
|
129
|
+
* @returns
|
|
130
|
+
*/
|
|
131
|
+
export declare const buildTransferTx: ({ fromAddress, toAddress, assetAmount, assetDenom, memo, nodeUrl, chainId, }: {
|
|
132
|
+
fromAddress: Address;
|
|
133
|
+
toAddress: Address;
|
|
134
|
+
assetAmount: BaseAmount;
|
|
135
|
+
assetDenom: string;
|
|
136
|
+
memo?: string | undefined;
|
|
137
|
+
nodeUrl: string;
|
|
138
|
+
chainId: ChainId;
|
|
139
|
+
}) => Promise<proto.cosmos.tx.v1beta1.TxBody>;
|
|
117
140
|
/**
|
|
118
141
|
* Get the balance of a given address.
|
|
119
142
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Custom Thorchain client and utilities used by XChainJS clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -27,29 +27,33 @@
|
|
|
27
27
|
"clean": "rimraf lib/**",
|
|
28
28
|
"build": "yarn clean && rollup -c",
|
|
29
29
|
"test": "jest",
|
|
30
|
+
"e2e": "jest --config jest.config.e2e.js",
|
|
30
31
|
"lint": "eslint \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
|
|
31
32
|
"prepublishOnly": "yarn build",
|
|
32
|
-
"start:example": "ts-node example/index.ts"
|
|
33
|
+
"start:example": "ts-node example/index.ts",
|
|
34
|
+
"generate:ThorchainMsgs": "./genMsgs.sh"
|
|
33
35
|
},
|
|
34
36
|
"devDependencies": {
|
|
37
|
+
"@cosmos-client/core": "^0.45.1",
|
|
35
38
|
"@types/big.js": "^6.0.0",
|
|
36
39
|
"@xchainjs/xchain-client": "^0.11.1",
|
|
37
|
-
"@xchainjs/xchain-cosmos": "^0.
|
|
40
|
+
"@xchainjs/xchain-cosmos": "^0.17.0",
|
|
38
41
|
"@xchainjs/xchain-crypto": "^0.2.4",
|
|
39
42
|
"@xchainjs/xchain-util": "^0.5.1",
|
|
40
43
|
"axios": "^0.25.0",
|
|
41
|
-
"
|
|
44
|
+
"bech32-buffer": "^0.2.0",
|
|
42
45
|
"nock": "^13.0.5"
|
|
43
46
|
},
|
|
44
47
|
"publishConfig": {
|
|
45
48
|
"access": "public"
|
|
46
49
|
},
|
|
47
50
|
"peerDependencies": {
|
|
51
|
+
"@cosmos-client/core": "^0.45.1",
|
|
48
52
|
"@xchainjs/xchain-client": "^0.11.1",
|
|
49
|
-
"@xchainjs/xchain-cosmos": "^0.
|
|
53
|
+
"@xchainjs/xchain-cosmos": "^0.17.0",
|
|
50
54
|
"@xchainjs/xchain-crypto": "^0.2.4",
|
|
51
55
|
"@xchainjs/xchain-util": "^0.5.1",
|
|
52
56
|
"axios": "^0.25.0",
|
|
53
|
-
"
|
|
57
|
+
"bech32-buffer": "^0.2.0"
|
|
54
58
|
}
|
|
55
59
|
}
|