Skip to content

Commit

Permalink
feat: liveliness stake devnet
Browse files Browse the repository at this point in the history
  • Loading branch information
bucurdavid committed Jul 15, 2024
1 parent e3785e9 commit 2932d0a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const bondContractAddress: { [key in EnvironmentsEnum]: string } = {
export const livelinessStakeContractAddress: {
[key in EnvironmentsEnum]: string;
} = {
devnet: '',
devnet: 'erd1qqqqqqqqqqqqqpgqydk7awqqukk9utkxtdtnuu4z53e0ahjm8ypszvjjh6',
mainnet: '',
testnet: ''
};
Expand Down
13 changes: 11 additions & 2 deletions src/liveliness-stake.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {
Address,
AddressValue,
BooleanType,
BooleanValue,
ContractCallPayloadBuilder,
IAddress,
OptionValue,
ResultsParser,
Transaction,
VariadicValue
Expand Down Expand Up @@ -113,10 +115,17 @@ export class LivelinessStake extends Contract {
let interaction = bypass_liveliness_check
? this.contract.methodsExplicit.claimableRewards([
new AddressValue(address),
new BooleanValue(bypass_liveliness_check)
new OptionValue(
new BooleanType(),
new BooleanValue(bypass_liveliness_check)
)
])
: this.contract.methodsExplicit.claimableRewards([
new AddressValue(address)
new AddressValue(address),
new OptionValue(
new BooleanType(),
new BooleanValue(bypass_liveliness_check)
)
]);

const query = interaction.buildQuery();
Expand Down
11 changes: 11 additions & 0 deletions tests/stake.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ContractConfiguration, LivelinessStake, State } from '../src';

describe('Bond test', () => {
test('#test liveliness', async () => {
const livelinessStake = new LivelinessStake('devnet');

const response = await livelinessStake.viewContractConfiguration();

expect(response).toBeInstanceOf(Object as unknown as ContractConfiguration);
});
});

0 comments on commit 2932d0a

Please sign in to comment.