Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: rename branch to main #1524

Merged
merged 1 commit into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: publish-beta
on:
push:
branches:
- master
- main
tags-ignore:
- "**"
- '**'
paths-ignore:
- "**.md"
- '**.md'

workflow_dispatch:

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: publish
on:
push:
branches:
- master
- main
tags-ignore:
- "**"
- '**'
paths-ignore:
- "**.md"
- '**.md'

workflow_dispatch:

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: tests
on:
push:
branches:
- master
- main
tags-ignore:
- "**"
- '**'

workflow_call:
workflow_dispatch:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: version
on:
push:
branches:
- master
- main
tags-ignore:
- "**"
- '**'
paths-ignore:
- "**.md"
- '**.md'

workflow_dispatch:

Expand All @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: master
ref: main

- uses: actions/setup-node@v3
with:
Expand All @@ -51,8 +51,8 @@ jobs:
- name: Create Release Pull Request
uses: janniks/changesets-action@main
with:
title: "chore: version packages"
commit: "chore: version packages"
version: "npm run ci:version"
title: 'chore: version packages'
commit: 'chore: version packages'
version: 'npm run ci:version'
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Stacks.js [![Test Action Badge](https://github.com/hirosystems/stacks.js/actions/workflows/tests.yml/badge.svg)](https://github.com/hirosystems/stacks.js/actions/workflows/tests.yml) [![Monorepo Version Label](https://img.shields.io/github/lerna-json/v/hirosystems/stacks.js?label=monorepo)](https://github.com/hirosystems/stacks.js/tree/master/packages)
# Stacks.js [![Test Action Badge](https://github.com/hirosystems/stacks.js/actions/workflows/tests.yml/badge.svg)](https://github.com/hirosystems/stacks.js/actions/workflows/tests.yml) [![Monorepo Version Label](https://img.shields.io/github/lerna-json/v/hirosystems/stacks.js?label=monorepo)](https://github.com/hirosystems/stacks.js/tree/main/packages)

This repo is home to most of the Stacks.js packages, which provide the building blocks to work with the [Stacks blockchain](https://www.stacks.co/what-is-stacks) from JavaScript/TypeScript.

Expand All @@ -8,24 +8,24 @@ This repo is home to most of the Stacks.js packages, which provide the building

#### Stacks Primitives

- [`@stacks/transactions`](https://github.com/hirosystems/stacks.js/tree/master/packages/transactions) Construct, decode transactions and work with Clarity smart contracts on the Stacks blockchain.
- [`@stacks/wallet-sdk`](https://github.com/hirosystems/stacks.js/tree/master/packages/wallet-sdk) Library for building wallets, managing accounts, and handling keys for the Stacks blockchain.
- [`@stacks/storage`](https://github.com/hirosystems/stacks.js/tree/master/packages/storage) Store and fetch files with Gaia, the decentralized storage system.
- [`@stacks/encryption`](https://github.com/hirosystems/stacks.js/tree/master/packages/encryption) Encryption functions used by stacks.js packages.
- [`@stacks/auth`](https://github.com/hirosystems/stacks.js/tree/master/packages/auth) Construct and decode authentication requests for Stacks apps.
- [`@stacks/profile`](https://github.com/hirosystems/stacks.js/tree/master/packages/profile) Functions for manipulating user profiles.
- [`@stacks/network`](https://github.com/hirosystems/stacks.js/tree/master/packages/network) Network and API library for working with Stacks blockchain nodes.
- [`@stacks/common`](https://github.com/hirosystems/stacks.js/tree/master/packages/common) Common utilities used by stacks.js packages.
- [`@stacks/transactions`](https://github.com/hirosystems/stacks.js/tree/main/packages/transactions) Construct, decode transactions and work with Clarity smart contracts on the Stacks blockchain.
- [`@stacks/wallet-sdk`](https://github.com/hirosystems/stacks.js/tree/main/packages/wallet-sdk) Library for building wallets, managing accounts, and handling keys for the Stacks blockchain.
- [`@stacks/storage`](https://github.com/hirosystems/stacks.js/tree/main/packages/storage) Store and fetch files with Gaia, the decentralized storage system.
- [`@stacks/encryption`](https://github.com/hirosystems/stacks.js/tree/main/packages/encryption) Encryption functions used by stacks.js packages.
- [`@stacks/auth`](https://github.com/hirosystems/stacks.js/tree/main/packages/auth) Construct and decode authentication requests for Stacks apps.
- [`@stacks/profile`](https://github.com/hirosystems/stacks.js/tree/main/packages/profile) Functions for manipulating user profiles.
- [`@stacks/network`](https://github.com/hirosystems/stacks.js/tree/main/packages/network) Network and API library for working with Stacks blockchain nodes.
- [`@stacks/common`](https://github.com/hirosystems/stacks.js/tree/main/packages/common) Common utilities used by stacks.js packages.

#### Native Smart Contract Interaction

- [`@stacks/bns`](https://github.com/hirosystems/stacks.js/tree/master/packages/bns) Library for interacting with the BNS contract.
- [`@stacks/stacking`](https://github.com/hirosystems/stacks.js/tree/master/packages/stacking) Library for PoX stacking.
- [`@stacks/bns`](https://github.com/hirosystems/stacks.js/tree/main/packages/bns) Library for interacting with the BNS contract.
- [`@stacks/stacking`](https://github.com/hirosystems/stacks.js/tree/main/packages/stacking) Library for PoX stacking.

#### Others

- [`@stacks/cli`](https://github.com/hirosystems/stacks.js/tree/master/packages/cli) Command line interface to interact with auth, storage and Stacks transactions.
- `@stacks/keychain` _**DEPRECATED:** replaced by [`@stacks/wallet-sdk`](https://github.com/hirosystems/stacks.js/tree/master/packages/wallet-sdk)_
- [`@stacks/cli`](https://github.com/hirosystems/stacks.js/tree/main/packages/cli) Command line interface to interact with auth, storage and Stacks transactions.
- `@stacks/keychain` _**DEPRECATED:** replaced by [`@stacks/wallet-sdk`](https://github.com/hirosystems/stacks.js/tree/main/packages/wallet-sdk)_

See the respective `README` in each package directory for installation instructions and usage.

Expand Down
20 changes: 8 additions & 12 deletions packages/auth/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# @stacks/auth

Construct and decode authentication requests for Stacks apps.
Construct and decode authentication requests for Stacks apps.

This package provides the auth logic used by the [Stacks Connect](https://github.com/hirosystems/connect) library. If you're looking to integrate Stacks authentication into your web app, Stacks Connect provides a simple API and built-in user interface. See the [authentication tutorial](https://docs.stacks.co/build-apps/references/authentication).
This package provides the auth logic used by the [Stacks Connect](https://github.com/hirosystems/connect) library. If you're looking to integrate Stacks authentication into your web app, Stacks Connect provides a simple API and built-in user interface. See the [authentication tutorial](https://docs.stacks.co/build-apps/references/authentication).

## Installation

Expand All @@ -15,7 +15,7 @@ npm install @stacks/auth
### Generating an authentication request

```typescript
import { UserSession, makeAuthRequest, AppConfig } from '@stacks/auth'
import { UserSession, makeAuthRequest, AppConfig } from '@stacks/auth';
```

The app domain is the URL to your website/app. This is how the Stacks authentication system identifies apps and determines what credentials to provide. Changing the app domain is equivalent to changing the app. Note that you also need to have a valid manifest.json file at the domain.
Expand All @@ -37,7 +37,7 @@ The authentication payloads are encrypted during transit, the encryption key gen
const transitKey = userSession.generateAndStoreTransitKey();
```

The Stacks auth process will open a compatible Stacks authenticator or browser extension to perform the authentication. So you will need to provide a redirect URL which the authenticator or extension can redirect to with the authentication payload. This page should process the authentication payload.
The Stacks auth process will open a compatible Stacks authenticator or browser extension to perform the authentication. So you will need to provide a redirect URL which the authenticator or extension can redirect to with the authentication payload. This page should process the authentication payload.

```typescript
const redirectUri = 'https://www.myapp.com/auth';
Expand All @@ -52,14 +52,10 @@ const manifestUri = 'https://www.myapp.com/manifest.json';
Finally generate the authentication request payload:

```typescript
const authRequest = userSession.makeAuthRequest(
transitKey,
redirectUri,
manifestUri
);
const authRequest = userSession.makeAuthRequest(transitKey, redirectUri, manifestUri);
```

The resulting payload can now be passed to a compatible Stacks authenticator or browser extension. If you are using Stacks connect, this is performed automatically.
The resulting payload can now be passed to a compatible Stacks authenticator or browser extension. If you are using Stacks connect, this is performed automatically.

If you would like to implement a Stacks authenticator, check out the reference implementation of the [Stacks browser extension, Hiro Wallet](https://github.com/hirosystems/stacks-wallet-web).

Expand All @@ -71,7 +67,7 @@ Below, we use `userSession.isSignInPending` to determine if there is an incoming

```typescript
if (userSession.isSignInPending()) {
userSession.handlePendingSignIn().then((userData) => {
userSession.handlePendingSignIn().then(userData => {
// Do something with userData
});
}
Expand All @@ -97,7 +93,7 @@ userSession.signUserOut();

### Data encryption

Stacks authentication also provides an easy way to encrypt the user's data. If you are using the [`@stacks/storage`](https://github.com/blockstack/stacks.js/tree/master/packages/storage) package, encryption is automatically enabled. If you would like to perform encryption outside of storage you can use the `userSession.encryptContent` and `userSession.decryptContent` methods.
Stacks authentication also provides an easy way to encrypt the user's data. If you are using the [`@stacks/storage`](https://github.com/blockstack/stacks.js/tree/main/packages/storage) package, encryption is automatically enabled. If you would like to perform encryption outside of storage you can use the `userSession.encryptContent` and `userSession.decryptContent` methods.

```typescript
const message = 'My secret message';
Expand Down
2 changes: 1 addition & 1 deletion packages/transactions/src/clarity/deserialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { bytesToAscii, bytesToUtf8, hexToBytes } from '@stacks/common';
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
export default function deserializeCV<T extends ClarityValue = ClarityValue>(
serializedClarityValue: BytesReader | Uint8Array | string
Expand Down
2 changes: 1 addition & 1 deletion packages/transactions/src/clarity/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function serializeStringUtf8CV(cv: StringUtf8CV) {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
export function serializeCV(value: ClarityValue): Uint8Array {
switch (value.type) {
Expand Down
6 changes: 3 additions & 3 deletions packages/transactions/src/clarity/types/booleanCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ interface FalseCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const trueCV = (): BooleanCV => ({ type: ClarityType.BoolTrue });

Expand All @@ -42,7 +42,7 @@ const trueCV = (): BooleanCV => ({ type: ClarityType.BoolTrue });
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const falseCV = (): BooleanCV => ({ type: ClarityType.BoolFalse });

Expand All @@ -60,7 +60,7 @@ const falseCV = (): BooleanCV => ({ type: ClarityType.BoolFalse });
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const boolCV = (bool: boolean) => (bool ? trueCV() : falseCV());

Expand Down
4 changes: 2 additions & 2 deletions packages/transactions/src/clarity/types/bufferCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface BufferCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const bufferCV = (buffer: Uint8Array): BufferCV => {
if (buffer.length > 1_000_000) {
Expand Down Expand Up @@ -54,7 +54,7 @@ const bufferCV = (buffer: Uint8Array): BufferCV => {
*```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const bufferCVFromString = (str: string): BufferCV => bufferCV(utf8ToBytes(str));

Expand Down
4 changes: 2 additions & 2 deletions packages/transactions/src/clarity/types/intCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ interface IntCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const intCV = (value: IntegerType): IntCV => {
const bigInt = intToBigInt(value, true);
Expand Down Expand Up @@ -61,7 +61,7 @@ interface UIntCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
const uintCV = (value: IntegerType): UIntCV => {
const bigInt = intToBigInt(value, false);
Expand Down
2 changes: 1 addition & 1 deletion packages/transactions/src/clarity/types/listCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface ListCV<T extends ClarityValue = ClarityValue> {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function listCV<T extends ClarityValue = ClarityValue>(values: T[]): ListCV<T> {
return { type: ClarityType.List, list: values };
Expand Down
4 changes: 2 additions & 2 deletions packages/transactions/src/clarity/types/optionalCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface SomeCV<T extends ClarityValue = ClarityValue> {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function noneCV(): NoneCV {
return { type: ClarityType.OptionalNone };
Expand All @@ -47,7 +47,7 @@ function noneCV(): NoneCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function someCV<T extends ClarityValue = ClarityValue>(value: T): OptionalCV<T> {
return { type: ClarityType.OptionalSome, value };
Expand Down
8 changes: 4 additions & 4 deletions packages/transactions/src/clarity/types/principalCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function principalCV(principal: string): PrincipalCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function standardPrincipalCV(addressString: string): StandardPrincipalCV {
const addr = createAddress(addressString);
Expand All @@ -77,7 +77,7 @@ function standardPrincipalCV(addressString: string): StandardPrincipalCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function standardPrincipalCVFromAddress(address: Address): StandardPrincipalCV {
return { type: ClarityType.PrincipalStandard, address };
Expand All @@ -98,7 +98,7 @@ function standardPrincipalCVFromAddress(address: Address): StandardPrincipalCV {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function contractPrincipalCV(addressString: string, contractName: string): ContractPrincipalCV {
const addr = createAddress(addressString);
Expand All @@ -122,7 +122,7 @@ function contractPrincipalCV(addressString: string, contractName: string): Contr
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function contractPrincipalCVFromAddress(
address: Address,
Expand Down
4 changes: 2 additions & 2 deletions packages/transactions/src/clarity/types/responseCV.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interface ResponseOkCV<T extends ClarityValue = ClarityValue> {
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function responseErrorCV<T extends ClarityValue = ClarityValue>(value: T): ResponseErrorCV<T> {
return { type: ClarityType.ResponseErr, value };
Expand All @@ -53,7 +53,7 @@ function responseErrorCV<T extends ClarityValue = ClarityValue>(value: T): Respo
* ```
*
* @see
* {@link https://github.com/hirosystems/stacks.js/blob/master/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
* {@link https://github.com/hirosystems/stacks.js/blob/main/packages/transactions/tests/clarity.test.ts | clarity test cases for more examples}
*/
function responseOkCV<T extends ClarityValue = ClarityValue>(value: T): ResponseOkCV<T> {
return { type: ClarityType.ResponseOk, value };
Expand Down
Loading