Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6c6a68b97 | ||
|
|
2682f5823e | ||
|
|
d30e3f4db3 | ||
|
|
2efe5be3ad | ||
|
|
31a252a0ec | ||
|
|
d5f18b403a | ||
|
|
cc0c7fa093 | ||
|
|
baeb74274e | ||
|
|
5038487e1b | ||
|
|
c5959fbd52 | ||
|
|
68d52f99b3 | ||
|
|
9efeba38f0 |
@@ -0,0 +1,35 @@
|
||||
export default {
|
||||
"name": "Palette Chain Mainnet",
|
||||
"chain": "PLT",
|
||||
"rpc": [
|
||||
"https://palette-chain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://palette-rpc.com:22000"
|
||||
],
|
||||
"faucets": [],
|
||||
"nativeCurrency": {
|
||||
"name": "Palette Token",
|
||||
"symbol": "PLT",
|
||||
"decimals": 18
|
||||
},
|
||||
"features": [],
|
||||
"infoURL": "https://hashpalette.com/",
|
||||
"shortName": "PaletteChain",
|
||||
"chainId": 1718,
|
||||
"networkId": 1718,
|
||||
"icon": {
|
||||
"url": "ipfs://QmPCEGZD1p1keTT2YfPp725azx1r9Ci41hejeUuGL2whFA",
|
||||
"width": 800,
|
||||
"height": 800,
|
||||
"format": "png"
|
||||
},
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Palettescan",
|
||||
"url": "https://palettescan.com",
|
||||
"icon": "PLT",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"testnet": false,
|
||||
"slug": "palette-chain"
|
||||
} as const;
|
||||
@@ -1,5 +1,19 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.10.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`2682f582`](https://github.com/thirdweb-dev/js/commit/2682f5823e5c71947f5c6a71918a0285f253fd18), [`d5f18b40`](https://github.com/thirdweb-dev/js/commit/d5f18b403a6f3ced0e1929b5c032f63325708304), [`2efe5be3`](https://github.com/thirdweb-dev/js/commit/2efe5be3ad2df4e80c0048c8fd35018ecf2d8dd9), [`baeb7427`](https://github.com/thirdweb-dev/js/commit/baeb74274e878cfbc237ef2aa676faa257606300)]:
|
||||
- @thirdweb-dev/sdk@3.10.2
|
||||
|
||||
## 0.10.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`68d52f99`](https://github.com/thirdweb-dev/js/commit/68d52f99b36c6744e45872d0bdebafbbf7d09b59)]:
|
||||
- @thirdweb-dev/sdk@3.10.1
|
||||
|
||||
## 0.10.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 3.10.2
|
||||
|
||||
## 3.10.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#684](https://github.com/thirdweb-dev/js/pull/684) [`9efeba38`](https://github.com/thirdweb-dev/js/commit/9efeba38f06783b78e2c947ad878350173f4e07a) Thanks [@adam-maj](https://github.com/adam-maj)! - Update auth hooks to include credentials on login
|
||||
|
||||
## 3.10.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "3.10.0",
|
||||
"version": "3.10.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -206,7 +206,7 @@ export function useBatchesToReveal<TContract extends RevealableContract>(
|
||||
*
|
||||
* @param contract - an instance of a {@link DropContract}
|
||||
* @returns a mutation object that can be used to claim a NFT to the wallet specificed in the params
|
||||
* @twfeature ERC721Claimable | ERC1155Claimable
|
||||
* @twfeature ERC721Claimable | ERC1155Claimable | ERC721ClaimPhasesV2 | ERC721ClaimPhasesV1 | ERC721ClaimConditionsV2 | ERC721ClaimConditionsV1 | ERC1155ClaimPhasesV2 | ERC1155ClaimPhasesV1 | ERC1155ClaimConditionsV2 | ERC1155ClaimConditionsV1
|
||||
* @beta
|
||||
*/
|
||||
export function useClaimNFT<TContract extends DropContract>(
|
||||
|
||||
@@ -35,6 +35,7 @@ export function useLogin() {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ payload }),
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
|
||||
@@ -47,6 +47,7 @@ export function useLogin() {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ payload }),
|
||||
credentials: "include",
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.1.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`2682f582`](https://github.com/thirdweb-dev/js/commit/2682f5823e5c71947f5c6a71918a0285f253fd18), [`d5f18b40`](https://github.com/thirdweb-dev/js/commit/d5f18b403a6f3ced0e1929b5c032f63325708304), [`2efe5be3`](https://github.com/thirdweb-dev/js/commit/2efe5be3ad2df4e80c0048c8fd35018ecf2d8dd9), [`baeb7427`](https://github.com/thirdweb-dev/js/commit/baeb74274e878cfbc237ef2aa676faa257606300)]:
|
||||
- @thirdweb-dev/sdk@3.10.2
|
||||
- @thirdweb-dev/react-core@3.10.2
|
||||
|
||||
## 0.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`68d52f99`](https://github.com/thirdweb-dev/js/commit/68d52f99b36c6744e45872d0bdebafbbf7d09b59), [`9efeba38`](https://github.com/thirdweb-dev/js/commit/9efeba38f06783b78e2c947ad878350173f4e07a)]:
|
||||
- @thirdweb-dev/sdk@3.10.1
|
||||
- @thirdweb-dev/react-core@3.10.1
|
||||
|
||||
## 0.1.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.8",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 3.10.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`d30e3f4d`](https://github.com/thirdweb-dev/js/commit/d30e3f4db3d74589429e17da1a56e89e9e1082ab), [`31a252a0`](https://github.com/thirdweb-dev/js/commit/31a252a0ecafe338d1fbb3000b5dec55274a2d84)]:
|
||||
- @thirdweb-dev/wallets@0.2.8
|
||||
- @thirdweb-dev/react-core@3.10.2
|
||||
|
||||
## 3.10.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`9efeba38`](https://github.com/thirdweb-dev/js/commit/9efeba38f06783b78e2c947ad878350173f4e07a)]:
|
||||
- @thirdweb-dev/react-core@3.10.1
|
||||
|
||||
## 3.10.0
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "3.10.0",
|
||||
"version": "3.10.2",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -35,6 +35,7 @@ interface Web3ButtonProps<TActionFn extends ActionFn>
|
||||
isDisabled?: boolean;
|
||||
// the fn to execute
|
||||
action: TActionFn;
|
||||
type?: "button" | "submit" | "reset";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,6 +69,7 @@ export const Web3Button = <TAction extends ActionFn>({
|
||||
children,
|
||||
action,
|
||||
className,
|
||||
type,
|
||||
...themeProps
|
||||
}: PropsWithChildren<Web3ButtonProps<TAction>>) => {
|
||||
const address = useAddress();
|
||||
@@ -137,6 +139,7 @@ export const Web3Button = <TAction extends ActionFn>({
|
||||
return (
|
||||
<ThemeProvider {...themeProps}>
|
||||
<Button
|
||||
type={type}
|
||||
className={className}
|
||||
style={{ height: "50px", minWidth: "200px", width: "100%" }}
|
||||
isLoading={mutation.isLoading || !contract}
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 3.10.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#697](https://github.com/thirdweb-dev/js/pull/697) [`2682f582`](https://github.com/thirdweb-dev/js/commit/2682f5823e5c71947f5c6a71918a0285f253fd18) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix fetching ABI on legacy contracts
|
||||
|
||||
- [#693](https://github.com/thirdweb-dev/js/pull/693) [`d5f18b40`](https://github.com/thirdweb-dev/js/commit/d5f18b403a6f3ced0e1929b5c032f63325708304) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Fix passing only chain name as the network to connect to
|
||||
|
||||
- [#694](https://github.com/thirdweb-dev/js/pull/694) [`2efe5be3`](https://github.com/thirdweb-dev/js/commit/2efe5be3ad2df4e80c0048c8fd35018ecf2d8dd9) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Optimize getContract calls with no type
|
||||
|
||||
- [#687](https://github.com/thirdweb-dev/js/pull/687) [`baeb7427`](https://github.com/thirdweb-dev/js/commit/baeb74274e878cfbc237ef2aa676faa257606300) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - New app uri defaults
|
||||
|
||||
## 3.10.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#688](https://github.com/thirdweb-dev/js/pull/688) [`68d52f99`](https://github.com/thirdweb-dev/js/commit/68d52f99b36c6744e45872d0bdebafbbf7d09b59) Thanks [@adam-maj](https://github.com/adam-maj)! - Poll if transaction can't be found yet on gasless
|
||||
|
||||
## 3.10.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "3.10.0",
|
||||
"version": "3.10.2",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -65,6 +65,11 @@ export async function fetchContractMetadataFromAddress(
|
||||
chainId,
|
||||
address,
|
||||
);
|
||||
if (!importedUri) {
|
||||
throw new Error(
|
||||
`Could not resolve metadata for contract at ${address}`,
|
||||
);
|
||||
}
|
||||
metadata = await fetchContractMetadata(importedUri, storage);
|
||||
} catch (err) {
|
||||
throw new Error(`Could not resolve metadata for contract at ${address}`);
|
||||
|
||||
@@ -102,11 +102,11 @@ export function getChainProvider(
|
||||
// Build a map of chainId -> ChainInfo based on the supportedChains
|
||||
const rpcMap: Record<number, ChainInfo> = buildDefaultMap(options);
|
||||
|
||||
// Resolve the chain id from the network, which could be a chain, chain name, or chain id
|
||||
const chainId = getChainIdFromNetwork(network, options);
|
||||
|
||||
let rpcUrl = "";
|
||||
let chainId;
|
||||
try {
|
||||
// Resolve the chain id from the network, which could be a chain, chain name, or chain id
|
||||
chainId = getChainIdFromNetwork(network, options);
|
||||
// Attempt to get the RPC url from the map based on the chainId
|
||||
rpcUrl = getChainRPC(rpcMap[chainId], {
|
||||
thirdwebApiKey: options.thirdwebApiKey || DEFAULT_API_KEY,
|
||||
@@ -114,13 +114,12 @@ export function getChainProvider(
|
||||
alchemyApiKey: options.alchemyApiKey,
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn("Failed to get chain RPC", e);
|
||||
// no-op
|
||||
}
|
||||
|
||||
// if we still don't have an url fall back to just using the chainId in the rpc and try that shit
|
||||
// if we still don't have an url fall back to just using the chainId or slug in the rpc and try that
|
||||
if (!rpcUrl) {
|
||||
rpcUrl = `https://${chainId}.rpc.thirdweb.com/${
|
||||
rpcUrl = `https://${chainId || network}.rpc.thirdweb.com/${
|
||||
options.thirdwebApiKey || DEFAULT_API_KEY
|
||||
}`;
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ export const PREBUILT_CONTRACTS_MAP = {
|
||||
|
||||
export const PREBUILT_CONTRACTS_APPURI_MAP = {
|
||||
[EditionDropInitializer.contractType]:
|
||||
"ipfs://QmbAgC8YwY36n8H2kuvSWsRisxDZ15QZw3xGZyk9aDvcv7/erc1155.html",
|
||||
"ipfs://QmNm3wRzpKYWo1SRtJfgfxtvudp5p2nXD6EttcsQJHwTmk",
|
||||
[EditionInitializer.contractType]: "",
|
||||
[MarketplaceInitializer.contractType]:
|
||||
"ipfs://QmbAgC8YwY36n8H2kuvSWsRisxDZ15QZw3xGZyk9aDvcv7/marketplace.html",
|
||||
@@ -635,10 +635,10 @@ export const PREBUILT_CONTRACTS_APPURI_MAP = {
|
||||
[MultiwrapInitializer.contractType]: "",
|
||||
[NFTCollectionInitializer.contractType]: "",
|
||||
[NFTDropInitializer.contractType]:
|
||||
"ipfs://QmbAgC8YwY36n8H2kuvSWsRisxDZ15QZw3xGZyk9aDvcv7/erc721.html",
|
||||
"ipfs://QmZptmVipc6SGFbKAyXcxGgohzTwYRXZ9LauRX5ite1xDK",
|
||||
[PackInitializer.contractType]: "",
|
||||
[SignatureDropInitializer.contractType]:
|
||||
"ipfs://QmbAgC8YwY36n8H2kuvSWsRisxDZ15QZw3xGZyk9aDvcv7/erc721.html",
|
||||
"ipfs://QmZptmVipc6SGFbKAyXcxGgohzTwYRXZ9LauRX5ite1xDK",
|
||||
[SplitInitializer.contractType]: "",
|
||||
[TokenDropInitializer.contractType]:
|
||||
"ipfs://QmbAgC8YwY36n8H2kuvSWsRisxDZ15QZw3xGZyk9aDvcv7/erc20.html",
|
||||
|
||||
@@ -463,8 +463,27 @@ export class Transaction<TResult = TransactionResult> {
|
||||
this.gaslessOptions,
|
||||
);
|
||||
|
||||
const sentTx = await this.provider.getTransaction(txHash);
|
||||
sentTx.wait = async () => this.provider.waitForTransaction(txHash);
|
||||
// Need to poll here because ethers.provider.getTransaction lies about the type
|
||||
// It can actually return null, which can happen if we're still in gasless API send queue
|
||||
let sentTx;
|
||||
let iteration = 1;
|
||||
while (!sentTx) {
|
||||
sentTx = await this.provider.getTransaction(txHash);
|
||||
|
||||
// Exponential (ish) backoff for polling
|
||||
if (!sentTx) {
|
||||
await new Promise((resolve) =>
|
||||
setTimeout(resolve, Math.min(iteration * 1000, 10000)),
|
||||
);
|
||||
iteration++;
|
||||
}
|
||||
|
||||
// Timeout if we still don't have it after a while
|
||||
if (iteration > 20) {
|
||||
throw new Error(`Unable to retrieve transaction with hash ${txHash}`);
|
||||
}
|
||||
}
|
||||
|
||||
return sentTx;
|
||||
}
|
||||
|
||||
|
||||
@@ -459,25 +459,26 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
// if we don't have a contractType or ABI then we will have to resolve it regardless
|
||||
// we also handle it being "custom" just in case...
|
||||
if (!contractTypeOrABI || contractTypeOrABI === "custom") {
|
||||
const resolvedContractType = await this.resolveContractType(address);
|
||||
if (resolvedContractType === "custom") {
|
||||
// if it's a custom contract we gotta fetch the compiler metadata
|
||||
try {
|
||||
const metadata =
|
||||
await this.getPublisher().fetchCompilerMetadataFromAddress(address);
|
||||
newContract = await this.getContractFromAbi(address, metadata.abi);
|
||||
} catch (e) {
|
||||
try {
|
||||
const metadata =
|
||||
await this.getPublisher().fetchCompilerMetadataFromAddress(address);
|
||||
newContract = await this.getContractFromAbi(address, metadata.abi);
|
||||
} catch (e) {
|
||||
// try resolving the contract type (legacy contracts)
|
||||
const resolvedContractType = await this.resolveContractType(address);
|
||||
if (resolvedContractType && resolvedContractType !== "custom") {
|
||||
// otherwise if it's a prebuilt contract we can just use the contract type
|
||||
const contractAbi = await PREBUILT_CONTRACTS_MAP[
|
||||
resolvedContractType
|
||||
].getAbi(address, this.getProvider(), this.storage);
|
||||
newContract = await this.getContractFromAbi(address, contractAbi);
|
||||
} else {
|
||||
// we cant fetch the ABI, and we don't know the contract type, throw an error
|
||||
const chainId = (await this.getProvider().getNetwork()).chainId;
|
||||
throw new Error(
|
||||
`No ABI found for this contract. Try importing it by visiting: https://thirdweb.com/${chainId}/${address}`,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// otherwise if it's a prebuilt contract we can just use the contract type
|
||||
const contractAbi = await PREBUILT_CONTRACTS_MAP[
|
||||
resolvedContractType
|
||||
].getAbi(address, this.getProvider(), this.storage);
|
||||
newContract = await this.getContractFromAbi(address, contractAbi);
|
||||
}
|
||||
}
|
||||
// if it's a builtin contract type we can just use the contract type to initialize the contract instance
|
||||
|
||||
@@ -61,7 +61,7 @@ import {
|
||||
OffersLogic__factory,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { ethers } from "ethers";
|
||||
import { ContractInterface, ethers } from "ethers";
|
||||
import hardhat from "hardhat";
|
||||
|
||||
// it's there, trust me bro
|
||||
@@ -160,21 +160,27 @@ export const mochaHooks = {
|
||||
await contractPublisher.deployed();
|
||||
|
||||
async function deployContract(
|
||||
contractFactory: ethers.ContractFactory,
|
||||
abi: ContractInterface,
|
||||
bytecode: string,
|
||||
contractType: ContractType,
|
||||
): Promise<ethers.Contract> {
|
||||
): Promise<string> {
|
||||
switch (contractType) {
|
||||
case MarketplaceInitializer.contractType:
|
||||
case MultiwrapInitializer.contractType:
|
||||
const nativeTokenWrapperAddress = getNativeTokenByChainId(
|
||||
ChainId.Hardhat,
|
||||
).wrapped.address;
|
||||
return await contractFactory.deploy(nativeTokenWrapperAddress);
|
||||
return await deployContractAndUploadMetadata(abi, bytecode, signer, [
|
||||
nativeTokenWrapperAddress,
|
||||
]);
|
||||
case PackInitializer.contractType:
|
||||
const addr = getNativeTokenByChainId(ChainId.Hardhat).wrapped.address;
|
||||
return await contractFactory.deploy(addr, trustedForwarderAddress);
|
||||
return await deployContractAndUploadMetadata(abi, bytecode, signer, [
|
||||
addr,
|
||||
trustedForwarderAddress,
|
||||
]);
|
||||
default:
|
||||
return await contractFactory.deploy();
|
||||
return await deployContractAndUploadMetadata(abi, bytecode, signer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,23 +231,15 @@ export const mochaHooks = {
|
||||
}
|
||||
|
||||
for (const factory of factories) {
|
||||
const contractFactory = new ethers.ContractFactory(
|
||||
const addr = await deployContract(
|
||||
factory.abi,
|
||||
factory.bytecode,
|
||||
).connect(signer);
|
||||
|
||||
const deployedContract: ethers.Contract = await deployContract(
|
||||
contractFactory,
|
||||
contractType as ContractType,
|
||||
);
|
||||
|
||||
await deployedContract.deployed();
|
||||
const tx = await thirdwebFactoryDeployer.addImplementation(
|
||||
deployedContract.address,
|
||||
);
|
||||
const tx = await thirdwebFactoryDeployer.addImplementation(addr);
|
||||
await tx.wait();
|
||||
implementations[contractType as ContractType] =
|
||||
deployedContract.address;
|
||||
implementations[contractType as ContractType] = addr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ describe("Custom Contracts", async () => {
|
||||
// if we update the test data - await uploadContractMetadata("Greeter", storage);
|
||||
|
||||
// only create this once by default (hits IPFS!)
|
||||
// TODO use mock storage instead
|
||||
customContractAddress = await realSDK.deployer.deployContractFromUri(
|
||||
simpleContractUri,
|
||||
[],
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
# @thirdweb-dev/unity-js-bridge
|
||||
|
||||
## 0.2.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`2682f582`](https://github.com/thirdweb-dev/js/commit/2682f5823e5c71947f5c6a71918a0285f253fd18), [`d30e3f4d`](https://github.com/thirdweb-dev/js/commit/d30e3f4db3d74589429e17da1a56e89e9e1082ab), [`d5f18b40`](https://github.com/thirdweb-dev/js/commit/d5f18b403a6f3ced0e1929b5c032f63325708304), [`2efe5be3`](https://github.com/thirdweb-dev/js/commit/2efe5be3ad2df4e80c0048c8fd35018ecf2d8dd9), [`31a252a0`](https://github.com/thirdweb-dev/js/commit/31a252a0ecafe338d1fbb3000b5dec55274a2d84), [`baeb7427`](https://github.com/thirdweb-dev/js/commit/baeb74274e878cfbc237ef2aa676faa257606300)]:
|
||||
- @thirdweb-dev/sdk@3.10.2
|
||||
- @thirdweb-dev/wallets@0.2.8
|
||||
|
||||
## 0.2.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`68d52f99`](https://github.com/thirdweb-dev/js/commit/68d52f99b36c6744e45872d0bdebafbbf7d09b59)]:
|
||||
- @thirdweb-dev/sdk@3.10.1
|
||||
|
||||
## 0.2.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/unity-js-bridge",
|
||||
"version": "0.2.14",
|
||||
"version": "0.2.16",
|
||||
"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,13 @@
|
||||
# @thirdweb-dev/wallets
|
||||
|
||||
## 0.2.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#696](https://github.com/thirdweb-dev/js/pull/696) [`d30e3f4d`](https://github.com/thirdweb-dev/js/commit/d30e3f4db3d74589429e17da1a56e89e9e1082ab) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Upgrade Paper SDK
|
||||
|
||||
- [#692](https://github.com/thirdweb-dev/js/pull/692) [`31a252a0`](https://github.com/thirdweb-dev/js/commit/31a252a0ecafe338d1fbb3000b5dec55274a2d84) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Cleanup PaperWallet integration
|
||||
|
||||
## 0.2.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -3,14 +3,40 @@
|
||||
<a href="https://thirdweb.com"><img src="https://github.com/thirdweb-dev/js/blob/main/packages/sdk/logo.svg?raw=true" width="200" alt=""/></a>
|
||||
<br />
|
||||
</p>
|
||||
<h1 align="center">thirdweb wallets</h1>
|
||||
<h1 align="center">thirdweb Wallet SDK</h1>
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.com/package/@thirdweb-dev/wallets"><img src="https://img.shields.io/npm/v/@thirdweb-dev/wallets?color=red&label=npm&logo=npm" alt="npm version"/></a>
|
||||
<a href="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml"><img alt="Build Status" src="https://github.com/thirdweb-dev/js/actions/workflows/build-test-lint.yml/badge.svg"/></a>
|
||||
<a href="https://discord.gg/thirdweb"><img alt="Join our Discord!" src="https://img.shields.io/discord/834227967404146718.svg?color=7289da&label=discord&logo=discord&style=flat"/></a>
|
||||
|
||||
</p>
|
||||
<!-- <p align="center"><strong>Best in class Web3 SDK for Browser, Node and Mobile apps</strong></p> -->
|
||||
<p align="center"><strong>Unified web3 Wallet library to integrate any wallet into your applications.</strong></p>
|
||||
<br />
|
||||
|
||||
### todo
|
||||
### A unified interface for ANY wallet
|
||||
|
||||
```ts
|
||||
const wallet = new Metamask();
|
||||
await wallet.connect();
|
||||
```
|
||||
|
||||
### Supported wallets
|
||||
|
||||
#### Browser wallets
|
||||
|
||||
- Metamask
|
||||
- Coinbase Wallet
|
||||
- Wallet Connect v1 and v2
|
||||
- Phantom
|
||||
- Injected
|
||||
- Device Wallet
|
||||
- Paper Wallet
|
||||
- Magic.link
|
||||
- Ethers
|
||||
|
||||
|
||||
#### Backend Wallets
|
||||
|
||||
- Privatekey
|
||||
- AWS KMs
|
||||
- AWS Sercret Manager
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"main": "dist/thirdweb-dev-wallets-evm-connectors-email.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets-evm-connectors-email.esm.js"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "dist/thirdweb-dev-wallets-evm-connectors-paper.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets-evm-connectors-paper.esm.js"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"main": "dist/thirdweb-dev-wallets-evm-wallets-email-wallet.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets-evm-wallets-email-wallet.esm.js"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"main": "dist/thirdweb-dev-wallets-evm-wallets-paper-wallet.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets-evm-wallets-paper-wallet.esm.js"
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/wallets",
|
||||
"version": "0.2.7",
|
||||
"version": "0.2.8",
|
||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||
"exports": {
|
||||
@@ -60,22 +60,22 @@
|
||||
"module": "./evm/wallets/private-key/dist/thirdweb-dev-wallets-evm-wallets-private-key.esm.js",
|
||||
"default": "./evm/wallets/private-key/dist/thirdweb-dev-wallets-evm-wallets-private-key.cjs.js"
|
||||
},
|
||||
"./evm/wallets/email-wallet": {
|
||||
"module": "./evm/wallets/email-wallet/dist/thirdweb-dev-wallets-evm-wallets-email-wallet.esm.js",
|
||||
"default": "./evm/wallets/email-wallet/dist/thirdweb-dev-wallets-evm-wallets-email-wallet.cjs.js"
|
||||
"./evm/wallets/paper-wallet": {
|
||||
"module": "./evm/wallets/paper-wallet/dist/thirdweb-dev-wallets-evm-wallets-paper-wallet.esm.js",
|
||||
"default": "./evm/wallets/paper-wallet/dist/thirdweb-dev-wallets-evm-wallets-paper-wallet.cjs.js"
|
||||
},
|
||||
"./evm/wallets/device-wallet": {
|
||||
"module": "./evm/wallets/device-wallet/dist/thirdweb-dev-wallets-evm-wallets-device-wallet.esm.js",
|
||||
"default": "./evm/wallets/device-wallet/dist/thirdweb-dev-wallets-evm-wallets-device-wallet.cjs.js"
|
||||
},
|
||||
"./evm/connectors/email": {
|
||||
"module": "./evm/connectors/email/dist/thirdweb-dev-wallets-evm-connectors-email.esm.js",
|
||||
"default": "./evm/connectors/email/dist/thirdweb-dev-wallets-evm-connectors-email.cjs.js"
|
||||
},
|
||||
"./evm/connectors/magic": {
|
||||
"module": "./evm/connectors/magic/dist/thirdweb-dev-wallets-evm-connectors-magic.esm.js",
|
||||
"default": "./evm/connectors/magic/dist/thirdweb-dev-wallets-evm-connectors-magic.cjs.js"
|
||||
},
|
||||
"./evm/connectors/paper": {
|
||||
"module": "./evm/connectors/paper/dist/thirdweb-dev-wallets-evm-connectors-paper.esm.js",
|
||||
"default": "./evm/connectors/paper/dist/thirdweb-dev-wallets-evm-connectors-paper.cjs.js"
|
||||
},
|
||||
"./evm/wallets/wallet-connect": {
|
||||
"module": "./evm/wallets/wallet-connect/dist/thirdweb-dev-wallets-evm-wallets-wallet-connect.esm.js",
|
||||
"default": "./evm/wallets/wallet-connect/dist/thirdweb-dev-wallets-evm-wallets-wallet-connect.cjs.js"
|
||||
@@ -142,15 +142,15 @@
|
||||
"localforage": "^1.10.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@thirdweb-dev/chains": "*",
|
||||
"@aws-sdk/client-secrets-manager": "^3.256.0",
|
||||
"@coinbase/wallet-sdk": "^3.6.3",
|
||||
"@magic-ext/connect": "^3.1.0",
|
||||
"@magic-ext/oauth": "^4.1.0",
|
||||
"@magic-sdk/provider": "^10.1.0",
|
||||
"@paperxyz/embedded-wallet-service-sdk": "^0.0.16",
|
||||
"@noble/ed25519": "^1.7.1",
|
||||
"@paperxyz/embedded-wallet-service-sdk": "^0.0.18",
|
||||
"@solana/web3.js": "^1.73.0",
|
||||
"@thirdweb-dev/chains": "*",
|
||||
"@wagmi/core": "^0.8.18",
|
||||
"@walletconnect/ethereum-provider": "^1.7.8",
|
||||
"bs58": "^5.0.0",
|
||||
@@ -207,16 +207,16 @@
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@thirdweb-dev/chains": "*",
|
||||
"@aws-sdk/client-secrets-manager": "^3.256.0",
|
||||
"@coinbase/wallet-sdk": "^3.6.3",
|
||||
"@magic-ext/connect": "^3.1.0",
|
||||
"@magic-ext/oauth": "^4.1.0",
|
||||
"@magic-sdk/provider": "^10.1.0",
|
||||
"@noble/ed25519": "^1.7.1",
|
||||
"@paperxyz/embedded-wallet-service-sdk": "^0.0.16",
|
||||
"@paperxyz/embedded-wallet-service-sdk": "^0.0.18",
|
||||
"@preconstruct/cli": "^2.2.1",
|
||||
"@solana/web3.js": "^1.73.0",
|
||||
"@thirdweb-dev/chains": "*",
|
||||
"@wagmi/core": "^0.8.18",
|
||||
"@walletconnect/ethereum-provider": "^1.7.8",
|
||||
"abitype": "^0.2.5",
|
||||
|
||||
+12
-17
@@ -1,33 +1,33 @@
|
||||
import { ConnectParams, TWConnector } from "../../interfaces/tw-connector";
|
||||
import {
|
||||
EmailWalletConnectionArgs,
|
||||
EmailWalletConnectorOptions,
|
||||
PaperWalletConnectionArgs,
|
||||
PaperWalletConnectorOptions,
|
||||
} from "./types";
|
||||
import {
|
||||
Chains,
|
||||
Chain,
|
||||
InitializedUser,
|
||||
PaperEmbeddedWalletSdk,
|
||||
UserStatus,
|
||||
} from "@paperxyz/embedded-wallet-service-sdk";
|
||||
import { ethers, Signer } from "ethers";
|
||||
|
||||
export const PaperChainMap: Record<number, Chains> = {
|
||||
export const PaperChainMap: Record<number, Chain> = {
|
||||
1: "Ethereum",
|
||||
5: "Goerli",
|
||||
137: "Polygon",
|
||||
80001: "Mumbai",
|
||||
};
|
||||
|
||||
export class EmailWalletConnector extends TWConnector<EmailWalletConnectionArgs> {
|
||||
readonly id: string = "email-wallet";
|
||||
readonly name: string = "Email Wallet";
|
||||
export class PaperWalletConnector extends TWConnector<PaperWalletConnectionArgs> {
|
||||
readonly id: string = "paper-wallet";
|
||||
readonly name: string = "Paper Wallet";
|
||||
ready: boolean = true;
|
||||
|
||||
private user: InitializedUser | null = null;
|
||||
private paper?: PaperEmbeddedWalletSdk;
|
||||
private options: EmailWalletConnectorOptions;
|
||||
private options: PaperWalletConnectorOptions;
|
||||
|
||||
constructor(options: EmailWalletConnectorOptions) {
|
||||
constructor(options: PaperWalletConnectorOptions) {
|
||||
super();
|
||||
this.options = options;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ export class EmailWalletConnector extends TWConnector<EmailWalletConnectionArgs>
|
||||
}
|
||||
}
|
||||
|
||||
async connect(args?: ConnectParams<EmailWalletConnectionArgs>) {
|
||||
async connect(args?: ConnectParams<PaperWalletConnectionArgs>) {
|
||||
const email = args?.email;
|
||||
if (!email) {
|
||||
throw new Error("No Email provided");
|
||||
@@ -61,12 +61,6 @@ export class EmailWalletConnector extends TWConnector<EmailWalletConnectionArgs>
|
||||
email,
|
||||
});
|
||||
this.user = authResult.user;
|
||||
/**
|
||||
TODO headless support
|
||||
await Paper.auth.sendPaperEmailLoginOtp({ email });
|
||||
const otp = await args?.handleOTP();
|
||||
const user = await Paper.auth.verifyPaperEmailLoginOtp({ email, otp });
|
||||
*/
|
||||
break;
|
||||
}
|
||||
case UserStatus.LOGGED_IN_WALLET_INITIALIZED: {
|
||||
@@ -85,7 +79,8 @@ export class EmailWalletConnector extends TWConnector<EmailWalletConnectionArgs>
|
||||
}
|
||||
|
||||
async getAddress(): Promise<string> {
|
||||
return await this.getUser().wallet.getAddress();
|
||||
const signer = await this.getSigner();
|
||||
return signer.getAddress();
|
||||
}
|
||||
|
||||
async isConnected(): Promise<boolean> {
|
||||
+3
-4
@@ -1,16 +1,15 @@
|
||||
import { Chain } from "@thirdweb-dev/chains";
|
||||
|
||||
export type EmailWalletOptions = {
|
||||
export type PaperWalletOptions = {
|
||||
clientId: string;
|
||||
chain: Pick<Chain, "chainId" | "rpc">;
|
||||
};
|
||||
|
||||
export interface EmailWalletConnectorOptions {
|
||||
export interface PaperWalletConnectorOptions {
|
||||
clientId: string;
|
||||
chain: Pick<Chain, "chainId" | "rpc">;
|
||||
}
|
||||
|
||||
export interface EmailWalletConnectionArgs {
|
||||
export interface PaperWalletConnectionArgs {
|
||||
email: string;
|
||||
handleOTP: () => Promise<string>;
|
||||
}
|
||||
@@ -8,6 +8,7 @@ export * from "./wallets/magic-auth";
|
||||
export * from "./wallets/private-key";
|
||||
export * from "./wallets/ethers";
|
||||
export * from "./wallets/device-wallet";
|
||||
export * from "./wallets/paper-wallet";
|
||||
// just the types
|
||||
export type { AbstractBrowserWallet, WalletOptions } from "./wallets/base";
|
||||
export type { WalletData, WalletEvents } from "./wallets/abstract";
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import {
|
||||
EmailWalletConnectionArgs,
|
||||
EmailWalletOptions,
|
||||
} from "../connectors/email/types";
|
||||
import { TWConnector } from "../interfaces/tw-connector";
|
||||
import { AbstractBrowserWallet, WalletOptions } from "./base";
|
||||
|
||||
export class EmailWallet extends AbstractBrowserWallet<
|
||||
EmailWalletOptions,
|
||||
EmailWalletConnectionArgs
|
||||
> {
|
||||
#connector?: TWConnector;
|
||||
|
||||
static id = "email-wallet" as const;
|
||||
public get walletName() {
|
||||
return "Email Wallet" as const;
|
||||
}
|
||||
|
||||
constructor(options: WalletOptions<EmailWalletOptions>) {
|
||||
super(EmailWallet.id, {
|
||||
...options,
|
||||
shouldAutoConnect: false, // TODO figure the autoconnect flow
|
||||
});
|
||||
}
|
||||
|
||||
protected async getConnector(): Promise<TWConnector> {
|
||||
if (!this.#connector) {
|
||||
const { EmailWalletConnector } = await import("../connectors/email");
|
||||
this.#connector = new EmailWalletConnector({
|
||||
clientId: this.options.clientId,
|
||||
chain: this.options.chain,
|
||||
});
|
||||
}
|
||||
return this.#connector;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import {
|
||||
PaperWalletConnectionArgs,
|
||||
PaperWalletOptions,
|
||||
} from "../connectors/paper/types";
|
||||
import { TWConnector } from "../interfaces/tw-connector";
|
||||
import { AbstractBrowserWallet, WalletOptions } from "./base";
|
||||
|
||||
export class PaperWallet extends AbstractBrowserWallet<
|
||||
PaperWalletOptions,
|
||||
PaperWalletConnectionArgs
|
||||
> {
|
||||
#connector?: TWConnector;
|
||||
|
||||
static id = "paper-wallet" as const;
|
||||
public get walletName() {
|
||||
return "Paper Wallet" as const;
|
||||
}
|
||||
|
||||
constructor(options: WalletOptions<PaperWalletOptions>) {
|
||||
super(PaperWallet.id, {
|
||||
...options,
|
||||
shouldAutoConnect: false, // TODO figure the autoconnect flow
|
||||
});
|
||||
}
|
||||
|
||||
protected async getConnector(): Promise<TWConnector> {
|
||||
if (!this.#connector) {
|
||||
const { PaperWalletConnector: PaperWalletConnector } = await import(
|
||||
"../connectors/paper"
|
||||
);
|
||||
this.#connector = new PaperWalletConnector({
|
||||
clientId: this.options.clientId,
|
||||
chain: this.options.chain,
|
||||
});
|
||||
}
|
||||
return this.#connector;
|
||||
}
|
||||
}
|
||||
@@ -4373,10 +4373,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@panva/hkdf/-/hkdf-1.0.4.tgz#4e02bb248402ff6c5c024e23a68438e2b0e69d67"
|
||||
integrity sha512-003xWiCuvePbLaPHT+CRuaV4GlyCAVm6XYSbBZDHoWZGn1mNkVKFaDbGJjjxmEFvizUwlCoM6O18FCBMMky2zQ==
|
||||
|
||||
"@paperxyz/embedded-wallet-service-sdk@^0.0.16":
|
||||
version "0.0.16"
|
||||
resolved "https://registry.yarnpkg.com/@paperxyz/embedded-wallet-service-sdk/-/embedded-wallet-service-sdk-0.0.16.tgz#0826a114f28268a2f9ef8457c8c453d284c2708e"
|
||||
integrity sha512-6XDxSS5+W9ReVwHhBBlt7M+FZwfrtpMwiiIOmdN8xvU6C4wbgwFaSUE5BgyUFeprYB1NNr9iC9UE7oPX7dqnwQ==
|
||||
"@paperxyz/embedded-wallet-service-sdk@^0.0.18":
|
||||
version "0.0.18"
|
||||
resolved "https://registry.yarnpkg.com/@paperxyz/embedded-wallet-service-sdk/-/embedded-wallet-service-sdk-0.0.18.tgz#6e55ef2464bf13d4073d4e33cd0c922f19684c08"
|
||||
integrity sha512-sMjd+3ZZpRky3dRmu2mX/hgYewU8RDOokhVp9ABqMKjOTsjC1n9Qg4DVsqhzWlEUd7hUtGcYAi3k2iH5cGnd6w==
|
||||
dependencies:
|
||||
"@ethersproject/abstract-signer" "^5.7.0"
|
||||
"@ethersproject/bytes" "^5.7.0"
|
||||
|
||||
Reference in New Issue
Block a user