-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af0cec5
commit a8bfcd3
Showing
2 changed files
with
71 additions
and
71 deletions.
There are no files selected for viewing
48 changes: 24 additions & 24 deletions
48
src/main/java/zerobibim/flory/global/config/SwaggerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
94
src/main/java/zerobibim/flory/global/config/Web3jConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
// } | ||
//} |