pact icon indicating copy to clipboard operation
pact copied to clipboard

getting tx sender with (chain-data) function in local server

Open fmelp opened this issue 6 years ago • 1 comments

the (chain-data) function does not seem to be working when running a local chain. I have a chain running on port 9001 and using a javascript front-end to interact with the contract and send tx's

defun get-sender ()
   (let (tx-data (chain-data))
     [(at "sender" tx-data)]
   )
)
;returns -> [""]

this is the javascript call:

test = (keyset) => {
  const cmdObj = {
    pactCode: `(contract.get-sender)`,
    keyPairs: keyset
  }
  Pact.fetch.local(cmdObj, API_HOST)
  .then(res => {
     console.log(res.data);
  })
}
//logs -> [""]

fmelp avatar Jul 18 '19 16:07 fmelp

In Pact, we'll need to populate the local PublicData with the correct values. Thanks for raising this @fmelp

emilypi avatar Jul 18 '19 16:07 emilypi