renproject/ren-js

Compatible with Darknode v0.1.0

Closed this issue · 0 comments

jazg commented

Dependencies

https://github.com/renproject/darknode/milestone/1

Overview

  • args have been broken up into in, out and autogen
  • b20 type is now called ext_ethCompatAddress
  • hash field is now called sighash
  • number values are now transmitted as strings
  • Values are not included in gateway generation
  • Transaction hashes are now based on the the gateway plus the btc/bch/zec transaction hash and vOut.
In: Formals{
    {"phash", TypeB32},                 // The hash of the payload data
    {"token", ExtTypeEthCompatAddress}, // The ERC20 contract address on Etherum for ZZEC
    {"to", ExtTypeEthCompatAddress},    // The address on the Ethereum blockchain to which ZZEC will be transferred
    {"n", TypeB32},                     // The nonce is used to randomise the gateway
    {"utxo", ExtTypeBtcCompatUTXO},     // The UTXO sent to the gateway
},
Autogen: Formals{
    {"ghash", TypeB32},   // The hash returned by `keccak256(abi.encode(phash, token, to, n))`
    {"nhash", TypeB32},   // The hash returned by `keccak256(abi.encode(n, txhash))`
    {"sighash", TypeB32}, // The hash returned by `keccak256(abi.encode(phash, amount, token, to, nhash))`
    {"gas", TypeU64},     // The blockchain gas that has been spent to move funds through the gateway
},
Out: Formals{
    {"r", TypeB}, // The R component of a signature over the input hash
    {"s", TypeB}, // The S component of a signature over the input hash (lower range)
    {"v", TypeB}, // The V component of a signature over the input hash
},

ren_submitTx

args are now accesssible from the in field and the b20 type (base64) has been changed to ext_ethCompatAddress (hexadecimal).

{
	"tx": {
		"to": "ZEC0Zec2Eth",
		"in": [{
			"name": "phash",
			"type": "b32",
			"value": "G/sJ856l0Dre1HYiKN4V7UFBJgaIcCahHG8nXuQEzVI="
		}, {
			"name": "token",
			"type": "ext_ethCompatAddress",
			"value": "71b6a19fc832bd9c739489ecbea67ab41261026f"
		}, {
			"name": "to",
			"type": "ext_ethCompatAddress",
			"value": "254db636af5a759b00cd809e605d513a63704724"
		}, {
			"name": "n",
			"type": "b32",
			"value": "y6EaObWm2BY3T+OJYMGiNwcGKdfqZX2W1d1rqFmirAM="
		}, {
			"name": "utxo",
			"type": "ext_btcCompatUTXO",
			"value": {
				"txHash": "8YhnMnqUgZ9oC+2Ao6sY4YlPzhHMO0pnb7YlXTg7ij8=",
				"vOut": "0"
			}
		}]
	}
}