mirror of
https://github.com/0xfnzero/solana-streamer.git
synced 2026-08-23 05:48:05 +00:00
remove trade.rs
This commit is contained in:
+5
-5
@@ -63,12 +63,12 @@ pub struct CreateTokenMetadata {
|
|||||||
pub metadata_uri: Option<String>,
|
pub metadata_uri: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn create_token_metadata(metadata: CreateTokenMetadata, api_key: &str) -> Result<TokenMetadataIPFS, anyhow::Error> {
|
pub async fn create_token_metadata(metadata: CreateTokenMetadata, jwt_token: &str) -> Result<TokenMetadataIPFS, anyhow::Error> {
|
||||||
let ipfs_url = if metadata.file.starts_with("http") || metadata.metadata_uri.is_some() {
|
let ipfs_url = if metadata.file.starts_with("http") || metadata.metadata_uri.is_some() {
|
||||||
metadata.file
|
metadata.file
|
||||||
} else {
|
} else {
|
||||||
let base64_string = file_to_base64(&metadata.file).await?;
|
let base64_string = file_to_base64(&metadata.file).await?;
|
||||||
upload_base64_file(&base64_string, api_key).await?
|
upload_base64_file(&base64_string, jwt_token).await?
|
||||||
};
|
};
|
||||||
|
|
||||||
let token_metadata = TokenMetadata {
|
let token_metadata = TokenMetadata {
|
||||||
@@ -94,7 +94,7 @@ pub async fn create_token_metadata(metadata: CreateTokenMetadata, api_key: &str)
|
|||||||
let response = client
|
let response = client
|
||||||
.post("https://api.pinata.cloud/pinning/pinJSONToIPFS")
|
.post("https://api.pinata.cloud/pinning/pinJSONToIPFS")
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.header("Authorization", format!("Bearer {}", api_key))
|
.header("Authorization", format!("Bearer {}", jwt_token))
|
||||||
.json(&token_metadata)
|
.json(&token_metadata)
|
||||||
.send()
|
.send()
|
||||||
.await?;
|
.await?;
|
||||||
@@ -116,7 +116,7 @@ pub async fn create_token_metadata(metadata: CreateTokenMetadata, api_key: &str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn upload_base64_file(base64_string: &str, api_key: &str) -> Result<String, anyhow::Error> {
|
pub async fn upload_base64_file(base64_string: &str, jwt_token: &str) -> Result<String, anyhow::Error> {
|
||||||
let decoded_bytes = general_purpose::STANDARD.decode(base64_string)?;
|
let decoded_bytes = general_purpose::STANDARD.decode(base64_string)?;
|
||||||
|
|
||||||
let client = Client::builder()
|
let client = Client::builder()
|
||||||
@@ -133,7 +133,7 @@ pub async fn upload_base64_file(base64_string: &str, api_key: &str) -> Result<St
|
|||||||
|
|
||||||
let response = client
|
let response = client
|
||||||
.post("https://api.pinata.cloud/pinning/pinFileToIPFS")
|
.post("https://api.pinata.cloud/pinning/pinFileToIPFS")
|
||||||
.header("Authorization", format!("Bearer {}", api_key))
|
.header("Authorization", format!("Bearer {}", jwt_token))
|
||||||
.header("Accept", "application/json")
|
.header("Accept", "application/json")
|
||||||
.multipart(form)
|
.multipart(form)
|
||||||
.send()
|
.send()
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ pub mod instruction;
|
|||||||
pub mod grpc;
|
pub mod grpc;
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod ipfs;
|
pub mod ipfs;
|
||||||
pub mod trade;
|
|
||||||
pub mod jito;
|
pub mod jito;
|
||||||
pub mod pumpfun;
|
pub mod pumpfun;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user