Skip to content

Commit

Permalink
Merge pull request #9 from BitCannaGlobal/v1.0.20
Browse files Browse the repository at this point in the history
Update 1.0.20
  • Loading branch information
atmoner committed Nov 20, 2023
2 parents 75fda33 + 7c674bb commit 2f075bd
Show file tree
Hide file tree
Showing 9 changed files with 5,979 additions and 155 deletions.
5 changes: 5 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ For our FAQ we'd like to refer you to our [documentation website](https://docs.b
5. After just a couple seconds, the payment will be performed and you can view your transaction.

== Changelog ==
= 1.0.20 =
* Update webpack version from v4 to v5
* Update cosmJs from 0.23.0 to 0.31.3
* Fix bitcanna logo path

= 1.0.19 =
* Fix array_search() method in admin panel

Expand Down
2 changes: 1 addition & 1 deletion cosmos-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'COSMOS_WOOCOMMERCE_VERSION', '1.0.19' );
define( 'COSMOS_WOOCOMMERCE_VERSION', '1.0.20' );



Expand Down
5,909 changes: 5,889 additions & 20 deletions public/js/bundle.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cosmos pay sources
# 🚀 Cosmos pay sources

This repository is reserved for compiler sources of the Cosmos Pay WooCommerce plugin

Expand All @@ -12,3 +12,4 @@ Compile
webpack

The source to include in the plugin is in `build/bundle.js`

100 changes: 19 additions & 81 deletions public/js/bundle.js.source/index.html
Original file line number Diff line number Diff line change
@@ -1,88 +1,26 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>
Keplr example
</title>


<meta charset="utf-8" />
<title>Webpack App</title>
</head>
<body>
<div id="app">
<div class="container-sm">
<br /> <br />
<!--<div id="address"></div>-->
<div id="returnResult"></div>

<form name="sendForm">
<div class="row">
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">Your Address</h5>
<p class="card-text"><div id="address"></div></p>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="card">
<div class="card-body">
<h5 class="card-title">Amount: $<span id="getAmount">1.5</span></h5>
<p class="card-text"><div id="finalAmount"></div></p>
</div>
</div>
</div>
</div>
<br />

<div class="btn-group-toggle" data-toggle="buttons" id="listChains">
<!--<label class="btn btn-secondary active">
<input type="radio" id="atom" value="Cosmoshub" name="get_chain" checked> Atom
</label>-->
<label class="btn btn-secondary active">
<input type="radio" id="BitCanna" value="BitCanna" name="get_chain" checked> Bitcanna
</label>
<label class="btn btn-secondary active">
<input type="radio" id="Chihuahua" value="Chihuahua" name="get_chain" checked> Chihuahua
</label>
<label class="btn btn-secondary active">
<input type="radio" id="Akash" value="Akash" name="get_chain" checked> Akash
</label>
</div>

<br />
<!-- <input type="radio" id="atom" value="atom" name="get_chain">
<label for="atom">Atom</label><br>
<input type="radio" id="bitcanna" value="bitcanna" name="get_chain">
<label for="bitcanna">Bitcanna</label><br>
<input type="radio" id="chihuahua" value="chihuahua" name="get_chain">
<label for="chihuahua">Chihuahua</label>
-->
<div class="form-group">
<label for="recipient">Recipient</label>
<input class="form-control" id="inputAddress" name="recipient">
</div>
<div class="form-group">
<label for="amount">Amount</label>
<div class="input-group">
<input class="form-control" id="inputAmount" name="amount">
<div class="input-group-append">
<div class="input-group-text" id="viewDenom">ATOM</div>
</div>
</div>
</div>
<input class="form-control" id="order_id" name="order_id" value="1" type="hidden">
<input class="form-control" id="memo" name="memo" value="sdfghs" type="hidden">
<button type="submit" class="btn btn-secondary ">Submit</button>
</form>
</div>
</div>
<h1>Hello world!</h1>
<h2>Tip: Check your console</h2>
</body>
<script>

console.log(exportCosmosConfig)

</script>
<script>
if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker
.register("service-worker.js")
.then((registration) => {
console.log("Service Worker registered: ", registration);
})
.catch((registrationError) => {
console.error("Service Worker registration failed: ", registrationError);
});
});
}
</script>
</html>
31 changes: 16 additions & 15 deletions public/js/bundle.js.source/package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
{
"name": "cosmos-pay-source",
"version": "1.0.1",
"version": "1.0.2",
"description": "",
"main": "index.js",
"name": "cosmos-pay-source",
"scripts": {
"dev": "webpack-dev-server"
"build": "webpack --mode=production --node-env=production",
"build:dev": "webpack --mode=development",
"build:prod": "webpack --mode=production --node-env=production",
"watch": "webpack --watch",
"serve": "webpack serve"
},
"keywords": [],
"author": "BitCanna",
"license": "ISC",
"devDependencies": {
"html-webpack-plugin": "^4.3.0",
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.11.0"
"html-webpack-plugin": "^5.5.3",
"prettier": "^3.1.0",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1",
"workbox-webpack-plugin": "^7.0.0"
},
"dependencies": {
"@chainapsis/cosmosjs": "0.0.3-alpha.3",
"@cosmjs/launchpad": "^0.23.0",
"@cosmjs/proto-signing": "^0.26.5",
"@cosmjs/stargate": "^0.26.5",
"@cosmjs/proto-signing": "^0.31.3",
"@cosmjs/stargate": "^0.31.3",
"axios": "^0.19.0",
"fast-deep-equal": "^3.1.1",
"jquery": "^3.6.0"
"jquery": "^3.7.1"
}
}
6 changes: 3 additions & 3 deletions public/js/bundle.js.source/src/initsend.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
const initConfig = require('./remote.config');
const {
SigningCosmosClient
} = require("@cosmjs/launchpad");
const {
assertIsBroadcastTxSuccess,
SigningStargateClient,
Expand Down Expand Up @@ -64,6 +61,9 @@ exports.sendByChain = async function(getChainId, recipient, amount, orderId, mem
$("#AcceptedTx").show();
$("#returnResult").html( result.transactionHash );

// Prestashop
// var returnUrl = '/index.php?fc=module&module=cosmospay&controller=validation&check&tx_hash='+result.transactionHash
// Woocomerce
var returnUrl = '/api-cosmos/?tx_hash='+result.transactionHash+'&order_id='+orderId

axios.get(returnUrl)
Expand Down
22 changes: 1 addition & 21 deletions public/js/bundle.js.source/src/main.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,11 @@
const {
SigningCosmosClient
} = require("@cosmjs/launchpad");

import {
DirectSecp256k1HdWallet
} from '@cosmjs/proto-signing'
import {
assertIsBroadcastTxSuccess,
SigningStargateClient,
} from '@cosmjs/stargate'
import initConfig from './remote.config'
import initKeplr from './addkeplr'
import initsend from './initsend'
import $ from 'jquery';
window.jQuery = $;
window.$ = $;

jQuery.fn.load = function(callback){ $(window).on("load", callback) };


async function updateUi(data) {
Expand All @@ -26,16 +16,6 @@ async function updateUi(data) {


$(document).ready(function () {
//console.log(cosmosConfig)
/* cosmosConfig.forEach(function(item){
$('#listChains')
.append(`<label class="btn btn-secondary active">
<input type="radio" id="${item.name}" name="get_chain" value="${item.name}" checked>
${item.name}</label>`)
}); */

var keplrData = ''
$('input[name="get_chain"]').click(function () {
if ($(this).is(':checked')) {
Expand Down
56 changes: 43 additions & 13 deletions public/js/bundle.js.source/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,57 @@
const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
// Generated using webpack-cli https://github.com/webpack/webpack-cli
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WorkboxWebpackPlugin = require('workbox-webpack-plugin');

module.exports = {
entry: {
main: "./src/main.js",
},
const isProduction = process.env.NODE_ENV == 'production';

const config = {
entry: './src/main.js',
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
library: 'exportCosmosConfig',
path: path.resolve(__dirname, 'dist'),
library: 'exportCosmosConfig',
libraryExport: "default" ,
libraryTarget: 'umd'
},
devServer: {
port: 8081
},
open: true,
host: 'localhost',
},
plugins: [
new HtmlWebpackPlugin({
template: "index.html",
chunks: ["main"]
})
template: 'index.html',
}),
],
externals: {
jquery: 'jQuery'
},
module: {
rules: [
{
test: /\.(eot|svg|ttf|woff|woff2|png|jpg|gif)$/i,
type: 'asset',
},
],
},
resolve: {
fallback: {
buffer: false,
crypto: false,
events: false,
path: false,
stream: false,
string_decoder: false,
},
},
};

module.exports = () => {
if (isProduction) {
config.mode = 'production';
config.plugins.push(new WorkboxWebpackPlugin.GenerateSW());
} else {
config.mode = 'development';
}
return config;
};

0 comments on commit 2f075bd

Please sign in to comment.