Skip to content
This repository was archived by the owner on Aug 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
570e483
add optimism / arbitrum chains
joaquim-verges Jun 10, 2022
00a8ba8
add L2 chain info
joaquim-verges Jun 13, 2022
584246c
Merge branch 'main' into joaquim/l2
joaquim-verges Jun 13, 2022
60e40f9
v2.3.13-0
joaquim-verges Jun 13, 2022
d644ae8
Fix currency names
nachoiacovino Jun 13, 2022
261531e
Fix symbols for testnets
nachoiacovino Jun 13, 2022
e8baf3f
Merge branch 'joaquim/l2' of github.com:thirdweb-dev/typescript-sdk i…
joaquim-verges Jun 13, 2022
c16d52b
Fix name/symbol
nachoiacovino Jun 13, 2022
0b09a41
add arbitrum testnet registry/factory
joaquim-verges Jun 13, 2022
8243a90
Use ETH symbol
nachoiacovino Jun 13, 2022
21ccb5e
Merge branch 'joaquim/l2' of https://github.com/thirdweb-dev/typescri…
nachoiacovino Jun 13, 2022
53ed529
Replace missing one
nachoiacovino Jun 13, 2022
dac790f
rename rpc aliases
joaquim-verges Jun 13, 2022
c307ad2
update docs
joaquim-verges Jun 13, 2022
e130b19
remove empty file
joaquim-verges Jun 13, 2022
49ccfc4
v2.3.13-1
joaquim-verges Jun 13, 2022
276bc91
Update testnets name/symbols
nachoiacovino Jun 13, 2022
5ad2baf
Merge branch 'joaquim/l2' of https://github.com/thirdweb-dev/typescri…
nachoiacovino Jun 13, 2022
a7c86b7
Update testnets name/symbols
nachoiacovino Jun 13, 2022
2d4d0dc
v2.3.13-2
nachoiacovino Jun 13, 2022
0209582
expose edition.claimConditions.setBatch() to set claim conditions on …
joaquim-verges Jun 13, 2022
20fc947
v2.3.13
joaquim-verges Jun 13, 2022
b74bc99
Merge branch 'main' into joaquim/l2
joaquim-verges Jun 14, 2022
0884139
remove unusupported chains from chainId enum, make nativetoken always…
jnsdls Jun 14, 2022
dd20cba
check in docs usage
jnsdls Jun 14, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/sdk.chainid.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export declare enum ChainId

| Member | Value | Description |
| --- | --- | --- |
| Arbitrum | <code>42161</code> | |
| ArbitrumTestnet | <code>421611</code> | |
| Avalanche | <code>43114</code> | |
| AvalancheFujiTestnet | <code>43113</code> | |
| BSC | <code>56</code> | |
Expand All @@ -28,6 +30,8 @@ export declare enum ChainId
| Mainnet | <code>1</code> | |
| Moonriver | <code>1285</code> | |
| Mumbai | <code>80001</code> | |
| Optimism | <code>10</code> | |
| OptimismTestnet | <code>69</code> | |
| Polygon | <code>137</code> | |
| Rinkeby | <code>4</code> | |
| Ropsten | <code>3</code> | |
Expand Down
4 changes: 2 additions & 2 deletions docs/sdk.supported_chain_id.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<b>Signature:</b>

```typescript
export declare type SUPPORTED_CHAIN_ID = ChainId.Mainnet | ChainId.Rinkeby | ChainId.Goerli | ChainId.Mumbai | ChainId.Polygon | ChainId.Fantom | ChainId.FantomTestnet | ChainId.Avalanche | ChainId.AvalancheFujiTestnet;
export declare type SUPPORTED_CHAIN_ID = ChainId.Mainnet | ChainId.Rinkeby | ChainId.Goerli | ChainId.Mumbai | ChainId.Polygon | ChainId.Fantom | ChainId.FantomTestnet | ChainId.Avalanche | ChainId.AvalancheFujiTestnet | ChainId.Optimism | ChainId.OptimismTestnet | ChainId.Arbitrum | ChainId.ArbitrumTestnet;
```
<b>References:</b> [ChainId.Mainnet](./sdk.chainid.md)<!-- -->, [ChainId.Rinkeby](./sdk.chainid.md)<!-- -->, [ChainId.Goerli](./sdk.chainid.md)<!-- -->, [ChainId.Mumbai](./sdk.chainid.md)<!-- -->, [ChainId.Polygon](./sdk.chainid.md)<!-- -->, [ChainId.Fantom](./sdk.chainid.md)<!-- -->, [ChainId.FantomTestnet](./sdk.chainid.md)<!-- -->, [ChainId.Avalanche](./sdk.chainid.md)<!-- -->, [ChainId.AvalancheFujiTestnet](./sdk.chainid.md)
<b>References:</b> [ChainId.Mainnet](./sdk.chainid.md)<!-- -->, [ChainId.Rinkeby](./sdk.chainid.md)<!-- -->, [ChainId.Goerli](./sdk.chainid.md)<!-- -->, [ChainId.Mumbai](./sdk.chainid.md)<!-- -->, [ChainId.Polygon](./sdk.chainid.md)<!-- -->, [ChainId.Fantom](./sdk.chainid.md)<!-- -->, [ChainId.FantomTestnet](./sdk.chainid.md)<!-- -->, [ChainId.Avalanche](./sdk.chainid.md)<!-- -->, [ChainId.AvalancheFujiTestnet](./sdk.chainid.md)<!-- -->, [ChainId.Optimism](./sdk.chainid.md)<!-- -->, [ChainId.OptimismTestnet](./sdk.chainid.md)<!-- -->, [ChainId.Arbitrum](./sdk.chainid.md)<!-- -->, [ChainId.ArbitrumTestnet](./sdk.chainid.md)

12 changes: 10 additions & 2 deletions etc/sdk.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ export type BufferOrStringWithName = {

// @public (undocumented)
export enum ChainId {
// (undocumented)
Arbitrum = 42161,
// (undocumented)
ArbitrumTestnet = 421611,
// (undocumented)
Avalanche = 43114,
// (undocumented)
Expand Down Expand Up @@ -181,6 +185,10 @@ export enum ChainId {
// (undocumented)
Mumbai = 80001,
// (undocumented)
Optimism = 10,
// (undocumented)
OptimismTestnet = 69,
// (undocumented)
Polygon = 137,
// (undocumented)
Rinkeby = 4,
Expand Down Expand Up @@ -208,7 +216,7 @@ export const ChainlinkVrf: Record<number, ChainlinkInfo>;
// Warning: (ae-internal-missing-underscore) The name "ChainOrRpc" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export type ChainOrRpc = "mumbai" | "polygon" | "matic" | "rinkeby" | "goerli" | "mainnet" | "ethereum" | "fantom" | "avalanche" | (string & {});
export type ChainOrRpc = "mumbai" | "polygon" | "matic" | "rinkeby" | "goerli" | "mainnet" | "ethereum" | "fantom" | "avalanche" | "optimism" | "optimism-testnet" | "arbitrum" | "arbitrum-testnet" | (string & {});

// Warning: (ae-internal-missing-underscore) The name "CidWithFileName" should be prefixed with an underscore because the declaration is marked as @internal
//
Expand Down Expand Up @@ -5045,7 +5053,7 @@ export interface SplitRecipientInput {
}

// @public (undocumented)
export type SUPPORTED_CHAIN_ID = ChainId.Mainnet | ChainId.Rinkeby | ChainId.Goerli | ChainId.Mumbai | ChainId.Polygon | ChainId.Fantom | ChainId.FantomTestnet | ChainId.Avalanche | ChainId.AvalancheFujiTestnet;
export type SUPPORTED_CHAIN_ID = ChainId.Mainnet | ChainId.Rinkeby | ChainId.Goerli | ChainId.Mumbai | ChainId.Polygon | ChainId.Fantom | ChainId.FantomTestnet | ChainId.Avalanche | ChainId.AvalancheFujiTestnet | ChainId.Optimism | ChainId.OptimismTestnet | ChainId.Arbitrum | ChainId.ArbitrumTestnet;

// @public (undocumented)
export const SUPPORTED_CHAIN_IDS: SUPPORTED_CHAIN_ID[];
Expand Down
36 changes: 36 additions & 0 deletions src/constants/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,42 @@ export const CONTRACT_ADDRESSES: Record<
contractMetadataRegistry: "0x1e474395f58418e9c594a79abb0152D04C229E8e",
sigMint: constants.AddressZero,
},
[ChainId.Arbitrum]: {
biconomyForwarder: constants.AddressZero,
twFactory: "", // TODO
twRegistry: "", // TODO
twBYOCRegistry: constants.AddressZero,
contractDeployer: constants.AddressZero,
contractMetadataRegistry: constants.AddressZero,
sigMint: constants.AddressZero,
},
[ChainId.ArbitrumTestnet]: {
biconomyForwarder: constants.AddressZero,
twFactory: "0xeb8de81F1eFA6523f72ad0cd0a1e6E5C0908b3Ce", // TODO from shared deployer wallet
twRegistry: "0x6D340cc8bF255d05aCad6c3d820D8B0d8905542c", // TODO from shared deployer wallet
twBYOCRegistry: constants.AddressZero,
contractDeployer: constants.AddressZero,
contractMetadataRegistry: constants.AddressZero,
sigMint: constants.AddressZero,
},
[ChainId.Optimism]: {
biconomyForwarder: constants.AddressZero,
twFactory: "", // TODO
twRegistry: "", // TODO
twBYOCRegistry: constants.AddressZero,
contractDeployer: constants.AddressZero,
contractMetadataRegistry: constants.AddressZero,
sigMint: constants.AddressZero,
},
[ChainId.OptimismTestnet]: {
biconomyForwarder: constants.AddressZero,
twFactory: "0x3805FF4740F47c5F3206223af6e7D5d99e58a2E7", // TODO from shared deployer wallet
twRegistry: "0xc7B5A95ee69c3384F97edcDEb31F29ed0078bF52", // TODO from shared deployer wallet
twBYOCRegistry: constants.AddressZero,
contractDeployer: constants.AddressZero,
contractMetadataRegistry: constants.AddressZero,
sigMint: constants.AddressZero,
},
};

/**
Expand Down
14 changes: 13 additions & 1 deletion src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ export enum ChainId {
FantomTestnet = 4002,
Avalanche = 43114,
AvalancheFujiTestnet = 43113,
Optimism = 10,
OptimismTestnet = 69,
Arbitrum = 42161,
ArbitrumTestnet = 421611,
}

/**
Expand All @@ -33,7 +37,11 @@ export type SUPPORTED_CHAIN_ID =
| ChainId.Fantom
| ChainId.FantomTestnet
| ChainId.Avalanche
| ChainId.AvalancheFujiTestnet;
| ChainId.AvalancheFujiTestnet
| ChainId.Optimism
| ChainId.OptimismTestnet
| ChainId.Arbitrum
| ChainId.ArbitrumTestnet;

/**
* @public
Expand All @@ -48,4 +56,8 @@ export const SUPPORTED_CHAIN_IDS: SUPPORTED_CHAIN_ID[] = [
ChainId.FantomTestnet,
ChainId.Avalanche,
ChainId.AvalancheFujiTestnet,
ChainId.Optimism,
ChainId.OptimismTestnet,
ChainId.Arbitrum,
ChainId.ArbitrumTestnet,
];
48 changes: 44 additions & 4 deletions src/constants/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export const NATIVE_TOKENS: Record<
},
},
[ChainId.Rinkeby]: {
name: "Ether",
symbol: "ETH",
name: "Rinkeby Ether",
symbol: "RIN",
decimals: 18,
wrapped: {
address: "0xc778417E063141139Fce010982780140Aa0cD5Ab",
Expand All @@ -35,8 +35,8 @@ export const NATIVE_TOKENS: Record<
},
},
[ChainId.Goerli]: {
name: "Ether",
symbol: "ETH",
name: "Görli Ether",
symbol: "GOR",
decimals: 18,
wrapped: {
address: "0x0bb7509324ce409f7bbc4b701f932eaca9736ab7",
Expand Down Expand Up @@ -104,6 +104,46 @@ export const NATIVE_TOKENS: Record<
symbol: "WFTM",
},
},
[ChainId.Arbitrum]: {
name: "Ether",
symbol: "ETH",
decimals: 18,
wrapped: {
address: "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
name: "Wrapped Ether",
symbol: "WETH",
},
},
[ChainId.ArbitrumTestnet]: {
name: "Arbitrum Rinkeby Ether",
symbol: "ARETH",
decimals: 18,
wrapped: {
address: "0xEBbc3452Cc911591e4F18f3b36727Df45d6bd1f9",
name: "Wrapped Ether",
symbol: "WETH",
},
},
[ChainId.Optimism]: {
name: "Ether",
symbol: "ETH",
decimals: 18,
wrapped: {
address: "0x4200000000000000000000000000000000000006",
name: "Wrapped Ether",
symbol: "WETH",
},
},
[ChainId.OptimismTestnet]: {
name: "Kovan Ether",
symbol: "KOR",
decimals: 18,
wrapped: {
address: "0xbC6F6b680bc61e30dB47721c6D1c5cde19C1300d",
name: "Wrapped Ether",
symbol: "WETH",
},
},
[ChainId.Hardhat]: {
name: "Ether",
symbol: "ETH",
Expand Down
16 changes: 16 additions & 0 deletions src/constants/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ export type ChainOrRpc =
| "ethereum"
| "fantom"
| "avalanche"
| "optimism"
| "optimism-testnet"
| "arbitrum"
| "arbitrum-testnet"
// ideally we could use `https://${string}` notation here, but doing that causes anything that is a generic string to throw a type error => not worth the hassle for now
| (string & {});

Expand Down Expand Up @@ -67,6 +71,18 @@ export function getProviderForNetwork(network: ChainOrRpc | SignerOrProvider) {
case "mainnet":
case "ethereum":
return `https://eth-mainnet.g.alchemy.com/v2/${DEFAULT_API_KEY}`;
case "optimism":
// TODO test this RPC
return `https://opt-mainnet.g.alchemy.com/v2/${DEFAULT_API_KEY}`;
case "optimism-testnet":
// alchemy optimism kovan rpc doesn't link to the testnet sequencer...
return "https://kovan.optimism.io";
case "arbitrum":
// TODO test this RPC
return `https://arb-mainnet.g.alchemy.com/v2/${DEFAULT_API_KEY}`;
case "arbitrum-testnet":
// TODO test this RPC
return `https://arb-rinkeby.g.alchemy.com/v2/${DEFAULT_API_KEY}`;
case "fantom":
return "https://rpc.ftm.tools";
case "avalanche":
Expand Down