-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
609 additions
and
794 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 |
---|---|---|
@@ -1,7 +1,25 @@ | ||
import { TonClient4 } from "ton"; | ||
import { getHttpV4Endpoint } from "@orbs-network/ton-access"; | ||
|
||
export async function getClientV4() { | ||
// TODO clientV4 ton access dont work | ||
// const endpoint = await getHttpV4Endpoint(); | ||
return new TonClient4({ endpoint: "https://mainnet-v4.tonhubapi.com" }); | ||
const clients: TonClient4[] = []; | ||
|
||
export async function getClientsV4() { | ||
if (clients.length === 0) { | ||
const tonAccessEndpoint = await getHttpV4Endpoint(); | ||
clients.push( | ||
...[ | ||
new TonClient4({ endpoint: "https://mainnet-v4.tonhubapi.com" }), | ||
new TonClient4({ endpoint: tonAccessEndpoint }), | ||
] | ||
); | ||
} | ||
|
||
return clients; | ||
} | ||
|
||
export async function executeV4Function<T>( | ||
func: (tc: TonClient4) => Promise<T> | ||
) { | ||
const clients = await getClientsV4(); | ||
return Promise.any(clients.map(func)); | ||
} |
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
Oops, something went wrong.