-
Notifications
You must be signed in to change notification settings - Fork 10
Fix/rpc queries #192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix/rpc queries #192
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
fdca049
Generate the new rpc structure
2102600
Remove resolution set for polkadot/keyring
4f05810
Fix jest debugging issue by updating jest packages
8d702c1
Fix cennz rpc definition
ee587d3
AssetToPay -> AssetToPayout
c5142a7
Enable generic asset rpc test
03f7017
Fix cennzx rpc returned types
4c539f0
Remove Payment queryInfo from custom rpcs.
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,67 @@ | ||
// import { RpcMethodOpt } from '@polkadot/jsonrpc/types'; | ||
// | ||
// import createMethod from '@polkadot/jsonrpc/create/method'; | ||
// import createParam from '@polkadot/jsonrpc/create/param'; | ||
// | ||
// const buyPrice: RpcMethodOpt = { | ||
// description: 'Retrieves the CENNZX exchange buy price', | ||
// isOptional: true, | ||
// params: [ | ||
// createParam('AssetToBuy', 'AssetId'), | ||
// createParam('Amount', 'Balance'), | ||
// createParam('AssetToPay', 'AssetId'), | ||
// ], | ||
// type: 'Balance', | ||
// }; | ||
// | ||
// const sellPrice: RpcMethodOpt = { | ||
// description: 'Retrieves the CENNZX exchange sell price', | ||
// isOptional: true, | ||
// params: [ | ||
// createParam('AssetToSell', 'AssetId'), | ||
// createParam('Amount', 'Balance'), | ||
// createParam('AssetToPayout', 'AssetId'), | ||
// ], | ||
// type: 'Balance', | ||
// }; | ||
// | ||
// // Returns the core asset price and investment asset's price for investment asset Id | ||
// const liquidityPrice: RpcMethodOpt = { | ||
// description: 'Get the price of liquidity for the given asset ID', | ||
// isOptional: true, | ||
// params: [createParam('AssetId', 'AssetId'), createParam('liquidityToBuy', 'Balance')], | ||
// type: '(Balance, Balance)' as any, | ||
// }; | ||
// | ||
// // Returns liquidity volume, core amount, asset amount for given asset | ||
// const liquidityValue: RpcMethodOpt = { | ||
// description: "Get the value of an account's liquidity for the given asset", | ||
// isOptional: true, | ||
// params: [createParam('AccountId', 'Address'), createParam('AssetId', 'AssetId')], | ||
// type: '(Balance, Balance, Balance)' as any, | ||
// }; | ||
// | ||
// const section = 'cennzx'; | ||
// | ||
// export default [ | ||
// { ...createMethod(section, 'buyPrice', buyPrice), name: 'buyPrice' }, | ||
// { ...createMethod(section, 'sellPrice', sellPrice), name: 'sellPrice' }, | ||
// { ...createMethod(section, 'liquidityPrice', liquidityPrice), name: 'liquidityPrice' }, | ||
// { ...createMethod(section, 'liquidityValue', liquidityValue), name: 'liquidityValue' }, | ||
// ]; | ||
const cennzxRpc = { | ||
buyPrice: { | ||
description: 'Retrieves the spot exchange buy price', | ||
params: [ | ||
{ | ||
name: 'AssetToBuy', | ||
type: 'AssetId', | ||
}, | ||
{ | ||
name: 'Amount', | ||
type: 'Balance', | ||
}, | ||
{ | ||
name: 'AssetToPay', | ||
type: 'AssetId', | ||
}, | ||
], | ||
type: 'Balance', | ||
}, | ||
sellPrice: { | ||
description: 'Retrieves the spot exchange sell price', | ||
params: [ | ||
{ | ||
name: 'AssetToSell', | ||
type: 'AssetId', | ||
}, | ||
{ | ||
name: 'Amount', | ||
type: 'Balance', | ||
}, | ||
{ | ||
name: 'AssetToPay', | ||
aliXsed marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
type: 'AssetId', | ||
}, | ||
], | ||
type: 'Balance', | ||
}, | ||
liquidityPrice: { | ||
description: 'Get the price of liquidity for the given asset ID', | ||
params: [ | ||
{ | ||
name: 'AssetId', | ||
type: 'AssetId', | ||
}, | ||
{ | ||
name: 'liquidityToBuy', | ||
type: 'Balance', | ||
}, | ||
], | ||
type: '(Balance, Balance) as any', | ||
}, | ||
liquidityValue: { | ||
description: "Get the value of an account's liquidity for the given asset", | ||
params: [ | ||
{ | ||
name: 'AccountId', | ||
type: 'Address', | ||
}, | ||
{ | ||
name: 'AssetId', | ||
type: 'AssetId', | ||
}, | ||
], | ||
type: '(Balance, Balance, Balance) as any', | ||
}, | ||
}; | ||
export default cennzxRpc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,9 @@ | ||
// import { RpcMethodOpt } from '@polkadot/jsonrpc/types'; | ||
// | ||
// import createMethod from '@polkadot/jsonrpc/create/method'; | ||
// | ||
// const registeredAssets: RpcMethodOpt = { | ||
// description: 'Get all registered generic assets (symbol, decimal places)', | ||
// isOptional: true, | ||
// params: [], | ||
// type: 'Vec<(AssetId, AssetInfo)>', | ||
// }; | ||
// | ||
// const section = 'genericAsset'; | ||
// | ||
// export default [{ ...createMethod(section, 'registeredAssets', registeredAssets), name: 'registeredAssets' }]; | ||
const genericAssetRpc = { | ||
registeredAssets: { | ||
description: 'Get all registered generic assets (symbol, decimal places)', | ||
params: [], | ||
type: 'Vec<(AssetId, AssetInfo)>', | ||
}, | ||
}; | ||
|
||
export default genericAssetRpc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
// import cennzx from './cennzx'; | ||
// import genericAsset from './genericAsset'; | ||
// | ||
// const interfaces: Record<string, object> = { | ||
// cennzx, | ||
// genericAsset, | ||
// }; | ||
// | ||
// export default interfaces; | ||
import cennzxRpc from './cennzx'; | ||
import genericAssetRpc from './genericAsset'; | ||
import paymentRpc from './payment'; | ||
|
||
const interfaces = { | ||
cennzx: cennzxRpc, | ||
genericAsset: genericAssetRpc, | ||
payment: paymentRpc, | ||
aliXsed marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
}; | ||
|
||
export default interfaces; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const paymentRpc = { | ||
aliXsed marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
queryInfo: { | ||
description: 'Query transaction payment info', | ||
params: [ | ||
{ | ||
name: 'EncodedXt', | ||
type: 'Bytes', | ||
}, | ||
{ | ||
name: 'At', | ||
type: 'BlockHash', | ||
}, | ||
], | ||
type: 'RuntimeDispatchInfo', | ||
}, | ||
}; | ||
|
||
export default paymentRpc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.