@zoralabs/protocol-sdk 0.5.7-MINT.3 → 0.5.7

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.js CHANGED
@@ -417,16 +417,14 @@ var zora721Abi = parseAbi([
417
417
 
418
418
  // src/apis/chain-constants.ts
419
419
  import {
420
+ arbitrum,
420
421
  base,
421
- baseGoerli,
422
422
  foundry,
423
- goerli,
424
423
  mainnet,
425
424
  optimism,
426
- optimismGoerli,
425
+ sepolia,
427
426
  zora,
428
- zoraSepolia,
429
- zoraTestnet
427
+ zoraSepolia
430
428
  } from "viem/chains";
431
429
  import { parseEther as parseEther2 } from "viem";
432
430
  var REWARD_PER_TOKEN = parseEther2("0.000777");
@@ -438,12 +436,12 @@ var networkConfigByChain = {
438
436
  zoraBackendChainName: "ETHEREUM-MAINNET",
439
437
  subgraphUrl: getSubgraph("zora-create-mainnet", "stable")
440
438
  },
441
- [goerli.id]: {
442
- chainId: goerli.id,
439
+ [sepolia.id]: {
440
+ chainId: sepolia.id,
443
441
  isTestnet: true,
444
- zoraCollectPathChainName: "gor",
445
- zoraBackendChainName: "ETHEREUM-GOERLI",
446
- subgraphUrl: getSubgraph("zora-create-goerli", "stable")
442
+ zoraCollectPathChainName: "sep",
443
+ zoraBackendChainName: "ETHEREUM-SEPOLIA",
444
+ subgraphUrl: getSubgraph("zora-create-sepolia", "stable")
447
445
  },
448
446
  [zora.id]: {
449
447
  chainId: zora.id,
@@ -452,13 +450,6 @@ var networkConfigByChain = {
452
450
  zoraBackendChainName: "ZORA-MAINNET",
453
451
  subgraphUrl: getSubgraph("zora-create-zora-mainnet", "stable")
454
452
  },
455
- [zoraTestnet.id]: {
456
- chainId: zoraTestnet.id,
457
- isTestnet: true,
458
- zoraCollectPathChainName: "zgor",
459
- zoraBackendChainName: "ZORA-GOERLI",
460
- subgraphUrl: getSubgraph("zora-create-zora-testnet", "stable")
461
- },
462
453
  [zoraSepolia.id]: {
463
454
  chainId: zoraSepolia.id,
464
455
  isTestnet: true,
@@ -473,12 +464,12 @@ var networkConfigByChain = {
473
464
  zoraBackendChainName: "OPTIMISM-MAINNET",
474
465
  subgraphUrl: getSubgraph("zora-create-optimism", "stable")
475
466
  },
476
- [optimismGoerli.id]: {
477
- chainId: optimismGoerli.id,
467
+ [arbitrum.id]: {
468
+ chainId: arbitrum.id,
478
469
  isTestnet: true,
479
- zoraCollectPathChainName: "ogor",
480
- zoraBackendChainName: "OPTIMISM-GOERLI",
481
- subgraphUrl: getSubgraph("zora-create-optimism-goerli", "stable")
470
+ zoraCollectPathChainName: "arb",
471
+ zoraBackendChainName: "ARBITRUM-MAINNET",
472
+ subgraphUrl: getSubgraph("zora-create-arbitrum-one", "stable")
482
473
  },
483
474
  [base.id]: {
484
475
  chainId: base.id,
@@ -487,13 +478,6 @@ var networkConfigByChain = {
487
478
  zoraBackendChainName: "BASE-MAINNET",
488
479
  subgraphUrl: getSubgraph("zora-create-base-mainnet", "stable")
489
480
  },
490
- [baseGoerli.id]: {
491
- chainId: baseGoerli.id,
492
- isTestnet: true,
493
- zoraCollectPathChainName: "bgor",
494
- zoraBackendChainName: "BASE-GOERLI",
495
- subgraphUrl: getSubgraph("zora-create-base-goerli", "stable")
496
- },
497
481
  [foundry.id]: {
498
482
  chainId: foundry.id,
499
483
  isTestnet: true,
@@ -502,13 +486,6 @@ var networkConfigByChain = {
502
486
  subgraphUrl: getSubgraph("zora-create-zora-testnet", "stable")
503
487
  }
504
488
  };
505
- var getSubgraphUrl = (chainId) => {
506
- const networkConfig = networkConfigByChain[chainId];
507
- if (!networkConfig) {
508
- throw new Error(`Network not configured for chain id ${chainId}`);
509
- }
510
- return networkConfig.subgraphUrl;
511
- };
512
489
 
513
490
  // src/mint/mint-api-client.ts
514
491
  var getApiNetworkConfigForChain = (chainId) => {
@@ -1581,7 +1558,7 @@ function create1155CreatorClient({
1581
1558
  throw new Error("Invariant: contract cannot be missing and an address");
1582
1559
  }
1583
1560
  if (!contractExists && typeof contract !== "string") {
1584
- const request2 = {
1561
+ const request = {
1585
1562
  abi: zoraCreator1155FactoryImplABI,
1586
1563
  functionName: "createContractDeterministic",
1587
1564
  account,
@@ -1600,13 +1577,13 @@ function create1155CreatorClient({
1600
1577
  ]
1601
1578
  };
1602
1579
  return {
1603
- request: request2,
1580
+ request,
1604
1581
  tokenSetupActions,
1605
1582
  contractAddress,
1606
1583
  contractExists
1607
1584
  };
1608
1585
  } else if (contractExists) {
1609
- const request2 = {
1586
+ const request = {
1610
1587
  abi: zoraCreator1155ImplABI3,
1611
1588
  functionName: "multicall",
1612
1589
  account,
@@ -1614,7 +1591,7 @@ function create1155CreatorClient({
1614
1591
  args: [tokenSetupActions]
1615
1592
  };
1616
1593
  return {
1617
- request: request2,
1594
+ request,
1618
1595
  tokenSetupActions,
1619
1596
  contractAddress,
1620
1597
  contractExists
@@ -1624,93 +1601,6 @@ function create1155CreatorClient({
1624
1601
  }
1625
1602
  return { createNew1155Token };
1626
1603
  }
1627
-
1628
- // src/mints/mints-queries.ts
1629
- import { request, gql } from "graphql-request";
1630
- var getMintsAccountBalanceWithPriceQuery = (account) => {
1631
- const query = gql`
1632
- query GetMintAccountBalances($account: String!) {
1633
- mintAccountBalances(where: { account: $account }) {
1634
- balance
1635
- mintToken {
1636
- id
1637
- pricePerToken
1638
- }
1639
- }
1640
- }
1641
- `;
1642
- return {
1643
- query,
1644
- variables: { account }
1645
- };
1646
- };
1647
- var selectMintsToCollectWithFromQueryResult = (mintAccountBalances, quantityToCollect) => {
1648
- const parsed = mintAccountBalances.map((r) => {
1649
- return {
1650
- tokenId: BigInt(r.mintToken.id),
1651
- quantity: BigInt(r.balance),
1652
- pricePerToken: BigInt(r.mintToken.pricePerToken)
1653
- };
1654
- });
1655
- const sorted = parsed.sort((a, b) => {
1656
- if (a.pricePerToken < b.pricePerToken) {
1657
- return -1;
1658
- }
1659
- return 1;
1660
- });
1661
- let remainingQuantity = quantityToCollect;
1662
- const tokenIds = [];
1663
- const quantities = [];
1664
- while (remainingQuantity > 0) {
1665
- const next = sorted.shift();
1666
- if (!next) {
1667
- throw new Error("Not enough MINTs to collect with");
1668
- }
1669
- const quantityToUse = remainingQuantity > next.quantity ? next.quantity : remainingQuantity;
1670
- tokenIds.push(next.tokenId);
1671
- quantities.push(quantityToUse);
1672
- remainingQuantity -= quantityToUse;
1673
- }
1674
- return {
1675
- tokenIds,
1676
- quantities
1677
- };
1678
- };
1679
- var sumBalances = (mintAccountBalances) => {
1680
- return mintAccountBalances.reduce((acc, curr) => {
1681
- return acc + BigInt(curr.balance);
1682
- }, BigInt(0));
1683
- };
1684
- var getMINTsToCollectWith = async ({
1685
- account,
1686
- chainId,
1687
- quantityToCollect
1688
- }) => {
1689
- const subgraphUrl = getSubgraphUrl(chainId);
1690
- const { query, variables } = getMintsAccountBalanceWithPriceQuery(account);
1691
- const result = await request(
1692
- subgraphUrl,
1693
- query,
1694
- variables
1695
- );
1696
- return selectMintsToCollectWithFromQueryResult(
1697
- result.mintTokenBalances,
1698
- quantityToCollect
1699
- );
1700
- };
1701
- var getMINTsBalance = async ({
1702
- chainId,
1703
- account
1704
- }) => {
1705
- const subgraphUrl = getSubgraphUrl(chainId);
1706
- const { query, variables } = getMintsAccountBalanceWithPriceQuery(account);
1707
- const result = await request(
1708
- subgraphUrl,
1709
- query,
1710
- variables
1711
- );
1712
- return sumBalances(result.mintTokenBalances);
1713
- };
1714
1604
  export {
1715
1605
  DEFAULT_SALE_SETTINGS,
1716
1606
  Errors,
@@ -1733,10 +1623,7 @@ export {
1733
1623
  encodePremintForAPI,
1734
1624
  getApiNetworkConfigForChain,
1735
1625
  getDefaultFixedPriceMinterAddress,
1736
- getMINTsBalance,
1737
- getMINTsToCollectWith,
1738
1626
  getMintCosts,
1739
- getMintsAccountBalanceWithPriceQuery,
1740
1627
  getPremintCollectionAddress,
1741
1628
  getPremintExecutorAddress,
1742
1629
  getPremintMintCosts,
@@ -1752,8 +1639,6 @@ export {
1752
1639
  premintTypedDataDefinition,
1753
1640
  recoverCreatorFromCreatorAttribution,
1754
1641
  recoverPremintSigner,
1755
- selectMintsToCollectWithFromQueryResult,
1756
- sumBalances,
1757
1642
  supportedPremintVersions,
1758
1643
  supportsPremintVersion,
1759
1644
  tryRecoverPremintSigner,