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

Create javascript client from rust code #96

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion .github/.env
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CARGO_TERM_COLOR=always
NODE_VERSION=16.x
PROGRAMS=["bubblegum"]
PROGRAMS=["protractor"]
RUST_VERSION=1.68.0
SOLANA_VERSION=1.16.8
ANCHOR_VERSION=0.27.0
Expand Down
6 changes: 3 additions & 3 deletions .github/file-filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ program_common: &program_common
- ".github/file-filters.yml"
- ".github/.env"

bubblegum_program: &bubblegum_program
protractor_program: &protractor_program
- *program_common
- "programs/bubblegum/**"
- "programs/protractor/**"

programs: &programs
- *bubblegum_program
- *protractor_program

# Clients.

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-rust-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ jobs:
with:
name: rust-client-builds
# First wildcard ensures exported paths are consistently under the clients folder.
path: ./client*/rust/target/release/*mpl_bubblegum*
path: ./client*/rust/target/release/*mpl_protractor*
if-no-files-found: error
24 changes: 11 additions & 13 deletions .github/workflows/deploy-program.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:
program:
description: Program
required: true
default: bubblegum
default: protractor
type: choice
options:
- bubblegum
- protractor
cluster:
description: Cluster environment
required: true
Expand Down Expand Up @@ -86,15 +86,13 @@ jobs:
with:
version: ${{ env.ANCHOR_VERSION }}
cache: ${{ env.CACHE }}



- name: Install cargo-release
uses: metaplex-foundation/actions/install-cargo-release@v1
if: github.event.inputs.publish_crate == 'true'
with:
cache: ${{ env.CACHE }}


- name: Install cargo-release
uses: metaplex-foundation/actions/install-cargo-release@v1
if: github.event.inputs.publish_crate == 'true'
Expand All @@ -111,10 +109,10 @@ jobs:

- name: Identify program
run: |
if [ "${{ inputs.program }}" == "bubblegum" ]; then
echo ${{ secrets.BUBBLEGUM_DEPLOY_KEY }} > ./deploy-key.json
echo ${{ secrets.BUBBLEGUM_ID }} > ./program-id.json
echo PROGRAM_NAME="bubblegum" >> $GITHUB_ENV
if [ "${{ inputs.program }}" == "protractor" ]; then
echo ${{ secrets.protractor_DEPLOY_KEY }} > ./deploy-key.json
echo ${{ secrets.protractor_ID }} > ./program-id.json
echo PROGRAM_NAME="protractor" >> $GITHUB_ENV
fi

- name: Bump program version
Expand All @@ -124,7 +122,7 @@ jobs:
MAJOR=`echo ${VERSION} | cut -d. -f1`
MINOR=`echo ${VERSION} | cut -d. -f2`
PATCH=`echo ${VERSION} | cut -d. -f3`

if [ "${{ inputs.bump }}" == "major" ]; then
MAJOR=$((MAJOR + 1))
MINOR=0
Expand All @@ -135,7 +133,7 @@ jobs:
else
PATCH=$((PATCH + 1))
fi

PROGRAM_VERSION="${MAJOR}.${MINOR}.${PATCH}"

cp ./idls/${IDL_NAME}.json ./idls/${IDL_NAME}-previous.json
Expand Down Expand Up @@ -179,13 +177,13 @@ jobs:
git stash
git config user.name "${{ env.COMMIT_USER_NAME }}"
git config user.email "${{ env.COMMIT_USER_EMAIL }}"

cargo login ${{ secrets.CRATES_TOKEN }}
cargo release ${{ inputs.bump }} --no-confirm --no-push --no-tag --no-publish --execute

git reset --soft HEAD~1
git stash pop

- name: Commit and tag new version
uses: stefanzweifel/git-auto-commit-action@v4
if: github.event.inputs.publish_crate == 'true' && github.event.inputs.cluster == 'mainnet-beta'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ dist
.crates
test-programs
programs/.bin
.pnpm-lock.yaml
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"rust-analyzer.linkedProjects": [
"./clients/rust/Cargo.toml",
"./programs/bubblegum/Cargo.toml",
]
}
"rust-analyzer.linkedProjects": [
"./clients/rust/Cargo.toml",
"./programs/protractor/Cargo.toml"
]
}
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,48 @@
<h1 align="center">
Metaplex Bubblegum
Primitives Protocol
</h1>
<p>
Create and manage compressed NFTs on Solana. Compressed NFTs make it possible to scale the creation of NFTs to new orders of magnitude by rethinking the way we store data on-chain.
</p>
<p align="center">
<img width="600" alt="Metaplex Bubblegum" src="https://github.com/metaplex-foundation/mpl-bubblegum/assets/729235/4885acf0-f270-480a-9407-bc5f0baa83c6" />
</p>
<p align="center">
<a href="https://github.com/metaplex-foundation/mpl-bubblegum/actions/workflows/main.yml"><img src="https://img.shields.io/github/actions/workflow/status/metaplex-foundation/mpl-bubblegum/main.yml?logo=GitHub" /></a>
<a href="https://explorer.solana.com/address/metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"><img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmetaplex-foundation%2Fmpl-bubblegum%2Fmain%2Fidls%2Fbubblegum.json&query=%24.version&label=program%20version&logo=data:image/svg%2bxml;base64,PHN2ZyB3aWR0aD0iMzEzIiBoZWlnaHQ9IjI4MSIgdmlld0JveD0iMCAwIDMxMyAyODEiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMF80NzZfMjQzMCkiPgo8cGF0aCBkPSJNMzExLjMxOCAyMjEuMDU3TDI1OS42NiAyNzYuNTU4QzI1OC41MzcgMjc3Ljc2NCAyNTcuMTc4IDI3OC43MjUgMjU1LjY2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8cmVjdCB3aWR0aD0iMzEyLjkzIiBoZWlnaHQ9IjI4MC4zNzciIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==&color=9945FF" /></a>
<a href="https://www.npmjs.com/package/@metaplex-foundation/mpl-bubblegum"><img src="https://img.shields.io/npm/v/%40metaplex-foundation%2Fmpl-bubblegum?logo=npm&color=377CC0" /></a>
<a href="https://crates.io/crates/mpl-bubblegum"><img src="https://img.shields.io/crates/v/mpl-bubblegum?logo=rust" /></a>
<img width="600" alt="Primitives Protocol" src="graph.jpeg" />
</p>

## Getting Started

The packages below can be use to interact with Bubblegum program.
The packages below can be use to interact with the Protractor program.

### TypeScript

```sh
npm install @metaplex-foundation/mpl-bubblegum
npm install @primitives-xyz/protractor
```

[See typedoc documentation](https://mpl-bubblegum-js-docs.vercel.app/).

### Rust

```sh
cargo add mpl-bubblegum
COMING SOON
## cargo add prim-protractor
```

[See crate documentation](https://docs.rs/mpl-bubblegum/latest/mpl_bubblegum/).

## Documentation

Developer documentation for Bubblegum can be found [here](https://developers.metaplex.com/bubblegum).
Developer documentation for Protractor can be found [here](https://developers.metaplex.com/bubblegum).

## Building

From the root directory of the repository:

- Install the required packges:

```sh
pnpm install
```

- Build the program:

```sh
pnpm programs:build
```
Expand All @@ -54,33 +51,38 @@ This will create the program binary at `<ROOT>/programs/.bin`

## Testing

Bubblegum includes two set of tests: BPF and TypeScript.
Protractor includes two set of tests: BPF and TypeScript.

### BPF

From the root directory of the repository:

```sh
pnpm programs:test
```

### TypeScript

From the root directory of the repository:

```sh
pnpm validator
```

This will start a local validator using [Amman](https://github.com/metaplex-foundation/amman).

After starting the validator, go to the folder `<ROOT>/clients/js` and run:

```sh
pnpm install
```

This will install the required packages for the tests. Then, run:

```sh
pnpm build && pnpm test
```

## Security

To report a security issue, please follow the guidance on our [bug bounty program](https://www.metaplex.com/bounty-program) page.
Expand Down
16 changes: 0 additions & 16 deletions clients/js-solita/.eslintrc.js

This file was deleted.

1 change: 0 additions & 1 deletion clients/js-solita/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions clients/js-solita/.prettierignore

This file was deleted.

11 changes: 0 additions & 11 deletions clients/js-solita/.prettierrc.js

This file was deleted.

29 changes: 0 additions & 29 deletions clients/js-solita/.solitarc.js

This file was deleted.

Loading