Skip to content

Commit 1c864af

Browse files
authored
Merge pull request #9 from holaplex/anshul/rust_airdrop
Airdrop cron job service in rust
2 parents 61bf127 + 4db605f commit 1c864af

File tree

18 files changed

+2648
-84
lines changed

18 files changed

+2648
-84
lines changed

.github/worfklows/release.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release
8+
9+
jobs:
10+
build:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
target:
15+
- x86_64-unknown-linux-musl
16+
include:
17+
- target: x86_64-unknown-linux-musl
18+
os: ubuntu-latest
19+
runs-on: ${{ matrix.os }}
20+
21+
services:
22+
postgres:
23+
image: postgres:14.1
24+
25+
env:
26+
POSTGRES_USER: ci
27+
POSTGRES_PASSWORD: ci
28+
POSTGRES_PORT: 5432
29+
POSTGRES_DB: ci
30+
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Build Linux
34+
if: matrix.os == 'ubuntu-latest'
35+
run: |
36+
cp holaplex.graphql ./scripts/airdrop && cd scripts/airdrop
37+
docker run --network host --rm -t \
38+
-e DATABASE_URL=postgres://ci:[email protected]:5432/ci
39+
-v $HOME/.cargo/registry/:/root/.cargo/registry \
40+
-v "$(pwd)":/volume \
41+
clux/muslrust:stable \
42+
cargo build --release --target ${{ matrix.target }}
43+
44+
- name: Upload
45+
uses: actions/upload-artifact@v2
46+
with:
47+
name: airdrop-${{ matrix.os }}-amd64
48+
path: target/${{ matrix.target }}/release/airdrop
49+
if-no-files-found: error
50+
51+
release:
52+
needs: build
53+
runs-on: ubuntu-latest
54+
steps:
55+
- uses: actions/checkout@v2
56+
- name: Download
57+
uses: actions/download-artifact@v2
58+
- name: Layout
59+
run: |
60+
mv airdrop-ubuntu-latest-amd64/airdrop ./airdrop-linux-amd64
61+
rm -rf airdrop-ubuntu-latest-amd64
62+
63+
- name: Release
64+
uses: softprops/action-gh-release@v1
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
67+
with:
68+
generate_release_notes: true
69+
draft: true
70+
fail_on_unmatched_files: true
71+
files: |
72+
airdrop-linux-amd64

holaplex.graphql

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ type BlockchainCost {
112112
type Collection {
113113
"""
114114
The blockchain address of the collection used to view it in blockchain explorers.
115+
On Solana this is the mint address.
116+
On EVM chains it is the concatenation of the contract address and the token id `{contractAddress}:{tokenId}`.
115117
"""
116118
address: String
117119

@@ -191,8 +193,12 @@ input CollectionCreatorInput {
191193

192194
"""Represents a single NFT minted from a collection."""
193195
type CollectionMint {
194-
"""The wallet address of the NFT."""
195-
address: String!
196+
"""
197+
The address of the NFT
198+
On Solana this is the mint address.
199+
On EVM chains it is the concatenation of the contract address and the token id `{contractAddress}:{tokenId}`.
200+
"""
201+
address: String
196202

197203
"""The collection the NFT was minted from."""
198204
collection: Collection
@@ -637,6 +643,9 @@ enum FilterType {
637643
"""Event triggered when a new drop is minted"""
638644
DROP_MINTED
639645

646+
"""Event triggered when a mint has been successfully transfered"""
647+
MINT_TRANSFERED
648+
640649
"""Event triggered when a new project is created"""
641650
PROJECT_CREATED
642651

@@ -653,7 +662,7 @@ type Holder {
653662
collectionId: UUID!
654663

655664
"""The specific mints from the collection that the holder owns."""
656-
mints: [String!]!
665+
mints: [UUID!]!
657666

658667
"""The number of NFTs that the holder owns in the collection."""
659668
owns: Int!
@@ -664,7 +673,7 @@ type Invite {
664673
"""
665674
The datetime, in UTC, when the invitation to join the organization was created.
666675
"""
667-
createdAt: NaiveDateTime!
676+
createdAt: DateTime!
668677

669678
"""The ID of the user who created the invitation."""
670679
createdBy: UUID!
@@ -692,7 +701,7 @@ type Invite {
692701
status: InviteStatus!
693702

694703
"""The datetime, in UTC, when the invitation status was updated."""
695-
updatedAt: NaiveDateTime
704+
updatedAt: DateTime
696705
}
697706

698707
"""Input required for inviting a member to the organization."""
@@ -726,12 +735,12 @@ A member of a Holaplex organization, representing an individual who has been gra
726735
"""
727736
type Member {
728737
"""The datetime, in UTC, when the member joined the organization."""
729-
createdAt: NaiveDateTime!
738+
createdAt: DateTime!
730739

731740
"""
732741
The datetime, in UTC, when the member was deactivated from the organization.
733742
"""
734-
deactivatedAt: NaiveDateTime
743+
deactivatedAt: DateTime
735744

736745
"""The unique identifier of the member."""
737746
id: UUID!
@@ -759,7 +768,7 @@ type Member {
759768
"""
760769
The datetime, in UTC, when the member was revoked from the organization.
761770
"""
762-
revokedAt: NaiveDateTime
771+
revokedAt: DateTime
763772

764773
"""The user identity who is a member of the organization."""
765774
user: User
@@ -1061,7 +1070,7 @@ type Organization {
10611070
"""
10621071
The datetime, in UTC, when the Holaplex organization was created by its owner.
10631072
"""
1064-
createdAt: NaiveDateTime!
1073+
createdAt: DateTime!
10651074

10661075
"""
10671076
Get a single API credential by client ID.
@@ -1103,7 +1112,7 @@ type Organization {
11031112
"""
11041113
The datetime, in UTC, when the Holaplex organization was deactivated by its owner.
11051114
"""
1106-
deactivatedAt: NaiveDateTime
1115+
deactivatedAt: DateTime
11071116

11081117
"""
11091118
Define an asynchronous function to load the total credits deducted for each action
@@ -1137,11 +1146,12 @@ type Organization {
11371146
The owner of the Holaplex organization, who has created the organization and has full control over its settings and members.
11381147
"""
11391148
owner: Owner
1149+
profileImageUrl: String
11401150

11411151
"""
11421152
The optional profile image associated with the Holaplex organization, which can be used to visually represent the organization.
11431153
"""
1144-
profileImageUrl: String
1154+
profileImageUrlOriginal: String
11451155

11461156
"""
11471157
The projects that have been created and are currently associated with the Holaplex organization, which are used to organize NFT campaigns or initiatives within the organization.
@@ -1189,7 +1199,7 @@ The owner of the Holaplex organization, who is the individual that created the o
11891199
"""
11901200
type Owner {
11911201
"""The datetime, in UTC, when the organization was created."""
1192-
createdAt: NaiveDateTime!
1202+
createdAt: DateTime!
11931203

11941204
"""
11951205
The unique identifier assigned to the record of the user who created the Holaplex organization and serves as its owner, which is used to distinguish their record from other records within the Holaplex ecosystem.
@@ -1259,7 +1269,7 @@ A Holaplex project that belongs to an organization. Projects are used to group u
12591269
"""
12601270
type Project {
12611271
"""The datetime, in UTC, when the project was created."""
1262-
createdAt: NaiveDateTime!
1272+
createdAt: DateTime!
12631273

12641274
"""Retrieve a customer record associated with the project, using its ID."""
12651275
customer(id: UUID!): Customer
@@ -1270,7 +1280,7 @@ type Project {
12701280
"""
12711281
The date and time in Coordinated Universal Time (UTC) when the Holaplex project was created. Once a project is deactivated, objects that were assigned to the project can no longer be interacted with.
12721282
"""
1273-
deactivatedAt: NaiveDateTime
1283+
deactivatedAt: DateTime
12741284

12751285
"""Look up a drop associated with the project by its ID."""
12761286
drop(id: UUID!): Drop
@@ -1289,11 +1299,12 @@ type Project {
12891299

12901300
"""The ID of the Holaplex organization to which the project belongs."""
12911301
organizationId: UUID!
1302+
profileImageUrl: String
12921303

12931304
"""
12941305
The optional profile image associated with the project, which can be used to visually represent the project.
12951306
"""
1296-
profileImageUrl: String
1307+
profileImageUrlOriginal: String
12971308

12981309
"""
12991310
The treasury assigned to the project, which contains the project's wallets.
@@ -1434,8 +1445,8 @@ type TransferAssetPayload {
14341445
A collection of wallets assigned to different entities in the Holaplex ecosystem.
14351446
"""
14361447
type Treasury {
1437-
"""The creation datetime of the vault."""
1438-
createdAt: NaiveDateTime!
1448+
"""The creation DateTimeWithTimeZone of the vault."""
1449+
createdAt: DateTime!
14391450

14401451
"""The unique identifier for the treasury."""
14411452
id: UUID!
@@ -1502,20 +1513,20 @@ A blockchain wallet is a digital wallet that allows users to securely store, man
15021513
"""
15031514
type Wallet {
15041515
"""The wallet address."""
1505-
address: String!
1516+
address: String
15061517

15071518
"""The wallet's associated blockchain."""
15081519
assetId: AssetType!
1509-
createdAt: NaiveDateTime!
1520+
createdAt: DateTime!
15101521
createdBy: UUID!
1511-
legacyAddress: String!
1522+
deductionId: UUID
1523+
id: UUID!
15121524

15131525
"""
15141526
The NFTs that were minted from Holaplex and are owned by the wallet's address.
15151527
"""
15161528
mints: [CollectionMint!]
1517-
removedAt: NaiveDateTime
1518-
tag: String!
1529+
removedAt: DateTime
15191530
treasuryId: UUID!
15201531
}
15211532

package-lock.json

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
"generate": "prisma generate",
1515
"reset": "prisma migrate reset --force",
1616
"codegen": "graphql-codegen",
17-
"airdrop": "npx ts-node --compiler-options \"{\\\"module\\\":\\\"commonjs\\\"}\" -T ./scripts/airdrop.ts",
17+
"airdrop_ts": "npx ts-node --compiler-options \"{\\\"module\\\":\\\"commonjs\\\"}\" -T ./scripts/airdrop.ts",
18+
"airdrop": "cd ./scripts/airdrop && cargo run",
1819
"db": "prisma migrate deploy"
1920
},
2021
"dependencies": {

scripts/airdrop/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
target
2+
/.vscode/
3+
.env.local
4+
**/*.rs.bk

0 commit comments

Comments
 (0)