1. Home
  2. Docs
  3. SmartContracts
  4. Testnet Smartcontracts
  5. EasyPost Testnet

EasyPost Testnet

This Chainlink has a dedicated connection to EasyPost’s API. Providing access to EasyPost’s Test and Production APIs so that you can develop on both endpoints.

Steps for using this oracle    

Chainlink Network Details    

You will need to use the following LINK token address, oracle address, and Job ID in order to create the Chainlink request.

Ropsten

LINK Token address: 0x20fE562d797A42Dcb3399062AE9546cd06f63280

Oracle address: 0x51DE85B0cD5B3684865ECfEedfBAF12777cd0Ff8

Test API JobID: e7976548cca34382974fe394cf212a53

Production API JobID: 02f57d05ecc947138cba05fa5ec674c8

Rinkeby

LINK Token address: 0x01BE23585060835E02B77ef475b0Cc51aA1e0709

Oracle address: 0x7AFe1118Ea78C1eae84ca8feE5C65Bc76CcF879e

Test API JobID: c39dbc4321eb45a29e65df7087598fb2

Production API JobID: 51f8a4158b2b402ab3256c1b9242dcf3

Create your EasyPost contract    

pragma solidity ^0.4.24;

import "chainlink/contracts/ChainlinkClient.sol";

contract EasyPostChainlink is ChainlinkClient {

  uint256 oraclePayment;

  constructor(uint256 _oraclePayment) public {
    setPublicChainlinkToken();
    oraclePayment = _oraclePayment;
  }
            
function requestStatus
(
  address _oracle,
  bytes32 _jobId,
  string _code
)
  public
  onlyOwner
{
  Chainlink.Request memory req = buildChainlinkRequest(_jobId, this, this.fulfill.selector);
  req.add("car", "USPS");
  req.add("code", _code);
  req.add("copyPath", "status");
  sendChainlinkRequestTo(_oracle, req, oraclePayment);
}

            
bytes32 public status; function fulfill(bytes32 _requestId, bytes32 _status) public recordChainlinkFulfillment(_requestId) { status = _status; }
            
bytes32 public status;

function fulfill(bytes32 _requestId, bytes32 _status)
  public
  recordChainlinkFulfillment(_requestId)
{
  status = _status;
}

  
}
    

Tasks    

Request Parameters    

code

Required

The tracking number or code which is used by the carrier. Test codes are available here.

Solidity example

req.add(“code”, “EZ1000000001”);

car

Required

The provided carrier symbol. A full list of strings are available here.

Examples: DHLExpress, FedEx, UPS, USPS.

Solidity example

req.add(“car”, “USPS”);

copyPath

Required

The path of the desired data field to return to the smart contract.

Solidity example

req.add(“copyPath”, “status”);

Was this article helpful to you? Yes No

How can we help?

Leave a Reply

Your email address will not be published. Required fields are marked *