@kyve/contract-lib
Advanced tools
Comparing version 0.1.0-alpha.20 to 0.1.0-alpha.21
import Arweave from "arweave"; | ||
import { JWKInterface } from "arweave/node/lib/wallet"; | ||
import { SwcClient } from "smartweave/lib/v2"; | ||
declare type Keyfile = JWKInterface | "use_wallet"; | ||
@@ -8,3 +9,4 @@ interface GovernanceState { | ||
export declare class Governance { | ||
client: Arweave; | ||
inst: Arweave; | ||
client: SwcClient; | ||
wallet: Keyfile; | ||
@@ -11,0 +13,0 @@ state?: GovernanceState; |
@@ -40,3 +40,3 @@ "use strict"; | ||
exports.Governance = void 0; | ||
var smartweave_1 = require("smartweave"); | ||
var v2_1 = require("smartweave/lib/v2"); | ||
var cross_fetch_1 = require("cross-fetch"); | ||
@@ -47,3 +47,4 @@ var constants_1 = require("./constants"); | ||
this.id = constants_1.GOVERNANCE_CONTRACT_ID; | ||
this.client = arweave; | ||
this.inst = arweave; | ||
this.client = v2_1.SwClientFactory.memCacheClient(arweave); | ||
this.wallet = wallet; | ||
@@ -59,3 +60,3 @@ } | ||
if (!useCache) return [3 /*break*/, 5]; | ||
return [4 /*yield*/, cross_fetch_1.fetch("https://kyve.network/api/pool?id=" + this.id + "&type=meta")]; | ||
return [4 /*yield*/, cross_fetch_1.fetch("https://api.kyve.network/pool?id=" + this.id + "&type=meta")]; | ||
case 1: | ||
@@ -70,5 +71,7 @@ response = _a.sent(); | ||
case 4: return [3 /*break*/, 7]; | ||
case 5: return [4 /*yield*/, smartweave_1.readContract(this.client, this.id)]; | ||
case 5: return [4 /*yield*/, this.client.readState(this.id, undefined, undefined, { | ||
ignoreExceptions: true | ||
})]; | ||
case 6: | ||
res = _a.sent(); | ||
res = (_a.sent()).state; | ||
_a.label = 7; | ||
@@ -75,0 +78,0 @@ case 7: |
import { StateInterface } from "@kyve/contract-pool/dist/faces"; | ||
import Arweave from "arweave"; | ||
import { JWKInterface } from "arweave/node/lib/wallet"; | ||
import { SwcClient } from "smartweave/lib/v2"; | ||
declare type Keyfile = JWKInterface | "use_wallet"; | ||
export declare class Pool { | ||
client: Arweave; | ||
inst: Arweave; | ||
client: SwcClient; | ||
wallet: Keyfile; | ||
@@ -8,0 +10,0 @@ state?: StateInterface; |
@@ -52,2 +52,3 @@ "use strict"; | ||
var smartweave_1 = require("smartweave"); | ||
var v2_1 = require("smartweave/lib/v2"); | ||
var cross_fetch_1 = require("cross-fetch"); | ||
@@ -62,3 +63,4 @@ var constants_1 = require("./constants"); | ||
this.treasury = constants_1.TREASURY_CONTRACT_ID; | ||
this.client = arweave; | ||
this.inst = arweave; | ||
this.client = v2_1.SwClientFactory.memCacheClient(arweave); | ||
this.wallet = wallet; | ||
@@ -75,3 +77,3 @@ this.id = id; | ||
_a = this; | ||
return [4 /*yield*/, smartweave_1.createContractFromTx(this.client, this.wallet, this.src, JSON.stringify(__assign(__assign({}, state), { settings: __assign(__assign({}, state.settings), { foriegnContracts: { | ||
return [4 /*yield*/, smartweave_1.createContractFromTx(this.inst, this.wallet, this.src, JSON.stringify(__assign(__assign({}, state), { settings: __assign(__assign({}, state.settings), { foreignContracts: { | ||
governance: this.governance, | ||
@@ -106,5 +108,7 @@ treasury: this.treasury | ||
case 4: return [3 /*break*/, 7]; | ||
case 5: return [4 /*yield*/, smartweave_1.readContract(this.client, this.id)]; | ||
case 5: return [4 /*yield*/, this.client.readState(this.id, undefined, undefined, { | ||
ignoreExceptions: true | ||
})]; | ||
case 6: | ||
res = _a.sent(); | ||
res = (_a.sent()).state; | ||
_a.label = 7; | ||
@@ -137,5 +141,7 @@ case 7: | ||
case 4: return [3 /*break*/, 7]; | ||
case 5: return [4 /*yield*/, smartweave_1.readContract(this.client, this.id)]; | ||
case 5: return [4 /*yield*/, this.client.readState(this.id, undefined, undefined, { | ||
ignoreExceptions: true | ||
})]; | ||
case 6: | ||
state = _a.sent(); | ||
state = (_a.sent()).state; | ||
txs = state.txs; | ||
@@ -277,3 +283,3 @@ _a.label = 7; | ||
_a.sent(); | ||
return [4 /*yield*/, smartweave_1.interactWrite(this.client, this.wallet, this.state.settings.foreignContracts.governance, input, tags)]; | ||
return [4 /*yield*/, smartweave_1.interactWrite(this.inst, this.wallet, this.state.settings.foreignContracts.governance, input, tags)]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
@@ -291,3 +297,3 @@ } | ||
_a.sent(); | ||
return [4 /*yield*/, smartweave_1.interactWrite(this.client, this.wallet, this.id, input, tags)]; | ||
return [4 /*yield*/, smartweave_1.interactWrite(this.inst, this.wallet, this.id, input, tags)]; | ||
case 2: return [2 /*return*/, _a.sent()]; | ||
@@ -294,0 +300,0 @@ } |
{ | ||
"name": "@kyve/contract-lib", | ||
"version": "0.1.0-alpha.20", | ||
"version": "0.1.0-alpha.21", | ||
"main": "dist/index", | ||
@@ -22,5 +22,9 @@ "types": "dist/index", | ||
"cross-fetch": "^3.1.4", | ||
"smartweave": "johnletey/SmartWeave#release" | ||
"smartweave": "redstone-finance/SmartWeave#ppe/redweave" | ||
}, | ||
"gitHead": "e458235598178472ee5dc38b9f0818794cdb11d1" | ||
"devDependencies": { | ||
"@types/yargs": "^16.0.0", | ||
"yargs": "^16.2.0" | ||
}, | ||
"gitHead": "87ef3e655a2f40f4fee11197c8da721ca1a8cc60" | ||
} |
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
21809
455
2