@aurigami/sdk 0.1.4 → 0.1.5

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/dist/sdk.esm.js CHANGED
@@ -1,5 +1,5 @@
1
- import BigNumber from 'bignumber.js';
2
- import { Contract, BigNumber as BigNumber$1, utils } from 'ethers';
1
+ import BigNumber$1 from 'bignumber.js';
2
+ import { BigNumber, utils, Contract } from 'ethers';
3
3
 
4
4
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
5
5
  try {
@@ -847,1350 +847,72 @@ var Token = function Token(address, decimals, expiry) {
847
847
  this.expiry = expiry;
848
848
  };
849
849
 
850
- var TokenAmount = /*#__PURE__*/function () {
851
- function TokenAmount(token, amount, isRaw) {
852
- if (isRaw === void 0) {
853
- isRaw = true;
854
- }
855
-
856
- if (isRaw) {
857
- this.rawAmnt = amount;
858
- } else {
859
- this.rawAmnt = new BigNumber(amount).times(decimalFactor(token.decimals)).toFixed(0);
860
- }
861
-
862
- this.token = token;
863
- }
864
-
865
- var _proto = TokenAmount.prototype;
866
-
867
- _proto.formattedAmount = function formattedAmount() {
868
- return new BigNumber(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
869
- };
870
-
871
- _proto.rawAmount = function rawAmount() {
872
- return this.rawAmnt;
873
- };
874
-
875
- return TokenAmount;
876
- }();
877
-
878
- var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
879
- var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
880
- var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
881
- var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
882
- var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
883
- var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
884
- var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
885
- var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
886
- var dummyUserMarketDetails = {
887
- market: dummyMarketAddress,
888
- depositBalance: dummyTokenAmount2,
889
- borrowBalance: dummyZeroTokenAmount,
890
- isCollateral: true,
891
- maxWithdrawableAmount: dummyTokenAmount
892
- };
893
-
894
- var ethers = /*#__PURE__*/require('ethers');
895
-
896
- var DOLLAR = /*#__PURE__*/new Token('0x0000000000000000000000000000000000000001', 2);
897
- var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
898
- var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
899
- var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
900
- var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
901
-
902
- var abi = [
903
- {
904
- inputs: [
905
- {
906
- internalType: "string",
907
- name: "_name",
908
- type: "string"
909
- },
910
- {
911
- internalType: "string",
912
- name: "_symbol",
913
- type: "string"
914
- },
915
- {
916
- internalType: "uint8",
917
- name: "_decimals",
918
- type: "uint8"
919
- },
920
- {
921
- internalType: "address",
922
- name: "_underlying",
923
- type: "address"
924
- },
925
- {
926
- internalType: "address",
927
- name: "_vault",
928
- type: "address"
929
- }
930
- ],
931
- stateMutability: "nonpayable",
932
- type: "constructor"
933
- },
934
- {
935
- anonymous: false,
936
- inputs: [
937
- {
938
- indexed: true,
939
- internalType: "address",
940
- name: "owner",
941
- type: "address"
942
- },
943
- {
944
- indexed: true,
945
- internalType: "address",
946
- name: "spender",
947
- type: "address"
948
- },
949
- {
950
- indexed: false,
951
- internalType: "uint256",
952
- name: "value",
953
- type: "uint256"
954
- }
955
- ],
956
- name: "Approval",
957
- type: "event"
958
- },
959
- {
960
- anonymous: false,
961
- inputs: [
962
- {
963
- indexed: true,
964
- internalType: "address",
965
- name: "auth",
966
- type: "address"
967
- },
968
- {
969
- indexed: false,
970
- internalType: "uint256",
971
- name: "timestamp",
972
- type: "uint256"
973
- }
974
- ],
975
- name: "LogAddAuth",
976
- type: "event"
977
- },
978
- {
979
- anonymous: false,
980
- inputs: [
981
- {
982
- indexed: true,
983
- internalType: "address",
984
- name: "oldOwner",
985
- type: "address"
986
- },
987
- {
988
- indexed: true,
989
- internalType: "address",
990
- name: "newOwner",
991
- type: "address"
992
- },
993
- {
994
- indexed: true,
995
- internalType: "uint256",
996
- name: "effectiveHeight",
997
- type: "uint256"
998
- }
999
- ],
1000
- name: "LogChangeMPCOwner",
1001
- type: "event"
1002
- },
1003
- {
1004
- anonymous: false,
1005
- inputs: [
1006
- {
1007
- indexed: true,
1008
- internalType: "address",
1009
- name: "oldVault",
1010
- type: "address"
1011
- },
1012
- {
1013
- indexed: true,
1014
- internalType: "address",
1015
- name: "newVault",
1016
- type: "address"
1017
- },
1018
- {
1019
- indexed: true,
1020
- internalType: "uint256",
1021
- name: "effectiveTime",
1022
- type: "uint256"
1023
- }
1024
- ],
1025
- name: "LogChangeVault",
1026
- type: "event"
1027
- },
1028
- {
1029
- anonymous: false,
1030
- inputs: [
1031
- {
1032
- indexed: true,
1033
- internalType: "bytes32",
1034
- name: "txhash",
1035
- type: "bytes32"
1036
- },
1037
- {
1038
- indexed: true,
1039
- internalType: "address",
1040
- name: "account",
1041
- type: "address"
1042
- },
1043
- {
1044
- indexed: false,
1045
- internalType: "uint256",
1046
- name: "amount",
1047
- type: "uint256"
1048
- }
1049
- ],
1050
- name: "LogSwapin",
1051
- type: "event"
1052
- },
1053
- {
1054
- anonymous: false,
1055
- inputs: [
1056
- {
1057
- indexed: true,
1058
- internalType: "address",
1059
- name: "account",
1060
- type: "address"
1061
- },
1062
- {
1063
- indexed: true,
1064
- internalType: "address",
1065
- name: "bindaddr",
1066
- type: "address"
1067
- },
1068
- {
1069
- indexed: false,
1070
- internalType: "uint256",
1071
- name: "amount",
1072
- type: "uint256"
1073
- }
1074
- ],
1075
- name: "LogSwapout",
1076
- type: "event"
1077
- },
1078
- {
1079
- anonymous: false,
1080
- inputs: [
1081
- {
1082
- indexed: true,
1083
- internalType: "address",
1084
- name: "from",
1085
- type: "address"
1086
- },
1087
- {
1088
- indexed: true,
1089
- internalType: "address",
1090
- name: "to",
1091
- type: "address"
1092
- },
1093
- {
1094
- indexed: false,
1095
- internalType: "uint256",
1096
- name: "value",
1097
- type: "uint256"
1098
- }
1099
- ],
1100
- name: "Transfer",
1101
- type: "event"
1102
- },
1103
- {
1104
- inputs: [
1105
- ],
1106
- name: "DOMAIN_SEPARATOR",
1107
- outputs: [
1108
- {
1109
- internalType: "bytes32",
1110
- name: "",
1111
- type: "bytes32"
1112
- }
1113
- ],
1114
- stateMutability: "view",
1115
- type: "function"
1116
- },
1117
- {
1118
- inputs: [
1119
- ],
1120
- name: "PERMIT_TYPEHASH",
1121
- outputs: [
1122
- {
1123
- internalType: "bytes32",
1124
- name: "",
1125
- type: "bytes32"
1126
- }
1127
- ],
1128
- stateMutability: "view",
1129
- type: "function"
1130
- },
1131
- {
1132
- inputs: [
1133
- {
1134
- internalType: "bytes32",
1135
- name: "txhash",
1136
- type: "bytes32"
1137
- },
1138
- {
1139
- internalType: "address",
1140
- name: "account",
1141
- type: "address"
1142
- },
1143
- {
1144
- internalType: "uint256",
1145
- name: "amount",
1146
- type: "uint256"
1147
- }
1148
- ],
1149
- name: "Swapin",
1150
- outputs: [
1151
- {
1152
- internalType: "bool",
1153
- name: "",
1154
- type: "bool"
1155
- }
1156
- ],
1157
- stateMutability: "nonpayable",
1158
- type: "function"
1159
- },
1160
- {
1161
- inputs: [
1162
- {
1163
- internalType: "uint256",
1164
- name: "amount",
1165
- type: "uint256"
1166
- },
1167
- {
1168
- internalType: "address",
1169
- name: "bindaddr",
1170
- type: "address"
1171
- }
1172
- ],
1173
- name: "Swapout",
1174
- outputs: [
1175
- {
1176
- internalType: "bool",
1177
- name: "",
1178
- type: "bool"
1179
- }
1180
- ],
1181
- stateMutability: "nonpayable",
1182
- type: "function"
1183
- },
1184
- {
1185
- inputs: [
1186
- ],
1187
- name: "TRANSFER_TYPEHASH",
1188
- outputs: [
1189
- {
1190
- internalType: "bytes32",
1191
- name: "",
1192
- type: "bytes32"
1193
- }
1194
- ],
1195
- stateMutability: "view",
1196
- type: "function"
1197
- },
1198
- {
1199
- inputs: [
1200
- {
1201
- internalType: "address",
1202
- name: "",
1203
- type: "address"
1204
- },
1205
- {
1206
- internalType: "address",
1207
- name: "",
1208
- type: "address"
1209
- }
1210
- ],
1211
- name: "allowance",
1212
- outputs: [
1213
- {
1214
- internalType: "uint256",
1215
- name: "",
1216
- type: "uint256"
1217
- }
1218
- ],
1219
- stateMutability: "view",
1220
- type: "function"
1221
- },
1222
- {
1223
- inputs: [
1224
- ],
1225
- name: "applyMinter",
1226
- outputs: [
1227
- ],
1228
- stateMutability: "nonpayable",
1229
- type: "function"
1230
- },
1231
- {
1232
- inputs: [
1233
- ],
1234
- name: "applyVault",
1235
- outputs: [
1236
- ],
1237
- stateMutability: "nonpayable",
1238
- type: "function"
1239
- },
1240
- {
1241
- inputs: [
1242
- {
1243
- internalType: "address",
1244
- name: "spender",
1245
- type: "address"
1246
- },
1247
- {
1248
- internalType: "uint256",
1249
- name: "value",
1250
- type: "uint256"
1251
- }
1252
- ],
1253
- name: "approve",
1254
- outputs: [
1255
- {
1256
- internalType: "bool",
1257
- name: "",
1258
- type: "bool"
1259
- }
1260
- ],
1261
- stateMutability: "nonpayable",
1262
- type: "function"
1263
- },
1264
- {
1265
- inputs: [
1266
- {
1267
- internalType: "address",
1268
- name: "spender",
1269
- type: "address"
1270
- },
1271
- {
1272
- internalType: "uint256",
1273
- name: "value",
1274
- type: "uint256"
1275
- },
1276
- {
1277
- internalType: "bytes",
1278
- name: "data",
1279
- type: "bytes"
1280
- }
1281
- ],
1282
- name: "approveAndCall",
1283
- outputs: [
1284
- {
1285
- internalType: "bool",
1286
- name: "",
1287
- type: "bool"
1288
- }
1289
- ],
1290
- stateMutability: "nonpayable",
1291
- type: "function"
1292
- },
1293
- {
1294
- inputs: [
1295
- {
1296
- internalType: "address",
1297
- name: "",
1298
- type: "address"
1299
- }
1300
- ],
1301
- name: "balanceOf",
1302
- outputs: [
1303
- {
1304
- internalType: "uint256",
1305
- name: "",
1306
- type: "uint256"
1307
- }
1308
- ],
1309
- stateMutability: "view",
1310
- type: "function"
1311
- },
1312
- {
1313
- inputs: [
1314
- {
1315
- internalType: "address",
1316
- name: "from",
1317
- type: "address"
1318
- },
1319
- {
1320
- internalType: "uint256",
1321
- name: "amount",
1322
- type: "uint256"
1323
- }
1324
- ],
1325
- name: "burn",
1326
- outputs: [
1327
- {
1328
- internalType: "bool",
1329
- name: "",
1330
- type: "bool"
1331
- }
1332
- ],
1333
- stateMutability: "nonpayable",
1334
- type: "function"
1335
- },
1336
- {
1337
- inputs: [
1338
- {
1339
- internalType: "address",
1340
- name: "newVault",
1341
- type: "address"
1342
- }
1343
- ],
1344
- name: "changeMPCOwner",
1345
- outputs: [
1346
- {
1347
- internalType: "bool",
1348
- name: "",
1349
- type: "bool"
1350
- }
1351
- ],
1352
- stateMutability: "nonpayable",
1353
- type: "function"
1354
- },
1355
- {
1356
- inputs: [
1357
- {
1358
- internalType: "address",
1359
- name: "newVault",
1360
- type: "address"
1361
- }
1362
- ],
1363
- name: "changeVault",
1364
- outputs: [
1365
- {
1366
- internalType: "bool",
1367
- name: "",
1368
- type: "bool"
1369
- }
1370
- ],
1371
- stateMutability: "nonpayable",
1372
- type: "function"
1373
- },
1374
- {
1375
- inputs: [
1376
- ],
1377
- name: "decimals",
1378
- outputs: [
1379
- {
1380
- internalType: "uint8",
1381
- name: "",
1382
- type: "uint8"
1383
- }
1384
- ],
1385
- stateMutability: "view",
1386
- type: "function"
1387
- },
1388
- {
1389
- inputs: [
1390
- ],
1391
- name: "delay",
1392
- outputs: [
1393
- {
1394
- internalType: "uint256",
1395
- name: "",
1396
- type: "uint256"
1397
- }
1398
- ],
1399
- stateMutability: "view",
1400
- type: "function"
1401
- },
1402
- {
1403
- inputs: [
1404
- ],
1405
- name: "delayDelay",
1406
- outputs: [
1407
- {
1408
- internalType: "uint256",
1409
- name: "",
1410
- type: "uint256"
1411
- }
1412
- ],
1413
- stateMutability: "view",
1414
- type: "function"
1415
- },
1416
- {
1417
- inputs: [
1418
- ],
1419
- name: "delayMinter",
1420
- outputs: [
1421
- {
1422
- internalType: "uint256",
1423
- name: "",
1424
- type: "uint256"
1425
- }
1426
- ],
1427
- stateMutability: "view",
1428
- type: "function"
1429
- },
1430
- {
1431
- inputs: [
1432
- ],
1433
- name: "delayVault",
1434
- outputs: [
1435
- {
1436
- internalType: "uint256",
1437
- name: "",
1438
- type: "uint256"
1439
- }
1440
- ],
1441
- stateMutability: "view",
1442
- type: "function"
1443
- },
1444
- {
1445
- inputs: [
1446
- {
1447
- internalType: "uint256",
1448
- name: "amount",
1449
- type: "uint256"
1450
- },
1451
- {
1452
- internalType: "address",
1453
- name: "to",
1454
- type: "address"
1455
- }
1456
- ],
1457
- name: "deposit",
1458
- outputs: [
1459
- {
1460
- internalType: "uint256",
1461
- name: "",
1462
- type: "uint256"
1463
- }
1464
- ],
1465
- stateMutability: "nonpayable",
1466
- type: "function"
1467
- },
1468
- {
1469
- inputs: [
1470
- {
1471
- internalType: "uint256",
1472
- name: "amount",
1473
- type: "uint256"
1474
- }
1475
- ],
1476
- name: "deposit",
1477
- outputs: [
1478
- {
1479
- internalType: "uint256",
1480
- name: "",
1481
- type: "uint256"
1482
- }
1483
- ],
1484
- stateMutability: "nonpayable",
1485
- type: "function"
1486
- },
1487
- {
1488
- inputs: [
1489
- ],
1490
- name: "deposit",
1491
- outputs: [
1492
- {
1493
- internalType: "uint256",
1494
- name: "",
1495
- type: "uint256"
1496
- }
1497
- ],
1498
- stateMutability: "nonpayable",
1499
- type: "function"
1500
- },
1501
- {
1502
- inputs: [
1503
- {
1504
- internalType: "uint256",
1505
- name: "amount",
1506
- type: "uint256"
1507
- },
1508
- {
1509
- internalType: "address",
1510
- name: "to",
1511
- type: "address"
1512
- }
1513
- ],
1514
- name: "depositVault",
1515
- outputs: [
1516
- {
1517
- internalType: "uint256",
1518
- name: "",
1519
- type: "uint256"
1520
- }
1521
- ],
1522
- stateMutability: "nonpayable",
1523
- type: "function"
1524
- },
1525
- {
1526
- inputs: [
1527
- {
1528
- internalType: "address",
1529
- name: "target",
1530
- type: "address"
1531
- },
1532
- {
1533
- internalType: "uint256",
1534
- name: "value",
1535
- type: "uint256"
1536
- },
1537
- {
1538
- internalType: "uint256",
1539
- name: "deadline",
1540
- type: "uint256"
1541
- },
1542
- {
1543
- internalType: "uint8",
1544
- name: "v",
1545
- type: "uint8"
1546
- },
1547
- {
1548
- internalType: "bytes32",
1549
- name: "r",
1550
- type: "bytes32"
1551
- },
1552
- {
1553
- internalType: "bytes32",
1554
- name: "s",
1555
- type: "bytes32"
1556
- },
1557
- {
1558
- internalType: "address",
1559
- name: "to",
1560
- type: "address"
1561
- }
1562
- ],
1563
- name: "depositWithPermit",
1564
- outputs: [
1565
- {
1566
- internalType: "uint256",
1567
- name: "",
1568
- type: "uint256"
1569
- }
1570
- ],
1571
- stateMutability: "nonpayable",
1572
- type: "function"
1573
- },
1574
- {
1575
- inputs: [
1576
- {
1577
- internalType: "address",
1578
- name: "target",
1579
- type: "address"
1580
- },
1581
- {
1582
- internalType: "uint256",
1583
- name: "value",
1584
- type: "uint256"
1585
- },
1586
- {
1587
- internalType: "uint256",
1588
- name: "deadline",
1589
- type: "uint256"
1590
- },
1591
- {
1592
- internalType: "uint8",
1593
- name: "v",
1594
- type: "uint8"
1595
- },
1596
- {
1597
- internalType: "bytes32",
1598
- name: "r",
1599
- type: "bytes32"
1600
- },
1601
- {
1602
- internalType: "bytes32",
1603
- name: "s",
1604
- type: "bytes32"
1605
- },
1606
- {
1607
- internalType: "address",
1608
- name: "to",
1609
- type: "address"
1610
- }
1611
- ],
1612
- name: "depositWithTransferPermit",
1613
- outputs: [
1614
- {
1615
- internalType: "uint256",
1616
- name: "",
1617
- type: "uint256"
1618
- }
1619
- ],
1620
- stateMutability: "nonpayable",
1621
- type: "function"
1622
- },
1623
- {
1624
- inputs: [
1625
- ],
1626
- name: "getAllMinters",
1627
- outputs: [
1628
- {
1629
- internalType: "address[]",
1630
- name: "",
1631
- type: "address[]"
1632
- }
1633
- ],
1634
- stateMutability: "view",
1635
- type: "function"
1636
- },
1637
- {
1638
- inputs: [
1639
- {
1640
- internalType: "address",
1641
- name: "_vault",
1642
- type: "address"
1643
- }
1644
- ],
1645
- name: "initVault",
1646
- outputs: [
1647
- ],
1648
- stateMutability: "nonpayable",
1649
- type: "function"
1650
- },
1651
- {
1652
- inputs: [
1653
- {
1654
- internalType: "address",
1655
- name: "",
1656
- type: "address"
1657
- }
1658
- ],
1659
- name: "isMinter",
1660
- outputs: [
1661
- {
1662
- internalType: "bool",
1663
- name: "",
1664
- type: "bool"
1665
- }
1666
- ],
1667
- stateMutability: "view",
1668
- type: "function"
1669
- },
1670
- {
1671
- inputs: [
1672
- {
1673
- internalType: "address",
1674
- name: "to",
1675
- type: "address"
1676
- },
1677
- {
1678
- internalType: "uint256",
1679
- name: "amount",
1680
- type: "uint256"
1681
- }
1682
- ],
1683
- name: "mint",
1684
- outputs: [
1685
- {
1686
- internalType: "bool",
1687
- name: "",
1688
- type: "bool"
1689
- }
1690
- ],
1691
- stateMutability: "nonpayable",
1692
- type: "function"
1693
- },
1694
- {
1695
- inputs: [
1696
- {
1697
- internalType: "uint256",
1698
- name: "",
1699
- type: "uint256"
1700
- }
1701
- ],
1702
- name: "minters",
1703
- outputs: [
1704
- {
1705
- internalType: "address",
1706
- name: "",
1707
- type: "address"
1708
- }
1709
- ],
1710
- stateMutability: "view",
1711
- type: "function"
1712
- },
1713
- {
1714
- inputs: [
1715
- ],
1716
- name: "mpc",
1717
- outputs: [
1718
- {
1719
- internalType: "address",
1720
- name: "",
1721
- type: "address"
1722
- }
1723
- ],
1724
- stateMutability: "view",
1725
- type: "function"
1726
- },
1727
- {
1728
- inputs: [
1729
- ],
1730
- name: "name",
1731
- outputs: [
1732
- {
1733
- internalType: "string",
1734
- name: "",
1735
- type: "string"
1736
- }
1737
- ],
1738
- stateMutability: "view",
1739
- type: "function"
1740
- },
1741
- {
1742
- inputs: [
1743
- {
1744
- internalType: "address",
1745
- name: "",
1746
- type: "address"
1747
- }
1748
- ],
1749
- name: "nonces",
1750
- outputs: [
1751
- {
1752
- internalType: "uint256",
1753
- name: "",
1754
- type: "uint256"
1755
- }
1756
- ],
1757
- stateMutability: "view",
1758
- type: "function"
1759
- },
1760
- {
1761
- inputs: [
1762
- ],
1763
- name: "owner",
1764
- outputs: [
1765
- {
1766
- internalType: "address",
1767
- name: "",
1768
- type: "address"
1769
- }
1770
- ],
1771
- stateMutability: "view",
1772
- type: "function"
1773
- },
1774
- {
1775
- inputs: [
1776
- ],
1777
- name: "pendingDelay",
1778
- outputs: [
1779
- {
1780
- internalType: "uint256",
1781
- name: "",
1782
- type: "uint256"
1783
- }
1784
- ],
1785
- stateMutability: "view",
1786
- type: "function"
1787
- },
1788
- {
1789
- inputs: [
1790
- ],
1791
- name: "pendingMinter",
1792
- outputs: [
1793
- {
1794
- internalType: "address",
1795
- name: "",
1796
- type: "address"
1797
- }
1798
- ],
1799
- stateMutability: "view",
1800
- type: "function"
1801
- },
1802
- {
1803
- inputs: [
1804
- ],
1805
- name: "pendingVault",
1806
- outputs: [
1807
- {
1808
- internalType: "address",
1809
- name: "",
1810
- type: "address"
1811
- }
1812
- ],
1813
- stateMutability: "view",
1814
- type: "function"
1815
- },
1816
- {
1817
- inputs: [
1818
- {
1819
- internalType: "address",
1820
- name: "target",
1821
- type: "address"
1822
- },
1823
- {
1824
- internalType: "address",
1825
- name: "spender",
1826
- type: "address"
1827
- },
1828
- {
1829
- internalType: "uint256",
1830
- name: "value",
1831
- type: "uint256"
1832
- },
1833
- {
1834
- internalType: "uint256",
1835
- name: "deadline",
1836
- type: "uint256"
1837
- },
1838
- {
1839
- internalType: "uint8",
1840
- name: "v",
1841
- type: "uint8"
1842
- },
1843
- {
1844
- internalType: "bytes32",
1845
- name: "r",
1846
- type: "bytes32"
1847
- },
1848
- {
1849
- internalType: "bytes32",
1850
- name: "s",
1851
- type: "bytes32"
1852
- }
1853
- ],
1854
- name: "permit",
1855
- outputs: [
1856
- ],
1857
- stateMutability: "nonpayable",
1858
- type: "function"
1859
- },
1860
- {
1861
- inputs: [
1862
- {
1863
- internalType: "address",
1864
- name: "_auth",
1865
- type: "address"
1866
- }
1867
- ],
1868
- name: "revokeMinter",
1869
- outputs: [
1870
- ],
1871
- stateMutability: "nonpayable",
1872
- type: "function"
1873
- },
1874
- {
1875
- inputs: [
1876
- {
1877
- internalType: "address",
1878
- name: "_auth",
1879
- type: "address"
1880
- }
1881
- ],
1882
- name: "setMinter",
1883
- outputs: [
1884
- ],
1885
- stateMutability: "nonpayable",
1886
- type: "function"
1887
- },
1888
- {
1889
- inputs: [
1890
- {
1891
- internalType: "address",
1892
- name: "_vault",
1893
- type: "address"
1894
- }
1895
- ],
1896
- name: "setVault",
1897
- outputs: [
1898
- ],
1899
- stateMutability: "nonpayable",
1900
- type: "function"
1901
- },
1902
- {
1903
- inputs: [
1904
- {
1905
- internalType: "bool",
1906
- name: "enabled",
1907
- type: "bool"
1908
- }
1909
- ],
1910
- name: "setVaultOnly",
1911
- outputs: [
1912
- ],
1913
- stateMutability: "nonpayable",
1914
- type: "function"
1915
- },
1916
- {
1917
- inputs: [
1918
- ],
1919
- name: "symbol",
1920
- outputs: [
1921
- {
1922
- internalType: "string",
1923
- name: "",
1924
- type: "string"
1925
- }
1926
- ],
1927
- stateMutability: "view",
1928
- type: "function"
1929
- },
1930
- {
1931
- inputs: [
1932
- ],
1933
- name: "totalSupply",
1934
- outputs: [
1935
- {
1936
- internalType: "uint256",
1937
- name: "",
1938
- type: "uint256"
1939
- }
1940
- ],
1941
- stateMutability: "view",
1942
- type: "function"
1943
- },
1944
- {
1945
- inputs: [
1946
- {
1947
- internalType: "address",
1948
- name: "to",
1949
- type: "address"
1950
- },
1951
- {
1952
- internalType: "uint256",
1953
- name: "value",
1954
- type: "uint256"
1955
- }
1956
- ],
1957
- name: "transfer",
1958
- outputs: [
1959
- {
1960
- internalType: "bool",
1961
- name: "",
1962
- type: "bool"
1963
- }
1964
- ],
1965
- stateMutability: "nonpayable",
1966
- type: "function"
1967
- },
1968
- {
1969
- inputs: [
1970
- {
1971
- internalType: "address",
1972
- name: "to",
1973
- type: "address"
1974
- },
1975
- {
1976
- internalType: "uint256",
1977
- name: "value",
1978
- type: "uint256"
1979
- },
1980
- {
1981
- internalType: "bytes",
1982
- name: "data",
1983
- type: "bytes"
1984
- }
1985
- ],
1986
- name: "transferAndCall",
1987
- outputs: [
1988
- {
1989
- internalType: "bool",
1990
- name: "",
1991
- type: "bool"
1992
- }
1993
- ],
1994
- stateMutability: "nonpayable",
1995
- type: "function"
1996
- },
1997
- {
1998
- inputs: [
1999
- {
2000
- internalType: "address",
2001
- name: "from",
2002
- type: "address"
2003
- },
2004
- {
2005
- internalType: "address",
2006
- name: "to",
2007
- type: "address"
2008
- },
2009
- {
2010
- internalType: "uint256",
2011
- name: "value",
2012
- type: "uint256"
2013
- }
2014
- ],
2015
- name: "transferFrom",
2016
- outputs: [
2017
- {
2018
- internalType: "bool",
2019
- name: "",
2020
- type: "bool"
2021
- }
2022
- ],
2023
- stateMutability: "nonpayable",
2024
- type: "function"
2025
- },
2026
- {
2027
- inputs: [
2028
- {
2029
- internalType: "address",
2030
- name: "target",
2031
- type: "address"
2032
- },
2033
- {
2034
- internalType: "address",
2035
- name: "to",
2036
- type: "address"
2037
- },
2038
- {
2039
- internalType: "uint256",
2040
- name: "value",
2041
- type: "uint256"
2042
- },
2043
- {
2044
- internalType: "uint256",
2045
- name: "deadline",
2046
- type: "uint256"
2047
- },
2048
- {
2049
- internalType: "uint8",
2050
- name: "v",
2051
- type: "uint8"
2052
- },
2053
- {
2054
- internalType: "bytes32",
2055
- name: "r",
2056
- type: "bytes32"
2057
- },
2058
- {
2059
- internalType: "bytes32",
2060
- name: "s",
2061
- type: "bytes32"
2062
- }
2063
- ],
2064
- name: "transferWithPermit",
2065
- outputs: [
2066
- {
2067
- internalType: "bool",
2068
- name: "",
2069
- type: "bool"
2070
- }
2071
- ],
2072
- stateMutability: "nonpayable",
2073
- type: "function"
2074
- },
2075
- {
2076
- inputs: [
2077
- ],
2078
- name: "underlying",
2079
- outputs: [
2080
- {
2081
- internalType: "address",
2082
- name: "",
2083
- type: "address"
2084
- }
2085
- ],
2086
- stateMutability: "view",
2087
- type: "function"
2088
- },
2089
- {
2090
- inputs: [
2091
- ],
2092
- name: "vault",
2093
- outputs: [
2094
- {
2095
- internalType: "address",
2096
- name: "",
2097
- type: "address"
2098
- }
2099
- ],
2100
- stateMutability: "view",
2101
- type: "function"
2102
- },
2103
- {
2104
- inputs: [
2105
- {
2106
- internalType: "uint256",
2107
- name: "amount",
2108
- type: "uint256"
2109
- },
2110
- {
2111
- internalType: "address",
2112
- name: "to",
2113
- type: "address"
2114
- }
2115
- ],
2116
- name: "withdraw",
2117
- outputs: [
2118
- {
2119
- internalType: "uint256",
2120
- name: "",
2121
- type: "uint256"
2122
- }
2123
- ],
2124
- stateMutability: "nonpayable",
2125
- type: "function"
2126
- },
2127
- {
2128
- inputs: [
2129
- {
2130
- internalType: "uint256",
2131
- name: "amount",
2132
- type: "uint256"
2133
- }
2134
- ],
2135
- name: "withdraw",
2136
- outputs: [
2137
- {
2138
- internalType: "uint256",
2139
- name: "",
2140
- type: "uint256"
2141
- }
2142
- ],
2143
- stateMutability: "nonpayable",
2144
- type: "function"
2145
- },
2146
- {
2147
- inputs: [
2148
- ],
2149
- name: "withdraw",
2150
- outputs: [
2151
- {
2152
- internalType: "uint256",
2153
- name: "",
2154
- type: "uint256"
2155
- }
2156
- ],
2157
- stateMutability: "nonpayable",
2158
- type: "function"
2159
- },
2160
- {
2161
- inputs: [
2162
- {
2163
- internalType: "address",
2164
- name: "from",
2165
- type: "address"
2166
- },
2167
- {
2168
- internalType: "uint256",
2169
- name: "amount",
2170
- type: "uint256"
2171
- },
2172
- {
2173
- internalType: "address",
2174
- name: "to",
2175
- type: "address"
2176
- }
2177
- ],
2178
- name: "withdrawVault",
2179
- outputs: [
2180
- {
2181
- internalType: "uint256",
2182
- name: "",
2183
- type: "uint256"
2184
- }
2185
- ],
2186
- stateMutability: "nonpayable",
2187
- type: "function"
2188
- }
2189
- ];
2190
- var IERC20 = {
2191
- abi: abi
850
+ function formatObject(object) {
851
+ return JSON.stringify(object, null, ' ');
852
+ }
853
+ var decimalFactor = function decimalFactor(decimal) {
854
+ return BigNumber.from(10).pow(decimal).toString();
855
+ };
856
+ function validateAndParseAddress(address) {
857
+ try {
858
+ return utils.getAddress(address);
859
+ } catch (error) {
860
+ throw new Error("Invalid address " + address);
861
+ }
862
+ }
863
+
864
+ var TokenAmount = /*#__PURE__*/function () {
865
+ function TokenAmount(token, amount, isRaw) {
866
+ if (isRaw === void 0) {
867
+ isRaw = true;
868
+ }
869
+
870
+ if (isRaw) {
871
+ this.rawAmnt = amount;
872
+ } else {
873
+ this.rawAmnt = new BigNumber$1(amount).times(decimalFactor(token.decimals)).toFixed(0);
874
+ }
875
+
876
+ this.token = token;
877
+ }
878
+
879
+ var _proto = TokenAmount.prototype;
880
+
881
+ _proto.formattedAmount = function formattedAmount() {
882
+ return new BigNumber$1(this.rawAmnt).div(decimalFactor(this.token.decimals)).toString();
883
+ };
884
+
885
+ _proto.rawAmount = function rawAmount() {
886
+ return this.rawAmnt;
887
+ };
888
+
889
+ return TokenAmount;
890
+ }();
891
+
892
+ var dummyToken = /*#__PURE__*/new Token('0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e', 6);
893
+ var dummyPly = /*#__PURE__*/new Token('0x8729438eb15e2c8b576fcc6aecda6a148776c0f5', 18);
894
+ var dummyPlyAurora = /*#__PURE__*/new Token('0xE530dC2095Ef5653205CF5ea79F8979a7028065c', 18);
895
+ var dummyTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '123.456', false);
896
+ var dummyZeroTokenAmount = /*#__PURE__*/new TokenAmount(dummyToken, '0');
897
+ var dummyTokenAmount2 = /*#__PURE__*/new TokenAmount(dummyToken, '456.123', false);
898
+ var dummyTokenAmount3 = /*#__PURE__*/new TokenAmount(dummyToken, '1000.123', false);
899
+ var dummyMarketAddress = '0xbeb5d47a3f720ec0a390d04b4d41ed7d9688bc7f';
900
+ var dummyUserMarketDetails = {
901
+ market: dummyMarketAddress,
902
+ depositBalance: dummyTokenAmount2,
903
+ borrowBalance: dummyZeroTokenAmount,
904
+ isCollateral: true,
905
+ maxWithdrawableAmount: dummyTokenAmount
2192
906
  };
2193
907
 
908
+ var ethers = /*#__PURE__*/require('ethers');
909
+
910
+ var DOLLAR = /*#__PURE__*/new Token('0x0000000000000000000000000000000000000001', 2);
911
+ var AVAX_DEFAULT_PROVIDER_URL = 'https://api.avax.network/ext/bc/C/rpc';
912
+ var AVAX_DEFAULT_PROVIDER = /*#__PURE__*/new ethers.providers.JsonRpcProvider(AVAX_DEFAULT_PROVIDER_URL);
913
+ var dummyPrivateKey = '1111111111111111111111111111111111111111111111111111111111111111';
914
+ var AVAX_DEFAULT_SIGNER = /*#__PURE__*/new ethers.Wallet(dummyPrivateKey);
915
+
2194
916
  var ethers$1 = /*#__PURE__*/require('ethers');
2195
917
 
2196
918
  var SdkRead = /*#__PURE__*/function (_BlockchainEntityRead) {
@@ -2348,19 +1070,13 @@ var SdkReadWrite = /*#__PURE__*/function (_SdkRead) {
2348
1070
 
2349
1071
  _this = _SdkRead.apply(this, arguments) || this;
2350
1072
  _this.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee6() {
2351
- var dummyErc20Token;
2352
1073
  return runtime_1.wrap(function _callee6$(_context6) {
2353
1074
  while (1) {
2354
1075
  switch (_context6.prev = _context6.next) {
2355
1076
  case 0:
2356
- dummyErc20Token = new Contract(dummyToken.address, IERC20.abi, _this._providerOrSigner);
2357
- _context6.next = 3;
2358
- return dummyErc20Token.approve(dummyToken.address, 123);
2359
-
2360
- case 3:
2361
- return _context6.abrupt("return", _context6.sent);
1077
+ return _context6.abrupt("return", {});
2362
1078
 
2363
- case 4:
1079
+ case 1:
2364
1080
  case "end":
2365
1081
  return _context6.stop();
2366
1082
  }
@@ -2463,7 +1179,7 @@ var SDK = /*#__PURE__*/function (_BlockchainEntity) {
2463
1179
  return SDK;
2464
1180
  }(BlockchainEntity);
2465
1181
 
2466
- var abi$1 = [
1182
+ var abi = [
2467
1183
  {
2468
1184
  inputs: [
2469
1185
  {
@@ -4025,22 +2741,8 @@ var abi$1 = [
4025
2741
  }
4026
2742
  ];
4027
2743
  var AuToken = {
4028
- abi: abi$1
4029
- };
4030
-
4031
- function formatObject(object) {
4032
- return JSON.stringify(object, null, ' ');
4033
- }
4034
- var decimalFactor = function decimalFactor(decimal) {
4035
- return BigNumber$1.from(10).pow(decimal).toString();
2744
+ abi: abi
4036
2745
  };
4037
- function validateAndParseAddress(address) {
4038
- try {
4039
- return utils.getAddress(address);
4040
- } catch (error) {
4041
- throw new Error("Invalid address " + address);
4042
- }
4043
- }
4044
2746
 
4045
2747
  var MoneyMarketRead = /*#__PURE__*/function (_BlockchainEntityRead) {
4046
2748
  _inheritsLoose(MoneyMarketRead, _BlockchainEntityRead);
@@ -4097,19 +2799,13 @@ var MoneyMarketReadWrite = /*#__PURE__*/function (_MoneyMarketRead) {
4097
2799
 
4098
2800
  _this2 = _MoneyMarketRead.apply(this, arguments) || this;
4099
2801
  _this2.dummyTransaction = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/runtime_1.mark(function _callee2() {
4100
- var dummyErc20Token;
4101
2802
  return runtime_1.wrap(function _callee2$(_context2) {
4102
2803
  while (1) {
4103
2804
  switch (_context2.prev = _context2.next) {
4104
2805
  case 0:
4105
- dummyErc20Token = new Contract(dummyToken.address, IERC20.abi, _this2._providerOrSigner);
4106
- _context2.next = 3;
4107
- return dummyErc20Token.approve(dummyToken.address, 123);
4108
-
4109
- case 3:
4110
- return _context2.abrupt("return", _context2.sent);
2806
+ return _context2.abrupt("return", {});
4111
2807
 
4112
- case 4:
2808
+ case 1:
4113
2809
  case "end":
4114
2810
  return _context2.stop();
4115
2811
  }