Compare commits

...
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
1119f63a47 Version Packages (#991)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-05-09 23:23:42 -07:00
Joaquim VergesandGitHub 32908b7683 [SDK] rename extension detection functions (#992) 2023-05-10 06:03:26 +00:00
Joaquim VergesandGitHub 6a4aab0b8a [Wallets] LocalWalletNode fix + cleanup SmartWallet logs (#990) 2023-05-10 05:15:22 +00:00
30 changed files with 167 additions and 69 deletions
+7
View File
@@ -1,5 +1,12 @@
# @thirdweb-dev/auth
## 3.0.18
### Patch Changes
- Updated dependencies [[`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/wallets@0.2.19
## 3.0.17
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.0.17",
"version": "3.0.18",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/chains
## 0.1.15
### Patch Changes
- [#990](https://github.com/thirdweb-dev/js/pull/990) [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - updated chains
## 0.1.14
### Patch Changes
+1 -1
View File
@@ -4,7 +4,7 @@ export default {
"chain": "IRIShub",
"rpc": [
"https://irishub-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"http://34.80.202.172:8545"
"https://evmrpc.nyancat.irisnet.org"
],
"features": [
{
+1 -1
View File
@@ -25,7 +25,7 @@ export default {
"explorers": [
{
"name": "blockexplorer",
"url": "https://explorer.camino.foundation",
"url": "https://suite.camino.network/explorer",
"standard": "none"
}
],
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.14",
"version": "0.1.15",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"browser": {
+8
View File
@@ -1,5 +1,13 @@
# thirdweb
## 0.10.15
### Patch Changes
- Updated dependencies [[`32908b76`](https://github.com/thirdweb-dev/js/commit/32908b76832c60e91a0a6e40dbdb1c8f56e9e5be), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/sdk@3.10.14
- @thirdweb-dev/chains@0.1.15
## 0.10.14
### Patch Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.10.14",
"version": "0.10.15",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/react-core
## 3.11.11
### Patch Changes
- Updated dependencies [[`32908b76`](https://github.com/thirdweb-dev/js/commit/32908b76832c60e91a0a6e40dbdb1c8f56e9e5be), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/sdk@3.10.14
- @thirdweb-dev/wallets@0.2.19
- @thirdweb-dev/chains@0.1.15
## 3.11.10
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.11.10",
"version": "3.11.11",
"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.2.11
## 0.2.10
## 0.2.9
+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.10",
"version": "0.2.11",
"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.11
### Patch Changes
- Updated dependencies [[`32908b76`](https://github.com/thirdweb-dev/js/commit/32908b76832c60e91a0a6e40dbdb1c8f56e9e5be), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/sdk@3.10.14
- @thirdweb-dev/wallets@0.2.19
- @thirdweb-dev/chains@0.1.15
- @thirdweb-dev/react-core@3.11.11
## 0.2.10
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.2.10",
"version": "0.2.11",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/react
## 3.11.11
### Patch Changes
- Updated dependencies [[`32908b76`](https://github.com/thirdweb-dev/js/commit/32908b76832c60e91a0a6e40dbdb1c8f56e9e5be), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/sdk@3.10.14
- @thirdweb-dev/wallets@0.2.19
- @thirdweb-dev/chains@0.1.15
- @thirdweb-dev/react-core@3.11.11
## 3.11.10
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.11.10",
"version": "3.11.11",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/sdk
## 3.10.14
### Patch Changes
- [#992](https://github.com/thirdweb-dev/js/pull/992) [`32908b76`](https://github.com/thirdweb-dev/js/commit/32908b76832c60e91a0a6e40dbdb1c8f56e9e5be) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Add alias for extension detection functions
- Updated dependencies [[`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/chains@0.1.15
## 3.10.13
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.10.13",
"version": "3.10.14",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
@@ -1,4 +1,5 @@
import {
ExtensionWithEnabled,
Feature,
FeatureName,
FeatureWithEnabled,
@@ -8,7 +9,6 @@ import { ContractWrapper } from "../core/classes/contract-wrapper";
import { DetectableFeature } from "../core/interfaces/DetectableFeature";
import { decode } from "../lib/cbor-decode.js";
import {
Abi,
AbiEvent,
AbiFunction,
AbiInput,
@@ -484,7 +484,7 @@ export async function fetchExtendedReleaseMetadata(
* @returns the nested struct of all features and whether they're detected in the abi
*/
export function detectFeatures(
abi: Abi,
abi: AbiInput,
features: Record<string, Feature> = SUPPORTED_FEATURES,
): Record<string, FeatureWithEnabled> {
const results: Record<string, FeatureWithEnabled> = {};
@@ -523,29 +523,56 @@ function extractFeatures(
* Return all the detected features in the abi
* @param abi - parsed array of abi entries
* @returns array of all detected extensions with full information on each feature
* @public
* @internal
* @deprecated use getAllDetectedExtensions instead
*/
export function getAllDetectedFeatures(abi: Abi): FeatureWithEnabled[] {
export function getAllDetectedFeatures(abi: AbiInput): FeatureWithEnabled[] {
const features: FeatureWithEnabled[] = [];
extractFeatures(detectFeatures(abi), features);
return features;
}
/**
* Return all the detected extensions in the abi
* @param abi - parsed array of abi entries
* @returns array of all detected extensions with full information on each feature
* @public
*/
export function getAllDetectedExtensions(
abi: AbiInput,
): ExtensionWithEnabled[] {
return getAllDetectedFeatures(abi).map((f) => ({
...f,
extensions: f.features,
}));
}
/**
* Return all the detected features names in the abi
* @param abi - parsed array of abi entries
* @returns array of all detected features names
* @public
* @internal
* @deprecated use getAllExtensionNames instead
*/
export function getAllDetectedFeatureNames(abi: Abi): string[] {
export function getAllDetectedFeatureNames(abi: AbiInput): string[] {
const features: FeatureWithEnabled[] = [];
extractFeatures(detectFeatures(abi), features);
return features.map((f) => f.name);
}
/**
* Return all the detected extension names in the abi
* @param abi - parsed array of abi entries
* @returns array of all detected features names
* @public
*/
export function getAllDetectedExtensionNames(abi: AbiInput): string[] {
return getAllDetectedFeatureNames(abi);
}
/**
* Checks whether the given ABI supports a given feature
* @internal
* @deprecated use isExtensionEnabled instead
* @param abi
* @param featureName
*/
@@ -553,11 +580,20 @@ export function isFeatureEnabled(
abi: AbiInput,
featureName: FeatureName,
): boolean {
const parsedAbi = AbiSchema.parse(abi || []);
const features = detectFeatures(parsedAbi);
const features = detectFeatures(abi);
return _featureEnabled(features, featureName);
}
/**
* Checks whether the given ABI supports a given extension
* @public
* @param abi
* @param featureName
*/
export function isExtensionEnabled(abi: AbiInput, featureName: FeatureName) {
return isFeatureEnabled(abi, featureName);
}
/**
* Checks whether the given DetectableFeature is defined
* @internal
@@ -125,11 +125,13 @@ export type Feature =
| typeof FEATURE_OFFERS
| typeof FEATURE_SMART_WALLET
| typeof FEATURE_SMART_WALLET_FACTORY;
export type Extension = Feature;
/**
* @internal
*/
export type FeatureName = Feature["name"];
export type ExtensionName = Feature["name"];
/**
* @internal
*/
@@ -137,6 +139,10 @@ export type FeatureWithEnabled = Feature & {
features: Record<string, FeatureWithEnabled>;
enabled: boolean;
};
export type ExtensionWithEnabled = Extension & {
extensions: Record<string, FeatureWithEnabled>;
enabled: boolean;
};
/**
* @internal
+1
View File
@@ -4,3 +4,4 @@ export * from "./contract";
export * from "./currency";
export * from "./events";
export * from "./urls";
export * from "./contract-features";
+15 -13
View File
@@ -1,7 +1,7 @@
import {
ChainId,
getAllDetectedFeatureNames,
isFeatureEnabled,
getAllDetectedExtensionNames,
isExtensionEnabled,
resolveContractUriFromAddress,
ThirdwebSDK,
} from "../../src/evm";
@@ -75,34 +75,36 @@ describe("Publishing", async () => {
it("should extract features", async () => {
expect(
isFeatureEnabled(TokenERC721__factory.abi, "ERC721Enumerable"),
isExtensionEnabled(TokenERC721__factory.abi, "ERC721Enumerable"),
).to.eq(true);
expect(isFeatureEnabled(TokenERC721__factory.abi, "ERC721Mintable")).to.eq(
true,
);
expect(
isFeatureEnabled(TokenERC721__factory.abi, "ERC721BatchMintable"),
isExtensionEnabled(TokenERC721__factory.abi, "ERC721Mintable"),
).to.eq(true);
expect(
isExtensionEnabled(TokenERC721__factory.abi, "ERC721BatchMintable"),
).to.eq(true);
// Drop
expect(
isFeatureEnabled(DropERC721__factory.abi, "ERC721ClaimPhasesV2"),
isExtensionEnabled(DropERC721__factory.abi, "ERC721ClaimPhasesV2"),
).to.eq(true);
expect(isFeatureEnabled(DropERC721__factory.abi, "ERC721Supply")).to.eq(
expect(isExtensionEnabled(DropERC721__factory.abi, "ERC721Supply")).to.eq(
true,
);
expect(isFeatureEnabled(DropERC721__factory.abi, "ERC721Mintable")).to.eq(
expect(isExtensionEnabled(DropERC721__factory.abi, "ERC721Mintable")).to.eq(
false,
);
});
it("should extract all features", async () => {
const tokenFeatures = getAllDetectedFeatureNames(TokenERC721__factory.abi);
const tokenFeatures = getAllDetectedExtensionNames(
TokenERC721__factory.abi,
);
expect(tokenFeatures).to.contain("ERC721Enumerable");
expect(getAllDetectedFeatureNames(DropERC721__factory.abi)).to.contain(
expect(getAllDetectedExtensionNames(DropERC721__factory.abi)).to.contain(
"ERC721ClaimPhasesV2",
);
expect(getAllDetectedFeatureNames(DropERC721_V3__factory.abi)).to.contain(
expect(getAllDetectedExtensionNames(DropERC721_V3__factory.abi)).to.contain(
"ERC721ClaimPhasesV1",
);
});
+9
View File
@@ -1,5 +1,14 @@
# @thirdweb-dev/unity-js-bridge
## 0.2.29
### Patch Changes
- Updated dependencies [[`32908b76`](https://github.com/thirdweb-dev/js/commit/32908b76832c60e91a0a6e40dbdb1c8f56e9e5be), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/sdk@3.10.14
- @thirdweb-dev/wallets@0.2.19
- @thirdweb-dev/auth@3.0.18
## 0.2.28
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.28",
"version": "0.2.29",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/wallets
## 0.2.19
### Patch Changes
- [#990](https://github.com/thirdweb-dev/js/pull/990) [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix loadOrCreate for LocalWalletNode
- Updated dependencies [[`32908b76`](https://github.com/thirdweb-dev/js/commit/32908b76832c60e91a0a6e40dbdb1c8f56e9e5be), [`6a4aab0b`](https://github.com/thirdweb-dev/js/commit/6a4aab0b8a2e0f6ff1b47992a3c1e5426a74f7ff)]:
- @thirdweb-dev/sdk@3.10.14
- @thirdweb-dev/chains@0.1.15
## 0.2.18
### Patch Changes
+1 -8
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "0.2.18",
"version": "0.2.19",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
@@ -204,13 +204,6 @@
},
"default": "./evm/wallets/wallet-connect-v1/dist/thirdweb-dev-wallets-evm-wallets-wallet-connect-v1.cjs.js"
},
"./evm/wallets/local-walllet-node": {
"module": {
"browser": "./evm/wallets/local-walllet-node/dist/thirdweb-dev-wallets-evm-wallets-local-walllet-node.browser.esm.js",
"default": "./evm/wallets/local-walllet-node/dist/thirdweb-dev-wallets-evm-wallets-local-walllet-node.esm.js"
},
"default": "./evm/wallets/local-walllet-node/dist/thirdweb-dev-wallets-evm-wallets-local-walllet-node.cjs.js"
},
"./evm/wallets/aws-secrets-manager": {
"module": {
"browser": "./evm/wallets/aws-secrets-manager/dist/thirdweb-dev-wallets-evm-wallets-aws-secrets-manager.browser.esm.js",
@@ -49,7 +49,7 @@ export class AccountAPI extends BaseAccountAPI {
async getAccountInitCode(): Promise<string> {
const factory = await this.getFactoryContract();
console.log("AccountAPI - Creating account via factory");
console.log("Deploying smart wallet via factory");
const localSigner = await this.params.localSigner.getAddress();
const tx = await this.params.factoryInfo.createAccount(
factory,
@@ -57,12 +57,12 @@ export class AccountAPI extends BaseAccountAPI {
);
try {
console.log(
"Cost to create account: ",
"Cost to deploy smart wallet: ",
(await tx.estimateGasCost()).ether,
"ETH",
);
} catch (e) {
console.error("Cost to create account: unknown", e);
console.error("Cost to deploy smart wallet: unknown", e);
}
return hexConcat([factory.getAddress(), tx.encode()]);
}
@@ -1,7 +1,6 @@
import { ethers, providers } from "ethers";
import { Bytes, Signer } from "ethers";
import { UserOperationStruct } from "@account-abstraction/contracts";
import { ClientConfig } from "@account-abstraction/sdk";
import { BaseAccountAPI } from "./base-api";
import { ERC4337EthersProvider } from "./erc4337-provider";
@@ -132,9 +131,4 @@ export class ERC4337EthersSigner extends Signer {
): Promise<string> {
throw new Error("not implemented");
}
async signUserOperation(userOperation: UserOperationStruct): Promise<string> {
const message = await this.smartAccountAPI.getUserOpHash(userOperation);
return await this.originalSigner.signMessage(message);
}
}
@@ -338,12 +338,12 @@ export class LocalWallet extends AbstractClientWallet<
async getSavedData(storage?: AsyncStorage): Promise<WalletData | null> {
const _storage = storage || this.#storage;
const savedDataStr = await _storage.getItem(STORAGE_KEY_WALLET_DATA);
if (!savedDataStr) {
return null;
}
try {
const savedDataStr = await _storage.getItem(STORAGE_KEY_WALLET_DATA);
if (!savedDataStr) {
return null;
}
const savedData = JSON.parse(savedDataStr);
if (!savedData) {
return null;
@@ -1,14 +0,0 @@
import { WalletOptions } from "..";
import { AsyncJsonFileStorage } from "../../core/AsyncJsonFileStorage";
import { LocalWallet, LocalWalletOptions } from "./local-wallet";
export class LocalWalletNode extends LocalWallet {
constructor(
options?: WalletOptions<LocalWalletOptions> & { storageJsonFile?: string },
) {
const storage = new AsyncJsonFileStorage(
options?.storageJsonFile || "./wallet.json",
);
super({ storage, ...options });
}
}