Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c377290b27 | ||
|
|
35bddd69c5 | ||
|
|
34be385a5c | ||
|
|
79c9e130fd | ||
|
|
9c884e2f55 |
@@ -1,5 +1,19 @@
|
|||||||
# @thirdweb-dev/auth
|
# @thirdweb-dev/auth
|
||||||
|
|
||||||
|
## 4.1.47
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/wallets@2.4.25
|
||||||
|
|
||||||
|
## 4.1.46
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4)]:
|
||||||
|
- @thirdweb-dev/wallets@2.4.24
|
||||||
|
|
||||||
## 4.1.45
|
## 4.1.45
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/auth",
|
"name": "@thirdweb-dev/auth",
|
||||||
"version": "4.1.45",
|
"version": "4.1.47",
|
||||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# thirdweb
|
# thirdweb
|
||||||
|
|
||||||
|
## 0.13.55
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.49
|
||||||
|
- @thirdweb-dev/storage@2.0.11
|
||||||
|
- @thirdweb-dev/wallets@2.4.25
|
||||||
|
- @thirdweb-dev/auth@4.1.47
|
||||||
|
|
||||||
|
## 0.13.54
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4)]:
|
||||||
|
- @thirdweb-dev/wallets@2.4.24
|
||||||
|
- @thirdweb-dev/auth@4.1.46
|
||||||
|
|
||||||
## 0.13.53
|
## 0.13.53
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "thirdweb",
|
"name": "thirdweb",
|
||||||
"main": "dist/cli/index.js",
|
"main": "dist/cli/index.js",
|
||||||
"version": "0.13.53",
|
"version": "0.13.55",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
# @thirdweb-dev/crypto
|
# @thirdweb-dev/crypto
|
||||||
|
|
||||||
|
## 0.2.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#2523](https://github.com/thirdweb-dev/js/pull/2523) [`35bddd6`](https://github.com/thirdweb-dev/js/commit/35bddd69c555c9277d8c3d703a93f23f74e0de77) Thanks [@nachoiacovino](https://github.com/nachoiacovino)! - Fix function for old js
|
||||||
|
|
||||||
## 0.2.1
|
## 0.2.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/crypto",
|
"name": "@thirdweb-dev/crypto",
|
||||||
"version": "0.2.1",
|
"version": "0.2.2",
|
||||||
"main": "dist/thirdweb-dev-crypto.cjs.js",
|
"main": "dist/thirdweb-dev-crypto.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-crypto.esm.js",
|
"module": "dist/thirdweb-dev-crypto.esm.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -41,10 +41,12 @@ export function concatUint8Arrays(arrays, totalLength) {
|
|||||||
return new Uint8Array(0);
|
return new Uint8Array(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
totalLength ??= arrays.reduce(
|
if (totalLength === null || totalLength === undefined) {
|
||||||
|
totalLength = arrays.reduce(
|
||||||
(accumulator, currentValue) => accumulator + currentValue.length,
|
(accumulator, currentValue) => accumulator + currentValue.length,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const returnValue = new Uint8Array(totalLength);
|
const returnValue = new Uint8Array(totalLength);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# @thirdweb-dev/merkletree
|
# @thirdweb-dev/merkletree
|
||||||
|
|
||||||
|
## 0.2.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`35bddd6`](https://github.com/thirdweb-dev/js/commit/35bddd69c555c9277d8c3d703a93f23f74e0de77)]:
|
||||||
|
- @thirdweb-dev/crypto@0.2.2
|
||||||
|
|
||||||
## 0.2.1
|
## 0.2.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/merkletree",
|
"name": "@thirdweb-dev/merkletree",
|
||||||
"version": "0.2.1",
|
"version": "0.2.2",
|
||||||
"main": "dist/thirdweb-dev-merkletree.cjs.js",
|
"main": "dist/thirdweb-dev-merkletree.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-merkletree.esm.js",
|
"module": "dist/thirdweb-dev-merkletree.esm.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@@ -1,5 +1,25 @@
|
|||||||
# @thirdweb-dev/react-core
|
# @thirdweb-dev/react-core
|
||||||
|
|
||||||
|
## 4.4.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.49
|
||||||
|
- @thirdweb-dev/storage@2.0.11
|
||||||
|
- @thirdweb-dev/wallets@2.4.25
|
||||||
|
- @thirdweb-dev/auth@4.1.47
|
||||||
|
|
||||||
|
## 4.4.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#2497](https://github.com/thirdweb-dev/js/pull/2497) [`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4) Thanks [@makoshan](https://github.com/makoshan)! - Add imToken Wallet
|
||||||
|
|
||||||
|
- Updated dependencies [[`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4)]:
|
||||||
|
- @thirdweb-dev/wallets@2.4.24
|
||||||
|
- @thirdweb-dev/auth@4.1.46
|
||||||
|
|
||||||
## 4.4.21
|
## 4.4.21
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-core",
|
"name": "@thirdweb-dev/react-core",
|
||||||
"version": "4.4.21",
|
"version": "4.4.23",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import type {
|
|||||||
CryptoDefiWallet,
|
CryptoDefiWallet,
|
||||||
EmbeddedWallet,
|
EmbeddedWallet,
|
||||||
FrameWallet,
|
FrameWallet,
|
||||||
|
ImTokenWallet,
|
||||||
LocalWallet,
|
LocalWallet,
|
||||||
MagicEdenWallet,
|
MagicEdenWallet,
|
||||||
MagicLink,
|
MagicLink,
|
||||||
@@ -41,6 +42,7 @@ export type WalletIdToWalletTypeMap = {
|
|||||||
rainbowWallet: RainbowWallet;
|
rainbowWallet: RainbowWallet;
|
||||||
blocto: BloctoWallet;
|
blocto: BloctoWallet;
|
||||||
frame: FrameWallet;
|
frame: FrameWallet;
|
||||||
|
imToken: ImTokenWallet;
|
||||||
localWallet: LocalWallet;
|
localWallet: LocalWallet;
|
||||||
magicLink: MagicLink;
|
magicLink: MagicLink;
|
||||||
paper: PaperWallet;
|
paper: PaperWallet;
|
||||||
@@ -57,7 +59,7 @@ export type WalletIdToWalletTypeMap = {
|
|||||||
cryptoDefiWallet: CryptoDefiWallet;
|
cryptoDefiWallet: CryptoDefiWallet;
|
||||||
rabby: RabbyWallet;
|
rabby: RabbyWallet;
|
||||||
xdefi: XDEFIWallet;
|
xdefi: XDEFIWallet;
|
||||||
magicEden: MagicEdenWallet
|
magicEden: MagicEdenWallet;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,9 @@
|
|||||||
# @thirdweb-dev/react-native-compat
|
# @thirdweb-dev/react-native-compat
|
||||||
|
|
||||||
|
## 0.7.20
|
||||||
|
|
||||||
|
## 0.7.19
|
||||||
|
|
||||||
## 0.7.18
|
## 0.7.18
|
||||||
|
|
||||||
## 0.7.17
|
## 0.7.17
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native-compat",
|
"name": "@thirdweb-dev/react-native-compat",
|
||||||
"description": "Shims for Thirdweb in React Native Projects",
|
"description": "Shims for Thirdweb in React Native Projects",
|
||||||
"version": "0.7.18",
|
"version": "0.7.20",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -1,5 +1,23 @@
|
|||||||
# @thirdweb-dev/react-native
|
# @thirdweb-dev/react-native
|
||||||
|
|
||||||
|
## 0.7.20
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.49
|
||||||
|
- @thirdweb-dev/storage@2.0.11
|
||||||
|
- @thirdweb-dev/wallets@2.4.25
|
||||||
|
- @thirdweb-dev/react-core@4.4.23
|
||||||
|
|
||||||
|
## 0.7.19
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4)]:
|
||||||
|
- @thirdweb-dev/wallets@2.4.24
|
||||||
|
- @thirdweb-dev/react-core@4.4.22
|
||||||
|
|
||||||
## 0.7.18
|
## 0.7.18
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react-native",
|
"name": "@thirdweb-dev/react-native",
|
||||||
"version": "0.7.18",
|
"version": "0.7.20",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,24 @@
|
|||||||
# @thirdweb-dev/react
|
# @thirdweb-dev/react
|
||||||
|
|
||||||
|
## 4.4.23
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.49
|
||||||
|
- @thirdweb-dev/wallets@2.4.25
|
||||||
|
- @thirdweb-dev/react-core@4.4.23
|
||||||
|
|
||||||
|
## 4.4.22
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#2497](https://github.com/thirdweb-dev/js/pull/2497) [`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4) Thanks [@makoshan](https://github.com/makoshan)! - Add imToken Wallet
|
||||||
|
|
||||||
|
- Updated dependencies [[`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4)]:
|
||||||
|
- @thirdweb-dev/wallets@2.4.24
|
||||||
|
- @thirdweb-dev/react-core@4.4.22
|
||||||
|
|
||||||
## 4.4.21
|
## 4.4.21
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/react",
|
"name": "@thirdweb-dev/react",
|
||||||
"version": "4.4.21",
|
"version": "4.4.23",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||||
"author": "thirdweb eng <[email protected]>",
|
"author": "thirdweb eng <[email protected]>",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -111,4 +111,5 @@ export {
|
|||||||
CryptoDefiWallet,
|
CryptoDefiWallet,
|
||||||
RabbyWallet,
|
RabbyWallet,
|
||||||
Coin98Wallet,
|
Coin98Wallet,
|
||||||
|
ImTokenWallet,
|
||||||
} from "@thirdweb-dev/wallets";
|
} from "@thirdweb-dev/wallets";
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ export function enDefault(): ThirdwebLocale {
|
|||||||
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
||||||
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
||||||
trustWallet: extensionAndQRScanScreens("Trust"),
|
trustWallet: extensionAndQRScanScreens("Trust"),
|
||||||
|
imTokenWallet: extensionAndQRScanScreens("imToken"),
|
||||||
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
||||||
coreWallet: extensionAndQRScanScreens("Core"),
|
coreWallet: extensionAndQRScanScreens("Core"),
|
||||||
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ export function esDefault(): ThirdwebLocale {
|
|||||||
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
||||||
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
||||||
trustWallet: extensionAndQRScanScreens("Trust"),
|
trustWallet: extensionAndQRScanScreens("Trust"),
|
||||||
|
imTokenWallet: extensionAndQRScanScreens("imToken"),
|
||||||
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
||||||
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
||||||
cryptoDefiWallet: extensionAndQRScanScreens("Crypto Defi"),
|
cryptoDefiWallet: extensionAndQRScanScreens("Crypto Defi"),
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ export function jaDefault(): ThirdwebLocale {
|
|||||||
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
||||||
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
||||||
trustWallet: extensionAndQRScanScreens("Trust"),
|
trustWallet: extensionAndQRScanScreens("Trust"),
|
||||||
|
imTokenWallet: extensionAndQRScanScreens("imToken"),
|
||||||
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
||||||
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
||||||
cryptoDefiWallet: extensionAndQRScanScreens("Crypto Defi"),
|
cryptoDefiWallet: extensionAndQRScanScreens("Crypto Defi"),
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ export function tlDefault(): ThirdwebLocale {
|
|||||||
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
xdefiWallet: extensionAndQRScanScreens("XDEFI"),
|
||||||
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
rainbowWallet: extensionAndQRScanScreens("Rainbow"),
|
||||||
trustWallet: extensionAndQRScanScreens("Trust"),
|
trustWallet: extensionAndQRScanScreens("Trust"),
|
||||||
|
imTokenWallet: extensionAndQRScanScreens("imToken"),
|
||||||
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
zerionWallet: extensionAndQRScanScreens("Zerion"),
|
||||||
coreWallet: extensionAndQRScanScreens("Core"),
|
coreWallet: extensionAndQRScanScreens("Core"),
|
||||||
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
oneKeyWallet: extensionAndQRScanScreens("OneKey"),
|
||||||
|
|||||||
@@ -183,6 +183,7 @@ export type ThirdwebLocale = {
|
|||||||
getStartedScreen: { instruction: string };
|
getStartedScreen: { instruction: string };
|
||||||
scanScreen: { instruction: string };
|
scanScreen: { instruction: string };
|
||||||
};
|
};
|
||||||
|
trustWallet: ExtensionAndQRScreensLocale;
|
||||||
localWallet: {
|
localWallet: {
|
||||||
confirmPasswordLabel: string;
|
confirmPasswordLabel: string;
|
||||||
createScreen: {
|
createScreen: {
|
||||||
@@ -302,7 +303,7 @@ export type ThirdwebLocale = {
|
|||||||
title: string;
|
title: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
trustWallet: ExtensionAndQRScreensLocale;
|
imTokenWallet: ExtensionAndQRScreensLocale;
|
||||||
walletConnect: { scanInstruction: string };
|
walletConnect: { scanInstruction: string };
|
||||||
zerionWallet: ExtensionAndQRScreensLocale;
|
zerionWallet: ExtensionAndQRScreensLocale;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -107,6 +107,11 @@ export {
|
|||||||
type Coin98WalletConfigOptions,
|
type Coin98WalletConfigOptions,
|
||||||
} from "./wallet/wallets/coin98/coin98Wallet";
|
} from "./wallet/wallets/coin98/coin98Wallet";
|
||||||
|
|
||||||
|
export {
|
||||||
|
imTokenWallet,
|
||||||
|
type ImTokenWalletConfigOptions,
|
||||||
|
} from "./wallet/wallets/imtoken/imTokenWallet";
|
||||||
|
|
||||||
// theming
|
// theming
|
||||||
export { darkTheme, lightTheme } from "./design-system/index";
|
export { darkTheme, lightTheme } from "./design-system/index";
|
||||||
export type { Theme, ThemeOverrides } from "./design-system/index";
|
export type { Theme, ThemeOverrides } from "./design-system/index";
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export function useInstalledWallets() {
|
|||||||
let isCoinbaseWalletInstalled = false;
|
let isCoinbaseWalletInstalled = false;
|
||||||
let isZerionWalletInstalled = false;
|
let isZerionWalletInstalled = false;
|
||||||
let isTrustWalletInstalled = false;
|
let isTrustWalletInstalled = false;
|
||||||
|
let isImTokenInstalled = false;
|
||||||
|
|
||||||
const window_: Window | undefined = globalThis?.window;
|
const window_: Window | undefined = globalThis?.window;
|
||||||
if (assertWindowEthereum(window_)) {
|
if (assertWindowEthereum(window_)) {
|
||||||
@@ -19,6 +20,7 @@ export function useInstalledWallets() {
|
|||||||
isCoinbaseWalletInstalled = !!getInjectedCoinbaseProvider();
|
isCoinbaseWalletInstalled = !!getInjectedCoinbaseProvider();
|
||||||
isZerionWalletInstalled = !!window_.ethereum?.isZerion;
|
isZerionWalletInstalled = !!window_.ethereum?.isZerion;
|
||||||
isTrustWalletInstalled = !!window_.ethereum?.isTrust;
|
isTrustWalletInstalled = !!window_.ethereum?.isTrust;
|
||||||
|
isImTokenInstalled = !!window_.ethereum?.isToken;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -26,5 +28,6 @@ export function useInstalledWallets() {
|
|||||||
coinbaseWallet: isCoinbaseWalletInstalled,
|
coinbaseWallet: isCoinbaseWalletInstalled,
|
||||||
trustWallet: isTrustWalletInstalled,
|
trustWallet: isTrustWalletInstalled,
|
||||||
zerionWallet: isZerionWalletInstalled,
|
zerionWallet: isZerionWalletInstalled,
|
||||||
|
imtokenWallet: isImTokenInstalled,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import type {
|
||||||
|
WalletOptions,
|
||||||
|
WalletConfig,
|
||||||
|
ConnectUIProps,
|
||||||
|
} from "@thirdweb-dev/react-core";
|
||||||
|
import { ImTokenWallet, assertWindowEthereum } from "@thirdweb-dev/wallets";
|
||||||
|
import { useTWLocale } from "../../../evm/providers/locale-provider";
|
||||||
|
import { ExtensionOrWCConnectionUI } from "../_common/ExtensionORWCConnectionUI";
|
||||||
|
|
||||||
|
const imTokenWalletUris = {
|
||||||
|
ios: "https://itunes.apple.com/us/app/imtoken2/id1384798940",
|
||||||
|
android: "https://play.google.com/store/apps/details?id=im.token.app",
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ImTokenWalletConfigOptions = {
|
||||||
|
projectId?: string;
|
||||||
|
recommended?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const imTokenWallet = (
|
||||||
|
options?: ImTokenWalletConfigOptions,
|
||||||
|
): WalletConfig<ImTokenWallet> => {
|
||||||
|
return {
|
||||||
|
id: ImTokenWallet.id,
|
||||||
|
recommended: options?.recommended,
|
||||||
|
meta: {
|
||||||
|
...ImTokenWallet.meta,
|
||||||
|
iconURL:
|
||||||
|
"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iODAiIHZpZXdCb3g9IjAgMCA4MCA4MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzIyMl80NzgzKSI+CjxtYXNrIGlkPSJtYXNrMF8yMjJfNDc4MyIgc3R5bGU9Im1hc2stdHlwZTpsdW1pbmFuY2UiIG1hc2tVbml0cz0idXNlclNwYWNlT25Vc2UiIHg9IjAiIHk9IjAiIHdpZHRoPSI4MCIgaGVpZ2h0PSI4MCI+CjxwYXRoIGQ9Ik03OS44OTQ4IDBIMC4wNTA3ODEyVjgwSDc5Ljg5NDhWMFoiIGZpbGw9IndoaXRlIi8+CjwvbWFzaz4KPGcgbWFzaz0idXJsKCNtYXNrMF8yMjJfNDc4MykiPgo8cGF0aCBkPSJNNjIuMDI3NSAwSDE4LjA1MDlDOC4xNDYzOSAwIDAuMTE3MTg4IDguMDQ0ODggMC4xMTcxODggMTcuOTY4OFY2Mi4wMzEyQzAuMTE3MTg4IDcxLjk1NTEgOC4xNDYzOSA4MCAxOC4wNTA5IDgwSDYyLjAyNzVDNzEuOTMyIDgwIDc5Ljk2MTIgNzEuOTU1MSA3OS45NjEyIDYyLjAzMTJWMTcuOTY4OEM3OS45NjEyIDguMDQ0ODggNzEuOTMyIDAgNjIuMDI3NSAwWiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzIyMl80NzgzKSIvPgo8cGF0aCBkPSJNNjUuMDk4MSAyNC43MzNDNjYuNzU4NiA0Ny4yNjY3IDUyLjMwMjEgNTcuOTE3MiAzOS4zNDIzIDU5LjA1M0MyNy4yOTM1IDYwLjEwODcgMTUuOTUyIDUyLjY5MDggMTQuOTU3MSA0MS4yOTM2QzE0LjEzNjMgMzEuODc3NiAxOS45NDQ1IDI3Ljg2ODkgMjQuNTA4IDI3LjQ2OTRDMjkuMjAxNSAyNy4wNTcgMzMuMTQ1OCAzMC4zMDAxIDMzLjQ4NzkgMzQuMjI2OUMzMy44MTc1IDM4LjAwMiAzMS40NjY0IDM5LjcyMDUgMjkuODMxMyAzOS44NjM0QzI4LjUzODIgMzkuOTc3IDI2LjkxMTQgMzkuMTkwNSAyNi43NjQ1IDM3LjUwMTZDMjYuNjM4NSAzNi4wNTAzIDI3LjE4ODUgMzUuODUyNiAyNy4wNTQxIDM0LjMxMDlDMjYuODE0OSAzMS41NjYyIDI0LjQyNjEgMzEuMjQ2NiAyMy4xMTgzIDMxLjM2MDFDMjEuNTM1NyAzMS40OTkxIDE4LjY2NDEgMzMuMzQ5OCAxOS4wNjcgMzcuOTZDMTkuNDcyMiA0Mi42MTAxIDIzLjkyMjIgNDYuMjg0NSAyOS43NTU3IDQ1Ljc3MzRDMzYuMDUwOSA0NS4yMjIzIDQwLjQzMzcgNDAuMzExNCA0MC43NjM0IDMzLjQyMzRDNDAuNzYwMyAzMy4wNTg2IDQwLjgzNyAzMi42OTc1IDQwLjk4OCAzMi4zNjU1TDQwLjk5IDMyLjM1NzJDNDEuMDU3OCAzMi4yMTI4IDQxLjEzNzIgMzIuMDc0MiA0MS4yMjcyIDMxLjk0MjhDNDEuMzYxNiAzMS43NDA5IDQxLjUzMzggMzEuNTE4IDQxLjc1NjIgMzEuMjczOUM0MS43NTgzIDMxLjI2NzYgNDEuNzU4MyAzMS4yNjc2IDQxLjc2MjYgMzEuMjY3NkM0MS45MjQxIDMxLjA4NDcgNDIuMTE5NCAzMC44ODcgNDIuMzM5NyAzMC42NzQ1QzQ1LjA4OTcgMjguMDc1IDU0Ljk5MzEgMjEuOTQ0MiA2NC4zNTkyIDIzLjg4NTVDNjQuNTU3MyAyMy45MjggNjQuNzM2MSAyNC4wMzM0IDY0Ljg2OTMgMjQuMTg2MkM2NS4wMDI1IDI0LjMzOTEgNjUuMDgyNiAyNC41MzA4IDY1LjA5ODEgMjQuNzMzWiIgZmlsbD0id2hpdGUiLz4KPC9nPgo8L2c+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMjIyXzQ3ODMiIHgxPSI3My41MDA5IiB5MT0iNS4zMTI1IiB4Mj0iMi44NzI0MSIgeTI9Ijc3LjY3NDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iIzExQzREMSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiMwMDYyQUQiLz4KPC9saW5lYXJHcmFkaWVudD4KPGNsaXBQYXRoIGlkPSJjbGlwMF8yMjJfNDc4MyI+CjxyZWN0IHdpZHRoPSI4MCIgaGVpZ2h0PSI4MCIgZmlsbD0id2hpdGUiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4=",
|
||||||
|
},
|
||||||
|
create: (walletOptions: WalletOptions) => {
|
||||||
|
const wallet = new ImTokenWallet({
|
||||||
|
...walletOptions,
|
||||||
|
projectId: options?.projectId,
|
||||||
|
qrcode: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return wallet;
|
||||||
|
},
|
||||||
|
connectUI: ConnectUI,
|
||||||
|
isInstalled: isInstalled,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
function isInstalled() {
|
||||||
|
if (assertWindowEthereum(globalThis.window)) {
|
||||||
|
return !!globalThis.window.ethereum.isImToken;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function ConnectUI(props: ConnectUIProps<ImTokenWallet>) {
|
||||||
|
const locale = useTWLocale();
|
||||||
|
return (
|
||||||
|
<ExtensionOrWCConnectionUI
|
||||||
|
connect={props.connect}
|
||||||
|
connected={props.connected}
|
||||||
|
createWalletInstance={props.createWalletInstance}
|
||||||
|
goBack={props.goBack}
|
||||||
|
meta={props.walletConfig.meta}
|
||||||
|
setConnectedWallet={(w) => props.setConnectedWallet(w as ImTokenWallet)}
|
||||||
|
setConnectionStatus={props.setConnectionStatus}
|
||||||
|
supportedWallets={props.supportedWallets}
|
||||||
|
walletConnectUris={{
|
||||||
|
ios: imTokenWalletUris.ios,
|
||||||
|
android: imTokenWalletUris.android,
|
||||||
|
other: imTokenWalletUris.android,
|
||||||
|
}}
|
||||||
|
walletLocale={locale.wallets.imTokenWallet}
|
||||||
|
isInstalled={isInstalled}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -1,5 +1,14 @@
|
|||||||
# @thirdweb-dev/sdk
|
# @thirdweb-dev/sdk
|
||||||
|
|
||||||
|
## 4.0.49
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`35bddd6`](https://github.com/thirdweb-dev/js/commit/35bddd69c555c9277d8c3d703a93f23f74e0de77)]:
|
||||||
|
- @thirdweb-dev/crypto@0.2.2
|
||||||
|
- @thirdweb-dev/merkletree@0.2.2
|
||||||
|
- @thirdweb-dev/storage@2.0.11
|
||||||
|
|
||||||
## 4.0.48
|
## 4.0.48
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/sdk",
|
"name": "@thirdweb-dev/sdk",
|
||||||
"version": "4.0.48",
|
"version": "4.0.49",
|
||||||
"description": "The main thirdweb SDK.",
|
"description": "The main thirdweb SDK.",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,12 @@
|
|||||||
# @thirdweb-dev/storage
|
# @thirdweb-dev/storage
|
||||||
|
|
||||||
|
## 2.0.11
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`35bddd6`](https://github.com/thirdweb-dev/js/commit/35bddd69c555c9277d8c3d703a93f23f74e0de77)]:
|
||||||
|
- @thirdweb-dev/crypto@0.2.2
|
||||||
|
|
||||||
## 2.0.10
|
## 2.0.10
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/storage",
|
"name": "@thirdweb-dev/storage",
|
||||||
"version": "2.0.10",
|
"version": "2.0.11",
|
||||||
"main": "dist/thirdweb-dev-storage.cjs.js",
|
"main": "dist/thirdweb-dev-storage.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-storage.esm.js",
|
"module": "dist/thirdweb-dev-storage.esm.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,25 @@
|
|||||||
# @thirdweb-dev/unity-js-bridge
|
# @thirdweb-dev/unity-js-bridge
|
||||||
|
|
||||||
|
## 0.4.13
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies []:
|
||||||
|
- @thirdweb-dev/sdk@4.0.49
|
||||||
|
- @thirdweb-dev/storage@2.0.11
|
||||||
|
- @thirdweb-dev/wallets@2.4.25
|
||||||
|
- @thirdweb-dev/auth@4.1.47
|
||||||
|
|
||||||
|
## 0.4.12
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#2501](https://github.com/thirdweb-dev/js/pull/2501) [`9c884e2`](https://github.com/thirdweb-dev/js/commit/9c884e2f55f1d096555c1fcf65bc850684d258c9) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Unity] Expose additional WC QR Options
|
||||||
|
|
||||||
|
- Updated dependencies [[`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4)]:
|
||||||
|
- @thirdweb-dev/wallets@2.4.24
|
||||||
|
- @thirdweb-dev/auth@4.1.46
|
||||||
|
|
||||||
## 0.4.11
|
## 0.4.11
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/unity-js-bridge",
|
"name": "@thirdweb-dev/unity-js-bridge",
|
||||||
"version": "0.4.11",
|
"version": "0.4.13",
|
||||||
"main": "dist/thirdweb-unity-bridge.js",
|
"main": "dist/thirdweb-unity-bridge.js",
|
||||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ class ThirdwebBridge implements TWBridge {
|
|||||||
}
|
}
|
||||||
(globalThis as any).X_SDK_NAME = "UnitySDK_WebGL";
|
(globalThis as any).X_SDK_NAME = "UnitySDK_WebGL";
|
||||||
(globalThis as any).X_SDK_PLATFORM = "unity";
|
(globalThis as any).X_SDK_PLATFORM = "unity";
|
||||||
(globalThis as any).X_SDK_VERSION = "4.7.10";
|
(globalThis as any).X_SDK_VERSION = "4.7.11";
|
||||||
(globalThis as any).X_SDK_OS = browser?.os ?? "unknown";
|
(globalThis as any).X_SDK_OS = browser?.os ?? "unknown";
|
||||||
}
|
}
|
||||||
this.initializedChain = chain;
|
this.initializedChain = chain;
|
||||||
@@ -221,8 +221,18 @@ class ThirdwebBridge implements TWBridge {
|
|||||||
chains: supportedChains,
|
chains: supportedChains,
|
||||||
clientId: sdkOptions.clientId,
|
clientId: sdkOptions.clientId,
|
||||||
qrModalOptions: {
|
qrModalOptions: {
|
||||||
|
enableExplorer:
|
||||||
|
sdkOptions.wallet?.walletConnectEnableExplorer ?? false,
|
||||||
explorerRecommendedWalletIds:
|
explorerRecommendedWalletIds:
|
||||||
sdkOptions.wallet?.walletConnectExplorerRecommendedWalletIds,
|
sdkOptions.wallet?.walletConnectExplorerRecommendedWalletIds ??
|
||||||
|
undefined,
|
||||||
|
walletImages:
|
||||||
|
sdkOptions.wallet?.walletConnectWalletImages ?? undefined,
|
||||||
|
desktopWallets:
|
||||||
|
sdkOptions.wallet?.walletConnectDesktopWallets ?? undefined,
|
||||||
|
mobileWallets:
|
||||||
|
sdkOptions.wallet?.walletConnectMobileWallets ?? undefined,
|
||||||
|
themeMode: sdkOptions.wallet?.walletConnectThemeMode ?? undefined,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,5 +1,19 @@
|
|||||||
# @thirdweb-dev/wallets
|
# @thirdweb-dev/wallets
|
||||||
|
|
||||||
|
## 2.4.25
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Updated dependencies [[`35bddd6`](https://github.com/thirdweb-dev/js/commit/35bddd69c555c9277d8c3d703a93f23f74e0de77)]:
|
||||||
|
- @thirdweb-dev/crypto@0.2.2
|
||||||
|
- @thirdweb-dev/sdk@4.0.49
|
||||||
|
|
||||||
|
## 2.4.24
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- [#2497](https://github.com/thirdweb-dev/js/pull/2497) [`79c9e13`](https://github.com/thirdweb-dev/js/commit/79c9e130fdc6e1f7de1486894a5ac3e6d6776fa4) Thanks [@makoshan](https://github.com/makoshan)! - Add imToken Wallet
|
||||||
|
|
||||||
## 2.4.23
|
## 2.4.23
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"main": "dist/thirdweb-dev-wallets-evm-connectors-imtoken.cjs.js",
|
||||||
|
"module": "dist/thirdweb-dev-wallets-evm-connectors-imtoken.esm.js",
|
||||||
|
"browser": {
|
||||||
|
"./dist/thirdweb-dev-wallets-evm-connectors-imtoken.esm.js": "./dist/thirdweb-dev-wallets-evm-connectors-imtoken.browser.esm.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"main": "dist/thirdweb-dev-wallets-evm-wallets-imtoken.cjs.js",
|
||||||
|
"module": "dist/thirdweb-dev-wallets-evm-wallets-imtoken.esm.js",
|
||||||
|
"browser": {
|
||||||
|
"./dist/thirdweb-dev-wallets-evm-wallets-imtoken.esm.js": "./dist/thirdweb-dev-wallets-evm-wallets-imtoken.browser.esm.js"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@thirdweb-dev/wallets",
|
"name": "@thirdweb-dev/wallets",
|
||||||
"version": "2.4.23",
|
"version": "2.4.25",
|
||||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||||
"browser": {
|
"browser": {
|
||||||
@@ -147,6 +147,13 @@
|
|||||||
},
|
},
|
||||||
"default": "./evm/wallets/gcp-kms/dist/thirdweb-dev-wallets-evm-wallets-gcp-kms.cjs.js"
|
"default": "./evm/wallets/gcp-kms/dist/thirdweb-dev-wallets-evm-wallets-gcp-kms.cjs.js"
|
||||||
},
|
},
|
||||||
|
"./evm/wallets/imtoken": {
|
||||||
|
"module": {
|
||||||
|
"browser": "./evm/wallets/imtoken/dist/thirdweb-dev-wallets-evm-wallets-imtoken.browser.esm.js",
|
||||||
|
"default": "./evm/wallets/imtoken/dist/thirdweb-dev-wallets-evm-wallets-imtoken.esm.js"
|
||||||
|
},
|
||||||
|
"default": "./evm/wallets/imtoken/dist/thirdweb-dev-wallets-evm-wallets-imtoken.cjs.js"
|
||||||
|
},
|
||||||
"./evm/wallets/phantom": {
|
"./evm/wallets/phantom": {
|
||||||
"module": {
|
"module": {
|
||||||
"browser": "./evm/wallets/phantom/dist/thirdweb-dev-wallets-evm-wallets-phantom.browser.esm.js",
|
"browser": "./evm/wallets/phantom/dist/thirdweb-dev-wallets-evm-wallets-phantom.browser.esm.js",
|
||||||
@@ -336,6 +343,13 @@
|
|||||||
},
|
},
|
||||||
"default": "./evm/wallets/embedded-wallet/dist/thirdweb-dev-wallets-evm-wallets-embedded-wallet.cjs.js"
|
"default": "./evm/wallets/embedded-wallet/dist/thirdweb-dev-wallets-evm-wallets-embedded-wallet.cjs.js"
|
||||||
},
|
},
|
||||||
|
"./evm/connectors/imtoken": {
|
||||||
|
"module": {
|
||||||
|
"browser": "./evm/connectors/imtoken/dist/thirdweb-dev-wallets-evm-connectors-imtoken.browser.esm.js",
|
||||||
|
"default": "./evm/connectors/imtoken/dist/thirdweb-dev-wallets-evm-connectors-imtoken.esm.js"
|
||||||
|
},
|
||||||
|
"default": "./evm/connectors/imtoken/dist/thirdweb-dev-wallets-evm-connectors-imtoken.cjs.js"
|
||||||
|
},
|
||||||
"./evm/connectors/phantom": {
|
"./evm/connectors/phantom": {
|
||||||
"module": {
|
"module": {
|
||||||
"browser": "./evm/connectors/phantom/dist/thirdweb-dev-wallets-evm-connectors-phantom.browser.esm.js",
|
"browser": "./evm/connectors/phantom/dist/thirdweb-dev-wallets-evm-connectors-phantom.browser.esm.js",
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
import { InjectedConnector, InjectedConnectorOptions } from "../injected";
|
||||||
|
import { assertWindowEthereum } from "../../utils/assertWindowEthereum";
|
||||||
|
import { Ethereum } from "../injected/types";
|
||||||
|
import type { Chain } from "@thirdweb-dev/chains";
|
||||||
|
import { AsyncStorage } from "../../../core/AsyncStorage";
|
||||||
|
|
||||||
|
type ImTokenConnectorConstructorArg = {
|
||||||
|
chains?: Chain[];
|
||||||
|
connectorStorage: AsyncStorage;
|
||||||
|
options?: InjectedConnectorOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class ImTokenConnector extends InjectedConnector {
|
||||||
|
constructor(arg: ImTokenConnectorConstructorArg) {
|
||||||
|
const defaultOptions = {
|
||||||
|
name: "imToken",
|
||||||
|
getProvider() {
|
||||||
|
function getReady(ethereum?: Ethereum) {
|
||||||
|
const isToken = !!ethereum?.isToken;
|
||||||
|
if (!isToken) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return ethereum;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof window === "undefined") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (assertWindowEthereum(globalThis.window)) {
|
||||||
|
if (globalThis.window.ethereum?.providers) {
|
||||||
|
return globalThis.window.ethereum.providers.find(getReady);
|
||||||
|
}
|
||||||
|
|
||||||
|
return getReady(globalThis.window.ethereum);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
const options = {
|
||||||
|
...defaultOptions,
|
||||||
|
...arg.options,
|
||||||
|
};
|
||||||
|
super({
|
||||||
|
chains: arg.chains,
|
||||||
|
options,
|
||||||
|
connectorStorage: arg.connectorStorage,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,8 @@ type InjectedProviderFlags = {
|
|||||||
isDefiWallet?: true;
|
isDefiWallet?: true;
|
||||||
isRabbyWallet?: true;
|
isRabbyWallet?: true;
|
||||||
isCoin98Wallet?: true;
|
isCoin98Wallet?: true;
|
||||||
|
// imToken
|
||||||
|
isToken?: true;
|
||||||
};
|
};
|
||||||
type InjectedProviders = InjectedProviderFlags & {
|
type InjectedProviders = InjectedProviderFlags & {
|
||||||
isMetaMask: true;
|
isMetaMask: true;
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export const walletIds = {
|
|||||||
coreWallet: "coreWallet",
|
coreWallet: "coreWallet",
|
||||||
cryptoDefiWallet: "cryptoDefiWallet",
|
cryptoDefiWallet: "cryptoDefiWallet",
|
||||||
frame: "frame",
|
frame: "frame",
|
||||||
|
imtoken: "imToken",
|
||||||
localWallet: "localWallet",
|
localWallet: "localWallet",
|
||||||
magicLink: "magicLink",
|
magicLink: "magicLink",
|
||||||
metamask: "metamask",
|
metamask: "metamask",
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export * from "./wallets/coinbase-wallet";
|
|||||||
export * from "./wallets/embedded-wallet";
|
export * from "./wallets/embedded-wallet";
|
||||||
export * from "./wallets/ethers";
|
export * from "./wallets/ethers";
|
||||||
export * from "./wallets/frame";
|
export * from "./wallets/frame";
|
||||||
|
export * from "./wallets/imtoken";
|
||||||
export * from "./wallets/injected";
|
export * from "./wallets/injected";
|
||||||
export * from "./wallets/local-wallet";
|
export * from "./wallets/local-wallet";
|
||||||
export * from "./wallets/signer";
|
export * from "./wallets/signer";
|
||||||
|
|||||||
@@ -0,0 +1,139 @@
|
|||||||
|
import type { WalletConnectConnector as WalletConnectConnectorType } from "../connectors/wallet-connect";
|
||||||
|
import type { QRModalOptions } from "../connectors/wallet-connect/qrModalOptions";
|
||||||
|
import { Connector, WagmiAdapter } from "../interfaces/connector";
|
||||||
|
import { assertWindowEthereum } from "../utils/assertWindowEthereum";
|
||||||
|
import { AbstractClientWallet, WalletOptions } from "./base";
|
||||||
|
import type { ImTokenConnector as ImTokenConnectorType } from "../connectors/imtoken";
|
||||||
|
import { walletIds } from "../constants/walletIds";
|
||||||
|
import { TW_WC_PROJECT_ID } from "../constants/wc";
|
||||||
|
|
||||||
|
type ImTokenAdditionalOptions = {
|
||||||
|
qrcode?: boolean;
|
||||||
|
projectId?: string;
|
||||||
|
qrModalOptions?: QRModalOptions;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ImTokenWalletOptions = WalletOptions<ImTokenAdditionalOptions>;
|
||||||
|
|
||||||
|
type ConnectWithQrCodeArgs = {
|
||||||
|
chainId?: number;
|
||||||
|
onQrCodeUri: (uri: string) => void;
|
||||||
|
onConnected: (accountAddress: string) => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class ImTokenWallet extends AbstractClientWallet<ImTokenAdditionalOptions> {
|
||||||
|
connector?: Connector;
|
||||||
|
walletConnectConnector?: WalletConnectConnectorType;
|
||||||
|
imtokenConnector?: ImTokenConnectorType;
|
||||||
|
isInjected: boolean;
|
||||||
|
static id = walletIds.imtoken as string;
|
||||||
|
|
||||||
|
public get walletName() {
|
||||||
|
return "imToken Wallet" as const;
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(options: ImTokenWalletOptions) {
|
||||||
|
super(ImTokenWallet.id, options);
|
||||||
|
|
||||||
|
if (assertWindowEthereum(globalThis.window)) {
|
||||||
|
this.isInjected = !!globalThis.window.ethereum?.isImToken;
|
||||||
|
} else {
|
||||||
|
this.isInjected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected async getConnector(): Promise<Connector> {
|
||||||
|
if (!this.connector) {
|
||||||
|
if (this.isInjected) {
|
||||||
|
// import the connector dynamically
|
||||||
|
const { ImTokenConnector } = await import("../connectors/imtoken");
|
||||||
|
const imtokenConnector = new ImTokenConnector({
|
||||||
|
chains: this.chains,
|
||||||
|
connectorStorage: this.walletStorage,
|
||||||
|
options: {
|
||||||
|
shimDisconnect: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
this.imtokenConnector = imtokenConnector;
|
||||||
|
|
||||||
|
this.connector = new WagmiAdapter(imtokenConnector);
|
||||||
|
} else {
|
||||||
|
const { WalletConnectConnector } = await import(
|
||||||
|
"../connectors/wallet-connect"
|
||||||
|
);
|
||||||
|
|
||||||
|
const walletConnectConnector = new WalletConnectConnector({
|
||||||
|
chains: this.chains,
|
||||||
|
options: {
|
||||||
|
projectId: this.options?.projectId || TW_WC_PROJECT_ID, // TODO,
|
||||||
|
storage: this.walletStorage,
|
||||||
|
qrcode: this.options?.qrcode,
|
||||||
|
dappMetadata: this.dappMetadata,
|
||||||
|
qrModalOptions: this.options?.qrModalOptions,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
walletConnectConnector.getProvider().then((provider) => {
|
||||||
|
provider.signer.client.on("session_request_sent", () => {
|
||||||
|
this.emit("wc_session_request_sent");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// need to save this for getting the QR code URI
|
||||||
|
this.walletConnectConnector = walletConnectConnector;
|
||||||
|
this.connector = new WagmiAdapter(walletConnectConnector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.connector;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connect to the wallet using a QR code.
|
||||||
|
* You can use this method to display a QR code. The user can scan this QR code using the Trust Wallet mobile app to connect to your dapp.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```typescript
|
||||||
|
* wallet.connectWithQrCode({
|
||||||
|
* chainId: 1,
|
||||||
|
* onQrCodeUri(qrCodeUri) {
|
||||||
|
* // render the QR code with `qrCodeUri`
|
||||||
|
* },
|
||||||
|
* onConnected(accountAddress) {
|
||||||
|
* // update UI to show connected state
|
||||||
|
* },
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param options -
|
||||||
|
* The options object contains the following properties/method:
|
||||||
|
*
|
||||||
|
* ### chainId (optional)
|
||||||
|
* If provided, wallet will prompt the user to switch to the network with the given `chainId` after connecting.
|
||||||
|
*
|
||||||
|
* ### onQrCodeUri
|
||||||
|
* A callback to get the QR code URI to display to the user.
|
||||||
|
*
|
||||||
|
* ### onConnected
|
||||||
|
* A callback that is called when the user has connected their wallet using the QR code.
|
||||||
|
*/
|
||||||
|
async connectWithQrCode(options: ConnectWithQrCodeArgs) {
|
||||||
|
await this.getConnector();
|
||||||
|
const wcConnector = this.walletConnectConnector;
|
||||||
|
|
||||||
|
if (!wcConnector) {
|
||||||
|
throw new Error("WalletConnect connector not found");
|
||||||
|
}
|
||||||
|
|
||||||
|
const wcProvider = await wcConnector.getProvider();
|
||||||
|
|
||||||
|
// set a listener for display_uri event
|
||||||
|
wcProvider.on("display_uri", (uri) => {
|
||||||
|
options.onQrCodeUri(uri);
|
||||||
|
});
|
||||||
|
|
||||||
|
// trigger connect flow
|
||||||
|
this.connect({ chainId: options.chainId }).then(options.onConnected);
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Reference in New Issue
Block a user