UNPKG

@aeternity/aepp-sdk

Version:

SDK for the æternity blockchain

83 lines (80 loc) 2.55 kB
import address from '../field-types/address.js'; import nameId from '../field-types/name-id.js'; import shortUIntConst from '../field-types/short-u-int-const.js'; import { Encoding, decode, encode } from '../../../utils/encoder.js'; /** * @category delegation signature */ export let DelegationTag = /*#__PURE__*/function (DelegationTag) { /** * Delegation of all AENS names to a contract */ DelegationTag[DelegationTag["AensWildcard"] = 1] = "AensWildcard"; /** * Delegation of an AENS name to a contract */ DelegationTag[DelegationTag["AensName"] = 2] = "AensName"; /** * Delegation of AENS preclaim to a contract */ DelegationTag[DelegationTag["AensPreclaim"] = 3] = "AensPreclaim"; /** * Delegation of oracle operations to a contract */ DelegationTag[DelegationTag["Oracle"] = 4] = "Oracle"; /** * Delegation of oracle query to a contract */ DelegationTag[DelegationTag["OracleResponse"] = 5] = "OracleResponse"; return DelegationTag; }({}); const oracleAddressField = address(Encoding.OracleAddress); /** * Oracle query ID to reply by a contract */ const queryIdField = { serialize(value) { return oracleAddressField.serialize(encode(decode(value), Encoding.OracleAddress)); }, deserialize(value) { return encode(decode(oracleAddressField.deserialize(value)), Encoding.OracleQueryId); } }; /** * Address of a contract to delegate permissions to */ const contractAddress = address(Encoding.ContractAddress); /** * @see {@link https://github.com/aeternity/protocol/blob/8a9d1d1206174627f6aaef86159dc9c643080653/contracts/fate.md#from-ceres-serialized-signature-data} */ export const schemas = [{ tag: shortUIntConst(DelegationTag.AensWildcard), version: shortUIntConst(1, true), accountAddress: address(Encoding.AccountAddress), contractAddress }, { tag: shortUIntConst(DelegationTag.AensName), version: shortUIntConst(1, true), accountAddress: address(Encoding.AccountAddress), /** * AENS name to manage by a contract */ nameId, contractAddress }, { tag: shortUIntConst(DelegationTag.AensPreclaim), version: shortUIntConst(1, true), accountAddress: address(Encoding.AccountAddress), contractAddress }, { tag: shortUIntConst(DelegationTag.Oracle), version: shortUIntConst(1, true), accountAddress: address(Encoding.AccountAddress), contractAddress }, { tag: shortUIntConst(DelegationTag.OracleResponse), version: shortUIntConst(1, true), queryId: queryIdField, contractAddress }]; //# sourceMappingURL=schema.js.map