@skip-go/client 1.6.0-alpha.2 → 1.6.0-alpha.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/package.json +1 -1
- package/dist/cjs/api/getAssets.cjs +0 -16
- package/dist/cjs/api/getAssetsBetweenChains.cjs +0 -12
- package/dist/cjs/api/getBridges.cjs +0 -12
- package/dist/cjs/api/getChains.cjs +0 -12
- package/dist/cjs/api/getVenues.cjs +0 -12
- package/dist/cjs/api/postAssetsFromSource.cjs +0 -13
- package/dist/cjs/api/postBalances.cjs +0 -12
- package/dist/cjs/api/postIbcOriginAssets.cjs +0 -12
- package/dist/cjs/api/postMessages.cjs +0 -12
- package/dist/cjs/api/postMessagesDirect.cjs +0 -12
- package/dist/cjs/api/postRecommendAssets.cjs +0 -12
- package/dist/cjs/api/postRoute.cjs +0 -12
- package/dist/cjs/api/postSubmitTransaction.cjs +0 -12
- package/dist/cjs/api/postTrackTransaction.cjs +0 -12
- package/dist/cjs/api/postTransactionStatus.cjs +0 -12
- package/dist/cjs/chunk-25TA7Z7R.cjs +0 -460
- package/dist/cjs/chunk-2QPPD3BB.cjs +0 -210
- package/dist/cjs/chunk-2SA3OAIJ.cjs +0 -18
- package/dist/cjs/chunk-4BWE7SOV.cjs +0 -68
- package/dist/cjs/chunk-4GHUZDDP.cjs +0 -16
- package/dist/cjs/chunk-4ZIVDKQN.cjs +0 -387
- package/dist/cjs/chunk-A3UNNRKD.cjs +0 -574
- package/dist/cjs/chunk-A5S6SIYN.cjs +0 -12
- package/dist/cjs/chunk-AQTXZWLA.cjs +0 -55
- package/dist/cjs/chunk-ASDMDYTC.cjs +0 -11
- package/dist/cjs/chunk-ATW6UNT5.cjs +0 -136
- package/dist/cjs/chunk-AUTOIM57.cjs +0 -22
- package/dist/cjs/chunk-AVWWCQ5P.cjs +0 -2264
- package/dist/cjs/chunk-CIZTNJ3K.cjs +0 -24
- package/dist/cjs/chunk-CK6CQWQU.cjs +0 -49
- package/dist/cjs/chunk-EAZQ2ECA.cjs +0 -185
- package/dist/cjs/chunk-F3EB2AQG.cjs +0 -28
- package/dist/cjs/chunk-FCTBCHOT.cjs +0 -12
- package/dist/cjs/chunk-IJIBMN2F.cjs +0 -12
- package/dist/cjs/chunk-JRXPJ45U.cjs +0 -12
- package/dist/cjs/chunk-LJF74VNZ.cjs +0 -214
- package/dist/cjs/chunk-LJV45UGL.cjs +0 -582
- package/dist/cjs/chunk-MUJBB64F.cjs +0 -291
- package/dist/cjs/chunk-NCFH5MGF.cjs +0 -39
- package/dist/cjs/chunk-NM4PISTQ.cjs +0 -3359
- package/dist/cjs/chunk-OJISEAMX.cjs +0 -13
- package/dist/cjs/chunk-OVKHTOBP.cjs +0 -99
- package/dist/cjs/chunk-PDNKS5R2.cjs +0 -13
- package/dist/cjs/chunk-TEH6UMUR.cjs +0 -280
- package/dist/cjs/chunk-UXW4XVHF.cjs +0 -15
- package/dist/cjs/chunk-WVMDZODS.cjs +0 -1495
- package/dist/cjs/chunk-YX56UXDX.cjs +0 -189
- package/dist/cjs/index.cjs +0 -349
- package/dist/cjs/public-functions/executeMultipleRoutes.cjs +0 -27
- package/dist/cjs/public-functions/executeRoute.cjs +0 -27
- package/dist/cjs/public-functions/getCosmosGasAmountForMessage.cjs +0 -16
- package/dist/cjs/public-functions/getEvmGasAmountForMessage.cjs +0 -11
- package/dist/cjs/public-functions/getFeeInfoForChain.cjs +0 -14
- package/dist/cjs/public-functions/getRecommendedGasPrice.cjs +0 -15
- package/dist/cjs/public-functions/getRouteWithGasOnReceive.cjs +0 -41
- package/dist/cjs/public-functions/getSigningStargateClient.cjs +0 -15
- package/dist/cjs/public-functions/setApiOptions.cjs +0 -12
- package/dist/cjs/public-functions/setClientOptions.cjs +0 -16
- package/dist/cjs/public-functions/subscribeToRouteStatus.cjs +0 -26
- package/dist/cjs/public-functions/validateCosmosGasBalance.cjs +0 -18
- package/dist/cjs/public-functions/waitForTransaction.cjs +0 -18
- package/dist/esm/api/getAssets.d.ts +0 -19
- package/dist/esm/api/getAssets.js +0 -3
- package/dist/esm/api/getAssetsBetweenChains.d.ts +0 -56
- package/dist/esm/api/getAssetsBetweenChains.js +0 -3
- package/dist/esm/api/getBridges.d.ts +0 -55
- package/dist/esm/api/getBridges.js +0 -3
- package/dist/esm/api/getChains.d.ts +0 -41
- package/dist/esm/api/getChains.js +0 -3
- package/dist/esm/api/getVenues.d.ts +0 -13
- package/dist/esm/api/getVenues.js +0 -3
- package/dist/esm/api/postAssetsFromSource.d.ts +0 -22
- package/dist/esm/api/postAssetsFromSource.js +0 -4
- package/dist/esm/api/postBalances.d.ts +0 -35
- package/dist/esm/api/postBalances.js +0 -3
- package/dist/esm/api/postIbcOriginAssets.d.ts +0 -32
- package/dist/esm/api/postIbcOriginAssets.js +0 -3
- package/dist/esm/api/postMessages.d.ts +0 -101
- package/dist/esm/api/postMessages.js +0 -3
- package/dist/esm/api/postMessagesDirect.d.ts +0 -640
- package/dist/esm/api/postMessagesDirect.js +0 -3
- package/dist/esm/api/postRecommendAssets.d.ts +0 -40
- package/dist/esm/api/postRecommendAssets.js +0 -3
- package/dist/esm/api/postRoute.d.ts +0 -530
- package/dist/esm/api/postRoute.js +0 -3
- package/dist/esm/api/postSubmitTransaction.d.ts +0 -17
- package/dist/esm/api/postSubmitTransaction.js +0 -3
- package/dist/esm/api/postTrackTransaction.d.ts +0 -12
- package/dist/esm/api/postTrackTransaction.js +0 -3
- package/dist/esm/api/postTransactionStatus.d.ts +0 -639
- package/dist/esm/api/postTransactionStatus.js +0 -3
- package/dist/esm/apiState-1VvikVK-.d.ts +0 -8
- package/dist/esm/callbacks-DdC6QMlE.d.ts +0 -158
- package/dist/esm/chunk-3DIX6KRJ.js +0 -566
- package/dist/esm/chunk-3JHLVPRG.js +0 -10
- package/dist/esm/chunk-5WYMRZIO.js +0 -97
- package/dist/esm/chunk-6QW6MRVQ.js +0 -53
- package/dist/esm/chunk-A5NZMSTI.js +0 -10
- package/dist/esm/chunk-CGJRRAFS.js +0 -22
- package/dist/esm/chunk-DMJMN4J3.js +0 -379
- package/dist/esm/chunk-E4NRDAVO.js +0 -65
- package/dist/esm/chunk-ETBJVFQP.js +0 -10
- package/dist/esm/chunk-F2LQB2DP.js +0 -3323
- package/dist/esm/chunk-F66EKL3W.js +0 -203
- package/dist/esm/chunk-GV2QOWB4.js +0 -26
- package/dist/esm/chunk-GZJLX2CP.js +0 -2258
- package/dist/esm/chunk-HNU2Y3JI.js +0 -13
- package/dist/esm/chunk-J24LYWJE.js +0 -130
- package/dist/esm/chunk-KZKAL5ZN.js +0 -16
- package/dist/esm/chunk-N4PTRCNT.js +0 -11
- package/dist/esm/chunk-NUHMTWHP.js +0 -180
- package/dist/esm/chunk-OMOVHXSC.js +0 -212
- package/dist/esm/chunk-P36PE4CR.js +0 -37
- package/dist/esm/chunk-PZ2624FK.js +0 -187
- package/dist/esm/chunk-QYXGDTUU.js +0 -47
- package/dist/esm/chunk-R2GHDOWX.js +0 -272
- package/dist/esm/chunk-RH7PDDI5.js +0 -433
- package/dist/esm/chunk-RTDD7HZ3.js +0 -275
- package/dist/esm/chunk-SXBG57J3.js +0 -20
- package/dist/esm/chunk-TGTOO2ZQ.js +0 -14
- package/dist/esm/chunk-UHCKOKBM.js +0 -9
- package/dist/esm/chunk-ULUX2CVU.js +0 -557
- package/dist/esm/chunk-UN46DUOV.js +0 -11
- package/dist/esm/chunk-XNU3TKKM.js +0 -10
- package/dist/esm/chunk-ZVFYCNA5.js +0 -1492
- package/dist/esm/client-types-D03Tellv.d.ts +0 -114
- package/dist/esm/generateApi-Bv02Xt5y.d.ts +0 -56
- package/dist/esm/index.d.ts +0 -1859
- package/dist/esm/index.js +0 -32
- package/dist/esm/public-functions/executeMultipleRoutes.d.ts +0 -80
- package/dist/esm/public-functions/executeMultipleRoutes.js +0 -18
- package/dist/esm/public-functions/executeRoute.d.ts +0 -12
- package/dist/esm/public-functions/executeRoute.js +0 -18
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.d.ts +0 -8
- package/dist/esm/public-functions/getCosmosGasAmountForMessage.js +0 -3
- package/dist/esm/public-functions/getEvmGasAmountForMessage.d.ts +0 -14
- package/dist/esm/public-functions/getEvmGasAmountForMessage.js +0 -2
- package/dist/esm/public-functions/getFeeInfoForChain.d.ts +0 -9
- package/dist/esm/public-functions/getFeeInfoForChain.js +0 -5
- package/dist/esm/public-functions/getRecommendedGasPrice.d.ts +0 -9
- package/dist/esm/public-functions/getRecommendedGasPrice.js +0 -6
- package/dist/esm/public-functions/getRouteWithGasOnReceive.d.ts +0 -20
- package/dist/esm/public-functions/getRouteWithGasOnReceive.js +0 -32
- package/dist/esm/public-functions/getSigningStargateClient.d.ts +0 -13
- package/dist/esm/public-functions/getSigningStargateClient.js +0 -6
- package/dist/esm/public-functions/setApiOptions.d.ts +0 -9
- package/dist/esm/public-functions/setApiOptions.js +0 -3
- package/dist/esm/public-functions/setClientOptions.d.ts +0 -11
- package/dist/esm/public-functions/setClientOptions.js +0 -7
- package/dist/esm/public-functions/subscribeToRouteStatus.d.ts +0 -12
- package/dist/esm/public-functions/subscribeToRouteStatus.js +0 -5
- package/dist/esm/public-functions/validateCosmosGasBalance.d.ts +0 -44
- package/dist/esm/public-functions/validateCosmosGasBalance.js +0 -9
- package/dist/esm/public-functions/waitForTransaction.d.ts +0 -1279
- package/dist/esm/public-functions/waitForTransaction.js +0 -5
- package/dist/esm/setClientOptions-CTwe8YVX.d.ts +0 -76
- package/dist/esm/swaggerTypes-CzGbnX_b.d.ts +0 -2067
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { createValidAddressList, executeTransactions } from './chunk-ZVFYCNA5.js';
|
|
2
|
-
import { updateRouteDetails, executeAndSubscribeToRouteStatus } from './chunk-3DIX6KRJ.js';
|
|
3
|
-
import { messages } from './chunk-P36PE4CR.js';
|
|
4
|
-
import { ApiState } from './chunk-F66EKL3W.js';
|
|
5
|
-
|
|
6
|
-
// src/public-functions/executeRoute.ts
|
|
7
|
-
var executeRoute = async (options) => {
|
|
8
|
-
const { route, userAddresses, appendCosmosMsgs, timeoutSeconds } = options;
|
|
9
|
-
const { id: routeId } = updateRouteDetails({
|
|
10
|
-
status: "unconfirmed",
|
|
11
|
-
options
|
|
12
|
-
});
|
|
13
|
-
const addressList = await createValidAddressList({
|
|
14
|
-
userAddresses,
|
|
15
|
-
route
|
|
16
|
-
});
|
|
17
|
-
const response = await messages({
|
|
18
|
-
timeoutSeconds,
|
|
19
|
-
amountIn: route?.amountIn,
|
|
20
|
-
amountOut: route.estimatedAmountOut || "0",
|
|
21
|
-
sourceAssetChainId: route?.sourceAssetChainId,
|
|
22
|
-
sourceAssetDenom: route?.sourceAssetDenom,
|
|
23
|
-
destAssetChainId: route?.destAssetChainId,
|
|
24
|
-
destAssetDenom: route?.destAssetDenom,
|
|
25
|
-
operations: route?.operations,
|
|
26
|
-
addressList,
|
|
27
|
-
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
28
|
-
chainIdsToAffiliates: ApiState.chainIdsToAffiliates,
|
|
29
|
-
postRouteHandler: options.postRouteHandler,
|
|
30
|
-
feePayerAddress: options.svmFeePayer?.address
|
|
31
|
-
});
|
|
32
|
-
if (appendCosmosMsgs) {
|
|
33
|
-
Object.entries(appendCosmosMsgs).forEach(([chainId, msgs]) => {
|
|
34
|
-
const txIndex = response?.txs?.findIndex(
|
|
35
|
-
(tx2) => "cosmosTx" in tx2 && tx2.cosmosTx.chainId === chainId
|
|
36
|
-
);
|
|
37
|
-
if (txIndex === void 0 || txIndex === -1) return;
|
|
38
|
-
const tx = response?.txs?.[txIndex];
|
|
39
|
-
if (tx && "cosmosTx" in tx) {
|
|
40
|
-
tx.cosmosTx.msgs?.unshift(...msgs);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
const { transactionDetails, executeTransaction } = await executeTransactions({ ...options, routeId, txs: response?.txs });
|
|
45
|
-
await executeAndSubscribeToRouteStatus({
|
|
46
|
-
transactionDetails,
|
|
47
|
-
executeTransaction,
|
|
48
|
-
routeId,
|
|
49
|
-
options
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export { executeRoute };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { getFeeInfoForChain } from './chunk-5WYMRZIO.js';
|
|
2
|
-
import { Decimal } from '@cosmjs/math';
|
|
3
|
-
import { GasPrice } from '@cosmjs/stargate';
|
|
4
|
-
import { BigNumber } from 'bignumber.js';
|
|
5
|
-
|
|
6
|
-
var getRecommendedGasPrice = async (props) => {
|
|
7
|
-
const feeInfo = await getFeeInfoForChain(props);
|
|
8
|
-
if (!feeInfo || !feeInfo.gasPrice) {
|
|
9
|
-
return void 0;
|
|
10
|
-
}
|
|
11
|
-
let price = feeInfo.gasPrice.average;
|
|
12
|
-
if (price === "") {
|
|
13
|
-
price = feeInfo.gasPrice.high;
|
|
14
|
-
}
|
|
15
|
-
if (price === "") {
|
|
16
|
-
price = feeInfo.gasPrice.low;
|
|
17
|
-
}
|
|
18
|
-
if (!price) return;
|
|
19
|
-
return new GasPrice(Decimal.fromUserInput(BigNumber(price).toFixed(), 18), feeInfo.denom);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export { getRecommendedGasPrice };
|
|
@@ -1,379 +0,0 @@
|
|
|
1
|
-
import { BaseAccount as BaseAccount$1, base64FromBytes, bytesFromBase64, isSet } from './chunk-RTDD7HZ3.js';
|
|
2
|
-
import { chains, findFirstWorkingEndpoint } from './chunk-NUHMTWHP.js';
|
|
3
|
-
import { ClientState } from './chunk-J24LYWJE.js';
|
|
4
|
-
import { accountFromAny, SigningStargateClient } from '@cosmjs/stargate';
|
|
5
|
-
import { assertDefinedAndNotNull } from '@cosmjs/utils';
|
|
6
|
-
import { BinaryWriter, BinaryReader } from 'cosmjs-types/binary.js';
|
|
7
|
-
import { BaseAccount } from 'cosmjs-types/cosmos/auth/v1beta1/auth.js';
|
|
8
|
-
import { Coin } from 'cosmjs-types/cosmos/base/v1beta1/coin.js';
|
|
9
|
-
import { decodePubkey } from '@cosmjs/proto-signing';
|
|
10
|
-
import { PubKey } from 'cosmjs-types/cosmos/crypto/secp256k1/keys.js';
|
|
11
|
-
import { encodeSecp256k1Pubkey } from '@cosmjs/amino';
|
|
12
|
-
import _m0 from 'protobufjs/minimal.js';
|
|
13
|
-
|
|
14
|
-
var createBaseVestingAccount = () => {
|
|
15
|
-
return {
|
|
16
|
-
// @ts-expect-error
|
|
17
|
-
baseAccount: void 0,
|
|
18
|
-
originalVesting: [],
|
|
19
|
-
delegatedFree: [],
|
|
20
|
-
delegatedVesting: [],
|
|
21
|
-
endTime: BigInt(0)
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
var BaseVestingAccount = {
|
|
25
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
26
|
-
if (message.baseAccount !== void 0) {
|
|
27
|
-
BaseAccount.encode(
|
|
28
|
-
message.baseAccount,
|
|
29
|
-
writer.uint32(10).fork()
|
|
30
|
-
).ldelim();
|
|
31
|
-
}
|
|
32
|
-
for (const v of message.originalVesting) {
|
|
33
|
-
Coin.encode(v, writer.uint32(18).fork()).ldelim();
|
|
34
|
-
}
|
|
35
|
-
for (const v of message.delegatedFree) {
|
|
36
|
-
Coin.encode(v, writer.uint32(26).fork()).ldelim();
|
|
37
|
-
}
|
|
38
|
-
for (const v of message.delegatedVesting) {
|
|
39
|
-
Coin.encode(v, writer.uint32(34).fork()).ldelim();
|
|
40
|
-
}
|
|
41
|
-
if (message.endTime !== BigInt(0)) {
|
|
42
|
-
writer.uint32(40).int64(message.endTime);
|
|
43
|
-
}
|
|
44
|
-
return writer;
|
|
45
|
-
},
|
|
46
|
-
decode(input, length) {
|
|
47
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
48
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
49
|
-
const message = createBaseVestingAccount();
|
|
50
|
-
while (reader.pos < end) {
|
|
51
|
-
const tag = reader.uint32();
|
|
52
|
-
switch (tag >>> 3) {
|
|
53
|
-
case 1:
|
|
54
|
-
message.baseAccount = BaseAccount.decode(reader, reader.uint32());
|
|
55
|
-
break;
|
|
56
|
-
case 2:
|
|
57
|
-
message.originalVesting.push(Coin.decode(reader, reader.uint32()));
|
|
58
|
-
break;
|
|
59
|
-
case 3:
|
|
60
|
-
message.delegatedFree.push(Coin.decode(reader, reader.uint32()));
|
|
61
|
-
break;
|
|
62
|
-
case 4:
|
|
63
|
-
message.delegatedVesting.push(Coin.decode(reader, reader.uint32()));
|
|
64
|
-
break;
|
|
65
|
-
case 5:
|
|
66
|
-
message.endTime = reader.int64();
|
|
67
|
-
break;
|
|
68
|
-
default:
|
|
69
|
-
reader.skipType(tag & 7);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return message;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
function createBasePeriod() {
|
|
77
|
-
return {
|
|
78
|
-
startTime: BigInt(0),
|
|
79
|
-
length: BigInt(0),
|
|
80
|
-
amount: [],
|
|
81
|
-
actionType: 0
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
var Period = {
|
|
85
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
86
|
-
if (message.startTime !== BigInt(0)) {
|
|
87
|
-
writer.uint32(8).int64(message.startTime);
|
|
88
|
-
}
|
|
89
|
-
if (message.length !== BigInt(0)) {
|
|
90
|
-
writer.uint32(16).int64(message.length);
|
|
91
|
-
}
|
|
92
|
-
for (const v of message.amount) {
|
|
93
|
-
Coin.encode(v, writer.uint32(26).fork()).ldelim();
|
|
94
|
-
}
|
|
95
|
-
if (message.actionType !== 0) {
|
|
96
|
-
writer.uint32(32).int32(message.actionType);
|
|
97
|
-
}
|
|
98
|
-
return writer;
|
|
99
|
-
},
|
|
100
|
-
decode(input, length) {
|
|
101
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
102
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
103
|
-
const message = createBasePeriod();
|
|
104
|
-
while (reader.pos < end) {
|
|
105
|
-
const tag = reader.uint32();
|
|
106
|
-
switch (tag >>> 3) {
|
|
107
|
-
case 1:
|
|
108
|
-
message.startTime = reader.int64();
|
|
109
|
-
break;
|
|
110
|
-
case 2:
|
|
111
|
-
message.length = reader.int64();
|
|
112
|
-
break;
|
|
113
|
-
case 3:
|
|
114
|
-
message.amount.push(Coin.decode(reader, reader.uint32()));
|
|
115
|
-
break;
|
|
116
|
-
case 4:
|
|
117
|
-
message.actionType = reader.int32();
|
|
118
|
-
break;
|
|
119
|
-
default:
|
|
120
|
-
reader.skipType(tag & 7);
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return message;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
function createBaseStridePeriodicVestingAccount() {
|
|
128
|
-
return {
|
|
129
|
-
//eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
130
|
-
//@ts-ignore
|
|
131
|
-
baseVestingAccount: void 0,
|
|
132
|
-
vestingPeriods: []
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
var StridePeriodicVestingAccount = {
|
|
136
|
-
encode(message, writer = BinaryWriter.create()) {
|
|
137
|
-
if (message.baseVestingAccount !== void 0) {
|
|
138
|
-
BaseVestingAccount.encode(
|
|
139
|
-
message.baseVestingAccount,
|
|
140
|
-
writer.uint32(10).fork()
|
|
141
|
-
).ldelim();
|
|
142
|
-
}
|
|
143
|
-
for (const v of message.vestingPeriods) {
|
|
144
|
-
Period.encode(v, writer.uint32(26).fork()).ldelim();
|
|
145
|
-
}
|
|
146
|
-
return writer;
|
|
147
|
-
},
|
|
148
|
-
decode(input, length) {
|
|
149
|
-
const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
|
|
150
|
-
const end = length === void 0 ? reader.len : reader.pos + length;
|
|
151
|
-
const message = createBaseStridePeriodicVestingAccount();
|
|
152
|
-
while (reader.pos < end) {
|
|
153
|
-
const tag = reader.uint32();
|
|
154
|
-
switch (tag >>> 3) {
|
|
155
|
-
case 1:
|
|
156
|
-
message.baseVestingAccount = BaseVestingAccount.decode(
|
|
157
|
-
reader,
|
|
158
|
-
reader.uint32()
|
|
159
|
-
);
|
|
160
|
-
break;
|
|
161
|
-
case 3:
|
|
162
|
-
message.vestingPeriods.push(Period.decode(reader, reader.uint32()));
|
|
163
|
-
break;
|
|
164
|
-
default:
|
|
165
|
-
reader.skipType(tag & 7);
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return message;
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
function createBaseEthAccount() {
|
|
173
|
-
return {
|
|
174
|
-
baseAccount: void 0,
|
|
175
|
-
codeHash: new Uint8Array()
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
var EthAccount = {
|
|
179
|
-
typeUrl: "/injective.types.v1beta1.EthAccount",
|
|
180
|
-
encode(message, writer = _m0.Writer.create()) {
|
|
181
|
-
if (message.baseAccount !== void 0) {
|
|
182
|
-
BaseAccount$1.encode(message.baseAccount, writer.uint32(10).fork()).ldelim();
|
|
183
|
-
}
|
|
184
|
-
if (message.codeHash.length !== 0) {
|
|
185
|
-
writer.uint32(18).bytes(message.codeHash);
|
|
186
|
-
}
|
|
187
|
-
return writer;
|
|
188
|
-
},
|
|
189
|
-
decode(input, length) {
|
|
190
|
-
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
|
191
|
-
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
192
|
-
const message = createBaseEthAccount();
|
|
193
|
-
while (reader.pos < end) {
|
|
194
|
-
const tag = reader.uint32();
|
|
195
|
-
switch (tag >>> 3) {
|
|
196
|
-
case 1:
|
|
197
|
-
message.baseAccount = BaseAccount$1.decode(reader, reader.uint32());
|
|
198
|
-
break;
|
|
199
|
-
case 2:
|
|
200
|
-
message.codeHash = reader.bytes();
|
|
201
|
-
break;
|
|
202
|
-
default:
|
|
203
|
-
reader.skipType(tag & 7);
|
|
204
|
-
break;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return message;
|
|
208
|
-
},
|
|
209
|
-
fromJSON(object) {
|
|
210
|
-
return {
|
|
211
|
-
baseAccount: isSet(object.baseAccount) ? BaseAccount$1.fromJSON(object.baseAccount) : void 0,
|
|
212
|
-
codeHash: isSet(object.codeHash) ? bytesFromBase64(object.codeHash) : new Uint8Array()
|
|
213
|
-
};
|
|
214
|
-
},
|
|
215
|
-
toJSON(message) {
|
|
216
|
-
const obj = {};
|
|
217
|
-
message.baseAccount !== void 0 && (obj.baseAccount = message.baseAccount ? BaseAccount$1.toJSON(message.baseAccount) : void 0);
|
|
218
|
-
message.codeHash !== void 0 && (obj.codeHash = base64FromBytes(message.codeHash !== void 0 ? message.codeHash : new Uint8Array()));
|
|
219
|
-
return obj;
|
|
220
|
-
},
|
|
221
|
-
fromPartial(object) {
|
|
222
|
-
const message = createBaseEthAccount();
|
|
223
|
-
message.baseAccount = object.baseAccount !== void 0 && object.baseAccount !== null ? BaseAccount$1.fromPartial(object.baseAccount) : void 0;
|
|
224
|
-
message.codeHash = object.codeHash ?? new Uint8Array();
|
|
225
|
-
return message;
|
|
226
|
-
},
|
|
227
|
-
fromAmino(object) {
|
|
228
|
-
const message = createBaseEthAccount();
|
|
229
|
-
if (object.base_account !== void 0 && object.base_account !== null) {
|
|
230
|
-
message.baseAccount = BaseAccount$1.fromAmino(object.base_account);
|
|
231
|
-
}
|
|
232
|
-
if (object.code_hash !== void 0 && object.code_hash !== null) {
|
|
233
|
-
message.codeHash = bytesFromBase64(object.code_hash);
|
|
234
|
-
}
|
|
235
|
-
return message;
|
|
236
|
-
},
|
|
237
|
-
toAmino(message) {
|
|
238
|
-
const obj = {};
|
|
239
|
-
obj.base_account = message.baseAccount ? BaseAccount$1.toAmino(message.baseAccount) : void 0;
|
|
240
|
-
obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : void 0;
|
|
241
|
-
return obj;
|
|
242
|
-
},
|
|
243
|
-
fromAminoMsg(object) {
|
|
244
|
-
return EthAccount.fromAmino(object.value);
|
|
245
|
-
},
|
|
246
|
-
fromProtoMsg(message) {
|
|
247
|
-
return EthAccount.decode(message.value);
|
|
248
|
-
},
|
|
249
|
-
toProto(message) {
|
|
250
|
-
return EthAccount.encode(message).finish();
|
|
251
|
-
},
|
|
252
|
-
toProtoMsg(message) {
|
|
253
|
-
return {
|
|
254
|
-
typeUrl: "/injective.types.v1beta1.EthAccount",
|
|
255
|
-
value: EthAccount.encode(message).finish()
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
// src/registry.ts
|
|
261
|
-
var accountParser = (acc) => {
|
|
262
|
-
switch (acc.typeUrl) {
|
|
263
|
-
case "/stride.vesting.StridePeriodicVestingAccount": {
|
|
264
|
-
const baseAccount = StridePeriodicVestingAccount.decode(acc.value).baseVestingAccount?.baseAccount;
|
|
265
|
-
assertDefinedAndNotNull(baseAccount);
|
|
266
|
-
return {
|
|
267
|
-
address: baseAccount.address,
|
|
268
|
-
pubkey: baseAccount.pubKey ? decodePubkey(baseAccount.pubKey) : null,
|
|
269
|
-
accountNumber: Number(baseAccount.accountNumber),
|
|
270
|
-
sequence: Number(baseAccount.sequence)
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
case "/injective.types.v1beta1.EthAccount":
|
|
274
|
-
return accountEthParser(
|
|
275
|
-
acc,
|
|
276
|
-
"/injective.crypto.v1beta1.ethsecp256k1.PubKey"
|
|
277
|
-
);
|
|
278
|
-
case "/ethermint.types.v1.EthAccount":
|
|
279
|
-
return accountEthParser(acc, "/ethermint.crypto.v1.ethsecp256k1.PubKey");
|
|
280
|
-
default: {
|
|
281
|
-
if (acc.typeUrl === "/cosmos.auth.v1beta1.BaseAccount") {
|
|
282
|
-
const { address, pubKey, accountNumber, sequence } = BaseAccount.decode(
|
|
283
|
-
acc.value
|
|
284
|
-
);
|
|
285
|
-
switch (pubKey?.typeUrl) {
|
|
286
|
-
case "/initia.crypto.v1beta1.ethsecp256k1.PubKey":
|
|
287
|
-
case "/ethermint.crypto.v1.ethsecp256k1.PubKey":
|
|
288
|
-
case "/cosmos.evm.crypto.v1.ethsecp256k1.PubKey": {
|
|
289
|
-
const { key } = PubKey.decode(pubKey.value);
|
|
290
|
-
const pk = encodeSecp256k1Pubkey(key);
|
|
291
|
-
return {
|
|
292
|
-
address,
|
|
293
|
-
pubkey: pk,
|
|
294
|
-
accountNumber: Number(accountNumber),
|
|
295
|
-
sequence: Number(sequence)
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
return accountFromAny(acc);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
var accountEthParser = (ethAccount, pubKeyTypeUrl = "/injective.crypto.v1beta1.ethsecp256k1.PubKey") => {
|
|
305
|
-
const account = EthAccount.decode(
|
|
306
|
-
ethAccount.value
|
|
307
|
-
);
|
|
308
|
-
const baseAccount = account.baseAccount;
|
|
309
|
-
const pubKey = baseAccount.pubKey;
|
|
310
|
-
return {
|
|
311
|
-
address: baseAccount.address,
|
|
312
|
-
pubkey: pubKey ? {
|
|
313
|
-
type: pubKeyTypeUrl,
|
|
314
|
-
value: Buffer.from(pubKey.value).toString("base64")
|
|
315
|
-
} : null,
|
|
316
|
-
accountNumber: parseInt(baseAccount.accountNumber.toString(), 10),
|
|
317
|
-
sequence: parseInt(baseAccount.sequence.toString(), 10)
|
|
318
|
-
};
|
|
319
|
-
};
|
|
320
|
-
|
|
321
|
-
// src/private-functions/getRpcEndpointForChain.ts
|
|
322
|
-
var getRpcEndpointForChain = async (chainId) => {
|
|
323
|
-
if (ClientState.endpointOptions.getRpcEndpointForChain) {
|
|
324
|
-
return ClientState.endpointOptions.getRpcEndpointForChain(chainId);
|
|
325
|
-
}
|
|
326
|
-
if (ClientState.endpointOptions.endpoints && ClientState.endpointOptions.endpoints[chainId]) {
|
|
327
|
-
const endpointOptions = ClientState.endpointOptions.endpoints[chainId];
|
|
328
|
-
if (endpointOptions?.rpc) {
|
|
329
|
-
return endpointOptions.rpc;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
console.warn(
|
|
333
|
-
"Warning: You are using unreliable public endpoints. We strongly recommend overriding them via endpointOptions for use beyond development settings."
|
|
334
|
-
);
|
|
335
|
-
const chain = chains().find((chain2) => chain2.chainId === chainId);
|
|
336
|
-
if (!chain) {
|
|
337
|
-
throw new Error(`getRpcEndpointForChain: failed to find chain id '${chainId}' in registry`);
|
|
338
|
-
}
|
|
339
|
-
if (chain.apis?.rpc?.length === 0 || !chain.apis?.rpc) {
|
|
340
|
-
throw new Error(
|
|
341
|
-
`getRpcEndpointForChain error: failed to find RPC endpoint for chain id '${chainId}'`
|
|
342
|
-
);
|
|
343
|
-
}
|
|
344
|
-
const endpoints = chain.apis?.rpc?.map((api) => api.address);
|
|
345
|
-
const endpoint = await findFirstWorkingEndpoint(endpoints, "rpc");
|
|
346
|
-
if (!endpoint) {
|
|
347
|
-
throw new Error(
|
|
348
|
-
`getRpcEndpointForChain error: failed to find RPC endpoint for chain id '${chainId}'`
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
return endpoint;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
// src/public-functions/getSigningStargateClient.ts
|
|
355
|
-
var getSigningStargateClient = async ({
|
|
356
|
-
chainId,
|
|
357
|
-
getOfflineSigner
|
|
358
|
-
}) => {
|
|
359
|
-
if (!getOfflineSigner) {
|
|
360
|
-
throw new Error("'getCosmosSigner' is not provided or configured in skip router");
|
|
361
|
-
}
|
|
362
|
-
if (!ClientState.signingStargateClientByChainId?.[chainId]) {
|
|
363
|
-
const [signer, endpoint] = await Promise.all([
|
|
364
|
-
getOfflineSigner(chainId),
|
|
365
|
-
getRpcEndpointForChain(chainId)
|
|
366
|
-
]);
|
|
367
|
-
ClientState.signingStargateClientByChainId[chainId] = await SigningStargateClient.connectWithSigner(endpoint, signer, {
|
|
368
|
-
aminoTypes: ClientState.aminoTypes,
|
|
369
|
-
registry: ClientState.registry,
|
|
370
|
-
accountParser
|
|
371
|
-
});
|
|
372
|
-
}
|
|
373
|
-
return {
|
|
374
|
-
stargateClient: ClientState.signingStargateClientByChainId[chainId],
|
|
375
|
-
signer: await getOfflineSigner(chainId)
|
|
376
|
-
};
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
export { accountParser, getRpcEndpointForChain, getSigningStargateClient };
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { trackTransaction } from './chunk-SXBG57J3.js';
|
|
2
|
-
import { transactionStatus } from './chunk-N4PTRCNT.js';
|
|
3
|
-
import { wait } from './chunk-F66EKL3W.js';
|
|
4
|
-
|
|
5
|
-
// src/public-functions/waitForTransaction.ts
|
|
6
|
-
var waitForTransaction = async ({
|
|
7
|
-
chainId,
|
|
8
|
-
txHash,
|
|
9
|
-
explorerLink,
|
|
10
|
-
doNotTrack = false,
|
|
11
|
-
onStatusUpdated,
|
|
12
|
-
onError,
|
|
13
|
-
onTransactionTracked,
|
|
14
|
-
isCancelled,
|
|
15
|
-
...trackTxPollingOptions
|
|
16
|
-
}) => {
|
|
17
|
-
try {
|
|
18
|
-
if (!explorerLink && !doNotTrack) {
|
|
19
|
-
const response = await trackTransaction({
|
|
20
|
-
chainId,
|
|
21
|
-
txHash,
|
|
22
|
-
...trackTxPollingOptions
|
|
23
|
-
});
|
|
24
|
-
explorerLink = response.explorerLink;
|
|
25
|
-
await onTransactionTracked?.({ txHash, chainId, explorerLink });
|
|
26
|
-
}
|
|
27
|
-
} catch (error) {
|
|
28
|
-
console.warn(`track failed for txHash:${txHash}, chainId: ${chainId}`);
|
|
29
|
-
}
|
|
30
|
-
while (true) {
|
|
31
|
-
if (isCancelled?.()) {
|
|
32
|
-
throw new Error("waitForTransaction was aborted");
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
const txStatusResponse = await transactionStatus({
|
|
36
|
-
chainId,
|
|
37
|
-
txHash
|
|
38
|
-
});
|
|
39
|
-
onStatusUpdated?.(txStatusResponse);
|
|
40
|
-
if (txStatusResponse.state === "STATE_COMPLETED_SUCCESS") {
|
|
41
|
-
return txStatusResponse;
|
|
42
|
-
}
|
|
43
|
-
if (txStatusResponse.state === "STATE_COMPLETED_ERROR") {
|
|
44
|
-
throw new Error(`${txStatusResponse.error?.type}: ${txStatusResponse.error?.message}`);
|
|
45
|
-
}
|
|
46
|
-
if (txStatusResponse.state === "STATE_ABANDONED") {
|
|
47
|
-
throw new Error("Tracking for the transaction has been abandoned");
|
|
48
|
-
}
|
|
49
|
-
await wait(1e3);
|
|
50
|
-
} catch (error) {
|
|
51
|
-
onError?.(error);
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
var waitForTransactionWithCancel = (props) => {
|
|
57
|
-
let isCancelled = false;
|
|
58
|
-
const cancel = () => {
|
|
59
|
-
isCancelled = true;
|
|
60
|
-
};
|
|
61
|
-
const wrappedPromise = waitForTransaction({ ...props, isCancelled: () => isCancelled });
|
|
62
|
-
return { promise: wrappedPromise, cancel };
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { waitForTransaction, waitForTransactionWithCancel };
|