@vostokplatform/voting-contract-api
Advanced tools
Comparing version 0.1.0-RC2 to 0.1.0-RC20
export declare enum ParamType { | ||
string = "string", | ||
number = "number", | ||
integer = "integer", | ||
boolean = "boolean" | ||
@@ -5,0 +5,0 @@ } |
@@ -1,20 +0,26 @@ | ||
import { ICreateContractParams, IUpdateServerListParams, IVoteParams, IVotingContractAPICtr, IDkgRoundParams, IUpdateAdminListParams, IAddMainKey, IResultsParams, IDkgCommitParams, IDkgScalarParams, IDkgShadowsParams, IDkgComplaintParams, IDecryptionParams } from "./interfaces"; | ||
import { ICreateContractParams, IUpdateServerListParams, IVoteParams, IVotingContractAPICtr, IDkgRoundParams, IUpdateAdminListParams, IAddMainKey, IResultsParams, IDkgCommitParams, IDkgScalarParams, IDkgShadowsParams, IDkgComplaintParams, IDecryptionParams, IModifiedWavesApiResponse } from "./interfaces"; | ||
export declare class VotingContract { | ||
private readonly weApi; | ||
private readonly keyPair; | ||
private readonly fetchInstance; | ||
private readonly apiUrl; | ||
private readonly STATUS_RESPONSE_TIMEOUT; | ||
private checkStatusTimerId; | ||
private checkStatus; | ||
private waitStatusResponse; | ||
private createOperationParam; | ||
private callDockerContract; | ||
constructor(ctr: IVotingContractAPICtr); | ||
initiateVoting: (params: ICreateContractParams) => any; | ||
vote: (params: IVoteParams) => any; | ||
updateServerList: (params: IUpdateServerListParams) => any; | ||
dkgRound: (params: IDkgRoundParams) => any; | ||
updateAdminList: (params: IUpdateAdminListParams) => any; | ||
addMainKey: (params: IAddMainKey) => any; | ||
results: (params: IResultsParams) => any; | ||
dkgCommit: (params: IDkgCommitParams) => any; | ||
dkgScalar: (params: IDkgScalarParams) => any; | ||
dkgShadows: (params: IDkgShadowsParams) => any; | ||
dkgComplaint: (params: IDkgComplaintParams) => any; | ||
decryption: (params: IDecryptionParams) => any; | ||
initiateVoting: (params: ICreateContractParams) => Promise<IModifiedWavesApiResponse>; | ||
vote: (params: IVoteParams) => Promise<IModifiedWavesApiResponse>; | ||
updateServerList: (params: IUpdateServerListParams) => Promise<IModifiedWavesApiResponse>; | ||
dkgRound: (params: IDkgRoundParams) => Promise<IModifiedWavesApiResponse>; | ||
updateAdminList: (params: IUpdateAdminListParams) => Promise<IModifiedWavesApiResponse>; | ||
addMainKey: (params: IAddMainKey) => Promise<IModifiedWavesApiResponse>; | ||
results: (params: IResultsParams) => Promise<IModifiedWavesApiResponse>; | ||
dkgCommit: (params: IDkgCommitParams) => Promise<IModifiedWavesApiResponse>; | ||
dkgScalar: (params: IDkgScalarParams) => Promise<IModifiedWavesApiResponse>; | ||
dkgShadows: (params: IDkgShadowsParams) => Promise<IModifiedWavesApiResponse>; | ||
dkgComplaint: (params: IDkgComplaintParams) => Promise<IModifiedWavesApiResponse>; | ||
decryption: (params: IDecryptionParams) => Promise<IModifiedWavesApiResponse>; | ||
} |
@@ -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(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@vostokplatform/waves-api"),require("moment"));else if("function"==typeof define&&define.amd)define(["@vostokplatform/waves-api","moment"],e);else{var r="object"==typeof exports?e(require("@vostokplatform/waves-api"),require("moment")):e(t["@vostokplatform/waves-api"],t.moment);for(var a in r)("object"==typeof exports?exports:t)[a]=r[a]}}(this,(function(t,e){return function(t){var e={};function r(a){if(e[a])return e[a].exports;var n=e[a]={i:a,l:!1,exports:{}};return t[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=t,r.c=e,r.d=function(t,e,a){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:a})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)r.d(a,n,function(e){return t[e]}.bind(null,n));return a},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=2)}([function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){t.string="string",t.integer="integer",t.boolean="boolean"}(e.ParamType||(e.ParamType={}))},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});class a extends Error{constructor(t){super(`Error. Cannot map contract params. Unknown type for key: ${t}.`),this.name="MapContractParamsError"}}e.MapContractParamsError=a},function(t,e,r){"use strict";var a=this&&this.__awaiter||function(t,e,r,a){return new(r||(r=Promise))((function(n,s){function i(t){try{c(a.next(t))}catch(t){s(t)}}function o(t){try{c(a.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(i,o)}c((a=a.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const n=r(3),s=r(0),i=r(4),o={statusResponseTimeout:2e4};e.VotingContract=class{constructor(t){this.checkStatusTimerId=null,this.checkStatus=t=>a(this,void 0,void 0,(function*(){const e=yield this.fetchInstance(`${this.apiUrl}/contracts/status/${t}`,{method:"GET"}),r=yield e.json();return 200===e.status?Object.assign(Object.assign({},e),{success:!0,data:r}):Object.assign(Object.assign({},e),{success:!1,data:r})})),this.waitStatusResponse=t=>(...e)=>a(this,void 0,void 0,(function*(){const r=yield t(...e);return new Promise(t=>{let e=!1;setTimeout(()=>{null!==this.checkStatusTimerId&&clearTimeout(this.checkStatusTimerId),e=!0,t({success:!1,data:r})},this.STATUS_RESPONSE_TIMEOUT);const n=()=>a(this,void 0,void 0,(function*(){const a=yield this.checkStatus(r.id);a.success&&a.data.some(t=>"Success"===t.status)&&(e=!0,t({success:!0,data:r,status:a.data})),e||(this.checkStatusTimerId=setTimeout(n,1e3))}));n()})})),this.createOperationParam=t=>({type:s.ParamType.string,key:"operation",value:t}),this.callDockerContract=(t,e,r)=>{const{txParams:{contractId:a,fee:n},contractParams:s}=e,i={senderPublicKey:this.keyPair.publicKey,authorPublicKey:this.keyPair.publicKey,contractId:a,timestamp:Date.now(),params:[t,...Object.entries(s).map(r)],fee:n};return this.weApi.API.Node.transactions.broadcastFromClientAddress("dockerCall",i,this.keyPair)},this.initiateVoting=t=>a(this,void 0,void 0,(function*(){const{txParams:{fee:e,contractName:r,image:a,imageHash:n},contractParams:s}=t,o={senderPublicKey:this.keyPair.publicKey,timestamp:Date.now(),image:a,imageHash:n,contractName:r,params:Object.entries(s).map(i.mapCreateContractParams),fee:e};return this.weApi.API.Node.transactions.broadcastFromClientAddress("dockerCreateV2",o,this.keyPair)})),this.vote=t=>this.callDockerContract(this.createOperationParam("vote"),t,i.mapVoteParams),this.updateServerList=t=>this.callDockerContract(this.createOperationParam("updateServerList"),t,i.mapUpdateServerListParams),this.dkgRound=t=>this.callDockerContract(this.createOperationParam("dkgRound"),t,i.mapDkgRoundParams),this.updateAdminList=t=>this.callDockerContract(this.createOperationParam("updateAdminList"),t,i.mapUpdateAdminListParams),this.addMainKey=t=>this.callDockerContract(this.createOperationParam("addMainKey"),t,i.mapAddMainKeyParams),this.results=t=>this.callDockerContract(this.createOperationParam("results"),t,i.mapResultsParams),this.dkgCommit=t=>this.callDockerContract(this.createOperationParam("dkgCommit"),t,i.mapDkgCommitParams),this.dkgScalar=t=>this.callDockerContract(this.createOperationParam("dkgScalar"),t,i.mapDkgScalarParams),this.dkgShadows=t=>this.callDockerContract(this.createOperationParam("dkgShadows"),t,i.mapDkgShadowsParams),this.dkgComplaint=t=>this.callDockerContract(this.createOperationParam("dkgComplaint"),t,i.mapDkgComplaintParams),this.decryption=t=>this.callDockerContract(this.createOperationParam("decryption"),t,i.mapDecryptionParams);const{apiUrl:e,fetchInstance:r,keyPair:c,statusResponseTimeout:u}=Object.assign(Object.assign({},o),t);this.STATUS_RESPONSE_TIMEOUT=u,this.fetchInstance=r,this.apiUrl=e.replace(/\/$/,""),this.keyPair=c,this.weApi=n.create({initialConfiguration:Object.assign(Object.assign({},n.MAINNET_CONFIG),{nodeAddress:e}),fetchInstance:r}),this.initiateVoting=this.waitStatusResponse(this.initiateVoting),this.callDockerContract=this.waitStatusResponse(this.callDockerContract)}}},function(e,r){e.exports=t},function(t,e,r){"use strict";function a(t){for(var r in t)e.hasOwnProperty(r)||(e[r]=t[r])}Object.defineProperty(e,"__esModule",{value:!0}),a(r(5)),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)),a(r(19))},function(t,e,r){"use strict";var a=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const n=a(r(6)),s=r(0),i=r(7),o=r(8),c=r(1);e.mapCreateContractParams=t=>{const[e,r]=t;if("string"==typeof r)return{type:s.ParamType.string,key:e,value:r};if(i.isDateInstance(r))return{type:s.ParamType.string,key:e,value:n.default(r).format(o.DateFormat)};if(Array.isArray(r))return"docs"===e?{type:s.ParamType.string,key:e,value:JSON.stringify(r.map(t=>(t.dateUpload=n.default(t.dateUpload).format(o.DateFormat),t)))}:{type:s.ParamType.string,key:e,value:JSON.stringify(r)};if("number"==typeof r)return{type:s.ParamType.integer,key:e,value:r};throw new c.MapContractParamsError(e)}},function(t,r){t.exports=e},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isDateInstance=function(t){return t instanceof Date&&!isNaN(t.valueOf())}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DateFormat="DD-MM-YYYY HH:mm:ss"},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapUpdateServerListParams=t=>{const[e,r]=t;if("string"==typeof r)return{type:a.ParamType.string,key:e,value:r};if(Array.isArray(r))return{type:a.ParamType.string,key:e,value:JSON.stringify(r)};if("number"==typeof r)return{type:a.ParamType.integer,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapVoteParams=function(t){const[e,r]=t;if("string"==typeof r)return{type:a.ParamType.string,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapDkgRoundParams=function(t){const[e,r]=t;if("number"==typeof r)return{type:a.ParamType.integer,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapUpdateAdminListParams=function(t){const[e,r]=t;if(Array.isArray(r))return{type:a.ParamType.string,key:e,value:JSON.stringify(r)};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapAddMainKeyParams=function(t){const[e,r]=t;if("string"==typeof r)return{type:a.ParamType.string,key:e,value:r};if("number"==typeof r)return{type:a.ParamType.integer,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapResultsParams=function(t){const[e,r]=t;if("string"==typeof r)return{type:a.ParamType.string,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapDkgCommitParams=function(t){const[e,r]=t;if("number"==typeof r)return{type:a.ParamType.integer,key:e,value:r};if("object"==typeof r)return{type:a.ParamType.string,key:e,value:JSON.stringify(r)};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapDkgScalarParams=function(t){const[e,r]=t;if("number"==typeof r)return{type:a.ParamType.integer,key:e,value:r};if("string"==typeof r)return{type:a.ParamType.string,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapDkgShadowsParams=function(t){const[e,r]=t;if("object"==typeof r)return{type:a.ParamType.string,key:e,value:JSON.stringify(r)};if("number"==typeof r)return{type:a.ParamType.integer,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapDkgComplaintParams=function(t){const[e,r]=t;if("number"==typeof r)return{type:a.ParamType.integer,key:e,value:r};if("string"==typeof r)return{type:a.ParamType.string,key:e,value:r};throw new n.MapContractParamsError(e)}},function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0});const a=r(0),n=r(1);e.mapDecryptionParams=function(t){const[e,r]=t;if("string"==typeof r)return{type:a.ParamType.string,key:e,value:r};throw new n.MapContractParamsError(e)}}])})); | ||
//# sourceMappingURL=index.js.map |
import { IDockerCallParams } from "./index"; | ||
import { IServer } from "./IServer"; | ||
interface TxParams { | ||
@@ -15,3 +16,3 @@ fee: number; | ||
dateEnd: Date; | ||
k: string; | ||
k: number; | ||
participants: string[]; | ||
@@ -24,10 +25,5 @@ admins: string[]; | ||
}[]; | ||
servers: { | ||
description: string; | ||
pubKey: string; | ||
type: string; | ||
i?: string; | ||
}[]; | ||
servers: IServer[]; | ||
} | ||
export declare type ICreateContractParams = IDockerCallParams<ContractParams, TxParams>; | ||
export {}; |
@@ -1,4 +0,4 @@ | ||
import { IDockerCallParams } from "./index"; | ||
import { IDockerCallParams, IPoint } from "./index"; | ||
interface ContractParams { | ||
commit: number; | ||
commit: IPoint; | ||
round: number; | ||
@@ -5,0 +5,0 @@ } |
import { IDockerCallParams } from "./index"; | ||
interface ContractParams { | ||
scalar: number; | ||
scalar: string; | ||
round: number; | ||
@@ -5,0 +5,0 @@ } |
@@ -1,9 +0,9 @@ | ||
import { IDockerCallParams } from "./index"; | ||
import { IPoint } from "./IPoint"; | ||
import { IDockerCallParams, IShadowMap } from './index'; | ||
import { IPointMap } from "./IPointMap"; | ||
interface ContractParams { | ||
round: number; | ||
shadows: IPoint[]; | ||
exponents: IPoint[]; | ||
shadows: IShadowMap; | ||
exponents: IPointMap; | ||
} | ||
export declare type IDkgShadowsParams = IDockerCallParams<ContractParams>; | ||
export {}; |
@@ -1,2 +0,1 @@ | ||
import fetch from "isomorphic-fetch"; | ||
import { IDockerCallTxParams } from "./IDockerCallTxPrams"; | ||
@@ -11,2 +10,3 @@ export interface IKeyPair { | ||
keyPair: IKeyPair; | ||
statusResponseTimeout?: number; | ||
} | ||
@@ -28,4 +28,6 @@ export interface IDockerCallParams<ContractParams, DockerCallTxParams = IDockerCallTxParams> { | ||
export * from "./IDkgShadowsParams"; | ||
export * from "./IPoint"; | ||
export * from "./IPointMap"; | ||
export * from "./IShadowMap"; | ||
export * from "./IDkgComplaintParams"; | ||
export * from "./IDecryptionParams"; | ||
export * from "./IStatusResponse"; |
import { IDockerCallParams } from "./index"; | ||
interface ContractParams { | ||
results: string[]; | ||
results: string; | ||
} | ||
export declare type IResultsParams = IDockerCallParams<ContractParams>; | ||
export {}; |
import { IDockerCallParams } from "./index"; | ||
import { IServer } from "./IServer"; | ||
interface ContractParams { | ||
description: string; | ||
i: number; | ||
pubKey: string; | ||
type: string; | ||
status: string; | ||
dkgRound: number; | ||
dkgScalar: string; | ||
dkgCommit: string; | ||
dkgShadows: { | ||
[key: number]: { | ||
x: number; | ||
y: number; | ||
}; | ||
}; | ||
dkgComplaints: [string, string]; | ||
dkgExponents: { | ||
[key: number]: { | ||
x: number; | ||
y: number; | ||
}; | ||
}; | ||
servers: IServer[]; | ||
k: number; | ||
round: number; | ||
} | ||
export declare type IUpdateServerListParams = IDockerCallParams<ContractParams>; | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
export declare const DateFormat = "dd-MM-yyyy HH:mm:ss"; | ||
export declare const DateFormat = "DD-MM-YYYY HH:mm:ss"; |
@@ -6,3 +6,3 @@ import { ParamType } from "../contractParams"; | ||
key: string; | ||
value: never; | ||
value: string; | ||
}; |
@@ -6,3 +6,3 @@ import { ParamType } from "../contractParams"; | ||
key: string; | ||
value: never; | ||
value: string; | ||
}; |
{ | ||
"name": "@vostokplatform/voting-contract-api", | ||
"version": "0.1.0-RC2", | ||
"version": "0.1.0-RC20", | ||
"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" | ||
@@ -26,3 +27,4 @@ }, | ||
"@vostokplatform/waves-api": "1.3.0-RC8", | ||
"moment": "2.24.0" | ||
"moment": "2.24.0", | ||
"clean-webpack-plugin": "^3.0.0" | ||
}, | ||
@@ -29,0 +31,0 @@ "dependencies": {}, |
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
64378
41
379
13
1