Add Stamp
To add a stamp with the bStamp API, utilize the addStamp
method from the SDK.
Sample Code Snippet
Here is a JavaScript code snippet demonstrating the use of the addStamp
method:
import { Bstamp, Network } from 'edeXa-sdk';
async function addStamp() {
const bStamp = new Bstamp({
...settings,
authorization: `Bearer ${token}`,
});
const settings = {
network: Network.SANDBOX, // or Network.MAINNET for the mainnet network
};
const dataToStamp = {
hash: 'HASH',
isPrivate: 'true' // or false for public network
}
const version = {
version: API_VERSION.VERSION_1 // or API_VERSION.VERSION_2 for version 2
}
try {
const addedStampResponse = await bstamp.addStamp(dataToStamp, version);
// Handle success
} catch (error) {
// Handle error
}
}
Key Points to Note
- Asynchronous Function: The
addStamp
function operates as an asynchronous (async
) function, leveragingawait
to hold execution until thebstamp.addStamp
promise completes. - Token Replacement: Make sure to replace
token
used inAuthorization
with yourtoken
, which you will get in response of authentication method
Request Parameters
Parameter | Required | Type | Description |
---|---|---|---|
hash | Yes | String | Enter your hash value |
isPrivate | Yes | Boolean | Make your stamp public or private |
version | Yes | String | Use a specific available version of bStamp |
Response Format
Key | Type | Description |
---|---|---|
id | String | Unique identifier for the stamp |
txId | String | Transaction ID on the blockchain for the stamp |
code | String | Additional identifier or code for the stamp |
hash | String | Hash value of the stamped document or data |
filename | String | Name of the stamped file |