Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a6f516b4f | ||
|
|
7461e2a914 | ||
|
|
178609a062 | ||
|
|
8ea8f6e954 | ||
|
|
b49efc24ac | ||
|
|
6853e87a49 |
@@ -1,5 +1,7 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.3.16
|
||||
|
||||
## 0.3.15
|
||||
|
||||
## 0.3.14
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.3.15",
|
||||
"version": "0.3.16",
|
||||
"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,23 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.3.16
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1880](https://github.com/thirdweb-dev/js/pull/1880) [`7461e2a9`](https://github.com/thirdweb-dev/js/commit/7461e2a9145549b7e08bc34d87d44be9bcff2c07) Thanks [@iketw](https://github.com/iketw)! - Fixes wallet icons borders bug
|
||||
|
||||
- [#1878](https://github.com/thirdweb-dev/js/pull/1878) [`178609a0`](https://github.com/thirdweb-dev/js/commit/178609a0622b571560188a4266247eb342759ea1) Thanks [@iketw](https://github.com/iketw)! - Adds support for Japanese and Spanish
|
||||
|
||||
You can now pass 'ja' or 'es' to our ThirdwebProvider:
|
||||
|
||||
```
|
||||
import { ThirdwebProvider } from '@thirdweb-dev/react-native';
|
||||
|
||||
<ThirdwebProvider locale={'ja'}>
|
||||
<App />
|
||||
</ ThirdwebProvider>
|
||||
```
|
||||
|
||||
## 0.3.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.3.15",
|
||||
"version": "0.3.16",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
+2
-8
@@ -10,7 +10,7 @@ import { useMemo, useState } from "react";
|
||||
import { TextBalance } from "../base/TextBalance";
|
||||
import { SupportedTokens } from "../SendFunds/defaultTokens";
|
||||
import { SMART_WALLET_ICON } from "../../assets/svgs";
|
||||
import { ImageSvgUri } from "../base";
|
||||
import { WalletIcon } from "../base";
|
||||
import { useLocale } from "../../providers/ui-context-provider";
|
||||
|
||||
export type ConnectWalletDetailsProps = {
|
||||
@@ -92,13 +92,7 @@ export const WalletDetailsButton = ({
|
||||
alignContent="center"
|
||||
justifyContent="flex-start"
|
||||
>
|
||||
<Box borderRadius="lg" overflow="hidden">
|
||||
<ImageSvgUri
|
||||
width={32}
|
||||
height={32}
|
||||
imageUrl={avatarUrl || walletIconUrl}
|
||||
/>
|
||||
</Box>
|
||||
<WalletIcon iconUri={avatarUrl || walletIconUrl} size={32} />
|
||||
<Box ml="md" justifyContent="center" alignItems="flex-start">
|
||||
{activeWallet?.walletId === LocalWallet.id ? (
|
||||
<Text variant="bodySmall" color="red">
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import Box from "./Box";
|
||||
import ImageSvgUri from "./ImageSvgUri";
|
||||
|
||||
export const WalletIcon = ({
|
||||
@@ -7,5 +8,9 @@ export const WalletIcon = ({
|
||||
iconUri: string;
|
||||
size: number;
|
||||
}) => {
|
||||
return <ImageSvgUri imageUrl={iconUri} width={size} height={size} />;
|
||||
return (
|
||||
<Box borderRadius="sm" overflow="hidden">
|
||||
<ImageSvgUri imageUrl={iconUri} width={size} height={size} />
|
||||
</Box>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
export const _en = {
|
||||
connect_wallet: {
|
||||
label: "Connect Wallet",
|
||||
},
|
||||
connect_wallet_details: {
|
||||
additional_actions: "Additional Actions",
|
||||
address_copied_clipboard: "Address copied to clipboard",
|
||||
backup_wallet: "Backup Wallet",
|
||||
backup_personal_wallet: "Backup personal wallet",
|
||||
import_wallet: "Import Wallet",
|
||||
connected_to_smart_wallet: "Connected to a Smart Wallet",
|
||||
current_network: "Current Network",
|
||||
backup: "Backup",
|
||||
connect_to_app: "Connect to App",
|
||||
guest: "Guest",
|
||||
connect: "Connect",
|
||||
new_to_wallets: "New to wallets?",
|
||||
view_transaction_history: "View Transaction History",
|
||||
get_started: "Get started",
|
||||
receive_funds: "Receive Funds",
|
||||
search_or_paste_token: "Search or paste token address",
|
||||
connect_a_wallet: "Connect a wallet",
|
||||
continue_as_guest: "Continue as guest",
|
||||
tos: "Terms of Service",
|
||||
privacy_policy: "Privacy Policy",
|
||||
by_connecting_you_agree: "By connecting, you agree to the",
|
||||
copy_address_or_scan:
|
||||
"Copy the wallet address or scan the QR code to send funds to this wallet.",
|
||||
request_testnet_funds: "Request Testnet Funds",
|
||||
your_address: "Your address",
|
||||
qr_code: "QR Code",
|
||||
select_token: "Select Token",
|
||||
send_to: "Send to",
|
||||
send_funds: "Send Funds",
|
||||
no_tokens_found: "No Tokens found",
|
||||
confirm_in_wallet: "Confirm in your wallet",
|
||||
select_network: "Select Network",
|
||||
switch_to: "Switch to",
|
||||
no_supported_chains_detected: "No supported chains detected",
|
||||
recommended: "Recommended",
|
||||
network_mismatch:
|
||||
"There's a network mismatch between your contract and your wallet",
|
||||
},
|
||||
connecting_wallet: {
|
||||
creating_encrypting:
|
||||
"Creating, encrypting and securing your device wallet.",
|
||||
connecting_your_wallet: "Connecting your wallet",
|
||||
connecting_through_pop_up:
|
||||
"Login and connect your app through the wallet pop-up",
|
||||
},
|
||||
local_wallet: {
|
||||
guest_wallet: "Guest Wallet",
|
||||
backup_your_wallet: "Backup your wallet",
|
||||
create_new_wallet: "Create new wallet",
|
||||
private_key_mnemonic: "Or Private key or Mnemonic",
|
||||
private_key_mnemonic_placeholder: "Private key / Mnemonic",
|
||||
application_can_authorize_transactions:
|
||||
"The application can authorize any transactions on behalf of the wallet without any approvals. We recommend only connecting to trusted applications.",
|
||||
double_check_password: "Please, double check your password or private key.",
|
||||
error_accessing_file: "Error accessing the file. Please try again.",
|
||||
wallet_address: "Wallet Address",
|
||||
this_will_download_json:
|
||||
"This will download a JSON file containing your wallet information onto your device encrypted with the password.",
|
||||
this_is_a_temporary_wallet:
|
||||
"This is a temporary guest wallet. Download a backup if you don't want to loose access to it.",
|
||||
},
|
||||
smart_wallet: {
|
||||
switch_to_smart: "Switch to Smart Wallet",
|
||||
switch_to_personal: "Switch to Personal Wallet",
|
||||
network_mismatch: "Network Mismatch",
|
||||
connecting: "Connecting",
|
||||
},
|
||||
embedded_wallet: {
|
||||
request_new_code: "Request new code",
|
||||
sign_in: "Sign In",
|
||||
sign_in_google: "Sign in with Google",
|
||||
enter_your_email: "Enter your email address",
|
||||
forgot_password: "Forgot password",
|
||||
enter_account_recovery_code: "Enter account recovery code",
|
||||
backup_your_account: "Backup your account",
|
||||
},
|
||||
wallet_connect: {
|
||||
no_results_found: "No results found",
|
||||
search_wallets: "Search Wallets",
|
||||
},
|
||||
common: {
|
||||
connect_app: "Connect app",
|
||||
unknown_network: "Unknown Network",
|
||||
fetching: "Fetching...",
|
||||
password: "Password",
|
||||
reject: "Reject",
|
||||
approve: "Approve",
|
||||
switch_network: "Switch Network",
|
||||
import: "Import",
|
||||
username: "Username",
|
||||
amount: "Amount",
|
||||
send: "Send",
|
||||
receive: "Receive",
|
||||
continue: "Continue",
|
||||
error_switching_network: "Error switching network",
|
||||
or: "OR",
|
||||
from: "from",
|
||||
to: "from",
|
||||
next: "Next",
|
||||
learn_more: "Learn More",
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,113 @@
|
||||
export const _es = {
|
||||
connect_wallet: {
|
||||
label: "Conectar Cartera",
|
||||
},
|
||||
connect_wallet_details: {
|
||||
additional_actions: "Acciones Adicionales",
|
||||
address_copied_clipboard: "Dirección copiada al portapapeles",
|
||||
backup_wallet: "Respaldar Cartera",
|
||||
backup_personal_wallet: "Respaldar cartera personal",
|
||||
import_wallet: "Importar Cartera",
|
||||
connected_to_smart_wallet: "Conectado a una Cartera Inteligente",
|
||||
current_network: "Red Actual",
|
||||
backup: "Respaldar",
|
||||
connect_to_app: "Conectar a la Aplicación",
|
||||
guest: "Invitado",
|
||||
connect: "Conectar",
|
||||
new_to_wallets: "¿Nuevo en billeteras?",
|
||||
view_transaction_history: "Ver Historial de Transacciones",
|
||||
get_started: "Comenzar",
|
||||
receive_funds: "Recibir Fondos",
|
||||
search_or_paste_token: "Buscar o pegar dirección del token",
|
||||
connect_a_wallet: "Conectar una cartera",
|
||||
continue_as_guest: "Continuar como invitado",
|
||||
tos: "Términos de Servicio",
|
||||
privacy_policy: "Política de Privacidad",
|
||||
by_connecting_you_agree: "Al conectar, aceptas los",
|
||||
copy_address_or_scan:
|
||||
"Copia la dirección de la cartera o escanea el código QR para enviar fondos a esta cartera.",
|
||||
request_testnet_funds: "Solicitar Fondos de Testnet",
|
||||
your_address: "Tu dirección",
|
||||
qr_code: "Código QR",
|
||||
select_token: "Seleccionar Token",
|
||||
send_to: "Enviar a",
|
||||
send_funds: "Enviar Fondos",
|
||||
no_tokens_found: "No se encontraron tokens",
|
||||
confirm_in_wallet: "Confirma en tu cartera",
|
||||
select_network: "Seleccionar Red",
|
||||
switch_to: "Cambiar a",
|
||||
no_supported_chains_detected: "No se detectaron cadenas compatibles",
|
||||
recommended: "Recomendado",
|
||||
network_mismatch: "Hay un desajuste de red entre tu contrato y tu cartera",
|
||||
},
|
||||
connecting_wallet: {
|
||||
creating_encrypting:
|
||||
"Creando, cifrando y asegurando tu cartera de dispositivo.",
|
||||
connecting_your_wallet: "Conectando tu cartera",
|
||||
connecting_through_pop_up:
|
||||
"Iniciar sesión y conectar tu aplicación a través del pop-up de la cartera",
|
||||
},
|
||||
local_wallet: {
|
||||
guest_wallet: "Cartera de Invitado",
|
||||
backup_your_wallet: "Haz un respaldo de tu cartera",
|
||||
create_new_wallet: "Crear nueva cartera",
|
||||
private_key_mnemonic: "O clave privada o frase mnemotécnica",
|
||||
private_key_mnemonic_placeholder: "Clave privada / Frase mnemotécnica",
|
||||
application_can_authorize_transactions:
|
||||
"La aplicación puede autorizar cualquier transacción en nombre de la cartera sin aprobaciones. Recomendamos conectar solo a aplicaciones de confianza.",
|
||||
double_check_password: "Por favor, verifica tu contraseña o clave privada.",
|
||||
error_accessing_file:
|
||||
"Error al acceder al archivo. Por favor, inténtalo de nuevo.",
|
||||
wallet_address: "Dirección de la Cartera",
|
||||
this_will_download_json:
|
||||
"Esto descargará un archivo JSON que contiene la información de tu cartera en tu dispositivo cifrada con la contraseña.",
|
||||
this_is_a_temporary_wallet:
|
||||
"Esta es una cartera de invitado temporal. Descarga un respaldo si no quieres perder el acceso a ella.",
|
||||
},
|
||||
smart_wallet: {
|
||||
switch_to_smart: "Cambiar a Cartera Inteligente",
|
||||
switch_to_personal: "Cambiar a Cartera Personal",
|
||||
network_mismatch: "Desajuste de Red",
|
||||
connecting: "Conectando",
|
||||
},
|
||||
embedded_wallet: {
|
||||
request_new_code: "Solicitar nuevo código",
|
||||
sign_in: "Iniciar Sesión",
|
||||
sign_in_google: "Iniciar sesión con Google",
|
||||
enter_your_email: "Ingresa tu dirección de correo electrónico",
|
||||
forgot_password: "Olvidé mi contraseña",
|
||||
enter_account_recovery_code: "Ingresa el código de recuperación de cuenta",
|
||||
backup_your_account: "Haz un respaldo de tu cuenta",
|
||||
enter_password: "Introduce contraseña",
|
||||
create_password: "Crear contraseña",
|
||||
set_password_message:
|
||||
"Establece una contraseña para tu cuenta. Necesitarás esta contraseña cuando te conectes desde un nuevo dispositivo.",
|
||||
enter_password_for_email: "Ingresa la contraseña del correo electrónico",
|
||||
make_sure_you_save_it: "Asegúrate de guardarlo",
|
||||
},
|
||||
wallet_connect: {
|
||||
no_results_found: "No se encontraron resultados",
|
||||
search_wallets: "Buscar Billeteras",
|
||||
},
|
||||
common: {
|
||||
connect_app: "Conectar aplicación",
|
||||
unknown_network: "Red Desconocida",
|
||||
fetching: "Recuperando...",
|
||||
password: "Contraseña",
|
||||
reject: "Rechazar",
|
||||
approve: "Aprobar",
|
||||
switch_network: "Cambiar Red",
|
||||
import: "Importar",
|
||||
username: "Nombre de usuario",
|
||||
amount: "Cantidad",
|
||||
send: "Enviar",
|
||||
receive: "Recibir",
|
||||
continue: "Continuar",
|
||||
error_switching_network: "Error al cambiar de red",
|
||||
or: "O",
|
||||
from: "de",
|
||||
to: "a",
|
||||
next: "Siguiente",
|
||||
learn_more: "Saber más",
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,109 @@
|
||||
export const _ja = {
|
||||
connect_wallet: {
|
||||
label: "ウォレットを接続",
|
||||
},
|
||||
connect_wallet_details: {
|
||||
additional_actions: "追加のアクション",
|
||||
address_copied_clipboard: "アドレスがクリップボードにコピーされました",
|
||||
backup_wallet: "ウォレットのバックアップ",
|
||||
backup_personal_wallet: "個人のウォレットのバックアップ",
|
||||
import_wallet: "ウォレットのインポート",
|
||||
connected_to_smart_wallet: "スマートウォレットに接続されています",
|
||||
current_network: "現在のネットワーク",
|
||||
backup: "バックアップ",
|
||||
connect_to_app: "アプリに接続",
|
||||
guest: "ゲスト",
|
||||
connect: "接続",
|
||||
kpepe: "KPEPE",
|
||||
new_to_wallets: "ウォレットは初めてですか?",
|
||||
view_transaction_history: "取引履歴を見る",
|
||||
get_started: "開始する",
|
||||
receive_funds: "資金を受け取る",
|
||||
search_or_paste_token: "トークンのアドレスを検索または貼り付け",
|
||||
connect_a_wallet: "ウォレットを接続",
|
||||
continue_as_guest: "ゲストとして続行",
|
||||
tos: "利用規約",
|
||||
privacy_policy: "プライバシーポリシー",
|
||||
by_connecting_you_agree: "接続することで、あなたは以下に同意します",
|
||||
copy_address_or_scan:
|
||||
"ウォレットのアドレスをコピーするか、QRコードをスキャンして資金をこのウォレットに送信します",
|
||||
request_testnet_funds: "テストネットの資金をリクエスト",
|
||||
your_address: "あなたのアドレス",
|
||||
qr_code: "QRコード",
|
||||
select_token: "トークンを選択",
|
||||
send_to: "送信先",
|
||||
send_funds: "資金を送る",
|
||||
no_tokens_found: "トークンが見つかりません",
|
||||
confirm_in_wallet: "ウォレットで確認",
|
||||
select_network: "ネットワークを選択",
|
||||
switch_to: "に切り替える",
|
||||
no_supported_chains_detected:
|
||||
"サポートされているチェーンが検出されませんでした",
|
||||
recommended: "推奨",
|
||||
network_mismatch:
|
||||
"あなたのコントラクトとウォレットの間にネットワークの不一致があります",
|
||||
},
|
||||
connecting_wallet: {
|
||||
creating_encrypting: "デバイスのウォレットを作成、暗号化、保護しています",
|
||||
connecting_your_wallet: "ウォレットを接続しています",
|
||||
connecting_through_pop_up:
|
||||
"ウォレットのポップアップを通じてアプリにログインして接続します",
|
||||
},
|
||||
local_wallet: {
|
||||
guest_wallet: "ゲストウォレット",
|
||||
backup_your_wallet: "ウォレットをバックアップ",
|
||||
create_new_wallet: "新しいウォレットを作成",
|
||||
private_key_mnemonic: "または、秘密鍵またはニーモニック",
|
||||
private_key_mnemonic_placeholder: "秘密鍵 / ニーモニック",
|
||||
application_can_authorize_transactions:
|
||||
"アプリケーションは、承認なしにウォレットを代わりにトランザクションを許可することができます 信頼できるアプリケーションのみに接続することをおすすめします",
|
||||
double_check_password: "パスワードまたは秘密鍵を再度確認してください",
|
||||
error_accessing_file:
|
||||
"ファイルにアクセスできませんでしたもう一度試してください",
|
||||
wallet_address: "ウォレットのアドレス",
|
||||
this_will_download_json:
|
||||
"これにより、パスワードで暗号化されたウォレット情報を含むJSONファイルがデバイスにダウンロードされます",
|
||||
this_is_a_temporary_wallet:
|
||||
"これは一時的なゲストウォレットです アクセスを失わないようにバックアップをダウンロードしてください",
|
||||
},
|
||||
smart_wallet: {
|
||||
switch_to_smart: "スマートウォレットに切り替え",
|
||||
switch_to_personal: "個人のウォレットに切り替え",
|
||||
network_mismatch: "ネットワークの不一致",
|
||||
connecting: "接続中",
|
||||
},
|
||||
embedded_wallet: {
|
||||
request_new_code: "新しいコードをリクエスト",
|
||||
sign_in: "サインイン",
|
||||
sign_in_google: "Googleでサインイン",
|
||||
enter_your_email: "メールアドレスを入力",
|
||||
forgot_password: "パスワードを忘れた",
|
||||
enter_account_recovery_code: "アカウント回復コードを入力",
|
||||
backup_your_account: "アカウントのバックアップ",
|
||||
},
|
||||
wallet_connect: {
|
||||
no_results_found: "結果が見つかりません",
|
||||
search_wallets: "ウォレットを検索",
|
||||
},
|
||||
common: {
|
||||
connect_app: "アプリに接続",
|
||||
unknown_network: "不明なネットワーク",
|
||||
fetching: "取得中...",
|
||||
password: "パスワード",
|
||||
reject: "拒否",
|
||||
approve: "承認",
|
||||
switch_network: "ネットワークの切り替え",
|
||||
import: "インポート",
|
||||
username: "ユーザー名",
|
||||
amount: "金額",
|
||||
send: "送信",
|
||||
receive: "受け取り",
|
||||
continue: "続行",
|
||||
error_switching_network: "ネットワークの切り替えエラー",
|
||||
or: "または",
|
||||
from: "から",
|
||||
to: "まで",
|
||||
next: "次へ",
|
||||
learn_more: "もっと詳しく",
|
||||
},
|
||||
};
|
||||
@@ -1,13 +1,21 @@
|
||||
import { DeepPartial, deepMerge } from "../types/deepPartial";
|
||||
import { Locale, LocaleType, _en } from "./types";
|
||||
import { _en } from "./en";
|
||||
import { _es } from "./es";
|
||||
import { _ja } from "./ja";
|
||||
import { Locale, LocaleType } from "./types";
|
||||
|
||||
export const setLocale = (locale: Locale): LocaleType => {
|
||||
if (typeof locale === "string") {
|
||||
if (locale === "en") {
|
||||
return en();
|
||||
switch (locale) {
|
||||
case "en":
|
||||
return _en;
|
||||
case "es":
|
||||
return _es;
|
||||
case "ja":
|
||||
return _ja;
|
||||
default:
|
||||
throw new Error(`Locale ${locale} not supported`);
|
||||
}
|
||||
|
||||
throw new Error(`Locale ${locale} not supported`);
|
||||
}
|
||||
return locale;
|
||||
};
|
||||
@@ -18,3 +26,17 @@ export const en = (locale?: DeepPartial<LocaleType>): LocaleType => {
|
||||
}
|
||||
return deepMerge(_en, locale);
|
||||
};
|
||||
|
||||
export const ja = (locale?: DeepPartial<LocaleType>): LocaleType => {
|
||||
if (!locale) {
|
||||
return _ja;
|
||||
}
|
||||
return deepMerge(_ja, locale);
|
||||
};
|
||||
|
||||
export const es = (locale?: DeepPartial<LocaleType>): LocaleType => {
|
||||
if (!locale) {
|
||||
return _es;
|
||||
}
|
||||
return deepMerge(_es, locale);
|
||||
};
|
||||
|
||||
@@ -1,111 +1,5 @@
|
||||
export type Locale = LocaleType | "en";
|
||||
import { _en } from "./en";
|
||||
|
||||
export type Locale = LocaleType | "en" | "es" | "ja";
|
||||
|
||||
export type LocaleType = typeof _en;
|
||||
|
||||
export const _en = {
|
||||
connect_wallet: {
|
||||
label: "Connect Wallet",
|
||||
},
|
||||
connect_wallet_details: {
|
||||
additional_actions: "Additional Actions",
|
||||
address_copied_clipboard: "Address copied to clipboard",
|
||||
backup_wallet: "Backup Wallet",
|
||||
backup_personal_wallet: "Backup personal wallet",
|
||||
import_wallet: "Import Wallet",
|
||||
connected_to_smart_wallet: "Connected to a Smart Wallet",
|
||||
current_network: "Current Network",
|
||||
backup: "Backup",
|
||||
connect_to_app: "Connect to App",
|
||||
guest: "Guest",
|
||||
connect: "Connect",
|
||||
new_to_wallets: "New to wallets?",
|
||||
view_transaction_history: "View Transaction History",
|
||||
get_started: "Get started",
|
||||
receive_funds: "Receive Funds",
|
||||
search_or_paste_token: "Search or paste token address",
|
||||
connect_a_wallet: "Connect a wallet",
|
||||
continue_as_guest: "Continue as guest",
|
||||
tos: "Terms of Service",
|
||||
privacy_policy: "Privacy Policy",
|
||||
by_connecting_you_agree: "By connecting, you agree to the",
|
||||
copy_address_or_scan:
|
||||
"Copy the wallet address or scan the QR code to send funds to this wallet.",
|
||||
request_testnet_funds: "Request Testnet Funds",
|
||||
your_address: "Your address",
|
||||
qr_code: "QR Code",
|
||||
select_token: "Select Token",
|
||||
send_to: "Send to",
|
||||
send_funds: "Send Funds",
|
||||
no_tokens_found: "No Tokens found",
|
||||
confirm_in_wallet: "Confirm in your wallet",
|
||||
select_network: "Select Network",
|
||||
switch_to: "Switch to",
|
||||
no_supported_chains_detected: "No supported chains detected",
|
||||
recommended: "Recommended",
|
||||
network_mismatch:
|
||||
"There's a network mismatch between your contract and your wallet",
|
||||
},
|
||||
connecting_wallet: {
|
||||
creating_encrypting:
|
||||
"Creating, encrypting and securing your device wallet.",
|
||||
connecting_your_wallet: "Connecting your wallet",
|
||||
connecting_through_pop_up:
|
||||
"Login and connect your app through the wallet pop-up",
|
||||
},
|
||||
local_wallet: {
|
||||
guest_wallet: "Guest Wallet",
|
||||
backup_your_wallet: "Backup your wallet",
|
||||
create_new_wallet: "Create new wallet",
|
||||
private_key_mnemonic: "Or Private key or Mnemonic",
|
||||
private_key_mnemonic_placeholder: "Private key / Mnemonic",
|
||||
application_can_authorize_transactions:
|
||||
"The application can authorize any transactions on behalf of the wallet without any approvals. We recommend only connecting to trusted applications.",
|
||||
double_check_password: "Please, double check your password or private key.",
|
||||
error_accessing_file: "Error accessing the file. Please try again.",
|
||||
wallet_address: "Wallet Address",
|
||||
this_will_download_json:
|
||||
"This will download a JSON file containing your wallet information onto your device encrypted with the password.",
|
||||
this_is_a_temporary_wallet:
|
||||
"This is a temporary guest wallet. Download a backup if you don't want to loose access to it.",
|
||||
},
|
||||
smart_wallet: {
|
||||
switch_to_smart: "Switch to Smart Wallet",
|
||||
switch_to_personal: "Switch to Personal Wallet",
|
||||
network_mismatch: "Network Mismatch",
|
||||
connecting: "Connecting",
|
||||
},
|
||||
embedded_wallet: {
|
||||
request_new_code: "Request new code",
|
||||
sign_in: "Sign In",
|
||||
sign_in_google: "Sign in with Google",
|
||||
enter_your_email: "Enter your email address",
|
||||
forgot_password: "Forgot password",
|
||||
enter_account_recovery_code: "Enter account recovery code",
|
||||
backup_your_account: "Backup your account",
|
||||
},
|
||||
wallet_connect: {
|
||||
no_results_found: "No results found",
|
||||
search_wallets: "Search Wallets",
|
||||
},
|
||||
common: {
|
||||
connect_app: "Connect app",
|
||||
unknown_network: "Unknown Network",
|
||||
fetching: "Fetching...",
|
||||
password: "Password",
|
||||
reject: "Reject",
|
||||
approve: "Approve",
|
||||
switch_network: "Switch Network",
|
||||
import: "Import",
|
||||
username: "Username",
|
||||
amount: "Amount",
|
||||
send: "Send",
|
||||
receive: "Receive",
|
||||
continue: "Continue",
|
||||
error_switching_network: "Error switching network",
|
||||
or: "OR",
|
||||
from: "from",
|
||||
to: "from",
|
||||
next: "Next",
|
||||
learn_more: "Learn More",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Contract } from "ethers";
|
||||
import ContractPublisherAbi from "@thirdweb-dev/contracts-js/dist/abis/ContractPublisher.json";
|
||||
import type { ContractPublisher } from "@thirdweb-dev/contracts-js";
|
||||
import { getContractPublisherAddress } from "../../constants/addresses/getContractPublisherAddress";
|
||||
import { getChainProvider } from "../../constants/urls";
|
||||
@@ -25,6 +24,9 @@ export async function fetchPublishedContractFromPolygon(
|
||||
const polygonChain = getSupportedChains().find((c) => c.chainId === 137);
|
||||
const chain = polygonChain || Polygon;
|
||||
const publisher = await resolveAddress(publisherAddress);
|
||||
const ContractPublisherAbi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/ContractPublisher.json")
|
||||
).default;
|
||||
const contract = new Contract(
|
||||
getContractPublisherAddress(),
|
||||
ContractPublisherAbi,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { BigNumber, utils, type BigNumberish } from "ethers";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
|
||||
@@ -12,6 +11,9 @@ export async function approveErc20Allowance(
|
||||
) {
|
||||
const signer = contractToApprove.getSigner();
|
||||
const provider = contractToApprove.getProvider();
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20 = new ContractWrapper<IERC20>(
|
||||
signer || provider,
|
||||
currencyAddress,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { getNativeTokenByChainId } from "../../constants/currency";
|
||||
import { Currency } from "../../types/currency";
|
||||
import type { IERC20Metadata } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC20Metadata.json";
|
||||
import { Contract, providers } from "ethers";
|
||||
import { isNativeToken } from "./isNativeToken";
|
||||
|
||||
@@ -25,6 +24,9 @@ export async function fetchCurrencyMetadata(
|
||||
decimals: nativeToken.decimals,
|
||||
};
|
||||
} else {
|
||||
const ERC20MetadataAbi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20Metadata.json")
|
||||
).default;
|
||||
const erc20 = new Contract(
|
||||
asset,
|
||||
ERC20MetadataAbi,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { BigNumber } from "ethers";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
|
||||
@@ -9,6 +8,9 @@ export async function hasERC20Allowance(
|
||||
value: BigNumber,
|
||||
) {
|
||||
const provider = contractToApprove.getProvider();
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20 = new ContractWrapper<IERC20>(
|
||||
provider,
|
||||
currencyAddress,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { BigNumber } from "ethers";
|
||||
import { ContractWrapper } from "../../core/classes/contract-wrapper";
|
||||
import { isNativeToken } from "./isNativeToken";
|
||||
@@ -13,6 +12,9 @@ export async function setErc20Allowance(
|
||||
if (isNativeToken(currencyAddress)) {
|
||||
overrides["value"] = value;
|
||||
} else {
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const signer = contractToApprove.getSigner();
|
||||
const provider = contractToApprove.getProvider();
|
||||
const erc20 = new ContractWrapper<IERC20>(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import IThirdwebContractABI from "@thirdweb-dev/contracts-js/dist/abis/IThirdwebContract.json";
|
||||
import { providers, Contract, utils } from "ethers";
|
||||
|
||||
export async function getPrebuiltInfo(
|
||||
@@ -6,6 +5,11 @@ export async function getPrebuiltInfo(
|
||||
provider: providers.Provider,
|
||||
): Promise<{ type: string; version: number } | undefined> {
|
||||
try {
|
||||
const IThirdwebContractABI = (
|
||||
await import(
|
||||
"@thirdweb-dev/contracts-js/dist/abis/IThirdwebContract.json"
|
||||
)
|
||||
).default;
|
||||
const contract = new Contract(address, IThirdwebContractABI, provider);
|
||||
const [_type, version] = await Promise.all([
|
||||
contract.contractType(),
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
import type { IERC1155, IERC165, IERC721 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155.json";
|
||||
import ERC165Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC165.json";
|
||||
import ERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC721.json";
|
||||
import {
|
||||
BigNumber,
|
||||
BigNumberish,
|
||||
@@ -43,12 +40,18 @@ export async function isTokenApprovedForTransfer(
|
||||
owner: string,
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
const ERC165Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC165.json")
|
||||
).default;
|
||||
const erc165 = new Contract(assetContract, ERC165Abi, provider) as IERC165;
|
||||
const [isERC721, isERC1155] = await Promise.all([
|
||||
erc165.supportsInterface(InterfaceId_IERC721),
|
||||
erc165.supportsInterface(InterfaceId_IERC1155),
|
||||
]);
|
||||
if (isERC721) {
|
||||
const ERC721Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC721.json")
|
||||
).default;
|
||||
const asset = new Contract(assetContract, ERC721Abi, provider) as IERC721;
|
||||
|
||||
const approved = await asset.isApprovedForAll(
|
||||
@@ -69,6 +72,9 @@ export async function isTokenApprovedForTransfer(
|
||||
transferrerContractAddress.toLowerCase()
|
||||
);
|
||||
} else if (isERC1155) {
|
||||
const ERC1155Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC1155.json")
|
||||
).default;
|
||||
const asset = new Contract(
|
||||
assetContract,
|
||||
ERC1155Abi,
|
||||
@@ -101,6 +107,9 @@ export async function handleTokenApproval(
|
||||
tokenId: BigNumberish,
|
||||
from: string,
|
||||
): Promise<void> {
|
||||
const ERC165Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC165.json")
|
||||
).default;
|
||||
const erc165 = new ContractWrapper<IERC165>(
|
||||
contractWrapper.getSignerOrProvider(),
|
||||
assetContract,
|
||||
@@ -114,6 +123,9 @@ export async function handleTokenApproval(
|
||||
]);
|
||||
// check for token approval
|
||||
if (isERC721) {
|
||||
const ERC721Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC721.json")
|
||||
).default;
|
||||
const asset = new ContractWrapper<IERC721>(
|
||||
contractWrapper.getSignerOrProvider(),
|
||||
assetContract,
|
||||
@@ -138,6 +150,9 @@ export async function handleTokenApproval(
|
||||
}
|
||||
}
|
||||
} else if (isERC1155) {
|
||||
const ERC1155Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC1155.json")
|
||||
).default;
|
||||
const asset = new ContractWrapper<IERC1155>(
|
||||
contractWrapper.getSignerOrProvider(),
|
||||
assetContract,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { resolveContractUriAndBytecode } from "./feature-detection/resolveContra
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { Contract, providers } from "ethers";
|
||||
import { fetchContractMetadata } from "./fetchContractMetadata";
|
||||
import TWRegistryABI from "@thirdweb-dev/contracts-js/dist/abis/TWMultichainRegistryLogic.json";
|
||||
import { getMultichainRegistryAddress } from "../constants/addresses/getMultichainRegistryAddress";
|
||||
import { getChainProvider } from "../constants/urls";
|
||||
import type { TWMultichainRegistryLogic } from "@thirdweb-dev/contracts-js";
|
||||
@@ -113,6 +112,11 @@ async function getMetadataUriFromMultichainRegistry(
|
||||
chainId: number,
|
||||
sdkOptions: SDKOptions,
|
||||
) {
|
||||
const TWRegistryABI = (
|
||||
await import(
|
||||
"@thirdweb-dev/contracts-js/dist/abis/TWMultichainRegistryLogic.json"
|
||||
)
|
||||
).default;
|
||||
if (!multichainRegistry) {
|
||||
const polygonChain = sdkOptions?.supportedChains?.find(
|
||||
(c) => c.chainId === 137,
|
||||
|
||||
@@ -14,9 +14,6 @@ import type {
|
||||
IERC165,
|
||||
IERC721Metadata,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ERC165MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC165.json";
|
||||
import ERC721MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC721Metadata.json";
|
||||
import ERC1155MetadataAbi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155Metadata.json";
|
||||
import type {
|
||||
ThirdwebStorage,
|
||||
UploadProgressEvent,
|
||||
@@ -109,6 +106,9 @@ export async function fetchTokenMetadataForContract(
|
||||
storage: ThirdwebStorage,
|
||||
): Promise<NFTMetadata> {
|
||||
let uri: string | undefined;
|
||||
const ERC165MetadataAbi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC165.json")
|
||||
).default;
|
||||
const erc165 = new Contract(
|
||||
contractAddress,
|
||||
ERC165MetadataAbi,
|
||||
@@ -119,6 +119,9 @@ export async function fetchTokenMetadataForContract(
|
||||
erc165.supportsInterface(InterfaceId_IERC1155),
|
||||
]);
|
||||
if (isERC721) {
|
||||
const ERC721MetadataAbi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC721Metadata.json")
|
||||
).default;
|
||||
const erc721 = new Contract(
|
||||
contractAddress,
|
||||
ERC721MetadataAbi,
|
||||
@@ -126,6 +129,9 @@ export async function fetchTokenMetadataForContract(
|
||||
) as IERC721Metadata;
|
||||
uri = await erc721.tokenURI(tokenId);
|
||||
} else if (isERC1155) {
|
||||
const ERC1155MetadataAbi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC1155Metadata.json")
|
||||
).default;
|
||||
const erc1155 = new Contract(
|
||||
contractAddress,
|
||||
ERC1155MetadataAbi,
|
||||
|
||||
@@ -13,7 +13,6 @@ import { getChainProvider } from "../constants/urls";
|
||||
import invariant from "tiny-invariant";
|
||||
import { fetchContractMetadataFromAddress } from "./metadata-resolver";
|
||||
import type { ContractPublisher } from "@thirdweb-dev/contracts-js";
|
||||
import ContractPublisherAbi from "@thirdweb-dev/contracts-js/dist/abis/ContractPublisher.json";
|
||||
import { fetchExtendedReleaseMetadata } from "./feature-detection/fetchExtendedReleaseMetadata";
|
||||
import { getContractPublisherAddress } from "../constants/addresses/getContractPublisherAddress";
|
||||
|
||||
@@ -457,14 +456,20 @@ async function fetchDeployBytecodeFromPublishedContractMetadata(
|
||||
provider,
|
||||
);
|
||||
if (compilerMetaUri) {
|
||||
const ContractPublisherAbi = (
|
||||
await import(
|
||||
"@thirdweb-dev/contracts-js/dist/abis/ContractPublisher.json"
|
||||
)
|
||||
).default;
|
||||
const contract = new Contract(
|
||||
getContractPublisherAddress(),
|
||||
ContractPublisherAbi,
|
||||
getChainProvider("polygon", {}),
|
||||
) as ContractPublisher;
|
||||
|
||||
const publishedMetadataUri =
|
||||
await contract.getPublishedUriFromCompilerUri(compilerMetaUri);
|
||||
const publishedMetadataUri = await contract.getPublishedUriFromCompilerUri(
|
||||
compilerMetaUri,
|
||||
);
|
||||
if (publishedMetadataUri.length === 0) {
|
||||
throw Error(
|
||||
`Could not resolve published metadata URI from ${compilerMetaUri}`,
|
||||
|
||||
@@ -2,7 +2,6 @@ import type {
|
||||
IERC20,
|
||||
Split as SplitContract,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, CallOverrides, Contract } from "ethers";
|
||||
import { fetchCurrencyValue } from "../../common/currency/fetchCurrencyValue";
|
||||
@@ -247,6 +246,9 @@ export class Split implements UpdateableNetwork {
|
||||
resolveAddress(tokenAddress),
|
||||
resolveAddress(walletAddress),
|
||||
]);
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20 = new Contract(
|
||||
resolvedToken,
|
||||
ERC20Abi,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { IERC20, VoteERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { ProposalCreatedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/VoteERC20";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import {
|
||||
@@ -301,6 +300,9 @@ export class Vote implements UpdateableNetwork {
|
||||
public async balanceOfToken(
|
||||
tokenAddress: AddressOrEns,
|
||||
): Promise<CurrencyValue> {
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20 = new Contract(
|
||||
await resolveAddress(tokenAddress),
|
||||
ERC20Abi,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import ForwarderABI from "@thirdweb-dev/contracts-js/dist/abis/Forwarder.json";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import {
|
||||
BaseContract,
|
||||
@@ -759,6 +758,9 @@ export class ContractWrapper<
|
||||
const provider = this.getProvider();
|
||||
invariant(signer, "provider is not set");
|
||||
invariant(provider, "provider is not set");
|
||||
const ForwarderABI = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/Forwarder.json")
|
||||
).default;
|
||||
const forwarderAddress =
|
||||
this.options.gasless.openzeppelin.relayerForwarderAddress ||
|
||||
(this.options.gasless.openzeppelin.useEOAForwarder
|
||||
|
||||
@@ -3,7 +3,6 @@ import type {
|
||||
IThirdwebContract,
|
||||
SignatureDrop,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import DeprecatedAbi from "@thirdweb-dev/contracts-js/dist/abis/IDelayedRevealDeprecated.json";
|
||||
import { TokensLazyMintedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/DropERC721";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, Contract, utils, type BigNumberish } from "ethers";
|
||||
@@ -353,6 +352,11 @@ export class DelayedReveal<
|
||||
}
|
||||
|
||||
private async getLegacyEncryptedData(index: BigNumber) {
|
||||
const DeprecatedAbi = (
|
||||
await import(
|
||||
"@thirdweb-dev/contracts-js/dist/abis/IDelayedRevealDeprecated.json"
|
||||
)
|
||||
).default;
|
||||
const legacy = new Contract(
|
||||
this.contractWrapper.address,
|
||||
DeprecatedAbi,
|
||||
|
||||
@@ -10,7 +10,6 @@ import type {
|
||||
IERC20Metadata,
|
||||
Multicall,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import type { IDropSinglePhase } from "@thirdweb-dev/contracts-js/src/DropSinglePhase";
|
||||
import type { IClaimCondition } from "@thirdweb-dev/contracts-js/src/IDrop";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
@@ -503,6 +502,9 @@ export class DropClaimConditions<
|
||||
reasons.push(ClaimEligibility.NotEnoughTokens);
|
||||
}
|
||||
} else {
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20 = new ContractWrapper<IERC20>(
|
||||
provider,
|
||||
claimCondition.currencyAddress,
|
||||
|
||||
@@ -9,7 +9,6 @@ import type {
|
||||
IERC20,
|
||||
Multicall,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import IERC20ABI from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, constants, utils, type BigNumberish } from "ethers";
|
||||
import deepEqual from "fast-deep-equal";
|
||||
@@ -486,6 +485,9 @@ export class DropErc1155ClaimConditions<
|
||||
reasons.push(ClaimEligibility.NotEnoughTokens);
|
||||
}
|
||||
} else {
|
||||
const IERC20ABI = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20 = new ContractWrapper<IERC20>(
|
||||
provider,
|
||||
claimCondition.currencyAddress,
|
||||
|
||||
@@ -5,9 +5,6 @@ import type {
|
||||
IMarketplace,
|
||||
Marketplace,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155.json";
|
||||
import ERC165Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC165.json";
|
||||
import ERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC721.json";
|
||||
import { ListingAddedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/Marketplace";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import {
|
||||
@@ -578,6 +575,9 @@ export class MarketplaceDirect {
|
||||
}
|
||||
|
||||
const provider = this.contractWrapper.getProvider();
|
||||
const ERC165Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC165.json")
|
||||
).default;
|
||||
const erc165 = new Contract(
|
||||
listing.assetContractAddress,
|
||||
ERC165Abi,
|
||||
@@ -586,6 +586,9 @@ export class MarketplaceDirect {
|
||||
const isERC721 = await erc165.supportsInterface(InterfaceId_IERC721);
|
||||
const isERC1155 = await erc165.supportsInterface(InterfaceId_IERC1155);
|
||||
if (isERC721) {
|
||||
const ERC721Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC721.json")
|
||||
).default;
|
||||
const asset = new Contract(
|
||||
listing.assetContractAddress,
|
||||
ERC721Abi,
|
||||
@@ -607,6 +610,9 @@ export class MarketplaceDirect {
|
||||
: `Seller is not the owner of Token '${listing.tokenId}' from contract '${listing.assetContractAddress} anymore'`,
|
||||
};
|
||||
} else if (isERC1155) {
|
||||
const ERC1155Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC1155.json")
|
||||
).default;
|
||||
const asset = new Contract(
|
||||
listing.assetContractAddress,
|
||||
ERC1155Abi,
|
||||
|
||||
@@ -6,9 +6,6 @@ import type {
|
||||
IERC721,
|
||||
MarketplaceV3,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import ERC1155Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC1155.json";
|
||||
import ERC165Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC165.json";
|
||||
import ERC721Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC721.json";
|
||||
import {
|
||||
NewListingEvent,
|
||||
UpdatedListingEvent,
|
||||
@@ -893,6 +890,9 @@ export class MarketplaceV3DirectListings<TContract extends DirectListingsLogic>
|
||||
}
|
||||
|
||||
const provider = this.contractWrapper.getProvider();
|
||||
const ERC165Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC165.json")
|
||||
).default;
|
||||
const erc165 = new Contract(
|
||||
listing.assetContractAddress,
|
||||
ERC165Abi,
|
||||
@@ -901,6 +901,9 @@ export class MarketplaceV3DirectListings<TContract extends DirectListingsLogic>
|
||||
const isERC721 = await erc165.supportsInterface(InterfaceId_IERC721);
|
||||
const isERC1155 = await erc165.supportsInterface(InterfaceId_IERC1155);
|
||||
if (isERC721) {
|
||||
const ERC721Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC721.json")
|
||||
).default;
|
||||
const asset = new Contract(
|
||||
listing.assetContractAddress,
|
||||
ERC721Abi,
|
||||
@@ -922,6 +925,9 @@ export class MarketplaceV3DirectListings<TContract extends DirectListingsLogic>
|
||||
: `Seller is not the owner of Token '${listing.tokenId}' from contract '${listing.assetContractAddress} anymore'`,
|
||||
};
|
||||
} else if (isERC1155) {
|
||||
const ERC1155Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC1155.json")
|
||||
).default;
|
||||
const asset = new Contract(
|
||||
listing.assetContractAddress,
|
||||
ERC1155Abi,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { IERC20, IOffers, OffersLogic } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { NewOfferEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/OffersLogic";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, BigNumberish } from "ethers";
|
||||
@@ -426,6 +425,9 @@ export class MarketplaceV3Offers<TContract extends OffersLogic>
|
||||
: offer.currencyContractAddress;
|
||||
|
||||
const provider = this.contractWrapper.getProvider();
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20 = new ContractWrapper<IERC20>(
|
||||
provider,
|
||||
currency,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { ERC20Base, PackVRFDirect } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import IPackAbi from "@thirdweb-dev/contracts-js/dist/abis/IPackVRFDirect.json";
|
||||
import {
|
||||
ITokenBundle,
|
||||
@@ -8,7 +7,7 @@ import {
|
||||
PackOpenedEventObject,
|
||||
} from "@thirdweb-dev/contracts-js/dist/declarations/src/IPackVRFDirect";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { BigNumber, utils, type BigNumberish } from "ethers";
|
||||
import { BigNumber, utils, type BigNumberish, ContractInterface } from "ethers";
|
||||
import { fetchCurrencyMetadata } from "../../common/currency/fetchCurrencyMetadata";
|
||||
import { resolveAddress } from "../../common/ens/resolveAddress";
|
||||
import { buildTransactionFunction } from "../../common/transactions";
|
||||
@@ -309,7 +308,12 @@ export class PackVRF implements UpdateableNetwork, DetectableFeature {
|
||||
* @twfeature PackVRF
|
||||
*/
|
||||
public async getLinkBalance(): Promise<CurrencyValue> {
|
||||
return this.getLinkContract().balanceOf(this.contractWrapper.address);
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
return this.getLinkContract(ERC20Abi).balanceOf(
|
||||
this.contractWrapper.address,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -325,10 +329,16 @@ export class PackVRF implements UpdateableNetwork, DetectableFeature {
|
||||
* @twfeature PackVRF
|
||||
*/
|
||||
public async transferLink(amount: Amount) {
|
||||
await this.getLinkContract().transfer(this.contractWrapper.address, amount);
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
await this.getLinkContract(ERC20Abi).transfer(
|
||||
this.contractWrapper.address,
|
||||
amount,
|
||||
);
|
||||
}
|
||||
|
||||
private getLinkContract(): Erc20 {
|
||||
private getLinkContract(ERC20Abi: ContractInterface): Erc20 {
|
||||
const linkAddress = LINK_TOKEN_ADDRESS[this.chainId];
|
||||
if (!linkAddress) {
|
||||
throw new Error(
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import type { TWRegistry } from "@thirdweb-dev/contracts-js";
|
||||
import TWRegistryABI from "@thirdweb-dev/contracts-js/dist/abis/TWRegistry.json";
|
||||
import type { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { constants, utils } from "ethers";
|
||||
import { ContractInterface, constants, utils } from "ethers";
|
||||
import { resolveAddress } from "../../common/ens/resolveAddress";
|
||||
import { buildTransactionFunction } from "../../common/transactions";
|
||||
import { SDKOptions } from "../../schema/sdk-options";
|
||||
@@ -19,6 +18,7 @@ export class ContractRegistry extends ContractWrapper<TWRegistry> {
|
||||
registryAddress: string,
|
||||
network: NetworkInput,
|
||||
storage: ThirdwebStorage,
|
||||
TWRegistryABI: ContractInterface,
|
||||
options?: SDKOptions,
|
||||
) {
|
||||
super(network, registryAddress, TWRegistryABI, options, storage);
|
||||
|
||||
@@ -41,7 +41,6 @@ import {
|
||||
} from "../../common/forwarder";
|
||||
import { signEIP2612Permit } from "../../common/permit";
|
||||
import { signTypedDataInternal } from "../../common/sign";
|
||||
import ForwarderABI from "@thirdweb-dev/contracts-js/dist/abis/Forwarder.json";
|
||||
import { BytesLike } from "ethers";
|
||||
import { CONTRACT_ADDRESSES } from "../../constants/addresses/CONTRACT_ADDRESSES";
|
||||
import { getContractAddressByChainId } from "../../constants/addresses/getContractAddressByChainId";
|
||||
@@ -975,7 +974,9 @@ async function defenderPrepareRequest(
|
||||
transaction.chainId as keyof typeof CONTRACT_ADDRESSES
|
||||
].openzeppelinForwarder ||
|
||||
(await computeForwarderAddress(provider, storage)));
|
||||
|
||||
const ForwarderABI = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/Forwarder.json")
|
||||
).default;
|
||||
const forwarder = new Contract(forwarderAddress, ForwarderABI, provider);
|
||||
const nonce = await getAndIncrementNonce(forwarder, "getNonce", [
|
||||
transaction.from,
|
||||
|
||||
@@ -26,7 +26,6 @@ import type {
|
||||
import type { NetworkInput, ChainOrRpcUrl } from "./types";
|
||||
import { UserWallet } from "./wallet/user-wallet";
|
||||
import { Chain, defaultChains } from "@thirdweb-dev/chains";
|
||||
import IThirdwebContractABI from "@thirdweb-dev/contracts-js/dist/abis/IThirdwebContract.json";
|
||||
import { ContractAddress, GENERATED_ABI } from "@thirdweb-dev/generated-abis";
|
||||
import { IThirdwebStorage, ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import type { ContractInterface, Signer, BaseContract } from "ethers";
|
||||
@@ -662,6 +661,11 @@ export class ThirdwebSDK extends RPCConnectionHandler {
|
||||
contractAddress: AddressOrEns,
|
||||
): Promise<ContractType> {
|
||||
try {
|
||||
const IThirdwebContractABI = (
|
||||
await import(
|
||||
"@thirdweb-dev/contracts-js/dist/abis/IThirdwebContract.json"
|
||||
)
|
||||
).default;
|
||||
const contract = new EthersContract(
|
||||
await resolveAddress(contractAddress),
|
||||
IThirdwebContractABI,
|
||||
@@ -2005,10 +2009,14 @@ export class ContractDeployer extends RPCConnectionHandler {
|
||||
if (!registryAddress) {
|
||||
return undefined;
|
||||
}
|
||||
const TWRegistryABI = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/TWRegistry.json")
|
||||
).default;
|
||||
return new ContractRegistry(
|
||||
registryAddress,
|
||||
this.getSignerOrProvider(),
|
||||
this.storage,
|
||||
TWRegistryABI,
|
||||
this.options,
|
||||
);
|
||||
}));
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { BlockTag } from "@ethersproject/abstract-provider";
|
||||
import type { IERC20 } from "@thirdweb-dev/contracts-js";
|
||||
import ERC20Abi from "@thirdweb-dev/contracts-js/dist/abis/IERC20.json";
|
||||
import { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import {
|
||||
BigNumber,
|
||||
@@ -10,6 +9,7 @@ import {
|
||||
type Signer,
|
||||
type TypedDataField,
|
||||
type providers,
|
||||
ContractInterface,
|
||||
} from "ethers";
|
||||
import EventEmitter from "eventemitter3";
|
||||
import invariant from "tiny-invariant";
|
||||
@@ -122,11 +122,14 @@ export class UserWallet {
|
||||
};
|
||||
} else {
|
||||
// ERC20 token transfer
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
return {
|
||||
receipt: await this.createErc20(resolvedCurrency).sendTransaction(
|
||||
"transfer",
|
||||
[resolvedTo, amountInWei],
|
||||
),
|
||||
receipt: await this.createErc20(
|
||||
resolvedCurrency,
|
||||
ERC20Abi,
|
||||
).sendTransaction("transfer", [resolvedTo, amountInWei]),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -153,9 +156,13 @@ export class UserWallet {
|
||||
if (isNativeToken(resolvedCurrency)) {
|
||||
balance = await provider.getBalance(await this.getAddress());
|
||||
} else {
|
||||
balance = await this.createErc20(resolvedCurrency).read("balanceOf", [
|
||||
await this.getAddress(),
|
||||
]);
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
balance = await this.createErc20(resolvedCurrency, ERC20Abi).read(
|
||||
"balanceOf",
|
||||
[await this.getAddress()],
|
||||
);
|
||||
}
|
||||
return await fetchCurrencyValue(provider, resolvedCurrency, balance);
|
||||
}
|
||||
@@ -350,7 +357,7 @@ export class UserWallet {
|
||||
return signer;
|
||||
}
|
||||
|
||||
private createErc20(currencyAddress: Address) {
|
||||
private createErc20(currencyAddress: Address, ERC20Abi: ContractInterface) {
|
||||
return new ContractWrapper<IERC20>(
|
||||
this.connection.getSignerOrProvider(),
|
||||
currencyAddress,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { getContractTypeForRemoteName } from "../../contracts";
|
||||
import { ContractType } from "../../contracts";
|
||||
import IThirdwebContractABI from "@thirdweb-dev/contracts-js/dist/abis/IThirdwebContract.json";
|
||||
import { Contract, utils, type providers } from "ethers";
|
||||
|
||||
type ResolveContractTypeParams = {
|
||||
@@ -12,6 +11,11 @@ export async function resolveContractType(
|
||||
params: ResolveContractTypeParams,
|
||||
): Promise<ContractType> {
|
||||
try {
|
||||
const IThirdwebContractABI = (
|
||||
await import(
|
||||
"@thirdweb-dev/contracts-js/dist/abis/IThirdwebContract.json"
|
||||
)
|
||||
).default;
|
||||
const contract = new Contract(
|
||||
params.address,
|
||||
IThirdwebContractABI,
|
||||
|
||||
Reference in New Issue
Block a user