Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7016019f2a | ||
|
|
4e7b293c54 | ||
|
|
c9c0e4ff39 |
+2
-1
@@ -16,4 +16,5 @@ public/dist
|
||||
.yalc/
|
||||
yalc.lock
|
||||
build/
|
||||
playwright-report/
|
||||
playwright-report/
|
||||
.vscode/
|
||||
+3
-3
@@ -15,8 +15,8 @@
|
||||
"scripts": {
|
||||
"test": "turbo run test test:evm test:solana",
|
||||
"e2e": "turbo run e2e",
|
||||
"build": "turbo run build",
|
||||
"build:release": "turbo run build --force",
|
||||
"build": "turbo run build --filter=./packages/*",
|
||||
"build:release": "turbo run build --force --filter=./packages/*",
|
||||
"dev": "turbo run dev --no-cache --parallel --continue",
|
||||
"fix:repo": "manypkg fix",
|
||||
"lint": "turbo run lint",
|
||||
@@ -28,7 +28,7 @@
|
||||
"release": "node ./scripts/pre-release.mjs && changeset publish",
|
||||
"version-packages:nightly": "changeset version --snapshot nightly",
|
||||
"release:nightly": "node ./scripts/pre-release.mjs && changeset publish --tag nightly",
|
||||
"push": "turbo run push"
|
||||
"push": "turbo run push --filter=./packages/*"
|
||||
},
|
||||
"packageManager": "[email protected]",
|
||||
"dependencies": {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 2.0.28
|
||||
|
||||
## 2.0.27
|
||||
|
||||
## 2.0.26
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "2.0.27",
|
||||
"version": "2.0.28",
|
||||
"exports": {
|
||||
"./next": {
|
||||
"module": "./next/dist/thirdweb-dev-auth-next.esm.js",
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.8.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`4e7b293`](https://github.com/thirdweb-dev/js/commit/4e7b293c543244de79c150ca8c37d941221fc9a3), [`c9c0e4f`](https://github.com/thirdweb-dev/js/commit/c9c0e4ff39b054af746f3aec75fcbd0a3ef7239d)]:
|
||||
- @thirdweb-dev/sdk@3.5.1
|
||||
|
||||
## 0.8.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.8.13",
|
||||
"version": "0.8.14",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 3.5.1
|
||||
|
||||
## 3.5.0
|
||||
|
||||
## 3.4.5
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "3.5.0",
|
||||
"version": "3.5.1",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -4,7 +4,8 @@ import {
|
||||
RequiredParam,
|
||||
} from "../../../core/query-utils/required-param";
|
||||
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
||||
import type { Amount, Token } from "@thirdweb-dev/sdk/solana";
|
||||
import type { Amount } from "@thirdweb-dev/sdk";
|
||||
import type { Token } from "@thirdweb-dev/sdk/solana";
|
||||
|
||||
export type TransferTokenMutationParams = {
|
||||
amount: Amount;
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 3.5.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#368](https://github.com/thirdweb-dev/js/pull/368) [`4e7b293`](https://github.com/thirdweb-dev/js/commit/4e7b293c543244de79c150ca8c37d941221fc9a3) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix handling of old allowlist proof format
|
||||
|
||||
- [#365](https://github.com/thirdweb-dev/js/pull/365) [`c9c0e4f`](https://github.com/thirdweb-dev/js/commit/c9c0e4ff39b054af746f3aec75fcbd0a3ef7239d) Thanks [@jnsdls](https://github.com/jnsdls)! - [EVM] - now React Native compatible
|
||||
|
||||
## 3.5.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "3.5.0",
|
||||
"version": "3.5.1",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
@@ -108,7 +108,6 @@
|
||||
"@thirdweb-dev/storage": "*",
|
||||
"bn.js": "^5.2.1",
|
||||
"bs58": "^5.0.0",
|
||||
"cbor-x": "^1.4.1",
|
||||
"cross-fetch": "^3.1.5",
|
||||
"eventemitter3": "^4.0.7",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
|
||||
@@ -2,8 +2,14 @@ import BN from "bn.js";
|
||||
import { BigNumber } from "ethers";
|
||||
import { z } from "zod";
|
||||
|
||||
const isBrowser = () => typeof window !== "undefined";
|
||||
const FileOrBufferUnionSchema = isBrowser()
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const isBrowser = () => typeof window !== "undefined";
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferUnionSchema = isBrowser()
|
||||
? (z.instanceof(File) as z.ZodType<InstanceType<typeof File>>)
|
||||
: (z.instanceof(Buffer) as z.ZodTypeAny); // @fixme, this is a hack to make browser happy for now
|
||||
|
||||
@@ -96,6 +102,11 @@ export const AmountSchema = z
|
||||
])
|
||||
.transform((arg) => (typeof arg === "number" ? arg.toString() : arg));
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type Amount = z.input<typeof AmountSchema>;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -92,14 +92,16 @@ export async function prepareClaim(
|
||||
tokenDecimals,
|
||||
);
|
||||
priceInProof =
|
||||
snapshotEntry.price === undefined ||
|
||||
snapshotEntry.price === "unlimited"
|
||||
? ethers.constants.MaxUint256
|
||||
: await normalizePriceValue(
|
||||
contractWrapper.getProvider(),
|
||||
snapshotEntry.price,
|
||||
snapshotEntry.currencyAddress,
|
||||
snapshotEntry.currencyAddress || ethers.constants.AddressZero,
|
||||
);
|
||||
currencyAddressInProof = snapshotEntry.currencyAddress;
|
||||
currencyAddressInProof =
|
||||
snapshotEntry.currencyAddress || ethers.constants.AddressZero;
|
||||
} else {
|
||||
// if no snapshot entry, and it's a v1 format (exclusive allowlist) then address can't claim
|
||||
if (snapshotFormatVersion === SnapshotFormatVersion.V1) {
|
||||
@@ -323,9 +325,13 @@ export async function getClaimerProofs(
|
||||
return undefined;
|
||||
}
|
||||
const price =
|
||||
claim.price === "unlimited"
|
||||
claim.price === "unlimited" || claim.price === undefined
|
||||
? ethers.constants.MaxUint256
|
||||
: await normalizePriceValue(provider, claim.price, claim.currencyAddress);
|
||||
: await normalizePriceValue(
|
||||
provider,
|
||||
claim.price,
|
||||
claim.currencyAddress || ethers.constants.AddressZero,
|
||||
);
|
||||
const maxClaimable =
|
||||
claim.maxClaimable === "unlimited"
|
||||
? ethers.constants.MaxUint256
|
||||
@@ -334,7 +340,7 @@ export async function getClaimerProofs(
|
||||
proof: claim.proof,
|
||||
maxClaimable,
|
||||
price,
|
||||
currencyAddress: claim.currencyAddress,
|
||||
currencyAddress: claim.currencyAddress || ethers.constants.AddressZero,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { AmountSchema } from "../../core/schema/shared";
|
||||
import {
|
||||
getNativeTokenByChainId,
|
||||
NATIVE_TOKEN_ADDRESS,
|
||||
} from "../constants/currency";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { AmountSchema } from "../schema/shared";
|
||||
import { Amount, Currency, CurrencyValue, Price } from "../types/currency";
|
||||
import { BaseERC20 } from "../types/eips";
|
||||
import type { IERC20, IERC20Metadata } from "@thirdweb-dev/contracts-js";
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
} from "../constants/contract-features";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { DetectableFeature } from "../core/interfaces/DetectableFeature";
|
||||
import { decode } from "../lib/cbor-decode.js";
|
||||
import {
|
||||
AbiEvent,
|
||||
AbiFunction,
|
||||
@@ -23,7 +24,6 @@ import {
|
||||
import { ExtensionNotImplementedError } from "./error";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import bs58 from "bs58";
|
||||
import { decode } from "cbor-x";
|
||||
import { BaseContract, BigNumber, ethers } from "ethers";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { MAX_BPS } from "../../core/schema/shared";
|
||||
import {
|
||||
InterfaceId_IERC1155,
|
||||
InterfaceId_IERC721,
|
||||
} from "../constants/contract";
|
||||
import { SignerOrProvider } from "../core";
|
||||
import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { MAX_BPS } from "../schema/shared";
|
||||
import {
|
||||
NewAuctionListing,
|
||||
NewDirectListing,
|
||||
|
||||
@@ -101,8 +101,11 @@ export class ShardedMerkleTree {
|
||||
[
|
||||
entry.address,
|
||||
convertQuantityToBigNumber(entry.maxClaimable, tokenDecimals),
|
||||
convertQuantityToBigNumber(entry.price, currencyDecimals),
|
||||
entry.currencyAddress,
|
||||
convertQuantityToBigNumber(
|
||||
entry.price || "unlimited",
|
||||
currencyDecimals,
|
||||
),
|
||||
entry.currencyAddress || ethers.constants.AddressZero,
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -111,11 +114,14 @@ export class ShardedMerkleTree {
|
||||
static async fetchAndCacheDecimals(
|
||||
cache: Record<string, number>,
|
||||
provider: ethers.providers.Provider,
|
||||
currencyAddress: string,
|
||||
currencyAddress?: string,
|
||||
): Promise<number> {
|
||||
if (!currencyAddress) {
|
||||
return 18;
|
||||
}
|
||||
// cache decimals for each currency to avoid refetching for every address
|
||||
let currencyDecimals = cache[currencyAddress];
|
||||
if (!currencyDecimals) {
|
||||
if (currencyDecimals === undefined) {
|
||||
const currencyMetadata = await fetchCurrencyMetadata(
|
||||
provider,
|
||||
currencyAddress,
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
TransactionResult,
|
||||
TransactionResultWithId,
|
||||
} from "../../core/types";
|
||||
import { PaperCheckout } from "../../integrations/checkout";
|
||||
import { PaperCheckout } from "../../integrations/thirdweb-checkout";
|
||||
import { DropErc1155ContractSchema } from "../../schema/contracts/drop-erc1155";
|
||||
import { SDKOptions } from "../../schema/sdk-options";
|
||||
import { PrebuiltEditionDrop } from "../../types/eips";
|
||||
|
||||
@@ -26,7 +26,7 @@ import {
|
||||
TransactionResult,
|
||||
TransactionResultWithId,
|
||||
} from "../../core/types";
|
||||
import { PaperCheckout } from "../../integrations/checkout";
|
||||
import { PaperCheckout } from "../../integrations/thirdweb-checkout";
|
||||
import { DropErc721ContractSchema } from "../../schema/contracts/drop-erc721";
|
||||
import { SDKOptions } from "../../schema/sdk-options";
|
||||
import { PrebuiltNFTDrop } from "../../types/eips";
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
TransactionResult,
|
||||
TransactionResultWithId,
|
||||
} from "../../core/types";
|
||||
import { PaperCheckout } from "../../integrations/checkout";
|
||||
import { PaperCheckout } from "../../integrations/thirdweb-checkout";
|
||||
import { DropErc721ContractSchema } from "../../schema/contracts/drop-erc721";
|
||||
import { SDKOptions } from "../../schema/sdk-options";
|
||||
import { ClaimOptions, UploadProgressEvent } from "../../types";
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { AmountSchema } from "../../../core/schema/shared";
|
||||
import { includesErrorMessage } from "../../common";
|
||||
import {
|
||||
abstractContractModelToLegacy,
|
||||
@@ -22,7 +23,6 @@ import { isNode } from "../../common/utils";
|
||||
import { ClaimEligibility } from "../../enums";
|
||||
import {
|
||||
AbstractClaimConditionContractStruct,
|
||||
AmountSchema,
|
||||
SnapshotEntryWithProof,
|
||||
} from "../../schema";
|
||||
import {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { NetworkOrSignerOrProvider, TransactionResult } from "..";
|
||||
import { AmountSchema } from "../../../core/schema/shared";
|
||||
import { assertEnabled, detectContractFeature } from "../../common";
|
||||
import {
|
||||
fetchCurrencyMetadata,
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
FEATURE_TOKEN_SIGNATURE_MINTABLE,
|
||||
FEATURE_TOKEN_CLAIMABLE_WITH_CONDITIONS,
|
||||
} from "../../constants/erc20-features";
|
||||
import { TokenMintInput, AmountSchema } from "../../schema";
|
||||
import { TokenMintInput } from "../../schema";
|
||||
import { Currency, CurrencyValue, Amount, ClaimOptions } from "../../types";
|
||||
import {
|
||||
BaseERC20,
|
||||
|
||||
@@ -29,7 +29,7 @@ export * from "./constants";
|
||||
export * from "./contracts";
|
||||
|
||||
// export integration things
|
||||
export * from "./integrations/checkout";
|
||||
export * from "./integrations/thirdweb-checkout";
|
||||
|
||||
// explcitly export the *TYPES* of prebuilt contracts
|
||||
export type { Edition } from "./contracts/prebuilt-implementations/edition";
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ import { ContractWrapper } from "../core/classes/contract-wrapper";
|
||||
import { SignedPayload721WithQuantitySignature } from "../schema/contracts/common/signature";
|
||||
import { PrebuiltEditionDrop, PrebuiltNFTDrop } from "../types/eips";
|
||||
import { SignatureDrop } from "@thirdweb-dev/contracts-js/dist/declarations/src/SignatureDrop";
|
||||
import fetch from "cross-fetch";
|
||||
// import fetch from "cross-fetch";
|
||||
import invariant from "tiny-invariant";
|
||||
|
||||
const PAPER_API_BASE = `https://paper.xyz/api` as const;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,5 @@
|
||||
import { AddressSchema, AmountSchema } from "../../shared";
|
||||
import { AmountSchema } from "../../../../core/schema/shared";
|
||||
import { AddressSchema } from "../../shared";
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import { QuantitySchema } from "../../../../core/schema/shared";
|
||||
import {
|
||||
AmountSchema,
|
||||
BytesLikeSchema,
|
||||
QuantitySchema,
|
||||
} from "../../../../core/schema/shared";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../../../constants/currency";
|
||||
import {
|
||||
BigNumberishSchema,
|
||||
BigNumberSchema,
|
||||
BytesLikeSchema,
|
||||
AmountSchema,
|
||||
StartDateSchema,
|
||||
} from "../../shared";
|
||||
import { CurrencyValueSchema } from "./currency";
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
AddressSchema,
|
||||
BasisPointsSchema,
|
||||
FileOrBufferOrStringSchema,
|
||||
} from "../../shared";
|
||||
} from "../../../../core/schema/shared";
|
||||
import { AddressSchema } from "../../shared";
|
||||
import { constants } from "ethers";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import { NFTInputOrUriSchema } from "../../../../core/schema/nft";
|
||||
import {
|
||||
AmountSchema,
|
||||
BasisPointsSchema,
|
||||
} from "../../../../core/schema/shared";
|
||||
import { resolveOrGenerateId } from "../../../common/signature-minting";
|
||||
import { NATIVE_TOKEN_ADDRESS } from "../../../constants/currency";
|
||||
import {
|
||||
BasisPointsSchema,
|
||||
BigNumberishSchema,
|
||||
BigNumberSchema,
|
||||
EndDateSchema,
|
||||
AmountSchema,
|
||||
StartDateSchema,
|
||||
} from "../../shared";
|
||||
import { constants } from "ethers";
|
||||
|
||||
@@ -13,8 +13,10 @@ export const MerkleSchema = z.object({
|
||||
export const SnapshotEntryInput = z.object({
|
||||
address: AddressSchema,
|
||||
maxClaimable: QuantitySchema.default(0), // defaults to 0
|
||||
price: QuantitySchema, // defaults to unlimited
|
||||
currencyAddress: AddressSchema.default(ethers.constants.AddressZero),
|
||||
price: QuantitySchema.optional(), // defaults to unlimited, but can be undefined in old snapshots
|
||||
currencyAddress: AddressSchema.default(
|
||||
ethers.constants.AddressZero,
|
||||
).optional(), // defaults to AddressZero, but can be undefined for old snapshots
|
||||
});
|
||||
|
||||
export type SnapshotEntry = z.output<typeof SnapshotEntryInput>;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { FileOrBufferOrStringSchema } from "../../../core/schema/shared";
|
||||
import { toSemver } from "../../common/index";
|
||||
import {
|
||||
AddressSchema,
|
||||
BigNumberishSchema,
|
||||
BigNumberTransformSchema,
|
||||
FileOrBufferOrStringSchema,
|
||||
} from "../shared";
|
||||
import {
|
||||
CommonContractOutputSchema,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AddressSchema, BasisPointsSchema } from "../shared";
|
||||
import { BasisPointsSchema } from "../../../core/schema/shared";
|
||||
import { AddressSchema } from "../shared";
|
||||
import {
|
||||
CommonContractOutputSchema,
|
||||
CommonContractSchema,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { BasisPointsSchema, BigNumberSchema } from "../shared";
|
||||
import { BasisPointsSchema } from "../../../core/schema/shared";
|
||||
import { BigNumberSchema } from "../shared";
|
||||
import { BaseSignaturePayloadInput } from "./common";
|
||||
import { constants } from "ethers";
|
||||
import { z } from "zod";
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import {
|
||||
AddressSchema,
|
||||
BigNumberishSchema,
|
||||
BigNumberSchema,
|
||||
PercentSchema,
|
||||
} from "../shared";
|
||||
import { PercentSchema } from "../../../core/schema/shared";
|
||||
import { AddressSchema, BigNumberishSchema, BigNumberSchema } from "../shared";
|
||||
import {
|
||||
CommonContractOutputSchema,
|
||||
CommonContractSchema,
|
||||
|
||||
@@ -1,34 +1,6 @@
|
||||
import { BigNumber, CallOverrides, utils } from "ethers";
|
||||
import { z } from "zod";
|
||||
|
||||
const isBrowser = () => typeof window !== "undefined";
|
||||
const FileOrBufferUnionSchema = isBrowser()
|
||||
? (z.instanceof(File) as z.ZodType<InstanceType<typeof File>>)
|
||||
: (z.instanceof(Buffer) as z.ZodTypeAny); // @fixme, this is a hack to make browser happy for now
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferSchema = z.union([
|
||||
FileOrBufferUnionSchema,
|
||||
z.object({
|
||||
data: z.union([FileOrBufferUnionSchema, z.string()]),
|
||||
name: z.string(),
|
||||
}),
|
||||
]);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferOrStringSchema = z.union([
|
||||
FileOrBufferSchema,
|
||||
z.string(),
|
||||
]);
|
||||
|
||||
export const MAX_BPS = 10000;
|
||||
|
||||
export const BytesLikeSchema = z.union([z.array(z.number()), z.string()]);
|
||||
|
||||
export const BigNumberSchema = z
|
||||
.union([
|
||||
z.string(),
|
||||
@@ -55,16 +27,6 @@ export const BigNumberTransformSchema = z
|
||||
return BigNumber.from(arg).toString();
|
||||
});
|
||||
|
||||
export const BasisPointsSchema = z
|
||||
.number()
|
||||
.max(MAX_BPS, "Cannot exceed 100%")
|
||||
.min(0, "Cannot be below 0%");
|
||||
|
||||
export const PercentSchema = z
|
||||
.number()
|
||||
.max(100, "Cannot exceed 100%")
|
||||
.min(0, "Cannot be below 0%");
|
||||
|
||||
export const AddressSchema = z.string().refine(
|
||||
(arg) => utils.isAddress(arg),
|
||||
(out) => {
|
||||
@@ -74,13 +36,6 @@ export const AddressSchema = z.string().refine(
|
||||
},
|
||||
);
|
||||
|
||||
export const AmountSchema = z
|
||||
.union([
|
||||
z.string().regex(/^([0-9]+\.?[0-9]*|\.[0-9]+)$/, "Invalid amount"),
|
||||
z.number().min(0, "Amount cannot be negative"),
|
||||
])
|
||||
.transform((arg) => (typeof arg === "number" ? arg.toString() : arg));
|
||||
|
||||
export const RawDateSchema = z.date().transform((i) => {
|
||||
return BigNumber.from(Math.floor(i.getTime() / 1000));
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AddressSchema, BigNumberishSchema, AmountSchema } from "../../shared";
|
||||
import { AmountSchema } from "../../../../core/schema/shared";
|
||||
import { AddressSchema, BigNumberishSchema } from "../../shared";
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { NFTInputOrUriSchema } from "../../../core/schema/nft";
|
||||
import { BigNumberishSchema, AmountSchema, RawDateSchema } from "../shared";
|
||||
import { AmountSchema } from "../../../core/schema/shared";
|
||||
import { BigNumberishSchema, RawDateSchema } from "../shared";
|
||||
import {
|
||||
ERC1155WrappableSchema,
|
||||
ERC20WrappableSchema,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AddressSchema, AmountSchema } from "../shared";
|
||||
import { AmountSchema } from "../../../core/schema/shared";
|
||||
import { AddressSchema } from "../shared";
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
* Currency metadata.
|
||||
* @public
|
||||
*/
|
||||
import { AmountSchema } from "../../core/schema/shared";
|
||||
import {
|
||||
CurrencySchema,
|
||||
CurrencyValueSchema,
|
||||
} from "../schema/contracts/common/currency";
|
||||
import { AmountSchema } from "../schema/shared";
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { QueryAllParams } from "../../core/schema/QueryParams";
|
||||
import { NFT, NFTMetadata, NFTMetadataOrUri } from "../../core/schema/nft";
|
||||
import { Amount } from "../../core/schema/shared";
|
||||
import {
|
||||
enforceCreator,
|
||||
parseCreators,
|
||||
} from "../classes/helpers/creators-helper";
|
||||
import { NFTHelper } from "../classes/helpers/nft-helper";
|
||||
import { Amount, TransactionResult } from "../types/common";
|
||||
import { TransactionResult } from "../types/common";
|
||||
import { CreatorInput, CreatorOutput } from "../types/programs";
|
||||
import { sendMultipartTransaction } from "../utils/transactions";
|
||||
import { getNework } from "../utils/urls";
|
||||
|
||||
@@ -4,13 +4,14 @@ import {
|
||||
NFTMetadata,
|
||||
NFTMetadataInput,
|
||||
} from "../../core/schema/nft";
|
||||
import { Amount } from "../../core/schema/shared";
|
||||
import { ClaimConditions } from "../classes/claim-conditions";
|
||||
import {
|
||||
enforceCreator,
|
||||
parseCreators,
|
||||
} from "../classes/helpers/creators-helper";
|
||||
import { NFTHelper } from "../classes/helpers/nft-helper";
|
||||
import { Amount, TransactionResult } from "../types/common";
|
||||
import { TransactionResult } from "../types/common";
|
||||
import { CreatorInput, CreatorOutput } from "../types/programs";
|
||||
import { sendMultipartTransaction } from "../utils/transactions";
|
||||
import { getNework } from "../utils/urls";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Amount, AmountSchema } from "../../core/schema/shared";
|
||||
import { CurrencyValue, TokenMetadata } from "../../core/schema/token";
|
||||
import { Amount, AmountSchema, TransactionResult } from "../types/common";
|
||||
import { TransactionResult } from "../types/common";
|
||||
import { toCurrencyValue } from "../utils/token";
|
||||
import { getNework } from "../utils/urls";
|
||||
import {
|
||||
|
||||
@@ -2,52 +2,6 @@ import { Signer, WalletAdapter } from "@metaplex-foundation/js";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const MAX_BPS = 10000;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const BasisPointsSchema = z
|
||||
.number()
|
||||
.max(MAX_BPS, "Cannot exceed 100%")
|
||||
.min(0, "Cannot be below 0%");
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const PercentSchema = z
|
||||
.number()
|
||||
.max(100, "Cannot exceed 100%")
|
||||
.min(0, "Cannot be below 0%");
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const JsonLiteral = z.union([
|
||||
z.string(),
|
||||
z.number(),
|
||||
z.boolean(),
|
||||
z.null(),
|
||||
]);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type JsonLiteral = number | string | null | boolean;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type Json = JsonLiteral | JsonObject | Json[];
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type JsonObject = { [key: string]: Json };
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@@ -60,16 +14,6 @@ export const OptionalPropertiesInput = z
|
||||
.union([z.array(PropertiesInput), PropertiesInput])
|
||||
.optional();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const AmountSchema = z
|
||||
.union([
|
||||
z.string().regex(/^([0-9]+\.?[0-9]*|\.[0-9]+)$/, "Invalid amount"),
|
||||
z.number().min(0, "Amount cannot be negative"),
|
||||
])
|
||||
.transform((arg) => (typeof arg === "number" ? arg.toString() : arg));
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@@ -77,11 +21,6 @@ export const RawDateSchema = z.date().transform((i) => {
|
||||
return Math.floor(i.getTime() / 1000);
|
||||
});
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type Amount = z.input<typeof AmountSchema>;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
@@ -115,27 +54,3 @@ export const AddressSchema = z.union([
|
||||
z.string(),
|
||||
z.instanceof(PublicKey).transform((key) => key.toBase58()),
|
||||
]);
|
||||
|
||||
const isBrowser = () => typeof window !== "undefined";
|
||||
const FileOrBufferUnionSchema = isBrowser()
|
||||
? (z.instanceof(File) as z.ZodType<InstanceType<typeof File>>)
|
||||
: (z.instanceof(Buffer) as z.ZodTypeAny); // @fixme, this is a hack to make browser happy for now
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferSchema = z.union([
|
||||
FileOrBufferUnionSchema,
|
||||
z.object({
|
||||
data: z.union([FileOrBufferUnionSchema, z.string()]),
|
||||
name: z.string(),
|
||||
}),
|
||||
]);
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export const FileOrBufferOrStringSchema = z.union([
|
||||
FileOrBufferSchema,
|
||||
z.string(),
|
||||
]);
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { AmountSchema, FileOrBufferOrStringSchema, PercentSchema } from "../common";
|
||||
import {
|
||||
AmountSchema,
|
||||
FileOrBufferOrStringSchema,
|
||||
PercentSchema,
|
||||
} from "../../../core/schema/shared";
|
||||
import { Creator } from "@metaplex-foundation/js";
|
||||
import { z } from "zod";
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { NFTCollectionMetadataInputSchema } from ".";
|
||||
import { BasisPointsSchema, QuantitySchema } from "../../../core/schema/shared";
|
||||
import {
|
||||
AmountSchema,
|
||||
BasisPointsSchema,
|
||||
QuantitySchema,
|
||||
} from "../../../core/schema/shared";
|
||||
import { CurrencyValueSchema } from "../../../core/schema/token";
|
||||
import { AmountSchema } from "../common";
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"extends": "@thirdweb-dev/tsconfig/sdk.json",
|
||||
"include": ["src", "types"],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
"exclude": ["dist", "build", "node_modules"],
|
||||
"compilerOptions": {
|
||||
"allowJs": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1475,36 +1475,6 @@
|
||||
near-api-js "^0.44.2"
|
||||
near-seed-phrase "^0.2.0"
|
||||
|
||||
"@cbor-extract/[email protected]":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-darwin-arm64/-/cbor-extract-darwin-arm64-2.0.0.tgz#cf0667e4c22111c9d45e16c29964892b12460a76"
|
||||
integrity sha512-jebtLrruvsBbGMsUn0QxZW/8Z7caS9OkszVKZ64WTWajUkyohmolUdKL2nbfaTyyi3ABJrxVNM4YO1pvMsNI1g==
|
||||
|
||||
"@cbor-extract/[email protected]":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-darwin-x64/-/cbor-extract-darwin-x64-2.0.0.tgz#7bc01e7911b97eee4c78ae074bd3108f2ff208c3"
|
||||
integrity sha512-LGYjdlyqANBqCDzBujCqXpPcK70rvaQgw98/aquzBuEmK0KXS7i579CoVG1yS/eb3bMqiVPevBri45jbR6Tlsg==
|
||||
|
||||
"@cbor-extract/[email protected]":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-linux-arm64/-/cbor-extract-linux-arm64-2.0.0.tgz#e40608afed5f373091560fa9dcd19c7f52f510b0"
|
||||
integrity sha512-c1rbQcSF01yVgbG60zEfHNsUkXiEEQRNdYqm5qpqEAkLx4gA6DDU91IQbalkqXfwDuQzcMovOc1TC3uJJIi2OQ==
|
||||
|
||||
"@cbor-extract/[email protected]":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-linux-arm/-/cbor-extract-linux-arm-2.0.0.tgz#f52a7580fb23e305370e66ae9ff136de3729c4b8"
|
||||
integrity sha512-cOGHEIif5rPbpix6qhpuatrZzm6HeC5rT0nXt8ynLTc7PzfXmovswD9x6d9h5NcHswkV5y3PbkNbpel/tLADYg==
|
||||
|
||||
"@cbor-extract/[email protected]":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-linux-x64/-/cbor-extract-linux-x64-2.0.0.tgz#8c936b8a93f915bf3c2459d5b4b78d244bda0f26"
|
||||
integrity sha512-WYeE1b5WGf9pbbQH3qeNBXq710gGsuVFUiP148RY8In+2pCp/fxjBpe701ngam9/fF5D+gJs8B1i5wv/PN7JZA==
|
||||
|
||||
"@cbor-extract/[email protected]":
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@cbor-extract/cbor-extract-win32-x64/-/cbor-extract-win32-x64-2.0.0.tgz#4d4ad91527a8313c3db1e2167a8821dfae9d6211"
|
||||
integrity sha512-XqVuJEnE0jpl/RkuSp04FF2UE73gY52Y4nZaIE6j9GAeSH2cHYU5CCd4TaVMDi2M18ZpZv7XhL/k+nneQzyJpQ==
|
||||
|
||||
"@changesets/apply-release-plan@^6.1.0":
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/@changesets/apply-release-plan/-/apply-release-plan-6.1.0.tgz#97d755a7725bdcc1152aa54d8c7fbc85a5bf1e40"
|
||||
@@ -7128,27 +7098,6 @@ catering@^2.1.0, catering@^2.1.1:
|
||||
resolved "https://registry.yarnpkg.com/catering/-/catering-2.1.1.tgz#66acba06ed5ee28d5286133982a927de9a04b510"
|
||||
integrity sha512-K7Qy8O9p76sL3/3m7/zLKbRkyOlSZAgzEaLhyj2mXS8PsCud2Eo4hAb8aLtZqHh0QGqLcb9dlJSu6lHRVENm1w==
|
||||
|
||||
cbor-extract@^2.0.2:
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/cbor-extract/-/cbor-extract-2.0.2.tgz#8e45339627fb8b47071e8e71138c630019125939"
|
||||
integrity sha512-QoLGEgPff03ad/L66P91ci5Zmf7Woq8bh4H5XT3+D5annlrPH5ObHf2Yvo53eDQaDkQtF9tJwMKSWANGXDmwUA==
|
||||
dependencies:
|
||||
node-gyp-build-optional-packages "5.0.3"
|
||||
optionalDependencies:
|
||||
"@cbor-extract/cbor-extract-darwin-arm64" "2.0.0"
|
||||
"@cbor-extract/cbor-extract-darwin-x64" "2.0.0"
|
||||
"@cbor-extract/cbor-extract-linux-arm" "2.0.0"
|
||||
"@cbor-extract/cbor-extract-linux-arm64" "2.0.0"
|
||||
"@cbor-extract/cbor-extract-linux-x64" "2.0.0"
|
||||
"@cbor-extract/cbor-extract-win32-x64" "2.0.0"
|
||||
|
||||
cbor-x@^1.4.1:
|
||||
version "1.4.1"
|
||||
resolved "https://registry.yarnpkg.com/cbor-x/-/cbor-x-1.4.1.tgz#1cada332cf5b7d1f940b494c0e88f2f1439bbcf3"
|
||||
integrity sha512-qp6nM61RaamDJWsDGHzMIQ4+XBtg7/QIoBi5Lra4IDU65eP8lHcgkkJ9t2yIU8EvRThBfFCh6+S1Qkrmq93J3Q==
|
||||
optionalDependencies:
|
||||
cbor-extract "^2.0.2"
|
||||
|
||||
chai@^4.3.6:
|
||||
version "4.3.6"
|
||||
resolved "https://registry.yarnpkg.com/chai/-/chai-4.3.6.tgz#ffe4ba2d9fa9d6680cc0b370adae709ec9011e9c"
|
||||
@@ -13955,11 +13904,6 @@ node-forge@^1:
|
||||
resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-1.3.1.tgz#be8da2af243b2417d5f646a770663a92b7e9ded3"
|
||||
integrity sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==
|
||||
|
||||
[email protected]:
|
||||
version "5.0.3"
|
||||
resolved "https://registry.yarnpkg.com/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.0.3.tgz#92a89d400352c44ad3975010368072b41ad66c17"
|
||||
integrity sha512-k75jcVzk5wnnc/FMxsf4udAoTEUv2jY3ycfdSd3yWu6Cnd1oee6/CfZJApyscA4FJOmdoixWwiwOyf16RzD5JA==
|
||||
|
||||
node-gyp-build@^4.2.0, node-gyp-build@^4.3.0:
|
||||
version "4.5.0"
|
||||
resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.5.0.tgz#7a64eefa0b21112f89f58379da128ac177f20e40"
|
||||
|
||||
Reference in New Issue
Block a user