@refinableco/refinable-sdk
Advanced tools
Comparing version 4.1.0-next.1 to 4.1.0-next.2
@@ -152,2 +152,3 @@ "use strict"; | ||
Platform["Refinable"] = "REFINABLE"; | ||
Platform["X2Y2"] = "X2Y2"; | ||
})(Platform = exports.Platform || (exports.Platform = {})); | ||
@@ -154,0 +155,0 @@ var PriceCurrency; |
@@ -139,4 +139,6 @@ "use strict"; | ||
] }), | ||
_a[Network_1.Chain.PolygonMainnet] = __assign(__assign({}, chainConfigBase), { name: "Polygon (Matic Network) Mainnet", displayName: "Polygon", shortName: "Polygon", networkId: Network_1.Chain.PolygonMainnet, networkName: "polygon", networkType: Network_1.NetworkType.MAINNET, chainType: Network_1.ChainType.POLYGON, nodeUri: [ | ||
"https://matic-mainnet.chainstacklabs.com", | ||
_a[Network_1.Chain.PolygonMainnet] = __assign(__assign({}, chainConfigBase), { name: "Polygon (Matic Network) Mainnet", displayName: "Polygon", shortName: "Polygon", networkId: Network_1.Chain.PolygonMainnet, networkName: "polygon", networkType: Network_1.NetworkType.MAINNET, chainType: Network_1.ChainType.POLYGON, | ||
// https://docs.polygon.technology/docs/develop/network-details/network/ | ||
nodeUri: [ | ||
"https://polygon-rpc.com/", | ||
"https://rpc-mainnet.matic.quiknode.pro", | ||
@@ -143,0 +145,0 @@ ], explorerUri: "https://polygonscan.com/", supportedCurrencies: [ |
@@ -53,2 +53,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -58,2 +61,3 @@ exports.ERC721NFT = void 0; | ||
var sale_1 = require("../graphql/sale"); | ||
var EvmTransaction_1 = __importDefault(require("../transaction/EvmTransaction")); | ||
var AbstractEvmNFT_1 = require("./AbstractEvmNFT"); | ||
@@ -69,3 +73,3 @@ var ERCSaleId_1 = require("./ERCSaleId"); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var nftTokenContract; | ||
var nftTokenContract, setApprovalForAllTx, ex_1, gasLimit, fee; | ||
return __generator(this, function (_a) { | ||
@@ -76,10 +80,27 @@ switch (_a.label) { | ||
nftTokenContract = _a.sent(); | ||
return [4 /*yield*/, nftTokenContract.sendTransaction("setApprovalForAll", [ | ||
operatorAddress, | ||
true, | ||
])]; | ||
case 2: | ||
// FIXME: we should actually use this but our contracts do not support it | ||
// return this.nftTokenContract.approve(operatorAddress, this.item.tokenId); | ||
return [2 /*return*/, _a.sent()]; | ||
_a.label = 2; | ||
case 2: | ||
_a.trys.push([2, 4, , 9]); | ||
return [4 /*yield*/, nftTokenContract.contract.setApprovalForAll(operatorAddress, true)]; | ||
case 3: | ||
setApprovalForAllTx = _a.sent(); | ||
return [3 /*break*/, 9]; | ||
case 4: | ||
ex_1 = _a.sent(); | ||
if (!(ex_1.code === "UNPREDICTABLE_GAS_LIMIT")) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, nftTokenContract.contract.estimateGas.setApprovalForAll(operatorAddress, true)]; | ||
case 5: | ||
gasLimit = _a.sent(); | ||
return [4 /*yield*/, this.refinable.provider.getFeeData()]; | ||
case 6: | ||
fee = _a.sent(); | ||
return [4 /*yield*/, nftTokenContract.contract.setApprovalForAll(operatorAddress, true, { | ||
gasLimit: gasLimit, | ||
gasPrice: fee.gasPrice, | ||
})]; | ||
case 7: | ||
setApprovalForAllTx = _a.sent(); | ||
_a.label = 8; | ||
case 8: return [3 /*break*/, 9]; | ||
case 9: return [2 /*return*/, new EvmTransaction_1.default(setApprovalForAllTx)]; | ||
} | ||
@@ -86,0 +107,0 @@ }); |
@@ -17,2 +17,13 @@ "use strict"; | ||
})(); | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
@@ -149,3 +160,5 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
to: unsignedTx.to, | ||
value: unsignedTx.value, | ||
value: this._offer.price.currency != graphql_1.PriceCurrency.Eth | ||
? "0" | ||
: unsignedTx.value, | ||
})]; | ||
@@ -160,3 +173,5 @@ case 1: | ||
_a.trys.push([2, 5, , 6]); | ||
return [4 /*yield*/, this.refinable.evm.signer.sendTransaction(unsignedTx)]; | ||
return [4 /*yield*/, this.refinable.evm.signer.sendTransaction(__assign(__assign({}, unsignedTx), { value: this._offer.price.currency != graphql_1.PriceCurrency.Eth | ||
? "0" | ||
: unsignedTx.value }))]; | ||
case 3: | ||
@@ -163,0 +178,0 @@ response = _a.sent(); |
@@ -186,3 +186,3 @@ "use strict"; | ||
abi: ["function approve(address _spender, uint256 _value)"], | ||
}, this.refinable.evm.provider, this.refinable.evm.options); | ||
}, this.refinable.evm.providerOrSigner, this.refinable.evm.options); | ||
formattedAmount = ethers_1.ethers.utils | ||
@@ -189,0 +189,0 @@ .parseUnits(amount.toString(), token.decimals) |
@@ -136,3 +136,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var chainId, _a, contract, contractAbi, receipt, deployTx, _b, contractId, registeredContract, _c, _d, createdCollection; | ||
var chainId, _a, contract, contractAbi, receipt, deployTx, _b, contractId, registeredContract, _c, _d, createCollectionData, contractArguments, createdCollection; | ||
return __generator(this, function (_e) { | ||
@@ -168,5 +168,11 @@ switch (_e.label) { | ||
_e.label = 8; | ||
case 8: return [4 /*yield*/, this.refinable.graphqlClient.request(collections_1.CREATE_COLLECTION, { | ||
data: __assign(__assign({}, (0, omit_1.default)(params, "contractArguments")), { avatar: params.avatar, banner: params.banner, tokenType: registeredContract.getTokenType(), contractId: contractId, chainId: chainId, contractAddress: registeredContract.contractAddress }), | ||
})]; | ||
case 8: | ||
createCollectionData = __assign(__assign({}, (0, omit_1.default)(params, "contractArguments")), { avatar: params.avatar, banner: params.banner, tokenType: registeredContract.getTokenType(), contractId: contractId, chainId: chainId, contractAddress: registeredContract.contractAddress }); | ||
if (type === graphql_1.ContractTypes.Erc721LazyMintToken) { | ||
contractArguments = params.contractArguments; | ||
createCollectionData.maxSupply = contractArguments.tokenMintLimit; | ||
} | ||
return [4 /*yield*/, this.refinable.graphqlClient.request(collections_1.CREATE_COLLECTION, { | ||
data: createCollectionData, | ||
})]; | ||
case 9: | ||
@@ -173,0 +179,0 @@ createdCollection = (_e.sent()).createCollection; |
{ | ||
"name": "@refinableco/refinable-sdk", | ||
"version": "4.1.0-next.1", | ||
"version": "4.1.0-next.2", | ||
"description": "The Refinable SDK allows you to easily interact with the Refinable Marketplace to mint, sell and buy NFTs", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
855224
243
14997