Skip to content

Commit

Permalink
added immutable network support
Browse files Browse the repository at this point in the history
  • Loading branch information
spacehaz committed Aug 12, 2024
1 parent 2bc5c9f commit 4325db7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Linkdrop SDK

## 2.1.8
- added support for immutableZkevm network
- removed support for baseGoerli, goerli and mumbai

## 2.1.7
- token_name, linkdrop_token, token_image properties added to link params

## 2.1.6
- available_wallets_on => preferred_wallet_on
- available_wallets property removed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linkdrop-sdk",
"version": "2.1.7",
"version": "2.1.8",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
Expand Down
6 changes: 2 additions & 4 deletions src/configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ export const testnetsClaimHostUrl = 'https://testnets.claim.linkdrop.io'

export const polygonJSONRPCUrl = 'https://rpc-mainnet.maticvigil.com/v1/ad4cd2ea018ddb1ccd0418ffa43c27b3d99fbd55'
export const mainnetJSONRPCUrl = 'https://mainnet.infura.io/v3/620c738fbe1843a18f47ada0e60e738a'
export const goerliJSONRPCUrl = 'https://goeli.infura.io/v3/620c738fbe1843a18f47ada0e60e738a'
export const mumbaiJSONRPCUrl = 'https://rpc-mumbai.maticvigil.com/v1/f592ae2e5afb3bebe39314e9bd0949de5b74cd2f'
export const basicJSONRPCUrl = 'https://developer-access-mainnet.base.org'
export const basicGoerliJSONRPCUrl = 'https://base-goerli.public.blastapi.io'
export const baseJSONRPCUrl = 'https://developer-access-mainnet.base.org'
export const immutableZkevmJSONRPCUrl = 'https://immutable-zkevm.drpc.org'
18 changes: 6 additions & 12 deletions src/helpers/define-json-rpc-url.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
import { defineNetworkName } from './'
import {
polygonJSONRPCUrl,
mumbaiJSONRPCUrl,
goerliJSONRPCUrl,
mainnetJSONRPCUrl,
basicGoerliJSONRPCUrl,
basicJSONRPCUrl
baseJSONRPCUrl,
immutableZkevmJSONRPCUrl
} from '../configs'

const defineJSONRpcUrl = ({ chainId } : { chainId: number }) => {
const networkName = defineNetworkName(chainId)
switch (networkName) {
case 'matic':
return polygonJSONRPCUrl
case 'mumbai':
return mumbaiJSONRPCUrl
case 'goerli':
return goerliJSONRPCUrl
case 'mainnet':
return mainnetJSONRPCUrl
case 'basic':
return basicJSONRPCUrl
case 'basicGoerli':
return basicGoerliJSONRPCUrl
case 'base':
return baseJSONRPCUrl
case 'immutableZkevm':
return immutableZkevmJSONRPCUrl
default:
return alert('Current chain id is not supported')
}
Expand Down
6 changes: 2 additions & 4 deletions src/helpers/define-network-name.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const defineNetworkName = (chainId: number | null) : string => {
switch (Number(chainId)) {
case 1: return 'mainnet'
case 5: return 'goerli'
case 137: return 'matic'
case 80001: return 'mumbai'
case 8453: return 'basic'
case 84531: return 'basicMumbai'
case 8453: return 'base'
case 13371: return 'immutableZkevm'
default: return 'mainnet'
}
}
Expand Down

0 comments on commit 4325db7

Please sign in to comment.