Skip to content

Commit

Permalink
test: add an integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
ac10n committed Sep 13, 2023
1 parent 5a0689e commit bc1072a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
27 changes: 27 additions & 0 deletions integration-tests/contract-staking.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { CONFIGS } from "./config";

CONFIGS().forEach(({ lib, rpc, setup, knownBaker }) => {
const Tezos = lib;
describe(`Test staking through contract API using: ${rpc}`, () => {
beforeEach(async (done) => {
await setup(true)
done()
});
it('Should be able to stake', async (done) => {
const delegate = knownBaker
const pkh = await Tezos.signer.publicKeyHash();
const op = await Tezos.contract.stake({
baker: delegate,
amount: 0.1,
parameter: {
entrypoint: "stake",
value: { "prim": "Unit" }
}
});
await op.confirmation()
expect(op.hash).toBeDefined();
console.log(op);
done();
});
});
});
33 changes: 33 additions & 0 deletions packages/taquito/src/contract/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import {
SmartRollupAddMessagesParams,
SmartRollupOriginateParams,
FailingNoopParams,
StakeParams,
UnstakeParams,
FinalizeUnstakeParams,
} from '../operations/types';
import { ContractAbstraction, ContractStorageType, DefaultContractType } from './contract';
import { IncreasePaidStorageOperation } from '../operations/increase-paid-storage-operation';
Expand Down Expand Up @@ -283,4 +286,34 @@ export interface ContractProvider extends StorageProvider {
* @param params FailingNoop operation parameter
*/
failingNoop(params: FailingNoopParams): Promise<FailingNoopOperation>;

/**
*
* @description Stake founds. Will sign and inject an operation using the current context
*
* @returns An operation handle with the result from the rpc node
*
* @param stake operation parameter
*/
stake(params: StakeParams): Promise<TransactionOperation>;

/**
*
* @description Unstake founds. Will sign and inject an operation using the current context
*
* @returns An operation handle with the result from the rpc node
*
* @param unstake operation parameter
*/
unstake(params: UnstakeParams): Promise<TransactionOperation>;

/**
*
* @description Finalize unstake founds. Will sign and inject an operation using the current context
*
* @returns An operation handle with the result from the rpc node
*
* @param finalizeUnstake operation parameter
*/
unstake(params: FinalizeUnstakeParams): Promise<TransactionOperation>;
}
2 changes: 1 addition & 1 deletion packages/taquito/src/contract/rpc-contract-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ export class RpcContractProvider extends Provider implements ContractProvider, S

/**
*
* @description Unstake founds. Will sign and inject an operation using the current context
* @description Finalize unstake founds. Will sign and inject an operation using the current context
*
* @returns An operation handle with the result from the rpc node
*
Expand Down

0 comments on commit bc1072a

Please sign in to comment.