Compare commits

..
Author SHA1 Message Date
github-actions[bot]andgithub-actions[bot] 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 Tank 4b0e63dcc0 [wallets] Save oAuthRedirectResult when auto connecting Magic Link with social login (#1460) 2023-08-07 16:48:02 +00:00
Danny FridayandJonas Daniels 6979810de5 Fix typo in auth error message (#1454)
Co-authored-by: Jonas Daniels <[email protected]>
2023-08-06 04:10:05 +00:00
Jonas Daniels 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: env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
TW_SECRET_KEY: ${{ secrets.TW_SECRET_KEY }}
jobs: jobs:
build: build:
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/auth # @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 ## 3.2.27
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/auth", "name": "@thirdweb-dev/auth",
"version": "3.2.27", "version": "3.2.28",
"main": "dist/thirdweb-dev-auth.cjs.js", "main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js", "module": "dist/thirdweb-dev-auth.esm.js",
"browser": { "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 # 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 ## 0.11.10
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "thirdweb", "name": "thirdweb",
"main": "dist/cli/index.js", "main": "dist/cli/index.js",
"version": "0.11.10", "version": "0.11.11",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli", "repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "license": "Apache-2.0",
+12
View File
@@ -1,5 +1,17 @@
# @thirdweb-dev/react-core # @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 ## 3.14.27
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react-core", "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", "repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "license": "Apache-2.0",
@@ -317,7 +317,7 @@ export function ThirdwebWalletProvider(
), ),
{ {
ms: autoConnectTimeout, ms: autoConnectTimeout,
message: "Failed to Auto connect. Auto connect timed out.", message: autoConnectTimeoutErrorMessage,
}, },
); );
} catch (e) { } catch (e) {
@@ -346,7 +346,7 @@ export function ThirdwebWalletProvider(
setConnectionStatus("connecting"); setConnectionStatus("connecting");
await timeoutPromise(wallet.autoConnect(walletInfo.connectParams), { await timeoutPromise(wallet.autoConnect(walletInfo.connectParams), {
ms: autoConnectTimeout, ms: autoConnectTimeout,
message: "Failed to Auto connect. Auto connect timed out.", message: autoConnectTimeoutErrorMessage,
}); });
setConnectedWallet(wallet, walletInfo.connectParams, true); setConnectedWallet(wallet, walletInfo.connectParams, true);
} catch (e) { } 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 # @thirdweb-dev/react-native-compat
## 0.2.47
## 0.2.46 ## 0.2.46
## 0.2.45 ## 0.2.45
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "@thirdweb-dev/react-native-compat", "name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects", "description": "Shims for Thirdweb in React Native Projects",
"version": "0.2.46", "version": "0.2.47",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat", "repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0", "license": "Apache-2.0",
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/react-native # @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 ## 0.2.46
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react-native", "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", "repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/react # @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 ## 3.14.27
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/react", "name": "@thirdweb-dev/react",
"version": "3.14.27", "version": "3.14.28",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react", "repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>", "author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0", "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 # @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 ## 3.10.46
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/sdk", "name": "@thirdweb-dev/sdk",
"version": "3.10.46", "version": "3.10.47",
"description": "The main thirdweb SDK.", "description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk", "repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0", "license": "Apache-2.0",
+9 -2
View File
@@ -266,7 +266,11 @@ export class ThirdwebSDK extends RPCConnectionHandler {
) { ) {
const apiKeyType = typeof window !== "undefined" ? "clientId" : "secretKey"; 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`; 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`; 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); checkClientIdOrSecretKey(warnMessage, options.clientId, options.secretKey);
@@ -2194,7 +2198,10 @@ export class ContractDeployer extends RPCConnectionHandler {
version: string, version: string,
) { ) {
const address = await resolveAddress(publisherAddress); 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() .getPublisher()
.getVersion(address, contractName, version); .getVersion(address, contractName, version);
if (!publishedContract) { if (!publishedContract) {
+2
View File
@@ -7,6 +7,8 @@ describe("Error Handling", async () => {
it("should throw proper error on account with no balance", async () => { it("should throw proper error on account with no balance", async () => {
const newSdk = ThirdwebSDK.fromSigner( const newSdk = ThirdwebSDK.fromSigner(
Wallet.createRandom().connect(sdk.getProvider()), Wallet.createRandom().connect(sdk.getProvider()),
undefined,
{ secretKey: process.env.TW_SECRET_KEY },
); );
try { try {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/service-utils # @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 ## 0.4.0
### Minor Changes ### Minor Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/service-utils", "name": "@thirdweb-dev/service-utils",
"version": "0.4.0", "version": "0.4.1",
"main": "dist/thirdweb-dev-service-utils.cjs.js", "main": "dist/thirdweb-dev-service-utils.cjs.js",
"module": "dist/thirdweb-dev-service-utils.esm.js", "module": "dist/thirdweb-dev-service-utils.esm.js",
"exports": { "exports": {
@@ -114,7 +114,7 @@ export async function authorize(
return { return {
authorized: false, authorized: false,
status: 500, status: 500,
errorMessage: "Failed to account information.", errorMessage: "Failed to get account information.",
errorCode: "FAILED_TO_ACCOUNT", errorCode: "FAILED_TO_ACCOUNT",
}; };
} }
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/storage # @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 ## 1.2.3
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/storage", "name": "@thirdweb-dev/storage",
"version": "1.2.3", "version": "1.2.4",
"main": "dist/thirdweb-dev-storage.cjs.js", "main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js", "module": "dist/thirdweb-dev-storage.esm.js",
"browser": { "browser": {
+1
View File
@@ -67,6 +67,7 @@ export class ThirdwebStorage<T extends UploadOptions = IpfsUploadBatchOptions>
new IpfsUploader({ new IpfsUploader({
clientId: options?.clientId, clientId: options?.clientId,
secretKey: options?.secretKey, secretKey: options?.secretKey,
uploadServerUrl: options?.uploadServerUrl,
}); });
this.downloader = this.downloader =
options?.downloader || options?.downloader ||
@@ -43,11 +43,13 @@ import FormData from "form-data";
*/ */
export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> { export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
public uploadWithGatewayUrl: boolean; public uploadWithGatewayUrl: boolean;
private uploadServerUrl: string;
private clientId?: string; private clientId?: string;
private secretKey?: string; private secretKey?: string;
constructor(options?: IpfsUploaderOptions) { constructor(options?: IpfsUploaderOptions) {
this.uploadWithGatewayUrl = options?.uploadWithGatewayUrl || false; this.uploadWithGatewayUrl = options?.uploadWithGatewayUrl || false;
this.uploadServerUrl = options?.uploadServerUrl || TW_UPLOAD_SERVER_URL;
this.clientId = options?.clientId; this.clientId = options?.clientId;
this.secretKey = options?.secretKey; this.secretKey = options?.secretKey;
} }
@@ -268,7 +270,7 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
return reject(new Error("Unknown upload error occured")); 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) { if (this.secretKey) {
xhr.setRequestHeader("x-secret-key", 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", method: "POST",
headers: { headers: {
...headers, ...headers,
+1
View File
@@ -5,6 +5,7 @@ export type ThirdwebStorageOptions<T extends UploadOptions> = {
uploader?: IStorageUploader<T>; uploader?: IStorageUploader<T>;
downloader?: IStorageDownloader; downloader?: IStorageDownloader;
gatewayUrls?: GatewayUrls | string[]; gatewayUrls?: GatewayUrls | string[];
uploadServerUrl?: string;
clientId?: string; clientId?: string;
secretKey?: 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 * You can get an secretKey here: https://thirdweb.com/create-api-key
*/ */
secretKey?: string; 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 # @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 ## 0.2.64
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/unity-js-bridge", "name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.64", "version": "0.2.65",
"main": "dist/thirdweb-unity-bridge.js", "main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge", "repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0", "license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/wallets # @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 ## 1.1.10
### Patch Changes ### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@thirdweb-dev/wallets", "name": "@thirdweb-dev/wallets",
"version": "1.1.10", "version": "1.1.11",
"main": "dist/thirdweb-dev-wallets.cjs.js", "main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js", "module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts", "types": "dist/thirdweb-dev-wallets.cjs.d.ts",
+16 -5
View File
@@ -5,7 +5,10 @@ import type {
MagicAuthConnectOptions, MagicAuthConnectOptions,
MagicAuthConnector as MagicAuthConnectorType, MagicAuthConnector as MagicAuthConnectorType,
} from "../connectors/magic"; } 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"; import { walletIds } from "../constants/walletIds";
export type MagicLinkAdditionalOptions = MagicAuthOptions; export type MagicLinkAdditionalOptions = MagicAuthOptions;
@@ -19,6 +22,7 @@ export class MagicLink extends AbstractClientWallet<
> { > {
connector?: Connector; connector?: Connector;
magicConnector?: MagicAuthConnectorType; magicConnector?: MagicAuthConnectorType;
oAuthRedirectResult?: OAuthRedirectResult;
static meta = { static meta = {
iconURL: iconURL:
@@ -72,10 +76,16 @@ export class MagicLink extends AbstractClientWallet<
await this.magicConnector?.initializeMagicSDK(options); await this.magicConnector?.initializeMagicSDK(options);
const magic = this.getMagic(); const magic = this.getMagic();
try { if (typeof window !== "undefined") {
await magic.oauth.getRedirectResult(); // required to do this for social login const url = new URL(window.location.href);
} catch { const isMagicRedirect = url.searchParams.get("magic_credential");
// ignore if (isMagicRedirect) {
try {
this.oAuthRedirectResult = await magic.oauth.getRedirectResult(); // required to do this for social login
} catch {
// ignore
}
}
} }
const isLoggedIn = await magic.user.isLoggedIn(); const isLoggedIn = await magic.user.isLoggedIn();
@@ -87,6 +97,7 @@ export class MagicLink extends AbstractClientWallet<
} }
async disconnect() { async disconnect() {
this.oAuthRedirectResult = undefined;
const magic = this.getMagic(); const magic = this.getMagic();
await magic.user.logout(); await magic.user.logout();
return super.disconnect(); return super.disconnect();