45 lines
1.3 KiB
JavaScript
45 lines
1.3 KiB
JavaScript
const base = () => process.env.MIDDLEWARE_BASE_URL || 'http://127.0.0.1:3100';
|
|
|
|
const perform = async (z, bundle) => {
|
|
try {
|
|
const sha = encodeURIComponent(bundle.inputData.sha256);
|
|
const response = await z.request({
|
|
method: 'GET',
|
|
url: `${base()}/zapier/v1/hashes/${sha}?includeAttached=true&includeTree=true`,
|
|
});
|
|
return [response.data];
|
|
} catch (err) {
|
|
if (err.status === 404) return [];
|
|
throw err;
|
|
}
|
|
};
|
|
|
|
module.exports = {
|
|
key: 'tree_lookup',
|
|
noun: 'Timestamp',
|
|
display: {
|
|
label: 'Find Hash (tree nodes + central chain)',
|
|
description:
|
|
'Looks up a SHA256 on the main Verae chain, then queries external tree-node archives for leaves that were only sealed as a bulk Merkle summary.',
|
|
},
|
|
operation: {
|
|
inputFields: [
|
|
{
|
|
key: 'sha256',
|
|
label: 'SHA256',
|
|
type: 'string',
|
|
required: true,
|
|
helpText:
|
|
'64-char hex. If this hash was part of a batch, it may not be itemized on the main chain — this search still finds the Merkle proof on tree nodes.',
|
|
},
|
|
],
|
|
perform,
|
|
sample: {
|
|
sha256: '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824',
|
|
exists: true,
|
|
itemizedOnMainChain: false,
|
|
merkleRoot: 'ab'.repeat(32),
|
|
proofOk: true,
|
|
},
|
|
},
|
|
};
|