Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f02570db88 | ||
|
|
c6b025e844 | ||
|
|
332a14552b | ||
|
|
c894270401 | ||
|
|
595815dc3e | ||
|
|
b959cafccc | ||
|
|
4cf0aede0e | ||
|
|
6cf298a29a |
@@ -5,7 +5,7 @@
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<h1 align="center"><a href='https://thirdweb.com/'>thirdweb</a> JavaScript/TypeScript SDK</h1>
|
||||
<h1 align="center"><a href='https://thirdweb.com/'>thirdweb</a> TypeScript SDK</h1>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml">
|
||||
@@ -18,6 +18,9 @@
|
||||
|
||||
<p align="center"><strong>All-in-one web3 SDK for Browser, Node and Mobile apps</strong></p>
|
||||
|
||||
> [!IMPORTANT]
|
||||
> We rewrote the thirdweb SDK from scratch for performance! Head over to the [Beta version unified SDK](https://github.com/thirdweb-dev/js/tree/beta/packages/thirdweb).
|
||||
|
||||
## Features
|
||||
|
||||
- Support for React & React-Native
|
||||
@@ -29,16 +32,6 @@
|
||||
- High level contract extensions for interacting with common standards
|
||||
- Automatic ABI resolution
|
||||
|
||||
## Unified SDK (Beta)
|
||||
|
||||
We now have a new version of the SDK available in beta:
|
||||
|
||||
Please refer to the following resources to get started:
|
||||
|
||||
- [GitHub Branch](https://github.com/thirdweb-dev/js/tree/beta)
|
||||
- [Engineering Blog](https://blog.thirdweb.com/changelog/introducing-the-unified-thirdweb-sdk/)
|
||||
- [Documentation](https://portal.thirdweb.com/typescript/v5)
|
||||
|
||||
## Library Comparison
|
||||
|
||||
| | thirdweb | Wagmi | Viem | Ethers@6 |
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 4.1.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c894270`](https://github.com/thirdweb-dev/js/commit/c894270401850575d1a4df73e16198177b46477a), [`332a145`](https://github.com/thirdweb-dev/js/commit/332a14552bf95e13e5220b1bd73414f000088568)]:
|
||||
- @thirdweb-dev/wallets@2.4.17
|
||||
|
||||
## 4.1.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "4.1.38",
|
||||
"version": "4.1.39",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.13.47
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c894270`](https://github.com/thirdweb-dev/js/commit/c894270401850575d1a4df73e16198177b46477a), [`332a145`](https://github.com/thirdweb-dev/js/commit/332a14552bf95e13e5220b1bd73414f000088568), [`c6b025e`](https://github.com/thirdweb-dev/js/commit/c6b025e84451341f6f48c0a7c4b5f06b8e49d792)]:
|
||||
- @thirdweb-dev/wallets@2.4.17
|
||||
- @thirdweb-dev/sdk@4.0.42
|
||||
- @thirdweb-dev/auth@4.1.39
|
||||
|
||||
## 0.13.46
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.13.46",
|
||||
"version": "0.13.47",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,14 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 4.4.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c894270`](https://github.com/thirdweb-dev/js/commit/c894270401850575d1a4df73e16198177b46477a), [`332a145`](https://github.com/thirdweb-dev/js/commit/332a14552bf95e13e5220b1bd73414f000088568), [`c6b025e`](https://github.com/thirdweb-dev/js/commit/c6b025e84451341f6f48c0a7c4b5f06b8e49d792)]:
|
||||
- @thirdweb-dev/wallets@2.4.17
|
||||
- @thirdweb-dev/sdk@4.0.42
|
||||
- @thirdweb-dev/auth@4.1.39
|
||||
|
||||
## 4.4.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "4.4.14",
|
||||
"version": "4.4.15",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.7.12
|
||||
|
||||
## 0.7.11
|
||||
|
||||
## 0.7.10
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.7.11",
|
||||
"version": "0.7.12",
|
||||
"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,14 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.7.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c894270`](https://github.com/thirdweb-dev/js/commit/c894270401850575d1a4df73e16198177b46477a), [`332a145`](https://github.com/thirdweb-dev/js/commit/332a14552bf95e13e5220b1bd73414f000088568), [`c6b025e`](https://github.com/thirdweb-dev/js/commit/c6b025e84451341f6f48c0a7c4b5f06b8e49d792)]:
|
||||
- @thirdweb-dev/wallets@2.4.17
|
||||
- @thirdweb-dev/sdk@4.0.42
|
||||
- @thirdweb-dev/react-core@4.4.15
|
||||
|
||||
## 0.7.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.7.11",
|
||||
"version": "0.7.12",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,14 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 4.4.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c894270`](https://github.com/thirdweb-dev/js/commit/c894270401850575d1a4df73e16198177b46477a), [`332a145`](https://github.com/thirdweb-dev/js/commit/332a14552bf95e13e5220b1bd73414f000088568), [`c6b025e`](https://github.com/thirdweb-dev/js/commit/c6b025e84451341f6f48c0a7c4b5f06b8e49d792)]:
|
||||
- @thirdweb-dev/wallets@2.4.17
|
||||
- @thirdweb-dev/sdk@4.0.42
|
||||
- @thirdweb-dev/react-core@4.4.15
|
||||
|
||||
## 4.4.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "4.4.14",
|
||||
"version": "4.4.15",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 4.0.42
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2441](https://github.com/thirdweb-dev/js/pull/2441) [`c6b025e`](https://github.com/thirdweb-dev/js/commit/c6b025e84451341f6f48c0a7c4b5f06b8e49d792) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Handle L1 fees for OP chains in `estimateGasCost()`
|
||||
|
||||
## 4.0.41
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "4.0.41",
|
||||
"version": "4.0.42",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
@@ -134,6 +134,7 @@
|
||||
}
|
||||
},
|
||||
"dependencies": {
|
||||
"@eth-optimism/sdk": "^3.2.1",
|
||||
"@thirdweb-dev/chains": "workspace:*",
|
||||
"@thirdweb-dev/contracts-js": "workspace:*",
|
||||
"@thirdweb-dev/crypto": "workspace:*",
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
import { ChainId } from "../constants/chains/ChainId";
|
||||
import { BigNumber, utils, providers } from "ethers";
|
||||
import { Mumbai, Polygon, Flag, FlagTestnet } from "@thirdweb-dev/chains";
|
||||
import {
|
||||
Mumbai,
|
||||
Polygon,
|
||||
Flag,
|
||||
FlagTestnet,
|
||||
Optimism,
|
||||
OpSepoliaTestnet,
|
||||
Base,
|
||||
BaseSepoliaTestnet,
|
||||
Zora,
|
||||
ZoraSepoliaTestnet,
|
||||
} from "@thirdweb-dev/chains";
|
||||
|
||||
type FeeData = {
|
||||
maxFeePerGas: null | BigNumber;
|
||||
@@ -99,6 +110,35 @@ export async function getGasPrice(
|
||||
return txGasPrice;
|
||||
}
|
||||
|
||||
export async function estimateTransactionCost(
|
||||
provider: providers.Provider,
|
||||
tx: providers.TransactionRequest,
|
||||
) {
|
||||
const chainId = (await provider.getNetwork()).chainId;
|
||||
if (isOpStackChain(chainId)) {
|
||||
const { asL2Provider } = await import("@eth-optimism/sdk");
|
||||
const l2RpcProvider = asL2Provider(provider);
|
||||
const l2GasCost = await l2RpcProvider.estimateTotalGasCost(tx);
|
||||
return l2GasCost;
|
||||
} else {
|
||||
const gasLimit = tx.gasLimit || (await provider.estimateGas(tx));
|
||||
const gasPrice = await getGasPrice(provider);
|
||||
const gasCost = BigNumber.from(gasLimit).mul(gasPrice);
|
||||
return gasCost;
|
||||
}
|
||||
}
|
||||
|
||||
function isOpStackChain(chainId: number) {
|
||||
return (
|
||||
chainId === Optimism.chainId ||
|
||||
chainId === OpSepoliaTestnet.chainId ||
|
||||
chainId === Base.chainId ||
|
||||
chainId === BaseSepoliaTestnet.chainId ||
|
||||
chainId === Zora.chainId ||
|
||||
chainId === ZoraSepoliaTestnet.chainId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { toEther } from "../../common/currency/toEther";
|
||||
import { estimateTransactionCost } from "../../common/gas-price";
|
||||
import { ContractWrapper } from "./internal/contract-wrapper";
|
||||
import { BaseContract, BigNumber, utils } from "ethers";
|
||||
|
||||
@@ -35,11 +37,11 @@ export class GasCostEstimator<TContract extends BaseContract> {
|
||||
fn: keyof TContract["functions"] | (string & {}),
|
||||
args: Parameters<TContract["functions"][typeof fn]> | any[],
|
||||
): Promise<string> {
|
||||
const [price, gasUnits] = await Promise.all([
|
||||
this.contractWrapper.getProvider().getGasPrice(),
|
||||
this.contractWrapper.estimateGas(fn, args),
|
||||
]);
|
||||
return utils.formatEther(gasUnits.mul(price));
|
||||
const gasCost = await estimateTransactionCost(
|
||||
this.contractWrapper.getProvider(),
|
||||
await this.contractWrapper.populateTransaction(fn, args),
|
||||
);
|
||||
return toEther(gasCost);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -192,6 +192,13 @@ export class ContractWrapper<
|
||||
return this.writeContract.estimateGas[fn as string](...args);
|
||||
}
|
||||
|
||||
public async populateTransaction(
|
||||
fn: keyof TContract["functions"],
|
||||
args: any[],
|
||||
): Promise<providers.TransactionRequest> {
|
||||
return this.writeContract.populateTransaction[fn as string](...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { TransactionError, parseRevertReason } from "../../common/error";
|
||||
import { getDefaultGasOverrides, getGasPrice } from "../../common/gas-price";
|
||||
import {
|
||||
estimateTransactionCost,
|
||||
getDefaultGasOverrides,
|
||||
getGasPrice,
|
||||
} from "../../common/gas-price";
|
||||
import {
|
||||
fetchContractMetadataFromAddress,
|
||||
getContractMetadataFromCache,
|
||||
@@ -165,6 +169,10 @@ abstract class TransactionContext {
|
||||
}
|
||||
|
||||
public abstract estimateGasLimit(): Promise<BigNumber>;
|
||||
public abstract estimateGasCost(): Promise<{
|
||||
ether: string;
|
||||
wei: BigNumber;
|
||||
}>;
|
||||
|
||||
/**
|
||||
* Set a multiple to multiply the gas limit by
|
||||
@@ -187,22 +195,6 @@ abstract class TransactionContext {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Estimate the total gas cost of this transaction (in both ether and wei)
|
||||
*/
|
||||
public async estimateGasCost() {
|
||||
const [gasLimit, gasPrice] = await Promise.all([
|
||||
this.estimateGasLimit(),
|
||||
this.getGasPrice(),
|
||||
]);
|
||||
const gasCost = gasLimit.mul(gasPrice);
|
||||
|
||||
return {
|
||||
ether: utils.formatEther(gasCost),
|
||||
wei: gasCost,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the gas price for transactions (adding a 10% tip buffer)
|
||||
*/
|
||||
@@ -427,6 +419,20 @@ export class Transaction<
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Estimate the total gas cost of this transaction (in both ether and wei)
|
||||
*/
|
||||
public async estimateGasCost() {
|
||||
const gasCost = await estimateTransactionCost(
|
||||
this.provider,
|
||||
await this.populateTransaction(),
|
||||
);
|
||||
return {
|
||||
ether: utils.formatEther(gasCost),
|
||||
wei: gasCost,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the transaction without waiting for it to be mined.
|
||||
*/
|
||||
@@ -755,6 +761,20 @@ export class DeployTransaction extends TransactionContext {
|
||||
}
|
||||
}
|
||||
|
||||
async estimateGasCost() {
|
||||
const gasOverrides = await this.getGasOverrides();
|
||||
const overrides: CallOverrides = { ...gasOverrides, ...this.overrides };
|
||||
const populatedTx = this.factory.getDeployTransaction(
|
||||
...this.args,
|
||||
overrides,
|
||||
);
|
||||
const gasCost = await estimateTransactionCost(this.provider, populatedTx);
|
||||
return {
|
||||
ether: utils.formatEther(gasCost),
|
||||
wei: gasCost,
|
||||
};
|
||||
}
|
||||
|
||||
async send(): Promise<ContractTransaction> {
|
||||
try {
|
||||
const populatedTx = await this.populateTransaction();
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,11 @@
|
||||
# @thirdweb-dev/service-utils
|
||||
|
||||
## 0.4.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2431](https://github.com/thirdweb-dev/js/pull/2431) [`6cf298a`](https://github.com/thirdweb-dev/js/commit/6cf298a29a29e37cecb88953aab195db8934a740) Thanks [@edwardysun](https://github.com/edwardysun)! - Add pay to Services list
|
||||
|
||||
## 0.4.18
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/service-utils",
|
||||
"version": "0.4.18",
|
||||
"version": "0.4.19",
|
||||
"main": "dist/thirdweb-dev-service-utils.cjs.js",
|
||||
"module": "dist/thirdweb-dev-service-utils.esm.js",
|
||||
"exports": {
|
||||
|
||||
@@ -47,10 +47,17 @@ export const SERVICE_DEFINITIONS = {
|
||||
checkout: {
|
||||
name: "checkout",
|
||||
title: "Checkouts",
|
||||
description: "Payments for easy web3 onboarding",
|
||||
description: "NFT Checkouts for easy web3 onboarding",
|
||||
// all actions allowed
|
||||
actions: [],
|
||||
},
|
||||
pay: {
|
||||
name: "pay",
|
||||
title: "Pay",
|
||||
description: "Pay for a blockchain transaction with any currency",
|
||||
// all actions allowed
|
||||
actions: [],
|
||||
}
|
||||
} as const;
|
||||
|
||||
export const SERVICE_NAMES = Object.keys(
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,14 @@
|
||||
# @thirdweb-dev/unity-js-bridge
|
||||
|
||||
## 0.4.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`c894270`](https://github.com/thirdweb-dev/js/commit/c894270401850575d1a4df73e16198177b46477a), [`332a145`](https://github.com/thirdweb-dev/js/commit/332a14552bf95e13e5220b1bd73414f000088568), [`c6b025e`](https://github.com/thirdweb-dev/js/commit/c6b025e84451341f6f48c0a7c4b5f06b8e49d792)]:
|
||||
- @thirdweb-dev/wallets@2.4.17
|
||||
- @thirdweb-dev/sdk@4.0.42
|
||||
- @thirdweb-dev/auth@4.1.39
|
||||
|
||||
## 0.4.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/unity-js-bridge",
|
||||
"version": "0.4.4",
|
||||
"version": "0.4.5",
|
||||
"main": "dist/thirdweb-unity-bridge.js",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,16 @@
|
||||
# @thirdweb-dev/wallets
|
||||
|
||||
## 2.4.17
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2440](https://github.com/thirdweb-dev/js/pull/2440) [`c894270`](https://github.com/thirdweb-dev/js/commit/c894270401850575d1a4df73e16198177b46477a) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Smart Wallet] Update Account Core ABI
|
||||
|
||||
- [#2439](https://github.com/thirdweb-dev/js/pull/2439) [`332a145`](https://github.com/thirdweb-dev/js/commit/332a14552bf95e13e5220b1bd73414f000088568) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Make accountInfo/factoryInfo internal props optional in SmartWalletConfig
|
||||
|
||||
- Updated dependencies [[`c6b025e`](https://github.com/thirdweb-dev/js/commit/c6b025e84451341f6f48c0a7c4b5f06b8e49d792)]:
|
||||
- @thirdweb-dev/sdk@4.0.42
|
||||
|
||||
## 2.4.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/wallets",
|
||||
"version": "2.4.16",
|
||||
"version": "2.4.17",
|
||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -4,8 +4,8 @@ import { ERC4337EthersProvider } from "./lib/erc4337-provider";
|
||||
import { getVerifyingPaymaster } from "./lib/paymaster";
|
||||
import { create4337Provider } from "./lib/provider-utils";
|
||||
import {
|
||||
AccountContractInfo,
|
||||
FactoryContractInfo,
|
||||
AccountContractInfoInternal,
|
||||
FactoryContractInfoInternal,
|
||||
ProviderConfig,
|
||||
SmartWalletConfig,
|
||||
SmartWalletConnectionArgs,
|
||||
@@ -71,8 +71,22 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
gasless: config.gasless,
|
||||
factoryAddress: config.factoryAddress,
|
||||
accountAddress: params.accountAddress,
|
||||
factoryInfo: config.factoryInfo || this.defaultFactoryInfo(),
|
||||
accountInfo: config.accountInfo || this.defaultAccountInfo(),
|
||||
factoryInfo: {
|
||||
createAccount:
|
||||
config.factoryInfo?.createAccount ||
|
||||
this.defaultFactoryInfo().createAccount,
|
||||
getAccountAddress:
|
||||
config.factoryInfo?.getAccountAddress ||
|
||||
this.defaultFactoryInfo().getAccountAddress,
|
||||
abi: config.factoryInfo?.abi,
|
||||
},
|
||||
accountInfo: {
|
||||
execute:
|
||||
config.accountInfo?.execute || this.defaultAccountInfo().execute,
|
||||
getNonce:
|
||||
config.accountInfo?.getNonce || this.defaultAccountInfo().getNonce,
|
||||
abi: config.accountInfo?.abi,
|
||||
},
|
||||
clientId: config.clientId,
|
||||
secretKey: config.secretKey,
|
||||
erc20PaymasterAddress: config.erc20PaymasterAddress,
|
||||
@@ -541,7 +555,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
return sdk.getContract(this.config.factoryAddress);
|
||||
}
|
||||
|
||||
protected defaultFactoryInfo(): FactoryContractInfo {
|
||||
protected defaultFactoryInfo(): FactoryContractInfoInternal {
|
||||
return {
|
||||
createAccount: async (factory, owner) => {
|
||||
return factory.prepare("createAccount", [
|
||||
@@ -558,7 +572,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
};
|
||||
}
|
||||
|
||||
protected defaultAccountInfo(): AccountContractInfo {
|
||||
protected defaultAccountInfo(): AccountContractInfoInternal {
|
||||
return {
|
||||
execute: async (account, target, value, data) => {
|
||||
return account.prepare("execute", [target, value, data]);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,11 +54,14 @@ export type ContractInfoInput = {
|
||||
};
|
||||
|
||||
export type ContractInfo = {
|
||||
factoryInfo: FactoryContractInfo;
|
||||
accountInfo: AccountContractInfo;
|
||||
factoryInfo: FactoryContractInfoInternal;
|
||||
accountInfo: AccountContractInfoInternal;
|
||||
};
|
||||
|
||||
export type AccountContractInfo = {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type AccountContractInfoInternal = {
|
||||
abi?: ContractInterface;
|
||||
getNonce: (account: SmartContract) => Promise<BigNumber>;
|
||||
execute: (
|
||||
@@ -69,7 +72,10 @@ export type AccountContractInfo = {
|
||||
) => Promise<Transaction>;
|
||||
};
|
||||
|
||||
export type FactoryContractInfo = {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export type FactoryContractInfoInternal = {
|
||||
abi?: ContractInterface;
|
||||
createAccount: (
|
||||
factory: SmartContract,
|
||||
@@ -78,6 +84,29 @@ export type FactoryContractInfo = {
|
||||
getAccountAddress: (factory: SmartContract, owner: string) => Promise<string>;
|
||||
};
|
||||
|
||||
export type AccountContractInfo = {
|
||||
abi?: ContractInterface;
|
||||
getNonce?: (account: SmartContract) => Promise<BigNumber>;
|
||||
execute?: (
|
||||
account: SmartContract,
|
||||
target: string,
|
||||
value: BigNumberish,
|
||||
data: string,
|
||||
) => Promise<Transaction>;
|
||||
};
|
||||
|
||||
export type FactoryContractInfo = {
|
||||
abi?: ContractInterface;
|
||||
createAccount?: (
|
||||
factory: SmartContract,
|
||||
owner: string,
|
||||
) => Promise<Transaction>;
|
||||
getAccountAddress?: (
|
||||
factory: SmartContract,
|
||||
owner: string,
|
||||
) => Promise<string>;
|
||||
};
|
||||
|
||||
export type PaymasterResult = {
|
||||
paymasterAndData: string;
|
||||
preVerificationGas?: BigNumber;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { TokenBoundSmartWalletConfig } from "./types";
|
||||
import { ethers } from "ethers";
|
||||
import { SmartWalletConnector } from "../smart-wallet";
|
||||
import { FactoryContractInfo } from "../smart-wallet/types";
|
||||
import { FactoryContractInfoInternal } from "../smart-wallet/types";
|
||||
import { ERC6551_REGISTRY } from "../smart-wallet/lib/constants";
|
||||
|
||||
export class TokenBoundSmartWalletConnector extends SmartWalletConnector {
|
||||
@@ -16,7 +16,7 @@ export class TokenBoundSmartWalletConnector extends SmartWalletConnector {
|
||||
// TODO default account implementation address
|
||||
}
|
||||
|
||||
protected defaultFactoryInfo(): FactoryContractInfo {
|
||||
protected defaultFactoryInfo(): FactoryContractInfoInternal {
|
||||
return {
|
||||
createAccount: async (factory) => {
|
||||
return factory.prepare("createAccount", [
|
||||
|
||||
Binary file not shown.
Generated
+108
-1
@@ -1090,6 +1090,9 @@ importers:
|
||||
|
||||
packages/sdk:
|
||||
dependencies:
|
||||
'@eth-optimism/sdk':
|
||||
specifier: ^3.2.1
|
||||
version: 3.2.1([email protected])
|
||||
'@thirdweb-dev/chains':
|
||||
specifier: workspace:*
|
||||
version: link:../chains
|
||||
@@ -7536,6 +7539,11 @@ packages:
|
||||
resolution: {integrity: sha512-gMsVel9D7f2HLkBma9VbtzZRehRogVRfbr++f06nL2vnCGCNlzOD+/MUov/F4p8myyAHspEhVobgjpX64q5m6A==}
|
||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||
|
||||
/@eth-optimism/[email protected]:
|
||||
resolution: {integrity: sha512-Hc5peN5PM8kzl9dzqSD5jv6ED3QliO1DF0dXLRJxfrXR7/rmEeyuAYESUwUM0gdJZjkwRYiS5m230BI6bQmnlw==}
|
||||
requiresBuild: true
|
||||
dev: false
|
||||
|
||||
/@eth-optimism/[email protected]([email protected]):
|
||||
resolution: {integrity: sha512-MrzV0nvsymfO/fursTB7m/KunkPsCndltVgfdHaT1Aj5Vi6R/doKIGGkOofHX+8B6VMZpuZosKCMQ5lQuqjt8w==}
|
||||
peerDependencies:
|
||||
@@ -7550,6 +7558,20 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@eth-optimism/[email protected]([email protected]):
|
||||
resolution: {integrity: sha512-vQ04wfG9kMf1Fwy3FEMqH2QZbgS0gldKhcBeBUPfO8zu68L61VI97UDXmsMQXzTsEAxK8HnokW3/gosl4/NW3w==}
|
||||
peerDependencies:
|
||||
ethers: ^5
|
||||
dependencies:
|
||||
'@eth-optimism/core-utils': 0.12.0
|
||||
'@ethersproject/abstract-provider': 5.7.0
|
||||
'@ethersproject/abstract-signer': 5.7.0
|
||||
ethers: 5.7.2
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@eth-optimism/[email protected]:
|
||||
resolution: {integrity: sha512-qW+7LZYCz7i8dRa7SRlUKIo1VBU8lvN0HeXCxJR+z+xtMzMQpPds20XJNCMclszxYQHkXY00fOT6GvFw9ZL6nw==}
|
||||
dependencies:
|
||||
@@ -7574,6 +7596,50 @@ packages:
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@eth-optimism/[email protected]:
|
||||
resolution: {integrity: sha512-1FvzbUmCEy9zSKPG1QWg2VfA2Cy90xBA9Wkp11lXXrz91zUPCNCNSRTujXWYIC86ketNsZp7p4njSf6lTycHCw==}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
'@ethersproject/abi': 5.7.0
|
||||
'@ethersproject/abstract-provider': 5.7.0
|
||||
'@ethersproject/address': 5.7.0
|
||||
'@ethersproject/bignumber': 5.7.0
|
||||
'@ethersproject/bytes': 5.7.0
|
||||
'@ethersproject/constants': 5.7.0
|
||||
'@ethersproject/contracts': 5.7.0
|
||||
'@ethersproject/keccak256': 5.7.0
|
||||
'@ethersproject/properties': 5.7.0
|
||||
'@ethersproject/rlp': 5.7.0
|
||||
'@ethersproject/web': 5.7.1
|
||||
chai: 4.4.1
|
||||
ethers: 5.7.2
|
||||
node-fetch: 2.6.12
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- encoding
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@eth-optimism/[email protected]([email protected]):
|
||||
resolution: {integrity: sha512-COmnT2zRzFn2XhMW/OD1ML3gCrT6SO95YF3hV/Mx3G1G4Q6zOv09rwU1avH/OcqdDMBmZ/DTrZm+9OVmc+YPlQ==}
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
ethers: ^5
|
||||
dependencies:
|
||||
'@eth-optimism/contracts': 0.6.0([email protected])
|
||||
'@eth-optimism/contracts-bedrock': 0.17.1
|
||||
'@eth-optimism/core-utils': 0.13.1
|
||||
ethers: 5.7.2
|
||||
lodash: 4.17.21
|
||||
merkletreejs: 0.3.11
|
||||
rlp: 2.2.7
|
||||
semver: 7.6.0
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- encoding
|
||||
- utf-8-validate
|
||||
dev: false
|
||||
|
||||
/@ethereumjs/[email protected]:
|
||||
resolution: {integrity: sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA==}
|
||||
dependencies:
|
||||
@@ -15775,6 +15841,19 @@ packages:
|
||||
pathval: 1.1.1
|
||||
type-detect: 4.0.8
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
assertion-error: 1.1.0
|
||||
check-error: 1.0.3
|
||||
deep-eql: 4.1.3
|
||||
get-func-name: 2.0.2
|
||||
loupe: 2.3.6
|
||||
pathval: 1.1.1
|
||||
type-detect: 4.0.8
|
||||
dev: false
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==}
|
||||
engines: {node: '>=12'}
|
||||
@@ -15846,6 +15925,12 @@ packages:
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==}
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==}
|
||||
dependencies:
|
||||
get-func-name: 2.0.2
|
||||
dev: false
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-HBiYvXvn9Z70Z88XKjz3AEKd4HJhBXsa3j7xFnITAzoS8+q6eIGi8qDB8FKPBAjtuxjI/zFpwuiCb8oDtKOYrA==}
|
||||
dev: false
|
||||
@@ -16480,7 +16565,6 @@ packages:
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==}
|
||||
dev: true
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-GsVpkFPlycH7/fRR7Dhcmnoii54gV1nz7y4CWyeFS14N+JVBBhY+r8amRHE4BwSYal7BPTDp8isvAlCxyFt3Hg==}
|
||||
@@ -19939,6 +20023,10 @@ packages:
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==}
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==}
|
||||
dev: false
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==}
|
||||
dependencies:
|
||||
@@ -23604,6 +23692,17 @@ packages:
|
||||
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
|
||||
engines: {node: '>= 8'}
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-LJKTl4iVNTndhL+3Uz/tfkjD0klIWsHlUzgtuNnNrsf7bAlXR30m+xYB7lHr5Z/l6e/yAIsr26Dabx6Buo4VGQ==}
|
||||
engines: {node: '>= 7.6.0'}
|
||||
dependencies:
|
||||
bignumber.js: 9.1.1
|
||||
buffer-reverse: 1.0.1
|
||||
crypto-js: 4.2.0
|
||||
treeify: 1.1.0
|
||||
web3-utils: 1.8.2
|
||||
dev: false
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==}
|
||||
engines: {node: '>= 0.6'}
|
||||
@@ -27975,6 +28074,14 @@ packages:
|
||||
dependencies:
|
||||
lru-cache: 6.0.0
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==}
|
||||
engines: {node: '>=10'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
lru-cache: 6.0.0
|
||||
dev: false
|
||||
|
||||
/[email protected]:
|
||||
resolution: {integrity: sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
|
||||
Reference in New Issue
Block a user