lisk-framework
Version:
Lisk blockchain application platform
575 lines • 17.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasEscrowAccountResponseSchema = exports.hasUserAccountResponseSchema = exports.hasEscrowAccountRequestSchema = exports.hasUserAccountRequestSchema = exports.getInitializationFeesResponseSchema = exports.isSupportedResponseSchema = exports.isSupportedRequestSchema = exports.getEscrowedAmountsResponseSchema = exports.getSupportedTokensResponseSchema = exports.getTotalSupplyResponseSchema = exports.getBalancesResponseSchema = exports.getBalancesRequestSchema = exports.getBalanceResponseSchema = exports.getBalanceRequestSchema = exports.genesisTokenStoreSchema = exports.crossChainForwardMessageParams = exports.crossChainTransferMessageParams = exports.crossChainTransferParamsSchema = exports.transferParamsSchema = exports.terminatedEscrowStoreSchema = exports.availableLocalIDStoreSchema = exports.configSchema = void 0;
const constants_1 = require("./constants");
exports.configSchema = {
$id: '/token/config',
type: 'object',
properties: {
userAccountInitializationFee: {
type: 'string',
format: 'uint64',
},
escrowAccountInitializationFee: {
type: 'string',
format: 'uint64',
},
},
};
exports.availableLocalIDStoreSchema = {
$id: '/token/store/availableLocalID',
type: 'object',
required: ['nextAvailableLocalID'],
properties: {
nextAvailableLocalID: {
dataType: 'bytes',
fieldNumber: 1,
},
},
};
exports.terminatedEscrowStoreSchema = {
$id: '/token/store/terminatedEscrow',
type: 'object',
required: ['escrowTerminated'],
properties: {
escrowTerminated: {
dataType: 'boolean',
fieldNumber: 1,
},
},
};
exports.transferParamsSchema = {
$id: '/lisk/transferParams',
title: 'Transfer transaction params',
type: 'object',
required: ['tokenID', 'amount', 'recipientAddress', 'data'],
properties: {
tokenID: {
dataType: 'bytes',
fieldNumber: 1,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
amount: {
dataType: 'uint64',
fieldNumber: 2,
},
recipientAddress: {
dataType: 'bytes',
fieldNumber: 3,
format: 'lisk32',
},
data: {
dataType: 'string',
fieldNumber: 4,
minLength: 0,
maxLength: constants_1.MAX_DATA_LENGTH,
},
},
};
exports.crossChainTransferParamsSchema = {
$id: '/lisk/ccTransferParams',
type: 'object',
required: [
'tokenID',
'amount',
'receivingChainID',
'recipientAddress',
'data',
'messageFee',
'messageFeeTokenID',
],
properties: {
tokenID: {
dataType: 'bytes',
fieldNumber: 1,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
amount: {
dataType: 'uint64',
fieldNumber: 2,
},
receivingChainID: {
dataType: 'bytes',
fieldNumber: 3,
minLength: constants_1.CHAIN_ID_LENGTH,
maxLength: constants_1.CHAIN_ID_LENGTH,
},
recipientAddress: {
dataType: 'bytes',
fieldNumber: 4,
format: 'lisk32',
},
data: {
dataType: 'string',
fieldNumber: 5,
minLength: 0,
maxLength: constants_1.MAX_DATA_LENGTH,
},
messageFee: {
dataType: 'uint64',
fieldNumber: 6,
},
messageFeeTokenID: {
dataType: 'bytes',
fieldNumber: 7,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
},
};
exports.crossChainTransferMessageParams = {
$id: '/lisk/ccTransferMessageParams',
type: 'object',
required: ['tokenID', 'amount', 'senderAddress', 'recipientAddress', 'data'],
properties: {
tokenID: {
dataType: 'bytes',
fieldNumber: 1,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
amount: {
dataType: 'uint64',
fieldNumber: 2,
},
senderAddress: {
dataType: 'bytes',
fieldNumber: 3,
format: 'lisk32',
},
recipientAddress: {
dataType: 'bytes',
fieldNumber: 4,
format: 'lisk32',
},
data: {
dataType: 'string',
fieldNumber: 5,
minLength: 0,
maxLength: constants_1.MAX_DATA_LENGTH,
},
},
};
exports.crossChainForwardMessageParams = {
$id: '/lisk/ccForwardMessageParams',
type: 'object',
required: [
'tokenID',
'amount',
'senderAddress',
'forwardToChainID',
'recipientAddress',
'data',
'forwardedMessageFee',
],
properties: {
tokenID: {
dataType: 'bytes',
fieldNumber: 1,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
amount: {
dataType: 'uint64',
fieldNumber: 2,
},
senderAddress: {
dataType: 'bytes',
fieldNumber: 3,
format: 'lisk32',
},
forwardToChainID: {
dataType: 'bytes',
fieldNumber: 4,
minLength: constants_1.CHAIN_ID_LENGTH,
maxLength: constants_1.CHAIN_ID_LENGTH,
},
recipientAddress: {
dataType: 'bytes',
fieldNumber: 5,
format: 'lisk32',
},
data: {
dataType: 'string',
fieldNumber: 6,
minLength: 0,
maxLength: constants_1.MAX_DATA_LENGTH,
},
forwardedMessageFee: {
dataType: 'uint64',
fieldNumber: 7,
},
},
};
exports.genesisTokenStoreSchema = {
$id: '/token/module/genesis',
type: 'object',
required: ['userSubstore', 'supplySubstore', 'escrowSubstore', 'supportedTokensSubstore'],
properties: {
userSubstore: {
type: 'array',
fieldNumber: 1,
items: {
type: 'object',
required: ['address', 'tokenID', 'availableBalance', 'lockedBalances'],
properties: {
address: {
dataType: 'bytes',
format: 'lisk32',
fieldNumber: 1,
},
tokenID: {
dataType: 'bytes',
fieldNumber: 2,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
availableBalance: {
dataType: 'uint64',
fieldNumber: 3,
},
lockedBalances: {
type: 'array',
fieldNumber: 4,
items: {
type: 'object',
required: ['module', 'amount'],
properties: {
module: {
dataType: 'string',
minLength: constants_1.MIN_MODULE_NAME_LENGTH,
maxLength: constants_1.MAX_MODULE_NAME_LENGTH,
fieldNumber: 1,
},
amount: {
dataType: 'uint64',
fieldNumber: 2,
},
},
},
},
},
},
},
supplySubstore: {
type: 'array',
fieldNumber: 2,
items: {
type: 'object',
required: ['tokenID', 'totalSupply'],
properties: {
tokenID: {
dataType: 'bytes',
fieldNumber: 1,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
totalSupply: {
dataType: 'uint64',
fieldNumber: 2,
},
},
},
},
escrowSubstore: {
type: 'array',
fieldNumber: 3,
items: {
type: 'object',
required: ['escrowChainID', 'tokenID', 'amount'],
properties: {
escrowChainID: {
dataType: 'bytes',
minLength: constants_1.CHAIN_ID_LENGTH,
maxLength: constants_1.CHAIN_ID_LENGTH,
fieldNumber: 1,
},
tokenID: {
dataType: 'bytes',
fieldNumber: 2,
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
amount: {
dataType: 'uint64',
fieldNumber: 3,
},
},
},
},
supportedTokensSubstore: {
type: 'array',
fieldNumber: 4,
items: {
type: 'object',
required: ['chainID', 'supportedTokenIDs'],
properties: {
chainID: {
dataType: 'bytes',
fieldNumber: 1,
},
supportedTokenIDs: {
type: 'array',
fieldNumber: 2,
items: {
dataType: 'bytes',
minLength: constants_1.TOKEN_ID_LENGTH,
maxLength: constants_1.TOKEN_ID_LENGTH,
},
},
},
},
},
},
};
exports.getBalanceRequestSchema = {
$id: '/token/endpoint/getBalanceRequest',
type: 'object',
properties: {
address: {
type: 'string',
format: 'lisk32',
},
tokenID: {
type: 'string',
format: 'hex',
minLength: constants_1.TOKEN_ID_LENGTH * 2,
maxLength: constants_1.TOKEN_ID_LENGTH * 2,
},
},
required: ['address', 'tokenID'],
};
exports.getBalanceResponseSchema = {
$id: '/token/endpoint/getBalanceResponse',
type: 'object',
required: ['availableBalance', 'lockedBalances'],
properties: {
availableBalance: {
type: 'string',
format: 'uint64',
},
lockedBalances: {
type: 'array',
items: {
type: 'object',
required: ['module', 'amount'],
properties: {
module: {
type: 'string',
},
amount: {
type: 'string',
format: 'uint64',
},
},
},
},
},
};
exports.getBalancesRequestSchema = {
$id: '/token/endpoint/getBalancesRequest',
type: 'object',
properties: {
address: {
type: 'string',
format: 'lisk32',
},
},
required: ['address'],
};
exports.getBalancesResponseSchema = {
$id: '/token/endpoint/getBalancesResponse',
type: 'object',
required: ['balances'],
properties: {
balances: {
type: 'array',
items: {
type: 'object',
required: ['availableBalance', 'lockedBalances', 'tokenID'],
properties: {
tokenID: {
type: 'string',
format: 'hex',
},
availableBalance: {
type: 'string',
format: 'uint64',
},
lockedBalances: {
type: 'array',
items: {
type: 'object',
required: ['module', 'amount'],
properties: {
module: {
type: 'string',
},
amount: {
type: 'string',
format: 'uint64',
},
},
},
},
},
},
},
},
};
exports.getTotalSupplyResponseSchema = {
$id: '/token/endpoint/getTotalSupplyResponse',
type: 'object',
properties: {
totalSupply: {
type: 'array',
items: {
type: 'object',
required: ['totalSupply', 'tokenID'],
properties: {
tokenID: {
type: 'string',
format: 'hex',
},
totalSupply: {
type: 'string',
format: 'uint64',
},
},
},
},
},
};
exports.getSupportedTokensResponseSchema = {
$id: '/token/endpoint/getSupportedTokensResponse',
type: 'object',
properties: {
tokenIDs: {
type: 'array',
items: {
type: 'string',
format: 'hex',
},
},
},
};
exports.getEscrowedAmountsResponseSchema = {
$id: '/token/endpoint/getEscrowedAmountsResponse',
type: 'object',
properties: {
escrowedAmounts: {
type: 'array',
items: {
type: 'object',
required: ['escrowChainID', 'amount', 'tokenID'],
properties: {
escrowChainID: {
type: 'string',
format: 'hex',
},
tokenID: {
type: 'string',
format: 'hex',
},
amount: {
type: 'string',
format: 'uint64',
},
},
},
},
},
};
exports.isSupportedRequestSchema = {
$id: '/token/endpoint/isSupportedRequest',
type: 'object',
properties: {
tokenID: {
type: 'string',
format: 'hex',
minLength: constants_1.TOKEN_ID_LENGTH * 2,
maxLength: constants_1.TOKEN_ID_LENGTH * 2,
},
},
required: ['tokenID'],
};
exports.isSupportedResponseSchema = {
$id: '/token/endpoint/isSupportedResponse',
type: 'object',
properties: {
supported: {
dataType: 'boolean',
},
},
required: ['supported'],
};
exports.getInitializationFeesResponseSchema = {
$id: '/token/endpoint/getInitializationFees',
type: 'object',
properties: {
userAccount: {
type: 'string',
format: 'uint64',
},
escrowAccount: {
type: 'string',
format: 'uint64',
},
},
required: ['userAccount', 'escrowAccount'],
};
exports.hasUserAccountRequestSchema = {
$id: '/token/endpoint/hasUserAccountRequest',
type: 'object',
properties: {
address: {
type: 'string',
format: 'lisk32',
},
tokenID: {
type: 'string',
format: 'hex',
minLength: constants_1.TOKEN_ID_LENGTH * 2,
maxLength: constants_1.TOKEN_ID_LENGTH * 2,
},
},
required: ['address', 'tokenID'],
};
exports.hasEscrowAccountRequestSchema = {
$id: '/token/endpoint/hasEscrowAccountRequest',
type: 'object',
properties: {
tokenID: {
type: 'string',
format: 'hex',
minLength: constants_1.TOKEN_ID_LENGTH * 2,
maxLength: constants_1.TOKEN_ID_LENGTH * 2,
},
escrowChainID: {
type: 'string',
format: 'hex',
},
},
required: ['tokenID', 'escrowChainID'],
};
exports.hasUserAccountResponseSchema = {
$id: '/token/endpoint/hasUserAccountResponse',
type: 'object',
properties: {
exists: {
type: 'boolean',
},
},
};
exports.hasEscrowAccountResponseSchema = {
$id: '/token/endpoint/hasEscrowAccountResponse',
type: 'object',
properties: {
exists: {
type: 'boolean',
},
},
};
//# sourceMappingURL=schemas.js.map