@cryptovoxels/marketplace-js
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -9,5 +9,5 @@ "use strict"; | ||
mumbai: { | ||
wrapperRegistry: `0x023D0F59046A9E9b3129cdc7e4555eF82D265cD8`, | ||
marketplace: `0x4e172BA6A1AF2FD69A60f9B5c9B33723018E51be`, | ||
tokenRegistry: `0x1830a2bf63d41165cc1f43e4eE4A75528a2F98A4`, | ||
wrapperRegistry: `0xABbE873F8f735D8F86A65500635a838268c81180`, | ||
marketplace: `0xa75BC4AEeB26e7E3ed7Ee54D8B19D23501866132`, | ||
tokenRegistry: `0xBE06783f7a02cFF726c0d4A6F11e8B3c237030a3`, | ||
}, | ||
@@ -14,0 +14,0 @@ polygon: { |
@@ -40,2 +40,5 @@ import { ethers } from "ethers"; | ||
export declare type IndexingObject = Required<IndexingParameters>; | ||
declare type StandardEventName = "@:tx-start" | "@:tx-hash" | "@:tx-mined"; | ||
declare type ApprovalEventName = "approval:tx-start" | "approval:tx-hash" | "approval:tx-mined"; | ||
export declare type EventNames = StandardEventName | ApprovalEventName | "error"; | ||
export {}; |
@@ -12,2 +12,3 @@ /// <reference types="node" /> | ||
private logger; | ||
private emitEvent; | ||
constructor(providerOrSigner: ProviderOrSigner, network?: Network, logger?: (args: string) => void); | ||
@@ -14,0 +15,0 @@ /** |
@@ -22,2 +22,3 @@ "use strict"; | ||
this.logger = console.log; | ||
this.emitEvent = (eventName, ...args) => this.emit(eventName, args); | ||
/** | ||
@@ -43,3 +44,3 @@ * Get a listing from the contract directly given a hash id and index | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
@@ -72,3 +73,3 @@ } | ||
if (!isApproved) { | ||
isApproved = yield (0, helpers_1.askApproval)(this.contractInstance, validatedParams.address, userWallet, this.network, this.emit.bind(this)); | ||
isApproved = yield (0, helpers_1.askApproval)(this.contractInstance, validatedParams.address, userWallet, this.network, this.emitEvent.bind(this)); | ||
if (!isApproved) { | ||
@@ -79,3 +80,3 @@ // Cannot list if not approved | ||
} | ||
this.emit("@:tx-started"); | ||
this.emitEvent("@:tx-start"); | ||
//list item | ||
@@ -89,6 +90,6 @@ let tx; | ||
this.logger(err); | ||
this.emit("@:error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-hash", { hash: tx.hash }); | ||
this.emitEvent("@:tx-hash", { hash: tx.hash }); | ||
let receipt; | ||
@@ -101,6 +102,6 @@ try { | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-mined", { hash: receipt.transactionHash }); | ||
this.emitEvent("@:tx-mined", { hash: receipt.transactionHash }); | ||
return receipt; | ||
@@ -138,3 +139,3 @@ }); | ||
this.buyWithToken = (indexes, quantityToPurchase) => __awaiter(this, void 0, void 0, function* () { | ||
this.emit("@:tx-started"); | ||
this.emitEvent("@:tx-start"); | ||
//list item | ||
@@ -148,6 +149,6 @@ let tx; | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-hash", { hash: tx.hash }); | ||
this.emitEvent("@:tx-hash", { hash: tx.hash }); | ||
let receipt; | ||
@@ -160,10 +161,10 @@ try { | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-mined", { hash: receipt.transactionHash }); | ||
this.emitEvent("@:tx-mined", { hash: receipt.transactionHash }); | ||
return receipt.status; | ||
}); | ||
this.buyWithNativeToken = (indexes, value, quantityToPurchase) => __awaiter(this, void 0, void 0, function* () { | ||
this.emit("@:tx-started"); | ||
this.emitEvent("@:tx-start"); | ||
//list item | ||
@@ -177,6 +178,6 @@ let tx; | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-hash", { hash: tx.hash }); | ||
this.emitEvent("@:tx-hash", { hash: tx.hash }); | ||
let receipt; | ||
@@ -189,6 +190,6 @@ try { | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-mined", { hash: receipt.transactionHash }); | ||
this.emitEvent("@:tx-mined", { hash: receipt.transactionHash }); | ||
return receipt.status; | ||
@@ -203,3 +204,3 @@ }); | ||
} | ||
this.emit("@:tx-started"); | ||
this.emitEvent("@:tx-start"); | ||
//list item | ||
@@ -213,6 +214,6 @@ let tx; | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-hash", { hash: tx.hash }); | ||
this.emitEvent("@:tx-hash", { hash: tx.hash }); | ||
let receipt; | ||
@@ -225,6 +226,6 @@ try { | ||
this.logger(err); | ||
this.emit("error", err); | ||
this.emitEvent("error", err); | ||
return; | ||
} | ||
this.emit("@:tx-mined", { hash: receipt.transactionHash }); | ||
this.emitEvent("@:tx-mined", { hash: receipt.transactionHash }); | ||
return receipt.status; | ||
@@ -231,0 +232,0 @@ }); |
{ | ||
"name": "@cryptovoxels/marketplace-js", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "A simple JS sdk to interact with Voxels' marketplace", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
184680
3386