Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
c753641570 Version Packages (#1457)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-07 13:21:25 -07:00
Manan TankandGitHub 4b0e63dcc0 [wallets] Save oAuthRedirectResult when auto connecting Magic Link with social login (#1460) 2023-08-07 16:48:02 +00:00
6979810de5 Fix typo in auth error message (#1454)
Co-authored-by: Jonas Daniels <[email protected]>
2023-08-06 04:10:05 +00:00
Jonas DanielsandGitHub 4c37af49aa feat: allow overriding the upload server url for IpfsUploader (#1455) 2023-08-05 21:12:33 +00:00
34 changed files with 174 additions and 24 deletions
+1
View File
@@ -17,6 +17,7 @@ concurrency:
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }}
jobs:
build:
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/auth
## 3.2.28
### Patch Changes
- Updated dependencies [[`4b0e63dc`](https://github.com/thirdweb-dev/js/commit/4b0e63dcc0ca871ce9cef76f8a41ff290316741c)]:
- @thirdweb-dev/wallets@1.1.11
## 3.2.27
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.2.27",
"version": "3.2.28",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+33
View File
@@ -0,0 +1,33 @@
import type { Chain } from "../src/types";
export default {
"name": "Beam Testnet",
"chain": "BEAM",
"rpc": [
"https://beam-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/beam/testnet/rpc"
],
"features": [
{
"name": "EIP1559"
}
],
"faucets": [],
"nativeCurrency": {
"name": "Merit Circle",
"symbol": "MC",
"decimals": 18
},
"infoURL": "https://gaming.meritcircle.io",
"shortName": "BEAM",
"chainId": 13337,
"networkId": 13337,
"explorers": [
{
"name": "Beam Explorer",
"url": "https://subnets-test.avax.network/beam",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "beam-testnet"
} as const satisfies Chain;
+8
View File
@@ -1,5 +1,13 @@
# thirdweb
## 0.11.11
### Patch Changes
- Updated dependencies [[`4c37af49`](https://github.com/thirdweb-dev/js/commit/4c37af49aa4fa66beb8ffe8ef556068a29f3c5d4)]:
- @thirdweb-dev/storage@1.2.4
- @thirdweb-dev/sdk@3.10.47
## 0.11.10
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.11.10",
"version": "0.11.11",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/react-core
## 3.14.28
### Patch Changes
- [#1460](https://github.com/thirdweb-dev/js/pull/1460) [`4b0e63dc`](https://github.com/thirdweb-dev/js/commit/4b0e63dcc0ca871ce9cef76f8a41ff290316741c) Thanks [@MananTank](https://github.com/MananTank)! - Save `oAuthRedirectResult` when autoconnecting Magic Link via social login
- Updated dependencies [[`4c37af49`](https://github.com/thirdweb-dev/js/commit/4c37af49aa4fa66beb8ffe8ef556068a29f3c5d4), [`4b0e63dc`](https://github.com/thirdweb-dev/js/commit/4b0e63dcc0ca871ce9cef76f8a41ff290316741c)]:
- @thirdweb-dev/storage@1.2.4
- @thirdweb-dev/wallets@1.1.11
- @thirdweb-dev/sdk@3.10.47
- @thirdweb-dev/auth@3.2.28
## 3.14.27
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.14.27",
"version": "3.14.28",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -317,7 +317,7 @@ export function ThirdwebWalletProvider(
),
{
ms: autoConnectTimeout,
message: "Failed to Auto connect. Auto connect timed out.",
message: autoConnectTimeoutErrorMessage,
},
);
} catch (e) {
@@ -346,7 +346,7 @@ export function ThirdwebWalletProvider(
setConnectionStatus("connecting");
await timeoutPromise(wallet.autoConnect(walletInfo.connectParams), {
ms: autoConnectTimeout,
message: "Failed to Auto connect. Auto connect timed out.",
message: autoConnectTimeoutErrorMessage,
});
setConnectedWallet(wallet, walletInfo.connectParams, true);
} catch (e) {
@@ -552,3 +552,5 @@ function timeoutPromise<T>(
);
});
}
const autoConnectTimeoutErrorMessage = `Failed to Auto connect. Auto connect timed out. You can increase the timeout duration using the autoConnectTimeout prop on <ThirdwebProvider />`;
@@ -1,5 +1,7 @@
# @thirdweb-dev/react-native-compat
## 0.2.47
## 0.2.46
## 0.2.45
+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.46",
"version": "0.2.47",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/react-native
## 0.2.47
### Patch Changes
- Updated dependencies [[`4c37af49`](https://github.com/thirdweb-dev/js/commit/4c37af49aa4fa66beb8ffe8ef556068a29f3c5d4), [`4b0e63dc`](https://github.com/thirdweb-dev/js/commit/4b0e63dcc0ca871ce9cef76f8a41ff290316741c)]:
- @thirdweb-dev/storage@1.2.4
- @thirdweb-dev/react-core@3.14.28
- @thirdweb-dev/wallets@1.1.11
- @thirdweb-dev/sdk@3.10.47
## 0.2.46
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.2.46",
"version": "0.2.47",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/react
## 3.14.28
### Patch Changes
- Updated dependencies [[`4b0e63dc`](https://github.com/thirdweb-dev/js/commit/4b0e63dcc0ca871ce9cef76f8a41ff290316741c)]:
- @thirdweb-dev/react-core@3.14.28
- @thirdweb-dev/wallets@1.1.11
- @thirdweb-dev/sdk@3.10.47
## 3.14.27
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.14.27",
"version": "3.14.28",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
File diff suppressed because one or more lines are too long
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/sdk
## 3.10.47
### Patch Changes
- Updated dependencies [[`4c37af49`](https://github.com/thirdweb-dev/js/commit/4c37af49aa4fa66beb8ffe8ef556068a29f3c5d4)]:
- @thirdweb-dev/storage@1.2.4
## 3.10.46
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.10.46",
"version": "3.10.47",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
+9 -2
View File
@@ -266,7 +266,11 @@ export class ThirdwebSDK extends RPCConnectionHandler {
) {
const apiKeyType = typeof window !== "undefined" ? "clientId" : "secretKey";
let warnMessage = `No API key. Please provide a ${apiKeyType}. It is required to access thirdweb's services. You can create a key at https://thirdweb.com/create-api-key`;
if (typeof window === "undefined" && !options.secretKey) {
if (
typeof window === "undefined" &&
!options.secretKey &&
options.clientId
) {
warnMessage = `Please provide a secret key instead of the clientId. Create a new API Key at https://thirdweb.com/create-api-key`;
}
checkClientIdOrSecretKey(warnMessage, options.clientId, options.secretKey);
@@ -2194,7 +2198,10 @@ export class ContractDeployer extends RPCConnectionHandler {
version: string,
) {
const address = await resolveAddress(publisherAddress);
const publishedContract = await new ThirdwebSDK("polygon")
const publishedContract = await new ThirdwebSDK("polygon", {
clientId: this.options.clientId,
secretKey: this.options.secretKey,
})
.getPublisher()
.getVersion(address, contractName, version);
if (!publishedContract) {
+2
View File
@@ -7,6 +7,8 @@ describe("Error Handling", async () => {
it("should throw proper error on account with no balance", async () => {
const newSdk = ThirdwebSDK.fromSigner(
Wallet.createRandom().connect(sdk.getProvider()),
undefined,
{ secretKey: process.env.TW_SECRET_KEY },
);
try {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/service-utils
## 0.4.1
### Patch Changes
- [#1454](https://github.com/thirdweb-dev/js/pull/1454) [`6979810d`](https://github.com/thirdweb-dev/js/commit/6979810de5c3fc700c7b5b91ac1567d9cdf50607) Thanks [@nessup](https://github.com/nessup)! - Update error message
## 0.4.0
### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/service-utils",
"version": "0.4.0",
"version": "0.4.1",
"main": "dist/thirdweb-dev-service-utils.cjs.js",
"module": "dist/thirdweb-dev-service-utils.esm.js",
"exports": {
@@ -114,7 +114,7 @@ export async function authorize(
return {
authorized: false,
status: 500,
errorMessage: "Failed to account information.",
errorMessage: "Failed to get account information.",
errorCode: "FAILED_TO_ACCOUNT",
};
}
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/storage
## 1.2.4
### Patch Changes
- [#1455](https://github.com/thirdweb-dev/js/pull/1455) [`4c37af49`](https://github.com/thirdweb-dev/js/commit/4c37af49aa4fa66beb8ffe8ef556068a29f3c5d4) Thanks [@jnsdls](https://github.com/jnsdls)! - allow overriding the upload server url for IpfsUploader for advanced usage
## 1.2.3
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/storage",
"version": "1.2.3",
"version": "1.2.4",
"main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js",
"browser": {
+1
View File
@@ -67,6 +67,7 @@ export class ThirdwebStorage<T extends UploadOptions = IpfsUploadBatchOptions>
new IpfsUploader({
clientId: options?.clientId,
secretKey: options?.secretKey,
uploadServerUrl: options?.uploadServerUrl,
});
this.downloader =
options?.downloader ||
@@ -43,11 +43,13 @@ import FormData from "form-data";
*/
export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
public uploadWithGatewayUrl: boolean;
private uploadServerUrl: string;
private clientId?: string;
private secretKey?: string;
constructor(options?: IpfsUploaderOptions) {
this.uploadWithGatewayUrl = options?.uploadWithGatewayUrl || false;
this.uploadServerUrl = options?.uploadServerUrl || TW_UPLOAD_SERVER_URL;
this.clientId = options?.clientId;
this.secretKey = options?.secretKey;
}
@@ -268,7 +270,7 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
return reject(new Error("Unknown upload error occured"));
});
xhr.open("POST", `${TW_UPLOAD_SERVER_URL}/ipfs/upload`);
xhr.open("POST", `${this.uploadServerUrl}/ipfs/upload`);
if (this.secretKey) {
xhr.setRequestHeader("x-secret-key", this.secretKey);
@@ -323,7 +325,7 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
}`;
}
const res = await fetch(`${TW_UPLOAD_SERVER_URL}/ipfs/upload`, {
const res = await fetch(`${this.uploadServerUrl}/ipfs/upload`, {
method: "POST",
headers: {
...headers,
+1
View File
@@ -5,6 +5,7 @@ export type ThirdwebStorageOptions<T extends UploadOptions> = {
uploader?: IStorageUploader<T>;
downloader?: IStorageDownloader;
gatewayUrls?: GatewayUrls | string[];
uploadServerUrl?: string;
clientId?: string;
secretKey?: string;
};
+4
View File
@@ -56,6 +56,10 @@ export type IpfsUploaderOptions = {
* You can get an secretKey here: https://thirdweb.com/create-api-key
*/
secretKey?: string;
/**
* Optional upload server url to use instead of the default. (Advanced Usage)
*/
uploadServerUrl?: string;
};
/**
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/unity-js-bridge
## 0.2.65
### Patch Changes
- Updated dependencies [[`4c37af49`](https://github.com/thirdweb-dev/js/commit/4c37af49aa4fa66beb8ffe8ef556068a29f3c5d4), [`4b0e63dc`](https://github.com/thirdweb-dev/js/commit/4b0e63dcc0ca871ce9cef76f8a41ff290316741c)]:
- @thirdweb-dev/storage@1.2.4
- @thirdweb-dev/wallets@1.1.11
- @thirdweb-dev/sdk@3.10.47
- @thirdweb-dev/auth@3.2.28
## 0.2.64
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.64",
"version": "0.2.65",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/wallets
## 1.1.11
### Patch Changes
- [#1460](https://github.com/thirdweb-dev/js/pull/1460) [`4b0e63dc`](https://github.com/thirdweb-dev/js/commit/4b0e63dcc0ca871ce9cef76f8a41ff290316741c) Thanks [@MananTank](https://github.com/MananTank)! - Save `oAuthRedirectResult` when autoconnecting Magic Link via social login
- Updated dependencies []:
- @thirdweb-dev/sdk@3.10.47
## 1.1.10
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "1.1.10",
"version": "1.1.11",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
+16 -5
View File
@@ -5,7 +5,10 @@ import type {
MagicAuthConnectOptions,
MagicAuthConnector as MagicAuthConnectorType,
} from "../connectors/magic";
import { OAuthProvider as _OAuthProvider } from "@magic-ext/oauth";
import type {
OAuthProvider as _OAuthProvider,
OAuthRedirectResult,
} from "@magic-ext/oauth";
import { walletIds } from "../constants/walletIds";
export type MagicLinkAdditionalOptions = MagicAuthOptions;
@@ -19,6 +22,7 @@ export class MagicLink extends AbstractClientWallet<
> {
connector?: Connector;
magicConnector?: MagicAuthConnectorType;
oAuthRedirectResult?: OAuthRedirectResult;
static meta = {
iconURL:
@@ -72,10 +76,16 @@ export class MagicLink extends AbstractClientWallet<
await this.magicConnector?.initializeMagicSDK(options);
const magic = this.getMagic();
try {
await magic.oauth.getRedirectResult(); // required to do this for social login
} catch {
// ignore
if (typeof window !== "undefined") {
const url = new URL(window.location.href);
const isMagicRedirect = url.searchParams.get("magic_credential");
if (isMagicRedirect) {
try {
this.oAuthRedirectResult = await magic.oauth.getRedirectResult(); // required to do this for social login
} catch {
// ignore
}
}
}
const isLoggedIn = await magic.user.isLoggedIn();
@@ -87,6 +97,7 @@ export class MagicLink extends AbstractClientWallet<
}
async disconnect() {
this.oAuthRedirectResult = undefined;
const magic = this.getMagic();
await magic.user.logout();
return super.disconnect();