@zoralabs/protocol-sdk 0.5.4-MINT.0 → 0.5.4
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/.turbo/turbo-build.log +7 -6
- package/CHANGELOG.md +2 -5
- package/dist/apis/chain-constants.d.ts +0 -1
- package/dist/apis/chain-constants.d.ts.map +1 -1
- package/dist/index.cjs +4 -86
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -83
- package/dist/index.js.map +1 -1
- package/package.json +16 -9
- package/src/apis/chain-constants.ts +0 -10
- package/src/index.ts +0 -2
- package/dist/mints/mints-queries.d.ts +0 -44
- package/dist/mints/mints-queries.d.ts.map +0 -1
- package/src/mints/mints-queries.test.ts +0 -78
- package/src/mints/mints-queries.ts +0 -121
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
warning package.json: "dependencies" has dependency "vite" with range "4.5.0" that collides with a dependency in "devDependencies" of the same name with version "^4.5.0"
|
|
1
2
|
$ tsup
|
|
2
3
|
[34mCLI[39m Building entry: src/index.ts
|
|
3
4
|
[34mCLI[39m Using tsconfig: tsconfig.build.json
|
|
@@ -7,9 +8,9 @@ $ tsup
|
|
|
7
8
|
[34mCLI[39m Cleaning output folder
|
|
8
9
|
[34mCJS[39m Build start
|
|
9
10
|
[34mESM[39m Build start
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m50.17 KB[39m
|
|
12
|
+
[32mCJS[39m [1mdist/index.cjs.map [22m[32m97.10 KB[39m
|
|
13
|
+
[32mCJS[39m ⚡️ Build success in 67ms
|
|
14
|
+
[32mESM[39m [1mdist/index.js [22m[32m46.25 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m97.16 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 74ms
|
package/CHANGELOG.md
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
# @zoralabs/protocol-sdk
|
|
2
2
|
|
|
3
|
-
## 0.5.4
|
|
3
|
+
## 0.5.4
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
- Updated dependencies [a4d2d3d2]
|
|
9
|
-
- Updated dependencies [3401be26]
|
|
10
|
-
- @zoralabs/protocol-deployments@0.1.1-MINT.0
|
|
7
|
+
- 9710e5e: Defining exports in protocol-sdk
|
|
11
8
|
|
|
12
9
|
## 0.5.3
|
|
13
10
|
|
|
@@ -9,6 +9,5 @@ export type NetworkConfig = {
|
|
|
9
9
|
};
|
|
10
10
|
export declare const REWARD_PER_TOKEN: bigint;
|
|
11
11
|
export declare const networkConfigByChain: Record<number, NetworkConfig>;
|
|
12
|
-
export declare const getSubgraphUrl: (chainId: number) => string;
|
|
13
12
|
export {};
|
|
14
13
|
//# sourceMappingURL=chain-constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-constants.d.ts","sourceRoot":"","sources":["../../src/apis/chain-constants.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAIhE,KAAK,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,gBAAgB,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAuE9D,CAAC
|
|
1
|
+
{"version":3,"file":"chain-constants.d.ts","sourceRoot":"","sources":["../../src/apis/chain-constants.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAIhE,KAAK,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,CAAC;AAE3D,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,wBAAwB,EAAE,MAAM,CAAC;IACjC,oBAAoB,EAAE,gBAAgB,CAAC;IACvC,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AAEvD,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAuE9D,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -41,9 +41,7 @@ __export(src_exports, {
|
|
|
41
41
|
encodePremintForAPI: () => encodePremintForAPI,
|
|
42
42
|
getApiNetworkConfigForChain: () => getApiNetworkConfigForChain,
|
|
43
43
|
getDefaultFixedPriceMinterAddress: () => getDefaultFixedPriceMinterAddress,
|
|
44
|
-
getMINTsToCollectWith: () => getMINTsToCollectWith,
|
|
45
44
|
getMintCosts: () => getMintCosts,
|
|
46
|
-
getMintsAccountBalanceQuery: () => getMintsAccountBalanceQuery,
|
|
47
45
|
getPremintCollectionAddress: () => getPremintCollectionAddress,
|
|
48
46
|
getPremintExecutorAddress: () => getPremintExecutorAddress,
|
|
49
47
|
getPremintMintCosts: () => getPremintMintCosts,
|
|
@@ -59,7 +57,6 @@ __export(src_exports, {
|
|
|
59
57
|
premintTypedDataDefinition: () => premintTypedDataDefinition,
|
|
60
58
|
recoverCreatorFromCreatorAttribution: () => recoverCreatorFromCreatorAttribution,
|
|
61
59
|
recoverPremintSigner: () => recoverPremintSigner,
|
|
62
|
-
selectMintsToCollectWithFromQueryResult: () => selectMintsToCollectWithFromQueryResult,
|
|
63
60
|
supportedPremintVersions: () => supportedPremintVersions,
|
|
64
61
|
supportsPremintVersion: () => supportsPremintVersion,
|
|
65
62
|
tryRecoverPremintSigner: () => tryRecoverPremintSigner,
|
|
@@ -548,13 +545,6 @@ var networkConfigByChain = {
|
|
|
548
545
|
subgraphUrl: getSubgraph("zora-create-zora-testnet", "stable")
|
|
549
546
|
}
|
|
550
547
|
};
|
|
551
|
-
var getSubgraphUrl = (chainId) => {
|
|
552
|
-
const networkConfig = networkConfigByChain[chainId];
|
|
553
|
-
if (!networkConfig) {
|
|
554
|
-
throw new Error(`Network not configured for chain id ${chainId}`);
|
|
555
|
-
}
|
|
556
|
-
return networkConfig.subgraphUrl;
|
|
557
|
-
};
|
|
558
548
|
|
|
559
549
|
// src/mint/mint-api-client.ts
|
|
560
550
|
var getApiNetworkConfigForChain = (chainId) => {
|
|
@@ -1613,7 +1603,7 @@ function create1155CreatorClient({
|
|
|
1613
1603
|
throw new Error("Invariant: contract cannot be missing and an address");
|
|
1614
1604
|
}
|
|
1615
1605
|
if (!contractExists && typeof contract !== "string") {
|
|
1616
|
-
const
|
|
1606
|
+
const request = {
|
|
1617
1607
|
abi: import_protocol_deployments4.zoraCreator1155FactoryImplABI,
|
|
1618
1608
|
functionName: "createContractDeterministic",
|
|
1619
1609
|
account,
|
|
@@ -1632,13 +1622,13 @@ function create1155CreatorClient({
|
|
|
1632
1622
|
]
|
|
1633
1623
|
};
|
|
1634
1624
|
return {
|
|
1635
|
-
request
|
|
1625
|
+
request,
|
|
1636
1626
|
tokenSetupActions,
|
|
1637
1627
|
contractAddress,
|
|
1638
1628
|
contractExists
|
|
1639
1629
|
};
|
|
1640
1630
|
} else if (contractExists) {
|
|
1641
|
-
const
|
|
1631
|
+
const request = {
|
|
1642
1632
|
abi: import_protocol_deployments4.zoraCreator1155ImplABI,
|
|
1643
1633
|
functionName: "multicall",
|
|
1644
1634
|
account,
|
|
@@ -1646,7 +1636,7 @@ function create1155CreatorClient({
|
|
|
1646
1636
|
args: [tokenSetupActions]
|
|
1647
1637
|
};
|
|
1648
1638
|
return {
|
|
1649
|
-
request
|
|
1639
|
+
request,
|
|
1650
1640
|
tokenSetupActions,
|
|
1651
1641
|
contractAddress,
|
|
1652
1642
|
contractExists
|
|
@@ -1656,75 +1646,6 @@ function create1155CreatorClient({
|
|
|
1656
1646
|
}
|
|
1657
1647
|
return { createNew1155Token };
|
|
1658
1648
|
}
|
|
1659
|
-
|
|
1660
|
-
// src/mints/mints-queries.ts
|
|
1661
|
-
var import_graphql_request = require("graphql-request");
|
|
1662
|
-
var getMintsAccountBalanceQuery = (account) => {
|
|
1663
|
-
const query = import_graphql_request.gql`
|
|
1664
|
-
query GetMintAccountBalances($account: String!) {
|
|
1665
|
-
mintTokenBalances(where: { account: $account }) {
|
|
1666
|
-
balance
|
|
1667
|
-
mintToken {
|
|
1668
|
-
id
|
|
1669
|
-
pricePerToken
|
|
1670
|
-
}
|
|
1671
|
-
}
|
|
1672
|
-
}
|
|
1673
|
-
`;
|
|
1674
|
-
return {
|
|
1675
|
-
query,
|
|
1676
|
-
variables: { account }
|
|
1677
|
-
};
|
|
1678
|
-
};
|
|
1679
|
-
var selectMintsToCollectWithFromQueryResult = (mintAccountBalances, quantityToCollect) => {
|
|
1680
|
-
const parsed = mintAccountBalances.map((r) => {
|
|
1681
|
-
return {
|
|
1682
|
-
tokenId: BigInt(r.mintToken.id),
|
|
1683
|
-
quantity: BigInt(r.balance),
|
|
1684
|
-
pricePerToken: BigInt(r.mintToken.pricePerToken)
|
|
1685
|
-
};
|
|
1686
|
-
});
|
|
1687
|
-
const sorted = parsed.sort((a, b) => {
|
|
1688
|
-
if (a.pricePerToken < b.pricePerToken) {
|
|
1689
|
-
return -1;
|
|
1690
|
-
}
|
|
1691
|
-
return 1;
|
|
1692
|
-
});
|
|
1693
|
-
let remainingQuantity = quantityToCollect;
|
|
1694
|
-
const tokenIds = [];
|
|
1695
|
-
const quantities = [];
|
|
1696
|
-
while (remainingQuantity > 0) {
|
|
1697
|
-
const next = sorted.shift();
|
|
1698
|
-
if (!next) {
|
|
1699
|
-
throw new Error("Not enough MINTs to collect with");
|
|
1700
|
-
}
|
|
1701
|
-
const quantityToUse = remainingQuantity > next.quantity ? next.quantity : remainingQuantity;
|
|
1702
|
-
tokenIds.push(next.tokenId);
|
|
1703
|
-
quantities.push(quantityToUse);
|
|
1704
|
-
remainingQuantity -= quantityToUse;
|
|
1705
|
-
}
|
|
1706
|
-
return {
|
|
1707
|
-
tokenIds,
|
|
1708
|
-
quantities
|
|
1709
|
-
};
|
|
1710
|
-
};
|
|
1711
|
-
var getMINTsToCollectWith = async ({
|
|
1712
|
-
account,
|
|
1713
|
-
chainId,
|
|
1714
|
-
quantityToCollect
|
|
1715
|
-
}) => {
|
|
1716
|
-
const subgraphUrl = getSubgraphUrl(chainId);
|
|
1717
|
-
const { query, variables } = getMintsAccountBalanceQuery(account);
|
|
1718
|
-
const result = await (0, import_graphql_request.request)(
|
|
1719
|
-
subgraphUrl,
|
|
1720
|
-
query,
|
|
1721
|
-
variables
|
|
1722
|
-
);
|
|
1723
|
-
return selectMintsToCollectWithFromQueryResult(
|
|
1724
|
-
result.mintTokenBalances,
|
|
1725
|
-
quantityToCollect
|
|
1726
|
-
);
|
|
1727
|
-
};
|
|
1728
1649
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1729
1650
|
0 && (module.exports = {
|
|
1730
1651
|
DEFAULT_SALE_SETTINGS,
|
|
@@ -1748,9 +1669,7 @@ var getMINTsToCollectWith = async ({
|
|
|
1748
1669
|
encodePremintForAPI,
|
|
1749
1670
|
getApiNetworkConfigForChain,
|
|
1750
1671
|
getDefaultFixedPriceMinterAddress,
|
|
1751
|
-
getMINTsToCollectWith,
|
|
1752
1672
|
getMintCosts,
|
|
1753
|
-
getMintsAccountBalanceQuery,
|
|
1754
1673
|
getPremintCollectionAddress,
|
|
1755
1674
|
getPremintExecutorAddress,
|
|
1756
1675
|
getPremintMintCosts,
|
|
@@ -1766,7 +1685,6 @@ var getMINTsToCollectWith = async ({
|
|
|
1766
1685
|
premintTypedDataDefinition,
|
|
1767
1686
|
recoverCreatorFromCreatorAttribution,
|
|
1768
1687
|
recoverPremintSigner,
|
|
1769
|
-
selectMintsToCollectWithFromQueryResult,
|
|
1770
1688
|
supportedPremintVersions,
|
|
1771
1689
|
supportsPremintVersion,
|
|
1772
1690
|
tryRecoverPremintSigner,
|