Skip to content

Commit

Permalink
♻️ add apiURL variables && update constructor of GasStation class
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Burg committed Dec 18, 2023
1 parent 3663417 commit d345f1c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
16 changes: 14 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,21 @@ export type PermitOperation = {
transferHash: string;
};

export const GAS_STATION_PUBLIC_API_GHOSTNET =
"https://ghostnet.gas-station-api.marigold.dev/operation";
export const GAS_STATION_PUBLIC_API_MAINNET =
"https://gas-station-api.marigold.dev/operation";

export class GasStation {
url: string;

constructor(settings: Settings) {
this.url = settings.apiURL;
/**
*
* @param settings (optional) object
* - apiURL: the URL of Gas Station API. /!\ For this version, the URL must redirect to the endpoint /operation
*/
constructor(settings?: Settings) {
this.url = settings?.apiURL || GAS_STATION_PUBLIC_API_GHOSTNET;
}

async postOperations(sender: string, ops: Array<Operation>) {
Expand Down Expand Up @@ -62,6 +72,8 @@ export class GasStation {
}
}

const g = new GasStation();

export class PermitContract {
address: string;
tezos: TezosToolkit;
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@marigold-dev/gas-station-lib",
"version": "0.0.4",
"version": "0.0.6",
"description": "Interact with a gas station API and produce TZIP 17 permits",
"main": "./dist/index.js",
"files": [
Expand Down

0 comments on commit d345f1c

Please sign in to comment.