Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/curly-snails-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@thirdweb-dev/react": patch
"@thirdweb-dev/sdk": patch
"@thirdweb-dev/solana": patch
---

Syntax changes for react native support
2 changes: 1 addition & 1 deletion packages/react/src/utils/ipfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function resolveMimeType(url?: string) {
method: "HEAD",
});
if (res.ok && res.headers.has("content-type")) {
return res.headers.get("content-type") ?? undefined;
return res.headers.get("content-type") || undefined;
}
// we failed to resolve the mime type, return null
return undefined;
Expand Down
18 changes: 9 additions & 9 deletions packages/sdk/src/common/feature-detection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export function extractConstructorParamsFromAbi(
) {
for (const input of abi) {
if (input.type === "constructor") {
return input.inputs ?? [];
return input.inputs || [];
}
}
return [];
Expand All @@ -131,7 +131,7 @@ export function extractFunctionParamsFromAbi(
) {
for (const input of abi) {
if (input.type === "function" && input.name === functionName) {
return input.inputs ?? [];
return input.inputs || [];
}
}
return [];
Expand Down Expand Up @@ -159,11 +159,11 @@ export function extractFunctionsFromAbi(
const promise = out ? `: Promise<${out}>` : `: Promise<TransactionResult>`;
const signature = `contract.call("${f.name}"${fargs})${promise}`;
parsed.push({
inputs: f.inputs ?? [],
outputs: f.outputs ?? [],
name: f.name ?? "unknown",
inputs: f.inputs || [],
outputs: f.outputs || [],
name: f.name || "unknown",
signature,
stateMutability: f.stateMutability ?? "",
stateMutability: f.stateMutability || "",
comment: doc,
});
}
Expand All @@ -184,9 +184,9 @@ export function extractEventsFromAbi(
for (const e of events) {
const doc = extractCommentFromMetadata(e.name, metadata, "events");
parsed.push({
inputs: e.inputs ?? [],
outputs: e.outputs ?? [],
name: e.name ?? "unknown",
inputs: e.inputs || [],
outputs: e.outputs || [],
name: e.name || "unknown",
comment: doc,
});
}
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/src/common/permit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ export async function signDAIPermit(
verifyingContract: currencyAddress,
});

nonce = nonce ?? (await getSignerNonce(signer, currencyAddress)).toString();
deadline = deadline ?? ethers.constants.MaxUint256;
nonce = nonce || (await getSignerNonce(signer, currencyAddress)).toString();
deadline = deadline || ethers.constants.MaxUint256;

const message = {
owner,
Expand Down Expand Up @@ -185,8 +185,8 @@ export async function signEIP2612Permit(
verifyingContract: currencyAddress,
});

nonce = nonce ?? (await getSignerNonce(signer, currencyAddress)).toString();
deadline = deadline ?? ethers.constants.MaxUint256;
nonce = nonce || (await getSignerNonce(signer, currencyAddress)).toString();
deadline = deadline || ethers.constants.MaxUint256;

const message = {
owner,
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/schema/contracts/splits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ export const SplitsContractInput = CommonContractSchema.extend({
}
addressMap[entry.address] = true;
totalShares += entry.sharesBps;
if (totalShares > 10_000) {
if (totalShares > 10000) {
context.addIssue({
code: z.ZodIssueCode.custom,
message: `Total shares cannot go over 100%.`,
path: [index, `sharesBps`],
});
}
}
if (totalShares !== 10_000) {
if (totalShares !== 10000) {
context.addIssue({
code: z.ZodIssueCode.custom,
message: `Total shares need to add up to 100%. Total shares are currently ${
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/schema/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Json } from "@thirdweb-dev/storage";
import { BigNumber, CallOverrides, utils } from "ethers";
import { z } from "zod";

export const MAX_BPS = 10_000;
export const MAX_BPS = 10000;

export const BytesLikeSchema = z.union([z.array(z.number()), z.string()]);

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/test/nft-drop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ describe("NFT Drop Contract", async () => {
await dropContract.revealer.reveal(0, "my secret password");
const transactions =
(await adminWallet.provider?.getBlockWithTransactions("latest"))
?.transactions ?? [];
?.transactions || [];

const { index, _key } = dropContract.encoder.decode(
"reveal",
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/test/signature-drop.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ describe("Signature drop tests", async () => {
await signatureDropContract.revealer.reveal(0, "my secret password");
const transactions =
(await adminWallet.provider?.getBlockWithTransactions("latest"))
?.transactions ?? [];
?.transactions || [];

const { _index, _key } = signatureDropContract.encoder.decode(
"reveal",
Expand Down
2 changes: 1 addition & 1 deletion packages/solana/src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { z } from "zod";
/**
* @internal
*/
export const MAX_BPS = 10_000;
export const MAX_BPS = 10000;

/**
* @internal
Expand Down