@zerochain/0chain
Advanced tools
Comparing version 1.3.28 to 1.3.29
17
index.js
@@ -571,3 +571,3 @@ /* | ||
getFileMetaDataFromPathHash: async function (allocation_id, path_hash, client_id) { | ||
getFileMetaDataFromPathHash: async function (allocation_id, path_hash, auth_ticket, client_id) { | ||
const completeAllocationInfo = await this.allocationInfo(allocation_id); | ||
@@ -577,3 +577,3 @@ const blobber = completeAllocationInfo.blobbers[0].url; | ||
const blobber_url = blobber + Endpoints.FILE_META_ENDPOINT + allocation_id; | ||
const response = await utils.postReqToBlobber(blobber_url, {}, { path_hash: path_hash }, client_id); | ||
const response = await utils.postReqToBlobber(blobber_url, {}, { path_hash: path_hash, auth_token: atob(auth_ticket)}, client_id); | ||
if (response.status === 200) { | ||
@@ -591,3 +591,3 @@ const res = { | ||
commitMetaTransaction: async function (ae, crudType, allocation_id, path, auth_ticket = '', metadata = '') { | ||
commitMetaTransaction: async function (ae, crudType, allocation_id, path='', auth_ticket = '',lookuphash='', metadata = '') { | ||
if (metadata.length === 0) { | ||
@@ -598,3 +598,3 @@ if (path.length > 0) { | ||
const at = utils.parseAuthTicket(auth_ticket) | ||
metadata = await this.getFileMetaDataFromPathHash(allocation_id, at.file_path_hash, ae.id) | ||
metadata = await this.getFileMetaDataFromPathHash(at.allocation_id, lookuphash, auth_ticket, ae.id) | ||
} | ||
@@ -618,7 +618,7 @@ } | ||
const transactionData = JSON.parse(submitResponse.transaction_data) | ||
await this.updateMetaCommitToBlobbers(submitResponse.hash, allocation_id, transactionData.MetaData.LookupHash, ae.id); | ||
await this.updateMetaCommitToBlobbers(submitResponse.hash, allocation_id, transactionData.MetaData.LookupHash, ae.id, auth_ticket); | ||
return submitResponse | ||
}, | ||
updateMetaCommitToBlobbers: async function(transaction_hash, allocation, lookup_hash, client_id){ | ||
updateMetaCommitToBlobbers: async function(transaction_hash, allocation, lookup_hash, client_id, auth_ticket=""){ | ||
const completeAllocationInfo = await this.allocationInfo(allocation); | ||
@@ -636,2 +636,5 @@ blobber_list = completeAllocationInfo.blobbers.map(blobber => { | ||
formData.append('txn_id', transaction_hash); | ||
if(auth_ticket){ | ||
formData.append("auth_token", atob(auth_ticket)); | ||
} | ||
await utils.postReqToBlobber(blobber_url, formData, {}, client_id); | ||
@@ -768,3 +771,3 @@ } | ||
data.append('phone_num', phoneNumber); | ||
data.append('auth_ticket', authTicket) | ||
data.append('auth_tickets', JSON.stringify(authTicket)); | ||
data.append('message', message); | ||
@@ -771,0 +774,0 @@ data.append('from_info', fromInfo); |
{ | ||
"name": "@zerochain/0chain", | ||
"version": "1.3.28", | ||
"version": "1.3.29", | ||
"description": "js client library to interact with 0chain Blockchain", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
168627
1575