@aurigami/sdk 1.5.3 → 1.5.4

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.5.3",
2
+ "version": "1.5.4",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -40,9 +40,6 @@
40
40
  "limit": "10 KB"
41
41
  }
42
42
  ],
43
- "browser": {
44
- "assert": false
45
- },
46
43
  "devDependencies": {
47
44
  "@size-limit/preset-small-lib": "^7.0.5",
48
45
  "eslint-config-prettier": "^8.3.0",
@@ -16,11 +16,11 @@ import {
16
16
  getCurrentTimestamp,
17
17
  getDecimal,
18
18
  isSameAddress,
19
+ assert,
19
20
  } from './helpers';
20
21
  import AIRDROP_AUTOKEN_INFO from './airdrop_misc/auTokensInfo.json';
21
22
  import AIRDROP_WHITELIST_ADDRESSES from './airdrop_misc/whitelist.json';
22
23
  import { AuriAirdrop } from '@aurigami/contracts/typechain';
23
- import assert from 'assert';
24
24
  import { TokenAmount } from './tokenAmount';
25
25
  import { Token } from './token';
26
26
 
package/src/helpers.ts CHANGED
@@ -1,11 +1,16 @@
1
1
  import { Provider } from '@ethersproject/abstract-provider';
2
- import assert from 'assert';
3
2
  import BigNumber from 'bignumber.js';
4
3
  import { BigNumber as BN, utils } from 'ethers';
5
4
  import { getQuery as getAuroraAPIQuery } from './aurora-api-helpers';
6
5
  import { decimalRecords } from './decimals';
7
6
  import { Address } from './types';
8
7
 
8
+ export function assert(condition: boolean, message: string = ''): void {
9
+ if (!condition) {
10
+ throw new Error(message ?? 'Assertion failed');
11
+ }
12
+ }
13
+
9
14
  export function formatObject(object: Object) {
10
15
  return JSON.stringify(object, null, ' ');
11
16
  }
@@ -6,14 +6,13 @@ import {
6
6
  PRICE_WHITELISTED,
7
7
  } from './constants';
8
8
  import OracleABI from './abis/Oracle.json';
9
- import { isSameAddress, decimalFactor, getDecimal } from './helpers';
9
+ import { isSameAddress, decimalFactor, getDecimal, assert } from './helpers';
10
10
  import { IUniswapV2Pair, PriceOracle } from '@aurigami/contracts/typechain';
11
11
  import { TokenAmount } from './tokenAmount';
12
12
  import { Address, TokenValuation } from './types';
13
13
  import IUniswapV2PairABI from './abis/IUniswapV2Pair.json';
14
14
  import AuriLensABI from '@aurigami/contracts/artifacts/contracts/AuriLens.sol/AuriLens.json';
15
15
  import axios from 'axios';
16
- import assert from 'assert';
17
16
 
18
17
  const hardcodePLYPrice = true;
19
18
  export async function fetchPriceFromCoingeckoAPI(