Example #1
0
function _castArguments(message) {
  let contract;
  switch (message.method) {
    case 'getStorageOffer':
      contract = storj.Contract.fromObject(message.params[0]);
      contract.set('renter_id', nodeId);
      contract.sign('renter', keypair.getPrivateKey());
      message.params[0] = contract;
      break;
    case 'getStorageProof':
      message.params[0] = storj.Contact(message.params[0]);
      message.params[1] = storj.StorageItem(message.params[1]);
      break;
    case 'getRetrieveToken':
      message.params[0] = storj.Contact(message.params[0]);
      message.params[1] = storj.Contract.fromObject(message.params[1]);
      break;
    case 'getConsignToken':
      message.params[0] = storj.Contact(message.params[0]);
      message.params[1] = storj.Contract.fromObject(message.params[1]);
      message.params[2] = storj.AuditStream.fromRecords(
        message.params[2].challenges,
        message.params[2].tree
      );
      break;
    default:
      // noop
  }
}
Example #2
0
function _castArguments(message) {
  switch (message.method) {
    case 'getStorageOffer':
      message.params[0] = storj.Contract.fromObject(message.params[0]);
      break;
    case 'getStorageProof':
      message.params[0] = storj.Contact(message.params[0]);
      message.params[1] = storj.StorageItem(message.params[1]);
      break;
    case 'getRetrieveToken':
      message.params[0] = storj.Contact(message.params[0]);
      message.params[1] = storj.Contract.fromObject(message.params[1]);
      break;
    case 'getConsignToken':
      message.params[0] = storj.Contact(message.params[0]);
      message.params[1] = storj.Contract.fromObject(message.params[1]);
      message.params[2] = storj.AuditStream.fromRecords(
        message.params[2].challenges,
        message.params[2].tree
      );
      break;
    default:
      // noop
  }
}