Compare commits

...
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
55edaa900d Version Packages (#842)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-03-30 14:16:57 -07:00
Jonas DanielsandGitHub 839fce1f6f [storage, chains, react-core] - fail fast when making HEAD request to gateway during upload & more (#843) 2023-03-30 21:10:44 +00:00
Manan TankandGitHub 1f2df55b67 react-core: add useNetwork hook (#841) 2023-03-30 20:03:12 +00:00
b7fcae6e40 [SDK] Update function signature of contract.call (#834)
Co-authored-by: Jonas Daniels <[email protected]>
2023-03-30 19:53:16 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
d2bb62a1b8 Version Packages (#840)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-03-30 11:03:44 -07:00
sidandGitHub db648ed22d Add --clean flag to deploy, publish, build (#836) 2023-03-30 17:50:17 +00:00
Jonas DanielsandGitHub 9b3038291d [chains] - add telos icon & update other chains (#839) 2023-03-30 17:28:37 +00:00
e2581f211e [RectCore] fix auth logout by invalidating and storing invalidated cookie (#837)
Co-authored-by: Jonas Daniels <[email protected]>
2023-03-30 17:21:00 +00:00
72 changed files with 596 additions and 196 deletions
+14
View File
@@ -1,5 +1,19 @@
# @thirdweb-dev/auth
## 3.0.10
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@0.2.11
## 3.0.9
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@0.2.10
## 3.0.8
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.0.8",
"version": "3.0.10",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/chains
## 0.1.9
### Patch Changes
- [#843](https://github.com/thirdweb-dev/js/pull/843) [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d) Thanks [@jnsdls](https://github.com/jnsdls)! - update chains
## 0.1.8
### Patch Changes
- [#839](https://github.com/thirdweb-dev/js/pull/839) [`9b303829`](https://github.com/thirdweb-dev/js/commit/9b3038291d1c9f4eb243718a6070e3dac829a354) Thanks [@jnsdls](https://github.com/jnsdls)! - update chains (add telos icon & avalanche fuji faucet)
## 0.1.7
### Patch Changes
+6
View File
@@ -22,6 +22,12 @@ export default {
"standard": "EIP3091"
}
],
"icon": {
"url": "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
"format": "png",
"width": 228,
"height": 228
},
"testnet": false,
"slug": "telos-evm"
} as const;
+6
View File
@@ -18,5 +18,11 @@ export default {
"chainId": 41,
"networkId": 41,
"testnet": true,
"icon": {
"url": "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
"format": "png",
"width": 228,
"height": 228
},
"slug": "telos-evm-testnet"
} as const;
+1
View File
@@ -21,6 +21,7 @@ export default {
"https://api.avax-test.network/ext/bc/C/rpc"
],
"faucets": [
"https://faucet.avax.network/",
"https://faucet.avax-test.network/"
],
"nativeCurrency": {
+1 -1
View File
@@ -8,7 +8,7 @@ export default {
"symbol": "CAM",
"decimals": 18
},
"infoURL": "https://camino.foundation/",
"infoURL": "https://camino.network/",
"shortName": "Camino",
"chainId": 500,
"networkId": 1000,
+5 -2
View File
@@ -1,14 +1,17 @@
export default {
"name": "Columbus Test Network",
"chain": "CAM",
"rpc": [],
"rpc": [
"https://columbus-test-network.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://columbus.camino.network/ext/bc/C/rpc"
],
"faucets": [],
"nativeCurrency": {
"name": "Camino",
"symbol": "CAM",
"decimals": 18
},
"infoURL": "https://camino.foundation/",
"infoURL": "https://camino.network/",
"shortName": "Columbus",
"chainId": 501,
"networkId": 1001,
+1 -1
View File
@@ -27,7 +27,7 @@ export default {
{
"name": "Shardeum Scan",
"url": "https://explorer-liberty10.shardeum.org",
"standard": "none"
"standard": "EIP3091"
}
],
"redFlags": [
+1 -1
View File
@@ -27,7 +27,7 @@ export default {
{
"name": "Shardeum Scan",
"url": "https://explorer-liberty20.shardeum.org",
"standard": "none"
"standard": "EIP3091"
}
],
"redFlags": [
+1 -1
View File
@@ -27,7 +27,7 @@ export default {
{
"name": "Shardeum Scan",
"url": "https://explorer-sphinx.shardeum.org",
"standard": "none"
"standard": "EIP3091"
}
],
"redFlags": [
+1
View File
@@ -30,6 +30,7 @@ export default {
"explorers": [
{
"name": "meerscan",
"icon": "meer",
"url": "https://evm.meerscan.com",
"standard": "none"
}
+1
View File
@@ -21,6 +21,7 @@ export default {
"explorers": [
{
"name": "meerscan testnet",
"icon": "meer",
"url": "https://testnet.qng.meerscan.io",
"standard": "none"
}
+13
View File
@@ -0,0 +1,13 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 40,
icon: {
url: "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
format: "png",
width: 228,
height: 228,
},
};
+14
View File
@@ -0,0 +1,14 @@
// @ts-check
/** @typedef { import("../../src/types").Chain } Chain */
/** @type {Partial<Chain>} */
export default {
chainId: 41,
testnet: true,
icon: {
url: "ipfs://QmdkgQDtDedsNNth3ZVgWfwRZPCePLA13MtLvV4CEYSuTR/TLOS.png",
format: "png",
width: 228,
height: 228,
},
};
+1
View File
@@ -11,4 +11,5 @@ export default {
sizes: [16, 32, 64, 128, 256, 512],
},
rpc: ["https://avalanche-fuji.infura.io/v3/${INFURA_API_KEY}"],
faucets: ["https://faucet.avax.network/"],
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.7",
"version": "0.1.9",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"browser": {
File diff suppressed because one or more lines are too long
+17
View File
@@ -1,5 +1,22 @@
# thirdweb
## 0.10.6
### Patch Changes
- Updated dependencies [[`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d)]:
- @thirdweb-dev/sdk@3.10.6
- @thirdweb-dev/storage@1.1.2
## 0.10.5
### Patch Changes
- [#836](https://github.com/thirdweb-dev/js/pull/836) [`db648ed2`](https://github.com/thirdweb-dev/js/commit/db648ed22dba672c64e7893865f9ad8b72189dea) Thanks [@shift4id](https://github.com/shift4id)! - Added the --clean flag to build, publish, and deploy
- Updated dependencies []:
- @thirdweb-dev/sdk@3.10.5
## 0.10.4
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.10.4",
"version": "0.10.6",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+4
View File
@@ -251,6 +251,7 @@ const main = async () => {
program
.command("build")
.description("Compile contract and detect thirdweb contract extensions")
.option("--clean", "clear the cache before building")
.option("-p, --path <project-path>", "path to project", ".")
.option("-d, --debug", "show debug logs")
.option("-a, --all", "run detection on all contracts")
@@ -262,6 +263,7 @@ const main = async () => {
.command("deploy")
.description("Deploy your (or team) contracts securely to blockchains")
.option("-p, --path <project-path>", "path to project", ".")
.option("--clean", "clear the cache before building")
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
@@ -310,6 +312,7 @@ const main = async () => {
"-cn, --contract-name [name]",
"Filter for contracts that contain this contract name",
)
.option("--clean", "clear the cache before building")
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
@@ -340,6 +343,7 @@ const main = async () => {
"-cn, --contract-name [name]",
"Filter for contracts that contain this contract name",
)
.option("--clean", "clear the cache before building")
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
+1 -1
View File
@@ -34,7 +34,7 @@ export async function detectExtensions(options: any) {
let compiledResult;
const compileLoader = spinner("Compiling project...");
try {
compiledResult = await build(projectPath, projectType);
compiledResult = await build(projectPath, projectType, options);
} catch (e) {
compileLoader.fail("Compilation failed");
logger.error(e);
+1 -1
View File
@@ -97,7 +97,7 @@ export async function processProject(
let compiledResult: { contracts: ContractPayload[] };
const compileLoader = spinner("Compiling project...");
try {
compiledResult = await build(projectPath, projectType);
compiledResult = await build(projectPath, projectType, options);
} catch (e) {
compileLoader.fail("Compilation failed");
logger.error(e);
+2
View File
@@ -9,6 +9,7 @@ import { TruffleBuilder } from "./truffle";
export default async function build(
path: string,
projectType: ProjectType,
options: { clean: boolean },
): Promise<{
contracts: ContractPayload[];
}> {
@@ -38,5 +39,6 @@ export default async function build(
return await builder.compile({
name: "",
projectPath: path,
clean: options.clean,
});
}
+3
View File
@@ -25,6 +25,9 @@ export class FoundryBuilder extends BaseBuilder {
process.exit(1);
}
if (options.clean) {
await execute("forge clean", options.projectPath);
}
await execute("forge build --extra-output metadata", options.projectPath);
// get the current config first
+3
View File
@@ -12,6 +12,9 @@ export class HardhatBuilder extends BaseBuilder {
public async compile(options: CompileOptions): Promise<{
contracts: ContractPayload[];
}> {
if (options.clean) {
await execute("npx hardhat clean", options.projectPath);
}
await execute("npx hardhat compile", options.projectPath);
//we get our very own extractor script from the dir that we're in during execution
// this is `./dist/cli` (for all purposes of the CLI)
@@ -1,6 +1,7 @@
import { ContractPayload } from "./ContractPayload";
export type CompileOptions = {
clean: boolean;
projectPath: string;
name: string;
};
+56
View File
@@ -1,5 +1,61 @@
# @thirdweb-dev/react-core
## 3.11.2
### Patch Changes
- [#834](https://github.com/thirdweb-dev/js/pull/834) [`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910) Thanks [@adam-maj](https://github.com/adam-maj)! - Usage of the `useContractRead` and `useContractWrite` hooks has changed:
```js
const owner = "0x...";
const operator = "0x...";
const overrides = { gasLimit: "10000", gasPrice: "10000" };
// Old usage
const { data } = useContractRead(
contract,
"approve",
owner,
operator,
overrides,
);
const { mutateAsync } = useContractWrite(contract, "approve");
mutateAsync(owner, operator, overrides);
// New usage
const { data } = useContractRead(
contract,
"approve",
[owner, operator],
overrides,
);
const { mutateAsync } = useContractWrite(contract, "approve");
mutateAsync([owner, operator], overrides);
```
- [#841](https://github.com/thirdweb-dev/js/pull/841) [`1f2df55b`](https://github.com/thirdweb-dev/js/commit/1f2df55b673fefb0106778dca7a13406cfbcfc90) Thanks [@MananTank](https://github.com/MananTank)! - add useNetwork() hook back
- [#843](https://github.com/thirdweb-dev/js/pull/843) [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d) Thanks [@jnsdls](https://github.com/jnsdls)! - fix solana program query key resolution
- Updated dependencies [[`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 3.11.1
### Patch Changes
- [#837](https://github.com/thirdweb-dev/js/pull/837) [`e2581f21`](https://github.com/thirdweb-dev/js/commit/e2581f211e4419105d6169d84a60a4d69759eda9) Thanks [@lucoadam](https://github.com/lucoadam)! - Fixes auth logout by invalidating cookie by storing updated cookie credential
- Updated dependencies [[`9b303829`](https://github.com/thirdweb-dev/js/commit/9b3038291d1c9f4eb243718a6070e3dac829a354)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 3.11.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.11.0",
"version": "3.11.2",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -0,0 +1,130 @@
import { Chain, defaultChains } from "@thirdweb-dev/chains";
import { useCallback, useState } from "react";
import { useActiveChain, useChainId } from "../../evm/hooks/wallet";
import { useSupportedChains } from "../../evm/hooks/useSupportedChains";
import { useSwitchChain, useWallet } from "./wallet-hooks";
import { assertWindowEthereum } from "@thirdweb-dev/wallets";
// this hook is only for backwards compatibility
type SwitchNetwork = (chainId: number) => Promise<
| {
data: Chain | undefined;
error: undefined;
}
| {
data: undefined;
error: Error;
}
>;
type NetworkMetadata = {
data: {
chain: Chain | { chainId: number; unsupported: true } | undefined;
chains: Chain[];
};
error: Error | undefined;
loading: boolean | undefined;
};
/**
*
* @deprecated - use `useActiveChain`, `useSwitchChain`, `useChainId` instead
*
* Hook for getting metadata about the network the current wallet is connected to and switching networks
*
* @example
* ```javascript
* import { useNetwork } from "@thirdweb-dev/react";
*
* const App = () => {
* const [, switchNetwork] = useNetwork();
* return (
* // switchNetwork is undefined if the wallet does not support programmatic network switching
* // 137 is the chainId for Polygon in this example
* <button onClick={() => switchNetwork(137)}>
* Switch Network
* </button>
* );
* };
```
*
* It's important to note that some wallet apps do not support programmatic network switching and switchNetwork will be undefined.
* For those situations, you can typically switch networks in the wallet app this hook will still work.
*
* @public
*/
export function useNetwork(): [NetworkMetadata, SwitchNetwork | undefined] {
const chain = useActiveChain();
const chainId = useChainId();
const switchChain = useSwitchChain();
const supportedChains = useSupportedChains();
const wallet = useWallet();
const isMetamaskInstalled = assertWindowEthereum(window)
? window.ethereum.isMetaMask
: false;
const isCoinbaseInstalled = assertWindowEthereum(window)
? window.ethereum.isCoinbaseWallet
: false;
// switch not supported if connected to a mobile wallet
const switchChainNotSupported =
!wallet ||
wallet.walletId === "walletConnectV1" ||
wallet.walletId === "walletConnect" ||
(wallet.walletId === "metamask" && !isMetamaskInstalled) ||
(wallet.walletId === "coinbaseWallet" && !isCoinbaseInstalled);
// error when switching network
const [error, setError] = useState<Error | undefined>(undefined);
// loading: true when switching network
const [loading, setLoading] = useState(false);
const switchNetwork: SwitchNetwork = useCallback(
async (_chainId: number) => {
// reset error and loading
setLoading(true);
setError(undefined);
try {
await switchChain(_chainId);
} catch (e: any) {
setError(e);
setLoading(false);
return {
data: undefined,
error: e,
};
}
setLoading(false);
return {
data:
supportedChains.find((c) => c.chainId === _chainId) ||
defaultChains.find((c) => c.chainId === _chainId),
error: undefined,
};
},
[switchChain, supportedChains],
);
return [
{
data: {
chain:
chainId === undefined
? undefined
: chain || { chainId, unsupported: true },
chains: wallet ? supportedChains : [],
},
error: error,
loading,
},
switchChainNotSupported ? undefined : switchNetwork,
];
}
@@ -512,20 +512,22 @@ export function useContractEvents(
export function useContractRead(
contract: RequiredParam<ValidContractInstance>,
functionName: RequiredParam<string>,
...args: unknown[] | [...unknown[], CallOverrides]
args?: unknown[],
overrides?: CallOverrides,
) {
const contractAddress = contract?.getAddress();
return useQueryWithNetwork(
cacheKeys.contract.call(contractAddress, functionName, args),
cacheKeys.contract.call(contractAddress, functionName, args, overrides),
() => {
requiredParamInvariant(contract, "contract must be defined");
requiredParamInvariant(functionName, "function name must be provided");
return (
contract.call as (
functionName: string,
...args: unknown[] | [...unknown[], CallOverrides]
args?: unknown[],
overrides?: CallOverrides,
) => Promise<any>
)(functionName, ...args);
)(functionName, args, overrides);
},
{
enabled: !!contract && !!functionName,
@@ -560,23 +562,17 @@ export function useContractWrite(
const queryClient = useQueryClient();
return useMutation(
async (callParams?: unknown[] | [...unknown[], CallOverrides]) => {
async (args?: unknown[], overrides?: CallOverrides) => {
requiredParamInvariant(contract, "contract must be defined");
requiredParamInvariant(functionName, "function name must be provided");
if (!callParams?.length) {
return (
contract.call as (
functionName: string,
...args: unknown[] | [...unknown[], CallOverrides]
) => Promise<any>
)(functionName);
}
return (
contract.call as (
functionName: string,
...args: unknown[] | [...unknown[], CallOverrides]
args?: unknown[],
overrides?: CallOverrides,
) => Promise<any>
)(functionName, ...callParams);
)(functionName, args, overrides);
},
{
onSettled: () =>
@@ -28,6 +28,7 @@ export function useLogout() {
await fetch(`${authConfig.authUrl}/logout`, {
method: "POST",
credentials: "include",
});
queryClient.invalidateQueries(cacheKeys.auth.user());
+1
View File
@@ -17,6 +17,7 @@ export {
useSwitchChain,
useWallets,
} from "../core/hooks/wallet-hooks";
export { useNetwork } from "../core/hooks/useNetwork";
export { useThirdwebWallet } from "../core/providers/thirdweb-wallet-provider";
// connected wallet hooks
@@ -7,7 +7,7 @@ import type {
QueryAllParams,
SUPPORTED_CHAIN_ID,
} from "@thirdweb-dev/sdk";
import { BigNumberish, constants } from "ethers";
import { BigNumberish, CallOverrides, constants } from "ethers";
const TW_CACHE_KEY_PREFIX = "tw-cache";
@@ -108,8 +108,15 @@ export const cacheKeys = {
call: (
contractAddress: RequiredParam<ContractAddress>,
functionName: RequiredParam<string>,
args: unknown[],
) => createContractCacheKey(contractAddress, ["call", functionName, args]),
args?: unknown[],
overrides?: CallOverrides,
) =>
createContractCacheKey(contractAddress, [
"call",
functionName,
args,
overrides,
]),
app: {
get: (contractAddress: RequiredParam<ContractAddress>) =>
@@ -39,13 +39,14 @@ export function programQuery<TProgramType extends ProgramType>(
return {
queryKey: neverPersist(
createSOLQueryKeyWithNetwork(
["program-instance", address] as const,
["program-instance", { address, type }] as const,
network || null,
),
),
queryFn: (async () => {
requiredParamInvariant(sdk, "sdk is required");
requiredParamInvariant(address, "Address is required");
// if the type is not passed in explicitly then we'll try to resolve it
if (!type) {
// why do we call `fetchQuery` here instead of calling the sdk directly?
@@ -1,5 +1,9 @@
# @thirdweb-dev/react-native-compat
## 0.2.2
## 0.2.1
## 0.2.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.2.0",
"version": "0.2.2",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+21
View File
@@ -1,5 +1,26 @@
# @thirdweb-dev/react-native
## 0.2.2
### Patch Changes
- Updated dependencies [[`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910), [`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910), [`1f2df55b`](https://github.com/thirdweb-dev/js/commit/1f2df55b673fefb0106778dca7a13406cfbcfc90), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d)]:
- @thirdweb-dev/react-core@3.11.2
- @thirdweb-dev/sdk@3.10.6
- @thirdweb-dev/chains@0.1.9
- @thirdweb-dev/storage@1.1.2
- @thirdweb-dev/wallets@0.2.11
## 0.2.1
### Patch Changes
- Updated dependencies [[`e2581f21`](https://github.com/thirdweb-dev/js/commit/e2581f211e4419105d6169d84a60a4d69759eda9), [`9b303829`](https://github.com/thirdweb-dev/js/commit/9b3038291d1c9f4eb243718a6070e3dac829a354)]:
- @thirdweb-dev/react-core@3.11.1
- @thirdweb-dev/chains@0.1.8
- @thirdweb-dev/sdk@3.10.5
- @thirdweb-dev/wallets@0.2.10
## 0.2.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.2.0",
"version": "0.2.2",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+20
View File
@@ -1,5 +1,25 @@
# @thirdweb-dev/react
## 3.11.2
### Patch Changes
- Updated dependencies [[`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910), [`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910), [`1f2df55b`](https://github.com/thirdweb-dev/js/commit/1f2df55b673fefb0106778dca7a13406cfbcfc90), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d)]:
- @thirdweb-dev/react-core@3.11.2
- @thirdweb-dev/sdk@3.10.6
- @thirdweb-dev/chains@0.1.9
- @thirdweb-dev/wallets@0.2.11
## 3.11.1
### Patch Changes
- Updated dependencies [[`e2581f21`](https://github.com/thirdweb-dev/js/commit/e2581f211e4419105d6169d84a60a4d69759eda9), [`9b303829`](https://github.com/thirdweb-dev/js/commit/9b3038291d1c9f4eb243718a6070e3dac829a354)]:
- @thirdweb-dev/react-core@3.11.1
- @thirdweb-dev/chains@0.1.8
- @thirdweb-dev/sdk@3.10.5
- @thirdweb-dev/wallets@0.2.10
## 3.11.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.11.0",
"version": "3.11.2",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+41
View File
@@ -1,5 +1,46 @@
# @thirdweb-dev/sdk
## 3.10.6
### Patch Changes
- [#834](https://github.com/thirdweb-dev/js/pull/834) [`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910) Thanks [@adam-maj](https://github.com/adam-maj)! - The signature of all `contract.call` methods has been updated to the following structure:
```ts
function call(functionName: string, args: any[], overrides?: CallOverrides);
```
Meaning that the following contract call in the old format:
```ts
const owner = "0x...";
const operator = "0x...";
const overrides = { gasLimit: "10000", gasPrice: "10000" };
const res = await contract.call("approve", owner, operator, overrides);
```
Would now look like this with the changes:
```ts
const owner = "0x...";
const operator = "0x...";
const overrides = { gasLimit: "10000", gasPrice: "10000" };
const res = await contract.call("approve", [owner, operator], overrides);
```
- Updated dependencies [[`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d)]:
- @thirdweb-dev/[email protected]
- @thirdweb-dev/[email protected]
## 3.10.5
### Patch Changes
- Updated dependencies [[`9b303829`](https://github.com/thirdweb-dev/js/commit/9b3038291d1c9f4eb243718a6070e3dac829a354)]:
- @thirdweb-dev/[email protected]
## 3.10.4
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.10.4",
"version": "3.10.6",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
@@ -414,13 +414,9 @@ export class EditionDrop extends StandardErc1155<PrebuiltEditionDrop> {
TMethod extends keyof PrebuiltEditionDrop["functions"] = keyof PrebuiltEditionDrop["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<PrebuiltEditionDrop["functions"][TMethod]>)
| [
...(any[] & Parameters<PrebuiltEditionDrop["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<PrebuiltEditionDrop["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -416,13 +416,9 @@ export class Edition extends StandardErc1155<TokenERC1155> {
TMethod extends keyof TokenERC1155["functions"] = keyof TokenERC1155["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<TokenERC1155["functions"][TMethod]>)
| [
...(any[] & Parameters<TokenERC1155["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<TokenERC1155["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -696,13 +696,9 @@ export class Marketplace implements UpdateableNetwork {
TMethod extends keyof MarketplaceContract["functions"] = keyof MarketplaceContract["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<MarketplaceContract["functions"][TMethod]>)
| [
...(any[] & Parameters<MarketplaceContract["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<MarketplaceContract["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -273,14 +273,10 @@ export class MarketplaceV3 implements UpdateableNetwork {
TMethod extends keyof MarketplaceV3Contract["functions"] = keyof MarketplaceV3Contract["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<MarketplaceV3Contract["functions"][TMethod]>)
| [
...(any[] & Parameters<MarketplaceV3Contract["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<MarketplaceV3Contract["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
/** ********************
@@ -432,13 +432,9 @@ export class Multiwrap extends StandardErc721<MultiwrapContract> {
TMethod extends keyof MultiwrapContract["functions"] = keyof MultiwrapContract["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<MultiwrapContract["functions"][TMethod]>)
| [
...(any[] & Parameters<MultiwrapContract["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<MultiwrapContract["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -359,13 +359,9 @@ export class NFTCollection extends StandardErc721<TokenERC721> {
TMethod extends keyof TokenERC721["functions"] = keyof TokenERC721["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<TokenERC721["functions"][TMethod]>)
| [
...(any[] & Parameters<TokenERC721["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<TokenERC721["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -613,13 +613,9 @@ export class NFTDrop extends StandardErc721<PrebuiltNFTDrop> {
TMethod extends keyof PrebuiltNFTDrop["functions"] = keyof PrebuiltNFTDrop["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<PrebuiltNFTDrop["functions"][TMethod]>)
| [
...(any[] & Parameters<PrebuiltNFTDrop["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<PrebuiltNFTDrop["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -786,14 +786,10 @@ export class Pack extends StandardErc1155<PackContract> {
TMethod extends keyof PackContract["functions"] = keyof PackContract["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<PackContract["functions"][TMethod]>)
| [
...(any[] & Parameters<PackContract["functions"][TMethod]>),
CallOverrides,
]
args?: any[] & Parameters<PackContract["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
private detectVrf() {
@@ -509,13 +509,9 @@ export class SignatureDrop extends StandardErc721<SignatureDropContract> {
TMethod extends keyof SignatureDropContract["functions"] = keyof SignatureDropContract["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<SignatureDropContract["functions"][TMethod]>)
| [
...(any[] & Parameters<SignatureDropContract["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<SignatureDropContract["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -423,13 +423,9 @@ export class Split implements UpdateableNetwork {
TMethod extends keyof SplitContract["functions"] = keyof SplitContract["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<SplitContract["functions"][TMethod]>)
| [
...(any[] & Parameters<SplitContract["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<SplitContract["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -314,13 +314,9 @@ export class TokenDrop extends StandardErc20<PrebuiltTokenDrop> {
TMethod extends keyof PrebuiltTokenDrop["functions"] = keyof PrebuiltTokenDrop["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<PrebuiltTokenDrop["functions"][TMethod]>)
| [
...(any[] & Parameters<PrebuiltTokenDrop["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<PrebuiltTokenDrop["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -323,13 +323,9 @@ export class Token extends StandardErc20<TokenERC20> {
TMethod extends keyof TokenERC20["functions"] = keyof TokenERC20["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<TokenERC20["functions"][TMethod]>)
| [
...(any[] & Parameters<TokenERC20["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<TokenERC20["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -508,13 +508,9 @@ export class Vote implements UpdateableNetwork {
TMethod extends keyof VoteERC20["functions"] = keyof VoteERC20["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<VoteERC20["functions"][TMethod]>)
| [
...(any[] & Parameters<VoteERC20["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<VoteERC20["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<any> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
}
@@ -381,14 +381,10 @@ export class SmartContract<
TMethod extends keyof TContract["functions"] = keyof TContract["functions"],
>(
functionName: string & TMethod,
...args:
| (any[] & Parameters<TContract["functions"][TMethod]>)
| [
...(any[] & Parameters<TContract["functions"][TMethod]>),
CallOverrides,
]
args?: Parameters<TContract["functions"][TMethod]>,
overrides?: CallOverrides,
): Promise<ReturnType<TContract["functions"][TMethod]>> {
return this.contractWrapper.call(functionName, ...args);
return this.contractWrapper.call(functionName, args, overrides);
}
/** ********************
@@ -274,20 +274,13 @@ export class ContractWrapper<
*/
public async call(
functionName: string,
...args: unknown[] | [...unknown[], CallOverrides]
args: unknown[] = [],
overrides?: CallOverrides,
): Promise<any> {
// parse last arg as tx options if present
let txOptions: CallOverrides | undefined;
try {
if (args.length > 0 && typeof args[args.length - 1] === "object") {
const last = args[args.length - 1];
txOptions = await CallOverrideSchema.parseAsync(last);
// if call overrides found, remove it from args array
args = args.slice(0, args.length - 1);
}
} catch (e) {
// no-op
}
let txOptions: CallOverrides | undefined = overrides
? await CallOverrideSchema.parseAsync(overrides)
: undefined;
const functions = extractFunctionsFromAbi(AbiSchema.parse(this.abi)).filter(
(f) => f.name === functionName,
@@ -40,6 +40,7 @@ export class Registry {
const candyMachine = await this.metaplex
.candyMachinesV2()
.findByAddress({ address: new PublicKey(address) });
if (candyMachine) {
return "nft-drop";
}
+9 -6
View File
@@ -107,7 +107,7 @@ describe("Custom Contracts", async () => {
const owner = await c.call("owner");
expect(owner).to.eq(adminWallet.address);
const tx = await c.call("setOwner", samWallet.address);
const tx = await c.call("setOwner", [samWallet.address]);
expect(tx.receipt).to.not.eq(undefined);
const owner2 = await c.call("owner");
expect(owner2).to.eq(samWallet.address);
@@ -123,7 +123,7 @@ describe("Custom Contracts", async () => {
invariant(c, "Contract undefined");
try {
await c.call("setOwner", samWallet.address, {
await c.call("setOwner", [samWallet.address], {
value: ethers.utils.parseEther("0.1"),
});
} catch (e) {
@@ -131,14 +131,17 @@ describe("Custom Contracts", async () => {
}
try {
await c.call("setOwner", samWallet.address, {
somObj: "foo",
});
await c.call("setOwner", [
samWallet.address,
{
somObj: "foo",
},
]);
} catch (e) {
expectError(e, "requires 1 arguments, but 2 were provided");
}
const tx = await c.call("setOwner", samWallet.address, {
const tx = await c.call("setOwner", [samWallet.address], {
gasLimit: 300_000,
});
expect(tx.receipt).to.not.eq(undefined);
+26 -22
View File
@@ -37,17 +37,19 @@ describe("Error Handling", async () => {
const marketplace = await sdk.getContract(marketplaceAddress);
try {
await marketplace.call("createListing", {
assetContract: collectionAddress,
tokenId: 0,
startTime: 1000000000000,
secondsUntilEndTime: 10000000000000,
quantityToList: 1,
currencyToAccept: "0x0000000000000000000000000000000000000000",
reservePricePerToken: 0,
buyoutPricePerToken: 0,
listingType: 0,
});
await marketplace.call("createListing", [
{
assetContract: collectionAddress,
tokenId: 0,
startTime: 1000000000000,
secondsUntilEndTime: 10000000000000,
quantityToList: 1,
currencyToAccept: "0x0000000000000000000000000000000000000000",
reservePricePerToken: 0,
buyoutPricePerToken: 0,
listingType: 0,
},
]);
expect.fail();
} catch (err) {
// In this case, call static should go through before sendTransaction
@@ -75,17 +77,19 @@ describe("Error Handling", async () => {
try {
await marketplace.call(
"createListing",
{
assetContract: collectionAddress,
tokenId: 0,
startTime: 1000000000000,
secondsUntilEndTime: 10000000000000,
quantityToList: 1,
currencyToAccept: "0x0000000000000000000000000000000000000000",
reservePricePerToken: 0,
buyoutPricePerToken: 0,
listingType: 0,
},
[
{
assetContract: collectionAddress,
tokenId: 0,
startTime: 1000000000000,
secondsUntilEndTime: 10000000000000,
quantityToList: 1,
currencyToAccept: "0x0000000000000000000000000000000000000000",
reservePricePerToken: 0,
buyoutPricePerToken: 0,
listingType: 0,
},
],
{
gasLimit: 800000,
},
+2 -2
View File
@@ -2,7 +2,7 @@ import { SmartContract, Token } from "../../src/evm";
import { sdk, signers } from "./before-setup";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { TokenERC20__factory } from "@thirdweb-dev/contracts-js";
import { getContract, getContractFromAbi } from "@thirdweb-dev/sdk";
import { getContract, getContractFromAbi } from "../../src";
import { expect } from "chai";
describe("Functions", async () => {
@@ -22,7 +22,7 @@ describe("Functions", async () => {
abi: TokenERC20__factory.abi,
network: adminWallet,
});
const balance = await contract.call("balanceOf", adminWallet.address);
const balance = await contract.call("balanceOf", [adminWallet.address]);
expect(balance.toString()).to.equal("0");
});
+6 -9
View File
@@ -126,21 +126,18 @@ describe("Marketplace V3", async () => {
]);
tokenAddress = customTokenContract.getAddress();
await marketplaceContract.call(
"grantRole",
await marketplaceContract.call("grantRole", [
ethers.utils.solidityKeccak256(["string"], ["LISTER_ROLE"]),
adminWallet.address,
);
await marketplaceContract.call(
"grantRole",
]);
await marketplaceContract.call("grantRole", [
ethers.utils.solidityKeccak256(["string"], ["ASSET_ROLE"]),
dummyBundleContract.getAddress(),
);
await marketplaceContract.call(
"grantRole",
]);
await marketplaceContract.call("grantRole", [
ethers.utils.solidityKeccak256(["string"], ["ASSET_ROLE"]),
dummyNftContract.getAddress(),
);
]);
});
const createDirectListing = async (
+7 -5
View File
@@ -507,11 +507,13 @@ describe("Publishing", async () => {
const uri = await c.call("contractUri");
expect(uri).to.eq(ethers.utils.hexZeroPad("0x1234", 32));
const tx = await c.call("updateStruct", {
aNumber: 123,
aString: ethers.utils.hexZeroPad("0x1234", 32),
anArray: [adminWallet.address, samWallet.address],
});
const tx = await c.call("updateStruct", [
{
aNumber: 123,
aString: ethers.utils.hexZeroPad("0x1234", 32),
anArray: [adminWallet.address, samWallet.address],
},
]);
expect(tx).to.not.eq(undefined);
});
+2 -3
View File
@@ -21,8 +21,7 @@ describe("Tiered Drop Contract", async () => {
const tieredDrop = await sdk.getContract(address);
const walletAddress = await sdk.wallet.getAddress();
await tieredDrop.call(
"initialize",
await tieredDrop.call("initialize", [
walletAddress, // defaultAdmin
"Tiered Drop #1", // name
"TD", // symbol
@@ -31,7 +30,7 @@ describe("Tiered Drop Contract", async () => {
walletAddress, // saleRecipient
walletAddress, // royaltyRecipient
0, // royaltyBps
);
]);
return tieredDrop;
}
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/storage
## 1.1.2
### Patch Changes
- [#843](https://github.com/thirdweb-dev/js/pull/843) [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d) Thanks [@jnsdls](https://github.com/jnsdls)! - uploads to IPFS should start significantly faster due to a change in the re-upload detection
## 1.1.1
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/storage",
"version": "1.1.1",
"version": "1.1.2",
"main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js",
"browser": {
+4
View File
@@ -69,6 +69,10 @@ export async function getCID(
export async function isUploaded(cid: string) {
const res = await fetch(`${DEFAULT_GATEWAY_URLS["ipfs://"][0]}${cid}`, {
method: "HEAD",
headers: {
// tell the gateway to skip fetching from origin in order to fail fast on 404s and just re-upload in those cases
"x-skip-origin": "true",
},
});
return res.ok;
}
+19
View File
@@ -1,5 +1,24 @@
# @thirdweb-dev/unity-js-bridge
## 0.2.20
### Patch Changes
- Updated dependencies [[`b7fcae6e`](https://github.com/thirdweb-dev/js/commit/b7fcae6e40dade7a239b1a6afb1cd996c8f89910), [`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d)]:
- @thirdweb-dev/sdk@3.10.6
- @thirdweb-dev/storage@1.1.2
- @thirdweb-dev/wallets@0.2.11
- @thirdweb-dev/auth@3.0.10
## 0.2.19
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/sdk@3.10.5
- @thirdweb-dev/wallets@0.2.10
- @thirdweb-dev/auth@3.0.9
## 0.2.18
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.18",
"version": "0.2.20",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+14
View File
@@ -1,5 +1,19 @@
# @thirdweb-dev/wallets
## 0.2.11
### Patch Changes
- Updated dependencies [[`839fce1f`](https://github.com/thirdweb-dev/js/commit/839fce1f6f2747d6102033b26c292294e908f75d)]:
- @thirdweb-dev/chains@0.1.9
## 0.2.10
### Patch Changes
- Updated dependencies [[`9b303829`](https://github.com/thirdweb-dev/js/commit/9b3038291d1c9f4eb243718a6070e3dac829a354)]:
- @thirdweb-dev/chains@0.1.8
## 0.2.9
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "0.2.9",
"version": "0.2.11",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",