Skip to content

Commit

Permalink
chore(): Merge beta (#31)
Browse files Browse the repository at this point in the history
Co-authored-by: semantic-release-bot <[email protected]>
  • Loading branch information
Tbaut and semantic-release-bot authored Jan 4, 2024
1 parent cb6810a commit e4de35d
Show file tree
Hide file tree
Showing 12 changed files with 79 additions and 245 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v1
with:
Expand All @@ -27,6 +29,6 @@ jobs:
run: yarn plugin:build
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
run: npx semantic-release
1 change: 1 addition & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [
{ "message": "*BREAKING CHANGE*", "release": "major" },
{ "message": "*BREAKING CHANGES*", "release": "major" }
Expand Down
20 changes: 18 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,33 @@

## [1.2.1](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.2.0...v1.2.1) (2024-01-02)

## [1.2.1](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.2.0...v1.2.1) (2024-01-02)

### Bug Fixes

* Force a release when the breaking keyword is in the body ([#13](https://github.com/ChainSafe/cypress-polkadot-wallet/issues/13)) ([40652df](https://github.com/ChainSafe/cypress-polkadot-wallet/commit/40652df7f4cfb06e876cf37ef9720013e3b97f7b))
- Force a release when the breaking keyword is in the body ([#13](https://github.com/ChainSafe/cypress-polkadot-wallet/issues/13)) ([40652df](https://github.com/ChainSafe/cypress-polkadot-wallet/commit/40652df7f4cfb06e876cf37ef9720013e3b97f7b))

# [1.2.0](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.1.0...v1.2.0) (2023-12-13)

# [1.2.0](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.1.0...v1.2.0) (2023-12-13)

# [2.0.0](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.2.1...v2.0.0) (2024-01-02)

## [1.2.1](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.2.0...v1.2.1) (2024-01-02)

## [1.2.1](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.2.0...v1.2.1) (2024-01-02)

### Bug Fixes

- Force a release when the breaking keyword is in the body ([#13](https://github.com/ChainSafe/cypress-polkadot-wallet/issues/13)) ([40652df](https://github.com/ChainSafe/cypress-polkadot-wallet/commit/40652df7f4cfb06e876cf37ef9720013e3b97f7b))

# [1.2.0](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.1.0...v1.2.0) (2023-12-13)

# [1.2.0](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.1.0...v1.2.0) (2023-12-13)

### Features

* Align versions and readme ([#4](https://github.com/ChainSafe/cypress-polkadot-wallet/issues/4)) ([695fb5c](https://github.com/ChainSafe/cypress-polkadot-wallet/commit/695fb5c8762f0b4ce2e0212e5b7a35b1fd6a914a))
- Align versions and readme ([#4](https://github.com/ChainSafe/cypress-polkadot-wallet/issues/4)) ([695fb5c](https://github.com/ChainSafe/cypress-polkadot-wallet/commit/695fb5c8762f0b4ce2e0212e5b7a35b1fd6a914a))

# [1.1.0](https://github.com/ChainSafe/cypress-polkadot-wallet/compare/v1.0.0...v1.1.0) (2023-12-13)

Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ You can now easily use the following commands:
## Functions

<dl>
<dt><a href="#initWallet">initWallet(accounts, origin)</a></dt>
<dd><p>Initialize the Polkadot wallet. If an origin is passed there is no need to authorize the first connection for Dapps of this origin</p>
<dt><a href="#initWallet">initWallet(accounts, authorizedDappName, walletName)</a></dt>
<dd><p>Initialize the Polkadot wallet. If an authorizedDappName is passed there is no need to authorize the first connection for Dapps using this name.</p>
</dd>
<dt><a href="#getAuthRequests">getAuthRequests()</a></dt>
<dd><p>Read the authentication request queue</p>
</dd>
<dt><a href="#approveAuth">approveAuth(id, accountAddresses)</a></dt>
<dd><p>Authorize a specific request</p>
<dd><p>Approve a specific authentication request for the Dapp to get access the wallet accounts</p>
</dd>
<dt><a href="#rejectAuth">rejectAuth(id, reason)</a></dt>
<dd><p>Reject a specific authentication request</p>
<dd><p>Reject a specific authentication request. The Dapp will receive 0 connected wallet as a result.</p>
</dd>
<dt><a href="#getTxRequests">getTxRequests()</a></dt>
<dd><p>Read the tx request queue</p>
<dd><p>Read the wallet transaction request queue</p>
</dd>
<dt><a href="#approveTx">approveTx(id)</a></dt>
<dd><p>Authorize a specific transaction</p>
<dd><p>Approve a specific transaction</p>
</dd>
<dt><a href="#rejectTx">rejectTx(id, reason)</a></dt>
<dd><p>Reject a specific transaction</p>
Expand All @@ -66,23 +66,25 @@ You can now easily use the following commands:

<a name="initWallet"></a>

## initWallet(accounts, origin)
## initWallet(accounts, authorizedDappName, walletName)

Initialize the Polkadot wallet. If an origin is passed there is no need to authorize the first connection for Dapps of this origin
Initialize the Polkadot wallet. If an authorizedDappName is passed there is no need to authorize the first connection for Dapps using this name.

**Kind**: global function

| Param | Type | Description |
| -------- | --------------------------------------------- | --------------------------------------------------------------------------- |
| accounts | <code>Array.&lt;InjectedAccount&gt;</code> | Accounts to load into the wallet. |
| origin | <code>string</code> \| <code>undefined</code> | Dapp name to automatically share accounts with without needing to authorize |
| Param | Type | Description |
| ------------------ | --------------------------------------------- | ---------------------------------------------------------------------------- |
| accounts | <code>Array.&lt;InjectedAccount&gt;</code> | Accounts to load into the wallet. |
| authorizedDappName | <code>string</code> \| <code>undefined</code> | Dapp name to automatically share accounts with, without needing to authorize |
| walletName | <code>string</code> \| <code>undefined</code> | Sets the name of the injected wallet (default 'polkadot-js') |

**Example**

```js
cy.initWallet(
[{ address: '7NPoMQbiA6trJKkjB35uk96MeJD4PGWkLQLH7k7hXEkZpiba', name: 'Alice', type: 'sr25519' }],
'Multix'
'My-Dapp',
'My-wallet-extension'
)
```

Expand All @@ -105,7 +107,7 @@ cy.getAuthRequests().then((authQueue) => {

## approveAuth(id, accountAddresses)

Authorize a specific request
Approve a specific authentication request for the Dapp to get access the wallet accounts

**Kind**: global function

Expand All @@ -124,7 +126,7 @@ cy.approveAuth(1694443839903, ['7NPoMQbiA6trJKkjB35uk96MeJD4PGWkLQLH7k7hXEkZpiba

## rejectAuth(id, reason)

Reject a specific authentication request
Reject a specific authentication request. The Dapp will receive 0 connected wallet as a result.

**Kind**: global function

Expand All @@ -143,7 +145,7 @@ cy.rejectAuth(1694443839903, 'Cancelled')

## getTxRequests()

Read the tx request queue
Read the wallet transaction request queue

**Kind**: global function
**Example**
Expand All @@ -158,7 +160,7 @@ cy.getTxRequests().then((txQueue) => {

## approveTx(id)

Authorize a specific transaction
Approve a specific transaction

**Kind**: global function

Expand Down
201 changes: 1 addition & 200 deletions packages/plugin/README.md
Original file line number Diff line number Diff line change
@@ -1,203 +1,4 @@
<div align="center">

# @chainsafe/cypress-polkadot-wallet monorepo

Test your Dapp with Cypress as if you had a Polkadot wallet connected in the browser.

</div>

## ⚙️ Install

- npm:

```shell
npm install @chainsafe/cypress-polkadot-wallet
```

- yarn:

```shell
yarn add @chainsafe/cypress-polkadot-wallet
```

- pnpm:

```shell
pnpm add @chainsafe/cypress-polkadot-wallet
```

Then import the plugin into your `cypress/support/e2e.js` file:

```js
import '@chainsafe/cypress-polkadot-wallet'
// or
require('@chainsafe/cypress-polkadot-wallet')
```

## 🧪 Usage

You can now easily use the following commands:

## Functions

<dl>
<dt><a href="#initWallet">initWallet(accounts, origin)</a></dt>
<dd><p>Initialize the Polkadot wallet. If an origin is passed there is no need to authorize the first connection for Dapps of this origin</p>
</dd>
<dt><a href="#getAuthRequests">getAuthRequests()</a></dt>
<dd><p>Read the authentication request queue</p>
</dd>
<dt><a href="#approveAuth">approveAuth(id, accountAddresses)</a></dt>
<dd><p>Authorize a specific request</p>
</dd>
<dt><a href="#rejectAuth">rejectAuth(id, reason)</a></dt>
<dd><p>Reject a specific authentication request</p>
</dd>
<dt><a href="#getTxRequests">getTxRequests()</a></dt>
<dd><p>Read the tx request queue</p>
</dd>
<dt><a href="#approveTx">approveTx(id)</a></dt>
<dd><p>Authorize a specific transaction</p>
</dd>
<dt><a href="#rejectTx">rejectTx(id, reason)</a></dt>
<dd><p>Reject a specific transaction</p>
</dd>
</dl>

<a name="initWallet"></a>

## initWallet(accounts, origin)

Initialize the Polkadot wallet. If an origin is passed there is no need to authorize the first connection for Dapps of this origin

**Kind**: global function

| Param | Type | Description |
| -------- | --------------------------------------------- | --------------------------------------------------------------------------- |
| accounts | <code>Array.&lt;InjectedAccount&gt;</code> | Accounts to load into the wallet. |
| origin | <code>string</code> \| <code>undefined</code> | Dapp name to automatically share accounts with without needing to authorize |

**Example**

```js
cy.initWallet(
[{ address: '7NPoMQbiA6trJKkjB35uk96MeJD4PGWkLQLH7k7hXEkZpiba', name: 'Alice', type: 'sr25519' }],
'Multix'
)
```

<a name="getAuthRequests"></a>

## getAuthRequests()

Read the authentication request queue

**Kind**: global function
**Example**

```js
cy.getAuthRequests().then((authQueue) => {
cy.wrap(Object.values(authQueue).length).should('eq', 1)
})
```

<a name="approveAuth"></a>

## approveAuth(id, accountAddresses)

Authorize a specific request

**Kind**: global function

| Param | Type | Description |
| ---------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| id | <code>number</code> | the id of the request to authorize. This id is part of the getAuthRequests object response. |
| accountAddresses | <code>Array.&lt;string&gt;</code> | the account addresses to share with the applications. These addresses must be part of the ones shared in the `initWallet` |

**Example**

```js
cy.approveAuth(1694443839903, ['7NPoMQbiA6trJKkjB35uk96MeJD4PGWkLQLH7k7hXEkZpiba'])
```

<a name="rejectAuth"></a>

## rejectAuth(id, reason)

Reject a specific authentication request

**Kind**: global function

| Param | Type | Description |
| ------ | ------------------- | ---------------------------------------------------------------------------------------- |
| id | <code>number</code> | the id of the request to reject. This id is part of the getAuthRequests object response. |
| reason | <code>reason</code> | the reason for the rejection |

**Example**

```js
cy.rejectAuth(1694443839903, 'Cancelled')
```

<a name="getTxRequests"></a>

## getTxRequests()

Read the tx request queue

**Kind**: global function
**Example**

```js
cy.getTxRequests().then((txQueue) => {
cy.wrap(Object.values(txQueue).length).should('eq', 1)
})
```

<a name="approveTx"></a>

## approveTx(id)

Authorize a specific transaction

**Kind**: global function

| Param | Type | Description |
| ----- | ------------------- | --------------------------------------------------------------------------------------- |
| id | <code>number</code> | the id of the request to approve. This id is part of the getTxRequests object response. |

**Example**

```js
cy.approveTx(1694443839903)
```

<a name="rejectTx"></a>

## rejectTx(id, reason)

Reject a specific transaction

**Kind**: global function

| Param | Type | Description |
| ------ | ------------------- | ----------------------------------------------------------------------------------------- |
| id | <code>number</code> | the id of the tx request to reject. This id is part of the getTxRequests object response. |
| reason | <code>reason</code> | the reason for the rejection |

**Example**

```js
cy.rejectTx(1694443839903, 'Cancelled')
```

## 📐 Example

We have a very simple Dapp example, and a set of Cypress tests using @chainsafe/cypress-polkadot-wallet

- Take a look at the [Example Dapp](/packages/example/src)
- Take a look at the [Cypress tests](/packages/example/cypress/e2e/test%20cypress-polkadot-wallet%20plugin.cy.ts)

## 📄 License

This project is licensed under the terms of the [Apache-2.0](/LICENSE.md).
See [the monorepo readme for instructions](https://github.com/ChainSafe/cypress-polkadot-wallet).
Loading

0 comments on commit e4de35d

Please sign in to comment.