Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@vostokplatform/voting-contract-api

Package Overview
Dependencies
Maintainers
11
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vostokplatform/voting-contract-api - npm Package Compare versions

Comparing version 0.1.0-RC3 to 0.1.0-RC4

dist/interfaces/IPointMap.d.ts

2

dist/contractParams.d.ts
export declare enum ParamType {
string = "string",
number = "number",
integer = "integer",
boolean = "boolean"

@@ -5,0 +5,0 @@ }

@@ -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.integer="integer",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)};if("number"==typeof r)return{type:o.ParamType.integer,key:t,value: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)};if("number"==typeof r)return{type:a.ParamType.integer,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.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.integer,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.integer,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.integer,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.mapDkgScalarParams=function(e){const[t,r]=e;if("number"==typeof r)return{type:a.ParamType.integer,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.mapDkgShadowsParams=function(e){const[t,r]=e;if("object"==typeof r)return{type:a.ParamType.string,key:t,value:JSON.stringify(r)};if("number"==typeof r)return{type:a.ParamType.integer,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.integer,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
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 {};
import { IDockerCallParams } from "./index";
interface ContractParams {
commit: number;
commit: string;
round: number;

@@ -5,0 +5,0 @@ }

import { IDockerCallParams } from "./index";
interface ContractParams {
scalar: number;
scalar: string;
round: number;

@@ -5,0 +5,0 @@ }

import { IDockerCallParams } from "./index";
import { IPoint } from "./IPoint";
import { IPointMap } from "./IPointMap";
interface ContractParams {
round: number;
shadows: IPoint[];
exponents: IPoint[];
shadows: IPointMap;
exponents: IPointMap;
}
export declare type IDkgShadowsParams = IDockerCallParams<ContractParams>;
export {};

@@ -27,4 +27,4 @@ import fetch from "isomorphic-fetch";

export * from "./IDkgShadowsParams";
export * from "./IPoint";
export * from "./IPointMap";
export * from "./IDkgComplaintParams";
export * from "./IDecryptionParams";
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;
}
export declare type IUpdateServerListParams = IDockerCallParams<ContractParams>;
export {};

@@ -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-RC3",
"version": "0.1.0-RC4",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc