This repository has been archived by the owner on Dec 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from abstraction-hq/develop
Support EIP-5792, Add RPC Provider.
- Loading branch information
Showing
14 changed files
with
339 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Address } from "viem"; | ||
|
||
export const FACTORY: Address = "0xbC82703bDbE098773059957837016b8CA7374992" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { defineChain } from "viem"; | ||
|
||
export const NETWORKS = "mainnet" | ||
|
||
export const mainnet = defineChain({ | ||
id: 88, | ||
name: "Viction Mainnet", | ||
nativeCurrency: { | ||
decimals: 18, | ||
name: "Viction", | ||
symbol: "VIC", | ||
}, | ||
rpcUrls: { | ||
default: { | ||
http: ["https://rpc.viction.xyz"], | ||
webSocket: ["wss://ws.viction.xyz"], | ||
}, | ||
}, | ||
blockExplorers: { | ||
default: { name: "Explorer", url: "https://vicscan.xyz" }, | ||
}, | ||
testnet: true, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export * from "./supportedMethod" | ||
export * from "./chain" | ||
export * from "./address" | ||
|
||
export const KEY_URL = "https://wallet.abstraction.world" | ||
export const BUNDLER_URL = "https://wallet.abstraction.world/bundler" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { RPCProviderInput } from "../types"; | ||
import { mainnet } from "../constants"; | ||
import { Chain, createPublicClient, defineChain, http, PublicClient } from "viem"; | ||
|
||
export default class RPCProvider { | ||
ethClient: PublicClient; | ||
|
||
constructor(input?: RPCProviderInput) { | ||
let chain: Chain; | ||
if (input) { | ||
chain = defineChain({ | ||
id: 88, | ||
name: "Viction Mainnet", | ||
nativeCurrency: { | ||
decimals: 18, | ||
name: "Viction", | ||
symbol: "VIC", | ||
}, | ||
rpcUrls: { | ||
default: { | ||
http: [input.rpcUrl, "https://rpc.viction.xyz"], | ||
webSocket: [input.wsUrl, "wss://ws.viction.xyz"], | ||
}, | ||
}, | ||
blockExplorers: { | ||
default: { name: "Explorer", url: "https://vicscan.xyz" }, | ||
}, | ||
testnet: false, | ||
}) | ||
} else { | ||
chain = mainnet | ||
} | ||
|
||
// @ts-ignore | ||
this.ethClient = createPublicClient({ | ||
chain: chain, | ||
transport: http() | ||
}) as PublicClient | ||
} | ||
|
||
public async requestRPC(args: any) { | ||
return this.ethClient.request(args) | ||
} | ||
|
||
public async getClient() { | ||
return this.ethClient | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.