auctionflow-sdk 2.0.0 → 2.1.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.
package/dist/index.mjs CHANGED
@@ -77,7 +77,7 @@ var AuctionBuilder = class {
77
77
 
78
78
  // src/constants/addresses.ts
79
79
  var AUCTION_ADDRESSES = {
80
- 84532: "0xc6db1c900faeb4079281ecd6ec538c027cd18c28",
80
+ 84532: "0xe57fe62e31666a9b749e89086a8a5487a530153b",
81
81
  8453: "0x0000000000000000000000000000000000000000"
82
82
  // not yet deployed
83
83
  };
@@ -161,6 +161,13 @@ var tokenAuctionAbi = [
161
161
  ],
162
162
  "stateMutability": "view"
163
163
  },
164
+ {
165
+ "type": "function",
166
+ "name": "acceptOwnership",
167
+ "inputs": [],
168
+ "outputs": [],
169
+ "stateMutability": "nonpayable"
170
+ },
164
171
  {
165
172
  "type": "function",
166
173
  "name": "auctionCount",
@@ -278,6 +285,68 @@ var tokenAuctionAbi = [
278
285
  "outputs": [],
279
286
  "stateMutability": "nonpayable"
280
287
  },
288
+ {
289
+ "type": "function",
290
+ "name": "claim",
291
+ "inputs": [
292
+ {
293
+ "name": "token",
294
+ "type": "address",
295
+ "internalType": "contract IERC20"
296
+ }
297
+ ],
298
+ "outputs": [
299
+ {
300
+ "name": "amount",
301
+ "type": "uint256",
302
+ "internalType": "uint256"
303
+ }
304
+ ],
305
+ "stateMutability": "nonpayable"
306
+ },
307
+ {
308
+ "type": "function",
309
+ "name": "claimProtocolFees",
310
+ "inputs": [
311
+ {
312
+ "name": "token",
313
+ "type": "address",
314
+ "internalType": "contract IERC20"
315
+ }
316
+ ],
317
+ "outputs": [
318
+ {
319
+ "name": "amount",
320
+ "type": "uint256",
321
+ "internalType": "uint256"
322
+ }
323
+ ],
324
+ "stateMutability": "nonpayable"
325
+ },
326
+ {
327
+ "type": "function",
328
+ "name": "claimable",
329
+ "inputs": [
330
+ {
331
+ "name": "",
332
+ "type": "address",
333
+ "internalType": "address"
334
+ },
335
+ {
336
+ "name": "",
337
+ "type": "address",
338
+ "internalType": "address"
339
+ }
340
+ ],
341
+ "outputs": [
342
+ {
343
+ "name": "",
344
+ "type": "uint256",
345
+ "internalType": "uint256"
346
+ }
347
+ ],
348
+ "stateMutability": "view"
349
+ },
281
350
  {
282
351
  "type": "function",
283
352
  "name": "collectFees",
@@ -554,6 +623,58 @@ var tokenAuctionAbi = [
554
623
  ],
555
624
  "stateMutability": "view"
556
625
  },
626
+ {
627
+ "type": "function",
628
+ "name": "pause",
629
+ "inputs": [],
630
+ "outputs": [],
631
+ "stateMutability": "nonpayable"
632
+ },
633
+ {
634
+ "type": "function",
635
+ "name": "paused",
636
+ "inputs": [],
637
+ "outputs": [
638
+ {
639
+ "name": "",
640
+ "type": "bool",
641
+ "internalType": "bool"
642
+ }
643
+ ],
644
+ "stateMutability": "view"
645
+ },
646
+ {
647
+ "type": "function",
648
+ "name": "paymentTokenAllowed",
649
+ "inputs": [
650
+ {
651
+ "name": "",
652
+ "type": "address",
653
+ "internalType": "address"
654
+ }
655
+ ],
656
+ "outputs": [
657
+ {
658
+ "name": "",
659
+ "type": "bool",
660
+ "internalType": "bool"
661
+ }
662
+ ],
663
+ "stateMutability": "view"
664
+ },
665
+ {
666
+ "type": "function",
667
+ "name": "pendingOwner",
668
+ "inputs": [],
669
+ "outputs": [
670
+ {
671
+ "name": "",
672
+ "type": "address",
673
+ "internalType": "address"
674
+ }
675
+ ],
676
+ "stateMutability": "view"
677
+ },
557
678
  {
558
679
  "type": "function",
559
680
  "name": "poolOf",
@@ -637,6 +758,25 @@ var tokenAuctionAbi = [
637
758
  ],
638
759
  "stateMutability": "view"
639
760
  },
761
+ {
762
+ "type": "function",
763
+ "name": "protocolFees",
764
+ "inputs": [
765
+ {
766
+ "name": "",
767
+ "type": "address",
768
+ "internalType": "address"
769
+ }
770
+ ],
771
+ "outputs": [
772
+ {
773
+ "name": "",
774
+ "type": "uint256",
775
+ "internalType": "uint256"
776
+ }
777
+ ],
778
+ "stateMutability": "view"
779
+ },
640
780
  {
641
781
  "type": "function",
642
782
  "name": "renounceOwnership",
@@ -738,6 +878,24 @@ var tokenAuctionAbi = [
738
878
  "outputs": [],
739
879
  "stateMutability": "nonpayable"
740
880
  },
881
+ {
882
+ "type": "function",
883
+ "name": "setPaymentTokenAllowed",
884
+ "inputs": [
885
+ {
886
+ "name": "token",
887
+ "type": "address",
888
+ "internalType": "address"
889
+ },
890
+ {
891
+ "name": "allowed",
892
+ "type": "bool",
893
+ "internalType": "bool"
894
+ }
895
+ ],
896
+ "outputs": [],
897
+ "stateMutability": "nonpayable"
898
+ },
741
899
  {
742
900
  "type": "function",
743
901
  "name": "setProtocolFeeRecipient",
@@ -805,6 +963,13 @@ var tokenAuctionAbi = [
805
963
  "outputs": [],
806
964
  "stateMutability": "nonpayable"
807
965
  },
966
+ {
967
+ "type": "function",
968
+ "name": "unpause",
969
+ "inputs": [],
970
+ "outputs": [],
971
+ "stateMutability": "nonpayable"
972
+ },
808
973
  {
809
974
  "type": "function",
810
975
  "name": "userPurchases",
@@ -965,6 +1130,31 @@ var tokenAuctionAbi = [
965
1130
  ],
966
1131
  "anonymous": false
967
1132
  },
1133
+ {
1134
+ "type": "event",
1135
+ "name": "Claimed",
1136
+ "inputs": [
1137
+ {
1138
+ "name": "token",
1139
+ "type": "address",
1140
+ "indexed": true,
1141
+ "internalType": "address"
1142
+ },
1143
+ {
1144
+ "name": "account",
1145
+ "type": "address",
1146
+ "indexed": true,
1147
+ "internalType": "address"
1148
+ },
1149
+ {
1150
+ "name": "amount",
1151
+ "type": "uint256",
1152
+ "indexed": false,
1153
+ "internalType": "uint256"
1154
+ }
1155
+ ],
1156
+ "anonymous": false
1157
+ },
968
1158
  {
969
1159
  "type": "event",
970
1160
  "name": "DefaultFeeBpsUpdated",
@@ -1083,6 +1273,25 @@ var tokenAuctionAbi = [
1083
1273
  ],
1084
1274
  "anonymous": false
1085
1275
  },
1276
+ {
1277
+ "type": "event",
1278
+ "name": "OwnershipTransferStarted",
1279
+ "inputs": [
1280
+ {
1281
+ "name": "previousOwner",
1282
+ "type": "address",
1283
+ "indexed": true,
1284
+ "internalType": "address"
1285
+ },
1286
+ {
1287
+ "name": "newOwner",
1288
+ "type": "address",
1289
+ "indexed": true,
1290
+ "internalType": "address"
1291
+ }
1292
+ ],
1293
+ "anonymous": false
1294
+ },
1086
1295
  {
1087
1296
  "type": "event",
1088
1297
  "name": "OwnershipTransferred",
@@ -1102,6 +1311,38 @@ var tokenAuctionAbi = [
1102
1311
  ],
1103
1312
  "anonymous": false
1104
1313
  },
1314
+ {
1315
+ "type": "event",
1316
+ "name": "Paused",
1317
+ "inputs": [
1318
+ {
1319
+ "name": "account",
1320
+ "type": "address",
1321
+ "indexed": false,
1322
+ "internalType": "address"
1323
+ }
1324
+ ],
1325
+ "anonymous": false
1326
+ },
1327
+ {
1328
+ "type": "event",
1329
+ "name": "PaymentTokenAllowedUpdated",
1330
+ "inputs": [
1331
+ {
1332
+ "name": "token",
1333
+ "type": "address",
1334
+ "indexed": true,
1335
+ "internalType": "address"
1336
+ },
1337
+ {
1338
+ "name": "allowed",
1339
+ "type": "bool",
1340
+ "indexed": false,
1341
+ "internalType": "bool"
1342
+ }
1343
+ ],
1344
+ "anonymous": false
1345
+ },
1105
1346
  {
1106
1347
  "type": "event",
1107
1348
  "name": "ProceedsWithdrawn",
@@ -1146,6 +1387,31 @@ var tokenAuctionAbi = [
1146
1387
  ],
1147
1388
  "anonymous": false
1148
1389
  },
1390
+ {
1391
+ "type": "event",
1392
+ "name": "ProtocolFeesClaimed",
1393
+ "inputs": [
1394
+ {
1395
+ "name": "token",
1396
+ "type": "address",
1397
+ "indexed": true,
1398
+ "internalType": "address"
1399
+ },
1400
+ {
1401
+ "name": "recipient",
1402
+ "type": "address",
1403
+ "indexed": true,
1404
+ "internalType": "address"
1405
+ },
1406
+ {
1407
+ "name": "amount",
1408
+ "type": "uint256",
1409
+ "indexed": false,
1410
+ "internalType": "uint256"
1411
+ }
1412
+ ],
1413
+ "anonymous": false
1414
+ },
1149
1415
  {
1150
1416
  "type": "event",
1151
1417
  "name": "Swept",
@@ -1269,6 +1535,29 @@ var tokenAuctionAbi = [
1269
1535
  ],
1270
1536
  "anonymous": false
1271
1537
  },
1538
+ {
1539
+ "type": "event",
1540
+ "name": "Unpaused",
1541
+ "inputs": [
1542
+ {
1543
+ "name": "account",
1544
+ "type": "address",
1545
+ "indexed": false,
1546
+ "internalType": "address"
1547
+ }
1548
+ ],
1549
+ "anonymous": false
1550
+ },
1551
+ {
1552
+ "type": "error",
1553
+ "name": "EnforcedPause",
1554
+ "inputs": []
1555
+ },
1556
+ {
1557
+ "type": "error",
1558
+ "name": "ExpectedPause",
1559
+ "inputs": []
1560
+ },
1272
1561
  {
1273
1562
  "type": "error",
1274
1563
  "name": "OwnableInvalidOwner",
@@ -1547,12 +1836,24 @@ var AuctionFlowSDK = class {
1547
1836
  return this.write("migrate", [auctionId]);
1548
1837
  }
1549
1838
  /**
1550
- * Collect the migrated pool's trading fees. The protocol takes its share and
1551
- * the creator receives the rest. Anyone may call it.
1839
+ * Collect the migrated pool's trading fees. The protocol's share accrues to
1840
+ * the protocol and the rest is credited to the creator, who withdraws it
1841
+ * with `claim`. Anyone may call it.
1552
1842
  */
1553
1843
  async collectFees(auctionId) {
1554
1844
  return this.write("collectFees", [auctionId]);
1555
1845
  }
1846
+ /**
1847
+ * Withdraw everything credited to the connected account in `token`: a
1848
+ * creator's share of pool fees, and any reserve migration couldn't place.
1849
+ */
1850
+ async claim(token) {
1851
+ return this.write("claim", [token]);
1852
+ }
1853
+ /** Send the protocol's unclaimed fees in `token` to the fee recipient. Anyone may call it. */
1854
+ async claimProtocolFees(token) {
1855
+ return this.write("claimProtocolFees", [token]);
1856
+ }
1556
1857
  /** The Uniswap pool and position for a migrated auction. */
1557
1858
  async getMigration(auctionId) {
1558
1859
  const [pool, positionId] = await Promise.all([
@@ -1594,6 +1895,43 @@ var AuctionFlowSDK = class {
1594
1895
  args: [auctionId]
1595
1896
  });
1596
1897
  }
1898
+ // Read: Is the protocol paused? While paused, launches and curve buys
1899
+ // revert; selling back, migration, withdrawals, fee collection and claims
1900
+ // still work.
1901
+ async isPaused() {
1902
+ return this.publicClient.readContract({
1903
+ address: this.auctionAddress,
1904
+ abi: tokenAuctionAbi,
1905
+ functionName: "paused"
1906
+ });
1907
+ }
1908
+ // Read: How much of `token` is credited to `account`, waiting for `claim`?
1909
+ async getClaimable(token, account) {
1910
+ return this.publicClient.readContract({
1911
+ address: this.auctionAddress,
1912
+ abi: tokenAuctionAbi,
1913
+ functionName: "claimable",
1914
+ args: [token, account]
1915
+ });
1916
+ }
1917
+ // Read: Protocol fees in `token` earned and not yet claimed.
1918
+ async getProtocolFees(token) {
1919
+ return this.publicClient.readContract({
1920
+ address: this.auctionAddress,
1921
+ abi: tokenAuctionAbi,
1922
+ functionName: "protocolFees",
1923
+ args: [token]
1924
+ });
1925
+ }
1926
+ // Read: May new auctions be priced in `token`?
1927
+ async isPaymentTokenAllowed(token) {
1928
+ return this.publicClient.readContract({
1929
+ address: this.auctionAddress,
1930
+ abi: tokenAuctionAbi,
1931
+ functionName: "paymentTokenAllowed",
1932
+ args: [token]
1933
+ });
1934
+ }
1597
1935
  // Read: Get auction data
1598
1936
  async getAuction(auctionId) {
1599
1937
  const result = await this.publicClient.readContract({