@avail-project/ca-common 2.3.0 → 3.0.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.
Files changed (95) hide show
  1. package/dist/cjs/index.js +10593 -20
  2. package/dist/esm/index.mjs +10603 -0
  3. package/dist/types/index.d.ts +2608 -13
  4. package/package.json +41 -37
  5. package/dist/cjs/_polyfill.js +0 -147
  6. package/dist/cjs/balances/ub-api.js +0 -25
  7. package/dist/cjs/cosmos/index.js +0 -31
  8. package/dist/cjs/data/chaindata.js +0 -788
  9. package/dist/cjs/data/chainid.js +0 -93
  10. package/dist/cjs/data/currency.js +0 -78
  11. package/dist/cjs/data/index.js +0 -7
  12. package/dist/cjs/data/utils.js +0 -44
  13. package/dist/cjs/evmabi/erc20.abi.js +0 -349
  14. package/dist/cjs/evmabi/fibrousrouter.abi.js +0 -41
  15. package/dist/cjs/evmabi/index.js +0 -7
  16. package/dist/cjs/evmabi/vault.abi.js +0 -1021
  17. package/dist/cjs/evmabi/yakaggregator.abi.js +0 -275
  18. package/dist/cjs/permitutils/index.js +0 -186
  19. package/dist/cjs/proto/client.js +0 -48
  20. package/dist/cjs/proto/definition.js +0 -4131
  21. package/dist/cjs/proto/grpc.js +0 -298
  22. package/dist/cjs/rff/rff.js +0 -42
  23. package/dist/cjs/types/binarytypes.js +0 -2
  24. package/dist/cjs/types/index.js +0 -5
  25. package/dist/cjs/types/msgpack-axios.js +0 -22
  26. package/dist/cjs/vaultcontracts/index.js +0 -4
  27. package/dist/cjs/vaultcontracts/vaultcontracts.js +0 -222
  28. package/dist/cjs/xcs/autochoice.js +0 -575
  29. package/dist/cjs/xcs/bebop-agg.js +0 -156
  30. package/dist/cjs/xcs/fibrous-agg.js +0 -155
  31. package/dist/cjs/xcs/iface.js +0 -13
  32. package/dist/cjs/xcs/index.js +0 -9
  33. package/dist/cjs/xcs/lifi-agg.js +0 -177
  34. package/dist/cjs/xcs/selectsources.js +0 -255
  35. package/dist/esm/_polyfill.js +0 -143
  36. package/dist/esm/balances/ub-api.js +0 -21
  37. package/dist/esm/cosmos/index.js +0 -26
  38. package/dist/esm/data/chaindata.js +0 -785
  39. package/dist/esm/data/chainid.js +0 -87
  40. package/dist/esm/data/currency.js +0 -73
  41. package/dist/esm/data/index.js +0 -4
  42. package/dist/esm/data/utils.js +0 -34
  43. package/dist/esm/evmabi/erc20.abi.js +0 -346
  44. package/dist/esm/evmabi/fibrousrouter.abi.js +0 -38
  45. package/dist/esm/evmabi/index.js +0 -4
  46. package/dist/esm/evmabi/vault.abi.js +0 -1018
  47. package/dist/esm/evmabi/yakaggregator.abi.js +0 -272
  48. package/dist/esm/index.js +0 -13
  49. package/dist/esm/permitutils/index.js +0 -181
  50. package/dist/esm/proto/client.js +0 -11
  51. package/dist/esm/proto/definition.js +0 -4122
  52. package/dist/esm/proto/grpc.js +0 -292
  53. package/dist/esm/rff/rff.js +0 -38
  54. package/dist/esm/types/binarytypes.js +0 -1
  55. package/dist/esm/types/index.js +0 -2
  56. package/dist/esm/types/msgpack-axios.js +0 -18
  57. package/dist/esm/vaultcontracts/index.js +0 -1
  58. package/dist/esm/vaultcontracts/vaultcontracts.js +0 -218
  59. package/dist/esm/xcs/autochoice.js +0 -559
  60. package/dist/esm/xcs/bebop-agg.js +0 -151
  61. package/dist/esm/xcs/fibrous-agg.js +0 -150
  62. package/dist/esm/xcs/iface.js +0 -10
  63. package/dist/esm/xcs/index.js +0 -6
  64. package/dist/esm/xcs/lifi-agg.js +0 -172
  65. package/dist/esm/xcs/selectsources.js +0 -251
  66. package/dist/types/_polyfill.d.ts +0 -1
  67. package/dist/types/balances/ub-api.d.ts +0 -14
  68. package/dist/types/cosmos/index.d.ts +0 -6
  69. package/dist/types/data/chaindata.d.ts +0 -20
  70. package/dist/types/data/chainid.d.ts +0 -31
  71. package/dist/types/data/currency.d.ts +0 -30
  72. package/dist/types/data/index.d.ts +0 -4
  73. package/dist/types/data/utils.d.ts +0 -10
  74. package/dist/types/evmabi/erc20.abi.d.ts +0 -264
  75. package/dist/types/evmabi/fibrousrouter.abi.d.ts +0 -77
  76. package/dist/types/evmabi/index.d.ts +0 -4
  77. package/dist/types/evmabi/vault.abi.d.ts +0 -785
  78. package/dist/types/evmabi/yakaggregator.abi.d.ts +0 -298
  79. package/dist/types/permitutils/index.d.ts +0 -13
  80. package/dist/types/proto/client.d.ts +0 -2
  81. package/dist/types/proto/definition.d.ts +0 -382
  82. package/dist/types/proto/grpc.d.ts +0 -75
  83. package/dist/types/rff/rff.d.ts +0 -9
  84. package/dist/types/types/binarytypes.d.ts +0 -1
  85. package/dist/types/types/index.d.ts +0 -2
  86. package/dist/types/types/msgpack-axios.d.ts +0 -1
  87. package/dist/types/vaultcontracts/index.d.ts +0 -22
  88. package/dist/types/vaultcontracts/vaultcontracts.d.ts +0 -8
  89. package/dist/types/xcs/autochoice.d.ts +0 -104
  90. package/dist/types/xcs/bebop-agg.d.ts +0 -104
  91. package/dist/types/xcs/fibrous-agg.d.ts +0 -56
  92. package/dist/types/xcs/iface.d.ts +0 -69
  93. package/dist/types/xcs/index.d.ts +0 -6
  94. package/dist/types/xcs/lifi-agg.d.ts +0 -42
  95. package/dist/types/xcs/selectsources.d.ts +0 -27
@@ -1,255 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.selectSources = selectSources;
4
- const tslib_1 = require("tslib");
5
- const decimal_js_1 = tslib_1.__importDefault(require("decimal.js"));
6
- const iface_1 = require("./iface");
7
- const autochoice_1 = require("./autochoice");
8
- const data_1 = require("../data");
9
- const safetyMultiplier = new decimal_js_1.default("1.025");
10
- async function selectSources(args) {
11
- const { sources, outputRequired, aggregators, commonCurrencyID = data_1.CurrencyID.USDC, prefixHeadroom = new decimal_js_1.default("1.25"), } = args;
12
- console.debug("XCS | SS:", {
13
- sources,
14
- outputRequired: outputRequired.toFixed(),
15
- prefixHeadroom: prefixHeadroom.toFixed(),
16
- });
17
- const cotList = [];
18
- const nonCOTQuotes = [];
19
- for (const [idx, src] of sources.entries()) {
20
- const chain = data_1.ChaindataMap.get(src.chainID);
21
- if (chain == null) {
22
- throw new autochoice_1.AutoSelectionError("Chain not found");
23
- }
24
- const cot = chain.Currencies.find((c) => c.currencyID === commonCurrencyID);
25
- if (cot == null) {
26
- console.debug("XCS | SS | Skipping source — no COT on chain", { chain });
27
- continue;
28
- }
29
- const originalHolding = {
30
- chainID: src.chainID,
31
- tokenAddress: src.tokenAddress,
32
- amountRaw: src.amountRaw,
33
- };
34
- if (Buffer.compare(src.tokenAddress, cot.tokenAddress) === 0) {
35
- const normalizedAmount = new decimal_js_1.default(src.amountRaw.toString()).div(decimal_js_1.default.pow(10, cot.decimals));
36
- cotList.push({
37
- amount: normalizedAmount,
38
- idx,
39
- chainID: src.chainID,
40
- currency: cot,
41
- originalHolding,
42
- });
43
- }
44
- else {
45
- nonCOTQuotes.push({
46
- req: {
47
- userAddress: src.takerAddress,
48
- receiverAddress: src.receiverAddress,
49
- type: iface_1.QuoteType.EXACT_IN,
50
- chain: chain.ChainID,
51
- inputToken: src.tokenAddress,
52
- inputAmount: src.amountRaw,
53
- outputToken: cot.tokenAddress,
54
- seriousness: iface_1.QuoteSeriousness.PRICE_SURVEY,
55
- },
56
- originalHolding,
57
- cur: cot,
58
- idx,
59
- value: src.value,
60
- });
61
- }
62
- }
63
- // Continuous-COT fast path — covers outputRequired without touching any aggregator.
64
- if (cotList.length > 0 && cotList[0].idx === 0) {
65
- let continuousAmount = new decimal_js_1.default(0);
66
- let continuousCount = 0;
67
- for (const cot of cotList) {
68
- if (cot.idx !== continuousCount)
69
- break;
70
- continuousAmount = continuousAmount.add(cot.amount);
71
- continuousCount++;
72
- if (continuousAmount.gte(outputRequired)) {
73
- console.log("XCS | SS | Continuous COTs cover requirement, no quotes needed");
74
- const usedCOTs = [];
75
- let r = outputRequired;
76
- for (let i = 0; i < continuousCount; i++) {
77
- const c = cotList[i];
78
- const amountToUse = decimal_js_1.default.min(r, c.amount);
79
- usedCOTs.push({
80
- originalHolding: c.originalHolding,
81
- amountUsed: amountToUse,
82
- idx: c.idx,
83
- cur: c.currency,
84
- });
85
- r = r.minus(amountToUse);
86
- if (r.lte(0))
87
- break;
88
- }
89
- return { quoteResponses: [], usedCOTs };
90
- }
91
- }
92
- }
93
- const queue = [];
94
- for (const c of cotList) {
95
- queue.push({ idx: c.idx, isCOT: true, cotData: c });
96
- }
97
- for (const q of nonCOTQuotes) {
98
- queue.push({ idx: q.idx, isCOT: false, quoteData: q });
99
- }
100
- queue.sort((a, b) => a.idx - b.idx);
101
- // Smallest priority-ordered prefix whose cumulative value covers
102
- // `outputRequired × prefixHeadroom`. Quote only that prefix initially; the batch
103
- // is extended below if realised aggregator output under-delivers.
104
- const target = outputRequired.mul(prefixHeadroom);
105
- let cumulative = new decimal_js_1.default(0);
106
- let prefixCutoffIdx = null;
107
- for (const item of queue) {
108
- if (item.isCOT) {
109
- cumulative = cumulative.add(item.cotData.amount);
110
- }
111
- else {
112
- cumulative = cumulative.add(item.quoteData.value);
113
- }
114
- if (cumulative.gte(target)) {
115
- prefixCutoffIdx = item.idx;
116
- break;
117
- }
118
- }
119
- console.debug("XCS | SS | Prefix selected", {
120
- prefixCutoffIdx,
121
- cumulative: cumulative.toFixed(),
122
- target: target.toFixed(),
123
- });
124
- const responseByIdx = new Map();
125
- const quoteAndStore = async (batch) => {
126
- if (batch.length === 0)
127
- return;
128
- const r = await (0, autochoice_1.aggregateAggregators)(batch.map((b) => b.req), aggregators, autochoice_1.AggregateAggregatorsMode.MaximizeOutput);
129
- for (let i = 0; i < batch.length; i++) {
130
- responseByIdx.set(batch[i].idx, r[i]);
131
- }
132
- };
133
- const initialBatch = prefixCutoffIdx == null
134
- ? nonCOTQuotes
135
- : nonCOTQuotes.filter((q) => q.idx <= prefixCutoffIdx);
136
- console.debug("XCS | SS | Initial quote batch", {
137
- initialCount: initialBatch.length,
138
- totalNonCOT: nonCOTQuotes.length,
139
- });
140
- await quoteAndStore(initialBatch);
141
- const final = [];
142
- const usedCOTs = [];
143
- let remainder = outputRequired;
144
- for (const item of queue) {
145
- if (remainder.lte(0))
146
- break;
147
- if (item.isCOT) {
148
- const { cotData } = item;
149
- const amountToUse = decimal_js_1.default.min(remainder, cotData.amount);
150
- usedCOTs.push({
151
- originalHolding: cotData.originalHolding,
152
- amountUsed: amountToUse,
153
- idx: cotData.idx,
154
- cur: cotData.currency,
155
- });
156
- remainder = remainder.minus(amountToUse);
157
- console.debug("XCS | SS | cot", {
158
- idx: cotData.idx,
159
- amountToUse: amountToUse.toFixed(),
160
- remainder: remainder.toFixed(),
161
- });
162
- continue;
163
- }
164
- const { quoteData } = item;
165
- let lookup = responseByIdx.get(quoteData.idx);
166
- if (lookup == null) {
167
- // Prefix under-delivered: quote every non-COT we haven't yet and continue.
168
- const unquoted = nonCOTQuotes.filter((q) => !responseByIdx.has(q.idx));
169
- console.log("XCS | SS | Prefix under-delivered, extending batch", {
170
- remaining: unquoted.length,
171
- });
172
- await quoteAndStore(unquoted);
173
- lookup = responseByIdx.get(quoteData.idx);
174
- }
175
- if (lookup == null)
176
- continue;
177
- const { quote: resp, aggregator } = lookup;
178
- if (resp == null)
179
- continue;
180
- console.debug("XCS | SS | quote-eval", {
181
- idx: quoteData.idx,
182
- remainder: remainder.toFixed(),
183
- input: resp.input,
184
- output: resp.output,
185
- });
186
- const divisor = decimal_js_1.default.pow(10, quoteData.cur.decimals);
187
- const oamD = new decimal_js_1.default(resp.output.amount);
188
- if (oamD.gt(remainder)) {
189
- const indicativePrice = decimal_js_1.default.div(resp.input.amountRaw.toString(), resp.output.amountRaw.toString());
190
- const userBal = new decimal_js_1.default(quoteData.originalHolding.amountRaw.toString());
191
- let expectedInput = decimal_js_1.default.min(remainder.mul(divisor).mul(indicativePrice).mul(safetyMultiplier), userBal);
192
- let attempts = 0;
193
- while (true) {
194
- if (++attempts > 10) {
195
- throw new autochoice_1.AutoSelectionError("Partial quote did not converge");
196
- }
197
- console.debug("XCS | SS | partial_quote_loop", {
198
- indicativePrice: indicativePrice.toFixed(),
199
- expectedInput: expectedInput.toFixed(),
200
- userBal: userBal.toFixed(),
201
- remainder: remainder.toFixed(),
202
- });
203
- const adequate = await (0, autochoice_1.aggregateAggregators)([
204
- {
205
- ...quoteData.req,
206
- seriousness: iface_1.QuoteSeriousness.SERIOUS,
207
- inputAmount: (0, data_1.convertDecimalToBigInt)(expectedInput),
208
- },
209
- ], aggregators, autochoice_1.AggregateAggregatorsMode.MaximizeOutput);
210
- if (adequate.length !== 1) {
211
- throw new autochoice_1.AutoSelectionError("Unexpected response length from aggregateAggregators");
212
- }
213
- const aq = adequate[0];
214
- if (aq.quote == null) {
215
- throw new autochoice_1.AutoSelectionError("Couldn't get buy quote");
216
- }
217
- const oam2D = new decimal_js_1.default(aq.quote.output.amount);
218
- if (oam2D.gte(remainder)) {
219
- final.push({
220
- quote: aq.quote,
221
- aggregator: aq.aggregator,
222
- holding: quoteData.originalHolding,
223
- chainID: Number(quoteData.req.chain.chainID),
224
- });
225
- remainder = remainder.minus(oam2D);
226
- break;
227
- }
228
- else if (expectedInput.eq(userBal)) {
229
- throw new autochoice_1.AutoSelectionError("Holding was supposedly enough to meet the full requirement but ceased to be so subsequently");
230
- }
231
- else {
232
- expectedInput = decimal_js_1.default.min(expectedInput.mul(safetyMultiplier), userBal);
233
- }
234
- }
235
- }
236
- else {
237
- final.push({
238
- quote: resp,
239
- holding: quoteData.originalHolding,
240
- aggregator,
241
- chainID: Number(quoteData.req.chain.chainID),
242
- });
243
- remainder = remainder.minus(resp.output.amount);
244
- console.debug("XCS | SS | full_quote", {
245
- idx: quoteData.idx,
246
- remainder: remainder.toFixed(),
247
- });
248
- }
249
- }
250
- if (remainder.gt(0)) {
251
- throw new autochoice_1.AutoSelectionError("NOT_ENOUGH_SWAP_FOR_REQUIREMENT");
252
- }
253
- console.log("XCS | SS | final_quotes", { quotes: final, cots: usedCOTs });
254
- return { quoteResponses: final, usedCOTs };
255
- }
@@ -1,143 +0,0 @@
1
- import * as bufferModule from "buffer";
2
- import { Buffer as DefaultBuffer } from "buffer";
3
- const globalScope = globalThis;
4
- let patched = false;
5
- function collectBufferCtors() {
6
- const candidates = new Set();
7
- if (typeof DefaultBuffer === "function") {
8
- candidates.add(DefaultBuffer);
9
- }
10
- const mod = bufferModule;
11
- if (typeof mod?.Buffer === "function") {
12
- candidates.add(mod.Buffer);
13
- }
14
- const defaultExport = mod?.default;
15
- if (typeof defaultExport === "function") {
16
- candidates.add(defaultExport);
17
- }
18
- else if (defaultExport &&
19
- typeof defaultExport === "object" &&
20
- typeof defaultExport.Buffer === "function") {
21
- candidates.add(defaultExport.Buffer);
22
- }
23
- if (typeof globalScope.Buffer === "function") {
24
- candidates.add(globalScope.Buffer);
25
- }
26
- return Array.from(candidates);
27
- }
28
- function assertOffset(buffer, offset) {
29
- const numericOffset = Number(offset);
30
- if (!Number.isFinite(numericOffset)) {
31
- throw new TypeError("Offset must be a finite number");
32
- }
33
- const normalized = numericOffset >>> 0;
34
- if (normalized !== numericOffset) {
35
- throw new RangeError("Offset must be a non-negative integer");
36
- }
37
- if (normalized + 4 > buffer.length) {
38
- throw new RangeError("Offset out of bounds");
39
- }
40
- return normalized;
41
- }
42
- function fallbackWriteUint32BE(value, offset = 0) {
43
- const o = assertOffset(this, offset);
44
- const normalized = Number(value) >>> 0;
45
- this[o] = (normalized >>> 24) & 0xff;
46
- this[o + 1] =
47
- (normalized >>> 16) & 0xff;
48
- this[o + 2] =
49
- (normalized >>> 8) & 0xff;
50
- this[o + 3] = normalized & 0xff;
51
- return o + 4;
52
- }
53
- function fallbackWriteUint32LE(value, offset = 0) {
54
- const o = assertOffset(this, offset);
55
- const normalized = Number(value) >>> 0;
56
- this[o] = normalized & 0xff;
57
- this[o + 1] =
58
- (normalized >>> 8) & 0xff;
59
- this[o + 2] =
60
- (normalized >>> 16) & 0xff;
61
- this[o + 3] =
62
- (normalized >>> 24) & 0xff;
63
- return o + 4;
64
- }
65
- function fallbackReadUint32BE(offset = 0) {
66
- const o = assertOffset(this, offset);
67
- const store = this;
68
- return ((store[o] * 0x1000000 +
69
- ((store[o + 1] << 16) | (store[o + 2] << 8) | store[o + 3])) >>>
70
- 0);
71
- }
72
- function fallbackReadUint32LE(offset = 0) {
73
- const o = assertOffset(this, offset);
74
- const store = this;
75
- return ((store[o] |
76
- (store[o + 1] << 8) |
77
- (store[o + 2] << 16) |
78
- (store[o + 3] * 0x1000000)) >>>
79
- 0);
80
- }
81
- function aliasOrDefine(proto, alias, canonical, fallback) {
82
- const aliasKey = alias;
83
- const canonicalKey = canonical;
84
- const existingAlias = proto[aliasKey];
85
- if (typeof existingAlias === "function") {
86
- return;
87
- }
88
- const canonicalFn = proto[canonicalKey];
89
- if (typeof canonicalFn === "function") {
90
- Object.defineProperty(proto, aliasKey, {
91
- value: canonicalFn,
92
- writable: true,
93
- configurable: true,
94
- });
95
- return;
96
- }
97
- Object.defineProperty(proto, aliasKey, {
98
- value: fallback,
99
- writable: true,
100
- configurable: true,
101
- });
102
- }
103
- function patchPrototype(bufferCtor) {
104
- const proto = bufferCtor.prototype;
105
- if (!proto) {
106
- return;
107
- }
108
- aliasOrDefine(proto, "writeUint32BE", "writeUInt32BE", fallbackWriteUint32BE);
109
- aliasOrDefine(proto, "writeUint32LE", "writeUInt32LE", fallbackWriteUint32LE);
110
- aliasOrDefine(proto, "readUint32BE", "readUInt32BE", fallbackReadUint32BE);
111
- aliasOrDefine(proto, "readUint32LE", "readUInt32LE", fallbackReadUint32LE);
112
- }
113
- function ensureProcessEnv() {
114
- if (!globalScope.process) {
115
- globalScope.process = { env: { NODE_ENV: "production" } };
116
- return;
117
- }
118
- const processValue = globalScope.process;
119
- if (!processValue.env) {
120
- processValue.env = { NODE_ENV: "production" };
121
- return;
122
- }
123
- if (typeof processValue.env.NODE_ENV === "undefined") {
124
- processValue.env.NODE_ENV = "production";
125
- }
126
- }
127
- export function ensureBufferPolyfill() {
128
- if (patched) {
129
- return;
130
- }
131
- const candidates = collectBufferCtors();
132
- candidates.forEach(patchPrototype);
133
- const preferred = candidates[0];
134
- if (preferred &&
135
- (typeof globalScope.Buffer !== "function" ||
136
- typeof globalScope.Buffer.prototype?.writeUint32BE !==
137
- "function")) {
138
- globalScope.Buffer = preferred;
139
- }
140
- ensureProcessEnv();
141
- patched = true;
142
- }
143
- ensureBufferPolyfill();
@@ -1,21 +0,0 @@
1
- import Decimal from "decimal.js";
2
- import { Universe } from "../proto/definition";
3
- import { msgpackableAxios } from "../types";
4
- import { OmniversalChainID } from "../data";
5
- import { bytesToHex } from "viem";
6
- export async function getBalances(vscURL, universe, address) {
7
- const resp = await msgpackableAxios({
8
- baseURL: vscURL,
9
- url: `/api/v1/get-balance/${Universe[universe]}/${bytesToHex(address)}`,
10
- });
11
- const { data } = resp;
12
- return data.balances.map(bal => ({
13
- chainID: new OmniversalChainID(bal.universe, bal.chain_id),
14
- totalValue: new Decimal(bal.total_usd),
15
- currencywise: bal.currencies.map(cur => ({
16
- tokenAddress: cur.token_address,
17
- amount: new Decimal(cur.balance),
18
- value: new Decimal(cur.value)
19
- }))
20
- }));
21
- }
@@ -1,26 +0,0 @@
1
- import { Registry as CosmosRegistry, DirectSecp256k1Wallet, } from "@cosmjs/proto-signing";
2
- import { defaultRegistryTypes, SigningStargateClient, } from "@cosmjs/stargate";
3
- import { hexToBytes } from "viem";
4
- import { MsgCreateRequestForFunds, MsgCreateRequestForFundsResponse, MsgCreateSolverData, MsgCreateSolverDataResponse, MsgDoubleCheckTx, MsgRefundReq, MsgRefundReqResponse, MsgUpdateSolverData, } from "../proto/definition";
5
- export const Registry = new CosmosRegistry(defaultRegistryTypes);
6
- {
7
- Registry.register("/xarchain.chainabstraction.MsgCreateSolverData", MsgCreateSolverData);
8
- Registry.register("/xarchain.chainabstraction.MsgCreateSolverDataResponse", MsgCreateSolverDataResponse);
9
- Registry.register("/xarchain.chainabstraction.MsgUpdateSolverData", MsgUpdateSolverData);
10
- Registry.register("/xarchain.chainabstraction.MsgUpdateSolverDataResponse", MsgCreateSolverDataResponse);
11
- Registry.register("/xarchain.chainabstraction.MsgCreateRequestForFunds", MsgCreateRequestForFunds);
12
- Registry.register("/xarchain.chainabstraction.MsgCreateRequestForFundsResponse", MsgCreateRequestForFundsResponse);
13
- Registry.register("/xarchain.chainabstraction.MsgRefundReq", MsgRefundReq);
14
- Registry.register("/xarchain.chainabstraction.MsgRefundReqResponse", MsgRefundReqResponse);
15
- Registry.register("/xarchain.chainabstraction.MsgDoubleCheckTx", MsgDoubleCheckTx);
16
- }
17
- export function createCosmosWallet(privateKey) {
18
- const pkBytes = typeof privateKey === "string" ? hexToBytes(privateKey) : privateKey;
19
- return DirectSecp256k1Wallet.fromKey(pkBytes, "arcana");
20
- }
21
- export function createCosmosClient(signer, endpoint, options) {
22
- return SigningStargateClient.connectWithSigner(endpoint, signer, {
23
- registry: Registry,
24
- ...options,
25
- });
26
- }