@shapeshiftoss/swapper 9.6.0 → 9.6.1

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.
@@ -133,7 +133,7 @@ class ThorchainSwapper {
133
133
  }
134
134
  }
135
135
  async getTradeTxs(tradeResult) {
136
- var _a, _b, _c, _d;
136
+ var _a, _b, _c, _d, _e, _f, _g;
137
137
  try {
138
138
  const midgardTxid = tradeResult.tradeId.startsWith('0x')
139
139
  ? tradeResult.tradeId.slice(2)
@@ -149,9 +149,12 @@ class ThorchainSwapper {
149
149
  code: api_1.SwapErrorTypes.TRADE_FAILED,
150
150
  cause: responseData
151
151
  });
152
+ const standardBuyTxid = ((_g = (_f = (_e = responseData === null || responseData === void 0 ? void 0 : responseData.actions[0]) === null || _e === void 0 ? void 0 : _e.out[0]) === null || _f === void 0 ? void 0 : _f.coins[0]) === null || _g === void 0 ? void 0 : _g.asset.startsWith('ETH.'))
153
+ ? `0x${buyTxid}`
154
+ : buyTxid;
152
155
  return {
153
156
  sellTxid: tradeResult.tradeId,
154
- buyTxid: buyTxid.toLowerCase()
157
+ buyTxid: standardBuyTxid.toLowerCase()
155
158
  };
156
159
  }
157
160
  catch (e) {
@@ -18,7 +18,11 @@ export declare type PoolResponse = {
18
18
  units: string;
19
19
  volume24h: string;
20
20
  };
21
+ declare type MidardCoins = {
22
+ asset: string;
23
+ }[];
21
24
  declare type MidgardActionOut = {
25
+ coins: MidardCoins;
22
26
  txID: string;
23
27
  };
24
28
  declare type MidgardAction = {
@@ -17,7 +17,14 @@ const makeSwapMemo = ({ buyAssetId, destinationAddress, limit }) => {
17
17
  code: api_1.SwapErrorTypes.MAKE_MEMO_FAILED,
18
18
  details: { buyAssetId }
19
19
  });
20
- const memo = `s:${thorId}:${destinationAddress}:${limit}:${constants_1.THORCHAIN_AFFILIATE_NAME}:${constants_1.THORCHAIN_AFFILIATE_BIPS}`;
20
+ // bch hack
21
+ // Our bitcoin cash addresses are prefixed with `bitcoincash:`
22
+ // But thorchain memos need to be short (under 80 bytes for utxo)
23
+ // For this reason thorchain doesnt allow / need bitcoincash: in the memo
24
+ const parsedDestinationAddress = destinationAddress.includes('bitcoincash:')
25
+ ? destinationAddress.replace('bitcoincash:', '')
26
+ : destinationAddress;
27
+ const memo = `s:${thorId}:${parsedDestinationAddress}:${limit}:${constants_1.THORCHAIN_AFFILIATE_NAME}:${constants_1.THORCHAIN_AFFILIATE_BIPS}`;
21
28
  if (memo.length <= MAX_LENGTH)
22
29
  return memo;
23
30
  const abbreviationAmount = memo.length - MAX_LENGTH;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/swapper",
3
- "version": "9.6.0",
3
+ "version": "9.6.1",
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",