@shapeshiftoss/unchained-client 10.1.1 → 10.2.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.
@@ -15,22 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.BaseTransactionParser = void 0;
18
- const caip_1 = require("@shapeshiftoss/caip");
19
- const logger_1 = require("@shapeshiftoss/logger");
20
18
  const bignumber_js_1 = require("bignumber.js");
21
19
  const types_1 = require("../../types");
22
20
  const utils_1 = require("../../utils");
23
21
  const utils_2 = require("./utils");
24
22
  __exportStar(require("./types"), exports);
25
- const logger = new logger_1.Logger({
26
- namespace: ['unchained-client', 'cosmossdk', 'parser'],
27
- level: process.env.LOG_LEVEL,
28
- });
29
- const assetIdByDenom = new Map([
30
- ['uatom', caip_1.cosmosAssetId],
31
- ['uosmo', caip_1.osmosisAssetId],
32
- ['rune', caip_1.thorchainAssetId],
33
- ]);
34
23
  class BaseTransactionParser {
35
24
  constructor(args) {
36
25
  this.chainId = args.chainId;
@@ -48,28 +37,9 @@ class BaseTransactionParser {
48
37
  transfers: [],
49
38
  txid: tx.txid,
50
39
  };
51
- parsedTx.data = (0, utils_2.metaData)(tx.messages[0], this.assetId);
52
- tx.messages.forEach(({ from = '', to = '', value, origin }) => {
40
+ tx.messages.forEach((msg, i) => {
53
41
  var _a;
54
- const amount = new bignumber_js_1.BigNumber((_a = value === null || value === void 0 ? void 0 : value.amount) !== null && _a !== void 0 ? _a : 0);
55
- const assetId = (() => {
56
- if (!(value === null || value === void 0 ? void 0 : value.denom))
57
- return this.assetId;
58
- if (assetIdByDenom.has(value.denom))
59
- return assetIdByDenom.get(value.denom);
60
- const [assetNamespace, assetReference] = value.denom.split('/');
61
- if (assetNamespace === 'ibc' && assetReference) {
62
- return (0, caip_1.toAssetId)({ chainId: this.chainId, assetNamespace, assetReference });
63
- }
64
- logger.warn(`unknown denom: ${value.denom}, defaulting to: ${this.assetId}`);
65
- return this.assetId;
66
- })();
67
- if (from === address && amount.gt(0)) {
68
- parsedTx.transfers = (0, utils_1.aggregateTransfer)(parsedTx.transfers, types_1.TransferType.Send, assetId, from, to, amount.toString(10));
69
- }
70
- if (to === address && amount.gt(0)) {
71
- parsedTx.transfers = (0, utils_1.aggregateTransfer)(parsedTx.transfers, types_1.TransferType.Receive, assetId, from, to, amount.toString(10));
72
- }
42
+ const { from, to, value, origin } = msg;
73
43
  // We use origin for fees because some txs have a different from and origin addresses
74
44
  if (origin === address) {
75
45
  // network fee
@@ -78,6 +48,18 @@ class BaseTransactionParser {
78
48
  parsedTx.fee = { assetId: this.assetId, value: fees.toString(10) };
79
49
  }
80
50
  }
51
+ const assetId = (0, utils_2.getAssetIdByDenom)(value === null || value === void 0 ? void 0 : value.denom, this.assetId);
52
+ if (!assetId)
53
+ return;
54
+ if (i === 0)
55
+ parsedTx.data = (0, utils_2.metaData)(msg, tx.events[String(i)], assetId);
56
+ const amount = new bignumber_js_1.BigNumber((_a = value === null || value === void 0 ? void 0 : value.amount) !== null && _a !== void 0 ? _a : 0);
57
+ if (from === address && amount.gt(0)) {
58
+ parsedTx.transfers = (0, utils_1.aggregateTransfer)(parsedTx.transfers, types_1.TransferType.Send, assetId, from, to, amount.toString(10));
59
+ }
60
+ if (to === address && amount.gt(0)) {
61
+ parsedTx.transfers = (0, utils_1.aggregateTransfer)(parsedTx.transfers, types_1.TransferType.Receive, assetId, from, to, amount.toString(10));
62
+ }
81
63
  });
82
64
  return parsedTx;
83
65
  }
@@ -1,16 +1,30 @@
1
1
  import { BaseTxMetadata, StandardTx } from '../../types';
2
2
  import * as cosmossdk from '../types';
3
3
  export declare type Tx = cosmossdk.Tx;
4
- export interface TxMetadata extends BaseTxMetadata {
5
- parser: 'cosmos';
6
- delegator?: string;
4
+ export interface StakingMetadata extends BaseTxMetadata {
5
+ parser: 'staking';
6
+ delegator: string;
7
7
  sourceValidator?: string;
8
- destinationValidator?: string;
9
- assetId?: string;
10
- value?: string;
11
- ibcDestination?: string;
12
- ibcSource?: string;
8
+ destinationValidator: string;
9
+ assetId: string;
10
+ value: string;
13
11
  }
12
+ export interface IbcMetadata extends BaseTxMetadata {
13
+ parser: 'ibc';
14
+ ibcDestination: string;
15
+ ibcSource: string;
16
+ assetId: string;
17
+ value: string;
18
+ }
19
+ export interface SwapMetadata extends BaseTxMetadata {
20
+ parser: 'swap';
21
+ memo: string;
22
+ }
23
+ export interface LpMetadata extends BaseTxMetadata {
24
+ parser: 'lp';
25
+ pool: string;
26
+ }
27
+ export declare type TxMetadata = StakingMetadata | IbcMetadata | SwapMetadata | LpMetadata;
14
28
  export interface ParsedTx extends StandardTx {
15
29
  data?: TxMetadata;
16
30
  }
@@ -1,3 +1,5 @@
1
+ import { AssetId } from '@shapeshiftoss/caip';
1
2
  import { Message } from '../types';
2
3
  import { TxMetadata } from './types';
3
- export declare const metaData: (msg: Message | undefined, assetId: string) => TxMetadata | undefined;
4
+ export declare const getAssetIdByDenom: (denom: string, assetId: string) => AssetId | undefined;
5
+ export declare const metaData: (msg: Message, event: Record<string, Record<string, string>>, assetId: string) => TxMetadata | undefined;
@@ -1,54 +1,101 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.metaData = void 0;
3
+ exports.metaData = exports.getAssetIdByDenom = void 0;
4
+ const caip_1 = require("@shapeshiftoss/caip");
4
5
  const logger_1 = require("@shapeshiftoss/logger");
5
6
  const logger = new logger_1.Logger({
6
7
  namespace: ['unchained-client', 'cosmossdk', 'parser', 'utils'],
7
8
  level: process.env.LOG_LEVEL,
8
9
  });
9
- // TODO: break out metadata by parser category to allow more explicit metadata types and pull out chain specific logic to appropriate chain parser
10
- const metaData = (msg, assetId) => {
11
- var _a, _b, _c, _d;
12
- if (!msg)
13
- return;
10
+ const assetIdByDenom = new Map([
11
+ ['uatom', caip_1.cosmosAssetId],
12
+ ['uosmo', caip_1.osmosisAssetId],
13
+ ['rune', caip_1.thorchainAssetId],
14
+ ]);
15
+ const getAssetIdByDenom = (denom, assetId) => {
16
+ if (assetIdByDenom.has(denom))
17
+ return assetIdByDenom.get(denom);
18
+ const { chainId } = (0, caip_1.fromAssetId)(assetId);
19
+ const [assetNamespace, assetReference] = denom.split('/');
20
+ if (assetNamespace === 'ibc' && assetReference) {
21
+ return (0, caip_1.toAssetId)({ chainId, assetNamespace, assetReference });
22
+ }
23
+ logger.warn(`unknown denom: ${denom}`);
24
+ return;
25
+ };
26
+ exports.getAssetIdByDenom = getAssetIdByDenom;
27
+ const metaData = (msg, event, assetId) => {
28
+ var _a, _b, _c, _d, _e;
14
29
  switch (msg.type) {
15
30
  case 'delegate':
16
- case 'begin_unbonding':
17
31
  return {
18
- parser: 'cosmos',
32
+ parser: 'staking',
19
33
  method: msg.type,
20
- delegator: msg.from,
34
+ value: msg.value.amount,
35
+ assetId: (_a = (0, exports.getAssetIdByDenom)(msg.value.denom, assetId)) !== null && _a !== void 0 ? _a : '',
36
+ delegator: msg.origin,
21
37
  destinationValidator: msg.to,
22
- value: (_a = msg === null || msg === void 0 ? void 0 : msg.value) === null || _a === void 0 ? void 0 : _a.amount,
38
+ };
39
+ case 'begin_unbonding':
40
+ return {
41
+ parser: 'staking',
42
+ method: msg.type,
43
+ value: msg.value.amount,
44
+ assetId: (_b = (0, exports.getAssetIdByDenom)(msg.value.denom, assetId)) !== null && _b !== void 0 ? _b : '',
45
+ delegator: msg.origin,
46
+ destinationValidator: msg.from,
23
47
  };
24
48
  case 'begin_redelegate':
25
49
  return {
26
- parser: 'cosmos',
50
+ parser: 'staking',
27
51
  method: msg.type,
28
- sourceValidator: msg.from,
52
+ value: msg.value.amount,
53
+ assetId: (_c = (0, exports.getAssetIdByDenom)(msg.value.denom, assetId)) !== null && _c !== void 0 ? _c : '',
29
54
  delegator: msg.origin,
55
+ sourceValidator: msg.from,
30
56
  destinationValidator: msg.to,
31
- value: (_b = msg === null || msg === void 0 ? void 0 : msg.value) === null || _b === void 0 ? void 0 : _b.amount,
32
- assetId,
33
57
  };
34
58
  case 'withdraw_delegator_reward':
35
59
  return {
36
- parser: 'cosmos',
60
+ parser: 'staking',
37
61
  method: msg.type,
62
+ value: msg.value.amount,
63
+ assetId: (_d = (0, exports.getAssetIdByDenom)(msg.value.denom, assetId)) !== null && _d !== void 0 ? _d : '',
64
+ delegator: msg.origin,
38
65
  destinationValidator: msg.to,
39
- value: (_c = msg === null || msg === void 0 ? void 0 : msg.value) === null || _c === void 0 ? void 0 : _c.amount,
40
- assetId,
41
66
  };
42
67
  case 'transfer':
43
68
  case 'recv_packet':
44
69
  return {
45
- parser: 'cosmos',
46
- method: 'ibc_transfer',
70
+ parser: 'ibc',
71
+ method: msg.type,
72
+ value: msg.value.amount,
73
+ assetId: (_e = (0, exports.getAssetIdByDenom)(msg.value.denom, assetId)) !== null && _e !== void 0 ? _e : '',
74
+ ibcSource: msg.origin,
47
75
  ibcDestination: msg.to,
48
- ibcSource: msg.from,
49
- assetId,
50
- value: (_d = msg === null || msg === void 0 ? void 0 : msg.value) === null || _d === void 0 ? void 0 : _d.amount,
51
76
  };
77
+ case 'deposit':
78
+ if (event['add_liquidity']) {
79
+ return {
80
+ parser: 'lp',
81
+ method: msg.type,
82
+ pool: event['add_liquidity']['pool'],
83
+ };
84
+ }
85
+ return {
86
+ parser: 'swap',
87
+ method: msg.type,
88
+ memo: event['message']['memo'],
89
+ };
90
+ case 'outbound': {
91
+ const memo = event['outbound']['memo'];
92
+ const [type] = memo.split(':');
93
+ return {
94
+ parser: 'swap',
95
+ method: type.toLowerCase() || msg.type,
96
+ memo: event['outbound']['memo'],
97
+ };
98
+ }
52
99
  case 'swap_exact_amount_in':
53
100
  // TODO: parse applicable metadata
54
101
  return;
@@ -60,20 +60,20 @@ class Parser {
60
60
  parser: 'yearn',
61
61
  };
62
62
  switch (txSigHash) {
63
- case this.supportedYearnFunctions.approveSigHash:
63
+ case this.supportedYearnFunctions.approveSigHash: {
64
64
  if (decoded.args._spender !== constants_1.SHAPE_SHIFT_ROUTER_CONTRACT)
65
65
  return;
66
- return {
67
- data: {
68
- ...data,
69
- assetId: (0, caip_1.toAssetId)({
70
- chainId: this.chainId,
71
- assetNamespace: 'erc20',
72
- assetReference: tx.to,
73
- }),
74
- value: decoded.args._value.toString(),
75
- },
76
- };
66
+ const value = decoded.args._value;
67
+ const assetId = (0, caip_1.toAssetId)({
68
+ chainId: this.chainId,
69
+ assetNamespace: 'erc20',
70
+ assetReference: tx.to,
71
+ });
72
+ if (value.isZero()) {
73
+ return { data: { ...data, assetId, method: 'revoke', value: value.toString() } };
74
+ }
75
+ return { data: { ...data, assetId, value: value.toString() } };
76
+ }
77
77
  case this.supportedShapeShiftFunctions.depositSigHash:
78
78
  if (tx.to !== constants_1.SHAPE_SHIFT_ROUTER_CONTRACT)
79
79
  return;
@@ -37,8 +37,12 @@ class Parser {
37
37
  parser: 'erc20',
38
38
  };
39
39
  switch (txSigHash) {
40
- case this.supportedFunctions.approveSigHash:
41
- return { data: { ...data, value: (decoded === null || decoded === void 0 ? void 0 : decoded.args.amount).toString() } };
40
+ case this.supportedFunctions.approveSigHash: {
41
+ const value = decoded.args.amount;
42
+ if (value.isZero())
43
+ return { data: { ...data, method: 'revoke', value: value.toString() } };
44
+ return { data: { ...data, value: value.toString() } };
45
+ }
42
46
  default:
43
47
  return { data };
44
48
  }
@@ -80,7 +80,7 @@ class V1Api extends runtime.BaseAPI {
80
80
  headers: headerParameters,
81
81
  query: queryParameters,
82
82
  }, initOverrides);
83
- return new runtime.TextApiResponse(response);
83
+ return new runtime.JSONApiResponse(response);
84
84
  }
85
85
  /**
86
86
  * Get the estimated gas cost of a transaction
@@ -226,7 +226,7 @@ class V1Api extends runtime.BaseAPI {
226
226
  query: queryParameters,
227
227
  body: (0, models_1.SendTxBodyToJSON)(requestParameters.sendTxBody),
228
228
  }, initOverrides);
229
- return new runtime.TextApiResponse(response);
229
+ return new runtime.JSONApiResponse(response);
230
230
  }
231
231
  /**
232
232
  * Broadcast signed raw transaction
@@ -229,7 +229,7 @@ class V1Api extends runtime.BaseAPI {
229
229
  query: queryParameters,
230
230
  body: (0, models_1.SendTxBodyToJSON)(requestParameters.sendTxBody),
231
231
  }, initOverrides);
232
- return new runtime.TextApiResponse(response);
232
+ return new runtime.JSONApiResponse(response);
233
233
  }
234
234
  /**
235
235
  * Sends raw transaction to be broadcast to the node.
@@ -229,7 +229,7 @@ class V1Api extends runtime.BaseAPI {
229
229
  query: queryParameters,
230
230
  body: (0, models_1.SendTxBodyToJSON)(requestParameters.sendTxBody),
231
231
  }, initOverrides);
232
- return new runtime.TextApiResponse(response);
232
+ return new runtime.JSONApiResponse(response);
233
233
  }
234
234
  /**
235
235
  * Sends raw transaction to be broadcast to the node.
@@ -58,7 +58,7 @@ class V1Api extends runtime.BaseAPI {
58
58
  query: queryParameters,
59
59
  body: (0, models_1.EstimateGasRequestToJSON)(requestParameters.body),
60
60
  }, initOverrides);
61
- return new runtime.TextApiResponse(response);
61
+ return new runtime.JSONApiResponse(response);
62
62
  }
63
63
  /**
64
64
  * Get the estimated gas cost for a transaction.
@@ -225,7 +225,7 @@ class V1Api extends runtime.BaseAPI {
225
225
  query: queryParameters,
226
226
  body: (0, models_1.EstimateGasRequestToJSON)(requestParameters.body),
227
227
  }, initOverrides);
228
- return new runtime.TextApiResponse(response);
228
+ return new runtime.JSONApiResponse(response);
229
229
  }
230
230
  /**
231
231
  * Sends raw transaction to be broadcast to the node.
@@ -21,19 +21,19 @@ export interface Message {
21
21
  * @type {string}
22
22
  * @memberof Message
23
23
  */
24
- from?: string;
24
+ from: string;
25
25
  /**
26
26
  *
27
27
  * @type {string}
28
28
  * @memberof Message
29
29
  */
30
- origin?: string;
30
+ origin: string;
31
31
  /**
32
32
  *
33
33
  * @type {string}
34
34
  * @memberof Message
35
35
  */
36
- to?: string;
36
+ to: string;
37
37
  /**
38
38
  *
39
39
  * @type {string}
@@ -45,7 +45,7 @@ export interface Message {
45
45
  * @type {Value}
46
46
  * @memberof Message
47
47
  */
48
- value?: Value;
48
+ value: Value;
49
49
  }
50
50
  /**
51
51
  * Check if a given object implements the Message interface.
@@ -15,14 +15,17 @@
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.MessageToJSON = exports.MessageFromJSONTyped = exports.MessageFromJSON = exports.instanceOfMessage = void 0;
18
- const runtime_1 = require("../runtime");
19
18
  const Value_1 = require("./Value");
20
19
  /**
21
20
  * Check if a given object implements the Message interface.
22
21
  */
23
22
  function instanceOfMessage(value) {
24
23
  let isInstance = true;
24
+ isInstance = isInstance && "from" in value;
25
+ isInstance = isInstance && "origin" in value;
26
+ isInstance = isInstance && "to" in value;
25
27
  isInstance = isInstance && "type" in value;
28
+ isInstance = isInstance && "value" in value;
26
29
  return isInstance;
27
30
  }
28
31
  exports.instanceOfMessage = instanceOfMessage;
@@ -35,11 +38,11 @@ function MessageFromJSONTyped(json, ignoreDiscriminator) {
35
38
  return json;
36
39
  }
37
40
  return {
38
- 'from': !(0, runtime_1.exists)(json, 'from') ? undefined : json['from'],
39
- 'origin': !(0, runtime_1.exists)(json, 'origin') ? undefined : json['origin'],
40
- 'to': !(0, runtime_1.exists)(json, 'to') ? undefined : json['to'],
41
+ 'from': json['from'],
42
+ 'origin': json['origin'],
43
+ 'to': json['to'],
41
44
  'type': json['type'],
42
- 'value': !(0, runtime_1.exists)(json, 'value') ? undefined : (0, Value_1.ValueFromJSON)(json['value']),
45
+ 'value': (0, Value_1.ValueFromJSON)(json['value']),
43
46
  };
44
47
  }
45
48
  exports.MessageFromJSONTyped = MessageFromJSONTyped;
@@ -229,7 +229,7 @@ class V1Api extends runtime.BaseAPI {
229
229
  query: queryParameters,
230
230
  body: (0, models_1.SendTxBodyToJSON)(requestParameters.sendTxBody),
231
231
  }, initOverrides);
232
- return new runtime.TextApiResponse(response);
232
+ return new runtime.JSONApiResponse(response);
233
233
  }
234
234
  /**
235
235
  * Sends raw transaction to be broadcast to the node.
@@ -80,7 +80,7 @@ class V1Api extends runtime.BaseAPI {
80
80
  headers: headerParameters,
81
81
  query: queryParameters,
82
82
  }, initOverrides);
83
- return new runtime.TextApiResponse(response);
83
+ return new runtime.JSONApiResponse(response);
84
84
  }
85
85
  /**
86
86
  * Get the estimated gas cost of a transaction
@@ -226,7 +226,7 @@ class V1Api extends runtime.BaseAPI {
226
226
  query: queryParameters,
227
227
  body: (0, models_1.SendTxBodyToJSON)(requestParameters.sendTxBody),
228
228
  }, initOverrides);
229
- return new runtime.TextApiResponse(response);
229
+ return new runtime.JSONApiResponse(response);
230
230
  }
231
231
  /**
232
232
  * Sends raw transaction to be broadcast to the node.
@@ -229,7 +229,7 @@ class V1Api extends runtime.BaseAPI {
229
229
  query: queryParameters,
230
230
  body: (0, models_1.SendTxBodyToJSON)(requestParameters.sendTxBody),
231
231
  }, initOverrides);
232
- return new runtime.TextApiResponse(response);
232
+ return new runtime.JSONApiResponse(response);
233
233
  }
234
234
  /**
235
235
  * Sends raw transaction to be broadcast to the node.
@@ -58,7 +58,7 @@ class V1Api extends runtime.BaseAPI {
58
58
  query: queryParameters,
59
59
  body: (0, models_1.EstimateGasRequestToJSON)(requestParameters.body),
60
60
  }, initOverrides);
61
- return new runtime.TextApiResponse(response);
61
+ return new runtime.JSONApiResponse(response);
62
62
  }
63
63
  /**
64
64
  * Get the estimated gas cost for a transaction.
@@ -225,7 +225,7 @@ class V1Api extends runtime.BaseAPI {
225
225
  query: queryParameters,
226
226
  body: (0, models_1.EstimateGasRequestToJSON)(requestParameters.body),
227
227
  }, initOverrides);
228
- return new runtime.TextApiResponse(response);
228
+ return new runtime.JSONApiResponse(response);
229
229
  }
230
230
  /**
231
231
  * Sends raw transaction to be broadcast to the node.
@@ -21,19 +21,19 @@ export interface Message {
21
21
  * @type {string}
22
22
  * @memberof Message
23
23
  */
24
- from?: string;
24
+ from: string;
25
25
  /**
26
26
  *
27
27
  * @type {string}
28
28
  * @memberof Message
29
29
  */
30
- origin?: string;
30
+ origin: string;
31
31
  /**
32
32
  *
33
33
  * @type {string}
34
34
  * @memberof Message
35
35
  */
36
- to?: string;
36
+ to: string;
37
37
  /**
38
38
  *
39
39
  * @type {string}
@@ -45,7 +45,7 @@ export interface Message {
45
45
  * @type {Value}
46
46
  * @memberof Message
47
47
  */
48
- value?: Value;
48
+ value: Value;
49
49
  }
50
50
  /**
51
51
  * Check if a given object implements the Message interface.
@@ -15,14 +15,17 @@
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.MessageToJSON = exports.MessageFromJSONTyped = exports.MessageFromJSON = exports.instanceOfMessage = void 0;
18
- const runtime_1 = require("../runtime");
19
18
  const Value_1 = require("./Value");
20
19
  /**
21
20
  * Check if a given object implements the Message interface.
22
21
  */
23
22
  function instanceOfMessage(value) {
24
23
  let isInstance = true;
24
+ isInstance = isInstance && "from" in value;
25
+ isInstance = isInstance && "origin" in value;
26
+ isInstance = isInstance && "to" in value;
25
27
  isInstance = isInstance && "type" in value;
28
+ isInstance = isInstance && "value" in value;
26
29
  return isInstance;
27
30
  }
28
31
  exports.instanceOfMessage = instanceOfMessage;
@@ -35,11 +38,11 @@ function MessageFromJSONTyped(json, ignoreDiscriminator) {
35
38
  return json;
36
39
  }
37
40
  return {
38
- 'from': !(0, runtime_1.exists)(json, 'from') ? undefined : json['from'],
39
- 'origin': !(0, runtime_1.exists)(json, 'origin') ? undefined : json['origin'],
40
- 'to': !(0, runtime_1.exists)(json, 'to') ? undefined : json['to'],
41
+ 'from': json['from'],
42
+ 'origin': json['origin'],
43
+ 'to': json['to'],
41
44
  'type': json['type'],
42
- 'value': !(0, runtime_1.exists)(json, 'value') ? undefined : (0, Value_1.ValueFromJSON)(json['value']),
45
+ 'value': (0, Value_1.ValueFromJSON)(json['value']),
43
46
  };
44
47
  }
45
48
  exports.MessageFromJSONTyped = MessageFromJSONTyped;
@@ -58,7 +58,7 @@ class V1Api extends runtime.BaseAPI {
58
58
  query: queryParameters,
59
59
  body: (0, models_1.EstimateGasRequestToJSON)(requestParameters.body),
60
60
  }, initOverrides);
61
- return new runtime.TextApiResponse(response);
61
+ return new runtime.JSONApiResponse(response);
62
62
  }
63
63
  /**
64
64
  * Get the estimated gas cost for a transaction.
@@ -180,7 +180,7 @@ class V1Api extends runtime.BaseAPI {
180
180
  query: queryParameters,
181
181
  body: (0, models_1.EstimateGasRequestToJSON)(requestParameters.body),
182
182
  }, initOverrides);
183
- return new runtime.TextApiResponse(response);
183
+ return new runtime.JSONApiResponse(response);
184
184
  }
185
185
  /**
186
186
  * Sends raw transaction to be broadcast to the node.
@@ -21,19 +21,19 @@ export interface Message {
21
21
  * @type {string}
22
22
  * @memberof Message
23
23
  */
24
- from?: string;
24
+ from: string;
25
25
  /**
26
26
  *
27
27
  * @type {string}
28
28
  * @memberof Message
29
29
  */
30
- origin?: string;
30
+ origin: string;
31
31
  /**
32
32
  *
33
33
  * @type {string}
34
34
  * @memberof Message
35
35
  */
36
- to?: string;
36
+ to: string;
37
37
  /**
38
38
  *
39
39
  * @type {string}
@@ -45,7 +45,7 @@ export interface Message {
45
45
  * @type {Value}
46
46
  * @memberof Message
47
47
  */
48
- value?: Value;
48
+ value: Value;
49
49
  }
50
50
  /**
51
51
  * Check if a given object implements the Message interface.
@@ -15,14 +15,17 @@
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.MessageToJSON = exports.MessageFromJSONTyped = exports.MessageFromJSON = exports.instanceOfMessage = void 0;
18
- const runtime_1 = require("../runtime");
19
18
  const Value_1 = require("./Value");
20
19
  /**
21
20
  * Check if a given object implements the Message interface.
22
21
  */
23
22
  function instanceOfMessage(value) {
24
23
  let isInstance = true;
24
+ isInstance = isInstance && "from" in value;
25
+ isInstance = isInstance && "origin" in value;
26
+ isInstance = isInstance && "to" in value;
25
27
  isInstance = isInstance && "type" in value;
28
+ isInstance = isInstance && "value" in value;
26
29
  return isInstance;
27
30
  }
28
31
  exports.instanceOfMessage = instanceOfMessage;
@@ -35,11 +38,11 @@ function MessageFromJSONTyped(json, ignoreDiscriminator) {
35
38
  return json;
36
39
  }
37
40
  return {
38
- 'from': !(0, runtime_1.exists)(json, 'from') ? undefined : json['from'],
39
- 'origin': !(0, runtime_1.exists)(json, 'origin') ? undefined : json['origin'],
40
- 'to': !(0, runtime_1.exists)(json, 'to') ? undefined : json['to'],
41
+ 'from': json['from'],
42
+ 'origin': json['origin'],
43
+ 'to': json['to'],
41
44
  'type': json['type'],
42
- 'value': !(0, runtime_1.exists)(json, 'value') ? undefined : (0, Value_1.ValueFromJSON)(json['value']),
45
+ 'value': (0, Value_1.ValueFromJSON)(json['value']),
43
46
  };
44
47
  }
45
48
  exports.MessageFromJSONTyped = MessageFromJSONTyped;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapeshiftoss/unchained-client",
3
- "version": "10.1.1",
3
+ "version": "10.2.0",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "source": "src/index.ts",
@@ -15,7 +15,7 @@
15
15
  "build:local": "yarn clean && yarn generate:local && tsc -p tsconfig.build.json",
16
16
  "dev": "tsc --watch",
17
17
  "clean": "rm -rf dist src/generated tsconfig.build.tsbuildinfo",
18
- "generate": "TS_POST_PROCESS_FILE=./generator/ts-nocheck.sh JAVA_OPTS='-Dlog.level=error' openapi-generator-cli generate && rm openapitools.json",
18
+ "generate": "TS_POST_PROCESS_FILE=./generator/post_process.sh JAVA_OPTS='-Dlog.level=error' openapi-generator-cli generate && rm openapitools.json",
19
19
  "generate:dev": "cp generator/openapitools-dev.json openapitools.json && yarn generate",
20
20
  "generate:prod": "cp generator/openapitools-prod.json openapitools.json && yarn generate",
21
21
  "generate:local": "cp generator/openapitools-local.json openapitools.json && yarn generate",