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

@marigold-dev/gas-station-lib

Package Overview
Dependencies
Maintainers
9
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marigold-dev/gas-station-lib - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

dist/examples/nft/src/lib/index.d.ts

50

dist/index.d.ts
import { TezosToolkit } from "@taquito/taquito";
/**
* index.ts: Interacting with the Tezos blockchain, allowing users to perform token
* transfers and obtain permits for certain operations.
*/
/**
* Settings: Describes the settings object expected by the GasStation class, with an apiURL property.
*/
export type Settings = {
apiURL: string;
};
/**
* Operation: Represents a generic blockchain operation with destination and parameters properties
*/
export type Operation = {

@@ -9,2 +19,6 @@ destination: string;

};
/**
* TransferOperation: Represents a specific type of operation for transferring tokens,
* with from_ as the sender's address and an array of transactions (txs)
*/
export type TransferOperation = {

@@ -20,2 +34,6 @@ from_: string;

};
/**
* PermitOperation: Represents an operation for obtaining a permit,
* including publicKey, signature, and transferHash properties
*/
export type PermitOperation = {

@@ -28,2 +46,5 @@ publicKey: string;

export declare const GAS_STATION_PUBLIC_API_MAINNET = "https://gas-station-api.marigold.dev";
/**
* GasStation is responsible for interacting with a remote API to post blockchain operations.
*/
export declare class GasStation {

@@ -35,7 +56,25 @@ url: string;

* - apiURL: the URL of Gas Station API. /!\ For this version, the URL must redirect to the endpoint /operation
*
* Takes a Settings object and initializes the url property.
*/
constructor(settings?: Settings);
/**
* postOperations: Sends a POST request to the specified API endpoint with the provided operations.
*/
postOperations(sender: string, ops: Array<Operation>): Promise<any>;
/**
* postOperation: A convenience method to post a single operation using postOperations
*/
postOperation(sender: string, op: Operation): Promise<any>;
}
/**
* PermitContract: interacts with a Tezos smart contract, specifically for
* generating permits related to token transfers.
*
* It uses the Tezos toolkit to interact with the Tezos blockchain,
* fetch contract information, and perform operations.
*
* The code utilizes various Tezos-specific functions and conventions for
* encoding data, hashing, and interacting with smart contracts
*/
export declare class PermitContract {

@@ -45,3 +84,10 @@ address: string;

constructor(address: string, tezos: TezosToolkit);
/**
* getCounter: Retrieves the counter value from the contract's storage
*/
getCounter(): Promise<any>;
/**
* generatePermit: Generates a permit for a given transfer operation by computing a
* transfer hash and constructing permit data.
*/
generatePermit(transfer: TransferOperation): Promise<{

@@ -51,3 +97,7 @@ bytes: string;

}>;
/**
* permitCall: Calls the permit entrypoint on the contract with
* the provided permit operation parameters.
*/
permitCall(op: PermitOperation): Promise<import("@taquito/taquito").TransferParams>;
}

36

dist/index.js

@@ -49,2 +49,5 @@ "use strict";

exports.GAS_STATION_PUBLIC_API_MAINNET = "https://gas-station-api.marigold.dev";
/**
* GasStation is responsible for interacting with a remote API to post blockchain operations.
*/
var GasStation = /** @class */ (function () {

@@ -55,2 +58,4 @@ /**

* - apiURL: the URL of Gas Station API. /!\ For this version, the URL must redirect to the endpoint /operation
*
* Takes a Settings object and initializes the url property.
*/

@@ -60,2 +65,5 @@ function GasStation(settings) {

}
/**
* postOperations: Sends a POST request to the specified API endpoint with the provided operations.
*/
GasStation.prototype.postOperations = function (sender, ops) {

@@ -89,2 +97,5 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* postOperation: A convenience method to post a single operation using postOperations
*/
GasStation.prototype.postOperation = function (sender, op) {

@@ -96,2 +107,12 @@ return this.postOperations(sender, [op]);

exports.GasStation = GasStation;
/**
* PermitContract: interacts with a Tezos smart contract, specifically for
* generating permits related to token transfers.
*
* It uses the Tezos toolkit to interact with the Tezos blockchain,
* fetch contract information, and perform operations.
*
* The code utilizes various Tezos-specific functions and conventions for
* encoding data, hashing, and interacting with smart contracts
*/
var PermitContract = /** @class */ (function () {

@@ -102,2 +123,5 @@ function PermitContract(address, tezos) {

}
/**
* getCounter: Retrieves the counter value from the contract's storage
*/
PermitContract.prototype.getCounter = function () {

@@ -119,2 +143,6 @@ return __awaiter(this, void 0, void 0, function () {

};
/**
* generatePermit: Generates a permit for a given transfer operation by computing a
* transfer hash and constructing permit data.
*/
PermitContract.prototype.generatePermit = function (transfer) {

@@ -163,3 +191,3 @@ var _a;

console.info("Permit bytes :", permit_bytes);
console.info("Transfert hash : ", transfer_hash);
console.info("Transfer hash : ", transfer_hash);
return [2 /*return*/, { bytes: permit_bytes, transfer_hash: transfer_hash }];

@@ -170,2 +198,6 @@ }

};
/**
* permitCall: Calls the permit entrypoint on the contract with
* the provided permit operation parameters.
*/
PermitContract.prototype.permitCall = function (op) {

@@ -184,3 +216,3 @@ return __awaiter(this, void 0, void 0, function () {

call = _a.sent();
console.info("Transfert params", call);
console.info("Transfer params", call);
return [2 /*return*/, call];

@@ -187,0 +219,0 @@ }

2

package.json
{
"name": "@marigold-dev/gas-station-lib",
"version": "0.0.7",
"version": "0.0.8",
"description": "Interact with a gas station API and produce TZIP 17 permits",

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

# Tezos Gas Station library
This library helps you
- use [Marigold's Gas Station API](https://github.com/marigold-dev/gas-station) in TypeScript
- create [TZIP-17 permit contracts](https://tzip.tezosagora.org/proposal/tzip-17/), which are FA2
contracts that can be manipulated by a 3rd party (such as the gas station API). Permits are signed
This library facilitates the following:
- Utilizing [Marigold's Gas Station API](https://github.com/marigold-dev/gas-station) in TypeScript.
- Creating [TZIP-17 permit contracts](https://tzip.tezosagora.org/proposal/tzip-17/), which are FA2
contracts capable of being manipulated by a 3rd party, such as the gas station API. Permits are signed
off-chain and can be posted and executed by anyone.
A toy webapp example is available in the `examples/` directory.
An example of a toy web app is provided in the `examples/nft` directory.
Contributions welcome at https://github.com/marigold-dev/gas-station-lib.
Feel free to contribute and provide feedback on https://github.com/marigold-dev/gas-station-lib.

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