Skip to content

Commit a49ad8d

Browse files
committed
working
1 parent ca38b3d commit a49ad8d

30 files changed

+579
-145
lines changed

README.md

+29-4
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,20 @@ Developing with Docker is much easier, but has some nuances to it. This test doc
8080

8181
You need to run the following script (which takes a long time) in order to get all those .so files.
8282

83+
#### Authentication with Docker and AWS
84+
85+
```aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin {your aws container registry}```
86+
8387
```bash
84-
chmod
88+
chmod +x ./dowload-programs.sh
8589
./dowload-programs.sh
8690
```
8791
This script grabs all the code for these programs and compiles it, and chucks it into your programs folder. Go grab some coffe because this will take a while/
88-
92+
If you get some permissions errors, just sudo delete the programs directory and start again.
8993

9094
We use ``docker-compose`` on some systems its ``docker compose``.
9195
```bash
9296
docker-compose build
93-
9497
```
9598
This builds the docker container for API and the Ingester components and will download the appropriate Redis, Postgres and Solana+plerkle docker images.
9699
Keep in mind that the version `latest` on the Solana Validator image will match the latest version available on the docs, for other versions please change that version in your docker compose file.
@@ -99,5 +102,27 @@ Keep in mind that the version `latest` on the Solana Validator image will match
99102
docker-compose up
100103
```
101104

102-
When making changes you will need to ``docker compose up --force-recreate`` again to get the latest changes.
105+
When making changes you will need to ``docker compose up --build --force-recreate`` again to get the latest changes.
103106
Also when mucking about with the docker file if your gut tells you that something is wrong, and you are getting build errors run `docker compose build --no-cache`
107+
108+
109+
TODO-> make anote about root folders and deleting
110+
Once everything is working you can see that there is a api being served on
111+
```
112+
http://localhost:9090
113+
```
114+
And a Metrics System on
115+
```
116+
http://localhost:3000
117+
```
118+
119+
120+
# Deploying to Kubernetes
121+
Using skaffold you can deploy to k8s, make sure you authenticate with your docker registry
122+
```bash
123+
skaffold build --file-output skaffold-state.json --cache-artifacts=false
124+
## Your namepsace may differ.
125+
skaffold deploy --build-artifacts skaffold-state.json --namespace devnet-read-api --tail=true
126+
```
127+
128+

das_api/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

digital_asset_types/Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

digital_asset_types/src/dao/generated/asset.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub struct Model {
3737
pub royalty_target_type: RoyaltyTargetType,
3838
pub royalty_target: Option<Vec<u8>>,
3939
pub royalty_amount: i32,
40-
pub asset_data: Option<i64>,
40+
pub asset_data: Option<Vec<u8>>,
4141
pub created_at: Option<DateTimeWithTimeZone>,
4242
pub burnt: bool,
4343
pub slot_updated: i64,
@@ -114,7 +114,7 @@ impl ColumnTrait for Column {
114114
Self::RoyaltyTargetType => RoyaltyTargetType::db_type(),
115115
Self::RoyaltyTarget => ColumnType::Binary.def().null(),
116116
Self::RoyaltyAmount => ColumnType::Integer.def(),
117-
Self::AssetData => ColumnType::BigInteger.def().null(),
117+
Self::AssetData => ColumnType::Binary.def().null(),
118118
Self::CreatedAt => ColumnType::TimestampWithTimeZone.def().null(),
119119
Self::Burnt => ColumnType::Boolean.def(),
120120
Self::SlotUpdated => ColumnType::BigInteger.def(),

digital_asset_types/src/dao/generated/asset_data.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ impl EntityName for Entity {
1616

1717
#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)]
1818
pub struct Model {
19-
pub id: i64,
20-
pub asset_id: Vec<u8>,
19+
pub id: Vec<u8>,
2120
pub chain_data_mutability: ChainMutability,
2221
pub chain_data: Json,
2322
pub metadata_url: String,
@@ -29,7 +28,6 @@ pub struct Model {
2928
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
3029
pub enum Column {
3130
Id,
32-
AssetId,
3331
ChainDataMutability,
3432
ChainData,
3533
MetadataUrl,
@@ -44,9 +42,9 @@ pub enum PrimaryKey {
4442
}
4543

4644
impl PrimaryKeyTrait for PrimaryKey {
47-
type ValueType = i64;
45+
type ValueType = Vec<u8>;
4846
fn auto_increment() -> bool {
49-
true
47+
false
5048
}
5149
}
5250

@@ -59,8 +57,7 @@ impl ColumnTrait for Column {
5957
type EntityName = Entity;
6058
fn def(&self) -> ColumnDef {
6159
match self {
62-
Self::Id => ColumnType::BigInteger.def(),
63-
Self::AssetId => ColumnType::Binary.def(),
60+
Self::Id => ColumnType::Binary.def(),
6461
Self::ChainDataMutability => ChainMutability::db_type(),
6562
Self::ChainData => ColumnType::JsonBinary.def(),
6663
Self::MetadataUrl => ColumnType::String(Some(200u32)).def(),

digital_asset_types/src/dao/generated/sea_orm_active_enums.rs

+48-48
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,44 @@ use sea_orm::entity::prelude::*;
44
use serde::{Deserialize, Serialize};
55

66
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
7-
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "chain_mutability")]
8-
pub enum ChainMutability {
9-
#[sea_orm(string_value = "immutable")]
10-
Immutable,
11-
#[sea_orm(string_value = "mutable")]
12-
Mutable,
7+
#[sea_orm(
8+
rs_type = "String",
9+
db_type = "Enum",
10+
enum_name = "royalty_target_type"
11+
)]
12+
pub enum RoyaltyTargetType {
13+
#[sea_orm(string_value = "creators")]
14+
Creators,
15+
#[sea_orm(string_value = "fanout")]
16+
Fanout,
17+
#[sea_orm(string_value = "single")]
18+
Single,
1319
#[sea_orm(string_value = "unknown")]
1420
Unknown,
1521
}
1622
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
1723
#[sea_orm(
1824
rs_type = "String",
1925
db_type = "Enum",
20-
enum_name = "specification_asset_class"
26+
enum_name = "specification_versions"
2127
)]
22-
pub enum SpecificationAssetClass {
23-
#[sea_orm(string_value = "FUNGIBLE_ASSET")]
24-
FungibleAsset,
25-
#[sea_orm(string_value = "FUNGIBLE_TOKEN")]
26-
FungibleToken,
27-
#[sea_orm(string_value = "IDENTITY_NFT")]
28-
IdentityNft,
29-
#[sea_orm(string_value = "NFT")]
30-
Nft,
31-
#[sea_orm(string_value = "NON_TRANSFERABLE_NFT")]
32-
NonTransferableNft,
33-
#[sea_orm(string_value = "PRINT")]
34-
Print,
35-
#[sea_orm(string_value = "PRINTABLE_NFT")]
36-
PrintableNft,
37-
#[sea_orm(string_value = "TRANSFER_RESTRICTED_NFT")]
38-
TransferRestrictedNft,
28+
pub enum SpecificationVersions {
29+
#[sea_orm(string_value = "unknown")]
30+
Unknown,
31+
#[sea_orm(string_value = "v0")]
32+
V0,
33+
#[sea_orm(string_value = "v1")]
34+
V1,
35+
#[sea_orm(string_value = "v2")]
36+
V2,
37+
}
38+
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
39+
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "chain_mutability")]
40+
pub enum ChainMutability {
41+
#[sea_orm(string_value = "immutable")]
42+
Immutable,
43+
#[sea_orm(string_value = "mutable")]
44+
Mutable,
3945
#[sea_orm(string_value = "unknown")]
4046
Unknown,
4147
}
@@ -63,33 +69,27 @@ pub enum OwnerType {
6369
#[sea_orm(
6470
rs_type = "String",
6571
db_type = "Enum",
66-
enum_name = "royalty_target_type"
67-
)]
68-
pub enum RoyaltyTargetType {
69-
#[sea_orm(string_value = "creators")]
70-
Creators,
71-
#[sea_orm(string_value = "fanout")]
72-
Fanout,
73-
#[sea_orm(string_value = "single")]
74-
Single,
75-
#[sea_orm(string_value = "unknown")]
76-
Unknown,
77-
}
78-
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
79-
#[sea_orm(
80-
rs_type = "String",
81-
db_type = "Enum",
82-
enum_name = "specification_versions"
72+
enum_name = "specification_asset_class"
8373
)]
84-
pub enum SpecificationVersions {
74+
pub enum SpecificationAssetClass {
75+
#[sea_orm(string_value = "FUNGIBLE_ASSET")]
76+
FungibleAsset,
77+
#[sea_orm(string_value = "FUNGIBLE_TOKEN")]
78+
FungibleToken,
79+
#[sea_orm(string_value = "IDENTITY_NFT")]
80+
IdentityNft,
81+
#[sea_orm(string_value = "NFT")]
82+
Nft,
83+
#[sea_orm(string_value = "NON_TRANSFERABLE_NFT")]
84+
NonTransferableNft,
85+
#[sea_orm(string_value = "PRINT")]
86+
Print,
87+
#[sea_orm(string_value = "PRINTABLE_NFT")]
88+
PrintableNft,
89+
#[sea_orm(string_value = "TRANSFER_RESTRICTED_NFT")]
90+
TransferRestrictedNft,
8591
#[sea_orm(string_value = "unknown")]
8692
Unknown,
87-
#[sea_orm(string_value = "v0")]
88-
V0,
89-
#[sea_orm(string_value = "v1")]
90-
V1,
91-
#[sea_orm(string_value = "v2")]
92-
V2,
9393
}
9494
#[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)]
9595
#[sea_orm(

digital_asset_types/src/json/chain_data.rs

+10
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ use serde::{Deserialize, Serialize};
55
pub struct ChainDataV1 {
66
pub name: String,
77
pub symbol: String,
8+
#[serde(skip_serializing_if = "Option::is_none")]
89
pub edition_nonce: Option<u8>,
910
pub primary_sale_happened: bool,
11+
#[serde(skip_serializing_if = "Option::is_none")]
1012
pub token_standard: Option<TokenStandard>,
13+
#[serde(skip_serializing_if = "Option::is_none")]
1114
pub uses: Option<Uses>,
1215
}
16+
17+
impl ChainDataV1 {
18+
pub fn sanitize(&mut self) {
19+
self.name = self.name.trim().replace("\0","").to_string();
20+
self.symbol = self.symbol.trim().replace("\0","").to_string();
21+
}
22+
}

docker-compose.yaml

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ services:
1010
- "8126:8126"
1111
- "2003:2003"
1212
- "2004:2004"
13-
1413
grafana:
1514
image: grafana/grafana
1615
restart: always
@@ -20,6 +19,9 @@ services:
2019
- graphite
2120
environment:
2221
- GF_SECURITY_ADMIN_PASSWORD=password
22+
volumes:
23+
- ./grafana/datasources:/etc/grafana/provisioning/datasources
24+
- ./grafana/dashboards:/etc/grafana/provisioning/dashboards
2325
ingester:
2426
depends_on:
2527
- redis
@@ -74,7 +76,7 @@ services:
7476
- ./init.sql:/docker-entrypoint-initdb.d/init.sql:ro
7577
- ./db-data/:/var/lib/postgresql/data/:rw
7678
solana:
77-
image: digital-asset-validator-plugin-solana #ghcr.io/metaplex-foundation/plerkle-test-validator:v0.4.5
79+
image: ghcr.io/metaplex-foundation/plerkle-test-validator:v0.4.6
7880
volumes:
7981
- ./programs:/so/:ro
8082
- ./ledger:/config:rw

grafana/dashboards/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)