@shapeshiftoss/swapper 15.3.0 → 15.3.2

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.
@@ -183,8 +183,9 @@ class OsmosisSwapper {
183
183
  amount: sellAmountCryptoBaseUnit,
184
184
  };
185
185
  const responseAccount = await cosmosAdapter.getAccount(sellAddress);
186
+ const ibcAccountNumber = parseInt(responseAccount.chainSpecific.accountNumber || '0');
186
187
  const sequence = responseAccount.chainSpecific.sequence || '0';
187
- const { tradeId } = await (0, helpers_1.performIbcTransfer)(transfer, cosmosAdapter, wallet, this.deps.osmoUrl, 'uatom', constants_1.COSMO_OSMO_CHANNEL, feeData.fast.txFee, accountNumber, sequence, gas, 'uatom');
188
+ const { tradeId } = await (0, helpers_1.performIbcTransfer)(transfer, cosmosAdapter, wallet, this.deps.osmoUrl, 'uatom', constants_1.COSMO_OSMO_CHANNEL, feeData.fast.txFee, accountNumber, ibcAccountNumber, sequence, gas, 'uatom');
188
189
  cosmosIbcTradeId = tradeId;
189
190
  // wait till confirmed
190
191
  const pollResult = await (0, helpers_1.pollForComplete)(tradeId, this.deps.cosmosUrl);
@@ -240,7 +241,7 @@ class OsmosisSwapper {
240
241
  pubkey: cosmosAddress,
241
242
  pageSize: 1,
242
243
  });
243
- await (0, helpers_1.performIbcTransfer)(transfer, osmosisAdapter, wallet, this.deps.cosmosUrl, buyAssetDenom, constants_1.OSMO_COSMO_CHANNEL, '0', ibcAccountNumber, ibcSequence, gas, 'uosmo');
244
+ await (0, helpers_1.performIbcTransfer)(transfer, osmosisAdapter, wallet, this.deps.cosmosUrl, buyAssetDenom, constants_1.OSMO_COSMO_CHANNEL, '0', accountNumber, ibcAccountNumber, ibcSequence, gas, 'uosmo');
244
245
  return { tradeId, previousCosmosTxid: (_a = cosmosTxHistory.transactions[0]) === null || _a === void 0 ? void 0 : _a.txid, cosmosAddress };
245
246
  }
246
247
  return { tradeId, previousCosmosTxid: cosmosIbcTradeId };
@@ -21,7 +21,7 @@ export declare const getRateInfo: (sellAsset: string, buyAsset: string, sellAmou
21
21
  buyAssetTradeFeeUsd: string;
22
22
  buyAmountCryptoBaseUnit: string;
23
23
  }>;
24
- export declare const performIbcTransfer: (input: IbcTransferInput, adapter: CosmosSdkSupportedChainAdapters, wallet: HDWallet, blockBaseUrl: string, denom: string, sourceChannel: string, feeAmount: string, accountNumber: number, sequence: string, gas: string, feeDenom: string) => Promise<TradeResult>;
24
+ export declare const performIbcTransfer: (input: IbcTransferInput, adapter: CosmosSdkSupportedChainAdapters, wallet: HDWallet, blockBaseUrl: string, denom: string, sourceChannel: string, feeAmount: string, accountNumber: number, ibcAccountNumber: number, sequence: string, gas: string, feeDenom: string) => Promise<TradeResult>;
25
25
  export declare const buildTradeTx: ({ osmoAddress, adapter, accountNumber, buyAssetDenom, sellAssetDenom, sellAmount, gas, wallet, }: {
26
26
  osmoAddress: string;
27
27
  adapter: osmosis.ChainAdapter;
@@ -161,7 +161,7 @@ const getRateInfo = async (sellAsset, buyAsset, sellAmount, osmoUrl) => {
161
161
  };
162
162
  exports.getRateInfo = getRateInfo;
163
163
  // TODO: move to chain adapters
164
- const performIbcTransfer = async (input, adapter, wallet, blockBaseUrl, denom, sourceChannel, feeAmount, accountNumber, sequence, gas, feeDenom) => {
164
+ const performIbcTransfer = async (input, adapter, wallet, blockBaseUrl, denom, sourceChannel, feeAmount, accountNumber, ibcAccountNumber, sequence, gas, feeDenom) => {
165
165
  const { sender, receiver, amount } = input;
166
166
  const responseLatestBlock = await (async () => {
167
167
  try {
@@ -212,7 +212,7 @@ const performIbcTransfer = async (input, adapter, wallet, blockBaseUrl, denom, s
212
212
  tx,
213
213
  addressNList: (0, chain_adapters_1.toAddressNList)(bip44Params),
214
214
  chain_id: (0, caip_1.fromChainId)(adapter.getChainId()).chainReference,
215
- account_number: accountNumber.toString(),
215
+ account_number: ibcAccountNumber.toString(),
216
216
  sequence,
217
217
  },
218
218
  wallet,
@@ -226,6 +226,8 @@ exports.performIbcTransfer = performIbcTransfer;
226
226
  // TODO: move to chain adapters
227
227
  const buildTradeTx = async ({ osmoAddress, adapter, accountNumber, buyAssetDenom, sellAssetDenom, sellAmount, gas, wallet, }) => {
228
228
  const responseAccount = await adapter.getAccount(osmoAddress);
229
+ // note - this is a cosmos sdk specific account_number, not a bip44Params accountNumber
230
+ const account_number = responseAccount.chainSpecific.accountNumber || '0';
229
231
  const sequence = responseAccount.chainSpecific.sequence || '0';
230
232
  const tx = {
231
233
  memo: '',
@@ -265,7 +267,7 @@ const buildTradeTx = async ({ osmoAddress, adapter, accountNumber, buyAssetDenom
265
267
  tx,
266
268
  addressNList: (0, chain_adapters_1.toAddressNList)(bip44Params),
267
269
  chain_id: caip_1.CHAIN_REFERENCE.OsmosisMainnet,
268
- account_number: accountNumber.toString(),
270
+ account_number,
269
271
  sequence,
270
272
  },
271
273
  wallet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "15.3.0",
3
+ "version": "15.3.2",
4
4
  "description": "An interface and implementations to trade coins via various protocols",
5
5
  "repository": "https://github.com/shapeshift/lib",
6
6
  "license": "MIT",