Skip to content

Commit

Permalink
fix: nft 주석 처리 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
junseokkim committed Nov 17, 2023
1 parent af0cec5 commit a8bfcd3
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 71 deletions.
48 changes: 24 additions & 24 deletions src/main/java/zerobibim/flory/global/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
//package zerobibim.flory.global.config;
//
//import io.swagger.v3.oas.models.Components;
//import io.swagger.v3.oas.models.OpenAPI;
//import io.swagger.v3.oas.models.info.Info;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class SwaggerConfig {
// @Bean
// public OpenAPI openAPI() {
// return new OpenAPI()
// .components(new Components())
// .info(apiInfo());
// }
//
// private Info apiInfo() {
// return new Info()
// .title("Swagger for flory")
// .description("Springdoc을 사용한 Swagger UI for flory")
// .version("1.0.0");
// }
//}
package zerobibim.flory.global.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {
@Bean
public OpenAPI openAPI() {
return new OpenAPI()
.components(new Components())
.info(apiInfo());
}

private Info apiInfo() {
return new Info()
.title("Swagger for flory")
.description("Springdoc을 사용한 Swagger UI for flory")
.version("1.0.0");
}
}
94 changes: 47 additions & 47 deletions src/main/java/zerobibim/flory/global/config/Web3jConfig.java
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
package zerobibim.flory.global.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.web3j.crypto.Credentials;
import org.web3j.crypto.ECKeyPair;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.http.HttpService;
import org.web3j.tx.Contract;
import org.web3j.tx.gas.StaticGasProvider;
import zerobibim.flory.domain.contract.NFT;

import java.math.BigInteger;

@Configuration
public class Web3jConfig {

@Value("${infura.API_URL}")
private String INFURA_API_URL;

@Value("${metamask.PRIVATE_KEY}")
private String PRIVATE_KEY;

@Value("${metamask.CONTRACT_ADDRESS}")
private String CONTRACT_ADDRESS;

@Bean
public Web3j web3j() {
return Web3j.build(new HttpService(INFURA_API_URL));
}

@Bean
public Credentials credentials() {
BigInteger privateKeyInBT = new BigInteger(PRIVATE_KEY, 16);
return Credentials.create(ECKeyPair.create(privateKeyInBT));
}

@Bean
public NFT nft() {
BigInteger gasPrice = Contract.GAS_PRICE;
BigInteger gasLimit = Contract.GAS_LIMIT;
//StaticGasProvider gasProvider = new StaticGasProvider(gasPrice, gasLimit);

return NFT.load(CONTRACT_ADDRESS, web3j(), credentials(), gasPrice, gasLimit);
}
}
//package zerobibim.flory.global.config;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.web3j.crypto.Credentials;
//import org.web3j.crypto.ECKeyPair;
//import org.web3j.protocol.Web3j;
//import org.web3j.protocol.http.HttpService;
//import org.web3j.tx.Contract;
//import org.web3j.tx.gas.StaticGasProvider;
//import zerobibim.flory.domain.contract.NFT;
//
//import java.math.BigInteger;
//
//@Configuration
//public class Web3jConfig {
//
// @Value("${infura.API_URL}")
// private String INFURA_API_URL;
//
// @Value("${metamask.PRIVATE_KEY}")
// private String PRIVATE_KEY;
//
// @Value("${metamask.CONTRACT_ADDRESS}")
// private String CONTRACT_ADDRESS;
//
// @Bean
// public Web3j web3j() {
// return Web3j.build(new HttpService(INFURA_API_URL));
// }
//
// @Bean
// public Credentials credentials() {
// BigInteger privateKeyInBT = new BigInteger(PRIVATE_KEY, 16);
// return Credentials.create(ECKeyPair.create(privateKeyInBT));
// }
//
// @Bean
// public NFT nft() {
// BigInteger gasPrice = Contract.GAS_PRICE;
// BigInteger gasLimit = Contract.GAS_LIMIT;
// //StaticGasProvider gasProvider = new StaticGasProvider(gasPrice, gasLimit);
//
// return NFT.load(CONTRACT_ADDRESS, web3j(), credentials(), gasPrice, gasLimit);
// }
//}

0 comments on commit a8bfcd3

Please sign in to comment.