Skip to content

Commit

Permalink
Update from b03101d
Browse files Browse the repository at this point in the history
  • Loading branch information
Hathoriel committed Nov 23, 2021
1 parent f38bd86 commit 6c37320
Show file tree
Hide file tree
Showing 24 changed files with 165 additions and 117 deletions.
63 changes: 43 additions & 20 deletions README.txt
Expand Up @@ -5,7 +5,7 @@ Tags: tatum, blockchain, nft, erc721, ethereum, celo, bsc, mint
Requires at least: 5.5
Requires PHP: 7.0
Tested up to: 5.7.1
Stable tag: 2.0.11
Stable tag: 2.0.12
License: MIT
License URI: https://opensource.org/licenses/MIT

Expand All @@ -14,42 +14,62 @@ License URI: https://opensource.org/licenses/MIT
== Description ==
If you want to sell NFTs but don’t want to build an entire NFT marketplace from scratch, then NFT Maker is the plugin you’ve been waiting for.

Lazy Minting. Free IPFS Storage. Forever. Supports Ethereum, Polygon, Binance Smart Chain, Celo, and Harmony.
Lazy Minting. Free IPFS Storage, forever. Supports Ethereum, Polygon, Binance Smart Chain, Celo, and Harmony.

NFT Maker by Tatum allows you to turn your Woocommerce store into an NFT store with a simple plugin. Install our plugin, follow your usual WordPress product publishing flow, and only tick an extra box — make NFT.
NFT Maker by Tatum allows you to turn your Woocommerce store into an NFT store with a simple plugin. Install our plugin, follow your usual WordPress product publishing flow, and just tick which blockchain you’d like to mint your NFTs on.

You are welcome to add your pull request to the [repository](https://github.com/tatumio/woocommerce-plugin). If you have any questions just shoot [Discord](https://discord.gg/Mg2vdtD4JQ)
You are welcome to add your pull request to our Github [repository](https://github.com/tatumio/woocommerce-plugin). If you have any questions just drop us a line on the Tatum [Discord](https://discord.gg/Mg2vdtD4JQ).
Or feel free to contact developer via [Telegram](https://t.me/LukasKotol).

== Installation ==

This section describes how to install the Tatum plugin and get it working.

1. Create an account in the [Tatum Dashboard](https://dashboard.tatum.io/login) and obtain paid API key.
2. Install [Woocommerce plugin](https://wordpress.org/plugins/woocommerce/) if you don't have already installed it yet.
3. Submit your API key.
4. You are ready to mint NFT tokens! In the overview, you can see info about your API key.
5. Create Woocommerce product. Don't forget to select chain on which NFT will be minted.
6. Don't forget to set an NFT image. Only images up to 50 MB are available for storing. If you don't set an image your NFT will not be minted!
7. After you create product can see it in the list of lazy minted NFTs.
8. If your customer adds product to the cart and proceed to checkout, he/she will need to submit blockchain address to which will be NFT minted.
9. After successful purchase of the NFT customer will see the blockchain transaction.
10. Blockchain transaction links can redirect customer to the blockchain explorer to see NFT mint transaction details.
11. Admin can also see all sold and minted NFT.
1. Download and install the [Woocommerce plugin](https://wordpress.org/plugins/woocommerce/) if you haven’t already.
2. Click “Get your Tatum API key.”
3. Login to the Tatum dashboard and purchase a paid plan.
4. When you have completed your purchase, you will be directed back to the Tatum dashboard. Next to your newly created API key, click “Show” and copy your API key.
5. Now, back in the NFT Maker dashboard, paste your API key in the field labeled “Paste your API key below.”
6. Okay, you’re all ready to mint NFT tokens! In the overview, you can see info about your API key.
7. Open the “Product” tab in the left-hand column of your WordPress dashboard.
8. Click “Add product.”
9. Name your NFT.
10. Set its price in the “General” tab of the “Product data” box.
11. In the “NFT Maker” tab of the same box, select the blockchain on which to mint the NFT upon purchase.
12. Upload an image by clicking “Set product image” in the “Product Image” field in the right-hand column of the screen.
13. Click “Publish” to create your product. Now it is available for purchase in your e-shop. You can also view it in your list of lazy-minted NFTs. You will not consume any credits from your paid plan for gas fees until someone purchases your NFT and it is minted on the blockchain you have selected.
14. When a buyer adds the NFT to their cart and proceeds to checkout, they will have to enter a blockchain address on the blockchain to which the NFT will be minted.
15. After a successful purchase of the NFT, the customer will be shown a link to the blockchain transaction.
16. The blockchain transaction link redirects the customer to the blockchain explorer of the respective blockchain where they can view NFT mint transaction details.
17. Admins of the WordPress shop can also view all lazy-minted and sold NFTs.

== Frequently Asked Questions ==

= Can I use the Tatum plugin for selling NFTs? =
= Why do I need an API key? =
Normally, to create NFTs on different blockchains, you would need to have access to blockchain nodes and create wallets on each blockchain.
With NFT Maker, you can simply use an API key to connect to different blockchains through Tatum, and everything else is taken care of for you.

= Do I need to generate a blockchain wallet on each blockchain I want to mint NFTs on? =
No, since NFTs are lazy-minted, you do not need to create wallets on any blockchain. Once an NFT is purchased, it is minted directly to the buyer’s blockchain address.

Yes, the Tatum plugin is made for selling and minting NFTs without any blockchain experience.
= Do I have to choose which blockchain I will mint all of my NFTs on during setup? =
No, you can choose which NFT to mint on which blockchain when you are setting up each product.
You can select one blockchain per product, but you can also create multiple NFTs of the same image for multiple blockchains if you so choose.

= Is the plugin free? =
Yes, the NFT Maker plugin itself is completely free. However, in order to pay for the gas fees necessary to mint NFTs, you must buy a paid plan in the [Tatum Dashboard](https://dashboard.tatum.io/).
Each paid plan has different credit amounts, and credits will be consumed when your NFTs are purchased and minted to the blockchain, based on the current gas fees of the given blockchain.

No, you must buy paid plan in [Tatum Dashboard](https://dashboard.tatum.io/).
= If I don’t use all my credits within a month, do they carry over to the next month? =
At the moment, no, unused credits do not carry over to the following month.

= Can customers sell their NFT? =
= Can my users sell their NFTs with NFT Maker? =
NFT Maker can only be used to sell NFTs created by admins to customers.
To create NFT marketplaces that allow users to sell their own NFTs, please refer to Tatum’s [How to build p2p NFT marketplaces guide.](https://docs.tatum.io/tutorials/how-to-create-a-peer-to-peer-nft-marketplace)

No. The plugin could be only used to sell the NFT created by Admin to the customers.
= Can I sell my existing NFTs on my e-shop using NFT Maker? =
No, again, NFT Maker can only be used to sell NFTs created with the plugin.
For a complete guide on how to build the backend to an NFT marketplace from scratch, please refer to Tatum’s How to build [NFT marketplaces part 2 - Backend guide.](https://blog.tatum.io/how-to-build-nft-marketplaces-part-2-backend-899f7d804066)

== Screenshots ==
1. Create an account in the [Tatum Dashboard](https://dashboard.tatum.io/login) and obtain paid API key.
Expand Down Expand Up @@ -87,6 +107,9 @@ No. The plugin could be only used to sell the NFT created by Admin to the custom
= 2.0.11 =
* Fixed Safari date bug

= 2.0.12 =
* Fixed error with changing blockchain of NFT & Added videos & FAQ

== Upgrade Notice ==

= 1.0.0 =
Expand Down
25 changes: 16 additions & 9 deletions inc/Activator.php
Expand Up @@ -40,18 +40,25 @@ public function deactivate() {
* @param boolean $errorlevel If true throw errors
*/
public function dbDelta($errorlevel) {
// TODO: remove tatum options from DB
// Your table installation here...
/*$table_name = $this->getTableName();
$sql = "CREATE TABLE $table_name (
id mediumint(9) NOT NULL AUTO_INCREMENT,
UNIQUE KEY id (id)
) $charset_collate;";
dbDelta( $sql );
global $wpdb;

$lazy_nft_name = $this->getTableName("lazy_nft");
$prepared_nft_name = $this->getTableName("prepared_nft");
$sql = "ALTER TABLE $lazy_nft_name ADD COLUMN chain ENUM('CELO', 'ETH', 'BSC', 'ONE', 'MATIC');";
$wpdb->query($sql);

$sql = "SELECT * FROM $prepared_nft_name;";

$prepared_nfts = $wpdb->get_results($sql);

foreach ($prepared_nfts as $prepared_nft) {
$sql = "UPDATE $lazy_nft_name SET chain = '" . $prepared_nft->chain . "' WHERE prepared_nft_id = " . $prepared_nft->id . ";";
$wpdb->query($sql);
}

if ($errorlevel) {
$wpdb->print_error();
}*/
}
}

private function initDatabase() {
Expand Down
2 changes: 1 addition & 1 deletion inc/base/others/cachebuster-lib.php
@@ -1,5 +1,5 @@
<?php
/* This file was automatically generated by the `grunt libs:cachebuster` command (Sun Nov 14 2021 20:15:09 GMT+0000 (Coordinated Universal Time)). */
/* This file was automatically generated by the `grunt libs:cachebuster` command (Tue Nov 23 2021 18:54:55 GMT+0000 (Coordinated Universal Time)). */
return array(
'mobx' => '4.15.4',
'react' => '17.0.2',
Expand Down
8 changes: 4 additions & 4 deletions inc/base/others/cachebuster.php
@@ -1,10 +1,10 @@
<?php
/* This file was automatically generated by the `grunt libs:cachebuster` command (Sun Nov 14 2021 20:15:09 GMT+0000 (Coordinated Universal Time)). */
/* This file was automatically generated by the `grunt libs:cachebuster` command (Tue Nov 23 2021 18:54:55 GMT+0000 (Coordinated Universal Time)). */
return array(
'src/public/dist/admin.js' => '303d41e0b74eadbfdd45c9c63ee2f2d3',
'src/public/dist/vendor-admin.js' => 'cf7bcffd2127b22b8e586ad7991b134e',
'src/public/dist/admin.js' => '8b4434a06c26f543c93c6cd61acbbdcb',
'src/public/dist/vendor-admin.js' => '544a5b292e9bff3de00321a3d11b0984',
'src/public/dist/vendor-widget.js' => '9e3cdc863b954ff97d9e44bdb8f0384a',
'src/public/dist/widget.js' => '55dc633ed835f64258416aab9b31c9dc',
'src/public/dist/admin.css' => 'c8c6de5a905a89565b1e5b9c39b79a13',
'src/public/dist/admin.css' => '171a52746ca0ae79e591dd7535306dc5',
'src/public/dist/widget.css' => '1479e83e34ea80c5596ab0fa32dfa6e5',
);
7 changes: 6 additions & 1 deletion inc/hooks/Admin.php
Expand Up @@ -111,7 +111,12 @@ public function productSave($product_id) {
// run your code here!
if (isset($_POST['tatum_chain'])) {
$this->lazyMint->deletePrepared($product_id);
$this->lazyMint->insertPrepared($product_id, $_POST['tatum_chain']);

if (empty($this->lazyMint->getPreparedByProduct($product_id))) {
$this->lazyMint->insertPrepared($product_id, $_POST['tatum_chain']);
} else {
$this->lazyMint->updatePrepared($product_id, $_POST['tatum_chain']);
}
}
}
set_transient($updating_product_id, $product_id, 2); // change 2 seconds if not enough
Expand Down
15 changes: 7 additions & 8 deletions inc/hooks/PublicHooks.php
Expand Up @@ -90,23 +90,22 @@ private function mintProduct($product_id, $order_id, $api_key, $url) {
$recipient_address = get_post_meta($order_id, 'recipient_blockchain_address_' . $preparedNft->chain, true);

if ($recipient_address) {
$transfer_body = array('to' => $recipient_address, 'chain' => $preparedNft->chain, 'url' => "ipfs://$url");
$mint_body = array('to' => $recipient_address, 'chain' => $preparedNft->chain, 'url' => "ipfs://$url");
if ($preparedNft->chain === 'CELO') {
$transfer_body['feeCurrency'] = 'CELO';
$mint_body['feeCurrency'] = 'CELO';
}
$response = Connector::mint_nft($transfer_body, $api_key);

$response = Connector::mint_nft($mint_body, $api_key);
if (isset($response['txId'])) {
$this->lazyMint->insertLazyNft($preparedNft->id, $order_id, $recipient_address, $response['txId']);
$this->lazyMint->insertLazyNft($preparedNft->id, $order_id, $recipient_address, $preparedNft->chain, $response['txId']);
} else {
$this->resolveNftError($product_id, $order_id, 'Cannot mint NFT. Check recipient address or contact support.', $recipient_address);
$this->resolveNftError($product_id, $order_id, $preparedNft->chain, 'Cannot mint NFT. Check recipient address or contact support.', $recipient_address);
}
}
}
}

private function resolveNftError($order_id, $error_message, $preparedNft, $recipient_address) {
$this->lazyMint->insertLazyNft($preparedNft->id, $order_id, $recipient_address, null, $error_message);
private function resolveNftError($order_id, $error_message, $chain, $preparedNft, $recipient_address) {
$this->lazyMint->insertLazyNft($preparedNft->id, $order_id, $recipient_address, $chain, null, $error_message);
}

public function updateThankYouPage($thank_you_title, $order) {
Expand Down
11 changes: 8 additions & 3 deletions inc/tatum/LazyMint.php
Expand Up @@ -26,13 +26,18 @@ public function insertPrepared($productId, $chain) {
$this->wpdb->insert($this->preparedNft, array('product_id' => $productId, 'chain' => $chain));
}

public function insertLazyNft($preparedId, $orderId, $recipientAddress, $transactionId = null, $errorCause = null) {
public function updatePrepared($productId, $chain) {
$this->wpdb->update($this->preparedNft, array('chain' => $chain), array('product_id' => $productId));
}

public function insertLazyNft($preparedId, $orderId, $recipientAddress, $chain, $transactionId = null, $errorCause = null) {
$this->wpdb->insert($this->lazyNft, array(
'prepared_nft_id' => $preparedId,
'order_id' => $orderId,
'transaction_id' => $transactionId,
'error_cause' => $errorCause,
'recipient_address' => $recipientAddress
'recipient_address' => $recipientAddress,
'chain' => $chain
));
}

Expand Down Expand Up @@ -74,7 +79,7 @@ public function getPrepared() {
}

public function getMinted() {
$nfts = $this->wpdb->get_results("SELECT * FROM $this->lazyNft INNER JOIN $this->preparedNft ON $this->lazyNft.prepared_nft_id = $this->preparedNft.id;");
$nfts = $this->wpdb->get_results("SELECT * FROM $this->preparedNft INNER JOIN $this->lazyNft ON $this->lazyNft.prepared_nft_id = $this->preparedNft.id;");
return self::formatMintedNfts($nfts);
}

Expand Down
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -8,7 +8,7 @@
* Description: NFT Maker is the easiest and fastest free plugin to work with NFTs without any blockchain development experience.
* Author: Tatum
* Author URI: https://tatum.io
* Version: 2.0.11
* Version: 2.0.12
* Text Domain: tatum
* Domain Path: /languages
* License: MIT
Expand Down
2 changes: 1 addition & 1 deletion languages/tatum.pot
Expand Up @@ -2,7 +2,7 @@
# This file is distributed under the MIT.
msgid ""
msgstr ""
"Project-Id-Version: NFT Maker 2.0.8\n"
"Project-Id-Version: NFT Maker 2.0.12\n"
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/src\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down
2 changes: 1 addition & 1 deletion public/dist/admin.css

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

2 changes: 1 addition & 1 deletion public/dist/admin.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/dist/admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/dist/admin.js.map

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions public/dist/vendor-admin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/dist/vendor-admin.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion vendor/autoload.php
Expand Up @@ -4,4 +4,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInit9cc9c21ad052306750030a742100409b::getLoader();
return ComposerAutoloaderInit3b439705bf37abb72a44ac29eb6f17c9::getLoader();
8 changes: 4 additions & 4 deletions vendor/composer/autoload_real.php
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInit9cc9c21ad052306750030a742100409b
class ComposerAutoloaderInit3b439705bf37abb72a44ac29eb6f17c9
{
private static $loader;

Expand All @@ -24,15 +24,15 @@ public static function getLoader()

require __DIR__ . '/platform_check.php';

spl_autoload_register(array('ComposerAutoloaderInit9cc9c21ad052306750030a742100409b', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit3b439705bf37abb72a44ac29eb6f17c9', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInit9cc9c21ad052306750030a742100409b', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit3b439705bf37abb72a44ac29eb6f17c9', 'loadClassLoader'));

$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
if ($useStaticLoader) {
require __DIR__ . '/autoload_static.php';

call_user_func(\Composer\Autoload\ComposerStaticInit9cc9c21ad052306750030a742100409b::getInitializer($loader));
call_user_func(\Composer\Autoload\ComposerStaticInit3b439705bf37abb72a44ac29eb6f17c9::getInitializer($loader));
} else {
$classMap = require __DIR__ . '/autoload_classmap.php';
if ($classMap) {
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInit9cc9c21ad052306750030a742100409b
class ComposerStaticInit3b439705bf37abb72a44ac29eb6f17c9
{
public static $prefixLengthsPsr4 = array (
'k' =>
Expand Down Expand Up @@ -70,9 +70,9 @@ class ComposerStaticInit9cc9c21ad052306750030a742100409b
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit9cc9c21ad052306750030a742100409b::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit9cc9c21ad052306750030a742100409b::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit9cc9c21ad052306750030a742100409b::$classMap;
$loader->prefixLengthsPsr4 = ComposerStaticInit3b439705bf37abb72a44ac29eb6f17c9::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit3b439705bf37abb72a44ac29eb6f17c9::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit3b439705bf37abb72a44ac29eb6f17c9::$classMap;

}, null, ClassLoader::class);
}
Expand Down
4 changes: 2 additions & 2 deletions vendor/composer/installed.php
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '463ea819e5af8af565c9add0eca3b9e94efc79fe',
'reference' => 'b03101d9bbbdb40cfc91f0560e5b9ea7036f3ee6',
'name' => '__root__',
'dev' => false,
),
Expand All @@ -16,7 +16,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
'reference' => '463ea819e5af8af565c9add0eca3b9e94efc79fe',
'reference' => 'b03101d9bbbdb40cfc91f0560e5b9ea7036f3ee6',
'dev_requirement' => false,
),
'kornrunner/keccak' => array(
Expand Down

0 comments on commit 6c37320

Please sign in to comment.