@vostokplatform/voting-contract-api
Advanced tools
Comparing version 0.1.0-RC2 to 0.1.0-RC3
@@ -1,2 +0,2 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@vostokplatform/waves-api"),require("moment"));else if("function"==typeof define&&define.amd)define(["@vostokplatform/waves-api","moment"],t);else{var r="object"==typeof exports?t(require("@vostokplatform/waves-api"),require("moment")):t(e["@vostokplatform/waves-api"],e.moment);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,(function(e,t){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.string="string",e.number="number",e.boolean="boolean"}(t.ParamType||(t.ParamType={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(2),n=r(0),o=r(3);t.VotingContract=class{constructor(e){this.createOperationParam=e=>({type:n.ParamType.string,key:"operation",value:e}),this.callDockerContract=(e,t,r)=>{const{txParams:{contractId:a,fee:n},contractParams:o}=t,i={senderPublicKey:this.keyPair.publicKey,authorPublicKey:this.keyPair.publicKey,contractId:a,timestamp:Date.now(),params:[e,...Object.entries(o).map(r)],fee:n};return this.weApi.API.Node.transactions.broadcastFromClientAddress("dockerCall",i,this.keyPair)},this.initiateVoting=e=>{const{txParams:{fee:t,contractName:r,image:a,imageHash:n},contractParams:i}=e,s={senderPublicKey:this.keyPair.publicKey,timestamp:Date.now(),image:a,imageHash:n,contractName:r,params:Object.entries(i).map(o.mapCreateContractParams),fee:t};return this.weApi.API.Node.transactions.broadcastFromClientAddress("dockerCreateV2",s,this.keyPair)},this.vote=e=>this.callDockerContract(this.createOperationParam(this.vote.name),e,o.mapVoteParams),this.updateServerList=e=>this.callDockerContract(this.createOperationParam(this.updateServerList.name),e,o.mapUpdateServerListParams),this.dkgRound=e=>this.callDockerContract(this.createOperationParam(this.dkgRound.name),e,o.mapDkgRoundParams),this.updateAdminList=e=>this.callDockerContract(this.createOperationParam(this.updateAdminList.name),e,o.mapUpdateAdminListParams),this.addMainKey=e=>this.callDockerContract(this.createOperationParam(this.addMainKey.name),e,o.mapAddMainKeyParams),this.results=e=>this.callDockerContract(this.createOperationParam(this.results.name),e,o.mapResultsParams),this.dkgCommit=e=>this.callDockerContract(this.createOperationParam(this.dkgCommit.name),e,o.mapDkgCommitParams),this.dkgScalar=e=>this.callDockerContract(this.createOperationParam(this.dkgScalar.name),e,o.mapDkgScalarParams),this.dkgShadows=e=>this.callDockerContract(this.createOperationParam(this.dkgShadows.name),e,o.mapDkgShadowsParams),this.dkgComplaint=e=>this.callDockerContract(this.createOperationParam(this.dkgComplaint.name),e,o.mapDkgComplaintParams),this.decryption=e=>this.callDockerContract(this.createOperationParam(this.decryption.name),e,o.mapDecryptionParams);const{apiUrl:t,fetchInstance:r,keyPair:i}=e;this.keyPair=i,this.weApi=a.create({initialConfiguration:Object.assign(Object.assign({},a.MAINNET_CONFIG),{nodeAddress:t}),fetchInstance:r})}}},function(t,r){t.exports=e},function(e,t,r){"use strict";function a(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),a(r(4)),a(r(8)),a(r(9)),a(r(10)),a(r(11)),a(r(12)),a(r(13)),a(r(14)),a(r(15)),a(r(16)),a(r(17)),a(r(18))},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=a(r(5)),o=r(0),i=r(6),s=r(7);t.mapCreateContractParams=e=>{const[t,r]=e;if("string"==typeof r)return{type:o.ParamType.string,key:t,value:r};if(i.isDateInstance(r))return{type:o.ParamType.string,key:t,value:n.default(r).format(s.DateFormat)};if(Array.isArray(r))return"docs"===t?{type:o.ParamType.string,key:t,value:JSON.stringify(r.map(e=>(e.dateUpload=n.default(e.dateUpload).format(s.DateFormat),e)))}:{type:o.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDateInstance=function(e){return e instanceof Date&&!isNaN(e.valueOf())}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateFormat="dd-MM-yyyy HH:mm:ss"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapUpdateServerListParams=e=>{const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapVoteParams=function(e){const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgRoundParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapUpdateAdminListParams=function(e){const[t,r]=e;if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapAddMainKeyParams=function(e){const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapResultsParams=function(e){const[t,r]=e;if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgCommitParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgScalarParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgShadowsParams=function(e){const[t,r]=e;if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgComplaintParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDecryptionParams=function(e){const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};throw new Error("An unknown error occurred")}}])})); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@vostokplatform/waves-api"),require("moment"));else if("function"==typeof define&&define.amd)define(["@vostokplatform/waves-api","moment"],t);else{var r="object"==typeof exports?t(require("@vostokplatform/waves-api"),require("moment")):t(e["@vostokplatform/waves-api"],e.moment);for(var a in r)("object"==typeof exports?exports:e)[a]=r[a]}}(this,(function(e,t){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=1)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.string="string",e.number="number",e.boolean="boolean"}(t.ParamType||(t.ParamType={}))},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(2),n=r(0),o=r(3);t.VotingContract=class{constructor(e){this.createOperationParam=e=>({type:n.ParamType.string,key:"operation",value:e}),this.callDockerContract=(e,t,r)=>{const{txParams:{contractId:a,fee:n},contractParams:o}=t,i={senderPublicKey:this.keyPair.publicKey,authorPublicKey:this.keyPair.publicKey,contractId:a,timestamp:Date.now(),params:[e,...Object.entries(o).map(r)],fee:n};return this.weApi.API.Node.transactions.broadcastFromClientAddress("dockerCall",i,this.keyPair)},this.initiateVoting=e=>{const{txParams:{fee:t,contractName:r,image:a,imageHash:n},contractParams:i}=e,s={senderPublicKey:this.keyPair.publicKey,timestamp:Date.now(),image:a,imageHash:n,contractName:r,params:Object.entries(i).map(o.mapCreateContractParams),fee:t};return this.weApi.API.Node.transactions.broadcastFromClientAddress("dockerCreateV2",s,this.keyPair)},this.vote=e=>this.callDockerContract(this.createOperationParam(this.vote.name),e,o.mapVoteParams),this.updateServerList=e=>this.callDockerContract(this.createOperationParam(this.updateServerList.name),e,o.mapUpdateServerListParams),this.dkgRound=e=>this.callDockerContract(this.createOperationParam(this.dkgRound.name),e,o.mapDkgRoundParams),this.updateAdminList=e=>this.callDockerContract(this.createOperationParam(this.updateAdminList.name),e,o.mapUpdateAdminListParams),this.addMainKey=e=>this.callDockerContract(this.createOperationParam(this.addMainKey.name),e,o.mapAddMainKeyParams),this.results=e=>this.callDockerContract(this.createOperationParam(this.results.name),e,o.mapResultsParams),this.dkgCommit=e=>this.callDockerContract(this.createOperationParam(this.dkgCommit.name),e,o.mapDkgCommitParams),this.dkgScalar=e=>this.callDockerContract(this.createOperationParam(this.dkgScalar.name),e,o.mapDkgScalarParams),this.dkgShadows=e=>this.callDockerContract(this.createOperationParam(this.dkgShadows.name),e,o.mapDkgShadowsParams),this.dkgComplaint=e=>this.callDockerContract(this.createOperationParam(this.dkgComplaint.name),e,o.mapDkgComplaintParams),this.decryption=e=>this.callDockerContract(this.createOperationParam(this.decryption.name),e,o.mapDecryptionParams);const{apiUrl:t,fetchInstance:r,keyPair:i}=e;this.keyPair=i,this.weApi=a.create({initialConfiguration:Object.assign(Object.assign({},a.MAINNET_CONFIG),{nodeAddress:t}),fetchInstance:r})}}},function(t,r){t.exports=e},function(e,t,r){"use strict";function a(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),a(r(4)),a(r(8)),a(r(9)),a(r(10)),a(r(11)),a(r(12)),a(r(13)),a(r(14)),a(r(15)),a(r(16)),a(r(17)),a(r(18))},function(e,t,r){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const n=a(r(5)),o=r(0),i=r(6),s=r(7);t.mapCreateContractParams=e=>{const[t,r]=e;if("string"==typeof r)return{type:o.ParamType.string,key:t,value:r};if(i.isDateInstance(r))return{type:o.ParamType.string,key:t,value:n.default(r).format(s.DateFormat)};if(Array.isArray(r))return"docs"===t?{type:o.ParamType.string,key:t,value:JSON.stringify(r.map(e=>(e.dateUpload=n.default(e.dateUpload).format(s.DateFormat),e)))}:{type:o.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,r){e.exports=t},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isDateInstance=function(e){return e instanceof Date&&!isNaN(e.valueOf())}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DateFormat="DD-MM-YYYY HH:mm:ss"},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapUpdateServerListParams=e=>{const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapVoteParams=function(e){const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgRoundParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapUpdateAdminListParams=function(e){const[t,r]=e;if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapAddMainKeyParams=function(e){const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapResultsParams=function(e){const[t,r]=e;if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgCommitParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgScalarParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgShadowsParams=function(e){const[t,r]=e;if(Array.isArray(r))return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDkgComplaintParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.number,key:t,value:r};if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};throw new Error("An unknown error occurred")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const a=r(0);t.mapDecryptionParams=function(e){const[t,r]=e;if("string"==typeof r)return{type:a.ParamType.string,key:t,value:r};throw new Error("An unknown error occurred")}}])})); | ||
//# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
export declare const DateFormat = "dd-MM-yyyy HH:mm:ss"; | ||
export declare const DateFormat = "DD-MM-YYYY HH:mm:ss"; |
{ | ||
"name": "@vostokplatform/voting-contract-api", | ||
"version": "0.1.0-RC2", | ||
"version": "0.1.0-RC3", | ||
"description": "", | ||
@@ -8,2 +8,3 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"example": "ts-node example/usageExample.ts", | ||
"build": "webpack --config webpack/webpack.config.js --mode=production --progress --display-error-details" | ||
@@ -10,0 +11,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
52115
36
1