> For the complete documentation index, see [llms.txt](https://developers.alpha.wtf/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.alpha.wtf/keys-contract-interaction/staking-close.md).

# Staking Close

The key owner ends key staking.

## Contract function

```
stakingClose
```

## Contract address

```
0x9b727dcaC7b331f95786D3b01fA79191Ab527DA3
```

### Parameters

```
ratio: pool staking ratio
duration: time staking
locked: is pool staking locked
```

### Sample code

```
  public stakingClose = async (
    params: ICloseStaking
  ): Promise<ethers.ContractTransaction> => {
    try {
      await this.getBTCApprove({
        spender_address: ALPHA_KEY_FACTORY_ADDRESS,
        token_amount: 1,
        need_approve: true,
      });
      await this.estimateTCGasFee({ type: ETypes.buy });
      const afk = this.contract.getAlphaKeysFactoryContract();
      const tx = await afk
        .connect(this.wallet)
        .stakingClose(params.ratio, params.duration, params.isLock);
      await tx.wait();
      await delay(1000);
      await this.tradeAPI.scanTrxAlpha({ tx_hash: tx.hash });
      return tx;
    } catch (error) {
      console.log('stakingClose error', error);
      throw error;
    }
  };

```
