코인보내기/Contract 실행

이 문서는 '코인 보내기' 및 '스마트 컨트랙트 실행' 방법에 대하여 설명합니다.

Steps

  1. Transaction 결과 확인

가스비 조회

체인ID에 해당하는 네트워크(블록체인)의 현재 네트워크 사용료(가스비) 정보를 가져옵니다.

val gas = fncyWallet.(
    chainId = 3
)

See Also

getGasPrice

FncyGasPrice

티켓 정보 조회

Ticket을 생성하기 전 전송 가능여부 및 nonce, gasLimit등을 확인한다.

Ticket의 전송은 아래 3가지 타입이 있다.

  • AssetTransfer : Coin전송

  • SmartContract : Token전송 및 Contract 실행

  • WalletConnect : WalletConnect연결 시에 사용

See Also

estimateTicket

FncyTicket

TicketType

Coin 전송

val info = fncyWallet.estimateTicket(
    walletId = 10000L, //지갑 ID
    chainId = 3L, // bsc: 1, eth: 2, fncy: 3
    signatureType = TicketType.AssetTransfer, 
    toAddress = "0x1234...", //코인을 받을 주소
    transferVal = "1000000000000000000".toBigInteger(), //보낼 수량 (단위: wei)
    txGasPrice = "10000000000".toBigInteger(), //Gas Price (단위: wei)
    assetId = 6L, //보낼 자산 asset ID
    maxPriorityPerGas = BigInteger.ZERO, //ETH 전송일 경우 사용
    maxFeePerGas = BigInteger.ZERO // ETH전송일 경우 사용
)

Token 전송(Contract 실행)

val info = fncyWallet.estimateTicket(
    walletId = 10000L, //지갑 ID
    chainId = 3L, // bsc: 1, eth: 2, fncy: 3
    signatureType = TicketType.SmartContract, //
    toAddress = "0x1234...", //코인을 받을 주소
    transferVal = "0".toBigInteger(), //보낼 수량 (단위: wei)
    txGasPrice = "10000000000".toBigInteger(), //Gas Price (단위: wei)
    contractAddress = "0x1234...", //Contract Address
    txInput = "0x123456....", //Data
    assetId = 6L, //보낼 자산 asset ID
    maxPriorityPerGas = BigInteger.ZERO, //ETH 전송일 경우 사용
    maxFeePerGas = BigInteger.ZERO // ETH전송일 경우 사용
)

WalletConnect

val info = fncyWallet.estimateTicket(
    walletId = 10000L, //지갑 ID
    chainId = 3L, // bsc: 1, eth: 2, fncy: 3
    signatureType = TicketType.WalletConnect, //
    toAddress = "0x1234...", //코인을 받을 주소
    transferVal = "1000000000000000000".toBigInteger(), //보낼 수량 (단위: wei)
    txGasPrice: "10000000000".toBigInteger(), //Gas Price (단위: wei)
    contractAddress: "0x1234...", //Contract Address
    txInput: "0x123456....", //Data
    assetId: 6L, //보낼 자산 asset ID
    maxPriorityPerGas = BigInteger.ZERO, //ETH 전송일 경우 사용
    maxFeePerGas = BigInteger.ZERO // ETH전송일 경우 사용
)

티켓 생성

네트워크에 전송할 티켓(트랜잭션 정보)을 서버에 등록하고, 해당 티켓의 UUID 정보를 가져옵니다.

See Also

makeTicket

FncyTicketResult

Coin 전송

val info = fncyWallet.makeTicket(
    walletId = 10000L, //지갑 ID
    chainId = 3L, // bsc: 1, eth: 2, fncy: 3
    signatureType = TicketType.AssetTransfer, 
    toAddress = "0x1234...", //코인을 받을 주소
    transferVal = "1000000000000000000".toBigInteger(), //보낼 수량 (단위: wei)
    txGasPrice = "10000000000".toBigInteger(), //Gas Price (단위: wei)
    assetId = 6L, //보낼 자산 asset ID
    maxPriorityPerGas = BigInteger.ZERO, //ETH 전송일 경우 사용
    maxFeePerGas = BigInteger.ZERO, // ETH전송일 경우 사용
    txGasLimit = "21000".toBigInteger() // Gas Limit
)

Token 전송(Contract 실행)

val info = fncyWallet.makeTicket(
    walletId = 10000L, //지갑 ID
    chainId = 3L, // bsc: 1, eth: 2, fncy: 3
    signatureType = TicketType.SmartContract, 
    toAddress = "0x1234...", //코인을 받을 주소
    transferVal = "1000000000000000000".toBigInteger(), //보낼 수량 (단위: wei)
    txGasPrice = "10000000000".toBigInteger(), //Gas Price (단위: wei)
    contractAddress: "0x1234...", //Contract Address
    txInput: "0x123456....", //Data
    assetId = 6L, //보낼 자산 asset ID
    maxPriorityPerGas = BigInteger.ZERO, //ETH 전송일 경우 사용
    maxFeePerGas = BigInteger.ZERO, // ETH전송일 경우 사용
    txGasLimit = "21000".toBigInteger() // Gas Limit
)

WalletConnect

val info = fncyWallet.makeTicket(
    walletId = 10000L, //지갑 ID
    chainId = 3L, // bsc: 1, eth: 2, fncy: 3
    signatureType = TicketType.WalletConnect, 
    toAddress = "0x1234...", //코인을 받을 주소
    transferVal = "1000000000000000000".toBigInteger(), //보낼 수량 (단위: wei)
    txGasPrice = "10000000000".toBigInteger(), //Gas Price (단위: wei)
    contractAddress: "0x1234...", //Contract Address
    txInput: "0x123456....", //Data
    assetId = 6L, //보낼 자산 asset ID
    maxPriorityPerGas = BigInteger.ZERO, //ETH 전송일 경우 사용
    maxFeePerGas = BigInteger.ZERO, // ETH전송일 경우 사용
    txGasLimit = "21000".toBigInteger() // Gas Limit
)

티켓 정보 확인

TicketUuid로 해당 Uuid에 해당하는 Ticket 정보를 조회합니다.

val info = fncyWallet.getTicketInfo(
    ticketUuid = "ticketUuid", // Ticekt UUID
)

See Also

getTicketInfo

FncyTicket

티켓 전송

티켓 전송은 서버에 등록된 티켓 정보를 사용하여 실제 트랜잭션 실행을 요청합니다.

티켓 전송이 성공하면 해당 트랜잭션 이력은 블록체인에 영구적으로 포함되며 변경하거나 취소할 수 없습니다.

발행된 티켓UUID지갑 비밀번호를 전달하여 해당 티켓 정보로 실제 트랜잭션을 실행시킵니다.

티켓UUID를 얻는 방법은 티켓 생성을 확인하십시오.

val result = fncyWallet.sendTicket(
    ticketUuids = "ticketUuid", // Ticekt UUID
    pinNumber = "000000" // 지갑 비밀번호
)

See Also

sendTicket

Last updated