Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cc38b0680 | ||
|
|
7abb36a7ec | ||
|
|
6832b19fc5 | ||
|
|
1c4cbedb6a | ||
|
|
8ff87be631 | ||
|
|
e43beec36a |
@@ -1,5 +1,12 @@
|
|||||||
# @thirdweb-dev/auth
|
# @thirdweb-dev/auth
|
||||||
|
|
||||||
|
## 4.1.10
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`6832b19f`](https://github.com/thirdweb-dev/js/commit/6832b19fc5eedc7c17e69940a361840de0a84881), [`7abb36a7`](https://github.com/thirdweb-dev/js/commit/7abb36a7ec39766dd7da03015ccef401ef7a7863), [`1c4cbedb`](https://github.com/thirdweb-dev/js/commit/1c4cbedb6a3c9f9014ffbf83c02b998768958d96)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.7
|
||||||
|
|
||||||
## 4.1.9
|
## 4.1.9
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/auth",
|
"name": "@thirdweb-dev/auth",
|
||||||
"version": "4.1.9",
|
"version": "4.1.10",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# thirdweb
|
# thirdweb
|
||||||
|
|
||||||
|
## 0.13.18
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`6832b19f`](https://github.com/thirdweb-dev/js/commit/6832b19fc5eedc7c17e69940a361840de0a84881), [`7abb36a7`](https://github.com/thirdweb-dev/js/commit/7abb36a7ec39766dd7da03015ccef401ef7a7863), [`1c4cbedb`](https://github.com/thirdweb-dev/js/commit/1c4cbedb6a3c9f9014ffbf83c02b998768958d96), [`e43beec3`](https://github.com/thirdweb-dev/js/commit/e43beec36a569211b6fe708107aa7dc04bff08ec)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.7
|
||||||
|
- @thirdweb-dev/sdk@4.0.15
|
||||||
|
- @thirdweb-dev/auth@4.1.10
|
||||||
|
|
||||||
## 0.13.17
|
## 0.13.17
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "thirdweb",
|
"name": "thirdweb",
|
||||||
"main": "dist/cli/index.js",
|
"main": "dist/cli/index.js",
|
||||||
"version": "0.13.17",
|
"version": "0.13.18",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# @thirdweb-dev/react-core
|
# @thirdweb-dev/react-core
|
||||||
|
|
||||||
|
## 4.1.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`6832b19f`](https://github.com/thirdweb-dev/js/commit/6832b19fc5eedc7c17e69940a361840de0a84881), [`7abb36a7`](https://github.com/thirdweb-dev/js/commit/7abb36a7ec39766dd7da03015ccef401ef7a7863), [`1c4cbedb`](https://github.com/thirdweb-dev/js/commit/1c4cbedb6a3c9f9014ffbf83c02b998768958d96), [`e43beec3`](https://github.com/thirdweb-dev/js/commit/e43beec36a569211b6fe708107aa7dc04bff08ec)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.7
|
||||||
|
- @thirdweb-dev/sdk@4.0.15
|
||||||
|
- @thirdweb-dev/auth@4.1.10
|
||||||
|
|
||||||
## 4.1.7
|
## 4.1.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-core",
|
"name": "@thirdweb-dev/react-core",
|
||||||
"version": "4.1.7",
|
"version": "4.1.8",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# @thirdweb-dev/react-native-compat
|
# @thirdweb-dev/react-native-compat
|
||||||
|
|
||||||
|
## 0.4.8
|
||||||
|
|
||||||
## 0.4.7
|
## 0.4.7
|
||||||
|
|
||||||
## 0.4.6
|
## 0.4.6
|
||||||
|
|||||||
@@ -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.4.7",
|
"version": "0.4.8",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# @thirdweb-dev/react-native
|
# @thirdweb-dev/react-native
|
||||||
|
|
||||||
|
## 0.4.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`6832b19f`](https://github.com/thirdweb-dev/js/commit/6832b19fc5eedc7c17e69940a361840de0a84881), [`7abb36a7`](https://github.com/thirdweb-dev/js/commit/7abb36a7ec39766dd7da03015ccef401ef7a7863), [`1c4cbedb`](https://github.com/thirdweb-dev/js/commit/1c4cbedb6a3c9f9014ffbf83c02b998768958d96), [`e43beec3`](https://github.com/thirdweb-dev/js/commit/e43beec36a569211b6fe708107aa7dc04bff08ec)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.7
|
||||||
|
- @thirdweb-dev/sdk@4.0.15
|
||||||
|
- @thirdweb-dev/react-core@4.1.8
|
||||||
|
|
||||||
## 0.4.7
|
## 0.4.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native",
|
"name": "@thirdweb-dev/react-native",
|
||||||
"version": "0.4.7",
|
"version": "0.4.8",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# @thirdweb-dev/react
|
# @thirdweb-dev/react
|
||||||
|
|
||||||
|
## 4.1.8
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`6832b19f`](https://github.com/thirdweb-dev/js/commit/6832b19fc5eedc7c17e69940a361840de0a84881), [`7abb36a7`](https://github.com/thirdweb-dev/js/commit/7abb36a7ec39766dd7da03015ccef401ef7a7863), [`1c4cbedb`](https://github.com/thirdweb-dev/js/commit/1c4cbedb6a3c9f9014ffbf83c02b998768958d96), [`e43beec3`](https://github.com/thirdweb-dev/js/commit/e43beec36a569211b6fe708107aa7dc04bff08ec)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.7
|
||||||
|
- @thirdweb-dev/sdk@4.0.15
|
||||||
|
- @thirdweb-dev/react-core@4.1.8
|
||||||
|
|
||||||
## 4.1.7
|
## 4.1.7
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react",
|
"name": "@thirdweb-dev/react",
|
||||||
"version": "4.1.7",
|
"version": "4.1.8",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/sdk
|
# @thirdweb-dev/sdk
|
||||||
|
|
||||||
|
## 4.0.15
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1935](https://github.com/thirdweb-dev/js/pull/1935) [`e43beec3`](https://github.com/thirdweb-dev/js/commit/e43beec36a569211b6fe708107aa7dc04bff08ec) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Resolve diamond pattern facets ABIs
|
||||||
|
|
||||||
## 4.0.14
|
## 4.0.14
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/sdk",
|
"name": "@thirdweb-dev/sdk",
|
||||||
"version": "4.0.14",
|
"version": "4.0.15",
|
||||||
"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",
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Abi, AbiSchema } from "../../schema/contracts/custom";
|
|||||||
import { SDKOptions } from "../../schema/sdk-options";
|
import { SDKOptions } from "../../schema/sdk-options";
|
||||||
import { isExtensionEnabled } from "../feature-detection/isFeatureEnabled";
|
import { isExtensionEnabled } from "../feature-detection/isFeatureEnabled";
|
||||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||||
import { providers } from "ethers";
|
import { Contract, providers } from "ethers";
|
||||||
import { joinABIs } from "./joinABIs";
|
import { joinABIs } from "./joinABIs";
|
||||||
import { getPluginABI } from "./getPluginABI";
|
import { getPluginABI } from "./getPluginABI";
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export async function getCompositeABI(
|
|||||||
let pluginABIs: Abi[] = [];
|
let pluginABIs: Abi[] = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// check if contract is plugin-pattern
|
// check if contract is plugin-pattern / dynamic
|
||||||
const isPluginRouter: boolean = isExtensionEnabled(
|
const isPluginRouter: boolean = isExtensionEnabled(
|
||||||
AbiSchema.parse(abi),
|
AbiSchema.parse(abi),
|
||||||
"PluginRouter",
|
"PluginRouter",
|
||||||
@@ -33,6 +33,13 @@ export async function getCompositeABI(
|
|||||||
AbiSchema.parse(abi),
|
AbiSchema.parse(abi),
|
||||||
"DynamicContract",
|
"DynamicContract",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// check if the contract has fallback function - we'll further check for diamond pattern if needed
|
||||||
|
const isFallback: boolean = isExtensionEnabled(
|
||||||
|
AbiSchema.parse(abi),
|
||||||
|
"Fallback",
|
||||||
|
);
|
||||||
|
|
||||||
if (isbaseRouter) {
|
if (isbaseRouter) {
|
||||||
const contract = new ContractWrapper(
|
const contract = new ContractWrapper(
|
||||||
provider,
|
provider,
|
||||||
@@ -68,6 +75,21 @@ export async function getCompositeABI(
|
|||||||
|
|
||||||
// get ABIs of extension contracts
|
// get ABIs of extension contracts
|
||||||
pluginABIs = await getPluginABI(plugins as any[], provider, storage);
|
pluginABIs = await getPluginABI(plugins as any[], provider, storage);
|
||||||
|
} else if (isFallback) {
|
||||||
|
// check if diamond pattern
|
||||||
|
const dimaondAbi = [
|
||||||
|
"function facets() external view returns (tuple(address,bytes4[])[])",
|
||||||
|
];
|
||||||
|
const contract = new Contract(address, dimaondAbi, provider);
|
||||||
|
|
||||||
|
// get facets
|
||||||
|
const facets = await contract.facets();
|
||||||
|
|
||||||
|
// filter facet addresses
|
||||||
|
const facetAddresses = facets.map((item: any) => item[0]);
|
||||||
|
|
||||||
|
// get ABI of facets
|
||||||
|
pluginABIs = await getPluginABI(facetAddresses, provider, storage);
|
||||||
}
|
}
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ import {
|
|||||||
FEATURE_ACCOUNT_FACTORY,
|
FEATURE_ACCOUNT_FACTORY,
|
||||||
FEATURE_ACCOUNT_PERMISSIONS,
|
FEATURE_ACCOUNT_PERMISSIONS,
|
||||||
FEATURE_ACCOUNT_PERMISSIONS_V1,
|
FEATURE_ACCOUNT_PERMISSIONS_V1,
|
||||||
|
FEATURE_FALLBACK,
|
||||||
} from "./thirdweb-features";
|
} from "./thirdweb-features";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,7 +149,8 @@ export type Feature =
|
|||||||
| typeof FEATURE_ACCOUNT
|
| typeof FEATURE_ACCOUNT
|
||||||
| typeof FEATURE_ACCOUNT_PERMISSIONS
|
| typeof FEATURE_ACCOUNT_PERMISSIONS
|
||||||
| typeof FEATURE_ACCOUNT_PERMISSIONS_V1
|
| typeof FEATURE_ACCOUNT_PERMISSIONS_V1
|
||||||
| typeof FEATURE_ACCOUNT_FACTORY;
|
| typeof FEATURE_ACCOUNT_FACTORY
|
||||||
|
| typeof FEATURE_FALLBACK;
|
||||||
|
|
||||||
export type Extension = Feature;
|
export type Extension = Feature;
|
||||||
|
|
||||||
@@ -197,4 +199,5 @@ export const SUPPORTED_FEATURES: Record<string, Feature> = /* @__PURE__ */ {
|
|||||||
[FEATURE_ACCOUNT.name]: FEATURE_ACCOUNT,
|
[FEATURE_ACCOUNT.name]: FEATURE_ACCOUNT,
|
||||||
[FEATURE_NFT_LOYALTY_CARD.name]: FEATURE_NFT_LOYALTY_CARD,
|
[FEATURE_NFT_LOYALTY_CARD.name]: FEATURE_NFT_LOYALTY_CARD,
|
||||||
[FEATURE_NFT_UPDATABLE_METADATA.name]: FEATURE_NFT_UPDATABLE_METADATA,
|
[FEATURE_NFT_UPDATABLE_METADATA.name]: FEATURE_NFT_UPDATABLE_METADATA,
|
||||||
|
[FEATURE_FALLBACK.name]: FEATURE_FALLBACK,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,6 +19,13 @@ import IAccountPermissions from "@thirdweb-dev/contracts-js/dist/abis/IAccountPe
|
|||||||
import IAccountPermissionsV1 from "@thirdweb-dev/contracts-js/dist/abis/IAccountPermissions_V1.json";
|
import IAccountPermissionsV1 from "@thirdweb-dev/contracts-js/dist/abis/IAccountPermissions_V1.json";
|
||||||
import IAccount from "@thirdweb-dev/contracts-js/dist/abis/IAccount.json";
|
import IAccount from "@thirdweb-dev/contracts-js/dist/abis/IAccount.json";
|
||||||
|
|
||||||
|
export const fallbackAbi = [
|
||||||
|
{
|
||||||
|
stateMutability: "payable",
|
||||||
|
type: "fallback",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
export const getAllPluginsAbi = [
|
export const getAllPluginsAbi = [
|
||||||
{
|
{
|
||||||
inputs: [],
|
inputs: [],
|
||||||
@@ -370,3 +377,14 @@ export const FEATURE_AIRDROP_ERC1155 = {
|
|||||||
abis: [IAirdropERC1155],
|
abis: [IAirdropERC1155],
|
||||||
features: {},
|
features: {},
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
|
export const FEATURE_FALLBACK = {
|
||||||
|
name: "Fallback",
|
||||||
|
namespace: "fallback",
|
||||||
|
docLinks: {
|
||||||
|
sdk: "",
|
||||||
|
contracts: "",
|
||||||
|
},
|
||||||
|
abis: [fallbackAbi],
|
||||||
|
features: {},
|
||||||
|
} as const;
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ export { fetchSnapshotEntryForAddress } from "./common/claim-conditions/fetchSna
|
|||||||
export { getCachedAbiForContract } from "./common/abi";
|
export { getCachedAbiForContract } from "./common/abi";
|
||||||
export * from "./common/ens/resolveEns";
|
export * from "./common/ens/resolveEns";
|
||||||
export * from "./common/ens/resolveAddress";
|
export * from "./common/ens/resolveAddress";
|
||||||
|
export * from "./common/sign";
|
||||||
//#endregion @r/packages/sdk/src/evm/common/*
|
//#endregion @r/packages/sdk/src/evm/common/*
|
||||||
|
|
||||||
//#region @r/packages/sdk/src/evm/constants/*
|
//#region @r/packages/sdk/src/evm/constants/*
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/service-utils
|
# @thirdweb-dev/service-utils
|
||||||
|
|
||||||
|
## 0.4.9
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1976](https://github.com/thirdweb-dev/js/pull/1976) [`8ff87be6`](https://github.com/thirdweb-dev/js/commit/8ff87be631f1754b15e7ec4556d51e8eec5cbd18) Thanks [@arcoraven](https://github.com/arcoraven)! - Handle if error parsing JSON response in authorization helper
|
||||||
|
|
||||||
## 0.4.8
|
## 0.4.8
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/service-utils",
|
"name": "@thirdweb-dev/service-utils",
|
||||||
"version": "0.4.8",
|
"version": "0.4.9",
|
||||||
"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": {
|
||||||
|
|||||||
@@ -80,17 +80,16 @@ export async function fetchKeyMetadataFromApi(
|
|||||||
"content-type": "application/json",
|
"content-type": "application/json",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
let json: ApiResponse;
|
|
||||||
|
let text = "";
|
||||||
try {
|
try {
|
||||||
json = await response.json();
|
text = await response.text();
|
||||||
|
return JSON.parse(text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Error fetching key metadata from API: ${response.status} - ${
|
`Error fetching key metadata from API: ${response.status} - ${text}`,
|
||||||
response.statusText
|
|
||||||
} - ${await response.text()}`,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return json;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fetchAccountFromApi(
|
export async function fetchAccountFromApi(
|
||||||
@@ -110,17 +109,16 @@ export async function fetchAccountFromApi(
|
|||||||
authorization: `Bearer ${jwt}`,
|
authorization: `Bearer ${jwt}`,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
let json: ApiAccountResponse;
|
|
||||||
|
let text = "";
|
||||||
try {
|
try {
|
||||||
json = await response.json();
|
text = await response.text();
|
||||||
|
return JSON.parse(text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Error fetching account from API: ${response.status} - ${
|
`Error fetching account from API: ${response.status} - ${text}`,
|
||||||
response.statusText
|
|
||||||
} - ${await response.text()}`,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return json;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function updateRateLimitedAt(
|
export async function updateRateLimitedAt(
|
||||||
|
|||||||
@@ -1,5 +1,14 @@
|
|||||||
# @thirdweb-dev/unity-js-bridge
|
# @thirdweb-dev/unity-js-bridge
|
||||||
|
|
||||||
|
## 0.2.104
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`6832b19f`](https://github.com/thirdweb-dev/js/commit/6832b19fc5eedc7c17e69940a361840de0a84881), [`7abb36a7`](https://github.com/thirdweb-dev/js/commit/7abb36a7ec39766dd7da03015ccef401ef7a7863), [`1c4cbedb`](https://github.com/thirdweb-dev/js/commit/1c4cbedb6a3c9f9014ffbf83c02b998768958d96), [`e43beec3`](https://github.com/thirdweb-dev/js/commit/e43beec36a569211b6fe708107aa7dc04bff08ec)]:
|
||||||
|
- @thirdweb-dev/wallets@2.1.7
|
||||||
|
- @thirdweb-dev/sdk@4.0.15
|
||||||
|
- @thirdweb-dev/auth@4.1.10
|
||||||
|
|
||||||
## 0.2.103
|
## 0.2.103
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/unity-js-bridge",
|
"name": "@thirdweb-dev/unity-js-bridge",
|
||||||
"version": "0.2.103",
|
"version": "0.2.104",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1,5 +1,18 @@
|
|||||||
# @thirdweb-dev/wallets
|
# @thirdweb-dev/wallets
|
||||||
|
|
||||||
|
## 2.1.7
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#1977](https://github.com/thirdweb-dev/js/pull/1977) [`6832b19f`](https://github.com/thirdweb-dev/js/commit/6832b19fc5eedc7c17e69940a361840de0a84881) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix potential auto connection race condition
|
||||||
|
|
||||||
|
- [#1978](https://github.com/thirdweb-dev/js/pull/1978) [`7abb36a7`](https://github.com/thirdweb-dev/js/commit/7abb36a7ec39766dd7da03015ccef401ef7a7863) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Enforce authenticated users when getting embedded wallet signers
|
||||||
|
|
||||||
|
- [#1953](https://github.com/thirdweb-dev/js/pull/1953) [`1c4cbedb`](https://github.com/thirdweb-dev/js/commit/1c4cbedb6a3c9f9014ffbf83c02b998768958d96) Thanks [@nkrishang](https://github.com/nkrishang)! - Patched smart wallet signatures for updated eip-1271 sig verification
|
||||||
|
|
||||||
|
- Updated dependencies [[`e43beec3`](https://github.com/thirdweb-dev/js/commit/e43beec36a569211b6fe708107aa7dc04bff08ec)]:
|
||||||
|
- @thirdweb-dev/sdk@4.0.15
|
||||||
|
|
||||||
## 2.1.6
|
## 2.1.6
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/wallets",
|
"name": "@thirdweb-dev/wallets",
|
||||||
"version": "2.1.6",
|
"version": "2.1.7",
|
||||||
"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",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
if (!this.user) {
|
if (!this.user) {
|
||||||
throw new Error("Embedded Wallet is not connected");
|
throw new Error("Embedded Wallet is not connected");
|
||||||
}
|
}
|
||||||
return this.user.walletAddress;
|
return await this.getSigner().then((signer) => signer.getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
async isConnected(): Promise<boolean> {
|
async isConnected(): Promise<boolean> {
|
||||||
@@ -115,7 +115,7 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
}
|
}
|
||||||
|
|
||||||
const user = await this.getUser();
|
const user = await this.getUser();
|
||||||
const signer = await user?.wallet.getEthersJsSigner({
|
const signer = await user.wallet.getEthersJsSigner({
|
||||||
rpcEndpoint: this.options.chain.rpc[0] || "", // TODO: handle chain.rpc being empty array
|
rpcEndpoint: this.options.chain.rpc[0] || "", // TODO: handle chain.rpc being empty array
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -180,11 +180,11 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
this.emit("disconnect");
|
this.emit("disconnect");
|
||||||
};
|
};
|
||||||
|
|
||||||
async getUser(): Promise<InitializedUser | null> {
|
private async getUser(): Promise<InitializedUser> {
|
||||||
if (
|
if (
|
||||||
!this.user ||
|
!this.user ||
|
||||||
!this.user.wallet ||
|
!this.user.wallet ||
|
||||||
typeof this.user.wallet.getEthersJsSigner !== "function"
|
!this.user.wallet.getEthersJsSigner // when serializing, functions are lost, need to rehydrate
|
||||||
) {
|
) {
|
||||||
const embeddedWalletSdk = this.getEmbeddedWalletSDK();
|
const embeddedWalletSdk = this.getEmbeddedWalletSDK();
|
||||||
const user = await embeddedWalletSdk.getUser();
|
const user = await embeddedWalletSdk.getUser();
|
||||||
@@ -193,27 +193,25 @@ export class EmbeddedWalletConnector extends Connector<EmbeddedWalletConnectionA
|
|||||||
this.user = user;
|
this.user = user;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
default: {
|
||||||
|
// if logged out or unitialized, we can't get a signer, so throw an error
|
||||||
|
throw new Error(
|
||||||
|
"Embedded Wallet is not authenticated, please authenticate first",
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.user;
|
return this.user;
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEmail() {
|
async getEmail() {
|
||||||
// implicit call to set the user
|
const user = await this.getUser();
|
||||||
await this.getSigner();
|
return user.authDetails.email;
|
||||||
if (!this.user) {
|
|
||||||
throw new Error("No user found, Embedded Wallet is not connected");
|
|
||||||
}
|
|
||||||
return this.user.authDetails.email;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRecoveryInformation() {
|
async getRecoveryInformation() {
|
||||||
// implicit call to set the user
|
const user = await this.getUser();
|
||||||
await this.getSigner();
|
return user.authDetails;
|
||||||
if (!this.user) {
|
|
||||||
throw new Error("No user found, Embedded Wallet is not connected");
|
|
||||||
}
|
|
||||||
return this.user.authDetails;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendVerificationEmail({
|
async sendVerificationEmail({
|
||||||
|
|||||||
@@ -64,5 +64,4 @@ export type AuthResult = {
|
|||||||
user?: InitializedUser;
|
user?: InitializedUser;
|
||||||
isNewUser?: boolean;
|
isNewUser?: boolean;
|
||||||
needsRecoveryCode?: boolean;
|
needsRecoveryCode?: boolean;
|
||||||
verifyOTP?: (otp: string, recoveryCode?: string) => Promise<AuthResult>;
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { AbstractClientWallet, WalletOptions } from "./base";
|
import { AbstractClientWallet, WalletOptions } from "./base";
|
||||||
|
import { checkContractWalletSignature } from "./abstract";
|
||||||
import type { ConnectParams } from "../interfaces/connector";
|
import type { ConnectParams } from "../interfaces/connector";
|
||||||
import type {
|
import type {
|
||||||
SmartWalletConfig,
|
SmartWalletConfig,
|
||||||
@@ -14,7 +15,8 @@ import {
|
|||||||
} from "@thirdweb-dev/sdk";
|
} from "@thirdweb-dev/sdk";
|
||||||
import { walletIds } from "../constants/walletIds";
|
import { walletIds } from "../constants/walletIds";
|
||||||
import { getValidChainRPCs } from "@thirdweb-dev/chains";
|
import { getValidChainRPCs } from "@thirdweb-dev/chains";
|
||||||
import { providers, utils } from "ethers";
|
import { providers, utils, Bytes, Signer } from "ethers";
|
||||||
|
import { signTypedDataInternal } from "@thirdweb-dev/sdk";
|
||||||
|
|
||||||
// export types and utils for convenience
|
// export types and utils for convenience
|
||||||
export type * from "../connectors/smart-wallet/types";
|
export type * from "../connectors/smart-wallet/types";
|
||||||
@@ -76,6 +78,67 @@ export class SmartWallet extends AbstractClientWallet<
|
|||||||
return this.connector?.personalWallet;
|
return this.connector?.personalWallet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns the signature of the message
|
||||||
|
*/
|
||||||
|
public async signMessage(message: Bytes | string): Promise<string> {
|
||||||
|
// Deploy smart wallet if needed
|
||||||
|
const connector = await this.getConnector();
|
||||||
|
await connector.deployIfNeeded();
|
||||||
|
|
||||||
|
const erc4337Signer = await this.getSigner();
|
||||||
|
const chainId = await erc4337Signer.getChainId();
|
||||||
|
const address = await connector.getAddress();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We first try to sign the EIP-712 typed data i.e. the message mixed with the smart wallet's domain separator.
|
||||||
|
* If this fails, we fallback to the legacy signing method.
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const result = await signTypedDataInternal(
|
||||||
|
erc4337Signer,
|
||||||
|
{
|
||||||
|
name: "Account",
|
||||||
|
version: "1",
|
||||||
|
chainId,
|
||||||
|
verifyingContract: address,
|
||||||
|
},
|
||||||
|
{ AccountMessage: [{ name: "message", type: "bytes" }] },
|
||||||
|
{
|
||||||
|
message: utils.defaultAbiCoder.encode(
|
||||||
|
["bytes32"],
|
||||||
|
[utils.hashMessage(message)],
|
||||||
|
),
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
const isValid = await checkContractWalletSignature(
|
||||||
|
message as string,
|
||||||
|
result.signature,
|
||||||
|
address,
|
||||||
|
chainId,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!isValid) {
|
||||||
|
throw new Error("Invalid signature");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result.signature;
|
||||||
|
} catch {
|
||||||
|
return await this.signMessageLegacy(erc4337Signer, message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @returns the signature of the message (for legacy EIP-1271 signature verification)
|
||||||
|
*/
|
||||||
|
private async signMessageLegacy(
|
||||||
|
signer: Signer,
|
||||||
|
message: Bytes | string,
|
||||||
|
): Promise<string> {
|
||||||
|
return await signer.signMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the connected signer can execute a given transaction using the smart wallet.
|
* Check whether the connected signer can execute a given transaction using the smart wallet.
|
||||||
* @param transaction - the transaction to execute using the smart wallet.
|
* @param transaction - the transaction to execute using the smart wallet.
|
||||||
|
|||||||
Reference in New Issue
Block a user