@skip-go/client 1.0.2 → 1.0.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/dist/api/getAssets.cjs +15 -0
- package/dist/api/{getAssets.d.ts → getAssets.d.cts} +2 -2
- package/dist/api/getAssetsBetweenChains.cjs +11 -0
- package/dist/api/{getAssetsBetweenChains.d.ts → getAssetsBetweenChains.d.cts} +2 -2
- package/dist/api/getBridges.cjs +11 -0
- package/dist/api/{getBridges.d.ts → getBridges.d.cts} +2 -2
- package/dist/api/getChains.cjs +11 -0
- package/dist/api/{getChains.d.ts → getChains.d.cts} +2 -2
- package/dist/api/getVenues.cjs +11 -0
- package/dist/api/{getVenues.d.ts → getVenues.d.cts} +1 -1
- package/dist/api/postAssetsFromSource.cjs +12 -0
- package/dist/api/{postAssetsFromSource.d.ts → postAssetsFromSource.d.cts} +2 -2
- package/dist/api/postBalances.cjs +11 -0
- package/dist/api/{postBalances.d.ts → postBalances.d.cts} +3 -3
- package/dist/api/postIbcOriginAssets.cjs +11 -0
- package/dist/api/{postIbcOriginAssets.d.ts → postIbcOriginAssets.d.cts} +1 -1
- package/dist/api/postMessages.cjs +11 -0
- package/dist/api/{postMessages.d.ts → postMessages.d.cts} +186 -186
- package/dist/api/postMessagesDirect.cjs +11 -0
- package/dist/api/{postMessagesDirect.d.ts → postMessagesDirect.d.cts} +185 -185
- package/dist/api/postRecommendAssets.cjs +11 -0
- package/dist/api/{postRecommendAssets.d.ts → postRecommendAssets.d.cts} +2 -2
- package/dist/api/postRoute.cjs +11 -0
- package/dist/api/{postRoute.d.ts → postRoute.d.cts} +163 -163
- package/dist/api/postSubmitTransaction.cjs +11 -0
- package/dist/api/{postSubmitTransaction.d.ts → postSubmitTransaction.d.cts} +1 -1
- package/dist/api/postTrackTransaction.cjs +11 -0
- package/dist/api/{postTrackTransaction.d.ts → postTrackTransaction.d.cts} +1 -1
- package/dist/api/postTransactionStatus.cjs +11 -0
- package/dist/api/{postTransactionStatus.d.ts → postTransactionStatus.d.cts} +3 -3
- package/dist/chunk-32MRDO7V.cjs +12 -0
- package/dist/chunk-44PBLFB5.cjs +24 -0
- package/dist/{chunk-VQ5SIQWU.js → chunk-4R6OCWRR.cjs} +3 -1
- package/dist/{chunk-SQGWZAUC.js → chunk-5IAEEEOQ.cjs} +243 -221
- package/dist/{chunk-4JJWOILI.js → chunk-77ITCT75.cjs} +5 -3
- package/dist/{chunk-3OZQ35X3.js → chunk-7OIZPQJB.cjs} +174 -111
- package/dist/{chunk-JTIHU43D.js → chunk-7SK3IFXJ.cjs} +6 -1
- package/dist/chunk-DAMZSSOH.cjs +12 -0
- package/dist/{chunk-BRMONS6A.js → chunk-ED2OY55G.cjs} +11 -5
- package/dist/{chunk-735L35R6.js → chunk-G7BBDZ7C.cjs} +208 -186
- package/dist/{chunk-W6TBGBV3.js → chunk-HAR3IXDE.cjs} +31 -1
- package/dist/chunk-ISHM4QWP.cjs +16 -0
- package/dist/{chunk-VMPFHQ7U.js → chunk-J4LI33TK.cjs} +11 -9
- package/dist/chunk-KDN7RCGP.cjs +13 -0
- package/dist/{chunk-SWYON2RG.js → chunk-KZOSEIWH.cjs} +4 -1
- package/dist/chunk-L5V5PASH.cjs +12 -0
- package/dist/chunk-LXYLWTNZ.cjs +12 -0
- package/dist/{chunk-C2EDPY6J.js → chunk-PNWIJSMA.cjs} +5 -3
- package/dist/{chunk-PRQ2NHRZ.js → chunk-RDOSNDAQ.cjs} +5 -3
- package/dist/{chunk-GARVPN2H.js → chunk-SFMBRLUS.cjs} +6 -4
- package/dist/{chunk-3N7XVGLX.js → chunk-SW3SEQMJ.cjs} +51 -47
- package/dist/chunk-URLFWBSC.cjs +11 -0
- package/dist/{chunk-KNV72XRZ.js → chunk-VI7UMBQ7.cjs} +5 -3
- package/dist/{chunk-TW77BXMT.js → chunk-ZNXE6PUV.cjs} +9 -7
- package/dist/{client-types-CxjtffyG.d.ts → client-types-qvyKvyFh.d.cts} +1 -1
- package/dist/{executeRoute-BKvMVd1I.d.ts → executeRoute-BKRpODCc.d.cts} +3 -3
- package/dist/{generateApi-DqCp36fX.d.ts → generateApi-C0amiydg.d.cts} +1 -1
- package/dist/index.cjs +209 -0
- package/dist/{index.d.ts → index.d.cts} +25 -25
- package/dist/public-functions/executeRoute.cjs +21 -0
- package/dist/public-functions/{executeRoute.d.ts → executeRoute.d.cts} +4 -4
- package/dist/public-functions/getFeeInfoForChain.cjs +14 -0
- package/dist/public-functions/{getFeeInfoForChain.d.ts → getFeeInfoForChain.d.cts} +2 -2
- package/dist/public-functions/getRecommendedGasPrice.cjs +16 -0
- package/dist/public-functions/{getRecommendedGasPrice.d.ts → getRecommendedGasPrice.d.cts} +1 -1
- package/dist/public-functions/getSigningStargateClient.cjs +13 -0
- package/dist/public-functions/setApiOptions.cjs +11 -0
- package/dist/public-functions/{setApiOptions.d.ts → setApiOptions.d.cts} +2 -2
- package/dist/public-functions/setClientOptions.cjs +13 -0
- package/dist/public-functions/setClientOptions.d.cts +9 -0
- package/dist/{setClientOptions-DbanEIwL.d.ts → setClientOptions-CT6CHI9I.d.cts} +2 -2
- package/package.json +6 -6
- package/dist/api/getAssets.js +0 -2
- package/dist/api/getAssetsBetweenChains.js +0 -2
- package/dist/api/getBridges.js +0 -2
- package/dist/api/getChains.js +0 -2
- package/dist/api/getVenues.js +0 -2
- package/dist/api/postAssetsFromSource.js +0 -3
- package/dist/api/postBalances.js +0 -2
- package/dist/api/postIbcOriginAssets.js +0 -2
- package/dist/api/postMessages.js +0 -2
- package/dist/api/postMessagesDirect.js +0 -2
- package/dist/api/postRecommendAssets.js +0 -2
- package/dist/api/postRoute.js +0 -2
- package/dist/api/postSubmitTransaction.js +0 -2
- package/dist/api/postTrackTransaction.js +0 -2
- package/dist/api/postTransactionStatus.js +0 -2
- package/dist/chunk-33K6EESX.js +0 -10
- package/dist/chunk-BQTQJQ5E.js +0 -10
- package/dist/chunk-BRJDNGYH.js +0 -22
- package/dist/chunk-DW4U6YI6.js +0 -10
- package/dist/chunk-MGVXJ2U4.js +0 -11
- package/dist/chunk-MTMPHY3Y.js +0 -9
- package/dist/chunk-RDRDFJQE.js +0 -10
- package/dist/chunk-RMP3HM5N.js +0 -14
- package/dist/index.js +0 -24
- package/dist/public-functions/executeRoute.js +0 -12
- package/dist/public-functions/getFeeInfoForChain.js +0 -5
- package/dist/public-functions/getRecommendedGasPrice.js +0 -7
- package/dist/public-functions/getSigningStargateClient.js +0 -4
- package/dist/public-functions/setApiOptions.js +0 -2
- package/dist/public-functions/setClientOptions.d.ts +0 -9
- package/dist/public-functions/setClientOptions.js +0 -4
- /package/dist/{apiState-CdzxTxYd.d.ts → apiState-CdzxTxYd.d.cts} +0 -0
- /package/dist/public-functions/{getSigningStargateClient.d.ts → getSigningStargateClient.d.cts} +0 -0
- /package/dist/{swaggerTypes-O9-gvCT1.d.ts → swaggerTypes-O9-gvCT1.d.cts} +0 -0
|
@@ -1,49 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk4R6OCWRR_cjs = require('./chunk-4R6OCWRR.cjs');
|
|
4
|
+
var chunkKZOSEIWH_cjs = require('./chunk-KZOSEIWH.cjs');
|
|
5
|
+
var chunkSW3SEQMJ_cjs = require('./chunk-SW3SEQMJ.cjs');
|
|
6
|
+
var chunk7SK3IFXJ_cjs = require('./chunk-7SK3IFXJ.cjs');
|
|
7
|
+
var chunk7OIZPQJB_cjs = require('./chunk-7OIZPQJB.cjs');
|
|
8
|
+
var chunk32MRDO7V_cjs = require('./chunk-32MRDO7V.cjs');
|
|
9
|
+
var chunkL5V5PASH_cjs = require('./chunk-L5V5PASH.cjs');
|
|
10
|
+
var chunkKDN7RCGP_cjs = require('./chunk-KDN7RCGP.cjs');
|
|
11
|
+
var chunkDAMZSSOH_cjs = require('./chunk-DAMZSSOH.cjs');
|
|
12
|
+
var chunkED2OY55G_cjs = require('./chunk-ED2OY55G.cjs');
|
|
13
|
+
var chunkHAR3IXDE_cjs = require('./chunk-HAR3IXDE.cjs');
|
|
14
|
+
var web3_js = require('@solana/web3.js');
|
|
15
|
+
var bech32 = require('bech32');
|
|
16
|
+
var stargate = require('@cosmjs/stargate');
|
|
17
|
+
var tx_js = require('cosmjs-types/cosmos/tx/v1beta1/tx.js');
|
|
18
|
+
var signer = require('@cosmjs/proto-signing/build/signer');
|
|
19
|
+
var base64 = require('@cosmjs/encoding/build/base64');
|
|
20
|
+
var encoding = require('@cosmjs/encoding');
|
|
21
|
+
var sdkTs = require('@injectivelabs/sdk-ts');
|
|
22
|
+
var tx$2 = require('cosmjs-types/cosmos/bank/v1beta1/tx');
|
|
23
|
+
var tx$1 = require('cosmjs-types/cosmwasm/wasm/v1/tx');
|
|
24
|
+
var tx = require('cosmjs-types/ibc/applications/transfer/v1/tx');
|
|
25
|
+
var _m0 = require('protobufjs/minimal');
|
|
26
|
+
var utils = require('@injectivelabs/utils');
|
|
27
|
+
var signing = require('@cosmjs/proto-signing/build/signing');
|
|
28
|
+
var amino = require('@cosmjs/amino');
|
|
29
|
+
var protoSigning = require('@cosmjs/proto-signing');
|
|
30
|
+
var keys = require('cosmjs-types/cosmos/crypto/secp256k1/keys');
|
|
31
|
+
var any = require('cosmjs-types/google/protobuf/any');
|
|
32
|
+
var integers = require('@cosmjs/math/build/integers');
|
|
33
|
+
var signing$1 = require('cosmjs-types/cosmos/tx/signing/v1beta1/signing');
|
|
34
|
+
var viem = require('viem');
|
|
35
|
+
var decimal = require('@cosmjs/math/build/decimal');
|
|
36
|
+
|
|
37
|
+
function _interopNamespace(e) {
|
|
38
|
+
if (e && e.__esModule) return e;
|
|
39
|
+
var n = Object.create(null);
|
|
40
|
+
if (e) {
|
|
41
|
+
Object.keys(e).forEach(function (k) {
|
|
42
|
+
if (k !== 'default') {
|
|
43
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
44
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return e[k]; }
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
n.default = e;
|
|
52
|
+
return Object.freeze(n);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var _m0__namespace = /*#__PURE__*/_interopNamespace(_m0);
|
|
34
56
|
|
|
35
57
|
// src/private-functions/getRestEndpointForChain.ts
|
|
36
58
|
var getRestEndpointForChain = async (chainId) => {
|
|
37
|
-
if (ClientState.endpointOptions.getRestEndpointForChain) {
|
|
38
|
-
return ClientState.endpointOptions.getRestEndpointForChain(chainId);
|
|
59
|
+
if (chunkED2OY55G_cjs.ClientState.endpointOptions.getRestEndpointForChain) {
|
|
60
|
+
return chunkED2OY55G_cjs.ClientState.endpointOptions.getRestEndpointForChain(chainId);
|
|
39
61
|
}
|
|
40
|
-
if (ClientState.endpointOptions.endpoints && ClientState.endpointOptions.endpoints[chainId]) {
|
|
41
|
-
const endpointOptions = ClientState.endpointOptions.endpoints[chainId];
|
|
62
|
+
if (chunkED2OY55G_cjs.ClientState.endpointOptions.endpoints && chunkED2OY55G_cjs.ClientState.endpointOptions.endpoints[chainId]) {
|
|
63
|
+
const endpointOptions = chunkED2OY55G_cjs.ClientState.endpointOptions.endpoints[chainId];
|
|
42
64
|
if (endpointOptions?.rest) {
|
|
43
65
|
return endpointOptions.rest;
|
|
44
66
|
}
|
|
45
67
|
}
|
|
46
|
-
const chain = chains().find((chain2) => chain2.chain_id === chainId);
|
|
68
|
+
const chain = chunk7SK3IFXJ_cjs.chains().find((chain2) => chain2.chain_id === chainId);
|
|
47
69
|
if (!chain) {
|
|
48
70
|
throw new Error(
|
|
49
71
|
`getRestEndpointForChain error: failed to find chain id '${chainId}' in registry`
|
|
@@ -55,7 +77,7 @@ var getRestEndpointForChain = async (chainId) => {
|
|
|
55
77
|
);
|
|
56
78
|
}
|
|
57
79
|
const endpoints = chain.apis?.rest?.map((api) => api.address);
|
|
58
|
-
const endpoint = await findFirstWorkingEndpoint(endpoints, "rest");
|
|
80
|
+
const endpoint = await chunk7SK3IFXJ_cjs.findFirstWorkingEndpoint(endpoints, "rest");
|
|
59
81
|
if (!endpoint) {
|
|
60
82
|
throw new Error(
|
|
61
83
|
`getRestEndpointForChain error: failed to find REST endpoint for chain '${chainId}'`
|
|
@@ -69,9 +91,9 @@ var getAccountNumberAndSequence = async (address, chainId) => {
|
|
|
69
91
|
if (chainId.includes("dymension")) {
|
|
70
92
|
return getAccountNumberAndSequenceFromDymension(address, chainId);
|
|
71
93
|
}
|
|
72
|
-
const endpoint = await getRpcEndpointForChain(chainId);
|
|
73
|
-
const client = ClientState.signingStargateClientByChainId[chainId] ?? await StargateClient.connect(endpoint, {
|
|
74
|
-
accountParser
|
|
94
|
+
const endpoint = await chunkSW3SEQMJ_cjs.getRpcEndpointForChain(chainId);
|
|
95
|
+
const client = chunkED2OY55G_cjs.ClientState.signingStargateClientByChainId[chainId] ?? await stargate.StargateClient.connect(endpoint, {
|
|
96
|
+
accountParser: chunkSW3SEQMJ_cjs.accountParser
|
|
75
97
|
});
|
|
76
98
|
const account = await client.getAccount(address);
|
|
77
99
|
if (!account) {
|
|
@@ -85,10 +107,10 @@ var getAccountNumberAndSequence = async (address, chainId) => {
|
|
|
85
107
|
};
|
|
86
108
|
var getAccountNumberAndSequenceFromDymension = async (address, chainId) => {
|
|
87
109
|
const endpoint = await getRestEndpointForChain(chainId);
|
|
88
|
-
const jsonResponse = await createRequestClient({
|
|
110
|
+
const jsonResponse = await chunkHAR3IXDE_cjs.createRequestClient({
|
|
89
111
|
baseUrl: `${endpoint}/cosmos/auth/v1beta1/accounts/${address}`
|
|
90
112
|
}).get();
|
|
91
|
-
const response = toCamel(jsonResponse);
|
|
113
|
+
const response = chunkHAR3IXDE_cjs.toCamel(jsonResponse);
|
|
92
114
|
let sequence = 0;
|
|
93
115
|
let accountNumber = 0;
|
|
94
116
|
if (response.account.baseAccount) {
|
|
@@ -114,45 +136,45 @@ function createBaseClawbackVestingAccount() {
|
|
|
114
136
|
}
|
|
115
137
|
var ClawbackVestingAccount = {
|
|
116
138
|
typeUrl: "/evmos.vesting.v2.ClawbackVestingAccount",
|
|
117
|
-
encode(message, writer =
|
|
139
|
+
encode(message, writer = _m0__namespace.Writer.create()) {
|
|
118
140
|
if (message.baseVestingAccount !== void 0) {
|
|
119
|
-
BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim();
|
|
141
|
+
chunk7OIZPQJB_cjs.BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim();
|
|
120
142
|
}
|
|
121
143
|
if (message.funderAddress !== "") {
|
|
122
144
|
writer.uint32(18).string(message.funderAddress);
|
|
123
145
|
}
|
|
124
146
|
if (message.startTime !== void 0) {
|
|
125
|
-
Timestamp.encode(toTimestamp(message.startTime), writer.uint32(26).fork()).ldelim();
|
|
147
|
+
chunk7OIZPQJB_cjs.Timestamp.encode(chunk7OIZPQJB_cjs.toTimestamp(message.startTime), writer.uint32(26).fork()).ldelim();
|
|
126
148
|
}
|
|
127
149
|
for (const v of message.lockupPeriods) {
|
|
128
|
-
Period.encode(v, writer.uint32(34).fork()).ldelim();
|
|
150
|
+
chunk7OIZPQJB_cjs.Period.encode(v, writer.uint32(34).fork()).ldelim();
|
|
129
151
|
}
|
|
130
152
|
for (const v of message.vestingPeriods) {
|
|
131
|
-
Period.encode(v, writer.uint32(42).fork()).ldelim();
|
|
153
|
+
chunk7OIZPQJB_cjs.Period.encode(v, writer.uint32(42).fork()).ldelim();
|
|
132
154
|
}
|
|
133
155
|
return writer;
|
|
134
156
|
},
|
|
135
157
|
decode(input, length) {
|
|
136
|
-
const reader = input instanceof
|
|
158
|
+
const reader = input instanceof _m0__namespace.Reader ? input : new _m0__namespace.Reader(input);
|
|
137
159
|
let end = length === void 0 ? reader.len : reader.pos + length;
|
|
138
160
|
const message = createBaseClawbackVestingAccount();
|
|
139
161
|
while (reader.pos < end) {
|
|
140
162
|
const tag = reader.uint32();
|
|
141
163
|
switch (tag >>> 3) {
|
|
142
164
|
case 1:
|
|
143
|
-
message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32());
|
|
165
|
+
message.baseVestingAccount = chunk7OIZPQJB_cjs.BaseVestingAccount.decode(reader, reader.uint32());
|
|
144
166
|
break;
|
|
145
167
|
case 2:
|
|
146
168
|
message.funderAddress = reader.string();
|
|
147
169
|
break;
|
|
148
170
|
case 3:
|
|
149
|
-
message.startTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
|
|
171
|
+
message.startTime = chunk7OIZPQJB_cjs.fromTimestamp(chunk7OIZPQJB_cjs.Timestamp.decode(reader, reader.uint32()));
|
|
150
172
|
break;
|
|
151
173
|
case 4:
|
|
152
|
-
message.lockupPeriods.push(Period.decode(reader, reader.uint32()));
|
|
174
|
+
message.lockupPeriods.push(chunk7OIZPQJB_cjs.Period.decode(reader, reader.uint32()));
|
|
153
175
|
break;
|
|
154
176
|
case 5:
|
|
155
|
-
message.vestingPeriods.push(Period.decode(reader, reader.uint32()));
|
|
177
|
+
message.vestingPeriods.push(chunk7OIZPQJB_cjs.Period.decode(reader, reader.uint32()));
|
|
156
178
|
break;
|
|
157
179
|
default:
|
|
158
180
|
reader.skipType(tag & 7);
|
|
@@ -163,25 +185,25 @@ var ClawbackVestingAccount = {
|
|
|
163
185
|
},
|
|
164
186
|
fromJSON(object) {
|
|
165
187
|
return {
|
|
166
|
-
baseVestingAccount: isSet(object.baseVestingAccount) ? BaseVestingAccount.fromJSON(object.baseVestingAccount) : void 0,
|
|
167
|
-
funderAddress: isSet(object.funderAddress) ? String(object.funderAddress) : "",
|
|
168
|
-
startTime: isSet(object.startTime) ? fromJsonTimestamp(object.startTime) : void 0,
|
|
169
|
-
lockupPeriods: Array.isArray(object?.lockupPeriods) ? object.lockupPeriods.map((e) => Period.fromJSON(e)) : [],
|
|
170
|
-
vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e) => Period.fromJSON(e)) : []
|
|
188
|
+
baseVestingAccount: chunk7OIZPQJB_cjs.isSet(object.baseVestingAccount) ? chunk7OIZPQJB_cjs.BaseVestingAccount.fromJSON(object.baseVestingAccount) : void 0,
|
|
189
|
+
funderAddress: chunk7OIZPQJB_cjs.isSet(object.funderAddress) ? String(object.funderAddress) : "",
|
|
190
|
+
startTime: chunk7OIZPQJB_cjs.isSet(object.startTime) ? chunk7OIZPQJB_cjs.fromJsonTimestamp(object.startTime) : void 0,
|
|
191
|
+
lockupPeriods: Array.isArray(object?.lockupPeriods) ? object.lockupPeriods.map((e) => chunk7OIZPQJB_cjs.Period.fromJSON(e)) : [],
|
|
192
|
+
vestingPeriods: Array.isArray(object?.vestingPeriods) ? object.vestingPeriods.map((e) => chunk7OIZPQJB_cjs.Period.fromJSON(e)) : []
|
|
171
193
|
};
|
|
172
194
|
},
|
|
173
195
|
toJSON(message) {
|
|
174
196
|
const obj = {};
|
|
175
|
-
message.baseVestingAccount !== void 0 && (obj.baseVestingAccount = message.baseVestingAccount ? BaseVestingAccount.toJSON(message.baseVestingAccount) : void 0);
|
|
197
|
+
message.baseVestingAccount !== void 0 && (obj.baseVestingAccount = message.baseVestingAccount ? chunk7OIZPQJB_cjs.BaseVestingAccount.toJSON(message.baseVestingAccount) : void 0);
|
|
176
198
|
message.funderAddress !== void 0 && (obj.funderAddress = message.funderAddress);
|
|
177
199
|
message.startTime !== void 0 && (obj.startTime = message.startTime.toISOString());
|
|
178
200
|
if (message.lockupPeriods) {
|
|
179
|
-
obj.lockupPeriods = message.lockupPeriods.map((e) => e ? Period.toJSON(e) : void 0);
|
|
201
|
+
obj.lockupPeriods = message.lockupPeriods.map((e) => e ? chunk7OIZPQJB_cjs.Period.toJSON(e) : void 0);
|
|
180
202
|
} else {
|
|
181
203
|
obj.lockupPeriods = [];
|
|
182
204
|
}
|
|
183
205
|
if (message.vestingPeriods) {
|
|
184
|
-
obj.vestingPeriods = message.vestingPeriods.map((e) => e ? Period.toJSON(e) : void 0);
|
|
206
|
+
obj.vestingPeriods = message.vestingPeriods.map((e) => e ? chunk7OIZPQJB_cjs.Period.toJSON(e) : void 0);
|
|
185
207
|
} else {
|
|
186
208
|
obj.vestingPeriods = [];
|
|
187
209
|
}
|
|
@@ -189,40 +211,40 @@ var ClawbackVestingAccount = {
|
|
|
189
211
|
},
|
|
190
212
|
fromPartial(object) {
|
|
191
213
|
const message = createBaseClawbackVestingAccount();
|
|
192
|
-
message.baseVestingAccount = object.baseVestingAccount !== void 0 && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : void 0;
|
|
214
|
+
message.baseVestingAccount = object.baseVestingAccount !== void 0 && object.baseVestingAccount !== null ? chunk7OIZPQJB_cjs.BaseVestingAccount.fromPartial(object.baseVestingAccount) : void 0;
|
|
193
215
|
message.funderAddress = object.funderAddress ?? "";
|
|
194
216
|
message.startTime = object.startTime ?? void 0;
|
|
195
|
-
message.lockupPeriods = object.lockupPeriods?.map((e) => Period.fromPartial(e)) || [];
|
|
196
|
-
message.vestingPeriods = object.vestingPeriods?.map((e) => Period.fromPartial(e)) || [];
|
|
217
|
+
message.lockupPeriods = object.lockupPeriods?.map((e) => chunk7OIZPQJB_cjs.Period.fromPartial(e)) || [];
|
|
218
|
+
message.vestingPeriods = object.vestingPeriods?.map((e) => chunk7OIZPQJB_cjs.Period.fromPartial(e)) || [];
|
|
197
219
|
return message;
|
|
198
220
|
},
|
|
199
221
|
fromAmino(object) {
|
|
200
222
|
const message = createBaseClawbackVestingAccount();
|
|
201
223
|
if (object.base_vesting_account !== void 0 && object.base_vesting_account !== null) {
|
|
202
|
-
message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account);
|
|
224
|
+
message.baseVestingAccount = chunk7OIZPQJB_cjs.BaseVestingAccount.fromAmino(object.base_vesting_account);
|
|
203
225
|
}
|
|
204
226
|
if (object.funder_address !== void 0 && object.funder_address !== null) {
|
|
205
227
|
message.funderAddress = object.funder_address;
|
|
206
228
|
}
|
|
207
229
|
if (object.start_time !== void 0 && object.start_time !== null) {
|
|
208
|
-
message.startTime = fromTimestamp(Timestamp.fromAmino(object.start_time));
|
|
230
|
+
message.startTime = chunk7OIZPQJB_cjs.fromTimestamp(chunk7OIZPQJB_cjs.Timestamp.fromAmino(object.start_time));
|
|
209
231
|
}
|
|
210
|
-
message.lockupPeriods = object.lockup_periods?.map((e) => Period.fromAmino(e)) || [];
|
|
211
|
-
message.vestingPeriods = object.vesting_periods?.map((e) => Period.fromAmino(e)) || [];
|
|
232
|
+
message.lockupPeriods = object.lockup_periods?.map((e) => chunk7OIZPQJB_cjs.Period.fromAmino(e)) || [];
|
|
233
|
+
message.vestingPeriods = object.vesting_periods?.map((e) => chunk7OIZPQJB_cjs.Period.fromAmino(e)) || [];
|
|
212
234
|
return message;
|
|
213
235
|
},
|
|
214
236
|
toAmino(message) {
|
|
215
237
|
const obj = {};
|
|
216
|
-
obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : void 0;
|
|
238
|
+
obj.base_vesting_account = message.baseVestingAccount ? chunk7OIZPQJB_cjs.BaseVestingAccount.toAmino(message.baseVestingAccount) : void 0;
|
|
217
239
|
obj.funder_address = message.funderAddress === "" ? void 0 : message.funderAddress;
|
|
218
|
-
obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : void 0;
|
|
240
|
+
obj.start_time = message.startTime ? chunk7OIZPQJB_cjs.Timestamp.toAmino(chunk7OIZPQJB_cjs.toTimestamp(message.startTime)) : void 0;
|
|
219
241
|
if (message.lockupPeriods) {
|
|
220
|
-
obj.lockup_periods = message.lockupPeriods.map((e) => e ? Period.toAmino(e) : void 0);
|
|
242
|
+
obj.lockup_periods = message.lockupPeriods.map((e) => e ? chunk7OIZPQJB_cjs.Period.toAmino(e) : void 0);
|
|
221
243
|
} else {
|
|
222
244
|
obj.lockup_periods = message.lockupPeriods;
|
|
223
245
|
}
|
|
224
246
|
if (message.vestingPeriods) {
|
|
225
|
-
obj.vesting_periods = message.vestingPeriods.map((e) => e ? Period.toAmino(e) : void 0);
|
|
247
|
+
obj.vesting_periods = message.vestingPeriods.map((e) => e ? chunk7OIZPQJB_cjs.Period.toAmino(e) : void 0);
|
|
226
248
|
} else {
|
|
227
249
|
obj.vesting_periods = message.vestingPeriods;
|
|
228
250
|
}
|
|
@@ -257,7 +279,7 @@ function getEncodeObjectFromCosmosMessage(message) {
|
|
|
257
279
|
if (message.msgTypeUrl === "/ibc.applications.transfer.v1.MsgTransfer") {
|
|
258
280
|
return {
|
|
259
281
|
typeUrl: "/ibc.applications.transfer.v1.MsgTransfer",
|
|
260
|
-
value: MsgTransfer.fromJSON({
|
|
282
|
+
value: tx.MsgTransfer.fromJSON({
|
|
261
283
|
sourcePort: msgJson.source_port,
|
|
262
284
|
sourceChannel: msgJson.source_channel,
|
|
263
285
|
token: msgJson.token,
|
|
@@ -272,10 +294,10 @@ function getEncodeObjectFromCosmosMessage(message) {
|
|
|
272
294
|
if (message.msgTypeUrl === "/cosmwasm.wasm.v1.MsgExecuteContract") {
|
|
273
295
|
return {
|
|
274
296
|
typeUrl: message.msgTypeUrl,
|
|
275
|
-
value: MsgExecuteContract.fromPartial({
|
|
297
|
+
value: tx$1.MsgExecuteContract.fromPartial({
|
|
276
298
|
sender: msgJson.sender,
|
|
277
299
|
contract: msgJson.contract,
|
|
278
|
-
msg: toUtf8(JSON.stringify(msgJson.msg)),
|
|
300
|
+
msg: encoding.toUtf8(JSON.stringify(msgJson.msg)),
|
|
279
301
|
funds: msgJson.funds
|
|
280
302
|
})
|
|
281
303
|
};
|
|
@@ -283,7 +305,7 @@ function getEncodeObjectFromCosmosMessage(message) {
|
|
|
283
305
|
if (message.msgTypeUrl === "/cosmos.bank.v1beta1.MsgSend") {
|
|
284
306
|
return {
|
|
285
307
|
typeUrl: message.msgTypeUrl,
|
|
286
|
-
value: MsgSend.fromPartial({
|
|
308
|
+
value: tx$2.MsgSend.fromPartial({
|
|
287
309
|
fromAddress: msgJson.from_address,
|
|
288
310
|
toAddress: msgJson.to_address,
|
|
289
311
|
amount: msgJson.amount
|
|
@@ -293,19 +315,19 @@ function getEncodeObjectFromCosmosMessage(message) {
|
|
|
293
315
|
if (message.msgTypeUrl === "/circle.cctp.v1.MsgDepositForBurn") {
|
|
294
316
|
return {
|
|
295
317
|
typeUrl: message.msgTypeUrl,
|
|
296
|
-
value: MsgDepositForBurn.fromAmino(msgJson)
|
|
318
|
+
value: chunk7OIZPQJB_cjs.MsgDepositForBurn.fromAmino(msgJson)
|
|
297
319
|
};
|
|
298
320
|
}
|
|
299
321
|
if (message.msgTypeUrl === "/circle.cctp.v1.MsgDepositForBurnWithCaller") {
|
|
300
322
|
return {
|
|
301
323
|
typeUrl: message.msgTypeUrl,
|
|
302
|
-
value: MsgDepositForBurnWithCaller.fromAmino(msgJson)
|
|
324
|
+
value: chunk7OIZPQJB_cjs.MsgDepositForBurnWithCaller.fromAmino(msgJson)
|
|
303
325
|
};
|
|
304
326
|
}
|
|
305
327
|
if (message.msgTypeUrl === "/initia.move.v1.MsgExecute") {
|
|
306
328
|
return {
|
|
307
329
|
typeUrl: message.msgTypeUrl,
|
|
308
|
-
value: MsgExecute.fromPartial({
|
|
330
|
+
value: chunk7OIZPQJB_cjs.MsgExecute.fromPartial({
|
|
309
331
|
sender: msgJson.sender,
|
|
310
332
|
moduleAddress: msgJson.module_address,
|
|
311
333
|
moduleName: msgJson.module_name,
|
|
@@ -317,7 +339,7 @@ function getEncodeObjectFromCosmosMessage(message) {
|
|
|
317
339
|
if (message.msgTypeUrl === "/opinit.ophost.v1.MsgInitiateTokenDeposit") {
|
|
318
340
|
return {
|
|
319
341
|
typeUrl: message.msgTypeUrl,
|
|
320
|
-
value: MsgInitiateTokenDeposit.fromPartial({
|
|
342
|
+
value: chunk7OIZPQJB_cjs.MsgInitiateTokenDeposit.fromPartial({
|
|
321
343
|
sender: msgJson.sender,
|
|
322
344
|
to: msgJson.to,
|
|
323
345
|
amount: msgJson.amount,
|
|
@@ -345,7 +367,7 @@ function getEncodeObjectFromCosmosMessage(message) {
|
|
|
345
367
|
function getEncodeObjectFromCosmosMessageInjective(message) {
|
|
346
368
|
const msgJson = JSON.parse(message.msg ?? "");
|
|
347
369
|
if (message.msgTypeUrl === "/ibc.applications.transfer.v1.MsgTransfer") {
|
|
348
|
-
return MsgTransfer
|
|
370
|
+
return sdkTs.MsgTransfer.fromJSON({
|
|
349
371
|
port: msgJson.source_port,
|
|
350
372
|
channelId: msgJson.source_channel,
|
|
351
373
|
amount: msgJson.token,
|
|
@@ -356,7 +378,7 @@ function getEncodeObjectFromCosmosMessageInjective(message) {
|
|
|
356
378
|
});
|
|
357
379
|
}
|
|
358
380
|
if (message.msgTypeUrl === "/cosmwasm.wasm.v1.MsgExecuteContract") {
|
|
359
|
-
return MsgExecuteContractCompat.fromJSON({
|
|
381
|
+
return sdkTs.MsgExecuteContractCompat.fromJSON({
|
|
360
382
|
sender: msgJson.sender,
|
|
361
383
|
contractAddress: msgJson.contract,
|
|
362
384
|
msg: msgJson.msg,
|
|
@@ -370,7 +392,7 @@ function createTransaction({
|
|
|
370
392
|
message,
|
|
371
393
|
timeoutHeight,
|
|
372
394
|
memo = "",
|
|
373
|
-
fee = DEFAULT_STD_FEE,
|
|
395
|
+
fee = utils.DEFAULT_STD_FEE,
|
|
374
396
|
signMode = 1,
|
|
375
397
|
pubKey,
|
|
376
398
|
accountNumber,
|
|
@@ -381,7 +403,7 @@ function createTransaction({
|
|
|
381
403
|
accountNumber,
|
|
382
404
|
sequence
|
|
383
405
|
};
|
|
384
|
-
return createTransactionWithSigners({
|
|
406
|
+
return sdkTs.createTransactionWithSigners({
|
|
385
407
|
fee,
|
|
386
408
|
memo,
|
|
387
409
|
message,
|
|
@@ -413,10 +435,10 @@ var signCosmosMessageDirectEvmos = async (signerAddress, signer, cosmosMsgs, fee
|
|
|
413
435
|
fee
|
|
414
436
|
});
|
|
415
437
|
const directSignResponse = await signer.signDirect(signerAddress, signDoc);
|
|
416
|
-
return TxRaw.fromPartial({
|
|
438
|
+
return tx_js.TxRaw.fromPartial({
|
|
417
439
|
bodyBytes: directSignResponse.signed.bodyBytes,
|
|
418
440
|
authInfoBytes: directSignResponse.signed.authInfoBytes,
|
|
419
|
-
signatures: [fromBase64(directSignResponse.signature.signature)]
|
|
441
|
+
signatures: [base64.fromBase64(directSignResponse.signature.signature)]
|
|
420
442
|
});
|
|
421
443
|
};
|
|
422
444
|
var signCosmosMessageDirectInjective = async (signerAddress, signer, cosmosMsgs, fee, { accountNumber, sequence, chainId }) => {
|
|
@@ -426,10 +448,10 @@ var signCosmosMessageDirectInjective = async (signerAddress, signer, cosmosMsgs,
|
|
|
426
448
|
throw new Error("signCosmosMessageDirectInjective: failed to retrieve account from signer");
|
|
427
449
|
}
|
|
428
450
|
const restEndpoint = await getRestEndpointForChain(chainId);
|
|
429
|
-
const chainRestTendermintApi = new ChainRestTendermintApi(restEndpoint);
|
|
451
|
+
const chainRestTendermintApi = new sdkTs.ChainRestTendermintApi(restEndpoint);
|
|
430
452
|
const latestBlock = await chainRestTendermintApi.fetchLatestBlock();
|
|
431
453
|
const latestHeight = latestBlock.header.height;
|
|
432
|
-
const timeoutHeight = new BigNumberInBase(latestHeight).plus(DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
454
|
+
const timeoutHeight = new utils.BigNumberInBase(latestHeight).plus(utils.DEFAULT_BLOCK_TIMEOUT_HEIGHT);
|
|
433
455
|
const pk = Buffer.from(accountFromSigner.pubkey).toString("base64");
|
|
434
456
|
const messages2 = cosmosMsgs.map(
|
|
435
457
|
(cosmosMsg) => getEncodeObjectFromCosmosMessageInjective(cosmosMsg)
|
|
@@ -448,15 +470,15 @@ var signCosmosMessageDirectInjective = async (signerAddress, signer, cosmosMsgs,
|
|
|
448
470
|
// @ts-expect-error TODO: Fix this
|
|
449
471
|
signDoc
|
|
450
472
|
);
|
|
451
|
-
return TxRaw.fromPartial({
|
|
473
|
+
return tx_js.TxRaw.fromPartial({
|
|
452
474
|
bodyBytes: directSignResponse.signed.bodyBytes,
|
|
453
475
|
authInfoBytes: directSignResponse.signed.authInfoBytes,
|
|
454
|
-
signatures: [fromBase64(directSignResponse.signature.signature)]
|
|
476
|
+
signatures: [base64.fromBase64(directSignResponse.signature.signature)]
|
|
455
477
|
});
|
|
456
478
|
};
|
|
457
479
|
var pubkeyType = {
|
|
458
480
|
ethsecp256k1: "ethermint/PubKeyEthSecp256k1",
|
|
459
|
-
...pubkeyType
|
|
481
|
+
...amino.pubkeyType
|
|
460
482
|
};
|
|
461
483
|
|
|
462
484
|
// src/amino/encoding.ts
|
|
@@ -468,21 +490,21 @@ function encodeEthSecp256k1Pubkey(pubkey) {
|
|
|
468
490
|
}
|
|
469
491
|
return {
|
|
470
492
|
type: pubkeyType.ethsecp256k1,
|
|
471
|
-
value: toBase64(pubkey)
|
|
493
|
+
value: encoding.toBase64(pubkey)
|
|
472
494
|
};
|
|
473
495
|
}
|
|
474
496
|
|
|
475
497
|
// src/proto-signing/pubkey.ts
|
|
476
498
|
function makePubkeyAnyFromAccount(account, chainId) {
|
|
477
|
-
const isEthermint = getIsEthermint(chainId);
|
|
478
|
-
const pubkey = isEthermint ? encodeEthSecp256k1Pubkey(account.pubkey) : encodeSecp256k1Pubkey(account.pubkey);
|
|
499
|
+
const isEthermint = chunk7SK3IFXJ_cjs.getIsEthermint(chainId);
|
|
500
|
+
const pubkey = isEthermint ? encodeEthSecp256k1Pubkey(account.pubkey) : amino.encodeSecp256k1Pubkey(account.pubkey);
|
|
479
501
|
const pubkeyAny = encodePubkeyToAny(pubkey, chainId, isEthermint);
|
|
480
502
|
return pubkeyAny;
|
|
481
503
|
}
|
|
482
504
|
function encodePubkeyToAny(pubkey, chainId, isEthermint) {
|
|
483
505
|
if (isEthermint) {
|
|
484
|
-
const pubkeyProto = PubKey.fromPartial({
|
|
485
|
-
key: fromBase64
|
|
506
|
+
const pubkeyProto = keys.PubKey.fromPartial({
|
|
507
|
+
key: encoding.fromBase64(pubkey.value)
|
|
486
508
|
});
|
|
487
509
|
let typeUrl = "";
|
|
488
510
|
if (chainId?.includes("injective")) {
|
|
@@ -490,22 +512,22 @@ function encodePubkeyToAny(pubkey, chainId, isEthermint) {
|
|
|
490
512
|
} else {
|
|
491
513
|
typeUrl = "/ethermint.crypto.v1.ethsecp256k1.PubKey";
|
|
492
514
|
}
|
|
493
|
-
return Any.fromPartial({
|
|
515
|
+
return any.Any.fromPartial({
|
|
494
516
|
typeUrl,
|
|
495
|
-
value: Uint8Array.from(PubKey.encode(pubkeyProto).finish())
|
|
517
|
+
value: Uint8Array.from(keys.PubKey.encode(pubkeyProto).finish())
|
|
496
518
|
});
|
|
497
519
|
} else {
|
|
498
|
-
const isInitia = getIsInitia(chainId);
|
|
499
|
-
const pubkeyProto = PubKey.fromPartial({
|
|
500
|
-
key: fromBase64
|
|
520
|
+
const isInitia = chunk7SK3IFXJ_cjs.getIsInitia(chainId);
|
|
521
|
+
const pubkeyProto = keys.PubKey.fromPartial({
|
|
522
|
+
key: encoding.fromBase64(pubkey.value)
|
|
501
523
|
});
|
|
502
524
|
if (isInitia) {
|
|
503
|
-
return Any.fromPartial({
|
|
525
|
+
return any.Any.fromPartial({
|
|
504
526
|
typeUrl: "/initia.crypto.v1beta1.ethsecp256k1.PubKey",
|
|
505
|
-
value: Uint8Array.from(PubKey.encode(pubkeyProto).finish())
|
|
527
|
+
value: Uint8Array.from(keys.PubKey.encode(pubkeyProto).finish())
|
|
506
528
|
});
|
|
507
529
|
}
|
|
508
|
-
return encodePubkey(pubkey);
|
|
530
|
+
return protoSigning.encodePubkey(pubkey);
|
|
509
531
|
}
|
|
510
532
|
}
|
|
511
533
|
var signCosmosMessageDirect = async (options) => {
|
|
@@ -543,22 +565,22 @@ var signCosmosMessageDirect = async (options) => {
|
|
|
543
565
|
messages: messages2
|
|
544
566
|
}
|
|
545
567
|
};
|
|
546
|
-
const txBodyBytes = ClientState.registry.encode(txBodyEncodeObject);
|
|
547
|
-
const gasLimit = Int53.fromString(fee.gas).toNumber();
|
|
568
|
+
const txBodyBytes = chunkED2OY55G_cjs.ClientState.registry.encode(txBodyEncodeObject);
|
|
569
|
+
const gasLimit = integers.Int53.fromString(fee.gas).toNumber();
|
|
548
570
|
const pubkeyAny = makePubkeyAnyFromAccount(accountFromSigner, chainId);
|
|
549
|
-
const authInfoBytes = makeAuthInfoBytes(
|
|
571
|
+
const authInfoBytes = signing.makeAuthInfoBytes(
|
|
550
572
|
[{ pubkey: pubkeyAny, sequence }],
|
|
551
573
|
fee.amount,
|
|
552
574
|
gasLimit,
|
|
553
575
|
fee.granter,
|
|
554
576
|
fee.payer
|
|
555
577
|
);
|
|
556
|
-
const signDoc = makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
578
|
+
const signDoc = signing.makeSignDoc(txBodyBytes, authInfoBytes, chainId, accountNumber);
|
|
557
579
|
const { signature, signed } = await signer.signDirect(signerAddress, signDoc);
|
|
558
|
-
return TxRaw.fromPartial({
|
|
580
|
+
return tx_js.TxRaw.fromPartial({
|
|
559
581
|
bodyBytes: signed.bodyBytes,
|
|
560
582
|
authInfoBytes: signed.authInfoBytes,
|
|
561
|
-
signatures: [fromBase64(signature.signature)]
|
|
583
|
+
signatures: [base64.fromBase64(signature.signature)]
|
|
562
584
|
});
|
|
563
585
|
};
|
|
564
586
|
var signCosmosMessageAmino = async (options) => {
|
|
@@ -576,13 +598,13 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
576
598
|
throw new Error("signCosmosMessageAmino: failed to retrieve account from signer");
|
|
577
599
|
}
|
|
578
600
|
const messages2 = cosmosMsgs.map((cosmosMsg) => getEncodeObjectFromCosmosMessage(cosmosMsg));
|
|
579
|
-
const signMode = SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
580
|
-
const msgs = messages2.map((msg) => ClientState.aminoTypes.toAmino(msg));
|
|
601
|
+
const signMode = signing$1.SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
|
602
|
+
const msgs = messages2.map((msg) => chunkED2OY55G_cjs.ClientState.aminoTypes.toAmino(msg));
|
|
581
603
|
console.log("sign cosmos message amino", msgs, fee, signerChainId, "", accountNumber, sequence);
|
|
582
|
-
const signDoc = makeSignDoc
|
|
604
|
+
const signDoc = amino.makeSignDoc(msgs, fee, signerChainId, "", accountNumber, sequence);
|
|
583
605
|
const { signature, signed } = await signer.signAmino(signerAddress, signDoc);
|
|
584
606
|
const signedTxBody = {
|
|
585
|
-
messages: signed.msgs.map((msg) => ClientState.aminoTypes.fromAmino(msg)),
|
|
607
|
+
messages: signed.msgs.map((msg) => chunkED2OY55G_cjs.ClientState.aminoTypes.fromAmino(msg)),
|
|
586
608
|
memo: signed.memo
|
|
587
609
|
};
|
|
588
610
|
signedTxBody.messages[0].value.memo = messages2[0].value.memo;
|
|
@@ -590,11 +612,11 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
590
612
|
typeUrl: "/cosmos.tx.v1beta1.TxBody",
|
|
591
613
|
value: signedTxBody
|
|
592
614
|
};
|
|
593
|
-
const signedTxBodyBytes = ClientState.registry.encode(signedTxBodyEncodeObject);
|
|
594
|
-
const signedGasLimit = Int53.fromString(signed.fee.gas).toNumber();
|
|
595
|
-
const signedSequence = Int53.fromString(signed.sequence).toNumber();
|
|
615
|
+
const signedTxBodyBytes = chunkED2OY55G_cjs.ClientState.registry.encode(signedTxBodyEncodeObject);
|
|
616
|
+
const signedGasLimit = integers.Int53.fromString(signed.fee.gas).toNumber();
|
|
617
|
+
const signedSequence = integers.Int53.fromString(signed.sequence).toNumber();
|
|
596
618
|
const pubkeyAny = makePubkeyAnyFromAccount(accountFromSigner, chainId);
|
|
597
|
-
const signedAuthInfoBytes = makeAuthInfoBytes(
|
|
619
|
+
const signedAuthInfoBytes = signing.makeAuthInfoBytes(
|
|
598
620
|
[{ pubkey: pubkeyAny, sequence: signedSequence }],
|
|
599
621
|
signed.fee.amount,
|
|
600
622
|
signedGasLimit,
|
|
@@ -602,10 +624,10 @@ var signCosmosMessageAmino = async (options) => {
|
|
|
602
624
|
signed.fee.payer,
|
|
603
625
|
signMode
|
|
604
626
|
);
|
|
605
|
-
return TxRaw.fromPartial({
|
|
627
|
+
return tx_js.TxRaw.fromPartial({
|
|
606
628
|
bodyBytes: signedTxBodyBytes,
|
|
607
629
|
authInfoBytes: signedAuthInfoBytes,
|
|
608
|
-
signatures: [fromBase64(signature.signature)]
|
|
630
|
+
signatures: [base64.fromBase64(signature.signature)]
|
|
609
631
|
});
|
|
610
632
|
};
|
|
611
633
|
|
|
@@ -622,7 +644,7 @@ var executeCosmosTransaction = async ({
|
|
|
622
644
|
const chainId = tx.cosmosTx?.chainId;
|
|
623
645
|
const messages2 = tx.cosmosTx?.msgs;
|
|
624
646
|
const currentUserAddress = userAddresses.find((x) => x.chainId === tx.cosmosTx?.chainId)?.address;
|
|
625
|
-
const gasArray = ClientState.validateGasResults;
|
|
647
|
+
const gasArray = chunkED2OY55G_cjs.ClientState.validateGasResults;
|
|
626
648
|
const gas = gasArray?.find((gas2) => gas2?.error !== null && gas2?.error !== void 0);
|
|
627
649
|
if (typeof gas?.error === "string") {
|
|
628
650
|
throw new Error(gas?.error);
|
|
@@ -637,7 +659,7 @@ var executeCosmosTransaction = async ({
|
|
|
637
659
|
if (messages2 === void 0) {
|
|
638
660
|
throw new Error("no messages found for tx");
|
|
639
661
|
}
|
|
640
|
-
const { stargateClient, signer } = await getSigningStargateClient({
|
|
662
|
+
const { stargateClient, signer: signer$1 } = await chunkSW3SEQMJ_cjs.getSigningStargateClient({
|
|
641
663
|
chainId,
|
|
642
664
|
getOfflineSigner: options?.getCosmosSigner
|
|
643
665
|
});
|
|
@@ -646,7 +668,7 @@ var executeCosmosTransaction = async ({
|
|
|
646
668
|
`executeCosmosTransaction error: invalid address for chain '${tx.cosmosTx?.chainId}'`
|
|
647
669
|
);
|
|
648
670
|
}
|
|
649
|
-
const accounts = await signer.getAccounts();
|
|
671
|
+
const accounts = await signer$1.getAccounts();
|
|
650
672
|
const accountFromSigner = accounts.find((account) => account.address === currentUserAddress);
|
|
651
673
|
if (!accountFromSigner) {
|
|
652
674
|
throw new Error("executeCosmosTransaction error: failed to retrieve account from signer");
|
|
@@ -671,18 +693,18 @@ var executeCosmosTransaction = async ({
|
|
|
671
693
|
chainId
|
|
672
694
|
}
|
|
673
695
|
};
|
|
674
|
-
if (isOfflineDirectSigner(signer)) {
|
|
696
|
+
if (signer.isOfflineDirectSigner(signer$1)) {
|
|
675
697
|
rawTx = await signCosmosMessageDirect({
|
|
676
698
|
...commonRawTxBody,
|
|
677
|
-
signer
|
|
699
|
+
signer: signer$1
|
|
678
700
|
});
|
|
679
701
|
} else {
|
|
680
|
-
rawTx = await signCosmosMessageAmino({ ...commonRawTxBody, signer });
|
|
702
|
+
rawTx = await signCosmosMessageAmino({ ...commonRawTxBody, signer: signer$1 });
|
|
681
703
|
}
|
|
682
704
|
options?.onTransactionSigned?.({
|
|
683
705
|
chainId
|
|
684
706
|
});
|
|
685
|
-
const txBytes = TxRaw.encode(rawTx).finish();
|
|
707
|
+
const txBytes = tx_js.TxRaw.encode(rawTx).finish();
|
|
686
708
|
const txResponse = await stargateClient.broadcastTx(txBytes);
|
|
687
709
|
return {
|
|
688
710
|
chainId: tx?.cosmosTx?.chainId ?? "",
|
|
@@ -892,13 +914,13 @@ var erc20ABI = /* @__PURE__ */ createAbi([
|
|
|
892
914
|
|
|
893
915
|
// src/private-functions/evm/executeEvmTransaction.ts
|
|
894
916
|
var executeEvmTransaction = async (message, options) => {
|
|
895
|
-
const gasArray = ClientState.validateGasResults;
|
|
917
|
+
const gasArray = chunkED2OY55G_cjs.ClientState.validateGasResults;
|
|
896
918
|
const gas = gasArray?.find((gas2) => gas2?.error !== null && gas2?.error !== void 0);
|
|
897
919
|
if (typeof gas?.error === "string") {
|
|
898
920
|
throw new Error(gas?.error);
|
|
899
921
|
}
|
|
900
922
|
const { evmTx } = message;
|
|
901
|
-
const getEvmSigner = options.getEvmSigner || ClientState.getEvmSigner;
|
|
923
|
+
const getEvmSigner = options.getEvmSigner || chunkED2OY55G_cjs.ClientState.getEvmSigner;
|
|
902
924
|
if (!getEvmSigner) {
|
|
903
925
|
throw new Error("Unable to get EVM signer");
|
|
904
926
|
}
|
|
@@ -916,7 +938,7 @@ var executeEvmTransaction = async (message, options) => {
|
|
|
916
938
|
throw new Error("executeEVMTransaction error: no value found in evmTx");
|
|
917
939
|
}
|
|
918
940
|
const { onApproveAllowance, onTransactionSigned, bypassApprovalCheck, useUnlimitedApproval } = options;
|
|
919
|
-
const extendedSigner = evmSigner.extend(publicActions);
|
|
941
|
+
const extendedSigner = evmSigner.extend(viem.publicActions);
|
|
920
942
|
if (!bypassApprovalCheck && evmTx.requiredErc20Approvals) {
|
|
921
943
|
for (const requiredApproval of evmTx.requiredErc20Approvals) {
|
|
922
944
|
const allowance = await extendedSigner.readContract({
|
|
@@ -945,7 +967,7 @@ var executeEvmTransaction = async (message, options) => {
|
|
|
945
967
|
functionName: "approve",
|
|
946
968
|
args: [
|
|
947
969
|
requiredApproval.spender,
|
|
948
|
-
useUnlimitedApproval ? maxUint256 : BigInt(requiredApproval.amount) + BigInt(1e3)
|
|
970
|
+
useUnlimitedApproval ? viem.maxUint256 : BigInt(requiredApproval.amount) + BigInt(1e3)
|
|
949
971
|
],
|
|
950
972
|
chain: evmSigner.chain
|
|
951
973
|
});
|
|
@@ -978,7 +1000,7 @@ var executeEvmTransaction = async (message, options) => {
|
|
|
978
1000
|
return receipt;
|
|
979
1001
|
};
|
|
980
1002
|
var executeSvmTransaction = async (tx, options) => {
|
|
981
|
-
const gasArray = ClientState.validateGasResults;
|
|
1003
|
+
const gasArray = chunkED2OY55G_cjs.ClientState.validateGasResults;
|
|
982
1004
|
if (tx === void 0) {
|
|
983
1005
|
throw new Error("executeSvmTransaction error: tx is undefined");
|
|
984
1006
|
}
|
|
@@ -987,7 +1009,7 @@ var executeSvmTransaction = async (tx, options) => {
|
|
|
987
1009
|
throw new Error(gas?.error);
|
|
988
1010
|
}
|
|
989
1011
|
const svmTx = tx?.svmTx;
|
|
990
|
-
const getSvmSigner = options?.getSvmSigner || ClientState.getSvmSigner;
|
|
1012
|
+
const getSvmSigner = options?.getSvmSigner || chunkED2OY55G_cjs.ClientState.getSvmSigner;
|
|
991
1013
|
if (!getSvmSigner) {
|
|
992
1014
|
throw new Error(
|
|
993
1015
|
"executeRoute error: 'getSVMSigner' is not provided or configured in skip router"
|
|
@@ -998,15 +1020,15 @@ var executeSvmTransaction = async (tx, options) => {
|
|
|
998
1020
|
throw new Error("executeSvmTransaction error: chainId not found in svmTx");
|
|
999
1021
|
}
|
|
1000
1022
|
const txBuffer = Buffer.from(svmTx.tx ?? "", "base64");
|
|
1001
|
-
const transaction = Transaction.from(txBuffer);
|
|
1002
|
-
const endpoint = await getRpcEndpointForChain(svmTx.chainId);
|
|
1003
|
-
const connection = new Connection(endpoint);
|
|
1023
|
+
const transaction = web3_js.Transaction.from(txBuffer);
|
|
1024
|
+
const endpoint = await chunkSW3SEQMJ_cjs.getRpcEndpointForChain(svmTx.chainId);
|
|
1025
|
+
const connection = new web3_js.Connection(endpoint);
|
|
1004
1026
|
let signature;
|
|
1005
1027
|
if ("signTransaction" in signer) {
|
|
1006
1028
|
const signedTx = await signer.signTransaction(transaction);
|
|
1007
1029
|
options?.onTransactionSigned?.({ chainId: svmTx.chainId });
|
|
1008
1030
|
const serializedTx = signedTx.serialize();
|
|
1009
|
-
await submitTransaction({
|
|
1031
|
+
await chunkL5V5PASH_cjs.submitTransaction({
|
|
1010
1032
|
chainId: svmTx.chainId,
|
|
1011
1033
|
tx: serializedTx.toString("base64")
|
|
1012
1034
|
}).then((res) => {
|
|
@@ -1035,13 +1057,13 @@ var executeSvmTransaction = async (tx, options) => {
|
|
|
1035
1057
|
};
|
|
1036
1058
|
}
|
|
1037
1059
|
if (getStatusCount > 12) {
|
|
1038
|
-
await wait(3e3);
|
|
1060
|
+
await chunkHAR3IXDE_cjs.wait(3e3);
|
|
1039
1061
|
throw new Error(
|
|
1040
1062
|
`executeSvmTransaction error: waiting finalized status timed out for ${signature}`
|
|
1041
1063
|
);
|
|
1042
1064
|
}
|
|
1043
1065
|
getStatusCount++;
|
|
1044
|
-
await wait(3e3);
|
|
1066
|
+
await chunkHAR3IXDE_cjs.wait(3e3);
|
|
1045
1067
|
} catch (error) {
|
|
1046
1068
|
errorCount++;
|
|
1047
1069
|
if (errorCount > 12) {
|
|
@@ -1081,8 +1103,8 @@ var validateCosmosGasBalance = async ({
|
|
|
1081
1103
|
txIndex,
|
|
1082
1104
|
simulate
|
|
1083
1105
|
}) => {
|
|
1084
|
-
const skipAssets = (await ClientState.getSkipAssets({ chainId }))?.[chainId];
|
|
1085
|
-
const skipChains = await ClientState.getSkipChains();
|
|
1106
|
+
const skipAssets = (await chunkED2OY55G_cjs.ClientState.getSkipAssets({ chainId }))?.[chainId];
|
|
1107
|
+
const skipChains = await chunkED2OY55G_cjs.ClientState.getSkipChains();
|
|
1086
1108
|
const chain = skipChains?.find((c) => c.chainId === chainId);
|
|
1087
1109
|
if (!chain) {
|
|
1088
1110
|
throw new Error(`failed to find chain id for '${chainId}'`);
|
|
@@ -1097,7 +1119,7 @@ var validateCosmosGasBalance = async ({
|
|
|
1097
1119
|
if (txIndex !== 0 && chainId === "noble-1") {
|
|
1098
1120
|
return "0";
|
|
1099
1121
|
}
|
|
1100
|
-
const { stargateClient } = await getSigningStargateClient({
|
|
1122
|
+
const { stargateClient } = await chunkSW3SEQMJ_cjs.getSigningStargateClient({
|
|
1101
1123
|
chainId,
|
|
1102
1124
|
getOfflineSigner
|
|
1103
1125
|
});
|
|
@@ -1134,8 +1156,8 @@ var validateCosmosGasBalance = async ({
|
|
|
1134
1156
|
price = asset.gasPrice.low;
|
|
1135
1157
|
}
|
|
1136
1158
|
if (!price) return;
|
|
1137
|
-
return new GasPrice(
|
|
1138
|
-
Decimal.fromUserInput(BigNumber(price).toFixed(), 18),
|
|
1159
|
+
return new stargate.GasPrice(
|
|
1160
|
+
decimal.Decimal.fromUserInput(chunk4R6OCWRR_cjs.BigNumber(price).toFixed(), 18),
|
|
1139
1161
|
asset?.denom ?? ""
|
|
1140
1162
|
);
|
|
1141
1163
|
})();
|
|
@@ -1143,12 +1165,12 @@ var validateCosmosGasBalance = async ({
|
|
|
1143
1165
|
return null;
|
|
1144
1166
|
}
|
|
1145
1167
|
if (chainId === "noble-1") {
|
|
1146
|
-
const fee = calculateFee(2e5, gasPrice);
|
|
1168
|
+
const fee = stargate.calculateFee(2e5, gasPrice);
|
|
1147
1169
|
return fee;
|
|
1148
1170
|
}
|
|
1149
|
-
return calculateFee(Math.ceil(parseFloat(estimatedGasAmount)), gasPrice);
|
|
1171
|
+
return stargate.calculateFee(Math.ceil(parseFloat(estimatedGasAmount)), gasPrice);
|
|
1150
1172
|
});
|
|
1151
|
-
const feeBalance = await balances({
|
|
1173
|
+
const feeBalance = await chunkED2OY55G_cjs.balances({
|
|
1152
1174
|
chains: {
|
|
1153
1175
|
[chainId]: {
|
|
1154
1176
|
address: signerAddress,
|
|
@@ -1197,8 +1219,8 @@ var validateCosmosGasBalance = async ({
|
|
|
1197
1219
|
};
|
|
1198
1220
|
}
|
|
1199
1221
|
if (parseInt(balance?.amount ?? "") < parseInt(fee.amount[0]?.amount)) {
|
|
1200
|
-
const userAmount = new BigNumber(parseFloat(balance?.amount ?? "")).shiftedBy(-decimal).toFixed(decimal);
|
|
1201
|
-
const feeAmount = new BigNumber(parseFloat(fee.amount[0]?.amount)).shiftedBy(-decimal).toFixed(decimal);
|
|
1222
|
+
const userAmount = new chunk4R6OCWRR_cjs.BigNumber(parseFloat(balance?.amount ?? "")).shiftedBy(-decimal).toFixed(decimal);
|
|
1223
|
+
const feeAmount = new chunk4R6OCWRR_cjs.BigNumber(parseFloat(fee.amount[0]?.amount)).shiftedBy(-decimal).toFixed(decimal);
|
|
1202
1224
|
return {
|
|
1203
1225
|
error: `Insufficient balance for gas on ${chain?.prettyName}. Need ${feeAmount} ${symbol} but only have ${userAmount} ${symbol}.`,
|
|
1204
1226
|
asset
|
|
@@ -1235,7 +1257,7 @@ var validateEvmTokenApproval = async ({
|
|
|
1235
1257
|
throw new Error("validateEvmGasBalance: Signer address not found");
|
|
1236
1258
|
}
|
|
1237
1259
|
for (const requiredApproval of requiredErc20Approvals) {
|
|
1238
|
-
const extendedSigner = signer.extend(publicActions);
|
|
1260
|
+
const extendedSigner = signer.extend(viem.publicActions);
|
|
1239
1261
|
const allowance = await extendedSigner.readContract({
|
|
1240
1262
|
address: requiredApproval.tokenContract,
|
|
1241
1263
|
abi: erc20ABI,
|
|
@@ -1248,7 +1270,7 @@ var validateEvmTokenApproval = async ({
|
|
|
1248
1270
|
const fee = await extendedSigner.estimateFeesPerGas();
|
|
1249
1271
|
const allowanceGasFee = BigInt(fee.maxFeePerGas) * BigInt(1e5);
|
|
1250
1272
|
if (!gasBalance) {
|
|
1251
|
-
const chainAssets = (await ClientState.getSkipAssets({ chainId: tx.chainId }))[tx.chainId];
|
|
1273
|
+
const chainAssets = (await chunkED2OY55G_cjs.ClientState.getSkipAssets({ chainId: tx.chainId }))[tx.chainId];
|
|
1252
1274
|
const nativeAsset = chainAssets?.find((x) => x.denom.includes("-native"));
|
|
1253
1275
|
const zeroAddressAsset = chainAssets?.find(
|
|
1254
1276
|
(x) => x.denom.toLowerCase() === "0x0000000000000000000000000000000000000000"
|
|
@@ -1259,13 +1281,13 @@ var validateEvmTokenApproval = async ({
|
|
|
1259
1281
|
`Insufficient balance for gas on ${chain.prettyName}. Need ${allowanceGasFee} gwei.`
|
|
1260
1282
|
);
|
|
1261
1283
|
}
|
|
1262
|
-
const formattedGasAmount = formatUnits(allowanceGasFee, asset?.decimals);
|
|
1284
|
+
const formattedGasAmount = viem.formatUnits(allowanceGasFee, asset?.decimals);
|
|
1263
1285
|
throw new Error(
|
|
1264
1286
|
`Insufficient balance for gas on ${chain.prettyName}. Need ${formattedGasAmount} ${asset.symbol}.`
|
|
1265
1287
|
);
|
|
1266
1288
|
}
|
|
1267
|
-
if (BigNumber(gasBalance.amount).lt(Number(allowanceGasFee))) {
|
|
1268
|
-
const chainAssets = (await ClientState.getSkipAssets({ chainId: tx.chainId }))[tx.chainId];
|
|
1289
|
+
if (chunk4R6OCWRR_cjs.BigNumber(gasBalance.amount).lt(Number(allowanceGasFee))) {
|
|
1290
|
+
const chainAssets = (await chunkED2OY55G_cjs.ClientState.getSkipAssets({ chainId: tx.chainId }))[tx.chainId];
|
|
1269
1291
|
const asset = chainAssets?.find(
|
|
1270
1292
|
(x) => x.denom.includes("-native") || x.denom.toLowerCase() === "0x0000000000000000000000000000000000000000"
|
|
1271
1293
|
);
|
|
@@ -1276,7 +1298,7 @@ var validateEvmTokenApproval = async ({
|
|
|
1276
1298
|
fee: null
|
|
1277
1299
|
};
|
|
1278
1300
|
}
|
|
1279
|
-
const formattedGasAmount = formatUnits(allowanceGasFee, asset?.decimals);
|
|
1301
|
+
const formattedGasAmount = viem.formatUnits(allowanceGasFee, asset?.decimals);
|
|
1280
1302
|
return {
|
|
1281
1303
|
error: `Insufficient balance for gas on ${chain.prettyName}. Need ${formattedGasAmount} ${asset.symbol} but only have ${gasBalance.formattedAmount} ${asset.symbol}.`,
|
|
1282
1304
|
asset: null,
|
|
@@ -1290,7 +1312,7 @@ var validateEvmTokenApproval = async ({
|
|
|
1290
1312
|
functionName: "approve",
|
|
1291
1313
|
args: [
|
|
1292
1314
|
requiredApproval.spender,
|
|
1293
|
-
useUnlimitedApproval ? maxUint256 : BigInt(requiredApproval.amount) + BigInt(1e3)
|
|
1315
|
+
useUnlimitedApproval ? viem.maxUint256 : BigInt(requiredApproval.amount) + BigInt(1e3)
|
|
1294
1316
|
],
|
|
1295
1317
|
chain: signer.chain
|
|
1296
1318
|
});
|
|
@@ -1307,7 +1329,7 @@ var validateEvmTokenApproval = async ({
|
|
|
1307
1329
|
async function getEVMGasAmountForMessage(signer, tx, getFallbackGasAmount) {
|
|
1308
1330
|
const { to, data, value } = tx;
|
|
1309
1331
|
if (!signer.account) throw new Error("estimateGasForEvmTx: No account found");
|
|
1310
|
-
const extendedSigner = signer.extend(publicActions);
|
|
1332
|
+
const extendedSigner = signer.extend(viem.publicActions);
|
|
1311
1333
|
const fee = await extendedSigner.estimateFeesPerGas();
|
|
1312
1334
|
try {
|
|
1313
1335
|
const gasAmount = await extendedSigner.estimateGas({
|
|
@@ -1334,8 +1356,8 @@ var validateEvmGasBalance = async ({
|
|
|
1334
1356
|
useUnlimitedApproval
|
|
1335
1357
|
}) => {
|
|
1336
1358
|
const chainId = tx?.chainId ?? "";
|
|
1337
|
-
const skipAssets = (await ClientState.getSkipAssets({ chainId }))?.[chainId];
|
|
1338
|
-
const skipChains = await ClientState.getSkipChains();
|
|
1359
|
+
const skipAssets = (await chunkED2OY55G_cjs.ClientState.getSkipAssets({ chainId }))?.[chainId];
|
|
1360
|
+
const skipChains = await chunkED2OY55G_cjs.ClientState.getSkipChains();
|
|
1339
1361
|
const chain = skipChains?.find?.((chain2) => chain2.chainId === chainId);
|
|
1340
1362
|
if (!chain) {
|
|
1341
1363
|
throw new Error(`failed to find chain for chainId: '${chainId}'`);
|
|
@@ -1343,7 +1365,7 @@ var validateEvmGasBalance = async ({
|
|
|
1343
1365
|
if (!signer.account?.address) {
|
|
1344
1366
|
throw new Error("validateEvmGasBalance: Signer address not found");
|
|
1345
1367
|
}
|
|
1346
|
-
const skipBalances = (await balances({
|
|
1368
|
+
const skipBalances = (await chunkED2OY55G_cjs.balances({
|
|
1347
1369
|
chains: {
|
|
1348
1370
|
[tx?.chainId ?? ""]: {
|
|
1349
1371
|
address: signer.account?.address
|
|
@@ -1389,14 +1411,14 @@ var validateEvmGasBalance = async ({
|
|
|
1389
1411
|
fee: null
|
|
1390
1412
|
};
|
|
1391
1413
|
}
|
|
1392
|
-
const formattedGasAmount = formatUnits(gasAmount, asset?.decimals);
|
|
1414
|
+
const formattedGasAmount = viem.formatUnits(gasAmount, asset?.decimals);
|
|
1393
1415
|
return {
|
|
1394
1416
|
error: `Insufficient balance for gas on ${chain.prettyName}. Need ${formattedGasAmount} ${asset.symbol}.`,
|
|
1395
1417
|
asset: null,
|
|
1396
1418
|
fee: null
|
|
1397
1419
|
};
|
|
1398
1420
|
}
|
|
1399
|
-
if (BigNumber(gasBalance.amount ?? "").lt(Number(gasAmount))) {
|
|
1421
|
+
if (chunk4R6OCWRR_cjs.BigNumber(gasBalance.amount ?? "").lt(Number(gasAmount))) {
|
|
1400
1422
|
const asset = skipAssets?.find(
|
|
1401
1423
|
(x) => x.denom?.includes("-native") || x.denom?.toLowerCase() === "0x0000000000000000000000000000000000000000"
|
|
1402
1424
|
);
|
|
@@ -1407,7 +1429,7 @@ var validateEvmGasBalance = async ({
|
|
|
1407
1429
|
fee: null
|
|
1408
1430
|
};
|
|
1409
1431
|
}
|
|
1410
|
-
const formattedGasAmount = formatUnits(gasAmount, asset?.decimals);
|
|
1432
|
+
const formattedGasAmount = viem.formatUnits(gasAmount, asset?.decimals);
|
|
1411
1433
|
return {
|
|
1412
1434
|
error: `Insufficient balance for gas on ${chain.prettyName}. Need ${formattedGasAmount} ${asset.symbol} but only have ${gasBalance.formattedAmount} ${asset.symbol}.`,
|
|
1413
1435
|
asset: null,
|
|
@@ -1419,8 +1441,8 @@ var validateSvmGasBalance = async ({
|
|
|
1419
1441
|
tx
|
|
1420
1442
|
}) => {
|
|
1421
1443
|
if (!tx) throw new Error("Transaction is required");
|
|
1422
|
-
const endpoint = await getRpcEndpointForChain(tx.chainId ?? "");
|
|
1423
|
-
const connection = new Connection(endpoint);
|
|
1444
|
+
const endpoint = await chunkSW3SEQMJ_cjs.getRpcEndpointForChain(tx.chainId ?? "");
|
|
1445
|
+
const connection = new web3_js.Connection(endpoint);
|
|
1424
1446
|
if (!connection) throw new Error(`Failed to connect to ${tx.chainId}`);
|
|
1425
1447
|
if (!tx.tx) {
|
|
1426
1448
|
throw new Error("Transaction is required");
|
|
@@ -1428,7 +1450,7 @@ var validateSvmGasBalance = async ({
|
|
|
1428
1450
|
const txBuffer = Buffer.from(tx.tx, "base64");
|
|
1429
1451
|
let transaction;
|
|
1430
1452
|
try {
|
|
1431
|
-
transaction = Transaction.from(txBuffer);
|
|
1453
|
+
transaction = web3_js.Transaction.from(txBuffer);
|
|
1432
1454
|
} catch (decodeError) {
|
|
1433
1455
|
return {
|
|
1434
1456
|
success: false,
|
|
@@ -1470,7 +1492,7 @@ function getSolShortfall(logs) {
|
|
|
1470
1492
|
const have = parseInt(m[1] ?? "0", 10);
|
|
1471
1493
|
const need = parseInt(m[2] ?? "0", 10);
|
|
1472
1494
|
const shortfallLamports = need - have;
|
|
1473
|
-
return shortfallLamports / LAMPORTS_PER_SOL;
|
|
1495
|
+
return shortfallLamports / web3_js.LAMPORTS_PER_SOL;
|
|
1474
1496
|
}
|
|
1475
1497
|
|
|
1476
1498
|
// src/private-functions/validateGasBalances.ts
|
|
@@ -1567,13 +1589,13 @@ var validateGasBalances = async ({
|
|
|
1567
1589
|
onValidateGasBalance?.({
|
|
1568
1590
|
status: "error"
|
|
1569
1591
|
});
|
|
1570
|
-
ClientState.validateGasResults = validateResult;
|
|
1592
|
+
chunkED2OY55G_cjs.ClientState.validateGasResults = validateResult;
|
|
1571
1593
|
throw new Error(`${txError.error}`);
|
|
1572
1594
|
}
|
|
1573
1595
|
onValidateGasBalance?.({
|
|
1574
1596
|
status: "completed"
|
|
1575
1597
|
});
|
|
1576
|
-
ClientState.validateGasResults = validateResult;
|
|
1598
|
+
chunkED2OY55G_cjs.ClientState.validateGasResults = validateResult;
|
|
1577
1599
|
};
|
|
1578
1600
|
|
|
1579
1601
|
// src/private-functions/waitForTransaction.ts
|
|
@@ -1582,13 +1604,13 @@ var waitForTransaction = async ({
|
|
|
1582
1604
|
txHash,
|
|
1583
1605
|
onTransactionTracked
|
|
1584
1606
|
}) => {
|
|
1585
|
-
const { explorerLink } = await trackTransaction({
|
|
1607
|
+
const { explorerLink } = await chunkKDN7RCGP_cjs.trackTransaction({
|
|
1586
1608
|
chainId,
|
|
1587
1609
|
txHash
|
|
1588
1610
|
});
|
|
1589
1611
|
await onTransactionTracked?.({ txHash, chainId, explorerLink });
|
|
1590
1612
|
while (true) {
|
|
1591
|
-
const txStatusResponse = await transactionStatus({
|
|
1613
|
+
const txStatusResponse = await chunkDAMZSSOH_cjs.transactionStatus({
|
|
1592
1614
|
chainId,
|
|
1593
1615
|
txHash
|
|
1594
1616
|
});
|
|
@@ -1601,7 +1623,7 @@ var waitForTransaction = async ({
|
|
|
1601
1623
|
if (txStatusResponse.state === "STATE_ABANDONED") {
|
|
1602
1624
|
throw new Error("Tracking for the transaction has been abandoned");
|
|
1603
1625
|
}
|
|
1604
|
-
await wait(1e3);
|
|
1626
|
+
await chunkHAR3IXDE_cjs.wait(1e3);
|
|
1605
1627
|
}
|
|
1606
1628
|
};
|
|
1607
1629
|
|
|
@@ -1638,10 +1660,10 @@ var executeTransactions = async (options) => {
|
|
|
1638
1660
|
}
|
|
1639
1661
|
});
|
|
1640
1662
|
const isGasStationSourceEVM = chainIds.find((item, i, array) => {
|
|
1641
|
-
return GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm";
|
|
1663
|
+
return chunkKZOSEIWH_cjs.GAS_STATION_CHAIN_IDS.includes(item?.chainId ?? "") && array[i - 1]?.chainType === "evm";
|
|
1642
1664
|
});
|
|
1643
|
-
ClientState.validateGasResults = void 0;
|
|
1644
|
-
const validateChainIds = !batchSimulate ? chainIds.map((x) => x?.chainId ?? "") : isGasStationSourceEVM ? GAS_STATION_CHAIN_IDS : [];
|
|
1665
|
+
chunkED2OY55G_cjs.ClientState.validateGasResults = void 0;
|
|
1666
|
+
const validateChainIds = !batchSimulate ? chainIds.map((x) => x?.chainId ?? "") : isGasStationSourceEVM ? chunkKZOSEIWH_cjs.GAS_STATION_CHAIN_IDS : [];
|
|
1645
1667
|
await validateGasBalances({
|
|
1646
1668
|
txs,
|
|
1647
1669
|
getFallbackGasAmount: options.getFallbackGasAmount,
|
|
@@ -1720,7 +1742,7 @@ var executeRoute = async (options) => {
|
|
|
1720
1742
|
if (!isUserAddressesValid) {
|
|
1721
1743
|
throw new Error("executeRoute error: invalid user addresses");
|
|
1722
1744
|
}
|
|
1723
|
-
const response = await messages({
|
|
1745
|
+
const response = await chunk32MRDO7V_cjs.messages({
|
|
1724
1746
|
timeoutSeconds,
|
|
1725
1747
|
amountIn: route?.amountIn,
|
|
1726
1748
|
amountOut: route.estimatedAmountOut || "0",
|
|
@@ -1731,7 +1753,7 @@ var executeRoute = async (options) => {
|
|
|
1731
1753
|
operations: route?.operations,
|
|
1732
1754
|
addressList,
|
|
1733
1755
|
slippageTolerancePercent: options.slippageTolerancePercent || "1",
|
|
1734
|
-
chainIdsToAffiliates: ApiState.chainIdsToAffiliates
|
|
1756
|
+
chainIdsToAffiliates: chunkHAR3IXDE_cjs.ApiState.chainIdsToAffiliates
|
|
1735
1757
|
});
|
|
1736
1758
|
if (beforeMsg && (response?.txs?.length ?? 0) > 0) {
|
|
1737
1759
|
const firstTx = response?.txs?.[0];
|
|
@@ -1748,7 +1770,7 @@ var executeRoute = async (options) => {
|
|
|
1748
1770
|
await executeTransactions({ ...options, txs: response?.txs });
|
|
1749
1771
|
};
|
|
1750
1772
|
var validateUserAddresses = async (userAddresses) => {
|
|
1751
|
-
const chains2 = await ClientState.getSkipChains();
|
|
1773
|
+
const chains2 = await chunkED2OY55G_cjs.ClientState.getSkipChains();
|
|
1752
1774
|
const validations = userAddresses.map((userAddress) => {
|
|
1753
1775
|
const chain = chains2.find((chain2) => chain2.chainId === userAddress.chainId);
|
|
1754
1776
|
switch (chain?.chainType) {
|
|
@@ -1756,27 +1778,27 @@ var validateUserAddresses = async (userAddresses) => {
|
|
|
1756
1778
|
try {
|
|
1757
1779
|
if (chain.chainId?.includes("penumbra")) {
|
|
1758
1780
|
try {
|
|
1759
|
-
return chain.bech32Prefix === bech32m.decode(userAddress.address, 143)?.prefix;
|
|
1781
|
+
return chain.bech32Prefix === bech32.bech32m.decode(userAddress.address, 143)?.prefix;
|
|
1760
1782
|
} catch {
|
|
1761
1783
|
return ["penumbracompat1", "tpenumbra"].includes(
|
|
1762
|
-
bech32.decode(userAddress.address, 1023).prefix
|
|
1784
|
+
bech32.bech32.decode(userAddress.address, 1023).prefix
|
|
1763
1785
|
);
|
|
1764
1786
|
}
|
|
1765
1787
|
}
|
|
1766
|
-
return chain.bech32Prefix === bech32.decode(userAddress.address, 1023).prefix;
|
|
1788
|
+
return chain.bech32Prefix === bech32.bech32.decode(userAddress.address, 1023).prefix;
|
|
1767
1789
|
} catch {
|
|
1768
1790
|
return false;
|
|
1769
1791
|
}
|
|
1770
1792
|
case "evm" /* Evm */:
|
|
1771
1793
|
try {
|
|
1772
|
-
return isAddress(userAddress.address);
|
|
1794
|
+
return viem.isAddress(userAddress.address);
|
|
1773
1795
|
} catch (_error) {
|
|
1774
1796
|
return false;
|
|
1775
1797
|
}
|
|
1776
1798
|
case "svm" /* Svm */:
|
|
1777
1799
|
try {
|
|
1778
|
-
const publicKey = new PublicKey(userAddress.address);
|
|
1779
|
-
return PublicKey.isOnCurve(publicKey);
|
|
1800
|
+
const publicKey = new web3_js.PublicKey(userAddress.address);
|
|
1801
|
+
return web3_js.PublicKey.isOnCurve(publicKey);
|
|
1780
1802
|
} catch (_error) {
|
|
1781
1803
|
return false;
|
|
1782
1804
|
}
|
|
@@ -1787,4 +1809,4 @@ var validateUserAddresses = async (userAddresses) => {
|
|
|
1787
1809
|
return validations.every((validation) => validation);
|
|
1788
1810
|
};
|
|
1789
1811
|
|
|
1790
|
-
|
|
1812
|
+
exports.executeRoute = executeRoute;
|