Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
824051eb28 | ||
|
|
fde77a7e19 | ||
|
|
2ec4811f15 | ||
|
|
15fe4779f4 | ||
|
|
6d3d76cff8 | ||
|
|
04f2f7b8ff |
@@ -1,5 +1,12 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 3.2.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650), [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9)]:
|
||||
- @thirdweb-dev/wallets@1.3.3
|
||||
|
||||
## 3.2.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "3.2.45",
|
||||
"version": "3.2.46",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.12.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650), [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9), [`15fe4779`](https://github.com/thirdweb-dev/js/commit/15fe4779f4b99e51afe214ac3ebb31f611089787)]:
|
||||
- @thirdweb-dev/wallets@1.3.3
|
||||
- @thirdweb-dev/storage@1.2.11
|
||||
- @thirdweb-dev/sdk@3.10.65
|
||||
- @thirdweb-dev/auth@3.2.46
|
||||
|
||||
## 0.12.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.12.7",
|
||||
"version": "0.12.8",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 3.16.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650), [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9), [`15fe4779`](https://github.com/thirdweb-dev/js/commit/15fe4779f4b99e51afe214ac3ebb31f611089787)]:
|
||||
- @thirdweb-dev/wallets@1.3.3
|
||||
- @thirdweb-dev/storage@1.2.11
|
||||
- @thirdweb-dev/sdk@3.10.65
|
||||
- @thirdweb-dev/auth@3.2.46
|
||||
|
||||
## 3.16.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "3.16.2",
|
||||
"version": "3.16.3",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.3.2
|
||||
|
||||
## 0.3.1
|
||||
|
||||
## 0.3.0
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650), [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9), [`15fe4779`](https://github.com/thirdweb-dev/js/commit/15fe4779f4b99e51afe214ac3ebb31f611089787)]:
|
||||
- @thirdweb-dev/wallets@1.3.3
|
||||
- @thirdweb-dev/storage@1.2.11
|
||||
- @thirdweb-dev/sdk@3.10.65
|
||||
- @thirdweb-dev/react-core@3.16.3
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 3.16.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1707](https://github.com/thirdweb-dev/js/pull/1707) [`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650) Thanks [@MananTank](https://github.com/MananTank)! - Fix Unchecked Index accesses
|
||||
|
||||
- Updated dependencies [[`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650), [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9), [`15fe4779`](https://github.com/thirdweb-dev/js/commit/15fe4779f4b99e51afe214ac3ebb31f611089787)]:
|
||||
- @thirdweb-dev/wallets@1.3.3
|
||||
- @thirdweb-dev/sdk@3.10.65
|
||||
- @thirdweb-dev/react-core@3.16.3
|
||||
|
||||
## 3.16.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
/**
|
||||
* (REQUIRED) Whether to generate an API report.
|
||||
*/
|
||||
"enabled": true
|
||||
"enabled": true,
|
||||
|
||||
/**
|
||||
* The filename for the API report files. It will be combined with "reportFolder" or "reportTempFolder" to produce
|
||||
@@ -135,7 +135,7 @@
|
||||
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
|
||||
* DEFAULT VALUE: "<projectFolder>/etc/"
|
||||
*/
|
||||
// "reportFolder": "<projectFolder>/etc/",
|
||||
"reportFolder": "<projectFolder>/temp/"
|
||||
|
||||
/**
|
||||
* Specifies the folder where the temporary report file is written. The file name portion is determined by
|
||||
@@ -330,6 +330,10 @@
|
||||
"default": {
|
||||
"logLevel": "warning"
|
||||
// "addToApiReportFile": false
|
||||
},
|
||||
|
||||
"ae-wrong-input-file-type": {
|
||||
"logLevel": "none"
|
||||
}
|
||||
|
||||
// "ae-extra-release-tag": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "3.16.2",
|
||||
"version": "3.16.3",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -47,8 +47,11 @@ export const DragNDrop: React.FC<{
|
||||
e.stopPropagation();
|
||||
|
||||
if (e.dataTransfer.files && e.dataTransfer.files.length > 0) {
|
||||
handleFileUpload(e.dataTransfer.files[0]);
|
||||
e.dataTransfer.clearData();
|
||||
const fileContent = e.dataTransfer.files[0];
|
||||
if (fileContent) {
|
||||
handleFileUpload(fileContent);
|
||||
e.dataTransfer.clearData();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -83,7 +86,7 @@ export const DragNDrop: React.FC<{
|
||||
display: "none",
|
||||
}}
|
||||
onChange={(e) => {
|
||||
if (e.target.files && e.target.files.length > 0) {
|
||||
if (e.target.files && e.target.files[0]) {
|
||||
handleFileUpload(e.target.files[0]);
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -94,7 +94,10 @@ export function OTPInput(props: {
|
||||
let value = e.target.value;
|
||||
|
||||
if (value.length > 1) {
|
||||
value = value[value.length - 1];
|
||||
const lastValue = value[value.length - 1];
|
||||
if (lastValue) {
|
||||
value = lastValue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!/[0-9]/.test(value) && value !== "") {
|
||||
|
||||
@@ -18,6 +18,8 @@ export * from "./components/NftMedia";
|
||||
export * from "./components/Web3Button";
|
||||
export { ThirdwebProvider } from "./providers/thirdweb-provider";
|
||||
|
||||
export type { MediaRendererProps } from "./components/types";
|
||||
|
||||
// wallet/hooks
|
||||
export { useInstalledWallets } from "../wallet/hooks/useInstalledWallets";
|
||||
|
||||
|
||||
@@ -192,7 +192,10 @@ export const ConnectWallet: React.FC<ConnectWalletProps> = (props) => {
|
||||
const tokens = { ...defaultTokens };
|
||||
for (const k in props.supportedTokens) {
|
||||
const key = Number(k);
|
||||
tokens[key] = props.supportedTokens[key];
|
||||
const tokenList = props.supportedTokens[key];
|
||||
if (tokenList) {
|
||||
tokens[key] = tokenList;
|
||||
}
|
||||
}
|
||||
|
||||
return tokens;
|
||||
|
||||
@@ -464,7 +464,7 @@ export const ConnectedWalletDetails: React.FC<{
|
||||
)}
|
||||
|
||||
{/* Explorer link */}
|
||||
{chain?.explorers && (
|
||||
{chain?.explorers && chain.explorers[0]?.url && (
|
||||
<MenuLink
|
||||
href={chain.explorers[0].url + "/address/" + address}
|
||||
target="_blank"
|
||||
|
||||
@@ -11,9 +11,9 @@ export const ScreenContext = /* @__PURE__ */ createContext<Screen | undefined>(
|
||||
export function useScreen() {
|
||||
const walletConfigs = useWallets();
|
||||
const initialScreen =
|
||||
walletConfigs.length === 1 && !walletConfigs[0].selectUI
|
||||
(walletConfigs.length === 1 && !walletConfigs[0]?.selectUI
|
||||
? walletConfigs[0]
|
||||
: reservedScreens.main;
|
||||
: reservedScreens.main) || reservedScreens.main;
|
||||
|
||||
const [screen, setScreen] = useState<string | WalletConfig>(initialScreen);
|
||||
const prevInitialScreen = useRef(initialScreen);
|
||||
|
||||
@@ -42,7 +42,11 @@ export function SendFunds(props: { supportedTokens: SupportedTokens }) {
|
||||
props.supportedTokens[chainId] !== defaultTokens[chainId]
|
||||
) {
|
||||
// use the first token in the list as default selected
|
||||
defaultToken = props.supportedTokens[chainId][0];
|
||||
const tokensForChain = props.supportedTokens[chainId];
|
||||
const firstToken = tokensForChain && tokensForChain[0];
|
||||
if (firstToken) {
|
||||
defaultToken = firstToken;
|
||||
}
|
||||
}
|
||||
|
||||
const [token, setToken] = useState<TokenInfo | undefined>(defaultToken);
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"extends": "@thirdweb-dev/tsconfig/react-library.json",
|
||||
"include": ["."],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
"exclude": ["dist", "build", "node_modules"],
|
||||
"compilerOptions": {
|
||||
"noUncheckedIndexedAccess": true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 3.10.65
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1701](https://github.com/thirdweb-dev/js/pull/1701) [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Detect webGL platform
|
||||
|
||||
- [#1686](https://github.com/thirdweb-dev/js/pull/1686) [`15fe4779`](https://github.com/thirdweb-dev/js/commit/15fe4779f4b99e51afe214ac3ebb31f611089787) Thanks [@kien-ngo](https://github.com/kien-ngo)! - Update & add unit test for ERC1155 Enumerable
|
||||
|
||||
- Updated dependencies [[`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9)]:
|
||||
- @thirdweb-dev/storage@1.2.11
|
||||
|
||||
## 3.10.64
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "3.10.64",
|
||||
"version": "3.10.65",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -64,8 +64,9 @@ export function getChainProvider(
|
||||
|
||||
// if we still don't have an url fall back to just using the chainId or slug in the rpc and try that
|
||||
if (!rpcUrl) {
|
||||
rpcUrl = `https://${chainId || network}.rpc.thirdweb.com/${options.clientId || ""
|
||||
}`;
|
||||
rpcUrl = `https://${chainId || network}.rpc.thirdweb.com/${
|
||||
options.clientId || ""
|
||||
}`;
|
||||
}
|
||||
|
||||
if (!rpcUrl) {
|
||||
@@ -264,7 +265,9 @@ export function getProviderFromRpcUrl(
|
||||
headers["x-sdk-platform"] = bundleId
|
||||
? "react-native"
|
||||
: isBrowser()
|
||||
? "browser"
|
||||
? (window as any).bridge !== undefined
|
||||
? "webGL"
|
||||
: "browser"
|
||||
: "node";
|
||||
}
|
||||
const match = rpcUrl.match(/^(ws|http)s?:/i);
|
||||
@@ -285,18 +288,18 @@ export function getProviderFromRpcUrl(
|
||||
// Otherwise, create a new provider on the specific network
|
||||
const newProvider = chainId
|
||||
? // If we know the chainId we should use the StaticJsonRpcBatchProvider
|
||||
new StaticJsonRpcBatchProvider(
|
||||
{
|
||||
new StaticJsonRpcBatchProvider(
|
||||
{
|
||||
url: rpcUrl,
|
||||
headers,
|
||||
},
|
||||
chainId,
|
||||
)
|
||||
: // Otherwise fall back to the built in json rpc batch provider
|
||||
new providers.JsonRpcBatchProvider({
|
||||
url: rpcUrl,
|
||||
headers,
|
||||
},
|
||||
chainId,
|
||||
)
|
||||
: // Otherwise fall back to the built in json rpc batch provider
|
||||
new providers.JsonRpcBatchProvider({
|
||||
url: rpcUrl,
|
||||
headers,
|
||||
});
|
||||
});
|
||||
|
||||
// Save the provider in our cache
|
||||
RPC_PROVIDER_MAP.set(seralizedOpts, newProvider);
|
||||
|
||||
@@ -103,10 +103,12 @@ export class Erc1155Enumerable implements DetectableFeature {
|
||||
* @returns The NFT metadata for all NFTs in the contract.
|
||||
*/
|
||||
public async owned(walletAddress?: AddressOrEns): Promise<NFT[]> {
|
||||
const address = await resolveAddress(
|
||||
walletAddress || (await this.contractWrapper.getSignerAddress()),
|
||||
);
|
||||
const maxId = await this.contractWrapper.read("nextTokenIdToMint", []);
|
||||
const [address, maxId] = await Promise.all([
|
||||
resolveAddress(
|
||||
walletAddress || (await this.contractWrapper.getSignerAddress()),
|
||||
),
|
||||
this.contractWrapper.read("nextTokenIdToMint", []),
|
||||
]);
|
||||
const balances = await this.contractWrapper.read("balanceOfBatch", [
|
||||
Array(maxId.toNumber()).fill(address),
|
||||
Array.from(Array(maxId.toNumber()).keys()),
|
||||
@@ -120,15 +122,15 @@ export class Erc1155Enumerable implements DetectableFeature {
|
||||
};
|
||||
})
|
||||
.filter((b) => b.balance.gt(0));
|
||||
return await Promise.all(
|
||||
ownedBalances.map(async (b) => {
|
||||
const editionMetadata = await this.erc1155.get(b.tokenId.toString());
|
||||
return {
|
||||
...editionMetadata,
|
||||
owner: address,
|
||||
quantityOwned: b.balance.toString(),
|
||||
};
|
||||
}),
|
||||
);
|
||||
const nfts = (
|
||||
await Promise.all(
|
||||
ownedBalances.map((item) => this.erc1155.get(item.tokenId.toString())),
|
||||
)
|
||||
).map((editionMetadata, index) => ({
|
||||
...editionMetadata,
|
||||
owner: address,
|
||||
quantityOwned: ownedBalances[index].balance.toString(),
|
||||
}));
|
||||
return nfts;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,4 +259,34 @@ describe("Edition Contract", async () => {
|
||||
i++;
|
||||
});
|
||||
});
|
||||
|
||||
it("getOwned() should not return the ERC1155 if the supply is zero", async () => {
|
||||
// According to the code: .filter((b) => b.balance.gt(0));
|
||||
await bundleContract.mintBatch([
|
||||
{
|
||||
metadata: {
|
||||
name: "To be burned",
|
||||
},
|
||||
supply: 5,
|
||||
},
|
||||
{
|
||||
metadata: {
|
||||
name: "Test1",
|
||||
},
|
||||
supply: 5,
|
||||
},
|
||||
]);
|
||||
|
||||
// Burn the tokenId #0
|
||||
await bundleContract.burn(0, 5);
|
||||
const nfts = await bundleContract.getOwned(adminWallet.address);
|
||||
|
||||
// Only the editions from tokenId#1 should be returned
|
||||
// since the editions from #0 were burned
|
||||
expect(nfts).to.be.an("array").length(1);
|
||||
expect(nfts[0].owner).to.be.equal(adminWallet.address);
|
||||
expect(nfts[0].quantityOwned).to.be.equal("5");
|
||||
expect(nfts[0].supply).to.be.equal("5");
|
||||
expect(nfts[0].metadata.id).to.be.equal("1");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/storage
|
||||
|
||||
## 1.2.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1701](https://github.com/thirdweb-dev/js/pull/1701) [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Detect webGL platform
|
||||
|
||||
## 1.2.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/storage",
|
||||
"version": "1.2.10",
|
||||
"version": "1.2.11",
|
||||
"main": "dist/thirdweb-dev-storage.cjs.js",
|
||||
"module": "dist/thirdweb-dev-storage.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -107,7 +107,9 @@ export class StorageDownloader implements IStorageDownloader {
|
||||
) {
|
||||
headers = {
|
||||
...headers,
|
||||
authorization: `Bearer ${(globalThis as any).TW_AUTH_TOKEN as string}`,
|
||||
authorization: `Bearer ${
|
||||
(globalThis as any).TW_AUTH_TOKEN as string
|
||||
}`,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -118,7 +120,9 @@ export class StorageDownloader implements IStorageDownloader {
|
||||
) {
|
||||
headers = {
|
||||
...headers,
|
||||
authorization: `Bearer ${(globalThis as any).TW_CLI_AUTH_TOKEN as string}`,
|
||||
authorization: `Bearer ${
|
||||
(globalThis as any).TW_CLI_AUTH_TOKEN as string
|
||||
}`,
|
||||
};
|
||||
headers["x-authorize-wallet"] = "true";
|
||||
}
|
||||
@@ -128,8 +132,10 @@ export class StorageDownloader implements IStorageDownloader {
|
||||
headers["x-sdk-platform"] = bundleId
|
||||
? "react-native"
|
||||
: isBrowser()
|
||||
? "browser"
|
||||
: "node";
|
||||
? (window as any).bridge !== undefined
|
||||
? "webGL"
|
||||
: "browser"
|
||||
: "node";
|
||||
}
|
||||
|
||||
if (isTooManyRequests(resolvedUri)) {
|
||||
@@ -155,9 +161,10 @@ export class StorageDownloader implements IStorageDownloader {
|
||||
if (!("status" in resOrErr)) {
|
||||
// early exit if we don't have a status code
|
||||
throw new Error(
|
||||
`Request timed out after ${timeoutInSeconds} seconds. ${isTwGatewayUrl(resolvedUri)
|
||||
? "You can update the timeoutInSeconds option to increase the timeout."
|
||||
: "You're using a public IPFS gateway, pass in a clientId or secretKey for a reliable IPFS gateway."
|
||||
`Request timed out after ${timeoutInSeconds} seconds. ${
|
||||
isTwGatewayUrl(resolvedUri)
|
||||
? "You can update the timeoutInSeconds option to increase the timeout."
|
||||
: "You're using a public IPFS gateway, pass in a clientId or secretKey for a reliable IPFS gateway."
|
||||
}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -96,8 +96,9 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
|
||||
extensions = file.name.substring(extensionStartIndex);
|
||||
}
|
||||
}
|
||||
fileName = `${i + options.rewriteFileNames.fileStartNumber
|
||||
}${extensions}`;
|
||||
fileName = `${
|
||||
i + options.rewriteFileNames.fileStartNumber
|
||||
}${extensions}`;
|
||||
} else {
|
||||
fileName = `${file.name}`;
|
||||
}
|
||||
@@ -286,7 +287,13 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
|
||||
xhr.setRequestHeader("x-sdk-name", pkg.name);
|
||||
xhr.setRequestHeader(
|
||||
"x-sdk-platform",
|
||||
bundleId ? "react-native" : isBrowser() ? "browser" : "node",
|
||||
bundleId
|
||||
? "react-native"
|
||||
: isBrowser()
|
||||
? (window as any).bridge !== undefined
|
||||
? "webGL"
|
||||
: "browser"
|
||||
: "node",
|
||||
);
|
||||
|
||||
// if we have a authorization token on global context then add that to the headers, this is for the dashboard.
|
||||
@@ -311,10 +318,7 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
|
||||
"authorization",
|
||||
`Bearer ${(globalThis as any).TW_CLI_AUTH_TOKEN as string}`,
|
||||
);
|
||||
xhr.setRequestHeader(
|
||||
"x-authorize-wallet",
|
||||
`true`,
|
||||
);
|
||||
xhr.setRequestHeader("x-authorize-wallet", `true`);
|
||||
}
|
||||
|
||||
xhr.send(form as any);
|
||||
@@ -349,8 +353,9 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
|
||||
"TW_AUTH_TOKEN" in globalThis &&
|
||||
typeof (globalThis as any).TW_AUTH_TOKEN === "string"
|
||||
) {
|
||||
headers["authorization"] = `Bearer ${(globalThis as any).TW_AUTH_TOKEN as string
|
||||
}`;
|
||||
headers["authorization"] = `Bearer ${
|
||||
(globalThis as any).TW_AUTH_TOKEN as string
|
||||
}`;
|
||||
}
|
||||
|
||||
// CLI auth token
|
||||
@@ -359,8 +364,9 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
|
||||
"TW_CLI_AUTH_TOKEN" in globalThis &&
|
||||
typeof (globalThis as any).TW_CLI_AUTH_TOKEN === "string"
|
||||
) {
|
||||
headers["authorization"] = `Bearer ${(globalThis as any).TW_CLI_AUTH_TOKEN as string
|
||||
}`;
|
||||
headers["authorization"] = `Bearer ${
|
||||
(globalThis as any).TW_CLI_AUTH_TOKEN as string
|
||||
}`;
|
||||
headers["x-authorize-wallet"] = "true";
|
||||
}
|
||||
|
||||
@@ -379,7 +385,11 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
|
||||
"Unauthorized - You don't have permission to use this service.",
|
||||
);
|
||||
}
|
||||
throw new Error(`Failed to upload files to IPFS - ${res.status} - ${res.statusText} - ${await res.text()}`);
|
||||
throw new Error(
|
||||
`Failed to upload files to IPFS - ${res.status} - ${
|
||||
res.statusText
|
||||
} - ${await res.text()}`,
|
||||
);
|
||||
}
|
||||
|
||||
const body = await res.json();
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @thirdweb-dev/unity-js-bridge
|
||||
|
||||
## 0.2.83
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1688](https://github.com/thirdweb-dev/js/pull/1688) [`fde77a7e`](https://github.com/thirdweb-dev/js/commit/fde77a7e19a03b8c932785ec11a01710218c8acc) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Unity] Google login option for EWS
|
||||
|
||||
- Updated dependencies [[`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650), [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9), [`15fe4779`](https://github.com/thirdweb-dev/js/commit/15fe4779f4b99e51afe214ac3ebb31f611089787)]:
|
||||
- @thirdweb-dev/wallets@1.3.3
|
||||
- @thirdweb-dev/storage@1.2.11
|
||||
- @thirdweb-dev/sdk@3.10.65
|
||||
- @thirdweb-dev/auth@3.2.46
|
||||
|
||||
## 0.2.82
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/unity-js-bridge",
|
||||
"version": "0.2.82",
|
||||
"version": "0.2.83",
|
||||
"main": "dist/thirdweb-unity-bridge.js",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -77,6 +77,7 @@ interface TWBridge {
|
||||
password?: string,
|
||||
email?: string,
|
||||
personalWallet?: PossibleWallet,
|
||||
useGoogle?: string,
|
||||
) => Promise<string>;
|
||||
disconnect: () => Promise<void>;
|
||||
switchNetwork: (chainId: string) => Promise<void>;
|
||||
@@ -275,6 +276,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
password?: string,
|
||||
email?: string,
|
||||
personalWallet: PossibleWallet = "localWallet",
|
||||
useGoogle?: string,
|
||||
) {
|
||||
if (!this.activeSDK) {
|
||||
throw new Error("SDK not initialized");
|
||||
@@ -296,14 +298,23 @@ class ThirdwebBridge implements TWBridge {
|
||||
await magicLinkWallet.connect({ chainId: chainIdNumber, email: email });
|
||||
} else if (walletInstance.walletId === walletIds.embeddedWallet) {
|
||||
const embeddedWallet = walletInstance as EmbeddedWallet;
|
||||
if (!email) {
|
||||
throw new Error("Email is required for EmbeddedWallet");
|
||||
|
||||
if (useGoogle?.toLowerCase() === "true") {
|
||||
console.log("Using Google OAuth");
|
||||
await embeddedWallet.connect({
|
||||
chainId: chainIdNumber,
|
||||
loginType: "headless_google_oauth",
|
||||
});
|
||||
} else {
|
||||
if (!email) {
|
||||
throw new Error("Email is required for EmbeddedWallet");
|
||||
}
|
||||
await embeddedWallet.connect({
|
||||
chainId: chainIdNumber,
|
||||
email: email,
|
||||
loginType: "ui_email_otp",
|
||||
});
|
||||
}
|
||||
await embeddedWallet.connect({
|
||||
chainId: chainIdNumber,
|
||||
email: email,
|
||||
loginType: "ui_email_otp",
|
||||
});
|
||||
} else if (walletInstance.walletId === walletIds.paper) {
|
||||
const paperWallet = walletInstance as PaperWallet;
|
||||
if (!email) {
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# @thirdweb-dev/wallets
|
||||
|
||||
## 1.3.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1707](https://github.com/thirdweb-dev/js/pull/1707) [`6d3d76cf`](https://github.com/thirdweb-dev/js/commit/6d3d76cff8018015faa191a1f8bd4f34506a6650) Thanks [@MananTank](https://github.com/MananTank)! - Fix Unchecked Index accesses
|
||||
|
||||
- [#1701](https://github.com/thirdweb-dev/js/pull/1701) [`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Detect webGL platform
|
||||
|
||||
- Updated dependencies [[`04f2f7b8`](https://github.com/thirdweb-dev/js/commit/04f2f7b8ff5f19345d868fc515a24ccd6ffd0ab9), [`15fe4779`](https://github.com/thirdweb-dev/js/commit/15fe4779f4b99e51afe214ac3ebb31f611089787)]:
|
||||
- @thirdweb-dev/sdk@3.10.65
|
||||
|
||||
## 1.3.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/wallets",
|
||||
"version": "1.3.2",
|
||||
"version": "1.3.3",
|
||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
|
||||
|
||||
@@ -57,7 +57,7 @@ export class WalletConnectV2Handler extends WalletConnectHandler {
|
||||
|
||||
const sessions = this.#wcWallet.getActiveSessions();
|
||||
const keys = Object.keys(sessions);
|
||||
if (keys.length > 0) {
|
||||
if (keys[0]) {
|
||||
this.#session = sessions[keys[0]];
|
||||
}
|
||||
|
||||
@@ -90,19 +90,22 @@ export class WalletConnectV2Handler extends WalletConnectHandler {
|
||||
const namespaces: SessionTypes.Namespaces = {};
|
||||
Object.keys(requiredNamespaces).forEach((key) => {
|
||||
const accounts: string[] = [];
|
||||
requiredNamespaces[key].chains?.map((chain: string) => {
|
||||
accounts.push(`${chain}:${account}`);
|
||||
});
|
||||
namespaces[key] = {
|
||||
accounts,
|
||||
methods: requiredNamespaces[key].methods,
|
||||
events: requiredNamespaces[key].events,
|
||||
};
|
||||
const namespace = requiredNamespaces[key];
|
||||
if (namespace) {
|
||||
namespace.chains?.map((chain: string) => {
|
||||
accounts.push(`${chain}:${account}`);
|
||||
});
|
||||
namespaces[key] = {
|
||||
accounts,
|
||||
methods: namespace.methods,
|
||||
events: namespace.events,
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
this.#session = await this.#wcWallet.approveSession({
|
||||
id,
|
||||
relayProtocol: relays[0].protocol,
|
||||
relayProtocol: relays[0]?.protocol,
|
||||
namespaces,
|
||||
});
|
||||
|
||||
@@ -142,7 +145,7 @@ export class WalletConnectV2Handler extends WalletConnectHandler {
|
||||
case EIP155_SIGNING_METHODS.PERSONAL_SIGN:
|
||||
case EIP155_SIGNING_METHODS.ETH_SIGN:
|
||||
const message = this.#getSignParamsMessage(request.params);
|
||||
const signedMessage = await wallet.signMessage(message);
|
||||
const signedMessage = await wallet.signMessage(message || ""); // TODO: handle empty message
|
||||
|
||||
response = formatJsonRpcResult(id, signedMessage);
|
||||
break;
|
||||
@@ -224,15 +227,19 @@ export class WalletConnectV2Handler extends WalletConnectHandler {
|
||||
|
||||
const thisSessions = [];
|
||||
for (const sessionKey of sessionKeys) {
|
||||
const topic = sessions[sessionKey].topic;
|
||||
const peerMeta = sessions[sessionKey].peer.metadata;
|
||||
const session = sessions[sessionKey];
|
||||
|
||||
thisSessions.push({
|
||||
topic,
|
||||
peer: {
|
||||
metadata: peerMeta,
|
||||
},
|
||||
});
|
||||
if (session) {
|
||||
const topic = session.topic;
|
||||
const peerMeta = session.peer.metadata;
|
||||
|
||||
thisSessions.push({
|
||||
topic,
|
||||
peer: {
|
||||
metadata: peerMeta,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return thisSessions;
|
||||
@@ -346,7 +353,7 @@ export class WalletConnectV2Handler extends WalletConnectHandler {
|
||||
* If it is a hex string, it gets converted to utf8 string
|
||||
*/
|
||||
#getSignParamsMessage(params: string[]) {
|
||||
const message = params.filter((p) => !utils.isAddress(p))[0];
|
||||
const message = params.filter((p) => !utils.isAddress(p))[0] || ""; // TODO: handle empty message
|
||||
|
||||
if (utils.isHexString(message)) {
|
||||
return utils.toUtf8String(message);
|
||||
|
||||
@@ -114,7 +114,7 @@ export class BloctoConnector extends WagmiConnector<
|
||||
getProvider({ chainId }: { chainId?: number } = {}): Promise<BloctoProvider> {
|
||||
if (!this.#provider) {
|
||||
const _chainId =
|
||||
chainId ?? this.options.chainId ?? this.chains[0].chainId;
|
||||
chainId ?? this.options.chainId ?? this.chains[0]?.chainId ?? 1;
|
||||
const _rpc = this.chains.find((x) => x.chainId === _chainId)?.rpc[0];
|
||||
|
||||
this.#provider = new BloctoSDK({
|
||||
|
||||
@@ -150,7 +150,7 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
||||
}
|
||||
|
||||
const signer = await this.user?.wallet.getEthersJsSigner({
|
||||
rpcEndpoint: this.options.chain.rpc[0],
|
||||
rpcEndpoint: this.options.chain.rpc[0] || "", // TODO: handle chain.rpc being empty array
|
||||
});
|
||||
|
||||
if (!signer) {
|
||||
@@ -177,7 +177,7 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
||||
|
||||
// update signer
|
||||
this.#signer = await this.user?.wallet.getEthersJsSigner({
|
||||
rpcEndpoint: chain.rpc[0],
|
||||
rpcEndpoint: chain.rpc[0] || "", // TODO: handle chain.rpc being empty array
|
||||
});
|
||||
|
||||
this.emit("change", { chain: { id: chainId, unsupported: false } });
|
||||
|
||||
@@ -98,7 +98,9 @@ export abstract class MagicBaseConnector extends WagmiConnector<
|
||||
if (accounts.length === 0) {
|
||||
this.emit("disconnect");
|
||||
} else {
|
||||
this.emit("change", { account: utils.getAddress(accounts[0]) });
|
||||
if (accounts[0]) {
|
||||
this.emit("change", { account: utils.getAddress(accounts[0]) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +266,7 @@ export class MagicAuthConnector extends MagicBaseConnector {
|
||||
const chain = this.chains.find((c) => c.chainId === chainId);
|
||||
if (chain) {
|
||||
options.network = {
|
||||
rpcUrl: chain.rpc[0],
|
||||
rpcUrl: chain.rpc[0] || "", // TODO handle empty RPC array
|
||||
chainId: chain.chainId,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ export class PaperWalletConnector extends Connector<Record<string, never>> {
|
||||
}
|
||||
|
||||
const signer = await this.user?.wallet.getEthersJsSigner({
|
||||
rpcEndpoint: this.options.chain.rpc[0],
|
||||
rpcEndpoint: this.options.chain.rpc[0] || "", // TODO: handle chain.rpc being empty array
|
||||
});
|
||||
|
||||
if (!signer) {
|
||||
@@ -218,7 +218,7 @@ export class PaperWalletConnector extends Connector<Record<string, never>> {
|
||||
|
||||
// update signer
|
||||
this.#signer = await this.user?.wallet.getEthersJsSigner({
|
||||
rpcEndpoint: chain.rpc[0],
|
||||
rpcEndpoint: chain.rpc[0] || "", // TODO: handle chain.rpc being empty array
|
||||
});
|
||||
|
||||
this.emit("change", { chain: { id: chainId, unsupported: false } });
|
||||
|
||||
@@ -259,7 +259,9 @@ export class SafeConnector extends Connector<SafeConnectionArgs> {
|
||||
if (accounts.length === 0) {
|
||||
this.emit("disconnect");
|
||||
} else {
|
||||
this.emit("change", { account: ethers.utils.getAddress(accounts[0]) });
|
||||
if (accounts[0]) {
|
||||
this.emit("change", { account: ethers.utils.getAddress(accounts[0]) });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,7 +152,11 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
(item) =>
|
||||
ethers.utils.getAddress(item.signer) ===
|
||||
ethers.utils.getAddress(signerAddress),
|
||||
)[0].permissions;
|
||||
)[0]?.permissions;
|
||||
|
||||
if (!restrictions) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return restrictions.approvedCallTargets.includes(transaction.getTarget());
|
||||
}
|
||||
|
||||
@@ -368,8 +368,9 @@ export abstract class BaseAccountAPI {
|
||||
...userOp,
|
||||
paymasterAndData: "0x",
|
||||
};
|
||||
modifiedOp.preVerificationGas =
|
||||
await this.getPreVerificationGas(modifiedOp);
|
||||
modifiedOp.preVerificationGas = await this.getPreVerificationGas(
|
||||
modifiedOp,
|
||||
);
|
||||
return {
|
||||
...modifiedOp,
|
||||
signature: "",
|
||||
@@ -420,7 +421,7 @@ export abstract class BaseAccountAPI {
|
||||
const events = await this.entryPointView.queryFilter(
|
||||
this.entryPointView.filters.UserOperationEvent(userOpHash),
|
||||
);
|
||||
if (events.length > 0) {
|
||||
if (events[0]) {
|
||||
return events[0].transactionHash;
|
||||
}
|
||||
await new Promise((resolve) => setTimeout(resolve, interval));
|
||||
|
||||
@@ -74,7 +74,9 @@ export class HttpRpcClient {
|
||||
headers["x-sdk-platform"] = bundleId
|
||||
? "react-native"
|
||||
: isBrowser()
|
||||
? "browser"
|
||||
? (window as any).bridge !== undefined
|
||||
? "webGL"
|
||||
: "browser"
|
||||
: "node";
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ export class WalletConnectConnector extends WagmiConnector<
|
||||
|
||||
// If session exists and chains are authorized, enable provider for required chain
|
||||
const accounts = await provider.enable();
|
||||
if (accounts.length === 0) {
|
||||
if (!accounts[0]) {
|
||||
throw new Error("No accounts found on provider.");
|
||||
}
|
||||
const account = utils.getAddress(accounts[0]);
|
||||
@@ -206,7 +206,7 @@ export class WalletConnectConnector extends WagmiConnector<
|
||||
|
||||
async getAccount() {
|
||||
const { accounts } = await this.getProvider();
|
||||
if (accounts.length === 0) {
|
||||
if (!accounts[0]) {
|
||||
throw new Error("No accounts found on provider.");
|
||||
}
|
||||
return utils.getAddress(accounts[0]);
|
||||
@@ -282,8 +282,9 @@ export class WalletConnectConnector extends WagmiConnector<
|
||||
const isChainApproved = namespaceChains.includes(chainId);
|
||||
|
||||
if (!isChainApproved && namespaceMethods.includes(ADD_ETH_CHAIN_METHOD)) {
|
||||
const blockExplorerUrls = chain.explorers?.length
|
||||
? { blockExplorerUrls: [chain.explorers[0].url] }
|
||||
const firstExplorer = chain.explorers && chain.explorers[0];
|
||||
const blockExplorerUrls = firstExplorer
|
||||
? { blockExplorerUrls: [firstExplorer.url] }
|
||||
: {};
|
||||
await provider.request({
|
||||
method: ADD_ETH_CHAIN_METHOD,
|
||||
@@ -354,7 +355,10 @@ export class WalletConnectConnector extends WagmiConnector<
|
||||
icons: [this.options.dappMetadata.logoUrl || ""],
|
||||
},
|
||||
rpcMap: Object.fromEntries(
|
||||
this.filteredChains.map((chain) => [chain.chainId, chain.rpc[0]]),
|
||||
this.filteredChains.map((chain) => [
|
||||
chain.chainId,
|
||||
chain.rpc[0] || "", // TODO: handle chain.rpc being empty array
|
||||
]),
|
||||
),
|
||||
|
||||
qrModalOptions: this.options.qrModalOptions,
|
||||
@@ -463,7 +467,9 @@ export class WalletConnectConnector extends WagmiConnector<
|
||||
if (accounts.length === 0) {
|
||||
this.emit("disconnect");
|
||||
} else {
|
||||
this.emit("change", { account: utils.getAddress(accounts[0]) });
|
||||
if (accounts[0]) {
|
||||
this.emit("change", { account: utils.getAddress(accounts[0]) });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"extends": "@thirdweb-dev/tsconfig/sdk.json",
|
||||
"include": ["src", "types"],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
"exclude": ["dist", "build", "node_modules"],
|
||||
"compilerOptions": {
|
||||
"noUncheckedIndexedAccess": true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user