Compare commits

..
Author SHA1 Message Date
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
4895217142 Version Packages (#1560)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-09-01 12:45:44 -07:00
Joaquim VergesandGitHub 0b59cb2e59 update readme (#1574) 2023-09-01 18:41:16 +00:00
Joaquim VergesandGitHub 2088de1cac [SDK] Dynamic gas fee estimation (#1572) 2023-09-01 18:28:46 +00:00
Danny FridayandGitHub 066b9cfa09 [Storage] Improve storage SDK IPFS upload error logging (#1564) 2023-08-31 16:39:55 +00:00
Mariano FuentesandGitHub 1e6f9dcc04 CLI - Update globalThis variables (#1569) 2023-08-31 02:25:46 +00:00
Joaquim VergesandGitHub a023cb8cf1 [SDK] Adjust gas fee calculations for OP chains (#1568) 2023-08-30 23:37:08 +00:00
YashandGitHub a00cbaf78c [SDK] Fix param encoding for deterministic deploy (#1567) 2023-08-30 23:08:47 +00:00
Winston YeoandGitHub d378106a85 Winston/documentation for service utils (#1566) 2023-08-30 22:11:13 +00:00
Joaquim VergesandGitHub 3eb9592e10 [Storage] Up default download timeout to 60s, expose option to override it (#1565) 2023-08-30 17:40:06 +00:00
Mariano FuentesandGitHub 04b6ef73e4 [CLI] - Update logout logic (#1562) 2023-08-29 22:25:57 +00:00
Tair AsimandGitHub 13ef6a50cf [service-utils] expose account status in api key meta (#1559) 2023-08-29 17:24:59 +00:00
github-actions[bot]GitHubgithub-actions[bot] <github-actions[bot]@users.noreply.github.com>
04c607ccde Version Packages (#1556)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-08-29 10:23:47 -07:00
Mariano FuentesandGitHub 926dd7b03f [CLI] - Descriptions improvements, deprecate Release (#1558) 2023-08-29 17:01:20 +00:00
Manan TankandGitHub e00dd12357 [sdk] Use default import for EventEmitter (#1557) 2023-08-29 15:49:09 +00:00
iketwandGitHub cdc08c5528 [RN] Use regular import for coinbase connector (#1546) 2023-08-29 13:23:43 +00:00
72 changed files with 1023 additions and 336 deletions
+1
View File
@@ -23,6 +23,7 @@
| Package | Description | Latest Version |
| ---------------------------------------- | -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [/sdk](./packages/sdk) | Best in class web3 SDK for Browser, Node and Mobile apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/sdk"><img src="https://img.shields.io/npm/v/@thirdweb-dev/sdk?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/wallets](./packages/wallets) | Unified web3 Wallet library to integrate any wallet into your applications. | <a href="https://www.npmjs.com/package/@thirdweb-dev/wallets"><img src="https://img.shields.io/npm/v/@thirdweb-dev/wallets?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/react](./packages/react) | Ultimate collection of React hooks for your web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/react-native](./packages/react-native) | Ultimate collection of React hooks for your native mobile web3 apps | <a href="https://www.npmjs.com/package/@thirdweb-dev/react-native"><img src="https://img.shields.io/npm/v/@thirdweb-dev/react-native?color=red&label=npm&logo=npm" alt="npm version"/></a> |
| [/auth](./packages/auth) | Best in class wallet authentication for Node backends | <a href="https://www.npmjs.com/package/@thirdweb-dev/auth"><img src="https://img.shields.io/npm/v/@thirdweb-dev/auth?color=red&label=npm&logo=npm" alt="npm version"/></a> |
+14
View File
@@ -1,5 +1,19 @@
# @thirdweb-dev/auth
## 3.2.40
### Patch Changes
- Updated dependencies [[`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40), [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/wallets@1.1.23
## 3.2.39
### Patch Changes
- Updated dependencies []:
- @thirdweb-dev/wallets@1.1.22
## 3.2.38
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/auth",
"version": "3.2.38",
"version": "3.2.40",
"main": "dist/thirdweb-dev-auth.cjs.js",
"module": "dist/thirdweb-dev-auth.esm.js",
"browser": {
+6
View File
@@ -1,5 +1,11 @@
# @thirdweb-dev/chains
## 0.1.50
### Patch Changes
- [#1558](https://github.com/thirdweb-dev/js/pull/1558) [`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005) Thanks [@Marfuen](https://github.com/Marfuen)! - Updating chains list
## 0.1.49
### Patch Changes
+28
View File
@@ -0,0 +1,28 @@
import type { Chain } from "../src/types";
export default {
"name": "Worldland Mainnet",
"chain": "Worldland",
"rpc": [
"https://worldland.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://seoul.worldland.foundation"
],
"faucets": [],
"nativeCurrency": {
"name": "Worldland",
"symbol": "WL",
"decimals": 18
},
"infoURL": "https://worldland.foundation",
"shortName": "WLC",
"chainId": 103,
"networkId": 103,
"explorers": [
{
"name": "Worldland Explorer",
"url": "https://scan.worldland.foundation",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "worldland"
} as const satisfies Chain;
+28
View File
@@ -0,0 +1,28 @@
import type { Chain } from "../src/types";
export default {
"name": "Worldland Testnet",
"chain": "Worldland",
"rpc": [
"https://worldland-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://gwangju.worldland.foundation"
],
"faucets": [],
"nativeCurrency": {
"name": "Worldland",
"symbol": "WL",
"decimals": 18
},
"infoURL": "https://worldland.foundation",
"shortName": "TWLC",
"chainId": 10395,
"networkId": 10395,
"explorers": [
{
"name": "Worldland Explorer",
"url": "https://testscan.worldland.foundation",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "worldland-testnet"
} as const satisfies Chain;
+32
View File
@@ -0,0 +1,32 @@
import type { Chain } from "../src/types";
export default {
"name": "Polygon Supernet Arianee",
"chain": "Arianee",
"rpc": [
"https://polygon-supernet-arianee.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.polygonsupernet.public.arianee.net"
],
"faucets": [],
"nativeCurrency": {
"name": "Arianee",
"symbol": "ARIA20",
"decimals": 18
},
"infoURL": "https://arianee.org",
"shortName": "Arianee",
"chainId": 11891,
"networkId": 11891,
"explorers": [
{
"name": "Polygon Supernet Arianee Explorer",
"url": "https://polygonsupernet.explorer.arianee.net",
"standard": "EIP3091"
}
],
"parent": {
"chain": "eip155-1",
"type": "L2"
},
"testnet": false,
"slug": "polygon-supernet-arianee"
} as const satisfies Chain;
+33
View File
@@ -0,0 +1,33 @@
import type { Chain } from "../src/types";
export default {
"name": "Shrapnel Testnet",
"chain": "SHRAPNEL",
"rpc": [
"https://shrapnel-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://subnets.avax.network/shrapnel/testnet/rpc"
],
"features": [
{
"name": "EIP1559"
}
],
"faucets": [],
"nativeCurrency": {
"name": "SHRAPG",
"symbol": "SHRAPG",
"decimals": 18
},
"infoURL": "https://www.shrapnel.com/",
"shortName": "shraptest",
"chainId": 2038,
"networkId": 2038,
"explorers": [
{
"name": "SHRAPNEL Explorer",
"url": "https://subnets-test.avax.network/shrapnel",
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "shrapnel-testnet"
} as const satisfies Chain;
+23
View File
@@ -0,0 +1,23 @@
import type { Chain } from "../src/types";
export default {
"name": "BigShortBets",
"chain": "BIGSB",
"rpc": [
"https://bigshortbets.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://market.bigsb.io",
"wss://market.bigsb.io"
],
"faucets": [],
"nativeCurrency": {
"name": "USD Coin",
"symbol": "USDC",
"decimals": 18
},
"infoURL": "https://bigshortbets.com/",
"shortName": "bigsb",
"chainId": 2137,
"networkId": 2137,
"explorers": [],
"testnet": false,
"slug": "bigshortbets"
} as const satisfies Chain;
+40
View File
@@ -0,0 +1,40 @@
import type { Chain } from "../src/types";
export default {
"name": "Nautilus Mainnet",
"chain": "ETH",
"icon": {
"url": "ipfs://QmNutSgM7n6aJPPDiofe9Dm1epy1RcYTMvugukLUK2vmPM",
"width": 500,
"height": 500,
"format": "png"
},
"rpc": [
"https://nautilus.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.nautilus.nautchain.xyz"
],
"faucets": [],
"nativeCurrency": {
"name": "Zebec",
"symbol": "ZBC",
"decimals": 18
},
"infoURL": "https://docs.nautchain.xyz",
"shortName": "NAUTCHAIN",
"chainId": 22222,
"networkId": 22222,
"explorers": [
{
"name": "Nautscan",
"url": "https://nautscan.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmNutSgM7n6aJPPDiofe9Dm1epy1RcYTMvugukLUK2vmPM",
"width": 500,
"height": 500,
"format": "png"
}
}
],
"testnet": false,
"slug": "nautilus"
} as const satisfies Chain;
+37
View File
@@ -0,0 +1,37 @@
import type { Chain } from "../src/types";
export default {
"name": "Morphism Testnet",
"chain": "ETH",
"rpc": [
"https://morphism-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet.morphism.xyz"
],
"faucets": [],
"nativeCurrency": {
"name": "Ether",
"symbol": "ETH",
"decimals": 18
},
"infoURL": "https://morphism.xyz",
"shortName": "tmorph",
"chainId": 2710,
"networkId": 2710,
"explorers": [
{
"name": "Morphism Testnet Explorer",
"url": "https://explorer-testnet.morphism.xyz",
"standard": "EIP3091"
}
],
"parent": {
"type": "L2",
"chain": "eip155-1",
"bridges": [
{
"url": "https://bridge-testnet.morphism.xyz"
}
]
},
"testnet": true,
"slug": "morphism-testnet"
} as const satisfies Chain;
+2 -2
View File
@@ -3,7 +3,7 @@ export default {
"name": "Xpla Mainnet",
"chain": "XPLA",
"rpc": [
"https://xpla-xpla.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://xpla.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://dimension-evm-rpc.xpla.dev"
],
"nativeCurrency": {
@@ -31,5 +31,5 @@ export default {
"redFlags": [
"reusedChainId"
],
"slug": "xpla-xpla"
"slug": "xpla"
} as const satisfies Chain;
+11 -8
View File
@@ -1,21 +1,21 @@
import type { Chain } from "../src/types";
export default {
"name": "Xpla Mainnet",
"chain": "XPLA",
"name": "Xpla Testnet",
"chain": "XPLATest",
"rpc": [
"https://xpla.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://xpla-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://dimension-rpc.xpla.dev"
],
"faucets": [
"https://faucet.xpla.io/"
"https://faucet.xpla.io"
],
"nativeCurrency": {
"name": "XPLA",
"symbol": "XPLA",
"decimals": 18
},
"infoURL": "https://xpla.io/",
"shortName": "xpla",
"infoURL": "https://xpla.io",
"shortName": "xplatest",
"chainId": 3701,
"networkId": 3701,
"icon": {
@@ -31,6 +31,9 @@ export default {
"standard": "none"
}
],
"testnet": false,
"slug": "xpla"
"redFlags": [
"reusedChainId"
],
"testnet": true,
"slug": "xpla-testnet"
} as const satisfies Chain;
+36
View File
@@ -0,0 +1,36 @@
import type { Chain } from "../src/types";
export default {
"name": "ConnectorManager Robin",
"chain": "Rangers",
"icon": {
"url": "ipfs://QmXR5e5SDABWfQn6XT9uMsVYAo5Bv7vUv4jVs8DFqatZWG",
"width": 2000,
"height": 2000,
"format": "png"
},
"rpc": [
"https://connectormanager-robin.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://robin-cm.rangersprotocol.com/api/jsonrpc"
],
"faucets": [
"https://robin-faucet.rangersprotocol.com"
],
"nativeCurrency": {
"name": "Rangers Protocol Gas",
"symbol": "ttRPG",
"decimals": 18
},
"infoURL": "https://rangersprotocol.com",
"shortName": "ttrpg",
"chainId": 38401,
"networkId": 38401,
"explorers": [
{
"name": "rangersscan-robin",
"url": "https://robin-rangersscan.rangersprotocol.com",
"standard": "none"
}
],
"testnet": false,
"slug": "connectormanager-robin"
} as const satisfies Chain;
+2 -2
View File
@@ -3,7 +3,7 @@ export default {
"name": "Xpla Testnet",
"chain": "XPLA",
"rpc": [
"https://xpla-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://xpla-testnet-xpla-test.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://cube-evm-rpc.xpla.dev"
],
"nativeCurrency": {
@@ -34,5 +34,5 @@ export default {
"redFlags": [
"reusedChainId"
],
"slug": "xpla-testnet"
"slug": "xpla-testnet-xpla-test"
} as const satisfies Chain;
+43
View File
@@ -0,0 +1,43 @@
import type { Chain } from "../src/types";
export default {
"name": "Tritanium Testnet",
"chain": "TRITANIUM",
"rpc": [
"https://tritanium-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://nodetestnet-station-one.tritanium.network/",
"https://nodetestnet-station-two.tritanium.network/"
],
"faucets": [
"https://faucet.tritanium.network"
],
"nativeCurrency": {
"name": "Tritanium Native Token",
"symbol": "tTRN",
"decimals": 18
},
"infoURL": "https://tritanium.network",
"shortName": "ttrn",
"chainId": 5353,
"networkId": 5353,
"icon": {
"url": "ipfs://QmRm6gcEPJmU9a86zrmyP7FALTN4Toz9HrnrL2Kwg6FPeh",
"width": 512,
"height": 512,
"format": "png"
},
"explorers": [
{
"name": "TRITANIUM Testnet Explorer",
"icon": {
"url": "ipfs://QmRm6gcEPJmU9a86zrmyP7FALTN4Toz9HrnrL2Kwg6FPeh",
"width": 512,
"height": 512,
"format": "png"
},
"url": "https://testnet.tritanium.network",
"standard": "none"
}
],
"testnet": true,
"slug": "tritanium-testnet"
} as const satisfies Chain;
+50
View File
@@ -0,0 +1,50 @@
import type { Chain } from "../src/types";
export default {
"name": "Rethereum Mainnet",
"chain": "RTH",
"rpc": [
"https://rethereum.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.rethereum.org",
"https://rethereum.rpc.restratagem.com",
"https://rpc.rthcentral.org"
],
"faucets": [],
"nativeCurrency": {
"name": "Rethereum",
"symbol": "RTH",
"decimals": 18
},
"features": [
{
"name": "EIP155"
},
{
"name": "EIP1559"
}
],
"infoURL": "https://www.rethereum.org",
"shortName": "rth",
"chainId": 622277,
"networkId": 622277,
"icon": {
"url": "ipfs://bafkreiawlhc2trzyxgnz24vowdymxme2m446uk4vmrplgxsdd74ecpfloq",
"width": 830,
"height": 830,
"format": "png"
},
"explorers": [
{
"name": "rethereum",
"url": "https://explorer.rethereum.org",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "rethereum"
} as const satisfies Chain;
+28
View File
@@ -0,0 +1,28 @@
import type { Chain } from "../src/types";
export default {
"name": "JuncaChain",
"chain": "JuncaChain",
"rpc": [
"https://juncachain.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc.juncachain.com"
],
"nativeCurrency": {
"name": "JuncaChain Native Token",
"symbol": "JGC",
"decimals": 18
},
"faucets": [],
"infoURL": "https://junca-cash.world",
"shortName": "junca",
"chainId": 668,
"networkId": 668,
"explorers": [
{
"name": "JuncaScan",
"url": "https://scan.juncachain.com",
"standard": "EIP3091"
}
],
"testnet": false,
"slug": "juncachain"
} as const satisfies Chain;
+37
View File
@@ -0,0 +1,37 @@
import type { Chain } from "../src/types";
export default {
"name": "JuncaGlobal Chain Testnet",
"chain": "JuncaGlobal Test Chain",
"rpc": [
"https://juncaglobal-chain-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://rpc-testnet.juncachain.com",
"wss://ws-testnet.juncachain.com"
],
"faucets": [
"https://faucet-testnet.juncachain.com"
],
"nativeCurrency": {
"name": "JuncaGlobal Chain Testnet Native Token",
"symbol": "JGCT",
"decimals": 18
},
"infoURL": "https://junca-cash.world",
"shortName": "junca",
"chainId": 669,
"networkId": 669,
"explorers": [
{
"name": "blockscout",
"url": "https://scan-testnet.juncachain.com",
"icon": {
"url": "ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM",
"width": 551,
"height": 540,
"format": "png"
},
"standard": "EIP3091"
}
],
"testnet": true,
"slug": "juncaglobal-chain-testnet"
} as const satisfies Chain;
+3 -2
View File
@@ -1,6 +1,6 @@
import type { Chain } from "../src/types";
export default {
"name": "Horizen EON",
"name": "Horizen EON Mainnet",
"shortName": "EON",
"chain": "EON",
"icon": {
@@ -11,7 +11,8 @@ export default {
},
"rpc": [
"https://horizen-eon.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://eon-rpc.horizenlabs.io/ethv1"
"https://eon-rpc.horizenlabs.io/ethv1",
"https://rpc.ankr.com/horizen_eon"
],
"features": [
{
+42
View File
@@ -0,0 +1,42 @@
import type { Chain } from "../src/types";
export default {
"name": "Nautilus Proteus Testnet",
"chain": "ETH",
"icon": {
"url": "ipfs://QmNutSgM7n6aJPPDiofe9Dm1epy1RcYTMvugukLUK2vmPM",
"width": 500,
"height": 500,
"format": "png"
},
"rpc": [
"https://nautilus-proteus-testnet.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
"https://api.proteus.nautchain.xyz/solana"
],
"faucets": [
"https://proteusfaucet.nautchain.xyz"
],
"nativeCurrency": {
"name": "Zebec Test Token",
"symbol": "tZBC",
"decimals": 18
},
"infoURL": "https://docs.nautchain.xyz",
"shortName": "NAUTTest",
"chainId": 88002,
"networkId": 88002,
"explorers": [
{
"name": "Nautscan",
"url": "https://proteus.nautscan.com",
"standard": "EIP3091",
"icon": {
"url": "ipfs://QmNutSgM7n6aJPPDiofe9Dm1epy1RcYTMvugukLUK2vmPM",
"width": 500,
"height": 500,
"format": "png"
}
}
],
"testnet": true,
"slug": "nautilus-proteus-testnet"
} as const satisfies Chain;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/chains",
"version": "0.1.49",
"version": "0.1.50",
"main": "dist/thirdweb-dev-chains.cjs.js",
"module": "dist/thirdweb-dev-chains.esm.js",
"browser": {
File diff suppressed because one or more lines are too long
+26
View File
@@ -1,5 +1,31 @@
# thirdweb
## 0.12.2
### Patch Changes
- [#1562](https://github.com/thirdweb-dev/js/pull/1562) [`04b6ef73`](https://github.com/thirdweb-dev/js/commit/04b6ef73e4641c5284353bffc43dbc5c597405de) Thanks [@Marfuen](https://github.com/Marfuen)! - Logout underlying wallet on logout
- [#1569](https://github.com/thirdweb-dev/js/pull/1569) [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b) Thanks [@Marfuen](https://github.com/Marfuen)! - Use a different globalThis for CLI related flow.
- Updated dependencies [[`3eb9592e`](https://github.com/thirdweb-dev/js/commit/3eb9592e10154e06d2fa5effbc0c1a483f62498f), [`066b9cfa`](https://github.com/thirdweb-dev/js/commit/066b9cfa09df2531c9e5440477a24edc1374e0e0), [`a00cbaf7`](https://github.com/thirdweb-dev/js/commit/a00cbaf78c05ea43d3814ba9f9ec8e667f0ddb25), [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40), [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/storage@1.2.10
- @thirdweb-dev/sdk@3.10.59
- @thirdweb-dev/wallets@1.1.23
- @thirdweb-dev/auth@3.2.40
## 0.12.1
### Patch Changes
- [#1558](https://github.com/thirdweb-dev/js/pull/1558) [`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005) Thanks [@Marfuen](https://github.com/Marfuen)! - Updated descriptions for publish and deploy. Print out the login url for users without browsers. Remove the Release command (Use "Publish" instead).
- Updated dependencies [[`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005), [`e00dd123`](https://github.com/thirdweb-dev/js/commit/e00dd123579f75752b6fe4fcf613d2cae5419e19)]:
- @thirdweb-dev/chains@0.1.50
- @thirdweb-dev/sdk@3.10.58
- @thirdweb-dev/wallets@1.1.22
- @thirdweb-dev/auth@3.2.39
## 0.12.0
### Minor Changes
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "thirdweb",
"main": "dist/cli/index.js",
"version": "0.12.0",
"version": "0.12.2",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+12 -13
View File
@@ -43,7 +43,7 @@ export async function loginUser(
if (showLogs) {
console.log(chalk.green("You are already logged in"));
}
globalThis["TW_AUTH_TOKEN"] = authToken;
globalThis["TW_CLI_AUTH_TOKEN"] = authToken;
return authToken;
} else {
const token = await authenticateUser({ browser: true, configPaths });
@@ -51,7 +51,7 @@ export async function loginUser(
throw new Error("Failed to login");
}
globalThis["TW_AUTH_TOKEN"] = token;
globalThis["TW_CLI_AUTH_TOKEN"] = token;
return token;
}
}
@@ -59,7 +59,7 @@ export async function loginUser(
export async function logoutUser(credsConfigPath: string, tokenPath: string, cliWalletPath: string) {
try {
ora("Logging out...").start();
const dirExists = fs.existsSync(credsConfigPath) && fs.existsSync(tokenPath);
const dirExists = fs.existsSync(credsConfigPath) && fs.existsSync(tokenPath) && fs.existsSync(cliWalletPath);
if (!dirExists) {
ora().warn(chalk.yellow("You are already logged out, did you mean to login?"));
return;
@@ -197,16 +197,15 @@ export const authenticateUser = async (
server.listen(8976);
});
if (props?.browser) {
console.log(chalk.yellow(`Automatically opening a link to authenticate with our dashboard...\n`))
waitForDashboard.start();
// Adding this timeout since it feels weird for the browser to open before the spinner.
setTimeout(async () => {
await open(urlToOpen);
}, 2000);
} else {
logger.info(`Visit this link to authenticate: ${urlToOpen}`);
}
console.log(`Automatically attempting to open a link to authenticate with our dashboard...\n`);
waitForDashboard.start();
// Adding this timeout since it feels weird for the browser to open before the spinner.
setTimeout(async () => {
await open(urlToOpen);
}, 2000);
console.log(chalk.yellow(`If the browser doesn't open, please use this link to authenticate:\n`));
console.log(chalk.yellow(urlToOpen + '\n'));
return Promise.race([timerPromise, loginPromise]);
};
+6 -52
View File
@@ -47,11 +47,11 @@ const main = async () => {
$$ |$$\\ $$ | $$ |$$ |$$ | $$ | $$ |$$ | $$ | $$ |$$ ____|$$ | $$ |
\\$$$$ |$$ | $$ |$$ |$$ | \\$$$$$$$ |\\$$$$$\\$$$$ |\\$$$$$$$\\ $$$$$$$ |
\\____/ \\__| \\__|\\__|\\__| \\_______| \\_____\\____/ \\_______|\\_______/ `);
console.info(`\n 💎 thirdweb-cli v${cliVersion} 💎\n`);
console.info(`\n 💎 thirdweb v${cliVersion} 💎\n`);
}
program
.name("thirdweb-cli")
.name("thirdweb")
.description("Official thirdweb command line interface")
.version(cliVersion, "-v, --version")
.option("--skip-update-check", "Skip check for auto updates")
@@ -296,7 +296,7 @@ const main = async () => {
program
.command("deploy")
.description("Deploy your (or team) contracts securely to blockchains")
.description("Securely deploy your contract to any EVM network without having to deal with scripts, private keys, or ABIs")
.option("-p, --path <project-path>", "path to project", ".")
.option("--clean", "clear the cache before building")
.option("--dry-run", "dry run (skip actually publishing)")
@@ -350,55 +350,10 @@ const main = async () => {
}
});
program
.command("release")
.description("[Deprecated] use 'publish' instead.")
.option("-p, --path <project-path>", "path to project", ".")
.option(
"-f, --file [name]",
"Filter for contract files that contain the file name",
)
.option(
"-cn, --contract-name [name]",
"Filter for contracts that contain this contract name",
)
.option("--clean", "clear the cache before building")
.option("--dry-run", "dry run (skip actually publishing)")
.option("-d, --debug", "show debug logs")
.option("--ci", "Continuous Integration mode")
.option("-k, --key <key>", "API secret key to authorize usage")
.action(async (options) => {
let secretKey = "";
// If no key is passed in, prompt the user to login. If it is passed in, use it.
if (!options.key) {
await loginUser({
credsConfigPath,
cliWalletPath,
tokenPath,
});
} else {
// Don't need to validate anymore? Also, should probably rely on the underlying service to throw that error.
await validateKey(options.key);
secretKey = options.key;
}
logger.warn(
"'release' is deprecated and will be removed in a future update. Please use 'publish' instead.",
);
const url = await processProject(options, "publish", secretKey);
info(
`Open this link to publish your contracts: ${chalk.blueBright(
url.toString(),
)}`,
);
if (url && !options.ci) {
await open(url.toString());
}
});
program
.command("publish")
.description(
"Publish your protocol so other devs can deploy them and unlock SDKs, Dashboards and Analytics",
"Get a shareable page for your contract with a README, changelog, and version control. Enable one-click deploys to any EVM network",
)
.option("-p, --path <project-path>", "path to project", ".")
.option(
@@ -537,9 +492,8 @@ const main = async () => {
program
.command("login")
.description(
"Authenticate with the thirdweb CLI using your API secret key or replace an existing API secret key",
"Authorize your device to use the thirdweb CLI by authenticating with your wallet from our dashboard",
)
.option("-n, --new", "Login with a new API secret key", false)
.action(async (options) => {
await loginUser({
credsConfigPath,
@@ -551,7 +505,7 @@ const main = async () => {
program
.command("logout")
.description(
"Logout of the thirdweb CLI, effectively removing your API secret key from your machine",
"Logout of the thirdweb CLI",
)
.action(async () => {
await logoutUser(credsConfigPath, tokenPath, cliWalletPath);
+2 -1
View File
@@ -1,4 +1,5 @@
/* eslint-disable no-var */
declare module globalThis {
// eslint-disable-next-line no-var
var TW_AUTH_TOKEN: string;
var TW_CLI_AUTH_TOKEN: string;
}
+20
View File
@@ -1,5 +1,25 @@
# @thirdweb-dev/react-core
## 3.14.40
### Patch Changes
- Updated dependencies [[`3eb9592e`](https://github.com/thirdweb-dev/js/commit/3eb9592e10154e06d2fa5effbc0c1a483f62498f), [`066b9cfa`](https://github.com/thirdweb-dev/js/commit/066b9cfa09df2531c9e5440477a24edc1374e0e0), [`a00cbaf7`](https://github.com/thirdweb-dev/js/commit/a00cbaf78c05ea43d3814ba9f9ec8e667f0ddb25), [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40), [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/storage@1.2.10
- @thirdweb-dev/sdk@3.10.59
- @thirdweb-dev/wallets@1.1.23
- @thirdweb-dev/auth@3.2.40
## 3.14.39
### Patch Changes
- Updated dependencies [[`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005), [`e00dd123`](https://github.com/thirdweb-dev/js/commit/e00dd123579f75752b6fe4fcf613d2cae5419e19)]:
- @thirdweb-dev/chains@0.1.50
- @thirdweb-dev/sdk@3.10.58
- @thirdweb-dev/wallets@1.1.22
- @thirdweb-dev/auth@3.2.39
## 3.14.38
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-core",
"version": "3.14.38",
"version": "3.14.40",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,5 +1,9 @@
# @thirdweb-dev/react-native-compat
## 0.2.59
## 0.2.58
## 0.2.57
## 0.2.56
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@thirdweb-dev/react-native-compat",
"description": "Shims for Thirdweb in React Native Projects",
"version": "0.2.57",
"version": "0.2.59",
"author": "thirdweb eng <[email protected]>",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
"license": "Apache-2.0",
+22
View File
@@ -1,5 +1,27 @@
# @thirdweb-dev/react-native
## 0.2.59
### Patch Changes
- Updated dependencies [[`3eb9592e`](https://github.com/thirdweb-dev/js/commit/3eb9592e10154e06d2fa5effbc0c1a483f62498f), [`066b9cfa`](https://github.com/thirdweb-dev/js/commit/066b9cfa09df2531c9e5440477a24edc1374e0e0), [`a00cbaf7`](https://github.com/thirdweb-dev/js/commit/a00cbaf78c05ea43d3814ba9f9ec8e667f0ddb25), [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40), [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/storage@1.2.10
- @thirdweb-dev/sdk@3.10.59
- @thirdweb-dev/wallets@1.1.23
- @thirdweb-dev/react-core@3.14.40
## 0.2.58
### Patch Changes
- [#1546](https://github.com/thirdweb-dev/js/pull/1546) [`cdc08c55`](https://github.com/thirdweb-dev/js/commit/cdc08c55282d5873972b85217c42ba2f97a1ffed) Thanks [@iketw](https://github.com/iketw)! - Use regular import for coinbase connector in React Native
- Updated dependencies [[`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005), [`e00dd123`](https://github.com/thirdweb-dev/js/commit/e00dd123579f75752b6fe4fcf613d2cae5419e19)]:
- @thirdweb-dev/chains@0.1.50
- @thirdweb-dev/sdk@3.10.58
- @thirdweb-dev/react-core@3.14.39
- @thirdweb-dev/wallets@1.1.22
## 0.2.57
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react-native",
"version": "0.2.57",
"version": "0.2.59",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
@@ -1,8 +1,9 @@
import { noopStorage } from "../../../core/AsyncStorage";
import type {
CoinbaseWalletConnector,
CoinbaseWalletConnector as CoinbaseWalletConnectorType,
CoinbaseWalletConnectorOptions,
} from "../connectors/coinbase-wallet";
import { CoinbaseWalletConnector } from "../connectors/coinbase-wallet";
import {
AbstractClientWallet,
Connector,
@@ -28,8 +29,8 @@ export class CoinbaseWallet extends AbstractClientWallet<CoinbaseWalletConnector
};
connector?: Connector;
coinbaseConnector?: CoinbaseWalletConnector;
provider?: CoinbaseWalletConnector["provider"];
coinbaseConnector?: CoinbaseWalletConnectorType;
provider?: CoinbaseWalletConnectorType["provider"];
static id = walletIds.coinbase;
public get walletName() {
@@ -50,11 +51,6 @@ export class CoinbaseWallet extends AbstractClientWallet<CoinbaseWalletConnector
protected async getConnector(): Promise<Connector> {
if (!this.connector) {
// import the connector dynamically
const { CoinbaseWalletConnector: CoinbaseWalletConnector } = await import(
"../connectors/coinbase-wallet"
);
const cbConnector = new CoinbaseWalletConnector({
chains: this.chains,
options: {
+19
View File
@@ -1,5 +1,24 @@
# @thirdweb-dev/react
## 3.14.40
### Patch Changes
- Updated dependencies [[`a00cbaf7`](https://github.com/thirdweb-dev/js/commit/a00cbaf78c05ea43d3814ba9f9ec8e667f0ddb25), [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40), [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/sdk@3.10.59
- @thirdweb-dev/wallets@1.1.23
- @thirdweb-dev/react-core@3.14.40
## 3.14.39
### Patch Changes
- Updated dependencies [[`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005), [`e00dd123`](https://github.com/thirdweb-dev/js/commit/e00dd123579f75752b6fe4fcf613d2cae5419e19)]:
- @thirdweb-dev/chains@0.1.50
- @thirdweb-dev/sdk@3.10.58
- @thirdweb-dev/react-core@3.14.39
- @thirdweb-dev/wallets@1.1.22
## 3.14.38
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/react",
"version": "3.14.38",
"version": "3.14.40",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
"author": "thirdweb eng <[email protected]>",
"license": "Apache-2.0",
+6
View File
@@ -14,6 +14,12 @@ module.exports = {
message:
"Do not import entire ethers object, Use named imports instead.",
},
{
name: "eventemitter3",
importNames: ["EventEmitter"],
message:
"Do not use named import for importing EventEmitter, Use default import instead.",
},
],
},
],
+24
View File
@@ -1,5 +1,29 @@
# @thirdweb-dev/sdk
## 3.10.59
### Patch Changes
- [#1567](https://github.com/thirdweb-dev/js/pull/1567) [`a00cbaf7`](https://github.com/thirdweb-dev/js/commit/a00cbaf78c05ea43d3814ba9f9ec8e667f0ddb25) Thanks [@kumaryash90](https://github.com/kumaryash90)! - Fix constructor param encoding for deterministic deployments
- [#1568](https://github.com/thirdweb-dev/js/pull/1568) [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Better fee calculations for OP stack
- [#1572](https://github.com/thirdweb-dev/js/pull/1572) [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Dynamic gas fee estimations
- [#1569](https://github.com/thirdweb-dev/js/pull/1569) [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b) Thanks [@Marfuen](https://github.com/Marfuen)! - Use a different globalThis for CLI related flow.
- Updated dependencies [[`3eb9592e`](https://github.com/thirdweb-dev/js/commit/3eb9592e10154e06d2fa5effbc0c1a483f62498f), [`066b9cfa`](https://github.com/thirdweb-dev/js/commit/066b9cfa09df2531c9e5440477a24edc1374e0e0), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/storage@1.2.10
## 3.10.58
### Patch Changes
- [#1557](https://github.com/thirdweb-dev/js/pull/1557) [`e00dd123`](https://github.com/thirdweb-dev/js/commit/e00dd123579f75752b6fe4fcf613d2cae5419e19) Thanks [@MananTank](https://github.com/MananTank)! - Use default export for EventEmitter to fix issue with Nuxt/Vite + Yarn to fix the "Named export 'EventEmitter' not found" error
- Updated dependencies [[`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005)]:
- @thirdweb-dev/chains@0.1.50
## 3.10.57
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/sdk",
"version": "3.10.57",
"version": "3.10.59",
"description": "The main thirdweb SDK.",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
"license": "Apache-2.0",
@@ -48,17 +48,24 @@ export async function directDeployDeterministic(
const create2Factory = await deployCreate2Factory(signer);
// 2. Encode constructor params
const constructorParamTypes = extractConstructorParamsFromAbi(abi).map(
(p) => {
return p.type;
},
);
const constructorParams = extractConstructorParamsFromAbi(abi);
const constructorParamTypes = constructorParams.map((p) => {
return p.type;
});
const paramValues = convertParamValues(
constructorParamTypes,
constructorArgs,
);
const paramTypesForEncoder = constructorParams.map((p) => {
if (p.type === "tuple[]") {
return utils.ParamType.from(p);
} else {
return p.type;
}
});
const encodedArgs = utils.defaultAbiCoder.encode(
constructorParamTypes,
paramTypesForEncoder,
paramValues,
);
@@ -212,18 +219,24 @@ export async function predictAddressDeterministic(
const create2Factory = await getCreate2FactoryAddress(provider);
// 2. Encode constructor params
const constructorParamTypes = extractConstructorParamsFromAbi(abi).map(
(p) => {
return p.type;
},
);
const constructorParams = extractConstructorParamsFromAbi(abi);
const constructorParamTypes = constructorParams.map((p) => {
return p.type;
});
const paramValues = convertParamValues(
constructorParamTypes,
constructorArgs,
);
const paramTypesForEncoder = constructorParams.map((p) => {
if (p.type === "tuple[]") {
return utils.ParamType.from(p);
} else {
return p.type;
}
});
const encodedArgs = utils.defaultAbiCoder.encode(
constructorParamTypes,
paramTypesForEncoder,
paramValues,
);
+103 -1
View File
@@ -1,6 +1,108 @@
import { ChainId } from "../constants/chains/ChainId";
import fetch from "cross-fetch";
import { BigNumber, utils } from "ethers";
import { BigNumber, utils, providers } from "ethers";
import { Mumbai, Polygon } from "@thirdweb-dev/chains";
import { isBrowser } from "./utils";
type FeeData = {
maxFeePerGas: null | BigNumber;
maxPriorityFeePerGas: null | BigNumber;
};
export async function getDefaultGasOverrides(provider: providers.Provider) {
// If we're running in the browser, let users configure gas price in their wallet UI
if (isBrowser()) {
return {};
}
// handle smart wallet provider
if ((provider as any).originalProvider) {
provider = (provider as any).originalProvider;
}
const feeData = await getDynamicFeeData(
provider as providers.JsonRpcProvider,
);
if (feeData.maxFeePerGas && feeData.maxPriorityFeePerGas) {
return {
maxFeePerGas: feeData.maxPriorityFeePerGas,
maxPriorityFeePerGas: feeData.maxPriorityFeePerGas,
};
} else {
return {
gasPrice: await getGasPrice(provider),
};
}
}
export async function getDynamicFeeData(
provider: providers.JsonRpcProvider,
): Promise<FeeData> {
let maxFeePerGas: null | BigNumber = null;
let maxPriorityFeePerGas: null | BigNumber = null;
const [chainId, block, eth_maxPriorityFeePerGas] = await Promise.all([
(await provider.getNetwork()).chainId,
await provider.getBlock("latest"),
await provider.send("eth_maxPriorityFeePerGas", []).catch(() => null),
]);
const baseBlockFee =
block && block.baseFeePerGas
? block.baseFeePerGas
: utils.parseUnits("100", "wei");
if (chainId === Mumbai.chainId || chainId === Polygon.chainId) {
// for polygon, get fee data from gas station
maxPriorityFeePerGas = await getPolygonGasPriorityFee(chainId);
console.log(
"DYNAMIC: polygon fee",
utils.formatUnits(maxPriorityFeePerGas, "gwei"),
);
} else if (eth_maxPriorityFeePerGas) {
// prioritize fee from eth_maxPriorityFeePerGas
maxPriorityFeePerGas = BigNumber.from(eth_maxPriorityFeePerGas);
} else {
// if eth_maxPriorityFeePerGas is not available, use 1.5 gwei default
const feeData = await provider.getFeeData();
maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;
if (!maxPriorityFeePerGas) {
// chain does not support eip-1559, return null for both
return { maxFeePerGas: null, maxPriorityFeePerGas: null };
}
}
// eip-1559 formula, with an extra 10% tip to account for gas volatility
maxFeePerGas = baseBlockFee
.mul(2)
.add(getPreferredPriorityFee(maxPriorityFeePerGas));
return { maxFeePerGas, maxPriorityFeePerGas };
}
function getPreferredPriorityFee(
defaultPriorityFeePerGas: BigNumber,
percentMultiplier: number = 10,
): BigNumber {
const extraTip = defaultPriorityFeePerGas.div(100).mul(percentMultiplier); // + 10%
const txGasPrice = defaultPriorityFeePerGas.add(extraTip);
return txGasPrice;
}
export async function getGasPrice(
provider: providers.Provider,
): Promise<BigNumber> {
const gasPrice = await provider.getGasPrice();
const maxGasPrice = utils.parseUnits("300", "gwei"); // 300 gwei
const extraTip = gasPrice.div(100).mul(10); // + 10%
const txGasPrice = gasPrice.add(extraTip);
if (txGasPrice.gt(maxGasPrice)) {
return maxGasPrice;
}
return txGasPrice;
}
/**
* @internal
+1 -4
View File
@@ -12,10 +12,7 @@ export * from "./addresses/getDefaultTrustedForwarders";
export * from "./chains/ChainId";
export * from "./chains/SUPPORTED_CHAIN_ID";
export * from "./chains/SUPPORTED_CHAIN_IDS";
export {
setSupportedChains,
getSupportedChains,
} from "./chains/supportedChains";
export * from "./chains/supportedChains";
export * from "./contract";
export * from "./currency";
+8 -1
View File
@@ -240,10 +240,17 @@ export function getProviderFromRpcUrl(
headers["authorization"] = `Bearer ${
(globalThis as any).TW_AUTH_TOKEN as string
}`;
headers["x-authorize-wallet"] = "true";
authStrategy = "twAuthToken";
}
if (
typeof globalThis !== "undefined" &&
"TW_CLI_AUTH_TOKEN" in globalThis &&
typeof (globalThis as any).TW_CLI_AUTH_TOKEN === "string"
) {
headers["x-authorize-wallet"] = "true";
}
const bundleId =
typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis
? ((globalThis as any).APP_BUNDLE_ID as string)
@@ -2,7 +2,7 @@ import { EventType } from "../../constants/events";
import type { ContractEvent, EventQueryOptions } from "../../types/events";
import { ContractWrapper } from "./contract-wrapper";
import type { BaseContract, Event, providers, utils } from "ethers";
import type { EventEmitter } from "eventemitter3";
import type EventEmitter from "eventemitter3";
/**
* Listen to Contract events in real time
@@ -27,14 +27,12 @@ import {
ForwardRequest,
getAndIncrementNonce,
} from "../../common/forwarder";
import { getPolygonGasPriorityFee } from "../../common/gas-price";
import { getDefaultGasOverrides } from "../../common/gas-price";
import { fetchContractMetadataFromAddress } from "../../common/metadata-resolver";
import { signEIP2612Permit } from "../../common/permit";
import { signTypedDataInternal } from "../../common/sign";
import { isBrowser } from "../../common/utils";
import { CONTRACT_ADDRESSES } from "../../constants/addresses/CONTRACT_ADDRESSES";
import { getContractAddressByChainId } from "../../constants/addresses/getContractAddressByChainId";
import { ChainId } from "../../constants/chains/ChainId";
import { EventType } from "../../constants/events";
import { AbiSchema, ContractSource } from "../../schema/contracts/custom";
import { SDKOptions } from "../../schema/sdk-options";
@@ -133,105 +131,7 @@ export class ContractWrapper<
* @internal
*/
public async getCallOverrides(): Promise<CallOverrides> {
if (isBrowser()) {
// When running in the browser, let the wallet suggest gas estimates
// this means that the gas speed preferences set in the SDK options are ignored in a browser context
// but it also allows users to select their own gas speed prefs per tx from their wallet directly
return {};
}
const feeData = await this.getProvider().getFeeData();
const supports1559 = feeData.maxFeePerGas && feeData.maxPriorityFeePerGas;
if (supports1559) {
const chainId = await this.getChainID();
const block = await this.getProvider().getBlock("latest");
const baseBlockFee =
block && block.baseFeePerGas
? block.baseFeePerGas
: utils.parseUnits("1", "gwei");
let defaultPriorityFee: BigNumber;
if (chainId === ChainId.Mumbai || chainId === ChainId.Polygon) {
// for polygon, get fee data from gas station
defaultPriorityFee = await getPolygonGasPriorityFee(chainId);
} else {
// otherwise get it from ethers
defaultPriorityFee = BigNumber.from(feeData.maxPriorityFeePerGas);
}
// then add additional fee based on user preferences
const maxPriorityFeePerGas =
this.getPreferredPriorityFee(defaultPriorityFee);
// See: https://eips.ethereum.org/EIPS/eip-1559 for formula
const baseMaxFeePerGas = baseBlockFee.mul(2);
const maxFeePerGas = baseMaxFeePerGas.add(maxPriorityFeePerGas);
return {
maxFeePerGas,
maxPriorityFeePerGas,
};
} else {
return {
gasPrice: await this.getPreferredGasPrice(),
};
}
}
/**
* Calculates the priority fee per gas according to user preferences
* @param defaultPriorityFeePerGas - the base priority fee
*/
private getPreferredPriorityFee(
defaultPriorityFeePerGas: BigNumber,
): BigNumber {
const speed = this.options.gasSettings.speed;
const maxGasPrice = this.options.gasSettings.maxPriceInGwei;
let extraTip;
switch (speed) {
case "standard":
extraTip = BigNumber.from(0); // default is 2.5 gwei for ETH, 31 gwei for polygon
break;
case "fast":
extraTip = defaultPriorityFeePerGas.div(100).mul(5); // + 5% - 2.625 gwei / 32.5 gwei
break;
case "fastest":
extraTip = defaultPriorityFeePerGas.div(100).mul(10); // + 10% - 2.75 gwei / 34.1 gwei
break;
}
let txGasPrice = defaultPriorityFeePerGas.add(extraTip);
const max = utils.parseUnits(maxGasPrice.toString(), "gwei"); // no more than max gas setting
const min = utils.parseUnits("2.5", "gwei"); // no less than 2.5 gwei
if (txGasPrice.gt(max)) {
txGasPrice = max;
}
if (txGasPrice.lt(min)) {
txGasPrice = min;
}
return txGasPrice;
}
/**
* Calculates the gas price for transactions according to user preferences
*/
public async getPreferredGasPrice(): Promise<BigNumber> {
const gasPrice = await this.getProvider().getGasPrice();
const speed = this.options.gasSettings.speed;
const maxGasPrice = this.options.gasSettings.maxPriceInGwei;
let txGasPrice = gasPrice;
let extraTip;
switch (speed) {
case "standard":
extraTip = BigNumber.from(1); // min 1 wei
break;
case "fast":
extraTip = gasPrice.div(100).mul(5); // + 5%
break;
case "fastest":
extraTip = gasPrice.div(100).mul(10); // + 10%
break;
}
txGasPrice = txGasPrice.add(extraTip);
const max = utils.parseUnits(maxGasPrice.toString(), "gwei");
if (txGasPrice.gt(max)) {
txGasPrice = max;
}
return txGasPrice;
return getDefaultGasOverrides(this.getProvider());
}
/**
+1 -1
View File
@@ -38,7 +38,7 @@ import {
type ContractInterface,
utils,
} from "ethers";
import { EventEmitter } from "eventemitter3";
import EventEmitter from "eventemitter3";
import invariant from "tiny-invariant";
import { z } from "zod";
import { getApprovedImplementation } from "../../constants/addresses/getApprovedImplementation";
@@ -35,7 +35,7 @@ export class GasCostEstimator<TContract extends BaseContract> {
fn: keyof TContract["functions"] | (string & {}),
args: Parameters<TContract["functions"][typeof fn]> | any[],
): Promise<string> {
const price = await this.contractWrapper.getPreferredGasPrice();
const price = await this.contractWrapper.getProvider().getGasPrice();
const gasUnits = await this.contractWrapper.estimateGas(fn, args);
return utils.formatEther(gasUnits.mul(price));
}
@@ -1,10 +1,8 @@
import { TransactionError, parseRevertReason } from "../../common/error";
import { getPolygonGasPriorityFee } from "../../common/gas-price";
import { getDefaultGasOverrides, getGasPrice } from "../../common/gas-price";
import { fetchContractMetadataFromAddress } from "../../common/metadata-resolver";
import { fetchSourceFilesFromMetadata } from "../../common/fetchSourceFilesFromMetadata";
import { isRouterContract } from "../../common/plugin/isRouterContract";
import { isBrowser } from "../../common/utils";
import { ChainId } from "../../constants/chains/ChainId";
import { ContractSource } from "../../schema/contracts/custom";
import { SDKOptionsOutput } from "../../schema/sdk-options";
import type {
@@ -205,16 +203,7 @@ abstract class TransactionContext {
* Calculates the gas price for transactions (adding a 10% tip buffer)
*/
public async getGasPrice(): Promise<BigNumber> {
const gasPrice = await this.provider.getGasPrice();
const maxGasPrice = utils.parseUnits("300", "gwei"); // 300 gwei
const extraTip = gasPrice.div(100).mul(10); // + 10%
const txGasPrice = gasPrice.add(extraTip);
if (txGasPrice.gt(maxGasPrice)) {
return maxGasPrice;
}
return txGasPrice;
return getGasPrice(this.provider);
}
/**
@@ -228,43 +217,7 @@ abstract class TransactionContext {
* Get gas overrides for the transaction
*/
protected async getGasOverrides() {
// If we're running in the browser, let users configure gas price in their wallet UI
if (isBrowser()) {
return {};
}
const feeData = await this.provider.getFeeData();
const supports1559 = feeData.maxFeePerGas && feeData.maxPriorityFeePerGas;
if (supports1559) {
const chainId = (await this.provider.getNetwork()).chainId;
const block = await this.provider.getBlock("latest");
const baseBlockFee =
block && block.baseFeePerGas
? block.baseFeePerGas
: utils.parseUnits("1", "gwei");
let defaultPriorityFee: BigNumber;
if (chainId === ChainId.Mumbai || chainId === ChainId.Polygon) {
// for polygon, get fee data from gas station
defaultPriorityFee = await getPolygonGasPriorityFee(chainId);
} else {
// otherwise get it from ethers
defaultPriorityFee = BigNumber.from(feeData.maxPriorityFeePerGas);
}
// then add additional fee based on user preferences
const maxPriorityFeePerGas =
this.getPreferredPriorityFee(defaultPriorityFee);
// See: https://eips.ethereum.org/EIPS/eip-1559 for formula
const baseMaxFeePerGas = baseBlockFee.mul(2);
const maxFeePerGas = baseMaxFeePerGas.add(maxPriorityFeePerGas);
return {
maxFeePerGas,
maxPriorityFeePerGas,
};
} else {
return {
gasPrice: await this.getGasPrice(),
};
}
return getDefaultGasOverrides(this.provider);
}
/**
@@ -275,16 +228,6 @@ abstract class TransactionContext {
): BigNumber {
const extraTip = defaultPriorityFeePerGas.div(100).mul(10); // + 10%
const txGasPrice = defaultPriorityFeePerGas.add(extraTip);
const maxGasPrice = utils.parseUnits("300", "gwei"); // no more than 300 gwei
const minGasPrice = utils.parseUnits("2.5", "gwei"); // no less than 2.5 gwei
if (txGasPrice.gt(maxGasPrice)) {
return maxGasPrice;
}
if (txGasPrice.lt(minGasPrice)) {
return minGasPrice;
}
return txGasPrice;
}
}
+1 -1
View File
@@ -103,7 +103,7 @@ import {
utils,
ContractFactory as ethersContractFactory,
} from "ethers";
import { EventEmitter } from "eventemitter3";
import EventEmitter from "eventemitter3";
import invariant from "tiny-invariant";
import { z } from "zod";
import {
+2 -1
View File
@@ -1,4 +1,5 @@
/* eslint-disable no-var */
declare module globalThis {
// eslint-disable-next-line no-var
var TW_AUTH_TOKEN: string;
var TW_CLI_AUTH_TOKEN: string;
}
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/service-utils
## 0.4.4
### Patch Changes
- [#1566](https://github.com/thirdweb-dev/js/pull/1566) [`d378106a`](https://github.com/thirdweb-dev/js/commit/d378106a852f941779bb72ac1841bddf34fc15a6) Thanks [@ElasticBottle](https://github.com/ElasticBottle)! - docs(service-utils): Add documentation for authorizeNode for node auth function
- [#1569](https://github.com/thirdweb-dev/js/pull/1569) [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b) Thanks [@Marfuen](https://github.com/Marfuen)! - Use a different globalThis for CLI related flow.
- [#1559](https://github.com/thirdweb-dev/js/pull/1559) [`13ef6a50`](https://github.com/thirdweb-dev/js/commit/13ef6a50cf10b442b2b54b780e42210cab2db762) Thanks [@assimovt](https://github.com/assimovt)! - expose account status in api key metadata
## 0.4.3
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/service-utils",
"version": "0.4.3",
"version": "0.4.4",
"main": "dist/thirdweb-dev-service-utils.cjs.js",
"module": "dist/thirdweb-dev-service-utils.esm.js",
"exports": {
+18 -5
View File
@@ -1,5 +1,6 @@
import type { ServiceName } from "./services";
export type CoreServiceConfig = {
enforceAuth: boolean;
apiUrl: string;
@@ -13,6 +14,8 @@ export type ApiKeyMetadata = {
id: string;
key: string;
accountId: string;
accountStatus: "noCustomer" | "noPayment" | "validPayment" | "invalidPayment";
accountPlan: "free" | "enterprise";
creatorWalletAddress: string;
secretHash: string;
walletAddresses: string[];
@@ -62,11 +65,15 @@ export async function fetchKeyMetadataFromApi(
"content-type": "application/json",
},
});
let json: ApiResponse
let json: ApiResponse;
try {
json = await response.json();
} catch (e) {
throw new Error(`Error fetching key metadata from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
throw new Error(
`Error fetching key metadata from API: ${response.status} - ${
response.statusText
} - ${await response.text()}`,
);
}
return json;
}
@@ -77,7 +84,9 @@ export async function fetchAccountFromApi(
useWalletAuth: boolean,
): Promise<ApiAccountResponse> {
const { apiUrl, serviceApiKey } = config;
const url = useWalletAuth ? `${apiUrl}/v1/wallet/me` : `${apiUrl}/v1/account/me`
const url = useWalletAuth
? `${apiUrl}/v1/wallet/me`
: `${apiUrl}/v1/account/me`;
const response = await fetch(url, {
method: "GET",
headers: {
@@ -86,11 +95,15 @@ export async function fetchAccountFromApi(
authorization: `Bearer ${jwt}`,
},
});
let json: ApiAccountResponse
let json: ApiAccountResponse;
try {
json = await response.json();
} catch (e) {
throw new Error(`Error fetching account from API: ${response.status} - ${response.statusText} - ${await response.text()}`);
throw new Error(
`Error fetching account from API: ${response.status} - ${
response.statusText
} - ${await response.text()}`,
);
}
return json;
}
@@ -12,6 +12,8 @@ describe("authorizeClient", () => {
bundleIds: ["com.example.app"],
services: [],
accountId: "test-account-id",
accountStatus: "noCustomer",
accountPlan: "free",
};
const validAuthOptions: ClientAuthorizationPayload = {
@@ -11,6 +11,8 @@ describe("authorizeService", () => {
domains: [],
bundleIds: [],
accountId: "test-account-id",
accountStatus: "noCustomer",
accountPlan: "free",
services: [
{
name: "storage",
+19 -2
View File
@@ -1,12 +1,12 @@
import { createHash } from "node:crypto";
import { authorize } from "../core/authorize";
import type { ServerResponse } from "http";
import type { IncomingHttpHeaders, IncomingMessage } from "node:http";
import type { AuthorizationInput } from "../core/authorize";
import type { CoreServiceConfig } from "../core/api";
import type { AuthorizationInput } from "../core/authorize";
import type { AuthorizationResult } from "../core/authorize/types";
import type { CoreAuthInput } from "../core/types";
import type { ServerResponse } from "http";
export * from "../core/services";
@@ -16,6 +16,23 @@ export type AuthInput = CoreAuthInput & {
req: IncomingMessage;
};
/**
*
* @param {AuthInput['req']} authInput.req - The incoming request from which information will be pulled from. These information includes (checks are in order and terminates on first match):
* - clientId: Checks header `x-client-id`, search param `clientId`
* - bundleId: Checks header `x-bundle-id`, search param `bundleId`
* - secretKey: Checks header `x-secret-key`
* - origin (the requesting domain): Checks header `origin`, `referer`
* @param {AuthInput['clientId']} authInput.clientId - Overrides any clientId found on the `req` object
* @param {AuthInput['targetAddress']} authInput.targetAddress - Only used in smart wallets to determine if the request is authorized to interact with the target address.
* @param {NodeServiceConfig['enforceAuth']} serviceConfig - Always `true` unless you need to turn auth off. Tells the service whether or not to enforce auth.
* @param {NodeServiceConfig['apiUrl']} serviceConfig.apiUrl - The url of the api server to fetch information for verification. `https://api.thirdweb.com` for production and `https://api.staging.thirdweb.com` for staging
* @param {NodeServiceConfig['serviceApiKey']} serviceConfig.serviceApiKey - secret key to be used authenticate the caller of the api-server. Check the api-server's env variable for the keys.
* @param {NodeServiceConfig['serviceScope']} serviceConfig.serviceScope - The service that we are requesting authorization for. E.g. `relayer`, `rpc`, 'bundler', 'storage' etc.
* @param {NodeServiceConfig['serviceAction']} serviceConfig.serviceAction - Needed when the `serviceScope` is `storage`. Can be either `read` or `write`.
* @param {NodeServiceConfig['useWalletAuth']} serviceConfig.useWalletAuth - If true it pings the `wallet/me` or else, `account/me`. You most likely can leave this as false.
* @returns {AuthorizationResult} authorizationResult - contains if the request is authorized, and information about the account if it is authorized. Otherwise, it contains the error message and status code.
*/
export async function authorizeNode(
authInput: AuthInput,
serviceConfig: NodeServiceConfig,
+10
View File
@@ -1,5 +1,15 @@
# @thirdweb-dev/storage
## 1.2.10
### Patch Changes
- [#1565](https://github.com/thirdweb-dev/js/pull/1565) [`3eb9592e`](https://github.com/thirdweb-dev/js/commit/3eb9592e10154e06d2fa5effbc0c1a483f62498f) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - [Storage] Up default download timeout to 60s + expose option to override
- [#1564](https://github.com/thirdweb-dev/js/pull/1564) [`066b9cfa`](https://github.com/thirdweb-dev/js/commit/066b9cfa09df2531c9e5440477a24edc1374e0e0) Thanks [@nessup](https://github.com/nessup)! - Improve IPFS upload error logging in Node
- [#1569](https://github.com/thirdweb-dev/js/pull/1569) [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b) Thanks [@Marfuen](https://github.com/Marfuen)! - Use a different globalThis for CLI related flow.
## 1.2.9
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/storage",
"version": "1.2.9",
"version": "1.2.10",
"main": "dist/thirdweb-dev-storage.cjs.js",
"module": "dist/thirdweb-dev-storage.esm.js",
"browser": {
@@ -29,15 +29,18 @@ import pkg from "../../../package.json";
* @public
*/
export class StorageDownloader implements IStorageDownloader {
DEFAULT_TIMEOUT_IN_SECONDS = 30;
DEFAULT_TIMEOUT_IN_SECONDS = 60;
DEFAULT_MAX_RETRIES = 3;
private secretKey?: string;
private clientId?: string;
private defaultTimeout: number;
constructor(options: IpfsDownloaderOptions) {
this.secretKey = options.secretKey;
this.clientId = options.clientId;
this.defaultTimeout =
options.timeoutInSeconds || this.DEFAULT_TIMEOUT_IN_SECONDS;
}
async download(
@@ -105,17 +108,28 @@ export class StorageDownloader implements IStorageDownloader {
headers = {
...headers,
authorization: `Bearer ${(globalThis as any).TW_AUTH_TOKEN as string}`,
"x-authorize-wallet": 'true',
};
}
if (
typeof globalThis !== "undefined" &&
"TW_CLI_AUTH_TOKEN" in globalThis &&
typeof (globalThis as any).TW_CLI_AUTH_TOKEN === "string"
) {
headers = {
...headers,
authorization: `Bearer ${(globalThis as any).TW_CLI_AUTH_TOKEN as string}`,
};
headers["x-authorize-wallet"] = "true";
}
headers["x-sdk-version"] = pkg.version;
headers["x-sdk-name"] = pkg.name;
headers["x-sdk-platform"] = bundleId
? "react-native"
: isBrowser()
? "browser"
: "node";
? "browser"
: "node";
}
if (isTooManyRequests(resolvedUri)) {
@@ -124,8 +138,7 @@ export class StorageDownloader implements IStorageDownloader {
}
const controller = new AbortController();
const timeoutInSeconds =
options?.timeoutInSeconds || this.DEFAULT_TIMEOUT_IN_SECONDS;
const timeoutInSeconds = options?.timeoutInSeconds || this.defaultTimeout;
const timeout = setTimeout(
() => controller.abort(),
timeoutInSeconds * 1000,
@@ -142,10 +155,9 @@ export class StorageDownloader implements IStorageDownloader {
if (!("status" in resOrErr)) {
// early exit if we don't have a status code
throw new Error(
`Request timed out after ${timeoutInSeconds} seconds. ${
isTwGatewayUrl(resolvedUri)
? "You can update the timeoutInSeconds option to increase the timeout."
: "You're using a public IPFS gateway, pass in a clientId or secretKey for a reliable IPFS gateway."
`Request timed out after ${timeoutInSeconds} seconds. ${isTwGatewayUrl(resolvedUri)
? "You can update the timeoutInSeconds option to increase the timeout."
: "You're using a public IPFS gateway, pass in a clientId or secretKey for a reliable IPFS gateway."
}`,
);
}
@@ -289,7 +289,7 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
bundleId ? "react-native" : isBrowser() ? "browser" : "node",
);
// if we have a authorization token on global context then add that to the headers
// if we have a authorization token on global context then add that to the headers, this is for the dashboard.
if (
typeof globalThis !== "undefined" &&
"TW_AUTH_TOKEN" in globalThis &&
@@ -299,6 +299,18 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
"authorization",
`Bearer ${(globalThis as any).TW_AUTH_TOKEN as string}`,
);
}
// CLI auth token
if (
typeof globalThis !== "undefined" &&
"TW_CLI_AUTH_TOKEN" in globalThis &&
typeof (globalThis as any).TW_CLI_AUTH_TOKEN === "string"
) {
xhr.setRequestHeader(
"authorization",
`Bearer ${(globalThis as any).TW_CLI_AUTH_TOKEN as string}`,
);
xhr.setRequestHeader(
"x-authorize-wallet",
`true`,
@@ -331,7 +343,7 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
headers["x-bundle-id"] = (globalThis as any).APP_BUNDLE_ID as string;
}
// if we have a authorization token on global context then add that to the headers
// if we have a authorization token on global context then add that to the headers, this is for the dashboard.
if (
typeof globalThis !== "undefined" &&
"TW_AUTH_TOKEN" in globalThis &&
@@ -339,6 +351,16 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
) {
headers["authorization"] = `Bearer ${(globalThis as any).TW_AUTH_TOKEN as string
}`;
}
// CLI auth token
if (
typeof globalThis !== "undefined" &&
"TW_CLI_AUTH_TOKEN" in globalThis &&
typeof (globalThis as any).TW_CLI_AUTH_TOKEN === "string"
) {
headers["authorization"] = `Bearer ${(globalThis as any).TW_CLI_AUTH_TOKEN as string
}`;
headers["x-authorize-wallet"] = "true";
}
@@ -357,14 +379,14 @@ export class IpfsUploader implements IStorageUploader<IpfsUploadBatchOptions> {
"Unauthorized - You don't have permission to use this service.",
);
}
throw new Error("Failed to upload files to IPFS");
throw new Error(`Failed to upload files to IPFS - ${res.status} - ${res.statusText} - ${await res.text()}`);
}
const body = await res.json();
const cid = body.IpfsHash;
if (!cid) {
throw new Error("Failed to upload files to IPFS");
throw new Error("Failed to upload files to IPFS - Bad CID");
}
if (options?.uploadWithoutDirectory) {
+4
View File
@@ -31,6 +31,10 @@ export type IpfsDownloaderOptions = {
* You can get a clientId here: https://thirdweb.com/create-api-key
*/
clientId?: string;
/**
* Optional timeout in seconds for the download request, overrides the default timeout
*/
timeoutInSeconds?: number;
};
export type SingleDownloadOptions = {
+2 -1
View File
@@ -1,4 +1,5 @@
/* eslint-disable no-var */
declare module globalThis {
// eslint-disable-next-line no-var
var TW_AUTH_TOKEN: string;
var TW_CLI_AUTH_TOKEN: string;
}
+20
View File
@@ -1,5 +1,25 @@
# @thirdweb-dev/unity-js-bridge
## 0.2.77
### Patch Changes
- Updated dependencies [[`3eb9592e`](https://github.com/thirdweb-dev/js/commit/3eb9592e10154e06d2fa5effbc0c1a483f62498f), [`066b9cfa`](https://github.com/thirdweb-dev/js/commit/066b9cfa09df2531c9e5440477a24edc1374e0e0), [`a00cbaf7`](https://github.com/thirdweb-dev/js/commit/a00cbaf78c05ea43d3814ba9f9ec8e667f0ddb25), [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40), [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/storage@1.2.10
- @thirdweb-dev/sdk@3.10.59
- @thirdweb-dev/wallets@1.1.23
- @thirdweb-dev/auth@3.2.40
## 0.2.76
### Patch Changes
- Updated dependencies [[`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005), [`e00dd123`](https://github.com/thirdweb-dev/js/commit/e00dd123579f75752b6fe4fcf613d2cae5419e19)]:
- @thirdweb-dev/chains@0.1.50
- @thirdweb-dev/sdk@3.10.58
- @thirdweb-dev/wallets@1.1.22
- @thirdweb-dev/auth@3.2.39
## 0.2.75
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/unity-js-bridge",
"version": "0.2.75",
"version": "0.2.77",
"main": "dist/thirdweb-unity-bridge.js",
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
"license": "Apache-2.0",
+13
View File
@@ -4,5 +4,18 @@ module.exports = {
plugins: ["better-tree-shaking"],
rules: {
"better-tree-shaking/no-top-level-side-effects": "error",
"no-restricted-imports": [
"error",
{
paths: [
{
name: "eventemitter3",
importNames: ["EventEmitter"],
message:
"Do not use named import for importing EventEmitter, Use default import instead.",
},
],
},
],
},
};
+21
View File
@@ -1,5 +1,26 @@
# @thirdweb-dev/wallets
## 1.1.23
### Patch Changes
- [#1568](https://github.com/thirdweb-dev/js/pull/1568) [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Better fee calculations for OP stack
- [#1572](https://github.com/thirdweb-dev/js/pull/1572) [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Dynamic gas fee estimations
- [#1569](https://github.com/thirdweb-dev/js/pull/1569) [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b) Thanks [@Marfuen](https://github.com/Marfuen)! - Use a different globalThis for CLI related flow.
- Updated dependencies [[`a00cbaf7`](https://github.com/thirdweb-dev/js/commit/a00cbaf78c05ea43d3814ba9f9ec8e667f0ddb25), [`a023cb8c`](https://github.com/thirdweb-dev/js/commit/a023cb8cf1e4f08be56a2e33c146c8d307c80f40), [`2088de1c`](https://github.com/thirdweb-dev/js/commit/2088de1cacbc903d4f18a84c21a8f27af8d06b29), [`1e6f9dcc`](https://github.com/thirdweb-dev/js/commit/1e6f9dcc04022c6a8a39d490123a3e22e52b5e0b)]:
- @thirdweb-dev/sdk@3.10.59
## 1.1.22
### Patch Changes
- Updated dependencies [[`926dd7b0`](https://github.com/thirdweb-dev/js/commit/926dd7b03f38ed25ca303dc23d3323d5edd28005), [`e00dd123`](https://github.com/thirdweb-dev/js/commit/e00dd123579f75752b6fe4fcf613d2cae5419e19)]:
- @thirdweb-dev/chains@0.1.50
- @thirdweb-dev/sdk@3.10.58
## 1.1.21
### Patch Changes
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@thirdweb-dev/wallets",
"version": "1.1.21",
"version": "1.1.23",
"main": "dist/thirdweb-dev-wallets.cjs.js",
"module": "dist/thirdweb-dev-wallets.esm.js",
"types": "dist/thirdweb-dev-wallets.cjs.d.ts",
@@ -1,4 +1,5 @@
/* eslint-disable no-var */
declare module globalThis {
// eslint-disable-next-line no-var
var TW_AUTH_TOKEN: string;
var TW_CLI_AUTH_TOKEN: string;
}
@@ -18,10 +18,8 @@ import {
CeloAlfajoresTestnet,
CeloBaklavaTestnet,
Celo,
Mumbai,
Polygon,
} from "@thirdweb-dev/chains";
import { getPolygonGasPriorityFee } from "@thirdweb-dev/sdk";
import { getDynamicFeeData } from "@thirdweb-dev/sdk";
export interface BaseApiParams {
provider: providers.Provider;
@@ -293,7 +291,9 @@ export abstract class BaseAccountAPI {
let { maxFeePerGas, maxPriorityFeePerGas } = info;
if (!maxFeePerGas || !maxPriorityFeePerGas) {
const feeData = await this.provider.getFeeData();
const feeData = await getDynamicFeeData(
this.provider as providers.JsonRpcProvider,
);
if (!maxPriorityFeePerGas) {
maxPriorityFeePerGas = feeData.maxPriorityFeePerGas ?? undefined;
}
@@ -309,22 +309,6 @@ export abstract class BaseAccountAPI {
) {
maxPriorityFeePerGas = maxFeePerGas;
}
if (
maxPriorityFeePerGas &&
(chainId === Mumbai.chainId || chainId === Polygon.chainId)
) {
// for polygon/mumbai, override fee data from gas station
const block = await this.provider.getBlock("latest");
const baseBlockFee =
block && block.baseFeePerGas
? block.baseFeePerGas
: utils.parseUnits("1", "gwei");
maxPriorityFeePerGas = await getPolygonGasPriorityFee(chainId);
// See: https://eips.ethereum.org/EIPS/eip-1559 for formula
const baseMaxFeePerGas = baseBlockFee.mul(2);
maxFeePerGas = baseMaxFeePerGas.add(maxPriorityFeePerGas);
}
}
}
@@ -46,6 +46,7 @@ export class HttpRpcClient {
}
}
// Dashboard token
if (
typeof globalThis !== "undefined" &&
"TW_AUTH_TOKEN" in globalThis &&
@@ -54,6 +55,17 @@ export class HttpRpcClient {
headers["authorization"] = `Bearer ${
(globalThis as any).TW_AUTH_TOKEN as string
}`;
}
// CLI token
if (
typeof globalThis !== "undefined" &&
"TW_CLI_AUTH_TOKEN" in globalThis &&
typeof (globalThis as any).TW_CLI_AUTH_TOKEN === "string"
) {
headers["authorization"] = `Bearer ${
(globalThis as any).TW_CLI_AUTH_TOKEN as string
}`;
headers["x-authorize-wallet"] = "true";
}
@@ -52,12 +52,23 @@ class VerifyingPaymasterAPI extends PaymasterAPI {
headers["x-bundle-id"] = (globalThis as any).APP_BUNDLE_ID as string;
}
}
// Dashboard token.
if (
typeof globalThis !== "undefined" &&
"TW_AUTH_TOKEN" in globalThis &&
typeof (globalThis as any).TW_AUTH_TOKEN === "string"
) {
headers["authorization"] = `Bearer ${(globalThis as any).TW_AUTH_TOKEN as string}`;
}
// CLI token.
if (
typeof globalThis !== "undefined" &&
"TW_CLI_AUTH_TOKEN" in globalThis &&
typeof (globalThis as any).TW_CLI_AUTH_TOKEN === "string"
) {
headers["authorization"] = `Bearer ${(globalThis as any).TW_CLI_AUTH_TOKEN as string}`;
headers["x-authorize-wallet"] = "true";
}
}