@hypercerts-org/marketplace-sdk 0.0.3 → 0.0.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/index.cjs.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var ethers = require('ethers');
4
4
  var merkletreejs = require('merkletreejs');
5
+ var contracts = require('@hypercerts-org/contracts');
5
6
  var jsSha3 = require('js-sha3');
6
7
 
7
8
  var abiIERC721 = [
@@ -613,12 +614,6 @@ var abi$2 = [
613
614
  name: "NotAContract",
614
615
  type: "error"
615
616
  },
616
- {
617
- inputs: [
618
- ],
619
- name: "NotAffiliateController",
620
- type: "error"
621
- },
622
617
  {
623
618
  inputs: [
624
619
  ],
@@ -643,12 +638,6 @@ var abi$2 = [
643
638
  name: "OutsideOfTimeRange",
644
639
  type: "error"
645
640
  },
646
- {
647
- inputs: [
648
- ],
649
- name: "PercentageTooHigh",
650
- type: "error"
651
- },
652
641
  {
653
642
  inputs: [
654
643
  ],
@@ -757,33 +746,14 @@ var abi$2 = [
757
746
  {
758
747
  inputs: [
759
748
  ],
760
- name: "WrongPotentialOwner",
749
+ name: "UnsupportedCollectionType",
761
750
  type: "error"
762
751
  },
763
752
  {
764
- anonymous: false,
765
753
  inputs: [
766
- {
767
- indexed: false,
768
- internalType: "address",
769
- name: "affiliate",
770
- type: "address"
771
- },
772
- {
773
- indexed: false,
774
- internalType: "address",
775
- name: "currency",
776
- type: "address"
777
- },
778
- {
779
- indexed: false,
780
- internalType: "uint256",
781
- name: "affiliateFee",
782
- type: "uint256"
783
- }
784
754
  ],
785
- name: "AffiliatePayment",
786
- type: "event"
755
+ name: "WrongPotentialOwner",
756
+ type: "error"
787
757
  },
788
758
  {
789
759
  anonymous: false,
@@ -837,51 +807,6 @@ var abi$2 = [
837
807
  name: "InitiateOwnershipTransfer",
838
808
  type: "event"
839
809
  },
840
- {
841
- anonymous: false,
842
- inputs: [
843
- {
844
- indexed: false,
845
- internalType: "address",
846
- name: "affiliateController",
847
- type: "address"
848
- }
849
- ],
850
- name: "NewAffiliateController",
851
- type: "event"
852
- },
853
- {
854
- anonymous: false,
855
- inputs: [
856
- {
857
- indexed: false,
858
- internalType: "bool",
859
- name: "isActive",
860
- type: "bool"
861
- }
862
- ],
863
- name: "NewAffiliateProgramStatus",
864
- type: "event"
865
- },
866
- {
867
- anonymous: false,
868
- inputs: [
869
- {
870
- indexed: false,
871
- internalType: "address",
872
- name: "affiliate",
873
- type: "address"
874
- },
875
- {
876
- indexed: false,
877
- internalType: "uint256",
878
- name: "rate",
879
- type: "uint256"
880
- }
881
- ],
882
- name: "NewAffiliateRate",
883
- type: "event"
884
- },
885
810
  {
886
811
  anonymous: false,
887
812
  inputs: [
@@ -1332,39 +1257,6 @@ var abi$2 = [
1332
1257
  stateMutability: "nonpayable",
1333
1258
  type: "function"
1334
1259
  },
1335
- {
1336
- inputs: [
1337
- ],
1338
- name: "affiliateController",
1339
- outputs: [
1340
- {
1341
- internalType: "address",
1342
- name: "",
1343
- type: "address"
1344
- }
1345
- ],
1346
- stateMutability: "view",
1347
- type: "function"
1348
- },
1349
- {
1350
- inputs: [
1351
- {
1352
- internalType: "address",
1353
- name: "",
1354
- type: "address"
1355
- }
1356
- ],
1357
- name: "affiliateRates",
1358
- outputs: [
1359
- {
1360
- internalType: "uint256",
1361
- name: "",
1362
- type: "uint256"
1363
- }
1364
- ],
1365
- stateMutability: "view",
1366
- type: "function"
1367
- },
1368
1260
  {
1369
1261
  inputs: [
1370
1262
  {
@@ -1597,11 +1489,6 @@ var abi$2 = [
1597
1489
  name: "merkleTrees",
1598
1490
  type: "tuple[]"
1599
1491
  },
1600
- {
1601
- internalType: "address",
1602
- name: "affiliate",
1603
- type: "address"
1604
- },
1605
1492
  {
1606
1493
  internalType: "bool",
1607
1494
  name: "isAtomic",
@@ -1748,11 +1635,6 @@ var abi$2 = [
1748
1635
  internalType: "struct OrderStructs.MerkleTree",
1749
1636
  name: "merkleTree",
1750
1637
  type: "tuple"
1751
- },
1752
- {
1753
- internalType: "address",
1754
- name: "affiliate",
1755
- type: "address"
1756
1638
  }
1757
1639
  ],
1758
1640
  name: "executeTakerAsk",
@@ -1895,11 +1777,6 @@ var abi$2 = [
1895
1777
  internalType: "struct OrderStructs.MerkleTree",
1896
1778
  name: "merkleTree",
1897
1779
  type: "tuple"
1898
- },
1899
- {
1900
- internalType: "address",
1901
- name: "affiliate",
1902
- type: "address"
1903
1780
  }
1904
1781
  ],
1905
1782
  name: "executeTakerBid",
@@ -1974,20 +1851,6 @@ var abi$2 = [
1974
1851
  stateMutability: "nonpayable",
1975
1852
  type: "function"
1976
1853
  },
1977
- {
1978
- inputs: [
1979
- ],
1980
- name: "isAffiliateProgramActive",
1981
- outputs: [
1982
- {
1983
- internalType: "bool",
1984
- name: "",
1985
- type: "bool"
1986
- }
1987
- ],
1988
- stateMutability: "view",
1989
- type: "function"
1990
- },
1991
1854
  {
1992
1855
  inputs: [
1993
1856
  {
@@ -2263,53 +2126,6 @@ var abi$2 = [
2263
2126
  stateMutability: "view",
2264
2127
  type: "function"
2265
2128
  },
2266
- {
2267
- inputs: [
2268
- {
2269
- internalType: "address",
2270
- name: "newAffiliateController",
2271
- type: "address"
2272
- }
2273
- ],
2274
- name: "updateAffiliateController",
2275
- outputs: [
2276
- ],
2277
- stateMutability: "nonpayable",
2278
- type: "function"
2279
- },
2280
- {
2281
- inputs: [
2282
- {
2283
- internalType: "bool",
2284
- name: "isActive",
2285
- type: "bool"
2286
- }
2287
- ],
2288
- name: "updateAffiliateProgramStatus",
2289
- outputs: [
2290
- ],
2291
- stateMutability: "nonpayable",
2292
- type: "function"
2293
- },
2294
- {
2295
- inputs: [
2296
- {
2297
- internalType: "address",
2298
- name: "affiliate",
2299
- type: "address"
2300
- },
2301
- {
2302
- internalType: "uint256",
2303
- name: "bp",
2304
- type: "uint256"
2305
- }
2306
- ],
2307
- name: "updateAffiliateRate",
2308
- outputs: [
2309
- ],
2310
- stateMutability: "nonpayable",
2311
- type: "function"
2312
- },
2313
2129
  {
2314
2130
  inputs: [
2315
2131
  {
@@ -2497,45 +2313,45 @@ var abi$2 = [
2497
2313
  }
2498
2314
  ];
2499
2315
 
2500
- const executeTakerBid = (signer, address, taker, maker, makerSignature, merkleTree, affiliate, overrides) => {
2316
+ const executeTakerBid = (signer, address, taker, maker, makerSignature, merkleTree, overrides) => {
2501
2317
  const overridesWithValue = {
2502
2318
  ...overrides,
2503
2319
  ...(maker.currency === ethers.ZeroAddress && { value: maker.price }),
2504
2320
  };
2505
2321
  const contract = new ethers.Contract(address, abi$2).connect(signer);
2506
2322
  return {
2507
- call: (additionalOverrides) => contract.executeTakerBid.send(taker, maker, makerSignature, merkleTree, affiliate, {
2323
+ call: (additionalOverrides) => contract.executeTakerBid.send(taker, maker, makerSignature, merkleTree, {
2508
2324
  ...overridesWithValue,
2509
2325
  ...additionalOverrides,
2510
2326
  }),
2511
- estimateGas: (additionalOverrides) => contract.executeTakerBid.estimateGas(taker, maker, makerSignature, merkleTree, affiliate, {
2327
+ estimateGas: (additionalOverrides) => contract.executeTakerBid.estimateGas(taker, maker, makerSignature, merkleTree, {
2512
2328
  ...overridesWithValue,
2513
2329
  ...additionalOverrides,
2514
2330
  }),
2515
- callStatic: (additionalOverrides) => contract.executeTakerBid.staticCall(taker, maker, makerSignature, merkleTree, affiliate, {
2331
+ callStatic: (additionalOverrides) => contract.executeTakerBid.staticCall(taker, maker, makerSignature, merkleTree, {
2516
2332
  ...overridesWithValue,
2517
2333
  ...additionalOverrides,
2518
2334
  }),
2519
2335
  };
2520
2336
  };
2521
- const executeTakerAsk = (signer, address, taker, maker, makerSignature, merkleTree, affiliate, overrides) => {
2337
+ const executeTakerAsk = (signer, address, taker, maker, makerSignature, merkleTree, overrides) => {
2522
2338
  const contract = new ethers.Contract(address, abi$2).connect(signer);
2523
2339
  return {
2524
- call: (additionalOverrides) => contract.executeTakerAsk.send(taker, maker, makerSignature, merkleTree, affiliate, {
2340
+ call: (additionalOverrides) => contract.executeTakerAsk.send(taker, maker, makerSignature, merkleTree, {
2525
2341
  ...overrides,
2526
2342
  ...additionalOverrides,
2527
2343
  }),
2528
- estimateGas: (additionalOverrides) => contract.executeTakerAsk.estimateGas(taker, maker, makerSignature, merkleTree, affiliate, {
2344
+ estimateGas: (additionalOverrides) => contract.executeTakerAsk.estimateGas(taker, maker, makerSignature, merkleTree, {
2529
2345
  ...overrides,
2530
2346
  ...additionalOverrides,
2531
2347
  }),
2532
- callStatic: (additionalOverrides) => contract.executeTakerAsk.staticCall(taker, maker, makerSignature, merkleTree, affiliate, {
2348
+ callStatic: (additionalOverrides) => contract.executeTakerAsk.staticCall(taker, maker, makerSignature, merkleTree, {
2533
2349
  ...overrides,
2534
2350
  ...additionalOverrides,
2535
2351
  }),
2536
2352
  };
2537
2353
  };
2538
- const executeMultipleTakerBids = (signer, address, taker, maker, makerSignature, isAtomic, merkleTree, affiliate, overrides) => {
2354
+ const executeMultipleTakerBids = (signer, address, taker, maker, makerSignature, isAtomic, merkleTree, overrides) => {
2539
2355
  const value = maker.reduce((acc, order) => (order.currency === ethers.ZeroAddress ? acc + BigInt(order.price) : acc), 0n);
2540
2356
  const overridesWithValue = {
2541
2357
  ...overrides,
@@ -2543,15 +2359,15 @@ const executeMultipleTakerBids = (signer, address, taker, maker, makerSignature,
2543
2359
  };
2544
2360
  const contract = new ethers.Contract(address, abi$2).connect(signer);
2545
2361
  return {
2546
- call: (additionalOverrides) => contract.executeMultipleTakerBids.send(taker, maker, makerSignature, merkleTree, affiliate, isAtomic, {
2362
+ call: (additionalOverrides) => contract.executeMultipleTakerBids.send(taker, maker, makerSignature, merkleTree, isAtomic, {
2547
2363
  ...overridesWithValue,
2548
2364
  ...additionalOverrides,
2549
2365
  }),
2550
- estimateGas: (additionalOverrides) => contract.executeMultipleTakerBids.estimateGas(taker, maker, makerSignature, merkleTree, affiliate, isAtomic, {
2366
+ estimateGas: (additionalOverrides) => contract.executeMultipleTakerBids.estimateGas(taker, maker, makerSignature, merkleTree, isAtomic, {
2551
2367
  ...overridesWithValue,
2552
2368
  ...additionalOverrides,
2553
2369
  }),
2554
- callStatic: (additionalOverrides) => contract.executeMultipleTakerBids.staticCall(taker, maker, makerSignature, merkleTree, affiliate, isAtomic, {
2370
+ callStatic: (additionalOverrides) => contract.executeMultipleTakerBids.staticCall(taker, maker, makerSignature, merkleTree, isAtomic, {
2555
2371
  ...overridesWithValue,
2556
2372
  ...additionalOverrides,
2557
2373
  }),
@@ -4012,26 +3828,18 @@ var signMakerOrders = /*#__PURE__*/Object.freeze({
4012
3828
  });
4013
3829
 
4014
3830
  const goerliAddresses = {
4015
- LOOKS: "0x20A5A36ded0E4101C3688CBC405bBAAE58fE9eeC",
4016
- EXCHANGE_V2: "0x35C2215F2FFe8917B06454eEEaba189877F200cf",
4017
- TRANSFER_MANAGER_V2: "0xC20E0CeAD98abBBEb626B77efb8Dc1E5D781f90c",
3831
+ EXCHANGE_V2: "0x483e634b79A933CDf369c46f6138a781B7495233",
3832
+ TRANSFER_MANAGER_V2: "0x7AAC4C1407f5F83256581eCc913dC8b20F7bdab1",
3833
+ // EXCHANGE_V2: deployments[5].HypercertExchange as string,
3834
+ // TRANSFER_MANAGER_V2: deployments[5].TransferManager as string,
4018
3835
  WETH: "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
4019
3836
  ORDER_VALIDATOR_V2: "0x7454Cc9AEB024bcE6A2CDC49ad4733B4D8215fb8",
4020
- REVERSE_RECORDS: "0x333Fc8f550043f239a2CF79aEd5e9cF4A20Eb41e",
4021
- LOOKS_LP_V3: "0x87C81267796Cd65347130e789CADdCdAf7bD2231",
4022
- STAKING_POOL_FOR_LOOKS_LP: "",
4023
- AGGREGATOR_UNISWAP_V3: "0x63c38B3BE3eF075a00a5edaeC36F499088c7334C",
4024
3837
  };
4025
3838
  const sepoliaAddresses = {
4026
- LOOKS: "0xa68c2CaA3D45fa6EBB95aA706c70f49D3356824E",
4027
- EXCHANGE_V2: "0x34098cc15a8a48Da9d3f31CC0F63F01f9aa3D9F3",
4028
- TRANSFER_MANAGER_V2: "0xb46f116ecBa8451E661189F4b2B63aC60a618092",
3839
+ EXCHANGE_V2: contracts.deployments[11155111].HypercertExchange,
3840
+ TRANSFER_MANAGER_V2: contracts.deployments[11155111].TransferManager,
4029
3841
  WETH: "",
4030
3842
  ORDER_VALIDATOR_V2: "0x0bc129E4c1f8D7b5583eAbAeb1F7468935B6ec0C",
4031
- REVERSE_RECORDS: "",
4032
- LOOKS_LP_V3: "",
4033
- STAKING_POOL_FOR_LOOKS_LP: "",
4034
- AGGREGATOR_UNISWAP_V3: "",
4035
3843
  };
4036
3844
  /**
4037
3845
  * List of useful contract addresses
@@ -4050,10 +3858,6 @@ const chainInfo = {
4050
3858
  rpcUrl: "https://eth-goerli.g.alchemy.com/v2",
4051
3859
  baseApiUrl: "https://graphql-goerli.looksrare.org",
4052
3860
  osApiUrl: "https://testnets-api.opensea.io",
4053
- cdnUrl: "https://static-goerli.looksnice.org",
4054
- rewardsSubgraphUrl: "https://api.thegraph.com/subgraphs/name/0xjurassicpunk/looks-distribution",
4055
- cloudinaryUrl: "https://looksrare.mo.cloudinary.net/goerli",
4056
- wsUrl: "wss://ws-goerli.looksrare.org/ws",
4057
3861
  },
4058
3862
  [exports.ChainId.SEPOLIA]: {
4059
3863
  label: "Sepolia",
@@ -4062,10 +3866,6 @@ const chainInfo = {
4062
3866
  rpcUrl: "https://eth-sepolia.g.alchemy.com/v2",
4063
3867
  baseApiUrl: "https://graphql-sepolia.looksrare.org",
4064
3868
  osApiUrl: "https://testnets-api.opensea.io",
4065
- cdnUrl: "https://static-sepolia.looksnice.org",
4066
- rewardsSubgraphUrl: "https://api.thegraph.com/subgraphs/name/0xjurassicpunk/looks-distribution",
4067
- cloudinaryUrl: "https://looksrare.mo.cloudinary.net/sepolia",
4068
- wsUrl: "wss://ws-sepolia.looksrare.org/ws",
4069
3869
  },
4070
3870
  [exports.ChainId.HARDHAT]: {
4071
3871
  label: "Hardhat",
@@ -4074,10 +3874,6 @@ const chainInfo = {
4074
3874
  rpcUrl: "http://127.0.0.1:8545",
4075
3875
  baseApiUrl: "http://localhost:4000",
4076
3876
  osApiUrl: "https://testnets-api.opensea.io",
4077
- cdnUrl: "https://via.placeholder.com",
4078
- rewardsSubgraphUrl: "https://api.thegraph.com/subgraphs/name/0xjurassicpunk/looks-distribution",
4079
- cloudinaryUrl: "",
4080
- wsUrl: "ws://localhost:5001/ws",
4081
3877
  },
4082
3878
  };
4083
3879
 
@@ -5048,10 +4844,10 @@ class LooksRare {
5048
4844
  * @param affiliate Affiliate address if applicable
5049
4845
  * @returns ContractMethods
5050
4846
  */
5051
- executeOrder(maker, taker, signature, merkleTree = defaultMerkleTree, affiliate = ethers.ZeroAddress, overrides) {
4847
+ executeOrder(maker, taker, signature, merkleTree = defaultMerkleTree, overrides) {
5052
4848
  const signer = this.getSigner();
5053
4849
  const execute = maker.quoteType === exports.QuoteType.Ask ? executeTakerBid : executeTakerAsk;
5054
- return execute(signer, this.addresses.EXCHANGE_V2, taker, maker, signature, merkleTree, affiliate, overrides);
4850
+ return execute(signer, this.addresses.EXCHANGE_V2, taker, maker, signature, merkleTree, overrides);
5055
4851
  }
5056
4852
  /**
5057
4853
  * Execute several orders
@@ -5076,7 +4872,7 @@ class LooksRare {
5076
4872
  signatures.push(order.signature);
5077
4873
  merkleTrees.push(order.merkleTree ?? defaultMerkleTree);
5078
4874
  });
5079
- return executeMultipleTakerBids(signer, this.addresses.EXCHANGE_V2, takers, makers, signatures, isAtomic, merkleTrees, affiliate, overrides);
4875
+ return executeMultipleTakerBids(signer, this.addresses.EXCHANGE_V2, takers, makers, signatures, isAtomic, merkleTrees, affiliate);
5080
4876
  }
5081
4877
  /**
5082
4878
  * Cancell all maker bid and/or ask orders for the current user
package/dist/index.d.ts CHANGED
@@ -22,9 +22,9 @@ declare const utils: {
22
22
  cancelOrderNonces: (signer: import("ethers").Signer, address: string, nonces: import("ethers").BigNumberish[], overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
23
23
  cancelSubsetNonces: (signer: import("ethers").Signer, address: string, nonces: import("ethers").BigNumberish[], overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
24
24
  incrementBidAskNonces: (signer: import("ethers").Signer, address: string, bid: boolean, ask: boolean, overrides?: import("ethers").Overrides | undefined) => import("./types").ContractMethods;
25
- executeTakerBid: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker, maker: import("./types").Maker, makerSignature: string, merkleTree: import("./types").MerkleTree, affiliate: string, overrides?: import("./typechain/common").PayableOverrides | undefined) => import("./types").ContractMethods;
26
- executeTakerAsk: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker, maker: import("./types").Maker, makerSignature: string, merkleTree: import("./types").MerkleTree, affiliate: string, overrides?: import("./typechain/common").PayableOverrides | undefined) => import("./types").ContractMethods;
27
- executeMultipleTakerBids: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker[], maker: import("./types").Maker[], makerSignature: string[], isAtomic: boolean, merkleTree: import("./types").MerkleTree[], affiliate: string, overrides?: import("./typechain/common").PayableOverrides | undefined) => {
25
+ executeTakerBid: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker, maker: import("./types").Maker, makerSignature: string, merkleTree: import("./types").MerkleTree, overrides?: import("./typechain/common").PayableOverrides | undefined) => import("./types").ContractMethods;
26
+ executeTakerAsk: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker, maker: import("./types").Maker, makerSignature: string, merkleTree: import("./types").MerkleTree, overrides?: import("./typechain/common").PayableOverrides | undefined) => import("./types").ContractMethods;
27
+ executeMultipleTakerBids: (signer: import("ethers").Signer, address: string, taker: import("./types").Taker[], maker: import("./types").Maker[], makerSignature: string[], isAtomic: boolean, merkleTree: import("./types").MerkleTree[], overrides?: import("./typechain/common").PayableOverrides | undefined) => {
28
28
  call: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => Promise<import("ethers").ContractTransactionResponse>;
29
29
  estimateGas: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => Promise<bigint>;
30
30
  callStatic: (additionalOverrides?: import("./typechain/common").PayableOverrides | undefined) => Promise<void>;