thirdweb 5.53.0-nightly-9d84aff26615b6a553ac002e7f51a0ed5172eb5d-20240909000344 → 5.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chains/chain-definitions/assetchain-testnet.js +25 -0
- package/dist/cjs/chains/chain-definitions/assetchain-testnet.js.map +1 -0
- package/dist/cjs/exports/react.native.js +4 -1
- package/dist/cjs/exports/react.native.js.map +1 -1
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js +4 -2
- package/dist/cjs/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/cjs/social/profiles.js.map +1 -1
- package/dist/cjs/utils/bytecode/resolveImplementation.js +17 -10
- package/dist/cjs/utils/bytecode/resolveImplementation.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/cjs/wallets/coinbase/coinbaseMobileSDK.js +52 -24
- package/dist/cjs/wallets/coinbase/coinbaseMobileSDK.js.map +1 -1
- package/dist/cjs/wallets/coinbase/coinbaseWebSDK.js.map +1 -1
- package/dist/cjs/wallets/coinbase/utils.js +1 -1
- package/dist/cjs/wallets/coinbase/utils.js.map +1 -1
- package/dist/esm/chains/chain-definitions/assetchain-testnet.js +22 -0
- package/dist/esm/chains/chain-definitions/assetchain-testnet.js.map +1 -0
- package/dist/esm/exports/react.native.js +2 -0
- package/dist/esm/exports/react.native.js.map +1 -1
- package/dist/esm/exports/social.js +0 -1
- package/dist/esm/exports/social.js.map +1 -1
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js +4 -2
- package/dist/esm/react/core/hooks/transaction/useSendTransaction.js.map +1 -1
- package/dist/esm/social/profiles.js.map +1 -1
- package/dist/esm/utils/bytecode/resolveImplementation.js +17 -10
- package/dist/esm/utils/bytecode/resolveImplementation.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/esm/wallets/coinbase/coinbaseMobileSDK.js +50 -22
- package/dist/esm/wallets/coinbase/coinbaseMobileSDK.js.map +1 -1
- package/dist/esm/wallets/coinbase/coinbaseWebSDK.js.map +1 -1
- package/dist/esm/wallets/coinbase/utils.js +1 -1
- package/dist/esm/wallets/coinbase/utils.js.map +1 -1
- package/dist/types/chains/chain-definitions/assetchain-testnet.d.ts +7 -0
- package/dist/types/chains/chain-definitions/assetchain-testnet.d.ts.map +1 -0
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/exports/react.native.d.ts +2 -0
- package/dist/types/exports/react.native.d.ts.map +1 -1
- package/dist/types/exports/social.d.ts +1 -1
- package/dist/types/exports/social.d.ts.map +1 -1
- package/dist/types/react/core/hooks/transaction/useSendTransaction.d.ts.map +1 -1
- package/dist/types/react/core/social/useSocialProfiles.d.ts +1 -1
- package/dist/types/react/core/social/useSocialProfiles.d.ts.map +1 -1
- package/dist/types/react/core/utils/wallet.d.ts +1 -1
- package/dist/types/social/profiles.d.ts +2 -2
- package/dist/types/social/profiles.d.ts.map +1 -1
- package/dist/types/social/types.d.ts +2 -2
- package/dist/types/social/types.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/dist/types/wallets/coinbase/coinbaseMobileSDK.d.ts +2 -3
- package/dist/types/wallets/coinbase/coinbaseMobileSDK.d.ts.map +1 -1
- package/dist/types/wallets/coinbase/coinbaseWebSDK.d.ts.map +1 -1
- package/package.json +14 -1
- package/src/chains/chain-definitions/assetchain-testnet.ts +22 -0
- package/src/event/actions/get-events.test.ts +13 -0
- package/src/exports/react.native.ts +9 -0
- package/src/exports/react.ts +6 -0
- package/src/exports/social.ts +6 -1
- package/src/extensions/modules/ClaimableERC1155/claimableERC1155.test.ts +1 -1
- package/src/extensions/modules/ClaimableERC20/claimableERC20.test.ts +1 -1
- package/src/extensions/modules/ClaimableERC721/claimableERC721.test.ts +1 -1
- package/src/extensions/modules/OpenEditionMetadataERC721/openEditionERC721.test.ts +1 -1
- package/src/extensions/prebuilts/deploy-modular-core.test.ts +1 -1
- package/src/react/core/hooks/transaction/useSendTransaction.ts +4 -2
- package/src/social/profiles.ts +3 -3
- package/src/social/types.ts +2 -2
- package/src/utils/bytecode/resolveImplementation.test.ts +9 -0
- package/src/utils/bytecode/resolveImplementation.ts +21 -13
- package/src/version.ts +1 -1
- package/src/wallets/coinbase/coinbaseMobileSDK.ts +66 -35
- package/src/wallets/coinbase/coinbaseWebSDK.ts +0 -1
- package/src/wallets/coinbase/utils.ts +1 -1
package/src/social/profiles.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import type { ThirdwebClient } from "../client/client.js";
|
2
2
|
import { getThirdwebBaseUrl } from "../utils/domains.js";
|
3
3
|
import { getClientFetch } from "../utils/fetch.js";
|
4
|
-
import type {
|
4
|
+
import type { SocialProfile } from "./types.js";
|
5
5
|
|
6
6
|
/**
|
7
7
|
* Fetches the wallet's available social profiles.
|
@@ -23,7 +23,7 @@ import type { SocialProfiles } from "./types.js";
|
|
23
23
|
export async function getSocialProfiles(args: {
|
24
24
|
address: string;
|
25
25
|
client: ThirdwebClient;
|
26
|
-
}): Promise<
|
26
|
+
}): Promise<SocialProfile[]> {
|
27
27
|
const { address, client } = args;
|
28
28
|
|
29
29
|
const clientFetch = getClientFetch(client);
|
@@ -42,5 +42,5 @@ export async function getSocialProfiles(args: {
|
|
42
42
|
}
|
43
43
|
}
|
44
44
|
|
45
|
-
return (await response.json()).data as
|
45
|
+
return (await response.json()).data as SocialProfile[];
|
46
46
|
}
|
package/src/social/types.ts
CHANGED
@@ -34,10 +34,10 @@ export type EnsProfile = {
|
|
34
34
|
telegram?: string;
|
35
35
|
};
|
36
36
|
|
37
|
-
export type
|
37
|
+
export type SocialProfile = {
|
38
38
|
type: "farcaster" | "lens" | "ens";
|
39
39
|
name?: string;
|
40
40
|
avatar?: string;
|
41
41
|
bio?: string;
|
42
42
|
metadata?: FarcasterProfile | LensProfile | EnsProfile;
|
43
|
-
}
|
43
|
+
};
|
@@ -8,6 +8,8 @@ import {
|
|
8
8
|
import { ANVIL_CHAIN } from "../../../test/src/chains.js";
|
9
9
|
import { TEST_CLIENT } from "../../../test/src/test-clients.js";
|
10
10
|
import {
|
11
|
+
BASE_USDC_IMPLEMENTATION,
|
12
|
+
BASE_USDC_PROXY_CONTRACT,
|
11
13
|
NFT_DROP_CONTRACT,
|
12
14
|
NFT_DROP_IMPLEMENTATION,
|
13
15
|
POLYGON_USDT_IMPLEMENTATION,
|
@@ -31,6 +33,13 @@ describe("Resolve implementation", async () => {
|
|
31
33
|
);
|
32
34
|
});
|
33
35
|
|
36
|
+
it("should extract implementation address for base USDC proxy contract", async () => {
|
37
|
+
const resolved = resolveImplementation(BASE_USDC_PROXY_CONTRACT);
|
38
|
+
expect((await resolved).address).to.equal(
|
39
|
+
BASE_USDC_IMPLEMENTATION.toLowerCase(),
|
40
|
+
);
|
41
|
+
});
|
42
|
+
|
34
43
|
it("should extract implementation address for ERC1967 proxy contract", async () => {
|
35
44
|
const implementationAddress = await deployContract({
|
36
45
|
client: TEST_CLIENT,
|
@@ -120,24 +120,32 @@ async function getImplementationFromStorageSlot(
|
|
120
120
|
});
|
121
121
|
|
122
122
|
try {
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
if (proxyStorage === ZERO_BYTES32 && contract.chain.id === 137) {
|
132
|
-
proxyStorage = await eth_getStorageAt(rpcRequest, {
|
123
|
+
const proxyStoragePromises = [
|
124
|
+
eth_getStorageAt(rpcRequest, {
|
125
|
+
address: contract.address,
|
126
|
+
position:
|
127
|
+
"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc",
|
128
|
+
}),
|
129
|
+
eth_getStorageAt(rpcRequest, {
|
133
130
|
address: contract.address,
|
134
131
|
position:
|
135
132
|
// keccak256("matic.network.proxy.implementation") - used in polygon USDT proxy: https://polygonscan.com/address/0xc2132d05d31c914a87c6611c10748aeb04b58e8f#code
|
136
133
|
"0xbaab7dbf64751104133af04abc7d9979f0fda3b059a322a8333f533d3f32bf7f",
|
137
|
-
})
|
138
|
-
|
134
|
+
}),
|
135
|
+
eth_getStorageAt(rpcRequest, {
|
136
|
+
address: contract.address,
|
137
|
+
position:
|
138
|
+
// keccak256("org.zeppelinos.proxy.implementation") - e.g. base USDC proxy: https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913#code
|
139
|
+
"0x7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c3",
|
140
|
+
}),
|
141
|
+
];
|
139
142
|
|
140
|
-
|
143
|
+
const proxyStorages = await Promise.all(proxyStoragePromises);
|
144
|
+
const proxyStorage = proxyStorages.find(
|
145
|
+
(storage) => storage !== ZERO_BYTES32,
|
146
|
+
);
|
147
|
+
|
148
|
+
return proxyStorage ? `0x${proxyStorage.slice(-40)}` : AddressZero;
|
141
149
|
} catch {
|
142
150
|
return undefined;
|
143
151
|
}
|
package/src/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = "5.53.0
|
1
|
+
export const version = "5.53.0";
|
@@ -1,9 +1,5 @@
|
|
1
|
-
import { configure, handleResponse } from "@coinbase/wallet-mobile-sdk";
|
2
1
|
import type { ProviderInterface } from "@coinbase/wallet-sdk";
|
3
|
-
import {
|
4
|
-
import type { Chain } from "../../chains/types.js";
|
5
|
-
import type { COINBASE } from "../constants.js";
|
6
|
-
import type { CreateWalletArgs } from "../wallet-types.js";
|
2
|
+
import type { CoinbaseWalletCreationOptions } from "./coinbaseWebSDK.js";
|
7
3
|
|
8
4
|
let _provider: ProviderInterface | undefined;
|
9
5
|
|
@@ -11,44 +7,78 @@ let _provider: ProviderInterface | undefined;
|
|
11
7
|
* @internal
|
12
8
|
*/
|
13
9
|
export async function getCoinbaseMobileProvider(
|
14
|
-
options?:
|
10
|
+
options?: CoinbaseWalletCreationOptions,
|
15
11
|
): Promise<ProviderInterface> {
|
16
12
|
if (!_provider) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
13
|
+
// if explicitly set to smart wallet only, use the smart wallet provider
|
14
|
+
const useSmartWallet = options?.walletConfig?.options === "smartWalletOnly";
|
15
|
+
let mobileProvider: ProviderInterface;
|
16
|
+
if (useSmartWallet) {
|
17
|
+
mobileProvider = (await initSmartWalletProvider(
|
18
|
+
options,
|
19
|
+
)) as unknown as ProviderInterface;
|
20
|
+
const ExpoLinking = await import("expo-linking");
|
21
|
+
const { handleResponse } = await import("@mobile-wallet-protocol/client");
|
22
|
+
ExpoLinking.addEventListener("url", ({ url }) => {
|
23
|
+
handleResponse(url);
|
24
|
+
});
|
25
|
+
} else {
|
26
|
+
// otherwise, use the coinbase app provider
|
27
|
+
// TODO: remove this path once the new @mobile-wallet-protocol/client supports it
|
28
|
+
mobileProvider = (await initCoinbaseAppProvider(
|
29
|
+
options,
|
30
|
+
)) as unknown as ProviderInterface;
|
31
|
+
const ExpoLinking = await import("expo-linking");
|
32
|
+
const { handleResponse } = await import("@coinbase/wallet-mobile-sdk");
|
33
|
+
ExpoLinking.addEventListener("url", ({ url }) => {
|
33
34
|
// @ts-expect-error - Passing a URL object to handleResponse crashes the function
|
34
35
|
handleResponse(url);
|
35
|
-
}
|
36
|
-
}
|
36
|
+
});
|
37
|
+
}
|
38
|
+
_provider = mobileProvider;
|
37
39
|
return mobileProvider;
|
38
40
|
}
|
39
41
|
return _provider;
|
40
42
|
}
|
41
43
|
|
42
|
-
async function
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
async function initSmartWalletProvider(
|
45
|
+
options?: CoinbaseWalletCreationOptions,
|
46
|
+
) {
|
47
|
+
const { EIP1193Provider, Wallets } = await import(
|
48
|
+
"@mobile-wallet-protocol/client"
|
49
|
+
);
|
50
|
+
const appDeeplinkUrl = options?.mobileConfig?.callbackURL;
|
51
|
+
if (!appDeeplinkUrl) {
|
52
|
+
throw new Error(
|
53
|
+
"callbackURL is required. Set it when creating the coinbase wallet. Ex: createWallet('com.coinbase.wallet', { mobileConfig: { callbackUrl: 'https://example.com' }}",
|
54
|
+
);
|
55
|
+
}
|
56
|
+
const sdk = new EIP1193Provider({
|
57
|
+
metadata: {
|
58
|
+
appName: options?.appMetadata?.name || "thirdweb powered app",
|
59
|
+
appChainIds: options?.chains?.map((c) => c.id),
|
60
|
+
appDeeplinkUrl,
|
61
|
+
appLogoUrl: options?.appMetadata?.logoUrl,
|
62
|
+
},
|
63
|
+
wallet: Wallets.CoinbaseSmartWallet, // TODO support both smart and EOA once the SDK supports it
|
64
|
+
});
|
65
|
+
return sdk;
|
66
|
+
}
|
67
|
+
|
68
|
+
async function initCoinbaseAppProvider(
|
69
|
+
options?: CoinbaseWalletCreationOptions,
|
70
|
+
) {
|
71
|
+
const appDeeplinkUrl = options?.mobileConfig?.callbackURL;
|
72
|
+
if (!appDeeplinkUrl) {
|
73
|
+
throw new Error(
|
74
|
+
"callbackURL is required. Set it when creating the coinbase wallet. Ex: createWallet('com.coinbase.wallet', { mobileConfig: { callbackUrl: 'https://example.com' }}",
|
75
|
+
);
|
76
|
+
}
|
77
|
+
const { configure } = await import("@coinbase/wallet-mobile-sdk");
|
48
78
|
configure({
|
49
|
-
callbackURL: new URL(
|
50
|
-
hostURL: new URL(
|
51
|
-
hostPackageName:
|
79
|
+
callbackURL: new URL(appDeeplinkUrl),
|
80
|
+
hostURL: new URL("https://wallet.coinbase.com/wsegue"),
|
81
|
+
hostPackageName: "org.toshi",
|
52
82
|
});
|
53
83
|
let CoinbaseWalletMobileSDK = (
|
54
84
|
await import(
|
@@ -67,8 +97,9 @@ async function initMobileProvider(args: {
|
|
67
97
|
}
|
68
98
|
).default;
|
69
99
|
}
|
100
|
+
const chain = options.chains?.[0];
|
70
101
|
return new CoinbaseWalletMobileSDK({
|
71
|
-
jsonRpcUrl:
|
72
|
-
chainId:
|
102
|
+
jsonRpcUrl: chain?.rpc,
|
103
|
+
chainId: chain?.id,
|
73
104
|
});
|
74
105
|
}
|
@@ -2,5 +2,5 @@ import type { ProviderInterface } from "@coinbase/wallet-sdk";
|
|
2
2
|
|
3
3
|
export async function showCoinbasePopup(provider: ProviderInterface) {
|
4
4
|
// biome-ignore lint/suspicious/noExplicitAny: based on the latest CB SDK - scary but works
|
5
|
-
await (provider as any)?.communicator?.waitForPopupLoaded();
|
5
|
+
await (provider as any)?.communicator?.waitForPopupLoaded?.();
|
6
6
|
}
|