thirdweb 5.94.2 → 5.95.0-nightly-64bd603301b3067b6a69a29f66a28dee7ffa38f5-20250416000349
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/utils.js +41 -0
- package/dist/cjs/chains/utils.js.map +1 -1
- package/dist/cjs/event/actions/get-events.js +65 -11
- package/dist/cjs/event/actions/get-events.js.map +1 -1
- package/dist/cjs/exports/insight.js +5 -0
- package/dist/cjs/exports/insight.js.map +1 -0
- package/dist/cjs/exports/thirdweb.js +6 -2
- package/dist/cjs/exports/thirdweb.js.map +1 -1
- package/dist/cjs/extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.js +104 -0
- package/dist/cjs/extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.js.map +1 -0
- package/dist/cjs/extensions/thirdweb/write/publish.js +9 -4
- package/dist/cjs/extensions/thirdweb/write/publish.js.map +1 -1
- package/dist/cjs/insight/get-events.js +54 -0
- package/dist/cjs/insight/get-events.js.map +1 -0
- package/dist/cjs/insight/get-nfts.js +45 -0
- package/dist/cjs/insight/get-nfts.js.map +1 -0
- package/dist/cjs/insight/get-tokens.js +46 -0
- package/dist/cjs/insight/get-tokens.js.map +1 -0
- package/dist/cjs/insight/get-transactions.js +45 -0
- package/dist/cjs/insight/get-transactions.js.map +1 -0
- package/dist/cjs/insight/index.js +12 -0
- package/dist/cjs/insight/index.js.map +1 -0
- package/dist/cjs/pay/buyWithCrypto/getHistory.js +2 -2
- package/dist/cjs/pay/buyWithCrypto/getHistory.js.map +1 -1
- package/dist/cjs/pay/buyWithCrypto/getStatus.js +2 -2
- package/dist/cjs/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getHistory.js +2 -2
- package/dist/cjs/pay/buyWithFiat/getHistory.js.map +1 -1
- package/dist/cjs/pay/buyWithFiat/getStatus.js +2 -2
- package/dist/cjs/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/cjs/pay/getBuyHistory.js +2 -2
- package/dist/cjs/pay/getBuyHistory.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js +4 -14
- package/dist/cjs/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +6 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +2 -2
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SendFunds.js +3 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/SendFunds.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewAssets.js +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewAssets.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js +74 -32
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js +46 -6
- package/dist/cjs/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
- package/dist/cjs/react/web/ui/MediaRenderer/useResolvedMediaType.js +4 -1
- package/dist/cjs/react/web/ui/MediaRenderer/useResolvedMediaType.js.map +1 -1
- package/dist/cjs/rpc/fetch-rpc.js +4 -4
- package/dist/cjs/rpc/fetch-rpc.js.map +1 -1
- package/dist/cjs/transaction/actions/gasless/providers/biconomy.js +0 -1
- package/dist/cjs/transaction/actions/gasless/providers/biconomy.js.map +1 -1
- package/dist/cjs/transaction/actions/gasless/providers/openzeppelin.js +0 -1
- package/dist/cjs/transaction/actions/gasless/providers/openzeppelin.js.map +1 -1
- package/dist/cjs/transaction/transaction-store.js +11 -10
- package/dist/cjs/transaction/transaction-store.js.map +1 -1
- package/dist/cjs/utils/fetch.js +5 -4
- package/dist/cjs/utils/fetch.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/esm/chains/utils.js +40 -0
- package/dist/esm/chains/utils.js.map +1 -1
- package/dist/esm/event/actions/get-events.js +62 -8
- package/dist/esm/event/actions/get-events.js.map +1 -1
- package/dist/esm/exports/insight.js +2 -0
- package/dist/esm/exports/insight.js.map +1 -0
- package/dist/esm/exports/thirdweb.js +4 -0
- package/dist/esm/exports/thirdweb.js.map +1 -1
- package/dist/esm/extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.js +98 -0
- package/dist/esm/extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.js.map +1 -0
- package/dist/esm/extensions/thirdweb/write/publish.js +9 -4
- package/dist/esm/extensions/thirdweb/write/publish.js.map +1 -1
- package/dist/esm/insight/get-events.js +51 -0
- package/dist/esm/insight/get-events.js.map +1 -0
- package/dist/esm/insight/get-nfts.js +42 -0
- package/dist/esm/insight/get-nfts.js.map +1 -0
- package/dist/esm/insight/get-tokens.js +43 -0
- package/dist/esm/insight/get-tokens.js.map +1 -0
- package/dist/esm/insight/get-transactions.js +42 -0
- package/dist/esm/insight/get-transactions.js.map +1 -0
- package/dist/esm/insight/index.js +5 -0
- package/dist/esm/insight/index.js.map +1 -0
- package/dist/esm/pay/buyWithCrypto/getHistory.js +2 -2
- package/dist/esm/pay/buyWithCrypto/getHistory.js.map +1 -1
- package/dist/esm/pay/buyWithCrypto/getStatus.js +2 -2
- package/dist/esm/pay/buyWithCrypto/getStatus.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getHistory.js +2 -2
- package/dist/esm/pay/buyWithFiat/getHistory.js.map +1 -1
- package/dist/esm/pay/buyWithFiat/getStatus.js +2 -2
- package/dist/esm/pay/buyWithFiat/getStatus.js.map +1 -1
- package/dist/esm/pay/getBuyHistory.js +2 -2
- package/dist/esm/pay/getBuyHistory.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/Details.js +4 -14
- package/dist/esm/react/web/ui/ConnectWallet/Details.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js +6 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js +2 -2
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/SendFunds.js +3 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/SendFunds.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewAssets.js +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewAssets.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js +75 -33
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewNFTs.js.map +1 -1
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js +46 -6
- package/dist/esm/react/web/ui/ConnectWallet/screens/ViewTokens.js.map +1 -1
- package/dist/esm/react/web/ui/MediaRenderer/useResolvedMediaType.js +4 -1
- package/dist/esm/react/web/ui/MediaRenderer/useResolvedMediaType.js.map +1 -1
- package/dist/esm/rpc/fetch-rpc.js +4 -4
- package/dist/esm/rpc/fetch-rpc.js.map +1 -1
- package/dist/esm/transaction/actions/gasless/providers/biconomy.js +0 -1
- package/dist/esm/transaction/actions/gasless/providers/biconomy.js.map +1 -1
- package/dist/esm/transaction/actions/gasless/providers/openzeppelin.js +0 -1
- package/dist/esm/transaction/actions/gasless/providers/openzeppelin.js.map +1 -1
- package/dist/esm/transaction/transaction-store.js +11 -10
- package/dist/esm/transaction/transaction-store.js.map +1 -1
- package/dist/esm/utils/fetch.js +5 -4
- package/dist/esm/utils/fetch.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/chains/types.d.ts +7 -0
- package/dist/types/chains/types.d.ts.map +1 -1
- package/dist/types/chains/utils.d.ts +15 -1
- package/dist/types/chains/utils.d.ts.map +1 -1
- package/dist/types/event/actions/get-events.d.ts +1 -6
- package/dist/types/event/actions/get-events.d.ts.map +1 -1
- package/dist/types/exports/insight.d.ts +2 -0
- package/dist/types/exports/insight.d.ts.map +1 -0
- package/dist/types/exports/thirdweb.d.ts +4 -0
- package/dist/types/exports/thirdweb.d.ts.map +1 -1
- package/dist/types/extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.d.ts +64 -0
- package/dist/types/extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.d.ts.map +1 -0
- package/dist/types/extensions/thirdweb/write/publish.d.ts.map +1 -1
- package/dist/types/insight/get-events.d.ts +31 -0
- package/dist/types/insight/get-events.d.ts.map +1 -0
- package/dist/types/insight/get-nfts.d.ts +25 -0
- package/dist/types/insight/get-nfts.d.ts.map +1 -0
- package/dist/types/insight/get-tokens.d.ts +25 -0
- package/dist/types/insight/get-tokens.d.ts.map +1 -0
- package/dist/types/insight/get-transactions.d.ts +25 -0
- package/dist/types/insight/get-transactions.d.ts.map +1 -0
- package/dist/types/insight/index.d.ts +5 -0
- package/dist/types/insight/index.d.ts.map +1 -0
- package/dist/types/pay/buyWithCrypto/getHistory.d.ts.map +1 -1
- package/dist/types/pay/buyWithCrypto/getStatus.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getHistory.d.ts.map +1 -1
- package/dist/types/pay/buyWithFiat/getStatus.d.ts.map +1 -1
- package/dist/types/pay/getBuyHistory.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/Details.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/SendFunds.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewNFTs.d.ts.map +1 -1
- package/dist/types/react/web/ui/ConnectWallet/screens/ViewTokens.d.ts.map +1 -1
- package/dist/types/react/web/ui/MediaRenderer/useResolvedMediaType.d.ts +1 -1
- package/dist/types/react/web/ui/MediaRenderer/useResolvedMediaType.d.ts.map +1 -1
- package/dist/types/rpc/fetch-rpc.d.ts.map +1 -1
- package/dist/types/transaction/actions/gasless/providers/biconomy.d.ts.map +1 -1
- package/dist/types/transaction/actions/gasless/providers/openzeppelin.d.ts.map +1 -1
- package/dist/types/transaction/transaction-store.d.ts.map +1 -1
- package/dist/types/utils/fetch.d.ts +1 -1
- package/dist/types/utils/fetch.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +8 -2
- package/src/chains/types.ts +8 -0
- package/src/chains/utils.ts +61 -0
- package/src/event/actions/get-events.test.ts +96 -0
- package/src/event/actions/get-events.ts +99 -12
- package/src/exports/insight.ts +1 -0
- package/src/exports/thirdweb.ts +5 -0
- package/src/extensions/dynamic-contracts/__generated__/IExtensionManager/read/getAllExtensions.ts +104 -0
- package/src/extensions/thirdweb/write/publish.ts +12 -4
- package/src/insight/get-events.ts +78 -0
- package/src/insight/get-nfts.ts +65 -0
- package/src/insight/get-tokens.ts +66 -0
- package/src/insight/get-transactions.ts +66 -0
- package/src/insight/index.ts +4 -0
- package/src/pay/buyWithCrypto/getHistory.ts +4 -2
- package/src/pay/buyWithCrypto/getStatus.ts +4 -2
- package/src/pay/buyWithFiat/getHistory.ts +4 -2
- package/src/pay/buyWithFiat/getStatus.ts +4 -2
- package/src/pay/getBuyHistory.ts +4 -2
- package/src/react/web/ui/ConnectWallet/Details.tsx +15 -33
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/ConfirmationScreen.tsx +10 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TokenSelectorScreen.tsx +2 -2
- package/src/react/web/ui/ConnectWallet/screens/Buy/swap/TransferConfirmationScreen.tsx +5 -1
- package/src/react/web/ui/ConnectWallet/screens/SendFunds.tsx +5 -1
- package/src/react/web/ui/ConnectWallet/screens/ViewAssets.tsx +1 -1
- package/src/react/web/ui/ConnectWallet/screens/ViewNFTs.tsx +107 -55
- package/src/react/web/ui/ConnectWallet/screens/ViewTokens.tsx +94 -11
- package/src/react/web/ui/MediaRenderer/useResolvedMediaType.ts +4 -1
- package/src/rpc/fetch-rpc.ts +6 -4
- package/src/transaction/actions/gasless/providers/biconomy.ts +0 -1
- package/src/transaction/actions/gasless/providers/openzeppelin.ts +0 -1
- package/src/transaction/transaction-store.ts +11 -22
- package/src/utils/fetch.ts +6 -5
- package/src/version.ts +1 -1
@@ -0,0 +1,65 @@
|
|
1
|
+
import {
|
2
|
+
type GetV1NftsBalanceByOwnerAddressData,
|
3
|
+
type GetV1NftsBalanceByOwnerAddressResponse,
|
4
|
+
getV1NftsBalanceByOwnerAddress,
|
5
|
+
} from "@thirdweb-dev/insight";
|
6
|
+
import { stringify } from "viem";
|
7
|
+
import type { Chain } from "../chains/types.js";
|
8
|
+
import type { ThirdwebClient } from "../client/client.js";
|
9
|
+
import { getThirdwebDomains } from "../utils/domains.js";
|
10
|
+
import { getClientFetch } from "../utils/fetch.js";
|
11
|
+
|
12
|
+
export type OwnedNFT = GetV1NftsBalanceByOwnerAddressResponse["data"][number];
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Get NFTs owned by an address
|
16
|
+
* @example
|
17
|
+
* ```ts
|
18
|
+
* import { Insight } from "thirdweb";
|
19
|
+
*
|
20
|
+
* const nfts = await Insight.getOwnedNFTs({
|
21
|
+
* client,
|
22
|
+
* chains: [sepolia],
|
23
|
+
* ownerAddress: "0x1234567890123456789012345678901234567890",
|
24
|
+
* });
|
25
|
+
* ```
|
26
|
+
* @insight
|
27
|
+
*/
|
28
|
+
export async function getOwnedNFTs(args: {
|
29
|
+
client: ThirdwebClient;
|
30
|
+
chains: Chain[];
|
31
|
+
ownerAddress: string;
|
32
|
+
queryOptions?: GetV1NftsBalanceByOwnerAddressData["query"];
|
33
|
+
}): Promise<OwnedNFT[]> {
|
34
|
+
const {
|
35
|
+
client,
|
36
|
+
chains,
|
37
|
+
ownerAddress,
|
38
|
+
queryOptions = {
|
39
|
+
chain: chains.map((chain) => chain.id),
|
40
|
+
metadata: "true",
|
41
|
+
limit: 100,
|
42
|
+
page: 1,
|
43
|
+
},
|
44
|
+
} = args;
|
45
|
+
|
46
|
+
const result = await getV1NftsBalanceByOwnerAddress({
|
47
|
+
baseUrl: `https://${getThirdwebDomains().insight}`,
|
48
|
+
fetch: getClientFetch(client),
|
49
|
+
path: {
|
50
|
+
ownerAddress: ownerAddress,
|
51
|
+
},
|
52
|
+
query: {
|
53
|
+
chain: chains.map((chain) => chain.id),
|
54
|
+
...queryOptions,
|
55
|
+
},
|
56
|
+
});
|
57
|
+
|
58
|
+
if (result.error) {
|
59
|
+
throw new Error(
|
60
|
+
`${result.response.status} ${result.response.statusText} - ${result.error ? stringify(result.error) : "Unknown error"}`,
|
61
|
+
);
|
62
|
+
}
|
63
|
+
|
64
|
+
return result.data?.data ?? [];
|
65
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import {
|
2
|
+
type GetV1TokensErc20ByOwnerAddressData,
|
3
|
+
type GetV1TokensErc20ByOwnerAddressResponse,
|
4
|
+
getV1TokensErc20ByOwnerAddress,
|
5
|
+
} from "@thirdweb-dev/insight";
|
6
|
+
import { stringify } from "viem";
|
7
|
+
import type { Chain } from "../chains/types.js";
|
8
|
+
import type { ThirdwebClient } from "../client/client.js";
|
9
|
+
import { getThirdwebDomains } from "../utils/domains.js";
|
10
|
+
import { getClientFetch } from "../utils/fetch.js";
|
11
|
+
|
12
|
+
export type OwnedToken = GetV1TokensErc20ByOwnerAddressResponse["data"][number];
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Get ERC20 tokens owned by an address
|
16
|
+
* @example
|
17
|
+
* ```ts
|
18
|
+
* import { Insight } from "thirdweb";
|
19
|
+
*
|
20
|
+
* const tokens = await Insight.getOwnedTokens({
|
21
|
+
* client,
|
22
|
+
* chains: [sepolia],
|
23
|
+
* ownerAddress: "0x1234567890123456789012345678901234567890",
|
24
|
+
* });
|
25
|
+
* ```
|
26
|
+
* @insight
|
27
|
+
*/
|
28
|
+
export async function getOwnedTokens(args: {
|
29
|
+
client: ThirdwebClient;
|
30
|
+
chains: Chain[];
|
31
|
+
ownerAddress: string;
|
32
|
+
queryOptions?: GetV1TokensErc20ByOwnerAddressData["query"];
|
33
|
+
}): Promise<OwnedToken[]> {
|
34
|
+
const {
|
35
|
+
client,
|
36
|
+
chains,
|
37
|
+
ownerAddress,
|
38
|
+
queryOptions = {
|
39
|
+
chain: chains.map((chain) => chain.id),
|
40
|
+
include_spam: "false",
|
41
|
+
metadata: "true",
|
42
|
+
limit: 100,
|
43
|
+
page: 1,
|
44
|
+
},
|
45
|
+
} = args;
|
46
|
+
|
47
|
+
const result = await getV1TokensErc20ByOwnerAddress({
|
48
|
+
baseUrl: `https://${getThirdwebDomains().insight}`,
|
49
|
+
fetch: getClientFetch(client),
|
50
|
+
path: {
|
51
|
+
ownerAddress: ownerAddress,
|
52
|
+
},
|
53
|
+
query: {
|
54
|
+
chain: chains.map((chain) => chain.id),
|
55
|
+
...queryOptions,
|
56
|
+
},
|
57
|
+
});
|
58
|
+
|
59
|
+
if (result.error) {
|
60
|
+
throw new Error(
|
61
|
+
`${result.response.status} ${result.response.statusText} - ${result.error ? stringify(result.error) : "Unknown error"}`,
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
65
|
+
return result.data?.data ?? [];
|
66
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
import {
|
2
|
+
type GetV1WalletsByWalletAddressTransactionsData,
|
3
|
+
type GetV1WalletsByWalletAddressTransactionsResponse,
|
4
|
+
getV1WalletsByWalletAddressTransactions,
|
5
|
+
} from "@thirdweb-dev/insight";
|
6
|
+
import { stringify } from "viem";
|
7
|
+
import type { Chain } from "../chains/types.js";
|
8
|
+
import type { ThirdwebClient } from "../client/client.js";
|
9
|
+
import { getThirdwebDomains } from "../utils/domains.js";
|
10
|
+
import { getClientFetch } from "../utils/fetch.js";
|
11
|
+
|
12
|
+
export type Transaction = NonNullable<
|
13
|
+
GetV1WalletsByWalletAddressTransactionsResponse["data"]
|
14
|
+
>[number];
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Get transactions for a wallet
|
18
|
+
* @example
|
19
|
+
* ```ts
|
20
|
+
* import { Insight } from "thirdweb";
|
21
|
+
*
|
22
|
+
* const transactions = await Insight.getTransactions({
|
23
|
+
* client,
|
24
|
+
* walletAddress: "0x1234567890123456789012345678901234567890",
|
25
|
+
* chains: [sepolia],
|
26
|
+
* });
|
27
|
+
* ```
|
28
|
+
* @insight
|
29
|
+
*/
|
30
|
+
export async function getTransactions(args: {
|
31
|
+
client: ThirdwebClient;
|
32
|
+
walletAddress: string;
|
33
|
+
chains: Chain[];
|
34
|
+
queryOptions?: GetV1WalletsByWalletAddressTransactionsData["query"];
|
35
|
+
}): Promise<Transaction[]> {
|
36
|
+
const threeMonthsAgoInSeconds = Math.floor(
|
37
|
+
(Date.now() - 3 * 30 * 24 * 60 * 60 * 1000) / 1000,
|
38
|
+
);
|
39
|
+
const {
|
40
|
+
client,
|
41
|
+
walletAddress,
|
42
|
+
chains,
|
43
|
+
queryOptions = {
|
44
|
+
filter_block_timestamp_gte: threeMonthsAgoInSeconds,
|
45
|
+
limit: 100,
|
46
|
+
page: 1,
|
47
|
+
},
|
48
|
+
} = args;
|
49
|
+
const result = await getV1WalletsByWalletAddressTransactions({
|
50
|
+
baseUrl: `https://${getThirdwebDomains().insight}`,
|
51
|
+
fetch: getClientFetch(client),
|
52
|
+
query: {
|
53
|
+
chain: chains.map((chain) => chain.id),
|
54
|
+
...queryOptions,
|
55
|
+
},
|
56
|
+
path: {
|
57
|
+
wallet_address: walletAddress,
|
58
|
+
},
|
59
|
+
});
|
60
|
+
if (result.error) {
|
61
|
+
throw new Error(
|
62
|
+
`${result.response.status} ${result.response.statusText} - ${result.error ? stringify(result.error) : "Unknown error"}`,
|
63
|
+
);
|
64
|
+
}
|
65
|
+
return result.data.data || [];
|
66
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export { getOwnedNFTs, type OwnedNFT } from "./get-nfts.js";
|
2
|
+
export { getOwnedTokens, type OwnedToken } from "./get-tokens.js";
|
3
|
+
export { getTransactions, type Transaction } from "./get-transactions.js";
|
4
|
+
export { getContractEvents, type ContractEvent } from "./get-events.js";
|
@@ -79,8 +79,10 @@ export async function getBuyWithCryptoHistory(
|
|
79
79
|
|
80
80
|
// Assuming the response directly matches the SwapResponse interface
|
81
81
|
if (!response.ok) {
|
82
|
-
response.
|
83
|
-
throw new Error(
|
82
|
+
const error = await response.text().catch(() => null);
|
83
|
+
throw new Error(
|
84
|
+
`HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
|
85
|
+
);
|
84
86
|
}
|
85
87
|
|
86
88
|
const data: BuyWithCryptoHistoryData = (await response.json()).result;
|
@@ -142,8 +142,10 @@ export async function getBuyWithCryptoStatus(
|
|
142
142
|
|
143
143
|
// Assuming the response directly matches the BuyWithCryptoStatus interface
|
144
144
|
if (!response.ok) {
|
145
|
-
response.
|
146
|
-
throw new Error(
|
145
|
+
const error = await response.text().catch(() => null);
|
146
|
+
throw new Error(
|
147
|
+
`HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
|
148
|
+
);
|
147
149
|
}
|
148
150
|
|
149
151
|
const data: BuyWithCryptoStatus = (await response.json()).result;
|
@@ -78,8 +78,10 @@ export async function getBuyWithFiatHistory(
|
|
78
78
|
|
79
79
|
// Assuming the response directly matches the BuyWithFiatStatus response interface
|
80
80
|
if (!response.ok) {
|
81
|
-
response.
|
82
|
-
throw new Error(
|
81
|
+
const error = await response.text().catch(() => null);
|
82
|
+
throw new Error(
|
83
|
+
`HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
|
84
|
+
);
|
83
85
|
}
|
84
86
|
|
85
87
|
const data: BuyWithFiatHistoryData = (await response.json()).result;
|
@@ -188,8 +188,10 @@ export async function getBuyWithFiatStatus(
|
|
188
188
|
const response = await getClientFetch(params.client)(url);
|
189
189
|
|
190
190
|
if (!response.ok) {
|
191
|
-
response.
|
192
|
-
throw new Error(
|
191
|
+
const error = await response.text().catch(() => null);
|
192
|
+
throw new Error(
|
193
|
+
`HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
|
194
|
+
);
|
193
195
|
}
|
194
196
|
|
195
197
|
return (await response.json()).result;
|
package/src/pay/getBuyHistory.ts
CHANGED
@@ -93,8 +93,10 @@ export async function getBuyHistory(
|
|
93
93
|
|
94
94
|
// Assuming the response directly matches the SwapResponse interface
|
95
95
|
if (!response.ok) {
|
96
|
-
response.
|
97
|
-
throw new Error(
|
96
|
+
const error = await response.text().catch(() => null);
|
97
|
+
throw new Error(
|
98
|
+
`HTTP error! status: ${response.status} - ${response.statusText}: ${error || "unknown error"}`,
|
99
|
+
);
|
98
100
|
}
|
99
101
|
|
100
102
|
const data: BuyHistoryData = (await response.json()).result;
|
@@ -703,11 +703,7 @@ export function DetailsModal(props: {
|
|
703
703
|
}}
|
704
704
|
>
|
705
705
|
<CoinsIcon size={iconSize.md} />
|
706
|
-
<Text color="primaryText">
|
707
|
-
{props.supportedNFTs
|
708
|
-
? locale.viewFunds.viewAssets
|
709
|
-
: locale.viewFunds.title}
|
710
|
-
</Text>
|
706
|
+
<Text color="primaryText">{locale.viewFunds.viewAssets}</Text>
|
711
707
|
</MenuButton>
|
712
708
|
)}
|
713
709
|
|
@@ -841,34 +837,20 @@ export function DetailsModal(props: {
|
|
841
837
|
/>
|
842
838
|
);
|
843
839
|
} else if (screen === "view-assets") {
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
);
|
859
|
-
} else {
|
860
|
-
// Always show tokens (has the native token at least)
|
861
|
-
content = (
|
862
|
-
<ViewTokens
|
863
|
-
supportedTokens={props.supportedTokens}
|
864
|
-
onBack={() => {
|
865
|
-
setScreen("main");
|
866
|
-
}}
|
867
|
-
client={client}
|
868
|
-
connectLocale={locale}
|
869
|
-
/>
|
870
|
-
);
|
871
|
-
}
|
840
|
+
content = (
|
841
|
+
<ViewAssets
|
842
|
+
supportedTokens={props.supportedTokens}
|
843
|
+
supportedNFTs={props.supportedNFTs}
|
844
|
+
onBack={() => {
|
845
|
+
setScreen("main");
|
846
|
+
}}
|
847
|
+
theme={props.theme}
|
848
|
+
setScreen={setScreen}
|
849
|
+
client={client}
|
850
|
+
connectLocale={locale}
|
851
|
+
assetTabs={props.detailsModal?.assetTabs}
|
852
|
+
/>
|
853
|
+
);
|
872
854
|
} else if (screen === "view-nfts") {
|
873
855
|
content = (
|
874
856
|
<ViewNFTs
|
@@ -68,7 +68,11 @@ export function SwapConfirmationScreen(props: {
|
|
68
68
|
|
69
69
|
const uiErrorMessage = useMemo(() => {
|
70
70
|
if (step === "approval" && status === "error" && error) {
|
71
|
-
if (
|
71
|
+
if (
|
72
|
+
error.toLowerCase().includes("user rejected") ||
|
73
|
+
error.toLowerCase().includes("user closed modal") ||
|
74
|
+
error.toLowerCase().includes("user denied")
|
75
|
+
) {
|
72
76
|
return {
|
73
77
|
title: "Failed to Approve",
|
74
78
|
message: "Your wallet rejected the approval request.",
|
@@ -82,7 +86,11 @@ export function SwapConfirmationScreen(props: {
|
|
82
86
|
}
|
83
87
|
|
84
88
|
if (step === "swap" && status === "error" && error) {
|
85
|
-
if (
|
89
|
+
if (
|
90
|
+
error.toLowerCase().includes("user rejected") ||
|
91
|
+
error.toLowerCase().includes("user closed modal") ||
|
92
|
+
error.toLowerCase().includes("user denied")
|
93
|
+
) {
|
86
94
|
return {
|
87
95
|
title: "Failed to Confirm",
|
88
96
|
message: "Your wallet rejected the confirmation request.",
|
@@ -176,11 +176,11 @@ export function TokenSelectorScreen(props: {
|
|
176
176
|
enabled: !!props.sourceSupportedTokens && !!chainInfo.data,
|
177
177
|
});
|
178
178
|
|
179
|
-
if (walletsAndBalances.isLoading ||
|
179
|
+
if (walletsAndBalances.isLoading || chainInfo.isLoading) {
|
180
180
|
return <LoadingScreen />;
|
181
181
|
}
|
182
182
|
|
183
|
-
const filteredWallets = Array.from(walletsAndBalances.data
|
183
|
+
const filteredWallets = Array.from(walletsAndBalances.data?.entries() || [])
|
184
184
|
.filter(([w]) => !props.hiddenWallets?.includes(w.id))
|
185
185
|
.filter(([, balances]) => {
|
186
186
|
const hasEnoughBalance = balances.some((b) => b.balance.value > 0);
|
@@ -112,7 +112,11 @@ export function TransferConfirmationScreen(
|
|
112
112
|
|
113
113
|
const uiErrorMessage = useMemo(() => {
|
114
114
|
if (step === "approve" && status.id === "error" && status.error) {
|
115
|
-
if (
|
115
|
+
if (
|
116
|
+
status.error.toLowerCase().includes("user rejected") ||
|
117
|
+
status.error.toLowerCase().includes("user closed modal") ||
|
118
|
+
status.error.toLowerCase().includes("user denied")
|
119
|
+
) {
|
116
120
|
return {
|
117
121
|
title: "Failed to Approve",
|
118
122
|
message: "Your wallet rejected the approval request.",
|
@@ -145,7 +145,11 @@ export function SendFundsForm(props: {
|
|
145
145
|
return locale.transactionFailed;
|
146
146
|
}
|
147
147
|
|
148
|
-
if (
|
148
|
+
if (
|
149
|
+
message.includes("user rejected") ||
|
150
|
+
message.includes("user closed modal") ||
|
151
|
+
message.includes("user denied")
|
152
|
+
) {
|
149
153
|
return locale.transactionRejected;
|
150
154
|
}
|
151
155
|
|
@@ -1,5 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import { useMemo } from "react";
|
1
|
+
import { useQuery } from "@tanstack/react-query";
|
3
2
|
import type { Chain } from "../../../../../chains/types.js";
|
4
3
|
import { getCachedChain } from "../../../../../chains/utils.js";
|
5
4
|
import type { ThirdwebClient } from "../../../../../client/client.js";
|
@@ -8,6 +7,9 @@ import { getOwnedNFTs as getErc721OwnedNFTs } from "../../../../../extensions/er
|
|
8
7
|
import { isERC721 } from "../../../../../extensions/erc721/read/isERC721.js";
|
9
8
|
import { getOwnedNFTs as getErc1155OwnedNFTs } from "../../../../../extensions/erc1155/read/getOwnedNFTs.js";
|
10
9
|
import { isERC1155 } from "../../../../../extensions/erc1155/read/isERC1155.js";
|
10
|
+
import { getOwnedNFTs } from "../../../../../insight/get-nfts.js";
|
11
|
+
import type { Address } from "../../../../../utils/address.js";
|
12
|
+
import type { NFT } from "../../../../../utils/nft/parseNft.js";
|
11
13
|
import type { Theme } from "../../../../core/design-system/index.js";
|
12
14
|
import { useActiveAccount } from "../../../../core/hooks/wallets/useActiveAccount.js";
|
13
15
|
import { useActiveWalletChain } from "../../../../core/hooks/wallets/useActiveWalletChain.js";
|
@@ -16,6 +18,7 @@ import { MediaRenderer } from "../../MediaRenderer/MediaRenderer.js";
|
|
16
18
|
import { Skeleton } from "../../components/Skeleton.js";
|
17
19
|
import { Spacer } from "../../components/Spacer.js";
|
18
20
|
import { Container, Line, ModalHeader } from "../../components/basic.js";
|
21
|
+
import { Text } from "../../components/text.js";
|
19
22
|
import type { ConnectLocale } from "../locale/types.js";
|
20
23
|
|
21
24
|
const fetchNFTs = async (
|
@@ -108,44 +111,90 @@ export function ViewNFTsContent(props: {
|
|
108
111
|
const activeAccount = useActiveAccount();
|
109
112
|
const activeChain = useActiveWalletChain();
|
110
113
|
|
111
|
-
const
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
address,
|
119
|
-
chain: getCachedChain(Number.parseInt(chainId)),
|
120
|
-
})),
|
121
|
-
);
|
114
|
+
const nftQuery = useQuery({
|
115
|
+
queryKey: ["nfts", activeChain?.id, activeAccount?.address],
|
116
|
+
queryFn: async (): Promise<
|
117
|
+
(NFT & { chain: Chain; address: Address; quantityOwned: bigint })[]
|
118
|
+
> => {
|
119
|
+
if (!activeAccount) {
|
120
|
+
throw new Error("No active account");
|
122
121
|
}
|
123
|
-
|
124
|
-
|
125
|
-
|
122
|
+
if (!activeChain) {
|
123
|
+
throw new Error("No active chain");
|
124
|
+
}
|
125
|
+
|
126
|
+
const result = await getOwnedNFTs({
|
127
|
+
client: props.client,
|
128
|
+
chains: [activeChain],
|
129
|
+
ownerAddress: activeAccount.address,
|
130
|
+
});
|
131
|
+
|
132
|
+
return result
|
133
|
+
.filter((nft) => !!nft.name && !!nft.image_url)
|
134
|
+
.map((nft) => {
|
135
|
+
let parsedNft: NFT;
|
136
|
+
const metadata = {
|
137
|
+
name: nft.name,
|
138
|
+
description: nft.description,
|
139
|
+
image: nft.image_url,
|
140
|
+
animation_url: nft.video_url,
|
141
|
+
external_url: nft.external_url,
|
142
|
+
background_color: nft.background_color,
|
143
|
+
uri: nft.metadata_url ?? "",
|
144
|
+
image_url: nft.image_url,
|
145
|
+
attributes: Array.isArray(nft.extra_metadata?.attributes)
|
146
|
+
? nft.extra_metadata?.attributes?.reduce(
|
147
|
+
(acc, attr) => {
|
148
|
+
acc[attr.trait_type] = attr.value;
|
149
|
+
return acc;
|
150
|
+
},
|
151
|
+
{} as Record<string, unknown>,
|
152
|
+
)
|
153
|
+
: {},
|
154
|
+
};
|
126
155
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
156
|
+
if (nft.contract?.type === "erc1155") {
|
157
|
+
parsedNft = {
|
158
|
+
id: BigInt(nft.token_id),
|
159
|
+
type: "ERC1155",
|
160
|
+
owner: activeAccount.address,
|
161
|
+
tokenURI: nft.metadata_url ?? "",
|
162
|
+
supply: BigInt(nft.balance), // TODO: this is wrong
|
163
|
+
metadata,
|
164
|
+
};
|
165
|
+
} else {
|
166
|
+
parsedNft = {
|
167
|
+
id: BigInt(nft.token_id),
|
168
|
+
type: "ERC721",
|
169
|
+
owner: activeAccount.address,
|
170
|
+
tokenURI: nft.metadata_url ?? "",
|
171
|
+
metadata,
|
172
|
+
};
|
173
|
+
}
|
174
|
+
|
175
|
+
return {
|
176
|
+
chain: getCachedChain(nft.chain_id),
|
177
|
+
address: nft.token_address as Address,
|
178
|
+
quantityOwned: BigInt(nft.balance),
|
179
|
+
...parsedNft,
|
180
|
+
};
|
181
|
+
});
|
182
|
+
},
|
183
|
+
enabled: !!activeChain && !!activeAccount,
|
143
184
|
});
|
144
185
|
|
145
186
|
if (!activeChain?.id || !activeAccount?.address) {
|
146
187
|
return null;
|
147
188
|
}
|
148
189
|
|
190
|
+
const filteredNFTs = props.supportedNFTs?.[activeChain.id]
|
191
|
+
? nftQuery.data?.filter((nft) =>
|
192
|
+
props.supportedNFTs?.[activeChain.id]
|
193
|
+
?.map((supportedNFTAddress) => supportedNFTAddress.toLowerCase())
|
194
|
+
.includes(nft.address.toLowerCase()),
|
195
|
+
)
|
196
|
+
: nftQuery.data;
|
197
|
+
|
149
198
|
return (
|
150
199
|
<>
|
151
200
|
<Container
|
@@ -155,29 +204,21 @@ export function ViewNFTsContent(props: {
|
|
155
204
|
gap: "12px",
|
156
205
|
}}
|
157
206
|
>
|
158
|
-
{
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
<
|
165
|
-
key={`${
|
166
|
-
|
167
|
-
|
207
|
+
{nftQuery.error ? (
|
208
|
+
<Text>Error loading NFTs</Text>
|
209
|
+
) : nftQuery.isLoading || !filteredNFTs ? (
|
210
|
+
<Skeleton height="150px" width="150px" />
|
211
|
+
) : (
|
212
|
+
filteredNFTs.map((nft) => (
|
213
|
+
<NftCard
|
214
|
+
key={`${nft.chain.id}:${nft.address}:${nft.id}`}
|
215
|
+
{...nft}
|
216
|
+
client={props.client}
|
217
|
+
chain={nft.chain}
|
218
|
+
theme={props.theme}
|
168
219
|
/>
|
169
|
-
)
|
170
|
-
|
171
|
-
<NftCard
|
172
|
-
key={`${nft.chain.id}:${nft.address}:${nft.id}`}
|
173
|
-
{...nft}
|
174
|
-
client={props.client}
|
175
|
-
chain={nft.chain}
|
176
|
-
theme={props.theme}
|
177
|
-
/>
|
178
|
-
))
|
179
|
-
);
|
180
|
-
})}
|
220
|
+
))
|
221
|
+
)}
|
181
222
|
</Container>
|
182
223
|
<Spacer y="lg" />
|
183
224
|
</>
|
@@ -198,6 +239,7 @@ function NftCard(
|
|
198
239
|
<div
|
199
240
|
style={{
|
200
241
|
display: "flex",
|
242
|
+
width: "150px",
|
201
243
|
flexDirection: "column",
|
202
244
|
gap: "4px",
|
203
245
|
alignItems: "center",
|
@@ -263,7 +305,17 @@ function NftCard(
|
|
263
305
|
/>
|
264
306
|
)}
|
265
307
|
</div>
|
266
|
-
<
|
308
|
+
<Text
|
309
|
+
size="xs"
|
310
|
+
color="primaryText"
|
311
|
+
style={{
|
312
|
+
fontWeight: 600,
|
313
|
+
textAlign: "center",
|
314
|
+
maxLines: 2,
|
315
|
+
}}
|
316
|
+
>
|
317
|
+
{props.metadata.name}
|
318
|
+
</Text>
|
267
319
|
</div>
|
268
320
|
);
|
269
321
|
|