Home Reference Source

packages/oo7-parity/src/abis/index.js

  1. // (C) Copyright 2016-2017 Parity Technologies (UK) Ltd.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14.  
  15. const ParityApi = require('@parity/api');
  16.  
  17. const sha3 = ParityApi.util.sha3;
  18.  
  19. /** @type {ABI} */
  20. const RegistryABI = require('./registry.json');
  21. const RegistryExtras = [
  22. { name: 'lookupData', method: 'getData', args: [n => sha3(n.toLowerCase()), null] },
  23. { name: 'lookupAddress', method: 'getAddress', args: [n => sha3(n.toLowerCase()), null] },
  24. { name: 'lookupUint', method: 'getUint', args: [n => sha3(n.toLowerCase()), null] },
  25. { name: 'lookupOwner', method: 'getOwner', args: [n => sha3(n.toLowerCase())] }
  26. ];
  27. /**
  28. * Github Hint ABI definition.
  29. *
  30. * @type {ABI}
  31. */
  32. const GitHubHintABI = (() => require('./githubhint.json'))();
  33. /** @type {ABI} */
  34. const OperationsABI = (() => require('./operations.json'))();
  35. /** @type {ABI} */
  36. const BadgeRegABI = (() => require('./badgereg.json'))();
  37. /** @type {ABI} */
  38. const TokenRegABI = (() => require('./tokenreg.json'))();
  39. /** @type {ABI} */
  40. const BadgeABI = (() => require('./badge.json'))();
  41. /** @type {ABI} */
  42. const TokenABI = (() => require('./token.json'))();
  43.  
  44. /**
  45. * Deprecated.
  46. */
  47. function abiPolyfill () {
  48. return {
  49. registry: RegistryABI,
  50. registryExtras: RegistryExtras,
  51. githubhint: GitHubHintABI,
  52. operations: OperationsABI,
  53. badgereg: BadgeRegABI,
  54. tokenreg: TokenRegABI,
  55. badge: BadgeABI,
  56. erc20token: TokenABI
  57. };
  58. }
  59.  
  60. module.exports = {
  61. abiPolyfill,
  62. RegistryABI,
  63. RegistryExtras,
  64. GitHubHintABI,
  65. OperationsABI,
  66. BadgeRegABI,
  67. TokenRegABI,
  68. BadgeABI,
  69. TokenABI
  70. };