Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b052d63e9 | ||
|
|
a3f6878649 | ||
|
|
74a92dcb7d | ||
|
|
38fc0b796a | ||
|
|
ef76a96c2d | ||
|
|
2667706d8d | ||
|
|
047fbe2918 | ||
|
|
af01c63b45 | ||
|
|
3796204372 | ||
|
|
9c7fbc1603 | ||
|
|
156950423b | ||
|
|
f80f6307a3 | ||
|
|
5f243bba0d | ||
|
|
7d8697ec3f | ||
|
|
ab44b8f0ae | ||
|
|
ad135b67b9 |
@@ -1,5 +1,19 @@
|
||||
# @thirdweb-dev/auth
|
||||
|
||||
## 4.1.37
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`74a92dc`](https://github.com/thirdweb-dev/js/commit/74a92dcb7dc4be7d03bcb8b7211e87016f52a81f)]:
|
||||
- @thirdweb-dev/wallets@2.4.15
|
||||
|
||||
## 4.1.36
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022), [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f)]:
|
||||
- @thirdweb-dev/wallets@2.4.14
|
||||
|
||||
## 4.1.35
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/auth",
|
||||
"version": "4.1.35",
|
||||
"version": "4.1.37",
|
||||
"main": "dist/thirdweb-dev-auth.cjs.js",
|
||||
"module": "dist/thirdweb-dev-auth.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
# @thirdweb-dev/chains
|
||||
|
||||
## 0.1.77
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2406](https://github.com/thirdweb-dev/js/pull/2406) [`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
|
||||
|
||||
## 0.1.76
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2378](https://github.com/thirdweb-dev/js/pull/2378) [`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af) Thanks [@github-actions](https://github.com/apps/github-actions)! - Synced Chains Package
|
||||
|
||||
## 0.1.75
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -24,11 +24,10 @@ export default {
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://1001.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://klaytn-baobab.blockpi.network/v1/rpc/public",
|
||||
"https://api.baobab.klaytn.net:8651"
|
||||
],
|
||||
"shortName": "Baobab",
|
||||
"slip44": 1,
|
||||
"slug": "klaytn-testnet-baobab",
|
||||
"testnet": false
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 11198,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QI0304I2 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QI0304I2 Testnet Token",
|
||||
"symbol": "LOD",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 11198,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://11198.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI0304I2 Testnet",
|
||||
"slug": "qi0304i2-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 11516,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "Tenzro",
|
||||
"nativeCurrency": {
|
||||
"name": "Tenzro Token",
|
||||
"symbol": "TNZO",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 11516,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://11516.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/tenzro/testnet/rpc"
|
||||
],
|
||||
"shortName": "Tenzro",
|
||||
"slug": "tenzro",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 1614,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QI0305I1 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QI0305I1 Testnet Token",
|
||||
"symbol": "PDC",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 1614,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://1614.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI0305I1 Testnet",
|
||||
"slug": "qi0305i1-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 18898,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QaUser4 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QaUser4 Testnet Token",
|
||||
"symbol": "NLD",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 18898,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://18898.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QaUser4 Testnet",
|
||||
"slug": "qauser4-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "FFG",
|
||||
"chainId": 191,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://bafkreihsas2rwakc7lllmtb4pcgwutlel2woibmqmhd4aiin342zgtpmwy",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://filefilego.com",
|
||||
"name": "FileFileGo",
|
||||
"nativeCurrency": {
|
||||
"name": "FFG",
|
||||
"symbol": "FFG",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 191,
|
||||
"rpc": [
|
||||
"https://191.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.filefilego.com/rpc"
|
||||
],
|
||||
"shortName": "ffg",
|
||||
"slug": "filefilego",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 19112,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QI0304s1 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QI0304s1 Testnet Token",
|
||||
"symbol": "LKG",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 19112,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://19112.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI0304s1 Testnet",
|
||||
"slug": "qi0304s1-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,48 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "DEEPL",
|
||||
"chainId": 222555,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "DeepL Mainnet Explorer",
|
||||
"url": "https://scan.deeplnetwork.org",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeihjwgy4qja5cee452malk5hpb25pzpipfaka7hjcyb437ldodxzaq",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeihjwgy4qja5cee452malk5hpb25pzpipfaka7hjcyb437ldodxzaq",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://deeplnetwork.org",
|
||||
"name": "DeepL Mainnet",
|
||||
"nativeCurrency": {
|
||||
"name": "DeepL",
|
||||
"symbol": "DEEPL",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 222555,
|
||||
"rpc": [
|
||||
"https://222555.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.deeplnetwork.org"
|
||||
],
|
||||
"shortName": "deepl",
|
||||
"slug": "deepl",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,50 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "DEEPL",
|
||||
"chainId": 222666,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "DeepL Testnet Explorer",
|
||||
"url": "https://testnet-scan.deeplnetwork.org",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeihjwgy4qja5cee452malk5hpb25pzpipfaka7hjcyb437ldodxzaq",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.deeplnetwork.org"
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeihjwgy4qja5cee452malk5hpb25pzpipfaka7hjcyb437ldodxzaq",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://deeplnetwork.org",
|
||||
"name": "DeepL Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "DeepL",
|
||||
"symbol": "DEEPL",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 222666,
|
||||
"rpc": [
|
||||
"https://222666.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://testnet.deeplnetwork.org"
|
||||
],
|
||||
"shortName": "tdeepl",
|
||||
"slug": "deepl-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "inEVM",
|
||||
"chainId": 2525,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmU9KU1qgReJR7vyVxN5zwWB3nkhSs658ViArUjT7GCh4r",
|
||||
"width": 2000,
|
||||
"height": 2000,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://inevm.com",
|
||||
"name": "inEVM Mainnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Injective",
|
||||
"symbol": "INJ",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 2525,
|
||||
"rpc": [
|
||||
"https://2525.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://mainnet.rpc.inevm.com/http"
|
||||
],
|
||||
"shortName": "inevm",
|
||||
"slug": "inevm",
|
||||
"status": "active",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -16,6 +16,7 @@ export default {
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmRkhUD6J3B9WhT4hEWLrcFVTrBhx3CQgNC783aJsrwxSN",
|
||||
"width": 512,
|
||||
@@ -39,6 +40,7 @@ export default {
|
||||
}
|
||||
]
|
||||
},
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://280.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://testnet.era.zksync.dev"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 28106,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "Mezzanine Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Mezzanine Testnet Token",
|
||||
"symbol": "OWQ",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 28106,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://28106.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/mezzaninet/testnet/rpc"
|
||||
],
|
||||
"shortName": "Mezzanine Testnet",
|
||||
"slug": "mezzanine-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -10,6 +10,7 @@ export default {
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"infoURL": "https://community.optimism.io/docs/developers/bedrock",
|
||||
"name": "Optimism Bedrock (Goerli Alpha Testnet)",
|
||||
"nativeCurrency": {
|
||||
@@ -18,15 +19,16 @@ export default {
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 28528,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://28528.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://alpha-1-replica-0.bedrock-goerli.optimism.io",
|
||||
"https://alpha-1-replica-1.bedrock-goerli.optimism.io",
|
||||
"https://alpha-1-replica-2.bedrock-goerli.optimism.io",
|
||||
"https://alpha-1-replica-2.bedrock-goerli.optimism.io"
|
||||
],
|
||||
"shortName": "obgor",
|
||||
"slip44": 1,
|
||||
"slug": "optimism-bedrock-goerli-alpha-testnet",
|
||||
"status": "deprecated",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -10,6 +10,7 @@ export default {
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"infoURL": "https://boba.network",
|
||||
"name": "Boba Network Goerli Testnet",
|
||||
"nativeCurrency": {
|
||||
@@ -27,6 +28,7 @@ export default {
|
||||
}
|
||||
]
|
||||
},
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://2888.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://goerli.boba.network/",
|
||||
@@ -35,5 +37,6 @@ export default {
|
||||
"shortName": "BobaGoerli",
|
||||
"slip44": 1,
|
||||
"slug": "boba-network-goerli-testnet",
|
||||
"status": "deprecated",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -5,7 +5,7 @@ export default {
|
||||
"explorers": [
|
||||
{
|
||||
"name": "explorer-thebifrost",
|
||||
"url": "https://explorer.mainnet.thebifrost.io",
|
||||
"url": "https://explorer.mainnet.bifrostnetwork.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
@@ -16,7 +16,7 @@ export default {
|
||||
"height": 480,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://thebifrost.io",
|
||||
"infoURL": "https://bifrostnetwork.com",
|
||||
"name": "Bifrost Mainnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Bifrost",
|
||||
@@ -26,8 +26,8 @@ export default {
|
||||
"networkId": 3068,
|
||||
"rpc": [
|
||||
"https://3068.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://public-01.mainnet.thebifrost.io/rpc",
|
||||
"https://public-02.mainnet.thebifrost.io/rpc"
|
||||
"https://public-01.mainnet.bifrostnetwork.com/rpc",
|
||||
"https://public-02.mainnet.bifrostnetwork.com/rpc"
|
||||
],
|
||||
"shortName": "bfc",
|
||||
"slug": "bifrost",
|
||||
|
||||
@@ -4,8 +4,8 @@ export default {
|
||||
"chainId": 3776,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "blockscout",
|
||||
"url": "https://astar-zkevm.explorer.startale.com/",
|
||||
"name": "Blockscout Astar zkEVM explorer",
|
||||
"url": "https://astar-zkevm.explorer.startale.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
@@ -35,10 +35,12 @@ export default {
|
||||
]
|
||||
},
|
||||
"redFlags": [],
|
||||
"rpc": [],
|
||||
"rpc": [
|
||||
"https://3776.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.startale.com/astar-zkevm"
|
||||
],
|
||||
"shortName": "astarzk",
|
||||
"slug": "astar-zkevm",
|
||||
"status": "incubating",
|
||||
"testnet": false,
|
||||
"title": "Astar zkEVM Mainnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -5,7 +5,7 @@ export default {
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"infoURL": "https://docs.thefirechain.com/",
|
||||
"name": "Firechain zkEVM Testnet",
|
||||
"name": "Firechain zkEVM Ghostrider",
|
||||
"nativeCurrency": {
|
||||
"name": "Ether",
|
||||
"symbol": "ETH",
|
||||
@@ -16,8 +16,8 @@ export default {
|
||||
"https://3885.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-zkevm-ghostrider.thefirechain.com"
|
||||
],
|
||||
"shortName": "firechain-zkEVM-ghostrider",
|
||||
"slug": "firechain-zkevm-testnet",
|
||||
"shortName": "firechain-zkEVM-testnet",
|
||||
"slug": "firechain-zkevm-ghostrider",
|
||||
"testnet": true,
|
||||
"title": "Firechain zkEVM Ghostrider"
|
||||
"title": "Firechain zkEVM Testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 41799,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "Will's New Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Will's New Testnet Token",
|
||||
"symbol": "ZBO",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 41799,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://41799.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "Will's New Testnet",
|
||||
"slug": "will-s-new-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -43,5 +43,6 @@ export default {
|
||||
"shortName": "ogor",
|
||||
"slip44": 1,
|
||||
"slug": "optimism-goerli",
|
||||
"status": "deprecated",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -44,6 +44,7 @@ export default {
|
||||
"shortName": "arb-goerli",
|
||||
"slip44": 1,
|
||||
"slug": "arbitrum-goerli",
|
||||
"status": "deprecated",
|
||||
"testnet": true,
|
||||
"title": "Arbitrum Goerli Rollup Testnet"
|
||||
} as const satisfies Chain;
|
||||
@@ -2,13 +2,7 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Xai Goerli Orbit Testnet",
|
||||
"chainId": 47279324479,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Xai Goerli Testnet Explorer",
|
||||
"url": "https://testnet-explorer.xai-chain.net",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"infoURL": "https://xai.games/",
|
||||
@@ -20,11 +14,9 @@ export default {
|
||||
},
|
||||
"networkId": 47279324479,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://47279324479.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://testnet.xai-chain.net/rpc"
|
||||
],
|
||||
"rpc": [],
|
||||
"shortName": "xai-goerli",
|
||||
"slug": "xai-goerli-orbit",
|
||||
"status": "deprecated",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -5,7 +5,7 @@ export default {
|
||||
"explorers": [
|
||||
{
|
||||
"name": "explorer-thebifrost",
|
||||
"url": "https://explorer.testnet.thebifrost.io",
|
||||
"url": "https://explorer.testnet.bifrostnetwork.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
@@ -16,7 +16,7 @@ export default {
|
||||
"height": 480,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://thebifrost.io",
|
||||
"infoURL": "https://bifrostnetwork.com",
|
||||
"name": "Bifrost Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Bifrost",
|
||||
@@ -26,8 +26,8 @@ export default {
|
||||
"networkId": 49088,
|
||||
"rpc": [
|
||||
"https://49088.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://public-01.testnet.thebifrost.io/rpc",
|
||||
"https://public-02.testnet.thebifrost.io/rpc"
|
||||
"https://public-01.testnet.bifrostnetwork.com/rpc",
|
||||
"https://public-02.testnet.bifrostnetwork.com/rpc"
|
||||
],
|
||||
"shortName": "tbfc",
|
||||
"slip44": 1,
|
||||
|
||||
@@ -57,6 +57,7 @@ export default {
|
||||
"shortName": "gor",
|
||||
"slip44": 1,
|
||||
"slug": "goerli",
|
||||
"status": "deprecated",
|
||||
"testnet": true,
|
||||
"title": "Ethereum Testnet Goerli"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 51277,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QI0344s1 Testne",
|
||||
"nativeCurrency": {
|
||||
"name": "QI0344s1 Testne Token",
|
||||
"symbol": "LKG",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 51277,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://51277.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI0344s1 Testne",
|
||||
"slug": "qi0344s1-testne",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -1,28 +1,28 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "ETHF",
|
||||
"chain": "DIS",
|
||||
"chainId": 513100,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "etherfair",
|
||||
"url": "https://www.oklink.com/ethf",
|
||||
"name": "DisChain",
|
||||
"url": "https://www.oklink.com/dis",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"infoURL": "https://etherfair.org",
|
||||
"name": "ethereum Fair",
|
||||
"infoURL": "https://dischain.xyz",
|
||||
"name": "DisChain",
|
||||
"nativeCurrency": {
|
||||
"name": "EthereumFair",
|
||||
"symbol": "ETHF",
|
||||
"name": "DisChain",
|
||||
"symbol": "DIS",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 513100,
|
||||
"rpc": [
|
||||
"https://513100.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.etherfair.org"
|
||||
"https://rpc.dischain.xyz"
|
||||
],
|
||||
"shortName": "ethf",
|
||||
"slug": "ethereum-fair",
|
||||
"shortName": "dis",
|
||||
"slug": "dischain",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 52150,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QI0304I1 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QI0304I1 Testnet Token",
|
||||
"symbol": "LOD",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 52150,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://52150.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI0304I1 Testnet",
|
||||
"slug": "qi0304i1-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -26,8 +26,8 @@ export default {
|
||||
"https://rpc.ankr.com/syscoin/${ANKR_API_KEY}",
|
||||
"https://syscoin.public-rpc.com",
|
||||
"wss://rpc.syscoin.org/wss",
|
||||
"https://syscoin-evm-rpc.publicnode.com",
|
||||
"wss://syscoin-evm-rpc.publicnode.com"
|
||||
"https://syscoin-evm.publicnode.com",
|
||||
"wss://syscoin-evm.publicnode.com"
|
||||
],
|
||||
"shortName": "sys",
|
||||
"slug": "syscoin",
|
||||
|
||||
@@ -23,7 +23,9 @@ export default {
|
||||
"rpc": [
|
||||
"https://570.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.rollux.com",
|
||||
"wss://rpc.rollux.com/wss"
|
||||
"wss://rpc.rollux.com/wss",
|
||||
"https://rollux.rpc.syscoin.org",
|
||||
"wss://rollux.rpc.syscoin.org/wss"
|
||||
],
|
||||
"shortName": "sys-rollux",
|
||||
"slug": "rollux",
|
||||
|
||||
@@ -24,8 +24,8 @@ export default {
|
||||
"https://5700.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.tanenbaum.io",
|
||||
"wss://rpc.tanenbaum.io/wss",
|
||||
"https://syscoin-tanenbaum-evm-rpc.publicnode.com",
|
||||
"wss://syscoin-tanenbaum-evm-rpc.publicnode.com"
|
||||
"https://syscoin-tanenbaum-evm.publicnode.com",
|
||||
"wss://syscoin-tanenbaum-evm.publicnode.com"
|
||||
],
|
||||
"shortName": "tsys",
|
||||
"slip44": 1,
|
||||
|
||||
@@ -24,7 +24,9 @@ export default {
|
||||
"https://57000.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-tanenbaum.rollux.com",
|
||||
"https://rpc.ankr.com/rollux_testnet/${ANKR_API_KEY}",
|
||||
"wss://rpc-tanenbaum.rollux.com/wss"
|
||||
"wss://rpc-tanenbaum.rollux.com/wss",
|
||||
"https://rollux.rpc.tanenbaum.io",
|
||||
"wss://rollux.rpc.tanenbaum.io/wss"
|
||||
],
|
||||
"shortName": "tsys-rollux",
|
||||
"slip44": 1,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 57021,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QIM2403061",
|
||||
"nativeCurrency": {
|
||||
"name": "QIM2403061 Token",
|
||||
"symbol": "VVC",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 57021,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://57021.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QIM2403061",
|
||||
"slug": "qim2403061",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,42 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "BEYOND",
|
||||
"chainId": 59185,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Beyond",
|
||||
"url": "https://explorerl2new-beyond-indigo-playground-xz87sjgmaj.t.conduit.xyz",
|
||||
"standard": "standard",
|
||||
"icon": {
|
||||
"url": "ipfs://QmbLxRVZ27Yy6RE9xAdYgSxGPB1TjPtcxahy6uNnp2Pt6T/Beyond.jpg",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "jpg"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmbLxRVZ27Yy6RE9xAdYgSxGPB1TjPtcxahy6uNnp2Pt6T/Beyond.jpg",
|
||||
"width": 512,
|
||||
"height": 512,
|
||||
"format": "jpg"
|
||||
},
|
||||
"infoURL": "https://explorerl2new-beyond-indigo-playground-xz87sjgmaj.t.conduit.xyz",
|
||||
"name": "BeyondChain Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "BEYOND",
|
||||
"symbol": "BEYOND",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 59185,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://59185.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-beyond-indigo-playground-xz87sjgmaj.t.conduit.xyz"
|
||||
],
|
||||
"shortName": "beyond-indigo-playground-xz87sjgmaj",
|
||||
"slug": "beyondchain-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -44,5 +44,6 @@ export default {
|
||||
"shortName": "metis-goerli",
|
||||
"slip44": 1,
|
||||
"slug": "metis-goerli-testnet",
|
||||
"status": "deprecated",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -4,7 +4,7 @@ export default {
|
||||
"chainId": 6038361,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Blockscout zKyoto chain explorer",
|
||||
"name": "Blockscout zKyoto explorer",
|
||||
"url": "https://astar-zkyoto.blockscout.com",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
@@ -43,7 +43,6 @@ export default {
|
||||
],
|
||||
"shortName": "azkyt",
|
||||
"slug": "astar-zkyoto",
|
||||
"status": "incubating",
|
||||
"testnet": true,
|
||||
"title": "Astar zkEVM Testnet zKyoto"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 61551,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QR0304T1TS Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QR0304T1TS Testnet Token",
|
||||
"symbol": "OYU",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 61551,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://61551.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/qr0304t1ts/testnet/rpc"
|
||||
],
|
||||
"shortName": "QR0304T1TS Testnet",
|
||||
"slug": "qr0304t1ts-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "FlowEVM",
|
||||
"chainId": 646,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Flow Diver",
|
||||
"url": "https://previewnet.flowdiver.io",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"faucets": [
|
||||
"https://previewnet-faucet.onflow.org"
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://QmQFugEvsfU3ARjjJ7YRLJwSxMfTk54WWzrofekTRBKFaC",
|
||||
"width": 2000,
|
||||
"height": 2000,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://developers.flow.com/evm/about",
|
||||
"name": "FlowEVM PreviewNet",
|
||||
"nativeCurrency": {
|
||||
"name": "FLOW",
|
||||
"symbol": "FLOW",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 646,
|
||||
"rpc": [
|
||||
"https://646.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://previewnet.evm.nodes.onflow.org"
|
||||
],
|
||||
"shortName": "flowevm-preview",
|
||||
"slug": "flowevm-previewnet",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -24,13 +24,10 @@ export default {
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 65100001,
|
||||
"rpc": [
|
||||
"https://65100001.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc1.piccadilly.autonity.org/",
|
||||
"wss://rpc1.piccadilly.autonity.org/ws/"
|
||||
],
|
||||
"rpc": [],
|
||||
"shortName": "piccadilly-01",
|
||||
"slip44": 1,
|
||||
"slug": "autonity-piccadilly-barada-testnet",
|
||||
"status": "deprecated",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "AUT",
|
||||
"chainId": 65100002,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "autonity-blockscout",
|
||||
"url": "https://piccadilly.autonity.org",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://Qme5nxFZZoNNpiT8u9WwcBot4HyLTg2jxMxRnsbc5voQwB",
|
||||
"width": 1000,
|
||||
"height": 1000,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://autonity.org/",
|
||||
"name": "Autonity Piccadilly (Sumida) Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Piccadilly Auton",
|
||||
"symbol": "ATN",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 65100002,
|
||||
"rpc": [
|
||||
"https://65100002.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc1.piccadilly.autonity.org/",
|
||||
"wss://rpc1.piccadilly.autonity.org/ws/"
|
||||
],
|
||||
"shortName": "piccadilly-02",
|
||||
"slip44": 1,
|
||||
"slug": "autonity-piccadilly-sumida-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Degen",
|
||||
"chainId": 666666666,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://Qmb6yAe4wXeBkxjfhxzoUT9TzETcmE7Vne59etm9GJaQf7",
|
||||
"width": 789,
|
||||
"height": 668,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://degen.tips",
|
||||
"name": "Degen Chain",
|
||||
"nativeCurrency": {
|
||||
"name": "DEGEN",
|
||||
"symbol": "DEGEN",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 666666666,
|
||||
"rpc": [
|
||||
"https://666666666.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.degen.tips"
|
||||
],
|
||||
"shortName": "degen-chain",
|
||||
"slug": "degen-chain",
|
||||
"status": "incubating",
|
||||
"testnet": false,
|
||||
"title": "Degen Chain"
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 70038,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "John's Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "John's Testnet Token",
|
||||
"symbol": "FLG",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 70038,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://70038.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "John's Testnet",
|
||||
"slug": "john-s-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -2,9 +2,22 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 710420,
|
||||
"explorers": [],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "TILTYARD Explorer",
|
||||
"url": "https://subnets.avax.network/tiltyard",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"features": [
|
||||
{
|
||||
"name": "EIP155"
|
||||
},
|
||||
{
|
||||
"name": "EIP1559"
|
||||
}
|
||||
],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 7158,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "TESTNet FirstTEST",
|
||||
"nativeCurrency": {
|
||||
"name": "TESTNet FirstTEST Token",
|
||||
"symbol": "TEST",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 7158,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://7158.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/testnetfir/testnet/rpc"
|
||||
],
|
||||
"shortName": "TESTNet FirstTEST",
|
||||
"slug": "testnet-firsttest",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 72877,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QaUser4 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QaUser4 Testnet Token",
|
||||
"symbol": "ZAG",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 72877,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://72877.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QaUser4 Testnet",
|
||||
"slug": "qauser4-testnet-qauser4 testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 7326,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QI M 2403051 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QI M 2403051 Testnet Token",
|
||||
"symbol": "VVC",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 7326,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://7326.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI M 2403051 Testnet",
|
||||
"slug": "qi-m-2403051-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,34 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "FlowEVM",
|
||||
"chainId": 747,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Flow Diver",
|
||||
"url": "https://flowdiver.io",
|
||||
"standard": "none"
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://QmQFugEvsfU3ARjjJ7YRLJwSxMfTk54WWzrofekTRBKFaC",
|
||||
"width": 2000,
|
||||
"height": 2000,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://developers.flow.com/evm/about",
|
||||
"name": "FlowEVM Mainnet",
|
||||
"nativeCurrency": {
|
||||
"name": "FLOW",
|
||||
"symbol": "FLOW",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 747,
|
||||
"rpc": [
|
||||
"https://747.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://mainnet.evm.nodes.onflow.org"
|
||||
],
|
||||
"shortName": "flowevm-mainnet",
|
||||
"slug": "flowevm",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -4,19 +4,14 @@ export default {
|
||||
"chainId": 7700,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Canto EVM Explorer (Blockscout)",
|
||||
"url": "https://evm.explorer.canto.io",
|
||||
"standard": "none"
|
||||
},
|
||||
{
|
||||
"name": "Canto Cosmos Explorer",
|
||||
"url": "https://cosmos-explorers.neobase.one",
|
||||
"standard": "none"
|
||||
"name": "Canto Explorer (OKLink)",
|
||||
"url": "https://www.oklink.com/canto",
|
||||
"standard": "EIP3091"
|
||||
},
|
||||
{
|
||||
"name": "Canto EVM Explorer (Blockscout)",
|
||||
"url": "https://tuber.build",
|
||||
"standard": "none"
|
||||
"standard": "EIP3091"
|
||||
},
|
||||
{
|
||||
"name": "dexguru",
|
||||
@@ -42,14 +37,9 @@ export default {
|
||||
"rpc": [
|
||||
"https://7700.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://canto.slingshot.finance",
|
||||
"https://canto.neobase.one",
|
||||
"https://canto-rpc.ansybl.io",
|
||||
"https://mainnode.plexnode.org:8545",
|
||||
"https://canto.gravitychain.io/",
|
||||
"https://canto.evm.chandrastation.com/",
|
||||
"https://jsonrpc.canto.nodestake.top/",
|
||||
"https://canto.dexvaults.com/",
|
||||
"wss://canto.gravitychain.io:8546",
|
||||
"wss://canto.dexvaults.com/ws"
|
||||
"https://canto.gravitychain.io/"
|
||||
],
|
||||
"shortName": "canto",
|
||||
"slug": "canto",
|
||||
|
||||
@@ -2,7 +2,30 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "ETH",
|
||||
"chainId": 81457,
|
||||
"explorers": [],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "Blastscan",
|
||||
"url": "https://blastscan.io",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeifc2h3x7jgy4x4nmg2m54ghbvmkfu6oweujambwefzqzew5vujhsi",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"format": "jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Blast Explorer",
|
||||
"url": "https://blastexplorer.io",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeifc2h3x7jgy4x4nmg2m54ghbvmkfu6oweujambwefzqzew5vujhsi",
|
||||
"width": 400,
|
||||
"height": 400,
|
||||
"format": "jpg"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [],
|
||||
"icon": {
|
||||
"url": "ipfs://bafybeifc2h3x7jgy4x4nmg2m54ghbvmkfu6oweujambwefzqzew5vujhsi",
|
||||
@@ -22,9 +45,16 @@ export default {
|
||||
"type": "L2",
|
||||
"chain": "eip155-1"
|
||||
},
|
||||
"rpc": [],
|
||||
"rpc": [
|
||||
"https://81457.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc.blast.io",
|
||||
"https://rpc.ankr.com/blast",
|
||||
"https://blast.din.dev/rpc",
|
||||
"https://blastl2-mainnet.public.blastapi.io",
|
||||
"https://blast.blockpi.network/v1/rpc/public"
|
||||
],
|
||||
"shortName": "blastmainnet",
|
||||
"slug": "blast-blastmainnet",
|
||||
"status": "incubating",
|
||||
"status": "active",
|
||||
"testnet": false
|
||||
} as const satisfies Chain;
|
||||
@@ -0,0 +1,43 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Runic",
|
||||
"chainId": 822,
|
||||
"explorers": [
|
||||
{
|
||||
"name": "RunicScan",
|
||||
"url": "https://scan.runic.build",
|
||||
"standard": "EIP3091",
|
||||
"icon": {
|
||||
"url": "ipfs://QmW3RZKwBq12F7jVV2pn6T9WzwU5rosLYkVqoRQckfKvXo",
|
||||
"width": 340,
|
||||
"height": 340,
|
||||
"format": "png"
|
||||
}
|
||||
}
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.runic.build"
|
||||
],
|
||||
"icon": {
|
||||
"url": "ipfs://QmW3RZKwBq12F7jVV2pn6T9WzwU5rosLYkVqoRQckfKvXo",
|
||||
"width": 340,
|
||||
"height": 340,
|
||||
"format": "png"
|
||||
},
|
||||
"infoURL": "https://runic.build",
|
||||
"name": "Runic Chain Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "Bitcoin",
|
||||
"symbol": "rBTC",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 822,
|
||||
"rpc": [
|
||||
"https://822.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://rpc-testnet.runic.build"
|
||||
],
|
||||
"shortName": "runic-testnet",
|
||||
"slug": "runic-chain-testnet",
|
||||
"status": "active",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -32,7 +32,7 @@ export default {
|
||||
"networkId": 84532,
|
||||
"rpc": [
|
||||
"https://84532.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://https://sepolia.base.org",
|
||||
"https://sepolia.base.org",
|
||||
"https://base-sepolia-rpc.publicnode.com",
|
||||
"wss://base-sepolia-rpc.publicnode.com"
|
||||
],
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "Avalanche",
|
||||
"chainId": 89327,
|
||||
"explorers": [],
|
||||
"faucets": [],
|
||||
"features": [],
|
||||
"icon": {
|
||||
"url": "https://images.ctfassets.net/9bazykntljf6/62CceHSYsRS4D9fgDSkLRB/877cb8f26954e1743ff535fd7fdaf78f/avacloud-placeholder.svg",
|
||||
"width": 256,
|
||||
"height": 256,
|
||||
"format": "svg"
|
||||
},
|
||||
"infoURL": "https://avacloud.io",
|
||||
"name": "QI0304I3 Testnet",
|
||||
"nativeCurrency": {
|
||||
"name": "QI0304I3 Testnet Token",
|
||||
"symbol": "ZIK",
|
||||
"decimals": 18
|
||||
},
|
||||
"networkId": 89327,
|
||||
"redFlags": [],
|
||||
"rpc": [
|
||||
"https://89327.rpc.thirdweb.com/${THIRDWEB_API_KEY}",
|
||||
"https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"
|
||||
],
|
||||
"shortName": "QI0304I3 Testnet",
|
||||
"slug": "qi0304i3-testnet",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -2,7 +2,13 @@ import type { Chain } from "../src/types";
|
||||
export default {
|
||||
"chain": "FIRE",
|
||||
"chainId": 917,
|
||||
"explorers": [],
|
||||
"explorers": [
|
||||
{
|
||||
"name": "FireScan",
|
||||
"url": "https://rinia.firescan.io",
|
||||
"standard": "EIP3091"
|
||||
}
|
||||
],
|
||||
"faucets": [
|
||||
"https://faucet.thefirechain.com"
|
||||
],
|
||||
@@ -27,6 +33,5 @@ export default {
|
||||
"shortName": "tfire",
|
||||
"slip44": 1,
|
||||
"slug": "rinia-testnet",
|
||||
"status": "incubating",
|
||||
"testnet": true
|
||||
} as const satisfies Chain;
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/chains",
|
||||
"version": "0.1.75",
|
||||
"version": "0.1.77",
|
||||
"main": "dist/thirdweb-dev-chains.cjs.js",
|
||||
"module": "dist/thirdweb-dev-chains.esm.js",
|
||||
"exports": {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,27 @@
|
||||
# thirdweb
|
||||
|
||||
## 0.13.45
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2400](https://github.com/thirdweb-dev/js/pull/2400) [`ef76a96`](https://github.com/thirdweb-dev/js/commit/ef76a96c2dda21e28195371fd48e57350721b717) Thanks [@kumaryash90](https://github.com/kumaryash90)! - "Option to link external libraries"
|
||||
|
||||
- Updated dependencies [[`74a92dc`](https://github.com/thirdweb-dev/js/commit/74a92dcb7dc4be7d03bcb8b7211e87016f52a81f), [`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d)]:
|
||||
- @thirdweb-dev/wallets@2.4.15
|
||||
- @thirdweb-dev/chains@0.1.77
|
||||
- @thirdweb-dev/auth@4.1.37
|
||||
- @thirdweb-dev/sdk@4.0.40
|
||||
|
||||
## 0.13.44
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022), [`9c7fbc1`](https://github.com/thirdweb-dev/js/commit/9c7fbc1603a7265209b6f56c2284fdb0e6b33a1d), [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f), [`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af), [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825)]:
|
||||
- @thirdweb-dev/wallets@2.4.14
|
||||
- @thirdweb-dev/sdk@4.0.39
|
||||
- @thirdweb-dev/chains@0.1.76
|
||||
- @thirdweb-dev/auth@4.1.36
|
||||
|
||||
## 0.13.43
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "thirdweb",
|
||||
"main": "dist/cli/index.js",
|
||||
"version": "0.13.43",
|
||||
"version": "0.13.45",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/cli",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -20,6 +20,7 @@ import { generate } from "../generate/command";
|
||||
import { findPackageInstallation } from "../helpers/detect-local-packages";
|
||||
import { install } from "../install";
|
||||
import { upload } from "../storage/command";
|
||||
import { parseLinkLibOption } from "../common/link-lib-helper";
|
||||
|
||||
const main = async () => {
|
||||
// eslint-disable-next-line turbo/no-undeclared-env-vars
|
||||
@@ -331,6 +332,12 @@ const main = async () => {
|
||||
"Deploy a dynamic smart contract made up of extensions to blockchains",
|
||||
)
|
||||
.option("--zksync", "Deploy on ZKSync")
|
||||
.option(
|
||||
"--link-lib <library:address...>",
|
||||
"Specify library names and addresses",
|
||||
parseLinkLibOption,
|
||||
[],
|
||||
)
|
||||
.option("-k, --key <key>", "API secret key to authorize usage")
|
||||
.action(async (options) => {
|
||||
let secretKey = "";
|
||||
@@ -370,6 +377,12 @@ const main = async () => {
|
||||
.option("--dry-run", "dry run (skip actually publishing)")
|
||||
.option("-d, --debug", "show debug logs")
|
||||
.option("--ci", "Continuous Integration mode")
|
||||
.option(
|
||||
"--link-lib <library:address...>",
|
||||
"Specify library names and addresses",
|
||||
parseLinkLibOption,
|
||||
[],
|
||||
)
|
||||
.option("-k, --key <key>", "API secret key to authorize usage")
|
||||
.action(async (options) => {
|
||||
let secretKey = "";
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
import { utils } from "ethers";
|
||||
import { isAddress } from "ethers/lib/utils";
|
||||
|
||||
export interface Link {
|
||||
library: string;
|
||||
address: string;
|
||||
}
|
||||
|
||||
// Custom array option parser for --link-lib
|
||||
export function parseLinkLibOption(
|
||||
value: string,
|
||||
previousValue: Link[] | undefined,
|
||||
): Link[] {
|
||||
const links = previousValue || [];
|
||||
const [library, address] = value.split(":");
|
||||
if (!isAddress(address)) {
|
||||
throw new Error(`Invalid address ${address} `);
|
||||
}
|
||||
links.push({ library, address });
|
||||
return links;
|
||||
}
|
||||
|
||||
// replace placeholder in bytecode with library address
|
||||
export function linkLibrary(
|
||||
bytecode: string,
|
||||
libraries: {
|
||||
[key: string]: string;
|
||||
} = {},
|
||||
): string {
|
||||
let linkedBytecode = bytecode;
|
||||
for (const [key, address] of Object.entries(libraries)) {
|
||||
const placeholder = `__\$${utils
|
||||
.solidityKeccak256(["string"], [key])
|
||||
.slice(2, 36)}\$__`;
|
||||
const formattedAddress = utils
|
||||
.getAddress(address)
|
||||
.toLowerCase()
|
||||
.replace("0x", "");
|
||||
|
||||
linkedBytecode = linkedBytecode.replaceAll(placeholder, formattedAddress);
|
||||
}
|
||||
return linkedBytecode;
|
||||
}
|
||||
@@ -41,5 +41,6 @@ export default async function build(
|
||||
projectPath: path,
|
||||
clean: options.clean,
|
||||
zksync: options.zksync,
|
||||
linkLib: options.linkLib,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { findFiles } from "../../common/file-helper";
|
||||
import { Link, linkLibrary } from "../../common/link-lib-helper";
|
||||
import { hasForge } from "../../create/helpers/has-forge";
|
||||
import { execute } from "../helpers/exec";
|
||||
import { logger } from "../helpers/logger";
|
||||
@@ -43,6 +44,24 @@ export class FoundryBuilder extends BaseBuilder {
|
||||
const files: string[] = [];
|
||||
findFiles(outPath, /^.*(?<!metadata)\.json$/, files);
|
||||
|
||||
const libraries: { [key: string]: string } = {};
|
||||
if (Array.isArray(options.linkLib) && options.linkLib.length > 0) {
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
const contractName = basename(file, ".json");
|
||||
const contractJsonFile = readFileSync(file, "utf-8");
|
||||
const contractInfo = JSON.parse(contractJsonFile);
|
||||
|
||||
options.linkLib.forEach((link: Link) => {
|
||||
if (contractName === link.library) {
|
||||
const key = `${contractInfo.ast.absolutePath}:${link.library}`;
|
||||
libraries[key] = link.address;
|
||||
}
|
||||
});
|
||||
}
|
||||
logger.debug(`Found libraries to link: ${JSON.stringify(libraries)}`);
|
||||
}
|
||||
|
||||
for (let i = 0; i < files.length; i++) {
|
||||
const file = files[i];
|
||||
const contractName = basename(file, ".json");
|
||||
@@ -76,8 +95,13 @@ export class FoundryBuilder extends BaseBuilder {
|
||||
continue;
|
||||
}
|
||||
|
||||
const bytecode = contractInfo.bytecode.object;
|
||||
const deployedBytecode = contractInfo.deployedBytecode.object;
|
||||
let bytecode = contractInfo.bytecode.object;
|
||||
let deployedBytecode = contractInfo.deployedBytecode.object;
|
||||
|
||||
// link external libraries if any
|
||||
bytecode = linkLibrary(bytecode, libraries);
|
||||
deployedBytecode = linkLibrary(deployedBytecode, libraries);
|
||||
|
||||
const parsedMetadata = contractInfo.metadata;
|
||||
const metadata =
|
||||
contractInfo.rawMetadata ||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { findFiles } from "../../common/file-helper";
|
||||
import { Link, linkLibrary } from "../../common/link-lib-helper";
|
||||
import { execute } from "../helpers/exec";
|
||||
import { logger } from "../helpers/logger";
|
||||
import { ContractPayload } from "../interfaces/ContractPayload";
|
||||
@@ -85,6 +86,22 @@ export class HardhatBuilder extends BaseBuilder {
|
||||
|
||||
const contractBuildOutputs = buildJson.output.contracts;
|
||||
|
||||
const libraries: { [key: string]: string } = {};
|
||||
if (Array.isArray(options.linkLib) && options.linkLib.length > 0) {
|
||||
for (const [contractPath, contractInfos] of Object.entries(
|
||||
contractBuildOutputs,
|
||||
)) {
|
||||
const contractNames = Object.keys(contractInfos as any);
|
||||
options.linkLib.forEach((link: Link) => {
|
||||
if (contractNames.includes(link.library)) {
|
||||
const key = `${contractPath}:${link.library}`;
|
||||
libraries[key] = link.address;
|
||||
}
|
||||
});
|
||||
}
|
||||
logger.debug(`Found libraries to link: ${JSON.stringify(libraries)}`);
|
||||
}
|
||||
|
||||
for (const [contractPath, contractInfos] of Object.entries(
|
||||
contractBuildOutputs,
|
||||
)) {
|
||||
@@ -109,9 +126,13 @@ export class HardhatBuilder extends BaseBuilder {
|
||||
continue;
|
||||
}
|
||||
|
||||
const bytecode = info.evm.bytecode.object;
|
||||
const deployedBytecode =
|
||||
info.evm.deployedBytecode?.object || bytecode;
|
||||
let bytecode = info.evm.bytecode.object;
|
||||
let deployedBytecode = info.evm.deployedBytecode?.object || bytecode;
|
||||
|
||||
// link external libraries if any
|
||||
bytecode = linkLibrary(bytecode, libraries);
|
||||
deployedBytecode = linkLibrary(deployedBytecode, libraries);
|
||||
|
||||
const { metadata, abi } = info;
|
||||
|
||||
const meta = metadata.solc_metadata
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { Link } from "../../common/link-lib-helper";
|
||||
import { ContractPayload } from "./ContractPayload";
|
||||
|
||||
export type CompileOptions = {
|
||||
@@ -5,6 +6,7 @@ export type CompileOptions = {
|
||||
projectPath: string;
|
||||
name: string;
|
||||
zksync?: boolean;
|
||||
linkLib?: Link[];
|
||||
};
|
||||
|
||||
export interface IBuilder {
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @thirdweb-dev/react-core
|
||||
|
||||
## 4.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`74a92dc`](https://github.com/thirdweb-dev/js/commit/74a92dcb7dc4be7d03bcb8b7211e87016f52a81f), [`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d)]:
|
||||
- @thirdweb-dev/wallets@2.4.15
|
||||
- @thirdweb-dev/chains@0.1.77
|
||||
- @thirdweb-dev/auth@4.1.37
|
||||
- @thirdweb-dev/sdk@4.0.40
|
||||
|
||||
## 4.4.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2382](https://github.com/thirdweb-dev/js/pull/2382) [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added useUpdateNFTMetadata hook
|
||||
|
||||
- Updated dependencies [[`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022), [`9c7fbc1`](https://github.com/thirdweb-dev/js/commit/9c7fbc1603a7265209b6f56c2284fdb0e6b33a1d), [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f), [`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af), [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825)]:
|
||||
- @thirdweb-dev/wallets@2.4.14
|
||||
- @thirdweb-dev/sdk@4.0.39
|
||||
- @thirdweb-dev/chains@0.1.76
|
||||
- @thirdweb-dev/auth@4.1.36
|
||||
|
||||
## 4.4.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-core",
|
||||
"version": "4.4.11",
|
||||
"version": "4.4.13",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-core",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { BasicNFTInput } from "@thirdweb-dev/sdk";
|
||||
import type { BasicNFTInput, NFTMetadataInput } from "@thirdweb-dev/sdk";
|
||||
import {
|
||||
requiredParamInvariant,
|
||||
RequiredParam,
|
||||
@@ -335,7 +335,7 @@ export function useTotalCirculatingSupply(
|
||||
* @param ownerWalletAddress -
|
||||
* The wallet address to get owned tokens for. Likely, you will want to view the connected wallet’s NFTs. use the `useAddress` hook to get this value.
|
||||
*
|
||||
* @param queryParams -
|
||||
* @param queryParams -
|
||||
* Paginate the results by providing a `queryParams` object as an argument.
|
||||
*
|
||||
* ```jsx
|
||||
@@ -354,7 +354,7 @@ export function useTotalCirculatingSupply(
|
||||
* );
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* @returns Query result object that includes the list of owned `NFT` objects
|
||||
*
|
||||
* @twfeature ERC721Enumerable | ERC1155Enumerable | ERC721Supply
|
||||
@@ -1052,3 +1052,41 @@ export function useSetSharedMetadata<TContract extends NFTContract>(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update nft metadata
|
||||
* @param contract - Instance of a `NFTContract`
|
||||
* @param tokenId - The token ID of the NFT you want to fetch.
|
||||
* @public
|
||||
* @twfeature ERC721UpdatableMetadata | ERC1155UpdatableMetadata
|
||||
* @nft
|
||||
*/
|
||||
export function useUpdateNFTMetadata<TContract extends NFTContract>(
|
||||
contract: RequiredParam<TContract>,
|
||||
) {
|
||||
const activeChainId = useSDKChainId();
|
||||
const contractAddress = contract?.getAddress();
|
||||
const queryClient = useQueryClient();
|
||||
const { erc721, erc1155 } = getErcs(contract);
|
||||
|
||||
return useMutation(
|
||||
async (data: { tokenId: BigNumberish; metadata: NFTMetadataInput }) => {
|
||||
const { tokenId, metadata } = data;
|
||||
if (erc721) {
|
||||
return await erc721.updateMetadata(tokenId, metadata);
|
||||
}
|
||||
if (erc1155) {
|
||||
return await erc1155.updateMetadata(tokenId, metadata);
|
||||
}
|
||||
invariant(false, "Unknown NFT type");
|
||||
},
|
||||
{
|
||||
onSettled: () =>
|
||||
invalidateContractAndBalances(
|
||||
queryClient,
|
||||
contractAddress,
|
||||
activeChainId,
|
||||
),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -173,6 +173,7 @@ export {
|
||||
useBurnNFT,
|
||||
useSharedMetadata,
|
||||
useSetSharedMetadata,
|
||||
useUpdateNFTMetadata,
|
||||
} from "./hooks/async/nft";
|
||||
|
||||
// roles
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,9 @@
|
||||
# @thirdweb-dev/react-native-compat
|
||||
|
||||
## 0.7.10
|
||||
|
||||
## 0.7.9
|
||||
|
||||
## 0.7.8
|
||||
|
||||
## 0.7.7
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native-compat",
|
||||
"description": "Shims for Thirdweb in React Native Projects",
|
||||
"version": "0.7.8",
|
||||
"version": "0.7.10",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native-compat",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -1,5 +1,25 @@
|
||||
# @thirdweb-dev/react-native
|
||||
|
||||
## 0.7.10
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`74a92dc`](https://github.com/thirdweb-dev/js/commit/74a92dcb7dc4be7d03bcb8b7211e87016f52a81f), [`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d)]:
|
||||
- @thirdweb-dev/wallets@2.4.15
|
||||
- @thirdweb-dev/chains@0.1.77
|
||||
- @thirdweb-dev/react-core@4.4.13
|
||||
- @thirdweb-dev/sdk@4.0.40
|
||||
|
||||
## 0.7.9
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022), [`9c7fbc1`](https://github.com/thirdweb-dev/js/commit/9c7fbc1603a7265209b6f56c2284fdb0e6b33a1d), [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f), [`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af), [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825)]:
|
||||
- @thirdweb-dev/wallets@2.4.14
|
||||
- @thirdweb-dev/sdk@4.0.39
|
||||
- @thirdweb-dev/chains@0.1.76
|
||||
- @thirdweb-dev/react-core@4.4.12
|
||||
|
||||
## 0.7.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react-native",
|
||||
"version": "0.7.8",
|
||||
"version": "0.7.10",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react-native",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
@@ -38,7 +38,7 @@
|
||||
"@thirdweb-dev/wallets": "workspace:*",
|
||||
"abitype": "^0.2.5",
|
||||
"aws-amplify": "^5.3.8",
|
||||
"expo-application": "^5.3.0",
|
||||
"expo-application": "5.7.0",
|
||||
"expo-clipboard": "^4.5.0",
|
||||
"expo-document-picker": "^11.2.2",
|
||||
"expo-file-system": "^15.2.2",
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,25 @@
|
||||
# @thirdweb-dev/react
|
||||
|
||||
## 4.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`74a92dc`](https://github.com/thirdweb-dev/js/commit/74a92dcb7dc4be7d03bcb8b7211e87016f52a81f), [`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d)]:
|
||||
- @thirdweb-dev/wallets@2.4.15
|
||||
- @thirdweb-dev/chains@0.1.77
|
||||
- @thirdweb-dev/react-core@4.4.13
|
||||
- @thirdweb-dev/sdk@4.0.40
|
||||
|
||||
## 4.4.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022), [`9c7fbc1`](https://github.com/thirdweb-dev/js/commit/9c7fbc1603a7265209b6f56c2284fdb0e6b33a1d), [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f), [`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af), [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825)]:
|
||||
- @thirdweb-dev/wallets@2.4.14
|
||||
- @thirdweb-dev/sdk@4.0.39
|
||||
- @thirdweb-dev/chains@0.1.76
|
||||
- @thirdweb-dev/react-core@4.4.12
|
||||
|
||||
## 4.4.11
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/react",
|
||||
"version": "4.4.11",
|
||||
"version": "4.4.13",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/react",
|
||||
"author": "thirdweb eng <[email protected]>",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,25 @@
|
||||
# @thirdweb-dev/sdk
|
||||
|
||||
## 4.0.40
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [[`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d)]:
|
||||
- @thirdweb-dev/chains@0.1.77
|
||||
|
||||
## 4.0.39
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2379](https://github.com/thirdweb-dev/js/pull/2379) [`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Smart Wallet] Do not deploy to sign typed data, allow presigned deploy+session key
|
||||
|
||||
- [#2404](https://github.com/thirdweb-dev/js/pull/2404) [`9c7fbc1`](https://github.com/thirdweb-dev/js/commit/9c7fbc1603a7265209b6f56c2284fdb0e6b33a1d) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Updateable metadata for DropERC721 contracts
|
||||
|
||||
- [#2382](https://github.com/thirdweb-dev/js/pull/2382) [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825) Thanks [@joaquim-verges](https://github.com/joaquim-verges)! - Added useUpdateNFTMetadata hook
|
||||
|
||||
- Updated dependencies [[`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af)]:
|
||||
- @thirdweb-dev/chains@0.1.76
|
||||
|
||||
## 4.0.38
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/sdk",
|
||||
"version": "4.0.38",
|
||||
"version": "4.0.40",
|
||||
"description": "The main thirdweb SDK.",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/sdk",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -21,6 +21,7 @@ import { type QueryAllParams } from "../../../core/schema/QueryParams";
|
||||
import type {
|
||||
NFT,
|
||||
NFTMetadata,
|
||||
NFTMetadataInput,
|
||||
NFTMetadataOrUri,
|
||||
} from "../../../core/schema/nft";
|
||||
import { resolveAddress } from "../../common/ens/resolveAddress";
|
||||
@@ -749,8 +750,11 @@ export class Erc721<
|
||||
* ```
|
||||
* @twfeature ERC721UpdatableMetadata
|
||||
*/
|
||||
update = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (tokenId: BigNumberish, metadata: NFTMetadataOrUri) => {
|
||||
updateMetadata = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (tokenId: BigNumberish, metadata: NFTMetadataInput) => {
|
||||
if (this.lazyMintable) {
|
||||
return this.lazyMintable.updateMetadata.prepare(tokenId, metadata);
|
||||
}
|
||||
return assertEnabled(
|
||||
this.updatableMetadata,
|
||||
FEATURE_NFT_UPDATABLE_METADATA,
|
||||
@@ -758,6 +762,11 @@ export class Erc721<
|
||||
},
|
||||
);
|
||||
|
||||
// alias for backwards compat
|
||||
async update(tokenId: BigNumberish, metadata: NFTMetadataInput) {
|
||||
return this.updateMetadata(tokenId, metadata);
|
||||
}
|
||||
|
||||
////// ERC721 Claimable Extension //////
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@ import type {
|
||||
IAccountPermissions_V1,
|
||||
} from "@thirdweb-dev/contracts-js";
|
||||
import invariant from "tiny-invariant";
|
||||
import { detectContractFeature } from "../../../../common/feature-detection/detectContractFeature";
|
||||
import { resolveAddress } from "../../../../common/ens/resolveAddress";
|
||||
import { resolveOrGenerateId } from "../../../../common/signature-minting";
|
||||
import { buildTransactionFunction } from "../../../../common/transactions";
|
||||
@@ -94,37 +93,6 @@ export class AccountPermissions implements DetectableFeature {
|
||||
permissions: SignerPermissionsOutput,
|
||||
adminFlag: AdminFlag,
|
||||
): Promise<Transaction> {
|
||||
if (
|
||||
detectContractFeature<IAccountPermissions_V1>(
|
||||
this.contractWrapper,
|
||||
"AccountPermissionsV1",
|
||||
)
|
||||
) {
|
||||
// legacy account permissions contract
|
||||
// admin is set only via EOA
|
||||
// signer permissions are set via EOA or admin but no wildcard
|
||||
if (
|
||||
adminFlag === AdminFlag.AddAdmin ||
|
||||
adminFlag === AdminFlag.RemoveAdmin
|
||||
) {
|
||||
return Transaction.fromContractWrapper({
|
||||
contractWrapper: this.contractWrapper,
|
||||
method: "setAdmin",
|
||||
args: [signerAddress, adminFlag === AdminFlag.AddAdmin],
|
||||
});
|
||||
} else {
|
||||
const { payload, signature } = await this.generateLegacyPayload(
|
||||
signerAddress,
|
||||
permissions,
|
||||
);
|
||||
return Transaction.fromContractWrapper({
|
||||
contractWrapper: this.contractWrapper,
|
||||
method: "setPermissionsForSigner",
|
||||
args: [payload, signature],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const { payload, signature } = await this.generatePayload(
|
||||
signerAddress,
|
||||
permissions,
|
||||
@@ -435,21 +403,8 @@ export class AccountPermissions implements DetectableFeature {
|
||||
permissions: SignerPermissionsInput,
|
||||
): Promise<Transaction> => {
|
||||
const resolvedSignerAddress = await resolveAddress(signerAddress);
|
||||
const resolvedPermissions = await SignerPermissionsSchema.parseAsync(
|
||||
permissions,
|
||||
);
|
||||
|
||||
if (await this.isAdmin(resolvedSignerAddress)) {
|
||||
throw new Error(
|
||||
"Signer is already an admin. Cannot grant permissions to an existing admin.",
|
||||
);
|
||||
}
|
||||
|
||||
if (await this.isSigner(resolvedSignerAddress)) {
|
||||
throw new Error(
|
||||
"Signer already has permissions. Cannot grant permissions to an existing signer. You can update permissions using `updatePermissions`.",
|
||||
);
|
||||
}
|
||||
const resolvedPermissions =
|
||||
await SignerPermissionsSchema.parseAsync(permissions);
|
||||
|
||||
return await this.sendSignerPermissionRequest(
|
||||
resolvedSignerAddress,
|
||||
@@ -481,9 +436,8 @@ export class AccountPermissions implements DetectableFeature {
|
||||
permissions: SignerPermissionsInput,
|
||||
): Promise<Transaction> => {
|
||||
const resolvedSignerAddress = await resolveAddress(signerAddress);
|
||||
const resolvedPermissions = await SignerPermissionsSchema.parseAsync(
|
||||
permissions,
|
||||
);
|
||||
const resolvedPermissions =
|
||||
await SignerPermissionsSchema.parseAsync(permissions);
|
||||
|
||||
if (await this.isAdmin(resolvedSignerAddress)) {
|
||||
throw new Error(
|
||||
@@ -524,18 +478,6 @@ export class AccountPermissions implements DetectableFeature {
|
||||
async (signerAddress: AddressOrEns): Promise<Transaction> => {
|
||||
const resolvedSignerAddress = await resolveAddress(signerAddress);
|
||||
|
||||
if (await this.isAdmin(resolvedSignerAddress)) {
|
||||
throw new Error(
|
||||
"Signer is already an admin. Cannot revoke permissions of an admin.",
|
||||
);
|
||||
}
|
||||
|
||||
if (!(await this.isSigner(resolvedSignerAddress))) {
|
||||
throw new Error(
|
||||
"Signer does not already have permissions. You can grant permissions using `grantPermissions`.",
|
||||
);
|
||||
}
|
||||
|
||||
return await this.sendSignerPermissionRequest(
|
||||
resolvedSignerAddress,
|
||||
{
|
||||
@@ -693,9 +635,8 @@ export class AccountPermissions implements DetectableFeature {
|
||||
async (
|
||||
permissionSnapshot: PermissionSnapshotInput,
|
||||
): Promise<Transaction> => {
|
||||
const resolvedSnapshot = await PermissionSnapshotSchema.parseAsync(
|
||||
permissionSnapshot,
|
||||
);
|
||||
const resolvedSnapshot =
|
||||
await PermissionSnapshotSchema.parseAsync(permissionSnapshot);
|
||||
|
||||
/**
|
||||
* All cases
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type {
|
||||
NFTMetadata,
|
||||
NFTMetadataInput,
|
||||
NFTMetadataOrUri,
|
||||
} from "../../../../../core/schema/nft";
|
||||
import { detectContractFeature } from "../../../../common/feature-detection/detectContractFeature";
|
||||
@@ -15,7 +16,7 @@ import type { TransactionResultWithId } from "../../../types";
|
||||
import type { ContractWrapper } from "../contract-wrapper";
|
||||
import { Transaction } from "../../transactions";
|
||||
import type { ThirdwebStorage } from "@thirdweb-dev/storage";
|
||||
import { utils } from "ethers";
|
||||
import { BigNumber, BigNumberish, utils } from "ethers";
|
||||
import {
|
||||
getBaseUriFromBatch,
|
||||
uploadOrExtractURIs,
|
||||
@@ -24,6 +25,7 @@ import type { BaseDelayedRevealERC721 } from "../../../../types/eips";
|
||||
import { DelayedReveal } from "../../delayed-reveal";
|
||||
import type { TokensLazyMintedEvent } from "@thirdweb-dev/contracts-js/dist/declarations/src/LazyMint";
|
||||
import type { Erc721 } from "../../erc-721";
|
||||
import type { DropERC721 } from "@thirdweb-dev/contracts-js";
|
||||
|
||||
/**
|
||||
* Lazily mint and claim ERC721 NFTs
|
||||
@@ -159,6 +161,74 @@ export class Erc721LazyMintable implements DetectableFeature {
|
||||
},
|
||||
);
|
||||
|
||||
updateMetadata = /* @__PURE__ */ buildTransactionFunction(
|
||||
async (
|
||||
tokenId: BigNumberish,
|
||||
metadata: NFTMetadataInput,
|
||||
options?: {
|
||||
onProgress: (event: UploadProgressEvent) => void;
|
||||
},
|
||||
) => {
|
||||
const batchCount = await this.contractWrapper.read("getBaseURICount", []);
|
||||
if (batchCount.eq(0)) {
|
||||
throw new Error(
|
||||
"No base URI set. Please set a base URI before updating metadata",
|
||||
);
|
||||
}
|
||||
const targetTokenId = BigNumber.from(tokenId);
|
||||
let startTokenId = BigNumber.from(0);
|
||||
let endTokenId = BigNumber.from(0);
|
||||
let batchIndex = 0;
|
||||
for (let i = 0; i < batchCount.toNumber(); i++) {
|
||||
batchIndex = i;
|
||||
endTokenId = await this.contractWrapper.read("getBatchIdAtIndex", [
|
||||
batchIndex,
|
||||
]);
|
||||
if (endTokenId.gt(targetTokenId)) {
|
||||
break;
|
||||
}
|
||||
startTokenId = endTokenId;
|
||||
}
|
||||
// for the entire batch,
|
||||
// 1. download all of the metadata as a list of nft metadata
|
||||
const range = Array.from(
|
||||
{ length: endTokenId.sub(startTokenId).toNumber() },
|
||||
(v, k) => k + startTokenId.toNumber(),
|
||||
);
|
||||
const metadatas = await Promise.all(
|
||||
range.map((id) => this.erc721.getTokenMetadata(id)),
|
||||
);
|
||||
// 2. replace the metadata of the tokenId desired
|
||||
const newMetadatas = [];
|
||||
for (let i = 0; i < metadatas.length; i++) {
|
||||
const { id, uri, ...rest } = metadatas[i];
|
||||
if (BigNumber.from(targetTokenId).eq(BigNumber.from(id))) {
|
||||
newMetadatas.push(metadata);
|
||||
} else {
|
||||
void uri; // linter
|
||||
newMetadatas.push(rest);
|
||||
}
|
||||
}
|
||||
// 3. re-upload the entire batch with the correct starting number
|
||||
const batch = await uploadOrExtractURIs(
|
||||
newMetadatas,
|
||||
this.storage,
|
||||
startTokenId.toNumber(),
|
||||
options,
|
||||
);
|
||||
const baseUri = batch[0].substring(0, batch[0].lastIndexOf("/"));
|
||||
// 4. update the base uri for the entire batch
|
||||
return Transaction.fromContractWrapper({
|
||||
contractWrapper: this.contractWrapper as ContractWrapper<DropERC721>, // TODO contract detection
|
||||
method: "updateBatchBaseURI",
|
||||
args: [
|
||||
batchIndex,
|
||||
`${baseUri.endsWith("/") ? baseUri : `${baseUri}/`}`,
|
||||
],
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
/** ******************************
|
||||
* PRIVATE FUNCTIONS
|
||||
*******************************/
|
||||
|
||||
@@ -143,9 +143,8 @@ describe("Accounts with account factory", function () {
|
||||
"Correct admin for account.",
|
||||
);
|
||||
|
||||
const associatedAccounts = await accountFactory.getAssociatedAccounts(
|
||||
admin,
|
||||
);
|
||||
const associatedAccounts =
|
||||
await accountFactory.getAssociatedAccounts(admin);
|
||||
|
||||
assert.isTrue(
|
||||
associatedAccounts.length === 1,
|
||||
@@ -361,24 +360,38 @@ describe("Accounts with account factory", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("Should not be able to grant restricted access to a signer who already has access.", async () => {
|
||||
it("Should be able to update permissions by granting restricted access to a signer who already has access.", async () => {
|
||||
// Grant access to signer1
|
||||
await account.grantPermissions(signer1Wallet.address, {
|
||||
nativeTokenLimitPerTransaction: "1",
|
||||
approvedCallTargets: [adminWallet.address],
|
||||
});
|
||||
|
||||
// Store permissions
|
||||
const signersWithRestrictions = await account.getAllSigners();
|
||||
const restrictions = signersWithRestrictions.find(
|
||||
(result) =>
|
||||
utils.getAddress(result.signer) ===
|
||||
utils.getAddress(signer1Wallet.address),
|
||||
)?.permissions as SignerPermissions;
|
||||
|
||||
// Try granting access to signer1 again
|
||||
try {
|
||||
await account.grantPermissions(signer1Wallet.address, {
|
||||
approvedCallTargets: [adminWallet.address],
|
||||
});
|
||||
expect.fail();
|
||||
} catch (err: any) {
|
||||
expect(err.message).to.equal(
|
||||
"Signer already has permissions. Cannot grant permissions to an existing signer. You can update permissions using `updatePermissions`.",
|
||||
);
|
||||
}
|
||||
await account.grantPermissions(signer1Wallet.address, {
|
||||
approvedCallTargets: [adminWallet.address, signer2Wallet.address],
|
||||
});
|
||||
|
||||
const newSignersWithRestrictions = await account.getAllSigners();
|
||||
const newRestrictions = newSignersWithRestrictions.find(
|
||||
(result) =>
|
||||
utils.getAddress(result.signer) ===
|
||||
utils.getAddress(signer1Wallet.address),
|
||||
)?.permissions as SignerPermissions;
|
||||
|
||||
assert.strictEqual(
|
||||
newRestrictions.approvedCallTargets.length,
|
||||
2,
|
||||
"New signer1 should have two approved call targets.",
|
||||
);
|
||||
});
|
||||
|
||||
it("Should be able to revoke restricted access from an authorized signer.", async () => {
|
||||
@@ -418,7 +431,7 @@ describe("Accounts with account factory", function () {
|
||||
);
|
||||
});
|
||||
|
||||
it("Should not be able to revoke restricted access from a signer who doesn't have access.", async () => {
|
||||
it("Should be able to revoke restricted access from a signer who doesn't have access with no effect.", async () => {
|
||||
const signersWithRestrictions = await account.getAllSigners();
|
||||
assert.isFalse(
|
||||
signersWithRestrictions
|
||||
@@ -428,14 +441,15 @@ describe("Accounts with account factory", function () {
|
||||
);
|
||||
|
||||
// Try revoking access from signer1
|
||||
try {
|
||||
await account.revokeAccess(signer1Wallet.address);
|
||||
expect.fail();
|
||||
} catch (err: any) {
|
||||
expect(err.message).to.equal(
|
||||
"Signer does not already have permissions. You can grant permissions using `grantPermissions`.",
|
||||
);
|
||||
}
|
||||
await account.revokeAccess(signer1Wallet.address);
|
||||
|
||||
const newSignersWithRestrictions = await account.getAllSigners();
|
||||
assert.isFalse(
|
||||
newSignersWithRestrictions
|
||||
.map((result) => utils.getAddress(result.signer))
|
||||
.includes(signer1Wallet.address),
|
||||
"New signer should not have access to the account.",
|
||||
);
|
||||
});
|
||||
|
||||
it("Should be able to update access of an authorized signer.", async () => {
|
||||
|
||||
@@ -40,9 +40,11 @@ describe("NFT Drop Contract (v4)", async () => {
|
||||
platform_fee_basis_points: 10,
|
||||
platform_fee_recipient: AddressZero,
|
||||
},
|
||||
await sdk.deployer.getLatestBuiltInContractVersion(
|
||||
NFTDropInitializer.contractType,
|
||||
),
|
||||
(
|
||||
await sdk.deployer.getLatestBuiltInContractVersion(
|
||||
NFTDropInitializer.contractType,
|
||||
)
|
||||
).toString(),
|
||||
);
|
||||
dropContract = await sdk.getNFTDrop(address);
|
||||
});
|
||||
@@ -357,8 +359,8 @@ describe("NFT Drop Contract (v4)", async () => {
|
||||
i % 3 === 0
|
||||
? w.address.toLowerCase()
|
||||
: i % 3 === 1
|
||||
? w.address.toUpperCase().replace("0X", "0x")
|
||||
: w.address,
|
||||
? w.address.toUpperCase().replace("0X", "0x")
|
||||
: w.address,
|
||||
)
|
||||
.map((a) => ({
|
||||
address: a,
|
||||
@@ -1289,4 +1291,100 @@ describe("NFT Drop Contract (v4)", async () => {
|
||||
await dropContract.revealer.reveal(1, "my secret password");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Update metadata", () => {
|
||||
it("should update metadata", async () => {
|
||||
const tokens = [
|
||||
{
|
||||
name: "test 0",
|
||||
},
|
||||
{
|
||||
name: "test 1",
|
||||
},
|
||||
{
|
||||
name: "test 2",
|
||||
},
|
||||
{
|
||||
name: "test 3",
|
||||
},
|
||||
{
|
||||
name: "test 4",
|
||||
},
|
||||
];
|
||||
const result = await dropContract.createBatch(tokens);
|
||||
assert.lengthOf(result, tokens.length);
|
||||
for (const token of tokens) {
|
||||
const found = result.find(
|
||||
async (t) => (await t.data()).name === token.name,
|
||||
);
|
||||
assert.isDefined(found);
|
||||
}
|
||||
|
||||
const token = await dropContract.get(1);
|
||||
expect(token.metadata.name).to.eq("test 1");
|
||||
await dropContract.erc721.updateMetadata(1, {
|
||||
name: "test 123",
|
||||
});
|
||||
const token2 = await dropContract.get(1);
|
||||
expect(token2.metadata.name).to.eq("test 123");
|
||||
});
|
||||
|
||||
it("should update metadata from diff batch", async () => {
|
||||
const tokens = [
|
||||
{
|
||||
name: "test 0",
|
||||
},
|
||||
{
|
||||
name: "test 1",
|
||||
},
|
||||
{
|
||||
name: "test 2",
|
||||
},
|
||||
];
|
||||
const result = await dropContract.createBatch(tokens);
|
||||
assert.lengthOf(result, tokens.length);
|
||||
|
||||
const tokens2 = [
|
||||
{
|
||||
name: "test 3",
|
||||
},
|
||||
{
|
||||
name: "test 4",
|
||||
},
|
||||
];
|
||||
const result2 = await dropContract.createBatch(tokens2);
|
||||
assert.lengthOf(result2, tokens2.length);
|
||||
|
||||
let token = await dropContract.get("3");
|
||||
expect(token.metadata.name).to.eq("test 3");
|
||||
await dropContract.erc721.updateMetadata(3, {
|
||||
name: "test 123",
|
||||
});
|
||||
token = await dropContract.get("3");
|
||||
expect(token.metadata.name).to.eq("test 123");
|
||||
});
|
||||
|
||||
it("metadata update after reveal correctly", async () => {
|
||||
await dropContract.revealer.createDelayedRevealBatch(
|
||||
{
|
||||
name: "Placeholder #1",
|
||||
},
|
||||
[{ name: "NFT #1" }, { name: "NFT #2" }],
|
||||
"my secret password",
|
||||
);
|
||||
|
||||
expect((await dropContract.get("0")).metadata.name).to.be.equal(
|
||||
"Placeholder #1",
|
||||
);
|
||||
|
||||
await dropContract.revealer.reveal(0, "my secret password");
|
||||
await dropContract.erc721.updateMetadata(0, {
|
||||
name: "NFT 123",
|
||||
});
|
||||
|
||||
expect((await dropContract.get("0")).metadata.name).to.be.equal(
|
||||
"NFT 123",
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,31 @@
|
||||
# @thirdweb-dev/unity-js-bridge
|
||||
|
||||
## 0.4.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2415](https://github.com/thirdweb-dev/js/pull/2415) [`a3f6878`](https://github.com/thirdweb-dev/js/commit/a3f6878649345ea7b647d085d5d7d536af82948f) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Unity] Remove unnecessary logs, add getEmail check
|
||||
|
||||
- Updated dependencies [[`74a92dc`](https://github.com/thirdweb-dev/js/commit/74a92dcb7dc4be7d03bcb8b7211e87016f52a81f), [`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d)]:
|
||||
- @thirdweb-dev/wallets@2.4.15
|
||||
- @thirdweb-dev/chains@0.1.77
|
||||
- @thirdweb-dev/auth@4.1.37
|
||||
- @thirdweb-dev/sdk@4.0.40
|
||||
|
||||
## 0.4.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2379](https://github.com/thirdweb-dev/js/pull/2379) [`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Smart Wallet] Do not deploy to sign typed data, allow presigned deploy+session key
|
||||
|
||||
- [#2388](https://github.com/thirdweb-dev/js/pull/2388) [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Smart Wallet] ERC20Paymaster Generic Support
|
||||
|
||||
- Updated dependencies [[`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022), [`9c7fbc1`](https://github.com/thirdweb-dev/js/commit/9c7fbc1603a7265209b6f56c2284fdb0e6b33a1d), [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f), [`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af), [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825)]:
|
||||
- @thirdweb-dev/wallets@2.4.14
|
||||
- @thirdweb-dev/sdk@4.0.39
|
||||
- @thirdweb-dev/chains@0.1.76
|
||||
- @thirdweb-dev/auth@4.1.36
|
||||
|
||||
## 0.4.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/unity-js-bridge",
|
||||
"version": "0.4.1",
|
||||
"version": "0.4.3",
|
||||
"main": "dist/thirdweb-unity-bridge.js",
|
||||
"repository": "https://github.com/thirdweb-dev/js/tree/main/packages/unity-js-bridge",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -144,11 +144,10 @@ class ThirdwebBridge implements TWBridge {
|
||||
}
|
||||
(globalThis as any).X_SDK_NAME = "UnitySDK_WebGL";
|
||||
(globalThis as any).X_SDK_PLATFORM = "unity";
|
||||
(globalThis as any).X_SDK_VERSION = "4.7.1";
|
||||
(globalThis as any).X_SDK_VERSION = "4.7.6";
|
||||
(globalThis as any).X_SDK_OS = browser?.os ?? "unknown";
|
||||
}
|
||||
this.initializedChain = chain;
|
||||
console.debug("thirdwebSDK initialization:", chain, options);
|
||||
const sdkOptions = JSON.parse(options);
|
||||
let supportedChains;
|
||||
if (sdkOptions?.supportedChains) {
|
||||
@@ -167,7 +166,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
supportedChains = defaultChains;
|
||||
}
|
||||
} else {
|
||||
console.debug("no supportedChains passed, using default chains");
|
||||
console.warn("no supportedChains passed, using default chains");
|
||||
supportedChains = defaultChains;
|
||||
}
|
||||
sdkOptions.supportedChains = supportedChains;
|
||||
@@ -244,6 +243,9 @@ class ThirdwebBridge implements TWBridge {
|
||||
paymasterUrl: sdkOptions.smartWalletConfig?.paymasterUrl,
|
||||
// paymasterAPI: sdkOptions.smartWalletConfig?.paymasterAPI,
|
||||
entryPointAddress: sdkOptions.smartWalletConfig?.entryPointAddress,
|
||||
erc20PaymasterAddress:
|
||||
sdkOptions.smartWalletConfig?.erc20PaymasterAddress,
|
||||
erc20TokenAddress: sdkOptions.smartWalletConfig?.erc20TokenAddress,
|
||||
};
|
||||
walletInstance = new SmartWallet(config);
|
||||
break;
|
||||
@@ -381,6 +383,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
personalWallet,
|
||||
authOptions,
|
||||
);
|
||||
await this.switchNetwork(chainId); // workaround for polygon/mumbai
|
||||
if (this.activeWallet) {
|
||||
// Pass EOA and reconnect to initialize smart wallet
|
||||
await this.initializeSmartWallet(
|
||||
@@ -442,7 +445,7 @@ class ThirdwebBridge implements TWBridge {
|
||||
return arg;
|
||||
}
|
||||
});
|
||||
console.debug("thirdwebSDK call:", route, parsedArgs);
|
||||
// console.debug("thirdwebSDK call:", route, parsedArgs);
|
||||
|
||||
// wallet call
|
||||
if (addrOrSDK.startsWith("sdk")) {
|
||||
@@ -513,7 +516,10 @@ class ThirdwebBridge implements TWBridge {
|
||||
// ccipReadEnabled: txInput.ccipReadEnabled,
|
||||
});
|
||||
|
||||
if (routeArgs[2].includes("send")) {
|
||||
if (routeArgs[2].includes("sign")) {
|
||||
const result = await tx.sign();
|
||||
return JSON.stringify({ result: result }, bigNumberReplacer);
|
||||
} else if (routeArgs[2].includes("send")) {
|
||||
tx.setGaslessOptions(
|
||||
routeArgs[2] === "sendGasless"
|
||||
? this.activeSDK.options.gasless
|
||||
@@ -594,14 +600,6 @@ class ThirdwebBridge implements TWBridge {
|
||||
}
|
||||
});
|
||||
|
||||
console.debug(
|
||||
"thirdwebSDK invoke listener:",
|
||||
taskId,
|
||||
route,
|
||||
parsedFnArgs,
|
||||
action,
|
||||
);
|
||||
|
||||
// contract call
|
||||
if (addrOrSDK.startsWith("0x")) {
|
||||
let typeOrAbi: string | ContractInterface | undefined;
|
||||
@@ -666,14 +664,6 @@ class ThirdwebBridge implements TWBridge {
|
||||
personalWallet: AbstractClientWallet,
|
||||
accountAddress?: string,
|
||||
) {
|
||||
if (accountAddress) {
|
||||
console.debug(
|
||||
"Initializing smart wallet with account address override:",
|
||||
accountAddress,
|
||||
);
|
||||
}
|
||||
const personalWalletAddress = await personalWallet.getAddress();
|
||||
console.debug("Personal wallet address:", personalWalletAddress);
|
||||
await sw.connect({
|
||||
personalWallet,
|
||||
accountAddress: accountAddress,
|
||||
@@ -801,6 +791,9 @@ class ThirdwebBridge implements TWBridge {
|
||||
}
|
||||
|
||||
public async getEmail() {
|
||||
if (!this.activeWallet) {
|
||||
throw new Error("No wallet connected");
|
||||
}
|
||||
const embeddedWallet = this.walletMap.get(
|
||||
walletIds.embeddedWallet,
|
||||
) as EmbeddedWallet;
|
||||
@@ -818,9 +811,6 @@ class ThirdwebBridge implements TWBridge {
|
||||
const res = await signer?.getAddress();
|
||||
return JSON.stringify({ result: res }, bigNumberReplacer);
|
||||
} catch {
|
||||
console.debug(
|
||||
"Could not find a smart wallet, defaulting to normal signer",
|
||||
);
|
||||
const signer = await this.activeWallet.getSigner();
|
||||
const res = await signer.getAddress();
|
||||
return JSON.stringify({ result: res }, bigNumberReplacer);
|
||||
|
||||
@@ -1,5 +1,27 @@
|
||||
# @thirdweb-dev/wallets
|
||||
|
||||
## 2.4.15
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2414](https://github.com/thirdweb-dev/js/pull/2414) [`74a92dc`](https://github.com/thirdweb-dev/js/commit/74a92dcb7dc4be7d03bcb8b7211e87016f52a81f) Thanks [@jnsdls](https://github.com/jnsdls)! - properly pass through clientId and secretKey variables to verifySignature functions
|
||||
|
||||
- Updated dependencies [[`047fbe2`](https://github.com/thirdweb-dev/js/commit/047fbe2918808cbc8fded90104458b6e38d1207d)]:
|
||||
- @thirdweb-dev/chains@0.1.77
|
||||
- @thirdweb-dev/sdk@4.0.40
|
||||
|
||||
## 2.4.14
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#2379](https://github.com/thirdweb-dev/js/pull/2379) [`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Smart Wallet] Do not deploy to sign typed data, allow presigned deploy+session key
|
||||
|
||||
- [#2388](https://github.com/thirdweb-dev/js/pull/2388) [`f80f630`](https://github.com/thirdweb-dev/js/commit/f80f6307a3ebe1adaaf072dd2e02aecf83bfa43f) Thanks [@0xFirekeeper](https://github.com/0xFirekeeper)! - [Smart Wallet] ERC20Paymaster Generic Support
|
||||
|
||||
- Updated dependencies [[`ab44b8f`](https://github.com/thirdweb-dev/js/commit/ab44b8f0ae760065f400f76d69703e26bcbcc022), [`9c7fbc1`](https://github.com/thirdweb-dev/js/commit/9c7fbc1603a7265209b6f56c2284fdb0e6b33a1d), [`5f243bb`](https://github.com/thirdweb-dev/js/commit/5f243bba0ded5dace9344c79e8904a4a342d16af), [`7d8697e`](https://github.com/thirdweb-dev/js/commit/7d8697ec3ff72f33dda151e7eb82f5ff19c1f825)]:
|
||||
- @thirdweb-dev/sdk@4.0.39
|
||||
- @thirdweb-dev/chains@0.1.76
|
||||
|
||||
## 2.4.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@thirdweb-dev/wallets",
|
||||
"version": "2.4.13",
|
||||
"version": "2.4.15",
|
||||
"main": "dist/thirdweb-dev-wallets.cjs.js",
|
||||
"module": "dist/thirdweb-dev-wallets.esm.js",
|
||||
"browser": {
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
TransactionOptions,
|
||||
UserOpOptions,
|
||||
} from "./types";
|
||||
import { ENTRYPOINT_ADDRESS } from "./lib/constants";
|
||||
import { ACCOUNT_CORE_ABI, ENTRYPOINT_ADDRESS } from "./lib/constants";
|
||||
import { EVMWallet } from "../../interfaces";
|
||||
import { ERC4337EthersSigner } from "./lib/erc4337-signer";
|
||||
import { BigNumber, constants, ethers, providers, utils } from "ethers";
|
||||
@@ -75,6 +75,8 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
accountInfo: config.accountInfo || this.defaultAccountInfo(),
|
||||
clientId: config.clientId,
|
||||
secretKey: config.secretKey,
|
||||
erc20PaymasterAddress: config.erc20PaymasterAddress,
|
||||
erc20TokenAddress: config.erc20TokenAddress,
|
||||
};
|
||||
this.personalWallet = params.personalWallet;
|
||||
const accountApi = new AccountAPI(providerConfig, originalProvider);
|
||||
@@ -448,25 +450,21 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
target: string,
|
||||
permissions: SignerPermissionsInput,
|
||||
): Promise<TransactionResult> {
|
||||
await this.deployIfNeeded();
|
||||
const accountContract = await this.getAccountContract();
|
||||
return accountContract.account.grantPermissions(target, permissions);
|
||||
}
|
||||
|
||||
async revokePermissions(target: string): Promise<TransactionResult> {
|
||||
await this.deployIfNeeded();
|
||||
const accountContract = await this.getAccountContract();
|
||||
return accountContract.account.revokeAccess(target);
|
||||
}
|
||||
|
||||
async addAdmin(target: string): Promise<TransactionResult> {
|
||||
await this.deployIfNeeded();
|
||||
const accountContract = await this.getAccountContract();
|
||||
return accountContract.account.grantAdminPermissions(target);
|
||||
}
|
||||
|
||||
async removeAdmin(target: string): Promise<TransactionResult> {
|
||||
await this.deployIfNeeded();
|
||||
const accountContract = await this.getAccountContract();
|
||||
return accountContract.account.revokeAdminPermissions(target);
|
||||
}
|
||||
@@ -501,12 +499,6 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
* @returns The account contract of the smart wallet.
|
||||
*/
|
||||
async getAccountContract(): Promise<SmartContract> {
|
||||
const isDeployed = await this.isDeployed();
|
||||
if (!isDeployed) {
|
||||
throw new Error(
|
||||
"Account contract is not deployed yet. You can deploy it manually using SmartWallet.deploy(), or by executing a transaction from this wallet.",
|
||||
);
|
||||
}
|
||||
// getting a new instance everytime
|
||||
// to avoid caching issues pre/post deployment
|
||||
const sdk = ThirdwebSDK.fromSigner(
|
||||
@@ -523,7 +515,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
this.config.accountInfo.abi,
|
||||
);
|
||||
} else {
|
||||
return sdk.getContract(await this.getAddress());
|
||||
return sdk.getContract(await this.getAddress(), ACCOUNT_CORE_ABI);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,6 +583,7 @@ export class SmartWalletConnector extends Connector<SmartWalletConnectionArgs> {
|
||||
this.getProvider(),
|
||||
this.isDeployed(),
|
||||
]);
|
||||
|
||||
if (!isDeployed) {
|
||||
deployGasLimit = await this.estimateDeploymentGasLimit();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,15 @@ import {
|
||||
ThirdwebSDK,
|
||||
Transaction,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import { BigNumberish, BigNumber, ethers, utils, BytesLike } from "ethers";
|
||||
import {
|
||||
BigNumberish,
|
||||
BigNumber,
|
||||
ethers,
|
||||
utils,
|
||||
BytesLike,
|
||||
providers,
|
||||
Contract,
|
||||
} from "ethers";
|
||||
import { ProviderConfig } from "../types";
|
||||
import { BaseAccountAPI } from "./base-api";
|
||||
import { ACCOUNT_CORE_ABI } from "./constants";
|
||||
@@ -59,21 +67,11 @@ export class AccountAPI extends BaseAccountAPI {
|
||||
|
||||
async getAccountInitCode(): Promise<string> {
|
||||
const factory = await this.getFactoryContract();
|
||||
console.log("Deploying smart wallet via factory");
|
||||
const localSigner = await this.params.localSigner.getAddress();
|
||||
const tx = await this.params.factoryInfo.createAccount(
|
||||
factory,
|
||||
localSigner,
|
||||
);
|
||||
try {
|
||||
console.log(
|
||||
"Cost to deploy smart wallet: ",
|
||||
(await tx.estimateGasCost()).ether,
|
||||
"ETH",
|
||||
);
|
||||
} catch (e) {
|
||||
console.error("Cost to deploy smart wallet: unknown", e);
|
||||
}
|
||||
return utils.hexConcat([factory.getAddress(), tx.encode()]);
|
||||
}
|
||||
|
||||
@@ -143,4 +141,53 @@ export class AccountAPI extends BaseAccountAPI {
|
||||
async isAcountDeployed() {
|
||||
return !(await this.checkAccountPhantom());
|
||||
}
|
||||
|
||||
async isAccountApproved() {
|
||||
if (!this.params.erc20PaymasterAddress || !this.params.erc20TokenAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const swAddress = await this.getCounterFactualAddress();
|
||||
const ERC20Abi = (
|
||||
await import("@thirdweb-dev/contracts-js/dist/abis/IERC20.json")
|
||||
).default;
|
||||
const erc20Token = await this.sdk.getContract(
|
||||
this.params.erc20TokenAddress,
|
||||
ERC20Abi,
|
||||
);
|
||||
|
||||
const allowance = await erc20Token.call("allowance", [
|
||||
swAddress,
|
||||
this.params.erc20PaymasterAddress,
|
||||
]);
|
||||
|
||||
return allowance.gte(BigNumber.from(2).pow(96).sub(1));
|
||||
}
|
||||
|
||||
async createApproveTx(): Promise<providers.TransactionRequest | undefined> {
|
||||
if (await this.isAccountApproved()) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const amountToApprove = BigNumber.from(2).pow(96).sub(1);
|
||||
const ethersSigner = new ethers.Wallet(LOCAL_NODE_PKEY, this.provider);
|
||||
const erc20Contract = new Contract(
|
||||
this.params.erc20TokenAddress as string,
|
||||
[
|
||||
"function approve(address spender, uint256 amount) public returns (bool)",
|
||||
],
|
||||
ethersSigner,
|
||||
);
|
||||
const tx: ethers.providers.TransactionRequest = {
|
||||
to: this.params.erc20TokenAddress,
|
||||
from: await this.getAccountAddress(),
|
||||
value: 0,
|
||||
data: erc20Contract.interface.encodeFunctionData("approve", [
|
||||
this.params.erc20PaymasterAddress,
|
||||
amountToApprove,
|
||||
]),
|
||||
};
|
||||
|
||||
return tx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,8 @@ export abstract class BaseAccountAPI {
|
||||
paymasterAPI: PaymasterAPI;
|
||||
accountAddress?: string;
|
||||
gasless?: boolean;
|
||||
erc20PaymasterAddress?: string;
|
||||
erc20TokenAddress?: string;
|
||||
|
||||
/**
|
||||
* base constructor.
|
||||
@@ -54,6 +56,8 @@ export abstract class BaseAccountAPI {
|
||||
this.accountAddress = params.accountAddress;
|
||||
this.paymasterAPI = params.paymasterAPI;
|
||||
this.gasless = params.gasless;
|
||||
this.erc20PaymasterAddress = params.erc20PaymasterAddress;
|
||||
this.erc20TokenAddress = params.erc20TokenAddress;
|
||||
|
||||
// factory "connect" define the contract address. the contract "connect" defines the "from" address.
|
||||
this.entryPointView = EntryPoint__factory.connect(
|
||||
@@ -113,6 +117,10 @@ export abstract class BaseAccountAPI {
|
||||
return this.isPhantom;
|
||||
}
|
||||
|
||||
abstract isAccountApproved(): Promise<boolean>;
|
||||
|
||||
abstract createApproveTx(): Promise<providers.TransactionRequest | undefined>;
|
||||
|
||||
/**
|
||||
* return initCode value to into the UserOp.
|
||||
* (either deployment code, or empty hex if contract already deployed)
|
||||
@@ -230,7 +238,26 @@ export abstract class BaseAccountAPI {
|
||||
// paymaster data + maybe used for estimation as well
|
||||
const gasless =
|
||||
options?.gasless !== undefined ? options.gasless : this.gasless;
|
||||
if (gasless) {
|
||||
const useErc20Paymaster =
|
||||
this.erc20PaymasterAddress &&
|
||||
this.erc20TokenAddress &&
|
||||
(await this.isAccountApproved());
|
||||
if (useErc20Paymaster) {
|
||||
partialOp.paymasterAndData = this.erc20PaymasterAddress as string;
|
||||
let estimates;
|
||||
try {
|
||||
estimates = await httpRpcClient.estimateUserOpGas(partialOp);
|
||||
} catch (error: any) {
|
||||
throw this.unwrapBundlerError(error);
|
||||
}
|
||||
partialOp.callGasLimit = BigNumber.from(estimates.callGasLimit);
|
||||
partialOp.verificationGasLimit = BigNumber.from(
|
||||
estimates.verificationGasLimit,
|
||||
);
|
||||
partialOp.preVerificationGas = BigNumber.from(
|
||||
estimates.preVerificationGas,
|
||||
);
|
||||
} else if (gasless) {
|
||||
const paymasterResult =
|
||||
await this.paymasterAPI.getPaymasterAndData(partialOp);
|
||||
const paymasterAndData = paymasterResult.paymasterAndData;
|
||||
|
||||
@@ -11,6 +11,8 @@ import {
|
||||
checkContractWalletSignature,
|
||||
chainIdToThirdwebRpc,
|
||||
} from "../../../wallets/abstract";
|
||||
import { setAnalyticsHeaders } from "../../../utils/headers";
|
||||
import { isTwUrl } from "../../../utils/url";
|
||||
|
||||
export class ERC4337EthersSigner extends Signer {
|
||||
config: ProviderConfig;
|
||||
@@ -18,6 +20,7 @@ export class ERC4337EthersSigner extends Signer {
|
||||
erc4337provider: ERC4337EthersProvider;
|
||||
httpRpcClient: HttpRpcClient;
|
||||
smartAccountAPI: BaseAccountAPI;
|
||||
approving: boolean;
|
||||
|
||||
// TODO: we have 'erc4337provider', remove shared dependencies or avoid two-way reference
|
||||
constructor(
|
||||
@@ -34,6 +37,7 @@ export class ERC4337EthersSigner extends Signer {
|
||||
this.erc4337provider = erc4337provider;
|
||||
this.httpRpcClient = httpRpcClient;
|
||||
this.smartAccountAPI = smartAccountAPI;
|
||||
this.approving = false;
|
||||
}
|
||||
|
||||
address?: string;
|
||||
@@ -43,6 +47,14 @@ export class ERC4337EthersSigner extends Signer {
|
||||
transaction: utils.Deferrable<providers.TransactionRequest>,
|
||||
options?: UserOpOptions,
|
||||
): Promise<providers.TransactionResponse> {
|
||||
if (!this.approving) {
|
||||
this.approving = true;
|
||||
const tx = await this.smartAccountAPI.createApproveTx();
|
||||
if (tx) {
|
||||
await (await this.sendTransaction(tx)).wait();
|
||||
}
|
||||
this.approving = false;
|
||||
}
|
||||
const tx = await ethers.utils.resolveProperties(transaction);
|
||||
await this.verifyAllNecessaryFields(tx);
|
||||
|
||||
@@ -93,7 +105,7 @@ export class ERC4337EthersSigner extends Signer {
|
||||
errorIn.reason;
|
||||
|
||||
if (failedOpMessage?.includes("FailedOp")) {
|
||||
let paymasterInfo: string = "";
|
||||
let paymasterInfo = "";
|
||||
// TODO: better error extraction methods will be needed
|
||||
const matched = failedOpMessage.match(/FailedOp\((.*)\)/);
|
||||
|
||||
@@ -169,9 +181,58 @@ Code: ${errorCode}`;
|
||||
let factorySupports712: boolean;
|
||||
let signature: string;
|
||||
|
||||
const rpcUrl = chainIdToThirdwebRpc(chainId, this.config.clientId);
|
||||
|
||||
const headers: Record<string, string> = {};
|
||||
|
||||
if (isTwUrl(rpcUrl)) {
|
||||
const bundleId =
|
||||
typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis
|
||||
? ((globalThis as any).APP_BUNDLE_ID as string)
|
||||
: undefined;
|
||||
|
||||
if (this.config.secretKey) {
|
||||
headers["x-secret-key"] = this.config.secretKey;
|
||||
} else if (this.config.clientId) {
|
||||
headers["x-client-id"] = this.config.clientId;
|
||||
|
||||
if (bundleId) {
|
||||
headers["x-bundle-id"] = bundleId;
|
||||
}
|
||||
}
|
||||
|
||||
// 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";
|
||||
}
|
||||
|
||||
setAnalyticsHeaders(headers);
|
||||
}
|
||||
|
||||
try {
|
||||
const provider = new providers.JsonRpcProvider(
|
||||
chainIdToThirdwebRpc(chainId, this.config.clientId),
|
||||
const provider = new providers.StaticJsonRpcProvider(
|
||||
{
|
||||
url: chainIdToThirdwebRpc(chainId, this.config.clientId),
|
||||
headers,
|
||||
},
|
||||
chainId,
|
||||
);
|
||||
const walletContract = new Contract(
|
||||
@@ -212,6 +273,8 @@ Code: ${errorCode}`;
|
||||
signature,
|
||||
address,
|
||||
chainId,
|
||||
this.config.clientId,
|
||||
this.config.secretKey,
|
||||
);
|
||||
|
||||
if (isValid) {
|
||||
|
||||
@@ -69,7 +69,7 @@ export class HttpRpcClient {
|
||||
setAnalyticsHeaders(headers);
|
||||
}
|
||||
|
||||
this.userOpJsonRpcProvider = new providers.JsonRpcProvider(
|
||||
this.userOpJsonRpcProvider = new providers.StaticJsonRpcProvider(
|
||||
{
|
||||
url: this.bundlerUrl,
|
||||
headers,
|
||||
|
||||
@@ -22,6 +22,8 @@ export type SmartWalletConfig = {
|
||||
paymasterUrl?: string;
|
||||
paymasterAPI?: PaymasterAPI;
|
||||
entryPointAddress?: string;
|
||||
erc20PaymasterAddress?: string;
|
||||
erc20TokenAddress?: string;
|
||||
} & ContractInfoInput &
|
||||
WalletConnectReceiverConfig;
|
||||
|
||||
@@ -42,6 +44,8 @@ export interface ProviderConfig extends ContractInfo {
|
||||
accountAddress?: string;
|
||||
paymasterAPI: PaymasterAPI;
|
||||
gasless: boolean;
|
||||
erc20PaymasterAddress?: string;
|
||||
erc20TokenAddress?: string;
|
||||
}
|
||||
|
||||
export type ContractInfoInput = {
|
||||
@@ -116,6 +120,8 @@ export interface BaseApiParams {
|
||||
paymasterAPI: PaymasterAPI;
|
||||
accountAddress?: string;
|
||||
gasless: boolean;
|
||||
erc20PaymasterAddress?: string;
|
||||
erc20TokenAddress?: string;
|
||||
}
|
||||
|
||||
export interface UserOpResult {
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
normalizePriceValue,
|
||||
} from "@thirdweb-dev/sdk";
|
||||
import { createErc20 } from "../utils/currency";
|
||||
import { isTwUrl } from "../utils/url";
|
||||
import { setAnalyticsHeaders } from "../utils/headers";
|
||||
|
||||
// TODO improve this
|
||||
export function chainIdToThirdwebRpc(chainId: number, clientId?: string) {
|
||||
@@ -49,6 +51,8 @@ export async function checkContractWalletSignature(
|
||||
signature: string,
|
||||
address: string,
|
||||
chainId: number,
|
||||
clientId?: string,
|
||||
secretKey?: string,
|
||||
): Promise<boolean> {
|
||||
// TODO: remove below `skipFetchSetup` logic when ethers.js v6 support arrives
|
||||
let _skipFetchSetup = false;
|
||||
@@ -60,11 +64,60 @@ export async function checkContractWalletSignature(
|
||||
_skipFetchSetup = (globalThis as any).TW_SKIP_FETCH_SETUP as boolean;
|
||||
}
|
||||
|
||||
//TODO: A provider should be passed in instead of creating a new one here.
|
||||
const provider = new providers.JsonRpcProvider({
|
||||
url: chainIdToThirdwebRpc(chainId),
|
||||
skipFetchSetup: _skipFetchSetup,
|
||||
});
|
||||
const rpcUrl = chainIdToThirdwebRpc(chainId, clientId);
|
||||
|
||||
const headers: Record<string, string> = {};
|
||||
|
||||
if (isTwUrl(rpcUrl)) {
|
||||
const bundleId =
|
||||
typeof globalThis !== "undefined" && "APP_BUNDLE_ID" in globalThis
|
||||
? ((globalThis as any).APP_BUNDLE_ID as string)
|
||||
: undefined;
|
||||
|
||||
if (secretKey) {
|
||||
headers["x-secret-key"] = secretKey;
|
||||
} else if (clientId) {
|
||||
headers["x-client-id"] = clientId;
|
||||
|
||||
if (bundleId) {
|
||||
headers["x-bundle-id"] = bundleId;
|
||||
}
|
||||
}
|
||||
|
||||
// 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";
|
||||
}
|
||||
|
||||
setAnalyticsHeaders(headers);
|
||||
}
|
||||
|
||||
const provider = new providers.StaticJsonRpcProvider(
|
||||
{
|
||||
url: chainIdToThirdwebRpc(chainId),
|
||||
skipFetchSetup: _skipFetchSetup,
|
||||
headers,
|
||||
},
|
||||
chainId,
|
||||
);
|
||||
const walletContract = new Contract(address, EIP1271_ABI, provider);
|
||||
try {
|
||||
const res = await walletContract.isValidSignature(
|
||||
@@ -201,6 +254,8 @@ export abstract class AbstractWallet
|
||||
signature: string,
|
||||
address: string,
|
||||
chainId?: number,
|
||||
clientId?: string,
|
||||
secretKey?: string,
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
const messageHash = utils.hashMessage(message);
|
||||
@@ -225,6 +280,8 @@ export abstract class AbstractWallet
|
||||
signature,
|
||||
address,
|
||||
chainId || 1,
|
||||
clientId,
|
||||
secretKey,
|
||||
);
|
||||
return isValid;
|
||||
} catch {
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
/* eslint-disable better-tree-shaking/no-top-level-side-effects */
|
||||
import { SmartWallet } from "../src/evm/wallets/smart-wallet";
|
||||
import { LocalWallet } from "../src/evm/wallets/local-wallet";
|
||||
import { BaseSepoliaTestnet } from "@thirdweb-dev/chains";
|
||||
import { ThirdwebSDK, SmartContract } from "@thirdweb-dev/sdk";
|
||||
import { BigNumber, ethers } from "ethers";
|
||||
|
||||
require("dotenv-mono").load();
|
||||
|
||||
jest.setTimeout(240_000);
|
||||
|
||||
let smartWallet: SmartWallet;
|
||||
let smartWalletAddress: string;
|
||||
let personalWallet: LocalWallet;
|
||||
let contract: SmartContract;
|
||||
let sdk: ThirdwebSDK;
|
||||
const factoryAddress = "0x0Ef392D2CCe0f1cb2ed1309BCae11A0d6c59f872";
|
||||
const chain = BaseSepoliaTestnet;
|
||||
const erc20PaymasterAddress = "0xFA854D9C6f279bA798C67BD22ffAEcf090B5a87c"; // SimpleERC20Paymaster
|
||||
const erc20TokenAddress = "0xF7235993A1BB401620e7c384D541e78D18081090"; // Base DIA
|
||||
|
||||
const describeIf = (condition: boolean) =>
|
||||
condition ? describe : describe.skip;
|
||||
|
||||
beforeAll(async () => {
|
||||
personalWallet = new LocalWallet();
|
||||
await personalWallet.generate();
|
||||
smartWallet = new SmartWallet({
|
||||
chain,
|
||||
factoryAddress,
|
||||
gasless: true,
|
||||
secretKey: process.env.TW_SECRET_KEY,
|
||||
erc20PaymasterAddress: erc20PaymasterAddress,
|
||||
erc20TokenAddress: erc20TokenAddress,
|
||||
});
|
||||
smartWalletAddress = await smartWallet.connect({ personalWallet });
|
||||
sdk = await ThirdwebSDK.fromWallet(smartWallet, chain, {
|
||||
secretKey: process.env.TW_SECRET_KEY,
|
||||
});
|
||||
contract = await sdk.getContract(
|
||||
"0xF7235993A1BB401620e7c384D541e78D18081090", // using same token for payment and claim
|
||||
);
|
||||
});
|
||||
|
||||
describeIf(!!process.env.TW_SECRET_KEY)("ERC20Paymaster core tests", () => {
|
||||
it("can connect", async () => {
|
||||
expect(smartWalletAddress).toHaveLength(42);
|
||||
});
|
||||
|
||||
it("should deploy+approve (gasless) and execute a tx", async () => {
|
||||
const tokenContract = await sdk.getContract(erc20TokenAddress);
|
||||
|
||||
// initial checks
|
||||
let approvedAmount = (
|
||||
await tokenContract.erc20.allowanceOf(
|
||||
smartWalletAddress,
|
||||
erc20PaymasterAddress,
|
||||
)
|
||||
).value;
|
||||
expect(approvedAmount.toNumber()).toEqual(0);
|
||||
|
||||
let isDeployed = await smartWallet.isDeployed();
|
||||
expect(isDeployed).toEqual(false);
|
||||
|
||||
let balance = (await contract.erc20.balance()).value;
|
||||
expect(balance.toNumber()).toEqual(0);
|
||||
|
||||
// airdrop tokens for payment
|
||||
const tempLocalWallet = new LocalWallet();
|
||||
await tempLocalWallet.generate();
|
||||
const tempSmartWallet = new SmartWallet({
|
||||
chain,
|
||||
factoryAddress,
|
||||
gasless: true,
|
||||
secretKey: process.env.TW_SECRET_KEY,
|
||||
});
|
||||
await tempSmartWallet.connect({
|
||||
personalWallet: tempLocalWallet,
|
||||
});
|
||||
const claimTx = await contract.erc20.claimTo.prepare(smartWalletAddress, 1); // tx costs 1
|
||||
const claimReceipt = await tempSmartWallet.execute(claimTx);
|
||||
expect(claimReceipt.receipt.transactionHash).toHaveLength(66);
|
||||
balance = (await contract.erc20.balance()).value;
|
||||
expect(balance).toEqual(ethers.utils.parseEther("1"));
|
||||
|
||||
// transact with newly funded smart wallet using erc20 exclusively
|
||||
const preparedTx = await contract.erc20.claim.prepare(1);
|
||||
const tx = await smartWallet.execute(preparedTx);
|
||||
expect(tx.receipt.transactionHash).toHaveLength(66);
|
||||
|
||||
approvedAmount = (
|
||||
await tokenContract.erc20.allowanceOf(
|
||||
smartWalletAddress,
|
||||
erc20PaymasterAddress,
|
||||
)
|
||||
).value;
|
||||
expect(approvedAmount).toEqual(
|
||||
BigNumber.from(2).pow(96).sub(1).sub(ethers.utils.parseEther("1")), // 2^96 - 1 - 1^18 <- 1^18 is the tx cost removed from allowance
|
||||
);
|
||||
|
||||
isDeployed = await smartWallet.isDeployed();
|
||||
expect(isDeployed).toEqual(true);
|
||||
|
||||
balance = (await contract.erc20.balance()).value;
|
||||
expect(balance).toEqual(ethers.utils.parseEther("1")); // we spent 1 token to claim 1 token
|
||||
});
|
||||
});
|
||||
@@ -6,14 +6,17 @@ import { ThirdwebSDK, SmartContract } from "@thirdweb-dev/sdk";
|
||||
import { checkContractWalletSignature } from "../src/evm/wallets/abstract";
|
||||
|
||||
require("dotenv-mono").load();
|
||||
|
||||
jest.setTimeout(240_000);
|
||||
|
||||
let smartWallet: SmartWallet;
|
||||
let smartWalletAddress: string;
|
||||
let personalWallet: LocalWallet;
|
||||
let contract: SmartContract;
|
||||
const factoryAddress = "0x13947435c2fe6BE51ED82F6f59C38617a323dB9B";
|
||||
const factoryAddress = "0x13947435c2fe6BE51ED82F6f59C38617a323dB9B"; // pre 712
|
||||
const factoryAddressV2 = "0xC64d04AedecA895b3F20DC6866b4b532e0b22634"; // post 712
|
||||
const chain = Mumbai;
|
||||
const SECRET_KEY = process.env.TW_SECRET_KEY;
|
||||
|
||||
const describeIf = (condition: boolean) =>
|
||||
condition ? describe : describe.skip;
|
||||
@@ -25,16 +28,18 @@ beforeAll(async () => {
|
||||
chain,
|
||||
factoryAddress,
|
||||
gasless: true,
|
||||
secretKey: process.env.TW_SECRET_KEY,
|
||||
secretKey: SECRET_KEY,
|
||||
});
|
||||
smartWalletAddress = await smartWallet.connect({ personalWallet });
|
||||
const sdk = await ThirdwebSDK.fromWallet(smartWallet, chain);
|
||||
const sdk = await ThirdwebSDK.fromWallet(smartWallet, chain, {
|
||||
secretKey: SECRET_KEY,
|
||||
});
|
||||
contract = await sdk.getContract(
|
||||
"0xD170A53dADb19f62C78AB9982236857B71dbc83A", // mumbai edition drop
|
||||
);
|
||||
});
|
||||
|
||||
describeIf(!!process.env.TW_SECRET_KEY)("SmartWallet core tests", () => {
|
||||
describeIf(!!SECRET_KEY)("SmartWallet core tests", () => {
|
||||
it("can connect", async () => {
|
||||
expect(smartWalletAddress).toHaveLength(42);
|
||||
});
|
||||
@@ -98,7 +103,7 @@ describeIf(!!process.env.TW_SECRET_KEY)("SmartWallet core tests", () => {
|
||||
expect(balance.toNumber()).toEqual(7);
|
||||
});
|
||||
|
||||
it("can sign and verify 1271", async () => {
|
||||
it("can sign and verify 1271 old factory", async () => {
|
||||
const message = "0x1234";
|
||||
const sig = await smartWallet.signMessage(message);
|
||||
const isValidV1 = await smartWallet.verifySignature(
|
||||
@@ -106,6 +111,8 @@ describeIf(!!process.env.TW_SECRET_KEY)("SmartWallet core tests", () => {
|
||||
sig,
|
||||
smartWalletAddress,
|
||||
chain.chainId,
|
||||
undefined,
|
||||
SECRET_KEY,
|
||||
);
|
||||
expect(isValidV1).toEqual(true);
|
||||
const isValidV2 = await checkContractWalletSignature(
|
||||
@@ -113,6 +120,38 @@ describeIf(!!process.env.TW_SECRET_KEY)("SmartWallet core tests", () => {
|
||||
sig,
|
||||
smartWalletAddress,
|
||||
chain.chainId,
|
||||
undefined,
|
||||
SECRET_KEY,
|
||||
);
|
||||
expect(isValidV2).toEqual(true);
|
||||
});
|
||||
|
||||
it("can sign and verify 1271 new factory", async () => {
|
||||
smartWallet = new SmartWallet({
|
||||
chain,
|
||||
factoryAddress: factoryAddressV2,
|
||||
gasless: true,
|
||||
secretKey: process.env.TW_SECRET_KEY,
|
||||
});
|
||||
smartWalletAddress = await smartWallet.connect({ personalWallet });
|
||||
const message = "0x1234";
|
||||
const sig = await smartWallet.signMessage(message);
|
||||
const isValidV1 = await smartWallet.verifySignature(
|
||||
message,
|
||||
sig,
|
||||
smartWalletAddress,
|
||||
chain.chainId,
|
||||
undefined,
|
||||
SECRET_KEY,
|
||||
);
|
||||
expect(isValidV1).toEqual(true);
|
||||
const isValidV2 = await checkContractWalletSignature(
|
||||
message,
|
||||
sig,
|
||||
smartWalletAddress,
|
||||
chain.chainId,
|
||||
undefined,
|
||||
SECRET_KEY,
|
||||
);
|
||||
expect(isValidV2).toEqual(true);
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user