Base API
API Signatures
The authorization signature uses 'Ethereum message signing', assuming the ChainID of the relevant chain (e.g., ETH: 1, Silicon Mainnet: 2355).
For signatures used in snapshot submissions, verification is conducted using the ETH ChainID of 1 (the ChainID is included in the message).
Basic Response
{
statusCode: number;
message: string;
data: ResponseData;
}
Success
{
"statusCode": 200
"data": {},
"message": "success"
}
Fail
{
"statusCode": 500
"message": error_message
}
Error Message List
The following are basic error messages. Additional error messages may be present depending on the handling within each method.
Basic Validation
invalid_target
When managerName
does not match the name of the requested Manager.
request_timeout
Request timed out.
used_signature
When the signature value has already been processed within the allotted time (to prevent double usage).
invalid_cohort
When the CohortId
in the request does not match the CohortId
in the requestPath, or if the CohortId
is invalid or the cohort does not exist.
invalid_owner
When the owner in the request is missing or does not match the Owner of the CohortId
.
invalid_method
When the method is incorrect.
fail_to_authorization
When the authorization signature verified with the hash in the body does not match the Cohort Owner.
Basic Method Validation
invalid_members
When the members field is missing or not in a dictionary format.
exceed_limit
When the number of members being added exceeds the limit per request.
too_many_members
When the total number of members, after attempted additions, exceeds the overall limit.
invalid_address
When one or more addresses in the members field have an incorrect format.
invalid_weight
When the format of the weight in the members field is incorrect (must be an integer between 0 and uint32.max
).
pending_snapshot
When an add
request is sent during the snapshot prepare
status, but a submit
is expected.
Signature Generation Example
Example 1
dataHash = keccak256(
abi.encode(
[string, address, uint256, address[], address[], bytes[], uint256],
["OpenCohort:UpdateIdentity", cohort, chainId, identityList, addressList, signatureList, validUntil]
)
);
signingHash = ERC191(dataHash);
Example 2
const {
cohort,
chainId,
cohortId,
snapshotTime,
snapshotSignature,
validUntil
} = dto;
const dataBytes = defaultAbiCoder.encode(
['string', 'address', 'uint256', 'uint256', 'uint256', 'bytes', 'uint256'],
['OpenCohort:Submit', cohort, chainId, cohortId, snapshotTime, snapshotSignature, validUntil]
);
const dataHash = keccak256(dataBytes);
const signingBytes = Buffer.concat([
Buffer.from('\x19Ethereum Signed Message:\n32', 'ascii'),
Buffer.from(dataHash.replace("0x",""), 'hex')
]);
const signingHash = keccak256(signingBytes);
Last updated
Was this helpful?