@manifoldxyz/marketplace-sdk 3.0.7-beta.1 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -619,10 +619,10 @@ class MarketplaceListing {
|
|
|
619
619
|
return true;
|
|
620
620
|
if (this.version == 1) {
|
|
621
621
|
if (!this.listing.erc20) {
|
|
622
|
-
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
622
|
+
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true), 'verify', [(0, Web3Protocol_1.getConnectedAddress)(), amount]);
|
|
623
623
|
}
|
|
624
624
|
else {
|
|
625
|
-
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
625
|
+
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true), 'verify', [(0, Web3Protocol_1.getConnectedAddress)(), this.listing.erc20, amount]);
|
|
626
626
|
}
|
|
627
627
|
}
|
|
628
628
|
else if (this.version == 2) {
|
|
@@ -638,15 +638,15 @@ class MarketplaceListing {
|
|
|
638
638
|
}
|
|
639
639
|
if (useView) {
|
|
640
640
|
try {
|
|
641
|
-
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
641
|
+
return yield (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true), 'verifyView', [this.listing.id, (0, Web3Protocol_1.getConnectedAddress)(), this.listing.tokenAddress, tokenId, count, amount, this.listing.erc20 || NULL_ADDRESS, data]);
|
|
642
642
|
}
|
|
643
643
|
catch (e) {
|
|
644
644
|
// Not using verify view, try checkVerify
|
|
645
|
-
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
645
|
+
return yield (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true), 'checkVerify', [this.contractAddress, this.listing.id, (0, Web3Protocol_1.getConnectedAddress)(), this.listing.tokenAddress, tokenId, count, amount, this.listing.erc20 || NULL_ADDRESS, data]);
|
|
646
646
|
}
|
|
647
647
|
}
|
|
648
648
|
else {
|
|
649
|
-
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
649
|
+
return (0, Web3Protocol_1.callWeb3)(this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true), 'verify', [this.listing.id, (0, Web3Protocol_1.getConnectedAddress)(), this.listing.tokenAddress, tokenId, count, amount, this.listing.erc20 || NULL_ADDRESS, data]);
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
else {
|
package/package.json
CHANGED
|
@@ -180,7 +180,7 @@ class MarketplaceListing {
|
|
|
180
180
|
return contract
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
private _getIdentityVerifierContract(version: number, useView
|
|
183
|
+
private _getIdentityVerifierContract(version: number, useView = false, errorOnNoContract = true, bridge = false): Contract | undefined {
|
|
184
184
|
if (!this.listing?.identityVerifier) throw new Error("Could not get a contract instance")
|
|
185
185
|
if (!Object.keys(identityVerifierMapping).includes(version.toString())) {
|
|
186
186
|
throw new Error("Invalid marketplace version provided")
|
|
@@ -627,16 +627,17 @@ class MarketplaceListing {
|
|
|
627
627
|
* @returns
|
|
628
628
|
*/
|
|
629
629
|
public async checkIdentityVerifier(amount: string | number, count = 1, data = "0x", useView = false) : Promise<boolean> {
|
|
630
|
+
|
|
630
631
|
if (!this.listing!.identityVerifier) return true
|
|
631
632
|
|
|
632
633
|
if (this.version == 1) {
|
|
633
634
|
if (!this.listing!.erc20) {
|
|
634
635
|
return callWeb3(
|
|
635
|
-
this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
636
|
+
this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true)!, 'verify', [getConnectedAddress(), amount]
|
|
636
637
|
)
|
|
637
638
|
} else {
|
|
638
639
|
return callWeb3(
|
|
639
|
-
this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
640
|
+
this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true)!, 'verify', [getConnectedAddress(), this.listing!.erc20, amount]
|
|
640
641
|
)
|
|
641
642
|
}
|
|
642
643
|
} else if (this.version == 2) {
|
|
@@ -651,18 +652,18 @@ class MarketplaceListing {
|
|
|
651
652
|
}
|
|
652
653
|
if (useView) {
|
|
653
654
|
try {
|
|
654
|
-
return callWeb3(
|
|
655
|
-
this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
655
|
+
return await callWeb3(
|
|
656
|
+
this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true)!, 'verifyView', [this.listing!.id, getConnectedAddress(), this.listing!.tokenAddress, tokenId, count, amount, this.listing!.erc20 || NULL_ADDRESS, data]
|
|
656
657
|
)
|
|
657
658
|
} catch (e) {
|
|
658
659
|
// Not using verify view, try checkVerify
|
|
659
|
-
return callWeb3(
|
|
660
|
-
this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
660
|
+
return await callWeb3(
|
|
661
|
+
this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true)!, 'checkVerify', [this.contractAddress, this.listing!.id, getConnectedAddress(), this.listing!.tokenAddress, tokenId, count, amount, this.listing!.erc20 || NULL_ADDRESS, data]
|
|
661
662
|
)
|
|
662
663
|
}
|
|
663
664
|
} else {
|
|
664
665
|
return callWeb3(
|
|
665
|
-
this._getIdentityVerifierContract(this.version), this._getIdentityVerifierContract(this.version,
|
|
666
|
+
this._getIdentityVerifierContract(this.version, useView), this._getIdentityVerifierContract(this.version, useView, true, true)!, 'verify', [this.listing!.id, getConnectedAddress(), this.listing!.tokenAddress, tokenId, count, amount, this.listing!.erc20 || NULL_ADDRESS, data]
|
|
666
667
|
)
|
|
667
668
|
}
|
|
668
669
|
} else {
|