Skip to content

Commit

Permalink
add publish ci, update readme and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptowen committed Jun 18, 2023
1 parent fff1d01 commit a8515bc
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish package to GitHub Packages

on:
release:
types: [published]

jobs:
release:
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.4
with:
version: 8.1.1
- uses: actions/setup-node@v3.6.0
with:
node-version: '18'
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'
scope: '@suia'
- run: |
pnpm install --frozen-lockfile
pnpm run build
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- uses: actions/setup-node@v3.6.0
with:
node-version: '18'
cache: 'pnpm'
registry-url: 'https://npm.pkg.github.com'
scope: '@suia'
- run: pnpm publish --no-git-checks --access public --registry https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,44 @@

Install package: `npm install @suia/suibox`

Usage example:

```typescript
import { SuiboxContract } from '@suia/suibox';
import { devnetConnection, Ed25519Keypair, JsonRpcProvider, RawSigner } from '@mysten/sui.js';

async function main(): Promise<void> {
// init connection and signer
const connection = devnetConnection;
const provider = new JsonRpcProvider(connection);
const keypairseed = process.env.KEY_PAIR_SEED;
const keypair = Ed25519Keypair.fromSecretKey(Uint8Array.from(Buffer.from(keypairseed!, 'hex')));
const signer = new RawSigner(keypair, provider);

// publish a new suibox contract
const suiboxContract = await SuiboxContract.publish(signer);

// you can also specify an existing suibox contract with the function below
// const suiboxContract = new Contract(packageId, signer);

// create a new suibox
const suibox = await suiboxContract.createSuibox({
name: 'suibox name',
description: 'suibox description',
image_url: 'suibox image url',
layout: '9-box grid',
});

// list all suiboxes owned by the signer
const suiboxes = await suiboxContract.listSuiboxes();

// add an nft to the suibox
await suibox.add({ objectId: nft.objectId }, position);

// list all nfts in the suibox
const nftsAfterAddNFT = await suibox.listNFTs();

// extract the nft from the suibox
await suibox.extract(nftTypestruct, position);
}
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@suia/suibox",
"version": "0.1.0",
"version": "0.1.1",
"description": "SDK for interacting with the Suibox Contract on Sui Network",
"keywords": [
"sui",
Expand Down

0 comments on commit a8515bc

Please sign in to comment.