-
-
Notifications
You must be signed in to change notification settings - Fork 17
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 #125 from TxnLab/dev
v0.8.2
- Loading branch information
Showing
20 changed files
with
459 additions
and
247 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
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,6 +1,6 @@ | ||
{ | ||
"name": "reti-ui", | ||
"version": "0.8.1", | ||
"version": "0.8.2", | ||
"author": { | ||
"name": "Doug Richar", | ||
"email": "[email protected]" | ||
|
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,89 @@ | ||
import * as algokit from '@algorandfoundation/algokit-utils' | ||
import { TransactionSignerAccount } from '@algorandfoundation/algokit-utils/types/account' | ||
import algosdk from 'algosdk' | ||
import { FEE_SINK } from '@/constants/accounts' | ||
import { StakingPoolClient } from '@/contracts/StakingPoolClient' | ||
import { ValidatorRegistryClient } from '@/contracts/ValidatorRegistryClient' | ||
import { makeEmptyTransactionSigner } from '@/lib/makeEmptyTransactionSigner' | ||
import { getRetiAppIdFromViteEnvironment } from '@/utils/env' | ||
import { getAlgodConfigFromViteEnvironment } from '@/utils/network/getAlgoClientConfigs' | ||
import { ParamsCache } from '@/utils/paramsCache' | ||
|
||
const algodConfig = getAlgodConfigFromViteEnvironment() | ||
const algodClient = algokit.getAlgoClient({ | ||
server: algodConfig.server, | ||
port: algodConfig.port, | ||
token: algodConfig.token, | ||
}) | ||
|
||
const RETI_APP_ID = getRetiAppIdFromViteEnvironment() | ||
|
||
export async function getValidatorClient( | ||
signer: algosdk.TransactionSigner, | ||
activeAddress: string, | ||
): Promise<ValidatorRegistryClient> { | ||
const params = await ParamsCache.getSuggestedParams() | ||
|
||
return new ValidatorRegistryClient( | ||
{ | ||
sender: { signer, addr: activeAddress }, | ||
resolveBy: 'id', | ||
id: RETI_APP_ID, | ||
params, | ||
}, | ||
algodClient, | ||
) | ||
} | ||
|
||
export async function getSimulateValidatorClient( | ||
senderAddr: string = FEE_SINK, | ||
authAddr?: string, | ||
): Promise<ValidatorRegistryClient> { | ||
const params = await ParamsCache.getSuggestedParams() | ||
|
||
return new ValidatorRegistryClient( | ||
{ | ||
sender: { addr: senderAddr, signer: makeEmptyTransactionSigner(authAddr) }, | ||
resolveBy: 'id', | ||
id: RETI_APP_ID, | ||
params, | ||
}, | ||
algodClient, | ||
) | ||
} | ||
|
||
export async function getStakingPoolClient( | ||
poolAppId: number | bigint, | ||
signer: algosdk.TransactionSigner, | ||
activeAddress: string, | ||
): Promise<StakingPoolClient> { | ||
const params = await ParamsCache.getSuggestedParams() | ||
|
||
return new StakingPoolClient( | ||
{ | ||
sender: { signer, addr: activeAddress } as TransactionSignerAccount, | ||
resolveBy: 'id', | ||
id: poolAppId, | ||
params, | ||
}, | ||
algodClient, | ||
) | ||
} | ||
|
||
export async function getSimulateStakingPoolClient( | ||
poolAppId: number | bigint, | ||
senderAddr: string = FEE_SINK, | ||
authAddr?: string, | ||
): Promise<StakingPoolClient> { | ||
const params = await ParamsCache.getSuggestedParams() | ||
|
||
return new StakingPoolClient( | ||
{ | ||
sender: { addr: senderAddr, signer: makeEmptyTransactionSigner(authAddr) }, | ||
resolveBy: 'id', | ||
id: poolAppId, | ||
params, | ||
}, | ||
algodClient, | ||
) | ||
} |
Oops, something went wrong.