New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@verto/contracts

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@verto/contracts - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

3

build/amm/index.js

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,12 +11,14 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { TogglePairGatekeeper } from "./modules/togglePairGatekeeper";
import { SetCommunityContract } from "./modules/setCommunityContract";
import { ForeignTransfer } from "./modules/foreignTransfer";
import { CreateOrder } from "./modules/createOrder";
import { CancelOrder } from "./modules/cancelOrder";
import { ReadOutbox } from "./modules/readOutbox";
import { AddPair } from "./modules/addPair";
import { Invoke } from "./modules/invoke";
import { Halt } from "./modules/halt";
export function handle(state, action) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = void 0;
const togglePairGatekeeper_1 = require("./modules/togglePairGatekeeper");
const setCommunityContract_1 = require("./modules/setCommunityContract");
const foreignTransfer_1 = require("./modules/foreignTransfer");
const createOrder_1 = require("./modules/createOrder");
const cancelOrder_1 = require("./modules/cancelOrder");
const readOutbox_1 = require("./modules/readOutbox");
const addPair_1 = require("./modules/addPair");
const invoke_1 = require("./modules/invoke");
const halt_1 = require("./modules/halt");
function handle(state, action) {
return __awaiter(this, void 0, void 0, function* () {

@@ -25,19 +28,19 @@ ContractAssert(!state.halted || action.input.function === "halt", "The contract is currently halted");

case "addPair":
return { state: yield AddPair(state, action) };
return { state: yield (0, addPair_1.AddPair)(state, action) };
case "createOrder":
return { state: yield CreateOrder(state, action) };
return { state: yield (0, createOrder_1.CreateOrder)(state, action) };
case "cancelOrder":
return { state: yield CancelOrder(state, action) };
return { state: yield (0, cancelOrder_1.CancelOrder)(state, action) };
case "readOutbox":
return { state: yield ReadOutbox(state, action) };
return { state: yield (0, readOutbox_1.ReadOutbox)(state, action) };
case "invoke":
return { state: yield Invoke(state, action) };
return { state: yield (0, invoke_1.Invoke)(state, action) };
case "togglePairGatekeeper":
return { state: TogglePairGatekeeper(state, action) };
return { state: (0, togglePairGatekeeper_1.TogglePairGatekeeper)(state, action) };
case "setCommunityContract":
return { state: SetCommunityContract(state, action) };
return { state: (0, setCommunityContract_1.SetCommunityContract)(state, action) };
case "foreignTransfer":
return { state: ForeignTransfer(state, action) };
return { state: (0, foreignTransfer_1.ForeignTransfer)(state, action) };
case "halt":
return { state: Halt(state, action) };
return { state: (0, halt_1.Halt)(state, action) };
default:

@@ -48,1 +51,2 @@ throw new ContractError(`Invalid function: "${action.input.function}"`);

}
exports.handle = handle;

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,3 +11,5 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
export const AddPair = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddPair = void 0;
const AddPair = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
var _a, _b;

@@ -68,1 +71,2 @@ const caller = action.caller;

});
exports.AddPair = AddPair;

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,4 +11,6 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { isAddress } from "../utils";
export const CancelOrder = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
Object.defineProperty(exports, "__esModule", { value: true });
exports.CancelOrder = void 0;
const utils_1 = require("../utils");
const CancelOrder = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
const caller = action.caller;

@@ -17,3 +20,3 @@ const input = action.input;

// Verify order ID
ContractAssert(isAddress(orderTxID), "Invalid order ID");
ContractAssert((0, utils_1.isAddress)(orderTxID), "Invalid order ID");
// Remap all orders into one array

@@ -43,1 +46,2 @@ const allOrders = state.pairs.map((pair) => pair.orders).flat(1);

});
exports.CancelOrder = CancelOrder;

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,4 +11,6 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { ensureValidTransfer, isAddress } from "../utils";
export const CreateOrder = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreateOrder = void 0;
const utils_1 = require("../utils");
const CreateOrder = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
const caller = action.caller;

@@ -20,3 +23,3 @@ const input = action.input;

// Test that pairs are valid contract strings
ContractAssert(isAddress(usedPair[0]) && isAddress(usedPair[1]), "One of two supplied pairs is invalid");
ContractAssert((0, utils_1.isAddress)(usedPair[0]) && (0, utils_1.isAddress)(usedPair[1]), "One of two supplied pairs is invalid");
// Find the pair index

@@ -51,5 +54,5 @@ const pairIndex = pairs.findIndex(({ pair }) => pair.includes(usedPair[0]) && pair.includes(usedPair[1]));

ContractAssert(fromToken === contractID, "Invalid transfer transaction, using the wrong token. The transferred token has to be the first item in the pair");
ContractAssert(isAddress(contractID), "Invalid contract ID format");
ContractAssert((0, utils_1.isAddress)(contractID), "Invalid contract ID format");
// Test tokenTx for valid contract interaction
yield ensureValidTransfer(contractID, tokenTx);
yield (0, utils_1.ensureValidTransfer)(contractID, tokenTx);
// Sort orderbook based on prices

@@ -73,2 +76,3 @@ let sortedOrderbook = state.pairs[pairIndex].orders.sort((a, b) => a.price > b.price ? 1 : -1);

});
exports.CreateOrder = CreateOrder;
function matchOrder(inputToken, // Token of the new order

@@ -75,0 +79,0 @@ inputQuantity, inputCreator, inputTransaction, inputTransfer, orderbook, inputPrice, foreignCalls = [], logs = []) {

@@ -1,2 +0,5 @@

export const ForeignTransfer = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ForeignTransfer = void 0;
const ForeignTransfer = (state, action) => {
const caller = action.caller;

@@ -20,1 +23,2 @@ const input = action.input;

};
exports.ForeignTransfer = ForeignTransfer;

@@ -1,2 +0,5 @@

export const Halt = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Halt = void 0;
const Halt = (state, action) => {
const caller = action.caller;

@@ -7,1 +10,2 @@ // Ensure that only the emergency wallet has access to this function

};
exports.Halt = Halt;

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,3 +11,5 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
export const Invoke = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
Object.defineProperty(exports, "__esModule", { value: true });
exports.Invoke = void 0;
const Invoke = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
const input = action.input;

@@ -25,1 +28,2 @@ // Ensure that the interaction has an invocation object

});
exports.Invoke = Invoke;

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,4 +11,6 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { handle } from "../index";
export const ReadOutbox = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReadOutbox = void 0;
const index_1 = require("../index");
const ReadOutbox = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
const input = action.input;

@@ -27,3 +30,3 @@ // Ensure that a contract ID is passed

// Run invocation
res = (yield handle(res, { caller: input.contract, input: entry.input }))
res = (yield (0, index_1.handle)(res, { caller: input.contract, input: entry.input }))
.state;

@@ -35,1 +38,2 @@ // Push invocation to executed invocations

});
exports.ReadOutbox = ReadOutbox;

@@ -1,3 +0,6 @@

import { isAddress } from "../utils";
export const SetCommunityContract = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SetCommunityContract = void 0;
const utils_1 = require("../utils");
const SetCommunityContract = (state, action) => {
const caller = action.caller;

@@ -8,4 +11,5 @@ const { id } = action.input;

// Check if the supplied ID is valid
ContractAssert(isAddress(id), "Invalid ID supplied");
ContractAssert((0, utils_1.isAddress)(id), "Invalid ID supplied");
return Object.assign(Object.assign({}, state), { communityContract: id });
};
exports.SetCommunityContract = SetCommunityContract;

@@ -1,2 +0,5 @@

export const TogglePairGatekeeper = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TogglePairGatekeeper = void 0;
const TogglePairGatekeeper = (state, action) => {
const caller = action.caller;

@@ -7,1 +10,2 @@ // Ensure that only the emergency wallet has access to this function

};
exports.TogglePairGatekeeper = TogglePairGatekeeper;

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,2 +11,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAddress = exports.ensureValidInteraction = exports.ensureValidTransfer = void 0;
/**

@@ -18,5 +21,5 @@ * Ensures that the interaction tx is a valid transfer transaction

*/
export const ensureValidTransfer = (tokenID, transferTx) => __awaiter(void 0, void 0, void 0, function* () {
const ensureValidTransfer = (tokenID, transferTx) => __awaiter(void 0, void 0, void 0, function* () {
// Test tokenTx for valid contract interaction
yield ensureValidInteraction(tokenID, transferTx);
yield (0, exports.ensureValidInteraction)(tokenID, transferTx);
try {

@@ -42,2 +45,3 @@ const tx = yield SmartWeave.unsafeClient.transactions.get(transferTx);

});
exports.ensureValidTransfer = ensureValidTransfer;
/**

@@ -49,3 +53,3 @@ * Ensures that the interaction is valid

*/
export const ensureValidInteraction = (contractID, interactionID) => __awaiter(void 0, void 0, void 0, function* () {
const ensureValidInteraction = (contractID, interactionID) => __awaiter(void 0, void 0, void 0, function* () {
const { validity: contractTxValidities

@@ -59,2 +63,3 @@ // @ts-ignore

});
exports.ensureValidInteraction = ensureValidInteraction;
/**

@@ -67,2 +72,3 @@ * Returns if a string is a valid Arweave address or ID

*/
export const isAddress = (addr) => /[a-z0-9_-]{43}/i.test(addr);
const isAddress = (addr) => /[a-z0-9_-]{43}/i.test(addr);
exports.isAddress = isAddress;

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,6 +11,8 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { UpdateCollaborators } from "./modules/collaborators";
import { UpdateDetails } from "./modules/details";
import { UpdateItems } from "./modules/items";
export function handle(state, action) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = void 0;
const collaborators_1 = require("./modules/collaborators");
const details_1 = require("./modules/details");
const items_1 = require("./modules/items");
function handle(state, action) {
return __awaiter(this, void 0, void 0, function* () {

@@ -19,11 +22,12 @@ switch (action.input.function) {

case "updateDetails":
return { state: UpdateDetails(state, action) };
return { state: (0, details_1.UpdateDetails)(state, action) };
// collaborators
case "updateCollaborators":
return { state: UpdateCollaborators(state, action) };
return { state: (0, collaborators_1.UpdateCollaborators)(state, action) };
// Edit items
case "updateItems":
return { state: UpdateItems(state, action) };
return { state: (0, items_1.UpdateItems)(state, action) };
}
});
}
exports.handle = handle;

@@ -1,2 +0,5 @@

export const UpdateCollaborators = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateCollaborators = void 0;
const UpdateCollaborators = (state, action) => {
const collaborators = state.collaborators;

@@ -15,1 +18,2 @@ const input = action.input;

};
exports.UpdateCollaborators = UpdateCollaborators;

@@ -1,2 +0,5 @@

export const UpdateDetails = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateDetails = void 0;
const UpdateDetails = (state, action) => {
var _a, _b;

@@ -9,1 +12,2 @@ const collaborators = state.collaborators;

};
exports.UpdateDetails = UpdateDetails;

@@ -1,2 +0,5 @@

export const UpdateItems = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.UpdateItems = void 0;
const UpdateItems = (state, action) => {
const collaborators = state.collaborators;

@@ -11,1 +14,2 @@ const input = action.input;

};
exports.UpdateItems = UpdateItems;

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,6 +11,8 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { Claim } from "./modules/claim";
import { List } from "./modules/list";
import { Unlist } from "./modules/unlist";
export function handle(state, action) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = void 0;
const claim_1 = require("./modules/claim");
const list_1 = require("./modules/list");
const unlist_1 = require("./modules/unlist");
function handle(state, action) {
return __awaiter(this, void 0, void 0, function* () {

@@ -19,10 +22,11 @@ switch (action.input.function) {

case "claim":
return { state: Claim(state, action) };
return { state: (0, claim_1.Claim)(state, action) };
// Tokens
case "list":
return { state: yield List(state, action) };
return { state: yield (0, list_1.List)(state, action) };
case "unlist":
return { state: Unlist(state, action) };
return { state: (0, unlist_1.Unlist)(state, action) };
}
});
}
exports.handle = handle;

@@ -0,3 +1,6 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Claim = void 0;
// TODO: deprecate this, **ANS**
export const Claim = (state, action) => {
const Claim = (state, action) => {
let people = state.people;

@@ -49,1 +52,2 @@ const caller = action.caller;

};
exports.Claim = Claim;

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,3 +11,5 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
export const List = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
Object.defineProperty(exports, "__esModule", { value: true });
exports.List = void 0;
const List = (state, action) => __awaiter(void 0, void 0, void 0, function* () {
const people = state.people;

@@ -54,2 +57,3 @@ const tokens = state.tokens;

});
exports.List = List;
function getInitialState(contractID) {

@@ -56,0 +60,0 @@ return __awaiter(this, void 0, void 0, function* () {

@@ -1,2 +0,5 @@

export const Unlist = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Unlist = void 0;
const Unlist = (state, action) => {
const people = state.people;

@@ -15,1 +18,2 @@ const tokens = state.tokens;

};
exports.Unlist = Unlist;

@@ -1,10 +0,8 @@

import * as nft_1 from "./nft";
export { nft_1 as nft };
import * as invite_1 from "./invite";
export { invite_1 as invite };
import * as community_1 from "./community";
export { community_1 as community };
import * as collection_1 from "./collection";
export { collection_1 as collection };
import * as clob_1 from "./clob";
export { clob_1 as clob };
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.clob = exports.collection = exports.community = exports.invite = exports.nft = void 0;
exports.nft = require("./nft");
exports.invite = require("./invite");
exports.community = require("./community");
exports.collection = require("./collection");
exports.clob = require("./clob");

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,7 +11,9 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { Balance } from "./modules/balance";
import { Invite } from "./modules/invite";
import { Mint } from "./modules/mint";
import { Transfer } from "./modules/transfer";
export function handle(state, action) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = void 0;
const balance_1 = require("./modules/balance");
const invite_1 = require("./modules/invite");
const mint_1 = require("./modules/mint");
const transfer_1 = require("./modules/transfer");
function handle(state, action) {
return __awaiter(this, void 0, void 0, function* () {

@@ -20,12 +23,13 @@ switch (action.input.function) {

case "transfer":
return { state: Transfer(state, action) };
return { state: (0, transfer_1.Transfer)(state, action) };
case "balance":
return { result: Balance(state, action) };
return { result: (0, balance_1.Balance)(state, action) };
// Custom Functions
case "mint":
return { state: Mint(state, action) };
return { state: (0, mint_1.Mint)(state, action) };
case "invite":
return { state: Invite(state, action) };
return { state: (0, invite_1.Invite)(state, action) };
}
});
}
exports.handle = handle;

@@ -1,2 +0,5 @@

export const Balance = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Balance = void 0;
const Balance = (state, action) => {
const balances = state.balances;

@@ -13,1 +16,2 @@ const caller = action.caller;

};
exports.Balance = Balance;

@@ -1,2 +0,5 @@

export const Invite = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Invite = void 0;
const Invite = (state, action) => {
const balances = state.balances;

@@ -18,1 +21,2 @@ const invites = state.invites;

};
exports.Invite = Invite;

@@ -1,2 +0,5 @@

export const Mint = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mint = void 0;
const Mint = (state, action) => {
const owner = SmartWeave.contract.owner;

@@ -18,1 +21,2 @@ const balances = state.balances;

};
exports.Mint = Mint;

@@ -1,2 +0,5 @@

export const Transfer = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Transfer = void 0;
const Transfer = (state, action) => {
const balances = state.balances;

@@ -25,1 +28,2 @@ const caller = action.caller;

};
exports.Transfer = Transfer;

@@ -1,1 +0,2 @@

export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -0,1 +1,2 @@

"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -10,14 +11,16 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
import { Transfer } from "./modules/transfer";
import { Balance } from "./modules/balance";
import { Mint } from "./modules/mint";
export function handle(state, action) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.handle = void 0;
const transfer_1 = require("./modules/transfer");
const balance_1 = require("./modules/balance");
const mint_1 = require("./modules/mint");
function handle(state, action) {
return __awaiter(this, void 0, void 0, function* () {
switch (action.input.function) {
case "transfer":
return { state: Transfer(state, action) };
return { state: (0, transfer_1.Transfer)(state, action) };
case "balance":
return { result: Balance(state, action) };
return { result: (0, balance_1.Balance)(state, action) };
case "mint":
return { state: Mint(state, action) };
return { state: (0, mint_1.Mint)(state, action) };
default:

@@ -28,1 +31,2 @@ throw new ContractError(`Invalid function: "${action.input.function}"`);

}
exports.handle = handle;

@@ -1,2 +0,5 @@

export const Balance = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Balance = void 0;
const Balance = (state, action) => {
const balances = state.balances;

@@ -13,1 +16,2 @@ const caller = action.caller;

};
exports.Balance = Balance;

@@ -1,2 +0,5 @@

export const Mint = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mint = void 0;
const Mint = (state, action) => {
const owner = state.owner;

@@ -17,1 +20,2 @@ const allowMinting = state.allowMinting;

};
exports.Mint = Mint;

@@ -1,2 +0,5 @@

export const Transfer = (state, action) => {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Transfer = void 0;
const Transfer = (state, action) => {
const balances = state.balances;

@@ -25,1 +28,2 @@ const caller = action.caller;

};
exports.Transfer = Transfer;
{
"name": "@verto/contracts",
"version": "0.0.1",
"version": "0.0.2",
"author": "th8ta LLC",

@@ -5,0 +5,0 @@ "license": "MIT",

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