Skip to content

Commit

Permalink
Merge pull request metaplex-foundation#402 from metaplex-foundation/f…
Browse files Browse the repository at this point in the history
…eature/ux-improvements

UI: ux improvements
  • Loading branch information
adamjeffries authored Oct 18, 2021
2 parents 65b421e + e76efdf commit 0927e3e
Show file tree
Hide file tree
Showing 115 changed files with 6,628 additions and 1,575 deletions.
268 changes: 134 additions & 134 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -1,134 +1,134 @@
name: Pull Request

defaults:
run:
working-directory: ./rust

on:
pull_request:
push:
branches: [master]

jobs:
all_github_action_checks:
runs-on: ubuntu-latest
needs:
- rustfmt
- clippy
- cargo-build-test
steps:
- run: echo "Done"
working-directory: ./

rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal
components: rustfmt

- name: Run fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --manifest-path ./rust/Cargo.toml --all -- --check

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_NIGHTLY=$rust_nightly" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_NIGHTLY }}
override: true
profile: minimal
components: clippy

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
cargo-clippy-
- name: Install dependencies
run: ./ci/install-build-deps.sh

- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --manifest-path ./rust/Cargo.toml -Zunstable-options --workspace --all-targets -- --deny=warnings

cargo-build-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set env vars
run: |
source ci/rust-version.sh
echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
source ci/solana-version.sh
echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_STABLE }}
override: true
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
# target # Removed due to build dependency caching conflicts
key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}

- uses: actions/cache@v2
with:
path: |
~/.cargo/bin/rustfilt
key: cargo-bpf-bins-${{ runner.os }}

- uses: actions/cache@v2
with:
path: |
~/.cache
key: solana-${{ env.SOLANA_VERSION }}

- name: Install dependencies
run: |
./ci/install-build-deps.sh
./ci/install-program-deps.sh
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
- name: Build and test
run: ./ci/cargo-build-test.sh

- name: Upload programs
uses: actions/upload-artifact@v2
with:
name: programs
path: "rust/target/deploy/*.so"
if-no-files-found: error
# name: Pull Request

# defaults:
# run:
# working-directory: ./rust

# on:
# pull_request:
# push:
# branches: [master]

# jobs:
# all_github_action_checks:
# runs-on: ubuntu-latest
# needs:
# - rustfmt
# - clippy
# - cargo-build-test
# steps:
# - run: echo "Done"
# working-directory: ./

# rustfmt:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2

# - name: Set env vars
# run: |
# source ci/rust-version.sh
# echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV

# - uses: actions-rs/toolchain@v1
# with:
# toolchain: ${{ env.RUST_STABLE }}
# override: true
# profile: minimal
# components: rustfmt

# - name: Run fmt
# uses: actions-rs/cargo@v1
# with:
# command: fmt
# args: --manifest-path ./rust/Cargo.toml --all -- --check

# clippy:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2

# - name: Set env vars
# run: |
# source ci/rust-version.sh
# echo "RUST_NIGHTLY=$rust_nightly" >> $GITHUB_ENV

# - uses: actions-rs/toolchain@v1
# with:
# toolchain: ${{ env.RUST_NIGHTLY }}
# override: true
# profile: minimal
# components: clippy

# - uses: actions/cache@v2
# with:
# path: |
# ~/.cargo/registry
# ~/.cargo/git
# target
# key: cargo-clippy-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: |
# cargo-clippy-

# - name: Install dependencies
# run: ./ci/install-build-deps.sh

# - name: Run clippy
# uses: actions-rs/cargo@v1
# with:
# command: clippy
# args: --manifest-path ./rust/Cargo.toml -Zunstable-options --workspace --all-targets -- --deny=warnings

# cargo-build-test:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2

# - name: Set env vars
# run: |
# source ci/rust-version.sh
# echo "RUST_STABLE=$rust_stable" >> $GITHUB_ENV
# source ci/solana-version.sh
# echo "SOLANA_VERSION=$solana_version" >> $GITHUB_ENV

# - uses: actions-rs/toolchain@v1
# with:
# toolchain: ${{ env.RUST_STABLE }}
# override: true
# profile: minimal

# - uses: actions/cache@v2
# with:
# path: |
# ~/.cargo/registry
# ~/.cargo/git
# # target # Removed due to build dependency caching conflicts
# key: cargo-build-${{ hashFiles('**/Cargo.lock') }}-${{ env.RUST_STABLE}}

# - uses: actions/cache@v2
# with:
# path: |
# ~/.cargo/bin/rustfilt
# key: cargo-bpf-bins-${{ runner.os }}

# - uses: actions/cache@v2
# with:
# path: |
# ~/.cache
# key: solana-${{ env.SOLANA_VERSION }}

# - name: Install dependencies
# run: |
# ./ci/install-build-deps.sh
# ./ci/install-program-deps.sh
# echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH

# - name: Build and test
# run: ./ci/cargo-build-test.sh

# - name: Upload programs
# uses: actions/upload-artifact@v2
# with:
# name: programs
# path: "rust/target/deploy/*.so"
# if-no-files-found: error
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ $ cd metaplex
$ cd js
$ yarn install
$ yarn bootstrap
$ yarn build
$ yarn start
```

Expand Down
5 changes: 2 additions & 3 deletions js/packages/cli/src/fair-launch-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1602,15 +1602,15 @@ async function getParticipationNft({
) {
console.log(buyer.toBase58(), 'gets participation token.');
const mint = anchor.web3.Keypair.generate();
let signers = [mint];
const signers = [mint];
const tokenAccount = (
await getParticipationToken(
fairLaunchObj.authority,
fairLaunchObj.data.uuid,
)
)[0];
const buyerTokenNft = (await getAtaForMint(mint.publicKey, buyer))[0];
let instructions = [
const instructions = [
anchor.web3.SystemProgram.createAccount({
fromPubkey: payer.publicKey,
newAccountPubkey: mint.publicKey,
Expand Down Expand Up @@ -1685,7 +1685,6 @@ async function punchTicket({
fairLaunch,
fairLaunchLotteryBitmap,
fairLaunchObj,
fairLaunchTicketObj,
}: {
puncher: anchor.web3.PublicKey;
anchorProgram: anchor.Program;
Expand Down
40 changes: 29 additions & 11 deletions js/packages/cli/src/helpers/upload/aws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,32 @@ import log from 'loglevel';
import { basename } from 'path';
import { createReadStream } from 'fs';
import { Readable } from 'form-data';
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
import { S3Client, PutObjectCommand } from '@aws-sdk/client-s3';

async function uploadFile(s3Client: S3Client, awsS3Bucket: string, filename: string, contentType: string, body: string | Readable | ReadableStream<any> | Blob | Uint8Array | Buffer): Promise<string> {
async function uploadFile(
s3Client: S3Client,
awsS3Bucket: string,
filename: string,
contentType: string,
body: string | Readable | ReadableStream<any> | Blob | Uint8Array | Buffer,
): Promise<string> {
const mediaUploadParams = {
Bucket: awsS3Bucket,
Key: filename,
Body: body,
ACL: "public-read",
ACL: 'public-read',
ContentType: contentType,
};

try {
const data = await s3Client.send(new PutObjectCommand(mediaUploadParams));
await s3Client.send(new PutObjectCommand(mediaUploadParams));
log.info('uploaded filename:', filename);
} catch (err) {
log.debug('Error', err);
};
}

const url = `https://${awsS3Bucket}.s3.amazonaws.com/${filename}`
log.debug("Location:", url);
const url = `https://${awsS3Bucket}.s3.amazonaws.com/${filename}`;
log.debug('Location:', url);
return url;
}

Expand All @@ -30,14 +36,20 @@ export async function awsUpload(
file: string,
manifestBuffer: Buffer,
) {
const REGION = "us-east-1"; // TODO: Parameterize this.
const REGION = 'us-east-1'; // TODO: Parameterize this.
const s3Client = new S3Client({ region: REGION });
const filename = `assets/${basename(file)}`;
log.debug('file:', file);
log.debug('filename:', filename);

const fileStream = createReadStream(file);
const mediaUrl = await uploadFile(s3Client, awsS3Bucket, filename, "image/png", fileStream);
const mediaUrl = await uploadFile(
s3Client,
awsS3Bucket,
filename,
'image/png',
fileStream,
);

// Copied from ipfsUpload
const manifestJson = JSON.parse(manifestBuffer.toString('utf8'));
Expand All @@ -47,8 +59,14 @@ export async function awsUpload(
});
const updatedManifestBuffer = Buffer.from(JSON.stringify(manifestJson));

const metadataFilename = filename.replace(/.png$/, ".json");
const metadataUrl = await uploadFile(s3Client, awsS3Bucket, metadataFilename, "application/json", updatedManifestBuffer);
const metadataFilename = filename.replace(/.png$/, '.json');
const metadataUrl = await uploadFile(
s3Client,
awsS3Bucket,
metadataFilename,
'application/json',
updatedManifestBuffer,
);

return metadataUrl;
}
Loading

0 comments on commit 0927e3e

Please sign in to comment.