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
NONCE_NRGPRICE_QUERY: string = ` | |
query nonce($address: String!) { | |
chainApi { | |
nonce(address: $address) | |
} | |
txnApi { | |
nrgPrice | |
} | |
}` |
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
BALANCE_QUERY: string = ` | |
query balance($address: String!) { | |
chainApi { | |
balance(address: $address) | |
} | |
}` |
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
SEND_RAWTXN_QUERY: string = ` | |
mutation sendRawTransaction($encodedTx: String!) { | |
txnApi { | |
sendRawTransaction(encodedTx: $encodedTx) { | |
status | |
msgHash | |
txHash | |
txResult | |
txDeploy | |
error |
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
BLOCKS_QUERY: string = ` | |
query blocks($first: Long) { | |
blockApi { | |
blocks(first: $first) { | |
number | |
hash | |
parentHash | |
nrgLimit | |
nrgConsumed | |
timestamp |
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
import Control.Monad (void) | |
import Data.Aeson (FromJSON, ToJSON) | |
import qualified Data.Text as T | |
import GHC.Generics (Generic) | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx | |
import Language.PlutusTx.Prelude | |
import Ledger | |
import qualified Ledger.Ada as Ada | |
import qualified Ledger.Constraints as Constraints |
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
public void mintToken() throws ApiException, AddressExcepion, CborSerializationException { | |
BackendService backendService = | |
BackendFactory.getBlockfrostBackendService(Constants.BLOCKFROST_TESTNET_URL, Constant.BF_PROJECT_KEY); | |
FeeCalculationService feeCalculationService = backendService.getFeeCalculationService(); | |
TransactionHelperService transactionHelperService = backendService.getTransactionHelperService(); | |
BlockService blockService = backendService.getBlockService(); | |
String senderMnemonic = "kit color frog trick speak employ suit sort bomb goddess jewel primary spoil fade person useless measure manage warfare reduce few scrub beyond era"; | |
Account sender = new Account(Networks.testnet(), senderMnemonic); |
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
public void transfer() throws ApiException, AddressExcepion, CborSerializationException { | |
BackendService backendService = | |
BackendFactory.getBlockfrostBackendService(Constants.BLOCKFROST_TESTNET_URL, Constant.BF_PROJECT_KEY); | |
FeeCalculationService feeCalculationService = backendService.getFeeCalculationService(); | |
TransactionHelperService transactionHelperService = backendService.getTransactionHelperService(); | |
BlockService blockService = backendService.getBlockService(); | |
String senderMnemonic = "kit color frog trick speak employ suit sort bomb goddess jewel primary spoil fade person useless measure manage warfare reduce few scrub beyond era"; | |
Account sender = new Account(Networks.testnet(), senderMnemonic); |
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
public void transferWithMetadata() throws ApiException, AddressExcepion, CborSerializationException { | |
BackendService backendService = | |
BackendFactory.getBlockfrostBackendService(Constants.BLOCKFROST_TESTNET_URL, Constant.BF_PROJECT_KEY); | |
FeeCalculationService feeCalculationService = backendService.getFeeCalculationService(); | |
TransactionHelperService transactionHelperService = backendService.getTransactionHelperService(); | |
BlockService blockService = backendService.getBlockService(); | |
String senderMnemonic = "kit color frog trick speak employ suit sort bomb goddess jewel primary spoil fade person useless measure manage warfare reduce few scrub beyond era"; | |
Account sender = new Account(Networks.testnet(), senderMnemonic); |
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
import com.bloxbean.cardano.client.account.Account; | |
import com.bloxbean.cardano.client.common.model.Networks; | |
import com.bloxbean.cardano.client.exception.CborDeserializationException; | |
import com.bloxbean.cardano.client.exception.CborSerializationException; | |
import com.bloxbean.cardano.client.transaction.spec.*; | |
import com.bloxbean.cardano.client.util.HexUtil; | |
import java.math.BigInteger; | |
import java.util.Arrays; | |
import java.util.List; |
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
import com.bloxbean.cardano.client.account.Account; | |
import com.bloxbean.cardano.client.backend.api.BackendService; | |
import com.bloxbean.cardano.client.backend.api.BlockService; | |
import com.bloxbean.cardano.client.backend.api.helper.FeeCalculationService; | |
import com.bloxbean.cardano.client.backend.api.helper.TransactionHelperService; | |
import com.bloxbean.cardano.client.backend.api.helper.model.TransactionResult; | |
import com.bloxbean.cardano.client.backend.exception.ApiException; | |
import com.bloxbean.cardano.client.backend.gql.GqlBackendService; | |
import com.bloxbean.cardano.client.backend.model.Result; | |
import com.bloxbean.cardano.client.backend.model.TransactionContent; |
OlderNewer