Ethereum & EVM compatible
The D'CENT Android SDK provides functions for signing transaction of coins.
This function for :
.ETHEREUM
- ethereum (ETH).ETH_CLASSIC
- ethereum classic (ETC).ETH_KOVAN
- ethereum kovan (ETHt).ETH_ROPSTEN
- ethereum ropsten (ETHt).ETH_GOERLI
- ethereum goerli (ETHt).ETH_RINKEBY
- ethereum rinkeby (ETHt).FLR_COSTON
- flare network coston (CFLR).RSK
- rsk smart bitcoin (RBTC).RSK_TESTNET
- rsk smart bitcoin testnet (RBTCt).XDC
- xcd network (XDC).XDC_APOTHEM
- xdc apothem (XDCt).BSC
- binance smart chain (BNB).BSC_TESTNET
- binance smart chain testnet (BNBt).POLYGON
- polygon (MATIC).POLYGON_TESTNET
- polygon testnet (MATICt).CHAN
- other evm networks
- coinType: ethereum networks coin type
Name | Type | Description |
---|---|---|
addressPath | String | sign key path for ethereum transaction |
nonce | String | account nonce for ethereum transaction |
to | String | recipient's address of ethereum transaction |
amount | String | amount of ether to be sent. ( wei unit value ) |
gasLimit | String | gas limit value of ethereum transaction |
gasPrice | String | gas price for ethereum transaction |
data | String | transaction data of ethereum transaction |
chainId | String | chain id |
symbol | String | symbol for ethereum transaction
symbol value used for evm chain ( .CHAN ) |
txType | String | (optional)Type of ethereum transaction |
maxPriorityFpg | String | (optional)max_priority_fpg of ethereum transaction |
maxFeePerGas | String | (optional)max_fee_per gas of ethereum transaction |
accessList | String | (optional)access_list of ethereum transaction |
- result: (Bool)
true
if successful,false
if error occurred - txData: signed transaction
- Refer to "D`CENT Firmware Update History" to determine which D'CENT Biometric Wallet versions are supported on each network.
Example
let ethereumTransaction : EthereumTransaction = EthereumTransaction( addressPath:"", nonce:"", to:"", amount:"", gasLimit:"", gasPrice:"", data:"", chainId:"0" )
// test data
ethereumTransaction.addressPath = "m/44'/60'/0'/0/0"
ethereumTransaction.nonce = "14"
ethereumTransaction.to = "0xe5c23dAa6480e45141647E5AeB321832150a28D4"
ethereumTransaction.amount = "500000000000000"
ethereumTransaction.gasLimit = "21000"
ethereumTransaction.gasPrice = "6000000000"
ethereumTransaction.data = "0x"
ethereumTransaction.chainId = "1"
DcentMgr.getEthereumSignedTransaction(coinType:.ETHEREUM , ethereumTransaction:ethereumTransaction){ (result, txData) in
print("Ethereum Transaction closure")
if result == false {
print("FAIL !!!")
}else{
print(txData)
}
}
This fuction for :
.ERC20
- ethereum erc20 token.ETC_ERC20
- ethereum classic erc20 token.ERC20_KOVAN
- ethereum kovan erc20 token(ETH.ERC20_ROPSTEN
- ethereum ropsten erc20 token.ERC20_GOERLI
- ethereum goerli erc20 token.ERC20_RINKEBY
- ethereum rinkeby erc20 token.FLR20_COSTON
- flare network coston token.RRC20
- rsk smart bitcoin rrc20 token.RRC20_TESTNET
- rsk smart bitcoin testnet rrc20 token.XRC20
- xcd network xrc20 token.XRC20_APOTHEM
- xdc apothem xrc20 token.BEP20
- binance smart chain bep20 token.BEP20_TESTNET
- binance smart chain testnet bep20 token.POLYGON_ERC20
- polygon erc20 token.POLY_ERC20_TEST
- polygon testnet erc20 token.CH20
- other evm networks erc20 token
- coinType: erc20 type
Name | Type | Description |
---|---|---|
addressPath | String | sign key path for ethereum transaction |
nonce | String | account nonce for ethereum transaction |
to | String | recipient's address of ethereum transaction |
amount | String | amount of ether to be sent. ( wei unit value ) |
gasLimit | String | gas limit value of ethereum transaction |
gasPrice | String | gas price for ethereum transaction |
data | String | transaction data of ERC20 transaction |
chainId | String | chain id |
symbol | String | symbol of fee account for ERC20 transaction |
tokenName | String | token name of contract for ERC20 transaction |
contractAddress | String | address of contract for ERC20 transaction |
decimals | String | decimals of contract for ERC20 transaction |
tokenSymbol | String | symbol of contract for ERC20 transaction |
- result: (Bool)
true
if successful,false
if error occurred - txData: signed transaction
- Refer to "D`CENT Firmware Update History" to determine which D'CENT Biometric Wallet versions are supported on each network.
Example
let erc20Transaction : TokenTransaction = TokenTransaction(addressPath: "", nonce: "", to: "", amount: "", gasLimit: "", gasPrice: "", data: "", tokenName: "", contractAddress: "", decimals: "", tokenSymbol: "")
// test data
erc20Transaction.addressPath = "m/44'/60'/0'/0/0"
erc20Transaction.nonce = "14"
erc20Transaction.to = "0xe5c23dAa6480e45141647E5AeB321832150a28D4"
erc20Transaction.amount = "60000000000000000"
erc20Transaction.gasLimit = "70000"
erc20Transaction.gasPrice = "3000000000"
erc20Transaction.data = ""
erc20Transaction.chainId = "1"
erc20Transaction.tokenName = "OmiseGO"
erc20Transaction.contractAddress = "0xd26114cd6ee289accf82350c8d8487fedb8a0c07"
erc20Transaction.decimals = "18"
erc20Transaction.tokenSymbol = "OMG"
DDcentMgr.getTokenSignedTransaction(coinType:.ERC20, tokenTransaction:erc20Transaction){ (result, txData) in
print("ERC20 Token Transaction closure")
if result == false {
print("FAIL !!!")
}else{
print(txData)
}
}
Get the sign value of "EVM" message sign(personal_sign & signTypedData).
This fuction for :
.ETHEREUM
- ethereum (ETH).ETH_CLASSIC
- ethereum classic (ETC). ??.ETH_KOVAN
- ethereum kovan (ETHt).ETH_ROPSTEN
- ethereum ropsten (ETHt).ETH_GOERLI
- ethereum goerli (ETHt).ETH_RINKEBY
- ethereum rinkeby (ETHt).FLR_COSTON
- flare network coston (CFLR) ??.RSK
- rsk smart bitcoin (RBTC).RSK_TESTNET
- rsk smart bitcoin testnet (RBTCt).XDC
- xcd network (XDC).XDC_APOTHEM
- xdc apothem (XDCt).BSC
- binance smart chain (BNB).BSC_TESTNET
- binance smart chain testnet (BNBt).POLYGON
- polygon (MATIC).POLYGON_TESTNET
- polygon testnet (MATICt).CHAN
- other evm networks.KLAYTN
- klaytn mainnet (KLAY).KLAYTN_TESTNET
- klaytn baobab (KLAYt)
- coinType: EVM coin type
- isFull: (Bool)
true
for personal sign or the_sign of EVM /false
for signTypedDatt(EIP-721) of EVM
Name | Type | Description |
---|---|---|
message | String | message for sigining |
key | String | sign key path for evm message sign |
- result: (Bool)
true
if successful,false
if error occurred - addr: the address used to sign the data
- sign: signed data
Example
let messageSign : MessageSign = MessageSign(message: "sign TEST!!", key: "m/44'/60'/0'/0/0")
DcentMgr.getMessgaeSign(coin: .ETHEREUM, messageSign: messageSign, isFull: false) { (result, addr, sign) in
if result == false {
print("FAIL !!!")
}else{
print(addr)
print(sign)
}
}
Last modified 2mo ago