Skip to content

Commit

Permalink
fix raising error
Browse files Browse the repository at this point in the history
  • Loading branch information
0xNe0x1 committed Mar 19, 2024
1 parent 0ca9195 commit 7a87576
Show file tree
Hide file tree
Showing 15 changed files with 75 additions and 51 deletions.
2 changes: 1 addition & 1 deletion dist/esm/index.bundle.js

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/esm/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29498,14 +29498,22 @@ var preflight$1 = /*#__PURE__*/function () {
case 0:
accept = _ref.accept, recover = _ref.recover, integration = _ref.integration;

if (!(integration || recover)) {
if (!(typeof integration !== 'undefined' && typeof accept !== 'undefined')) {
_context.next = 3;
break;
}

return _context.abrupt("return");
throw 'You can either use `integration` or `accept`, but not both!';

case 3:
if (!(integration || recover)) {
_context.next = 5;
break;
}

return _context.abrupt("return");

case 5:
accept.forEach(function (configuration) {
if (typeof configuration.blockchain === 'undefined') {
throw 'You need to set the blockchain you want to receive the payment on!';
Expand All @@ -29526,13 +29534,9 @@ var preflight$1 = /*#__PURE__*/function () {
if (typeof configuration.receiver === 'undefined') {
throw 'You need to set the receiver address that you want to receive the payment!';
}

if (typeof configuration.integration !== 'undefined' && typeof configuration.accept !== 'undefined') {
throw 'You can either use `integration` or `accept`, but not both!';
}
});

case 4:
case 6:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.evm.js.map

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30928,14 +30928,22 @@ var preflight$1 = /*#__PURE__*/function () {
case 0:
accept = _ref.accept, recover = _ref.recover, integration = _ref.integration;

if (!(integration || recover)) {
if (!(typeof integration !== 'undefined' && typeof accept !== 'undefined')) {
_context.next = 3;
break;
}

return _context.abrupt("return");
throw 'You can either use `integration` or `accept`, but not both!';

case 3:
if (!(integration || recover)) {
_context.next = 5;
break;
}

return _context.abrupt("return");

case 5:
accept.forEach(function (configuration) {
if (typeof configuration.blockchain === 'undefined') {
throw 'You need to set the blockchain you want to receive the payment on!';
Expand All @@ -30956,13 +30964,9 @@ var preflight$1 = /*#__PURE__*/function () {
if (typeof configuration.receiver === 'undefined') {
throw 'You need to set the receiver address that you want to receive the payment!';
}

if (typeof configuration.integration !== 'undefined' && typeof configuration.accept !== 'undefined') {
throw 'You can either use `integration` or `accept`, but not both!';
}
});

case 4:
case 6:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.js.map

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/esm/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -38531,14 +38531,22 @@ var preflight$1 = /*#__PURE__*/function () {
case 0:
accept = _ref.accept, recover = _ref.recover, integration = _ref.integration;

if (!(integration || recover)) {
if (!(typeof integration !== 'undefined' && typeof accept !== 'undefined')) {
_context.next = 3;
break;
}

return _context.abrupt("return");
throw 'You can either use `integration` or `accept`, but not both!';

case 3:
if (!(integration || recover)) {
_context.next = 5;
break;
}

return _context.abrupt("return");

case 5:
accept.forEach(function (configuration) {
if (typeof configuration.blockchain === 'undefined') {
throw 'You need to set the blockchain you want to receive the payment on!';
Expand All @@ -38559,13 +38567,9 @@ var preflight$1 = /*#__PURE__*/function () {
if (typeof configuration.receiver === 'undefined') {
throw 'You need to set the receiver address that you want to receive the payment!';
}

if (typeof configuration.integration !== 'undefined' && typeof configuration.accept !== 'undefined') {
throw 'You can either use `integration` or `accept`, but not both!';
}
});

case 4:
case 6:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/esm/index.solana.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/umd/index.bundle.js

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/umd/index.evm.js
Original file line number Diff line number Diff line change
Expand Up @@ -29496,14 +29496,22 @@
case 0:
accept = _ref.accept, recover = _ref.recover, integration = _ref.integration;

if (!(integration || recover)) {
if (!(typeof integration !== 'undefined' && typeof accept !== 'undefined')) {
_context.next = 3;
break;
}

return _context.abrupt("return");
throw 'You can either use `integration` or `accept`, but not both!';

case 3:
if (!(integration || recover)) {
_context.next = 5;
break;
}

return _context.abrupt("return");

case 5:
accept.forEach(function (configuration) {
if (typeof configuration.blockchain === 'undefined') {
throw 'You need to set the blockchain you want to receive the payment on!';
Expand All @@ -29524,13 +29532,9 @@
if (typeof configuration.receiver === 'undefined') {
throw 'You need to set the receiver address that you want to receive the payment!';
}

if (typeof configuration.integration !== 'undefined' && typeof configuration.accept !== 'undefined') {
throw 'You can either use `integration` or `accept`, but not both!';
}
});

case 4:
case 6:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.evm.js.map

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/umd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30924,14 +30924,22 @@
case 0:
accept = _ref.accept, recover = _ref.recover, integration = _ref.integration;

if (!(integration || recover)) {
if (!(typeof integration !== 'undefined' && typeof accept !== 'undefined')) {
_context.next = 3;
break;
}

return _context.abrupt("return");
throw 'You can either use `integration` or `accept`, but not both!';

case 3:
if (!(integration || recover)) {
_context.next = 5;
break;
}

return _context.abrupt("return");

case 5:
accept.forEach(function (configuration) {
if (typeof configuration.blockchain === 'undefined') {
throw 'You need to set the blockchain you want to receive the payment on!';
Expand All @@ -30952,13 +30960,9 @@
if (typeof configuration.receiver === 'undefined') {
throw 'You need to set the receiver address that you want to receive the payment!';
}

if (typeof configuration.integration !== 'undefined' && typeof configuration.accept !== 'undefined') {
throw 'You can either use `integration` or `accept`, but not both!';
}
});

case 4:
case 6:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.js.map

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions dist/umd/index.solana.js
Original file line number Diff line number Diff line change
Expand Up @@ -38529,14 +38529,22 @@
case 0:
accept = _ref.accept, recover = _ref.recover, integration = _ref.integration;

if (!(integration || recover)) {
if (!(typeof integration !== 'undefined' && typeof accept !== 'undefined')) {
_context.next = 3;
break;
}

return _context.abrupt("return");
throw 'You can either use `integration` or `accept`, but not both!';

case 3:
if (!(integration || recover)) {
_context.next = 5;
break;
}

return _context.abrupt("return");

case 5:
accept.forEach(function (configuration) {
if (typeof configuration.blockchain === 'undefined') {
throw 'You need to set the blockchain you want to receive the payment on!';
Expand All @@ -38557,13 +38565,9 @@
if (typeof configuration.receiver === 'undefined') {
throw 'You need to set the receiver address that you want to receive the payment!';
}

if (typeof configuration.integration !== 'undefined' && typeof configuration.accept !== 'undefined') {
throw 'You can either use `integration` or `accept`, but not both!';
}
});

case 4:
case 6:
case "end":
return _context.stop();
}
Expand Down
2 changes: 1 addition & 1 deletion dist/umd/index.solana.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Payment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import WalletProvider from './providers/WalletProvider'
import { supported } from './blockchains'

let preflight = async({ accept, recover, integration }) => {
if(typeof integration !== 'undefined' && typeof accept !== 'undefined') { throw('You can either use `integration` or `accept`, but not both!') }
if(integration || recover){ return }
accept.forEach((configuration)=>{
if(typeof configuration.blockchain === 'undefined') { throw('You need to set the blockchain you want to receive the payment on!') }
if(!supported.includes(configuration.blockchain)) { throw('You need to set a supported blockchain!') }
if(typeof configuration.token === 'undefined' && typeof configuration.fromToken === 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') { throw('You need to set the token you want to receive as payment!') }
if(typeof configuration.token === 'undefined' && typeof configuration.fromToken !== 'undefined' && typeof configuration.fromAmount === 'undefined' && typeof configuration.toToken === 'undefined') { throw('You need to set the fromToken, fromAmount and toToken!') }
if(typeof configuration.receiver === 'undefined') { throw('You need to set the receiver address that you want to receive the payment!') }
if(typeof configuration.integration !== 'undefined' && typeof configuration.accept !== 'undefined') { throw('You can either use `integration` or `accept`, but not both!') }
})
}

Expand Down

0 comments on commit 7a87576

Please sign in to comment.