Classes
- RoomNightAdmin
RoomNightAdmin
- RoomNightCustomer
RoomNightCustomer
- RoomNightVendor
RoomNightVendor
RoomNightAdmin
RoomNightAdminKind: global class
- RoomNightAdmin
- .getVendorIds(offset, limit, options) ⇒ Promise
- .getVendor(vendorId, options) ⇒ Promise
- .getVendorByAddress(address, options) ⇒ Promise
- .supportedTokens(offset, limit, options) ⇒ Promise
- .getToken(tokenId, options) ⇒ Promise
- .updateBaseTokenURI(uri, options) ⇒ Promise
- .addVendor(address, name, options) ⇒ Promise
- .removeVendorByAddress(address, options) ⇒ Promise
- .removeVendorById(vendorId, options) ⇒ Promise
- .makeVendorValid(vendorId, valid, options) ⇒ Promise
- .addToken(contractAddress, options) ⇒ Promise
- .removeToken(tokenId, options) ⇒ Promise
roomNightAdmin.getVendorIds(offset, limit, options) ⇒ Promise
Get Vendor ids by pageKind: instance method of RoomNightAdmin
Returns: Promise - {vendorIds: Number, nextVendorId: Number }
- vendorIds: Vendor ids,
- nextVendorId: The next id of vendor, if id = 0 the next vendor is null
Param | Type | Description |
---|---|---|
offset | Number | The begin id, if id = 0 search from the begin |
limit | Number | The limit of one page |
options | Object |
roomNightAdmin.getVendor(vendorId, options) ⇒ Promise
Get the vendor info by idKind: instance method of RoomNightAdmin
Returns: Promise - {name: String, address: String, createTime: Number, isValid: Boolean}
- name: Vendor name
- address: Vendor address
- createTime: Create time: UTC timestamp(s)
- isValid: Vendor is valid or not
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
options | Object |
roomNightAdmin.getVendorByAddress(address, options) ⇒ Promise
Get vendor info by vendor addressKind: instance method of RoomNightAdmin
Returns: Promise - {name: String, address: String, createTime: Number, isValid: Boolean}
- name: Vendor name
- address: Vendor address
- createTime: Create time: UTC timestamp(s)
- isValid: Vendor is valid or not
Param | Type | Description |
---|---|---|
address | String | Vendor address |
options | Object |
roomNightAdmin.supportedTokens(offset, limit, options) ⇒ Promise
Get all supported tokens idsKind: instance method of RoomNightAdmin
Returns: Promise - {tokenIds: Number, nextVendorId: Number}
- tokenIds: Token ids
- nextVendorId: The next id of vendor, if id = 0 the next vendor is null
Param | Type | Description |
---|---|---|
offset | Number | The begin id, if id = 0 search from the begin |
limit | Number | The limit of one page |
options | Object |
roomNightAdmin.getToken(tokenId, options) ⇒ Promise
Get token information by token idKind: instance method of RoomNightAdmin
Returns: Promise - {symbole: String, name: String, decimal: Number, address: String}
- symbole: Token symbole
- name: Token name
- decimal: Token decimal
- address: Token address
Param | Type | Description |
---|---|---|
tokenId | Number | Token id |
options | Object |
roomNightAdmin.updateBaseTokenURI(uri, options) ⇒ Promise
Update the base URI of tokenKind: instance method of RoomNightAdmin
Returns: Promise - {tx: String, uri: String}
- tx: Transaction address
- uri: The base URI of token
Param | Type | Description |
---|---|---|
uri | String | The base URI of token |
options | Object |
roomNightAdmin.addVendor(address, name, options) ⇒ Promise
Add vendorKind: instance method of RoomNightAdmin
Returns: Promise - {tx: String, address: String, name: String}
- tx: Transaction address
- address: Vendor address
- name: Vendor name
Param | Type | Description |
---|---|---|
address | String | Vendor address |
name | String | Vendor name |
options | Object |
roomNightAdmin.removeVendorByAddress(address, options) ⇒ Promise
Remove vendor by vendor addressKind: instance method of RoomNightAdmin
Returns: Promise - {tx: String, address: String}
- tx: Transaction address
- address: Vendor address
Param | Type | Description |
---|---|---|
address | String | Vendor address |
options | Object |
roomNightAdmin.removeVendorById(vendorId, options) ⇒ Promise
Remove vendor by vendor idKind: instance method of RoomNightAdmin
Returns: Promise - {tx: String, address: String}
- tx: Transaction address
- address: Vendor address
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
options | Object |
roomNightAdmin.makeVendorValid(vendorId, valid, options) ⇒ Promise
Make vendor valid or invalidKind: instance method of RoomNightAdmin
Returns: Promise - {tx: String, address: String, valid: Boolean}
- tx: Transaction address
- address: Vendor address
- valid: Vendor is valid or not
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
valid | Boolean | Vendor is valid or not |
options | Object |
roomNightAdmin.addToken(contractAddress, options) ⇒ Promise
Add tokenKind: instance method of RoomNightAdmin
Returns: Promise - {tx: String, address: String}
- tx: Transaction address
- address: Token contract address
Param | Type | Description |
---|---|---|
contractAddress | String | Token contract address |
options | Object |
roomNightAdmin.removeToken(tokenId, options) ⇒ Promise
Remove tokenKind: instance method of RoomNightAdmin
Returns: Promise - {tx: String, id: Number}
- tx: Transaction address
- id: Token id
Param | Type | Description |
---|---|---|
tokenId | Number | Token id |
options | Object |
RoomNightCustomer
RoomNightCustomerKind: global class
- RoomNightCustomer
- .ipfsBase58ToHex(ipfs) ⇒ String
- .ipfsHexToBase58(ipfs) ⇒ String
- ._getTokenContractInstance(token) ⇒ Promise
- .name() ⇒ Promise
- .symbol() ⇒ Promise
- .tokenURI(tokenId) ⇒ Promise
- .balanceOf(owner) ⇒ Promise
- .ownerOf(tokenId) ⇒ Promise
- .getApproved(tokenId) ⇒ Promise
- .isApprovedForAll(owner, operator) ⇒ Promise
- .isRefundApplied(rnid) ⇒ Promise
- .roomNight(rnid) ⇒ Promise
- .roomNightsOfOwner(from, limit, isVendor, options) ⇒ Promise
- .safeTransferFrom(from, to, tokenId, data, {tx:)
- .transferFrom(from, to, tokenId, {tx:)
- .transferFromInBatch(from, to, tokenIds, {tx:)
- .approve(approved, tokenId, {tx:)
- .setApprovalForAll(operator, approved, {tx:)
- .buyInBatch(vendorId, rpid, dates, token, options, {tx:)
- .applyRefund(rnid, isRefund, options, {tx:)
- .refund(rnid, options, {tx:)
roomNightCustomer.ipfsBase58ToHex(ipfs) ⇒ String
Convert IPFS address from base58 to hex format(begin with 0x)Kind: instance method of RoomNightCustomer
Returns: String - IPFS with hex format(begin with 0x)
Param | Type | Description |
---|---|---|
ipfs | String | IPFS address with base58 encoded |
roomNightCustomer.ipfsHexToBase58(ipfs) ⇒ String
Conver IPFS address from hex format to base58 formatKind: instance method of RoomNightCustomer
Returns: String - IPFS with base58 format
Param | Type | Description |
---|---|---|
ipfs | String | IPFS address with hex format |
roomNightCustomer._getTokenContractInstance(token) ⇒ Promise
Kind: instance method ofRoomNightCustomer
Returns: Promise - {Contract instance}
Param | Type |
---|---|
token | token |
roomNightCustomer.name() ⇒ Promise
The name of current room night tokenKind: instance method of RoomNightCustomer
Returns: Promise - {String} The name of current room night token
roomNightCustomer.symbol() ⇒ Promise
The symbol of current room night tokenKind: instance method of RoomNightCustomer
Returns: Promise - {String} The symbol of current room night token
roomNightCustomer.tokenURI(tokenId) ⇒ Promise
The URI of token's informationKind: instance method of RoomNightCustomer
Returns: Promise - {String} The URI of token. E.g: http://ipfs.tripiochina.cn/api/v0/cat/Qmaj8UWNjTzBMBHkkaqSiyax2nFgiwYP2ewxnhGBucn6S8
Param | Type | Description |
---|---|---|
tokenId | Number | Token id |
roomNightCustomer.balanceOf(owner) ⇒ Promise
The balance of any addressKind: instance method of RoomNightCustomer
Returns: Promise - {BigNumber} The token balance
Param | Type | Description |
---|---|---|
owner | String | The owner address of some token |
roomNightCustomer.ownerOf(tokenId) ⇒ Promise
Get the owner of any tokenKind: instance method of RoomNightCustomer
Returns: Promise - {String} The token's owner address
Param | Type | Description |
---|---|---|
tokenId | Number | The room night token id |
roomNightCustomer.getApproved(tokenId) ⇒ Promise
Get the approved address for a single room night tokenKind: instance method of RoomNightCustomer
Returns: Promise - {String} The approved address for this token, or the zero address if there is none
Param | Type | Description |
---|---|---|
tokenId | Number | The room night token id |
roomNightCustomer.isApprovedForAll(owner, operator) ⇒ Promise
Query if an address is an authorized operator for another addressKind: instance method of RoomNightCustomer
Returns: Promise - {Boolean} True if operator is an approved operator
for owner
, false otherwise
Param | Type | Description |
---|---|---|
owner | String | The address that owns the token |
operator | String | The address that acts on behalf of the owner |
roomNightCustomer.isRefundApplied(rnid) ⇒ Promise
Whether the token is in refund applicationsKind: instance method of RoomNightCustomer
Returns: Promise - {Boolean} True if token in refund applications, false otherwise
Param | Type | Description |
---|---|---|
rnid | Number | The room night token id |
roomNightCustomer.roomNight(rnid) ⇒ Promise
Get the room night infomation in detailKind: instance method of RoomNightCustomer
Returns: Promise - {vendorId: BigNumber, rateplanId: BigNumber, tokenId: BigNumber, price: BigNumber, timestamp: BigNumber, date: BigNumber, ipfs: Hex String, rateplanName: String}
- vendorId: Vendor id
- rateplanId: Rateplan id
- tokenId: ERC2.0 Token id
- price: ERC2.0 price of RP
- timestamp: Create time: UTC timestamp(s)
- date: Order date E.g: 20180621
- ipfs: The IPFS's address of rateplan's desc(Hex String)
- rateplanName: Rateplan name
Param | Type | Description |
---|---|---|
rnid | Number | The room night token id |
roomNightCustomer.roomNightsOfOwner(from, limit, isVendor, options) ⇒ Promise
Get all the room nights of the msg.sender(Customer or Vendor)Kind: instance method of RoomNightCustomer
Returns: Promise - {roomnightIds: BigNumber|Array, nextId: BigNumber}
- roomnightIds: Room night token ids
- nextId: The next id of token, if id = 0 the next token is null
Param | Type | Description |
---|---|---|
from | Number | The begin id, if id = 0 search from the begin |
limit | Number | The limit of one page |
isVendor | Boolean | Is vendor or not |
options | Dict | {from: msg.sender} |
roomNightCustomer.safeTransferFrom(from, to, tokenId, data, {tx:)
Transfers the ownership of an room night token from one address to another address. When transfer is complete, this function checks if _to is a smart contract (code size > 0). If so, it calls onERC721Received on _to and throws if the return value is not bytes4(keccak256("onERC721Received(address,uint256,bytes)")).Kind: instance method of RoomNightCustomer
Param | Type | Description |
---|---|---|
from | String | The current owner of the room night token |
to | String | The new owner |
tokenId | Number | The token to transfer |
data | String | Additional data with no specified format, sent in call to to |
{tx: | Promise | String, from: BigNumber, to: BigNumber, tokenId: BigNumber} tx: Transaction number from: The current owner of the room night token to: The new owner tokenId: The token to transfer |
roomNightCustomer.transferFrom(from, to, tokenId, {tx:)
Transfers the ownership of an room night token from one address to another addressKind: instance method of RoomNightCustomer
Param | Type | Description |
---|---|---|
from | String | The current owner of the room night token |
to | String | The new owner |
tokenId | Number | The token to transfer |
{tx: | Promise | String, from: BigNumber, to: BigNumber, tokenId: BigNumber} tx: Transaction number from: The current owner of the room night token to: The new owner tokenId: The token to transfer |
roomNightCustomer.transferFromInBatch(from, to, tokenIds, {tx:)
Transfers the ownership of tokens from one address to another addressKind: instance method of RoomNightCustomer
Param | Type | Description | |
---|---|---|---|
from | String | The current owner of the room night token | |
to | String | The new owner | |
tokenIds | Number \ | Array | The tokens to transfer |
{tx: | Promise | String, from: BigNumber, to: BigNumber, tokenIds: Number | Array} tx: Transaction number from: The current owner of the room night token to: The new owner tokenIds: The token to transfer |
roomNightCustomer.approve(approved, tokenId, {tx:)
Set or reaffirm the approved address for an room night tokenKind: instance method of RoomNightCustomer
Param | Type | Description |
---|---|---|
approved | String | The new approved token controller |
tokenId | Number | The token to approve |
{tx: | Promise | String, owner: String, approved: String, tokenId: BigNumber} tx: Transaction number owner: The current owner of the room night token approved: The new approved token controller tokenId: The token to approve |
roomNightCustomer.setApprovalForAll(operator, approved, {tx:)
Enable or disable approval for a third party ("operator") to manage all of msg.sender's assetsKind: instance method of RoomNightCustomer
Param | Type | Description |
---|---|---|
operator | String | The new approved token controller |
approved | Boolean | The token to approve |
{tx: | Promise | String, owner: String, operator: String, approved: Boolean} tx: Transaction number owner: The current owner of the room night token operator: The new approved token controller approved: The token to approve |
roomNightCustomer.buyInBatch(vendorId, rpid, dates, token, options, {tx:)
By room nigth in batch through ETH(token
== 0) or other digital token(token
!= 0)
Kind: instance method of RoomNightCustomer
Param | Type | Description | |
---|---|---|---|
vendorId | Number | The vendor Id | |
rpid | Number | The vendor's rate plan id | |
dates | Number \ | Array | The booking dates |
token | Number | The digital currency token | |
options | Dict | {from: msg.sender} | |
{tx: | Promise | String, customer: String, vendor: String, rpid: BigNumber, dates: Number | Array, token: BigNumber} tx: Transaction number customer: The customer address vendor: Then vendor address rpid: The rateplan id dates: The booking dates token: The digital currency token |
roomNightCustomer.applyRefund(rnid, isRefund, options, {tx:)
Apply room night refundKind: instance method of RoomNightCustomer
Param | Type | Description |
---|---|---|
rnid | Number | Room night token id |
isRefund | Boolean | if true the rnid can refund else not |
options | Dict | {from: msg.sender} |
{tx: | Promise | String, customer: String, rnid: BigNumber, isRefund: Boolean} tx: Transaction number customer: The customer address rnid: The rateplan id isRefund: if true the rnid can refund else not |
roomNightCustomer.refund(rnid, options, {tx:)
Refund through ETH or other digital token, give the room night ETH/TOKEN to customer and take back inventoryKind: instance method of RoomNightCustomer
Param | Type | Description |
---|---|---|
rnid | Number | Room night token id |
options | Dict | {from: msg.sender} |
{tx: | Promise | String, vendor: String, rnid: BigNumber} tx: Transaction number vendor: Then vendor address * rnid: Room night token id |
RoomNightVendor
RoomNightVendorKind: global class
- RoomNightVendor
- .inventoriesOfDate(vendorId, rpid, dates, options) ⇒ Promise
- .pricesOfDate(vendorId, rpid, dates, token, options) ⇒ Promise
- .priceOfDate(vendorId, rpid, date, token, options) ⇒ Promise
- .ratePlansOfVendor(vendorId, offset, limit, options) ⇒ Promise
- .ratePlanOfVendor(vendorId, rpid, options) ⇒ Promise
- .pricesAndInventoriesOfDate(vendorId, rpid, dates, token, options) ⇒ Promise
- .updatePrices(rpid, dates, inventory, tokens, prices, options) ⇒ Promise
- .updateInventories(rpid, dates, inventory, options) ⇒ Promise
- .updateBasePrice(rpid, tokens, prices, inventory, options) ⇒ Promise
- .createRatePlan(name, ipfs, options) ⇒ Promise
- .removeRatePlan(rpid, options) ⇒ Promise
- .modifyRatePlan(rpid, name, ipfs, options) ⇒ Promise
roomNightVendor.inventoriesOfDate(vendorId, rpid, dates, options) ⇒ Promise
Get inventories of datesKind: instance method of RoomNightVendor
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
rpid | Number | Rateplan id |
dates | Number | Dates E.g: [20180610,20180611] |
options | Object |
roomNightVendor.pricesOfDate(vendorId, rpid, dates, token, options) ⇒ Promise
Get prices of datesKind: instance method of RoomNightVendor
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
rpid | Number | Rateplan id |
dates | Number | Dates E.g: [20180610,20180611] |
token | Number | Token id |
options | Object |
roomNightVendor.priceOfDate(vendorId, rpid, date, token, options) ⇒ Promise
Get price and inventory of dateKind: instance method of RoomNightVendor
Returns: Promise - {inventory: Number, price: Number}
- inventory: Inventory
- price: Price
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
rpid | Number | Rateplan id |
date | Number | Date E.g: 20180630 |
token | Number | Token id |
options | Object |
roomNightVendor.ratePlansOfVendor(vendorId, offset, limit, options) ⇒ Promise
Get rateplans of vendor by vendor idKind: instance method of RoomNightVendor
Returns: Promise - {rateplanIds: Number, nextRateplanId: Number}
- rateplanIds: Rateplan ids
- nextRateplanId: The next id of rateplan, if id = 0 the next rateplan is null
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
offset | Number | The begin id, if id = 0 search from the begin |
limit | Number | The limit of one page |
options | Object |
roomNightVendor.ratePlanOfVendor(vendorId, rpid, options) ⇒ Promise
Get rateplan information by vendor id and rateplan idKind: instance method of RoomNightVendor
Returns: Promise - {name: String, createTime: Number, ipfsAddress: String}
- name: Rateplan name
- createTime: Create time: UTC timestamp(s)
- ipfsAddress: IPFS file address
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
rpid | Number | Rateplan id |
options | Object |
roomNightVendor.pricesAndInventoriesOfDate(vendorId, rpid, dates, token, options) ⇒ Promise
Get prices and inventories by vendor id, rateplan id, dates, token idKind: instance method of RoomNightVendor
Returns: Promise - {prices: Array, inventorys: Array}
- prices: Prices
- inventorys: Inventories
Param | Type | Description |
---|---|---|
vendorId | Number | Vendor id |
rpid | Number | Rateplan Id |
dates | Array | Date E.g: [20180610,20180611] |
token | Number | Token id |
options | Object |
roomNightVendor.updatePrices(rpid, dates, inventory, tokens, prices, options) ⇒ Promise
Update prices and inventory of rateplanKind: instance method of RoomNightVendor
Returns: Promise - {tx: String, rpid: Number}
- tx: Transaction address
- rpid: Rateplan Id
Param | Type | Description |
---|---|---|
rpid | Number | Rateplan Id |
dates | Array | Date E.g: [20180610,20180611] |
inventory | Number | Inventory |
tokens | Array | Token ids |
prices | Array | Prices of tokens |
options | Object |
roomNightVendor.updateInventories(rpid, dates, inventory, options) ⇒ Promise
Update inventories of rateplanKind: instance method of RoomNightVendor
Returns: Promise - {tx: String, rpid: Number}
- tx: Transaction address
- rpid: Rateplan Id
Param | Type | Description |
---|---|---|
rpid | Number | Rateplan Id |
dates | Array | Date E.g: [20180610,20180611] |
inventory | Number | Inventory |
options | Object |
roomNightVendor.updateBasePrice(rpid, tokens, prices, inventory, options) ⇒ Promise
Update the base price of all rateplansKind: instance method of RoomNightVendor
Returns: Promise - {tx: String, rpid: Number}
- tx: Transaction address
- rpid: Rateplan Id
Param | Type | Description |
---|---|---|
rpid | Number | Rateplan Id |
tokens | Array | Token ids |
prices | Array | Prices of tokens |
inventory | Number | Inventory |
options | Object |
roomNightVendor.createRatePlan(name, ipfs, options) ⇒ Promise
Create new rateplanKind: instance method of RoomNightVendor
Returns: Promise - {tx: String, vendorId: String, name: String, ipfs: String}
- tx: Transaction address
- vendorId: Vendor Id
- name: Rateplan name
- ipfs: The IPFS's address of rateplan's desc
Param | Type | Description |
---|---|---|
name | String | Rateplan name |
ipfs | String | The IPFS's address of rateplan's desc |
options | Object |
roomNightVendor.removeRatePlan(rpid, options) ⇒ Promise
Remove rateplanKind: instance method of RoomNightVendor
Returns: Promise - {tx: String, vendorId: String, rpid: Number}
- tx: Transaction address
- vendorId: Vendor Id
- rpid: Rateplan Id
Param | Type | Description |
---|---|---|
rpid | Number | Rateplan Id |
options | Object |
roomNightVendor.modifyRatePlan(rpid, name, ipfs, options) ⇒ Promise
Modify rateplanKind: instance method of RoomNightVendor
Returns: Promise - {tx: String, vendorId: String, rpid: Number, name: String, ipfs: String}
- tx: Transaction address
- vendorId: Vendor Id
- rpid: Rateplan Id
- name: Rateplan name
- ipfs: The IPFS's address of rateplan's desc
Param | Type |
---|---|
rpid | Number |
name | String |
ipfs | String |
options | Object |