Skip to content

Commit

Permalink
receiveFunds on providerGetSigner
Browse files Browse the repository at this point in the history
  • Loading branch information
zapaz committed Apr 23, 2024
1 parent 04b0d0d commit 27b0277
Show file tree
Hide file tree
Showing 9 changed files with 369 additions and 434 deletions.
2 changes: 1 addition & 1 deletion common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@
"dependencies": {
"@kredeum/config": "workspace:^",
"@kredeum/contracts": "workspace:^",
"@kredeum/providers": "workspace:^"
"@kredeum/skale": "workspace:^"
}
}
10 changes: 9 additions & 1 deletion common/src/common/provider-get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import type { WindowExternalProvider } from "./types";
import { getChecksumAddress, sleep } from "../common/config";
import { ethers } from "ethers";
import { networks } from "./networks";
import { receiveFunds } from "@kredeum/skale";
import { Address } from "viem";

let _providerSetting = false;

Expand All @@ -31,8 +33,14 @@ const providerGetWindow = async (chainId = 0): Promise<Web3Provider | undefined>

const providerGetSigner = async (chainId = 0, accountOrIndex: string | number = 0): Promise<Signer | undefined> => {
const provider = await providerGetWindow(chainId);
if (!provider) return;

return provider && provider.getSigner(accountOrIndex);
const signer = provider.getSigner(accountOrIndex);
const signerAddress = (await signer.getAddress()) as Address;

await receiveFunds(signerAddress, chainId);

return signer;
};

const providerGetAccount = async (): Promise<string> => {
Expand Down
36 changes: 18 additions & 18 deletions config/src/testnets.handlebars.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,24 @@
"linkedLayer1": 17000,
"create": true
},
{
"chainId": 974399131,
"chainName": "calypso-testnet",
"rpcUrls": [
"https://testnet.skalenodes.com/v1/giant-half-dual-testnet"
],
"nativeCurrency": {
"name": "sFUEL",
"symbol": "SFUEL",
"decimals": 18
},
"blockExplorerUrls": [
"https://giant-half-dual-testnet.explorer.testnet.skalenodes.com"
],
"eip1559": false,
"create": false,
"linkedMainnet": 1564830818
},
{
"chainId": 80001,
"chainName": "mumbai",
Expand Down Expand Up @@ -407,24 +425,6 @@
"active": false,
"linkedMainnet": 1564830818
},
{
"chainId": 974399131,
"chainName": "calypso-testnet",
"rpcUrls": [
"https://testnet.skalenodes.com/v1/giant-half-dual-testnet"
],
"nativeCurrency": {
"name": "sFUEL",
"symbol": "SFUEL",
"decimals": 18
},
"blockExplorerUrls": [
"https://giant-half-dual-testnet.explorer.testnet.skalenodes.com"
],
"eip1559": false,
"create": false,
"linkedMainnet": 1564830818
},
{
"chainId": 3441005,
"chainName": "manta-pacific-testnet",
Expand Down
Loading

0 comments on commit 27b0277

Please sign in to comment.