Skip to content

Commit

Permalink
Merge pull request #363 from EdgeApp/andrey/fio-staking
Browse files Browse the repository at this point in the history
  • Loading branch information
samholmes authored Jan 29, 2022
2 parents a2f63b3 + dfaa02b commit d5595e8
Show file tree
Hide file tree
Showing 10 changed files with 589 additions and 215 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@binance-chain/javascript-sdk": "^2.14.4",
"@ethereumjs/common": "^2.4.0",
"@ethereumjs/tx": "^3.3.0",
"@fioprotocol/fiosdk": "^1.4.0",
"@fioprotocol/fiosdk": "^1.5.0",
"@hashgraph/sdk": "^1.1.9",
"@walletconnect/client": "1.6.6",
"biggystring": "^3.0.0",
Expand Down Expand Up @@ -115,7 +115,7 @@
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"edge-core-js": "^0.19.1",
"edge-core-js": "^0.19.4",
"eslint": "^7.14.0",
"eslint-config-standard-kit": "0.15.1",
"eslint-plugin-flowtype": "^5.2.0",
Expand Down
137 changes: 116 additions & 21 deletions src/fio/fioConst.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,41 +10,115 @@ export const HISTORY_NODE_ACTIONS = {
}
export const HISTORY_NODE_OFFSET = 20

export const BROADCAST_ACTIONS = {
recordObtData: true,
requestFunds: true,
registerFioAddress: true,
registerFioDomain: true,
renewFioDomain: true,
transferTokens: true,
addPublicAddresses: true,
transferFioAddress: true,
transferFioDomain: true,
addBundledTransactions: true
}

export const ACTIONS_TO_END_POINT_KEYS = {
requestFunds: 'newFundsRequest',
registerFioAddress: 'registerFioAddress',
registerFioDomain: 'registerFioDomain',
renewFioDomain: 'renewFioDomain',
addPublicAddresses: 'addPubAddress',
export const ACTIONS = {
transferTokens: 'transferTokens',
addPublicAddress: 'addPublicAddress',
addPublicAddresses: 'addPublicAddresses',
setFioDomainPublic: 'setFioDomainPublic',
rejectFundsRequest: 'rejectFundsRequest',
requestFunds: 'requestFunds',
recordObtData: 'recordObtData',
transferTokens: 'transferTokens',
pushTransaction: 'pushTransaction',
registerFioAddress: 'registerFioAddress',
registerFioDomain: 'registerFioDomain',
renewFioDomain: 'renewFioDomain',
transferFioAddress: 'transferFioAddress',
transferFioDomain: 'transferFioDomain',
pushTransaction: 'pushTransaction',
addBundledTransactions: 'addBundledTransactions',
stakeFioTokens: 'stakeFioTokens',
unStakeFioTokens: 'unStakeFioTokens'
}

export const BROADCAST_ACTIONS = {
[ACTIONS.recordObtData]: true,
[ACTIONS.requestFunds]: true,
[ACTIONS.registerFioAddress]: true,
[ACTIONS.registerFioDomain]: true,
[ACTIONS.renewFioDomain]: true,
[ACTIONS.transferTokens]: true,
[ACTIONS.addPublicAddresses]: true,
[ACTIONS.transferFioAddress]: true,
[ACTIONS.transferFioDomain]: true,
[ACTIONS.addBundledTransactions]: true,
[ACTIONS.stakeFioTokens]: true,
[ACTIONS.unStakeFioTokens]: true
}

export const ACTIONS_TO_END_POINT_KEYS = {
[ACTIONS.requestFunds]: 'newFundsRequest',
[ACTIONS.registerFioAddress]: 'registerFioAddress',
[ACTIONS.registerFioDomain]: 'registerFioDomain',
[ACTIONS.renewFioDomain]: 'renewFioDomain',
[ACTIONS.addPublicAddresses]: 'addPubAddress',
[ACTIONS.setFioDomainPublic]: 'setFioDomainPublic',
[ACTIONS.rejectFundsRequest]: 'rejectFundsRequest',
[ACTIONS.recordObtData]: 'recordObtData',
[ACTIONS.transferTokens]: 'transferTokens',
[ACTIONS.pushTransaction]: 'pushTransaction',
[ACTIONS.transferFioAddress]: 'transferFioAddress',
[ACTIONS.transferFioDomain]: 'transferFioDomain',
[ACTIONS.stakeFioTokens]: 'pushTransaction',
[ACTIONS.unStakeFioTokens]: 'pushTransaction',
addBundledTransactions: 'addBundledTransactions'
}

export const ACTIONS_TO_FEE_END_POINT_KEYS = {
[ACTIONS.requestFunds]: 'newFundsRequest',
[ACTIONS.registerFioAddress]: 'registerFioAddress',
[ACTIONS.registerFioDomain]: 'registerFioDomain',
[ACTIONS.renewFioDomain]: 'renewFioDomain',
[ACTIONS.addPublicAddresses]: 'addPubAddress',
[ACTIONS.setFioDomainPublic]: 'setFioDomainPublic',
[ACTIONS.rejectFundsRequest]: 'rejectFundsRequest',
[ACTIONS.recordObtData]: 'recordObtData',
[ACTIONS.transferTokens]: 'transferTokens',
[ACTIONS.pushTransaction]: 'pushTransaction',
[ACTIONS.transferFioAddress]: 'transferFioAddress',
[ACTIONS.transferFioDomain]: 'transferFioDomain',
[ACTIONS.addBundledTransactions]: 'addBundledTransactions',
[ACTIONS.stakeFioTokens]: 'stakeFioTokens',
[ACTIONS.unStakeFioTokens]: 'unStakeFioTokens'
}

export const FIO_REQUESTS_TYPES = {
PENDING: 'PENDING',
SENT: 'SENT'
}

export const FEE_ACTION_MAP = {
[ACTIONS.addPublicAddress]: {
action: 'getFeeForAddPublicAddress',
propName: 'fioAddress'
},
[ACTIONS.addPublicAddresses]: {
action: 'getFeeForAddPublicAddress',
propName: 'fioAddress'
},
[ACTIONS.rejectFundsRequest]: {
action: 'getFeeForRejectFundsRequest',
propName: 'payerFioAddress'
},
[ACTIONS.requestFunds]: {
action: 'getFeeForNewFundsRequest',
propName: 'payeeFioAddress'
},
[ACTIONS.recordObtData]: {
action: 'getFeeForRecordObtData',
propName: 'payerFioAddress'
},
[ACTIONS.stakeFioTokens]: {
propName: 'fioAddress'
},
[ACTIONS.unStakeFioTokens]: {
propName: 'fioAddress'
}
}

export const DEFAULT_BUNDLED_TXS_AMOUNT = 100
export const DEFAULT_APR = 450
export const STAKING_REWARD_MEMO = 'Paying Staking Rewards'
export const STAKING_LOCK_PERIOD = 1000 * 60 * 60 * 24 * 7 // 7 days
export const DAY_INTERVAL = 1000 * 60 * 60 * 24

export type FioRequest = {
fio_request_id: string,
Expand All @@ -69,3 +143,24 @@ export type FioDomain = {
expiration: string,
isPublic: boolean
}

export type TxOtherParams = {
account: string,
name: string,
authorization: Array<{ actor: string, permission: string }>,
data?: {
amount?: number,
max_fee?: number,
tpid?: string,
actor?: string
} & any,
action?: {
name: string,
params: any
},
meta: {
isTransferProcessed?: boolean,
isFeeProcessed?: boolean
},
ui?: any
}
Loading

0 comments on commit d5595e8

Please sign in to comment.