@hypercerts-org/marketplace-sdk 0.3.13 → 0.3.15

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.
@@ -1,5 +1,5 @@
1
1
  import { BigNumberish, ContractTransactionResponse, Overrides, Provider, Signer, TypedDataDomain } from "ethers";
2
- import { Addresses, BatchTransferItem, ChainId, ContractMethods, CreateMakerAskOutput, CreateMakerBidOutput, CreateMakerCollectionOfferInput, CreateMakerCollectionOfferWithProofInput, CreateMakerInput, Maker, MerkleTree, OrderValidatorCode, SignMerkleTreeOrdersOutput, StrategyInfo, StrategyType, Taker } from "./types";
2
+ import { Addresses, BatchTransferItem, ChainId, ContractMethods, CreateMakerAskOutput, CreateMakerBidOutput, CreateMakerCollectionOfferInput, CreateMakerCollectionOfferWithProofInput, CreateMakerInput, Currencies, Maker, MerkleTree, OrderValidatorCode, SignMerkleTreeOrdersOutput, StrategyInfo, StrategyType, Taker } from "./types";
3
3
  import { ApiClient } from "./utils/api";
4
4
  /**
5
5
  * HypercertExchange
@@ -10,6 +10,9 @@ export declare class HypercertExchangeClient {
10
10
  readonly chainId: ChainId;
11
11
  /** Mapping of Hypercert protocol addresses for the current chain */
12
12
  readonly addresses: Addresses;
13
+ /** List of supported currencies for the current chain */
14
+ readonly currencies: Currencies;
15
+ /** API client to interact with the HypercertExchange API */
13
16
  readonly api: ApiClient;
14
17
  /**
15
18
  * Ethers signer
@@ -30,10 +33,11 @@ export declare class HypercertExchangeClient {
30
33
  */
31
34
  constructor(chainId: ChainId, provider: Provider, signer?: Signer, overrides?: {
32
35
  addresses: Addresses;
36
+ currencies: Currencies;
33
37
  apiEndpoint?: string;
34
38
  });
35
39
  /**
36
- * Return the signer it it's set, throw an exception otherwise
40
+ * Return the signer if it's set, throw an exception otherwise
37
41
  * @returns Signer
38
42
  */
39
43
  private getSigner;
@@ -0,0 +1,2 @@
1
+ import { ChainId, Currencies } from "../types";
2
+ export declare const currenciesByNetwork: Record<ChainId, Currencies>;
@@ -11,4 +11,5 @@ export declare const defaultMerkleTree: {
11
11
  proof: never[];
12
12
  };
13
13
  export { addressesByNetwork } from "./addresses";
14
+ export { currenciesByNetwork } from "./currencies";
14
15
  export { chainInfo } from "./chains";
package/dist/index.cjs.js CHANGED
@@ -688,7 +688,11 @@ var strategies = /*#__PURE__*/Object.freeze({
688
688
  exports.ChainId = void 0;
689
689
  (function (ChainId) {
690
690
  ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
691
+ ChainId[ChainId["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA";
691
692
  ChainId[ChainId["HARDHAT"] = 31337] = "HARDHAT";
693
+ ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM";
694
+ ChainId[ChainId["CELO"] = 42220] = "CELO";
695
+ ChainId[ChainId["BASE"] = 8453] = "BASE";
692
696
  })(exports.ChainId || (exports.ChainId = {}));
693
697
  /** List of collection types supported by the protocol */
694
698
  exports.CollectionType = void 0;
@@ -1097,26 +1101,119 @@ const sepoliaAddresses = {
1097
1101
  EXCHANGE_V2: contracts.deployments[11155111].HypercertExchange,
1098
1102
  TRANSFER_MANAGER_V2: contracts.deployments[11155111].TransferManager,
1099
1103
  ORDER_VALIDATOR_V2: contracts.deployments[11155111].OrderValidatorV2A,
1100
- WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1101
1104
  MINTER: contracts.deployments[11155111].HypercertMinterUUPS,
1102
1105
  };
1106
+ const baseSepoliaAddresses = {
1107
+ EXCHANGE_V2: contracts.deployments[84532].HypercertExchange,
1108
+ TRANSFER_MANAGER_V2: contracts.deployments[84532].TransferManager,
1109
+ ORDER_VALIDATOR_V2: contracts.deployments[84532].OrderValidatorV2A,
1110
+ MINTER: contracts.deployments[84532].HypercertMinterUUPS,
1111
+ };
1112
+ const optimismAddresses = {
1113
+ EXCHANGE_V2: contracts.deployments[10].HypercertExchange,
1114
+ TRANSFER_MANAGER_V2: contracts.deployments[10].TransferManager,
1115
+ ORDER_VALIDATOR_V2: contracts.deployments[10].OrderValidatorV2A,
1116
+ MINTER: contracts.deployments[10].HypercertMinterUUPS,
1117
+ };
1118
+ const celoAddresses = {
1119
+ EXCHANGE_V2: contracts.deployments[42220].HypercertExchange,
1120
+ TRANSFER_MANAGER_V2: contracts.deployments[42220].TransferManager,
1121
+ ORDER_VALIDATOR_V2: contracts.deployments[42220].OrderValidatorV2A,
1122
+ MINTER: contracts.deployments[42220].HypercertMinterUUPS,
1123
+ };
1124
+ const baseAddresses = {
1125
+ EXCHANGE_V2: contracts.deployments[8453].HypercertExchange,
1126
+ TRANSFER_MANAGER_V2: contracts.deployments[8453].TransferManager,
1127
+ ORDER_VALIDATOR_V2: contracts.deployments[8453].OrderValidatorV2A,
1128
+ MINTER: contracts.deployments[8453].HypercertMinterUUPS,
1129
+ };
1103
1130
  /**
1104
1131
  * List of useful contract addresses
1105
1132
  */
1106
1133
  const addressesByNetwork = {
1134
+ // Testnets
1107
1135
  [exports.ChainId.SEPOLIA]: sepoliaAddresses,
1108
1136
  [exports.ChainId.HARDHAT]: sepoliaAddresses,
1137
+ [exports.ChainId.BASE_SEPOLIA]: baseSepoliaAddresses,
1138
+ // Production nets
1139
+ [exports.ChainId.OPTIMISM]: optimismAddresses,
1140
+ [exports.ChainId.CELO]: celoAddresses,
1141
+ [exports.ChainId.BASE]: baseAddresses,
1142
+ };
1143
+
1144
+ const currencyAddressesPerChain = {
1145
+ [exports.ChainId.SEPOLIA]: {
1146
+ ETH: ethers.ZeroAddress,
1147
+ WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1148
+ DAI: "0x68194a729C2450ad26072b3D33ADaCbcef39D574",
1149
+ USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
1150
+ },
1151
+ [exports.ChainId.HARDHAT]: {
1152
+ ETH: ethers.ZeroAddress,
1153
+ WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1154
+ DAI: "0x68194a729C2450ad26072b3D33ADaCbcef39D574",
1155
+ USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
1156
+ },
1157
+ [exports.ChainId.BASE_SEPOLIA]: {
1158
+ ETH: ethers.ZeroAddress,
1159
+ WETH: "0x1BDD24840e119DC2602dCC587Dd182812427A5Cc",
1160
+ DAI: "0xbEC8ab89b34835F6b99fFc29c088426E8e708ceA",
1161
+ USDC: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
1162
+ },
1163
+ [exports.ChainId.OPTIMISM]: {
1164
+ ETH: ethers.ZeroAddress,
1165
+ WETH: "0x4200000000000000000000000000000000000006",
1166
+ DAI: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
1167
+ USDC: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
1168
+ },
1169
+ [exports.ChainId.CELO]: {
1170
+ ETH: ethers.ZeroAddress,
1171
+ WETH: "0x66803fb87abd4aac3cbb3fad7c3aa01f6f3fb207",
1172
+ DAI: "0xE4fE50cdD716522A56204352f00AA110F731932d",
1173
+ USDC: "0xef4229c8c3250C675F21BCefa42f58EfbfF6002a",
1174
+ },
1175
+ [exports.ChainId.BASE]: {
1176
+ ETH: ethers.ZeroAddress,
1177
+ WETH: "0x4200000000000000000000000000000000000006",
1178
+ DAI: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
1179
+ USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
1180
+ },
1181
+ };
1182
+ const getCurrencies = (chainId) => {
1183
+ const currenciesForChain = currencyAddressesPerChain[chainId];
1184
+ return {
1185
+ ETH: {
1186
+ symbol: "ETH",
1187
+ address: currenciesForChain.ETH,
1188
+ decimals: 18,
1189
+ },
1190
+ WETH: {
1191
+ symbol: "WETH",
1192
+ address: currenciesForChain.WETH,
1193
+ decimals: 18,
1194
+ },
1195
+ DAI: {
1196
+ symbol: "DAI",
1197
+ address: currenciesForChain.DAI,
1198
+ decimals: 18,
1199
+ },
1200
+ USDC: {
1201
+ symbol: "USDC",
1202
+ address: currenciesForChain.USDC,
1203
+ decimals: 6,
1204
+ },
1205
+ };
1206
+ };
1207
+ const currenciesByNetwork = {
1208
+ [exports.ChainId.SEPOLIA]: getCurrencies(exports.ChainId.SEPOLIA),
1209
+ [exports.ChainId.HARDHAT]: getCurrencies(exports.ChainId.HARDHAT),
1210
+ [exports.ChainId.BASE_SEPOLIA]: getCurrencies(exports.ChainId.BASE_SEPOLIA),
1211
+ [exports.ChainId.OPTIMISM]: getCurrencies(exports.ChainId.OPTIMISM),
1212
+ [exports.ChainId.CELO]: getCurrencies(exports.ChainId.CELO),
1213
+ [exports.ChainId.BASE]: getCurrencies(exports.ChainId.BASE),
1109
1214
  };
1110
1215
 
1111
1216
  const chainInfo = {
1112
- // [ChainId.GOERLI]: {
1113
- // label: "Goerli",
1114
- // appUrl: "https://goerli.looksrare.org",
1115
- // explorer: "https://goerli.etherscan.io",
1116
- // rpcUrl: "https://eth-goerli.g.alchemy.com/v2",
1117
- // baseApiUrl: "https://graphql-goerli.looksrare.org",
1118
- // osApiUrl: "https://testnets-api.opensea.io",
1119
- // },
1120
1217
  [exports.ChainId.SEPOLIA]: {
1121
1218
  label: "Sepolia",
1122
1219
  appUrl: "https://sepolia.looksrare.org",
@@ -1133,6 +1230,38 @@ const chainInfo = {
1133
1230
  baseApiUrl: "http://localhost:4000",
1134
1231
  osApiUrl: "https://testnets-api.opensea.io",
1135
1232
  },
1233
+ [exports.ChainId.BASE_SEPOLIA]: {
1234
+ label: "Base Sepolia",
1235
+ appUrl: "https://sepolia.base.looksrare.org",
1236
+ explorer: "https://sepolia.basescan.org",
1237
+ rpcUrl: "https://sepolia.base.org",
1238
+ baseApiUrl: "https://api-sepolia.basescan.org/api",
1239
+ osApiUrl: "https://testnets-api.opensea.io",
1240
+ },
1241
+ [exports.ChainId.OPTIMISM]: {
1242
+ label: "Optimism",
1243
+ appUrl: "https://optimism.looksrare.org",
1244
+ explorer: "https://optimism.etherscan.io",
1245
+ rpcUrl: "https://optimism.g.alchemy.com/v2",
1246
+ baseApiUrl: "https://graphql-optimism.looksrare.org",
1247
+ osApiUrl: "https://testnets-api.opensea.io",
1248
+ },
1249
+ [exports.ChainId.CELO]: {
1250
+ label: "Celo",
1251
+ appUrl: "https://celo.looksrare.org",
1252
+ explorer: "https://explorer.celo.org",
1253
+ rpcUrl: "https://forno.celo.org",
1254
+ baseApiUrl: "https://api.celo.looksrare.org",
1255
+ osApiUrl: "https://testnets-api.opensea.io",
1256
+ },
1257
+ [exports.ChainId.BASE]: {
1258
+ label: "Base",
1259
+ appUrl: "https://base.looksrare.org",
1260
+ explorer: "https://base.etherscan.io",
1261
+ rpcUrl: "https://eth-base.g.alchemy.com/v2",
1262
+ baseApiUrl: "https://graphql-base.looksrare.org",
1263
+ osApiUrl: "https://testnets-api.opensea.io",
1264
+ },
1136
1265
  };
1137
1266
 
1138
1267
  /** Maximum amount of orders in a merkle tree
@@ -7428,12 +7557,13 @@ class HypercertExchangeClient {
7428
7557
  const indexerEnvironment = deployment.isTestnet ? "test" : "production";
7429
7558
  this.chainId = chainId;
7430
7559
  this.addresses = overrides?.addresses ?? addressesByNetwork[this.chainId];
7560
+ this.currencies = overrides?.currencies ?? currenciesByNetwork[this.chainId];
7431
7561
  this.signer = signer;
7432
7562
  this.provider = provider;
7433
7563
  this.api = new ApiClient(indexerEnvironment, overrides?.apiEndpoint);
7434
7564
  }
7435
7565
  /**
7436
- * Return the signer it it's set, throw an exception otherwise
7566
+ * Return the signer if it's set, throw an exception otherwise
7437
7567
  * @returns Signer
7438
7568
  */
7439
7569
  getSigner() {
@@ -7508,7 +7638,7 @@ class HypercertExchangeClient {
7508
7638
  * @param CreateMakerInput
7509
7639
  * @returns the maker object, isCurrencyApproved, and isBalanceSufficient
7510
7640
  */
7511
- async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts = [1], currency = this.addresses.WETH, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7641
+ async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts = [1], currency = this.currencies.WETH.address, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7512
7642
  const signer = this.getSigner();
7513
7643
  if (!this.isTimestampValid(startTime) || !this.isTimestampValid(endTime)) {
7514
7644
  throw new ErrorTimestamp();
@@ -7815,7 +7945,7 @@ class HypercertExchangeClient {
7815
7945
  * @param currency Currency used to buy the fractions (default to WETH)
7816
7946
  * @param additionalParameters Additional parameters used to support complex orders
7817
7947
  */
7818
- async createDirectFractionsSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.addresses.WETH, additionalParameters = [], }) {
7948
+ async createDirectFractionsSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.currencies.WETH.address, additionalParameters = [], }) {
7819
7949
  const address = await this.signer?.getAddress();
7820
7950
  if (!address) {
7821
7951
  throw new Error("No signer address could be determined");
@@ -7856,7 +7986,7 @@ class HypercertExchangeClient {
7856
7986
  * @param sellLeftoverFraction Whether or not the seller wants to sell the leftover units
7857
7987
  * @param root Merkle tree root (optional)
7858
7988
  */
7859
- async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.addresses.WETH, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
7989
+ async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.currencies.WETH.address, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
7860
7990
  const address = await this.signer?.getAddress();
7861
7991
  if (!address) {
7862
7992
  throw new Error("No signer address could be determined");
@@ -7961,5 +8091,6 @@ exports.TransferManagerAbi = TransferManager;
7961
8091
  exports.WETHAbi = WETH;
7962
8092
  exports.addressesByNetwork = addressesByNetwork;
7963
8093
  exports.chainInfo = chainInfo;
8094
+ exports.currenciesByNetwork = currenciesByNetwork;
7964
8095
  exports.defaultMerkleTree = defaultMerkleTree;
7965
8096
  exports.utils = utils;
package/dist/index.esm.js CHANGED
@@ -686,7 +686,11 @@ var strategies = /*#__PURE__*/Object.freeze({
686
686
  var ChainId;
687
687
  (function (ChainId) {
688
688
  ChainId[ChainId["SEPOLIA"] = 11155111] = "SEPOLIA";
689
+ ChainId[ChainId["BASE_SEPOLIA"] = 84532] = "BASE_SEPOLIA";
689
690
  ChainId[ChainId["HARDHAT"] = 31337] = "HARDHAT";
691
+ ChainId[ChainId["OPTIMISM"] = 10] = "OPTIMISM";
692
+ ChainId[ChainId["CELO"] = 42220] = "CELO";
693
+ ChainId[ChainId["BASE"] = 8453] = "BASE";
690
694
  })(ChainId || (ChainId = {}));
691
695
  /** List of collection types supported by the protocol */
692
696
  var CollectionType;
@@ -1095,26 +1099,119 @@ const sepoliaAddresses = {
1095
1099
  EXCHANGE_V2: deployments[11155111].HypercertExchange,
1096
1100
  TRANSFER_MANAGER_V2: deployments[11155111].TransferManager,
1097
1101
  ORDER_VALIDATOR_V2: deployments[11155111].OrderValidatorV2A,
1098
- WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1099
1102
  MINTER: deployments[11155111].HypercertMinterUUPS,
1100
1103
  };
1104
+ const baseSepoliaAddresses = {
1105
+ EXCHANGE_V2: deployments[84532].HypercertExchange,
1106
+ TRANSFER_MANAGER_V2: deployments[84532].TransferManager,
1107
+ ORDER_VALIDATOR_V2: deployments[84532].OrderValidatorV2A,
1108
+ MINTER: deployments[84532].HypercertMinterUUPS,
1109
+ };
1110
+ const optimismAddresses = {
1111
+ EXCHANGE_V2: deployments[10].HypercertExchange,
1112
+ TRANSFER_MANAGER_V2: deployments[10].TransferManager,
1113
+ ORDER_VALIDATOR_V2: deployments[10].OrderValidatorV2A,
1114
+ MINTER: deployments[10].HypercertMinterUUPS,
1115
+ };
1116
+ const celoAddresses = {
1117
+ EXCHANGE_V2: deployments[42220].HypercertExchange,
1118
+ TRANSFER_MANAGER_V2: deployments[42220].TransferManager,
1119
+ ORDER_VALIDATOR_V2: deployments[42220].OrderValidatorV2A,
1120
+ MINTER: deployments[42220].HypercertMinterUUPS,
1121
+ };
1122
+ const baseAddresses = {
1123
+ EXCHANGE_V2: deployments[8453].HypercertExchange,
1124
+ TRANSFER_MANAGER_V2: deployments[8453].TransferManager,
1125
+ ORDER_VALIDATOR_V2: deployments[8453].OrderValidatorV2A,
1126
+ MINTER: deployments[8453].HypercertMinterUUPS,
1127
+ };
1101
1128
  /**
1102
1129
  * List of useful contract addresses
1103
1130
  */
1104
1131
  const addressesByNetwork = {
1132
+ // Testnets
1105
1133
  [ChainId.SEPOLIA]: sepoliaAddresses,
1106
1134
  [ChainId.HARDHAT]: sepoliaAddresses,
1135
+ [ChainId.BASE_SEPOLIA]: baseSepoliaAddresses,
1136
+ // Production nets
1137
+ [ChainId.OPTIMISM]: optimismAddresses,
1138
+ [ChainId.CELO]: celoAddresses,
1139
+ [ChainId.BASE]: baseAddresses,
1140
+ };
1141
+
1142
+ const currencyAddressesPerChain = {
1143
+ [ChainId.SEPOLIA]: {
1144
+ ETH: ZeroAddress,
1145
+ WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1146
+ DAI: "0x68194a729C2450ad26072b3D33ADaCbcef39D574",
1147
+ USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
1148
+ },
1149
+ [ChainId.HARDHAT]: {
1150
+ ETH: ZeroAddress,
1151
+ WETH: "0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9",
1152
+ DAI: "0x68194a729C2450ad26072b3D33ADaCbcef39D574",
1153
+ USDC: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
1154
+ },
1155
+ [ChainId.BASE_SEPOLIA]: {
1156
+ ETH: ZeroAddress,
1157
+ WETH: "0x1BDD24840e119DC2602dCC587Dd182812427A5Cc",
1158
+ DAI: "0xbEC8ab89b34835F6b99fFc29c088426E8e708ceA",
1159
+ USDC: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
1160
+ },
1161
+ [ChainId.OPTIMISM]: {
1162
+ ETH: ZeroAddress,
1163
+ WETH: "0x4200000000000000000000000000000000000006",
1164
+ DAI: "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
1165
+ USDC: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
1166
+ },
1167
+ [ChainId.CELO]: {
1168
+ ETH: ZeroAddress,
1169
+ WETH: "0x66803fb87abd4aac3cbb3fad7c3aa01f6f3fb207",
1170
+ DAI: "0xE4fE50cdD716522A56204352f00AA110F731932d",
1171
+ USDC: "0xef4229c8c3250C675F21BCefa42f58EfbfF6002a",
1172
+ },
1173
+ [ChainId.BASE]: {
1174
+ ETH: ZeroAddress,
1175
+ WETH: "0x4200000000000000000000000000000000000006",
1176
+ DAI: "0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",
1177
+ USDC: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
1178
+ },
1179
+ };
1180
+ const getCurrencies = (chainId) => {
1181
+ const currenciesForChain = currencyAddressesPerChain[chainId];
1182
+ return {
1183
+ ETH: {
1184
+ symbol: "ETH",
1185
+ address: currenciesForChain.ETH,
1186
+ decimals: 18,
1187
+ },
1188
+ WETH: {
1189
+ symbol: "WETH",
1190
+ address: currenciesForChain.WETH,
1191
+ decimals: 18,
1192
+ },
1193
+ DAI: {
1194
+ symbol: "DAI",
1195
+ address: currenciesForChain.DAI,
1196
+ decimals: 18,
1197
+ },
1198
+ USDC: {
1199
+ symbol: "USDC",
1200
+ address: currenciesForChain.USDC,
1201
+ decimals: 6,
1202
+ },
1203
+ };
1204
+ };
1205
+ const currenciesByNetwork = {
1206
+ [ChainId.SEPOLIA]: getCurrencies(ChainId.SEPOLIA),
1207
+ [ChainId.HARDHAT]: getCurrencies(ChainId.HARDHAT),
1208
+ [ChainId.BASE_SEPOLIA]: getCurrencies(ChainId.BASE_SEPOLIA),
1209
+ [ChainId.OPTIMISM]: getCurrencies(ChainId.OPTIMISM),
1210
+ [ChainId.CELO]: getCurrencies(ChainId.CELO),
1211
+ [ChainId.BASE]: getCurrencies(ChainId.BASE),
1107
1212
  };
1108
1213
 
1109
1214
  const chainInfo = {
1110
- // [ChainId.GOERLI]: {
1111
- // label: "Goerli",
1112
- // appUrl: "https://goerli.looksrare.org",
1113
- // explorer: "https://goerli.etherscan.io",
1114
- // rpcUrl: "https://eth-goerli.g.alchemy.com/v2",
1115
- // baseApiUrl: "https://graphql-goerli.looksrare.org",
1116
- // osApiUrl: "https://testnets-api.opensea.io",
1117
- // },
1118
1215
  [ChainId.SEPOLIA]: {
1119
1216
  label: "Sepolia",
1120
1217
  appUrl: "https://sepolia.looksrare.org",
@@ -1131,6 +1228,38 @@ const chainInfo = {
1131
1228
  baseApiUrl: "http://localhost:4000",
1132
1229
  osApiUrl: "https://testnets-api.opensea.io",
1133
1230
  },
1231
+ [ChainId.BASE_SEPOLIA]: {
1232
+ label: "Base Sepolia",
1233
+ appUrl: "https://sepolia.base.looksrare.org",
1234
+ explorer: "https://sepolia.basescan.org",
1235
+ rpcUrl: "https://sepolia.base.org",
1236
+ baseApiUrl: "https://api-sepolia.basescan.org/api",
1237
+ osApiUrl: "https://testnets-api.opensea.io",
1238
+ },
1239
+ [ChainId.OPTIMISM]: {
1240
+ label: "Optimism",
1241
+ appUrl: "https://optimism.looksrare.org",
1242
+ explorer: "https://optimism.etherscan.io",
1243
+ rpcUrl: "https://optimism.g.alchemy.com/v2",
1244
+ baseApiUrl: "https://graphql-optimism.looksrare.org",
1245
+ osApiUrl: "https://testnets-api.opensea.io",
1246
+ },
1247
+ [ChainId.CELO]: {
1248
+ label: "Celo",
1249
+ appUrl: "https://celo.looksrare.org",
1250
+ explorer: "https://explorer.celo.org",
1251
+ rpcUrl: "https://forno.celo.org",
1252
+ baseApiUrl: "https://api.celo.looksrare.org",
1253
+ osApiUrl: "https://testnets-api.opensea.io",
1254
+ },
1255
+ [ChainId.BASE]: {
1256
+ label: "Base",
1257
+ appUrl: "https://base.looksrare.org",
1258
+ explorer: "https://base.etherscan.io",
1259
+ rpcUrl: "https://eth-base.g.alchemy.com/v2",
1260
+ baseApiUrl: "https://graphql-base.looksrare.org",
1261
+ osApiUrl: "https://testnets-api.opensea.io",
1262
+ },
1134
1263
  };
1135
1264
 
1136
1265
  /** Maximum amount of orders in a merkle tree
@@ -7426,12 +7555,13 @@ class HypercertExchangeClient {
7426
7555
  const indexerEnvironment = deployment.isTestnet ? "test" : "production";
7427
7556
  this.chainId = chainId;
7428
7557
  this.addresses = overrides?.addresses ?? addressesByNetwork[this.chainId];
7558
+ this.currencies = overrides?.currencies ?? currenciesByNetwork[this.chainId];
7429
7559
  this.signer = signer;
7430
7560
  this.provider = provider;
7431
7561
  this.api = new ApiClient(indexerEnvironment, overrides?.apiEndpoint);
7432
7562
  }
7433
7563
  /**
7434
- * Return the signer it it's set, throw an exception otherwise
7564
+ * Return the signer if it's set, throw an exception otherwise
7435
7565
  * @returns Signer
7436
7566
  */
7437
7567
  getSigner() {
@@ -7506,7 +7636,7 @@ class HypercertExchangeClient {
7506
7636
  * @param CreateMakerInput
7507
7637
  * @returns the maker object, isCurrencyApproved, and isBalanceSufficient
7508
7638
  */
7509
- async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts = [1], currency = this.addresses.WETH, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7639
+ async createMakerBid({ collection, strategyId, collectionType, subsetNonce, orderNonce, endTime, price, itemIds, amounts = [1], currency = this.currencies.WETH.address, startTime = Math.floor(Date.now() / 1000), additionalParameters = [], }) {
7510
7640
  const signer = this.getSigner();
7511
7641
  if (!this.isTimestampValid(startTime) || !this.isTimestampValid(endTime)) {
7512
7642
  throw new ErrorTimestamp();
@@ -7813,7 +7943,7 @@ class HypercertExchangeClient {
7813
7943
  * @param currency Currency used to buy the fractions (default to WETH)
7814
7944
  * @param additionalParameters Additional parameters used to support complex orders
7815
7945
  */
7816
- async createDirectFractionsSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.addresses.WETH, additionalParameters = [], }) {
7946
+ async createDirectFractionsSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.currencies.WETH.address, additionalParameters = [], }) {
7817
7947
  const address = await this.signer?.getAddress();
7818
7948
  if (!address) {
7819
7949
  throw new Error("No signer address could be determined");
@@ -7854,7 +7984,7 @@ class HypercertExchangeClient {
7854
7984
  * @param sellLeftoverFraction Whether or not the seller wants to sell the leftover units
7855
7985
  * @param root Merkle tree root (optional)
7856
7986
  */
7857
- async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.addresses.WETH, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
7987
+ async createFractionalSaleMakerAsk({ itemIds, price, startTime, endTime, currency = this.currencies.WETH.address, maxUnitAmount, minUnitAmount, minUnitsToKeep, sellLeftoverFraction, root, }) {
7858
7988
  const address = await this.signer?.getAddress();
7859
7989
  if (!address) {
7860
7990
  throw new Error("No signer address could be determined");
@@ -7939,4 +8069,4 @@ const utils = {
7939
8069
  ...asDeployedChain$1,
7940
8070
  };
7941
8071
 
7942
- export { ApiClient, ChainId, CollectionType, Eip712MakerMerkleTree, Eip712MerkleTree, ErrorItemId, ErrorMerkleTreeDepth, ErrorQuoteType, ErrorSigner, ErrorStrategyType, ErrorTimestamp, HypercertExchangeClient, IERC1155 as IERC1155Abi, abiIERC20 as IERC20Abi, abiIERC721 as IERC721Abi, LooksRareProtocol as LooksRareProtocolAbi, MAX_ORDERS_PER_TREE, MerkleTreeNodePosition, OrderValidatorCode, OrderValidatorV2A as OrderValidatorV2AAbi, QuoteType, StrategyType, TransferManager as TransferManagerAbi, WETH as WETHAbi, addressesByNetwork, chainInfo, defaultMerkleTree, utils };
8072
+ export { ApiClient, ChainId, CollectionType, Eip712MakerMerkleTree, Eip712MerkleTree, ErrorItemId, ErrorMerkleTreeDepth, ErrorQuoteType, ErrorSigner, ErrorStrategyType, ErrorTimestamp, HypercertExchangeClient, IERC1155 as IERC1155Abi, abiIERC20 as IERC20Abi, abiIERC721 as IERC721Abi, LooksRareProtocol as LooksRareProtocolAbi, MAX_ORDERS_PER_TREE, MerkleTreeNodePosition, OrderValidatorCode, OrderValidatorV2A as OrderValidatorV2AAbi, QuoteType, StrategyType, TransferManager as TransferManagerAbi, WETH as WETHAbi, addressesByNetwork, chainInfo, currenciesByNetwork, defaultMerkleTree, utils };
package/dist/types.d.ts CHANGED
@@ -4,14 +4,30 @@ import { Eip712MakerMerkleTree } from "./utils/Eip712MakerMerkleTree";
4
4
  export interface Addresses {
5
5
  EXCHANGE_V2: `0x${string}`;
6
6
  TRANSFER_MANAGER_V2: `0x${string}`;
7
- WETH: `0x${string}`;
8
7
  ORDER_VALIDATOR_V2: `0x${string}`;
9
8
  MINTER: `0x${string}`;
10
9
  }
10
+ /** List of supported currencies */
11
+ export interface Currencies {
12
+ ETH: Currency;
13
+ WETH: Currency;
14
+ USDC: Currency;
15
+ DAI: Currency;
16
+ }
17
+ /** Available information about a currency */
18
+ export interface Currency {
19
+ symbol: string;
20
+ address: `0x${string}`;
21
+ decimals: number;
22
+ }
11
23
  /** List of supported chains */
12
24
  export declare enum ChainId {
13
25
  SEPOLIA = 11155111,
14
- HARDHAT = 31337
26
+ BASE_SEPOLIA = 84532,
27
+ HARDHAT = 31337,
28
+ OPTIMISM = 10,
29
+ CELO = 42220,
30
+ BASE = 8453
15
31
  }
16
32
  /** ChainInfo data used to interact with HypercertExchange ecosystem */
17
33
  export interface ChainInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hypercerts-org/marketplace-sdk",
3
- "version": "0.3.13",
3
+ "version": "0.3.15",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",