@coinflowlabs/react 0.1.0 → 0.2.0

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.
package/README.md CHANGED
@@ -33,3 +33,4 @@ Props:
33
33
  * `env` (optional): This defaults to `prod`
34
34
  - For testing set to `staging`
35
35
  * `onSuccess` (optional): function to run when the purchase process is successful
36
+ * `transaction` (optional): transaction for the user to run which redeems their credits with your smart contract. Create this transaction just like you would for a normal user who has USDC in their account.
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
+ import { Transaction } from '@solana/web3.js';
2
3
  export type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';
3
4
  type CoinflowIFrameProps = {
4
5
  publicKey: string;
5
6
  IFrameRef: React.RefObject<HTMLIFrameElement>;
6
7
  env?: CoinflowEnvs;
7
8
  route: string;
9
+ transaction?: Transaction;
10
+ amount?: number;
8
11
  };
9
- declare function CoinflowIFrame({ publicKey, IFrameRef, env, route, }: CoinflowIFrameProps): JSX.Element;
10
- export declare const CoinflowIframe: React.MemoExoticComponent<typeof CoinflowIFrame>;
12
+ export declare function CoinflowIFrame({ publicKey, IFrameRef, env, route, transaction, amount, }: CoinflowIFrameProps): JSX.Element;
11
13
  export {};
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  exports.__esModule = true;
3
- exports.CoinflowIframe = void 0;
3
+ exports.CoinflowIFrame = void 0;
4
4
  var tslib_1 = require("tslib");
5
- var react_1 = tslib_1.__importDefault(require("react"));
5
+ var react_1 = tslib_1.__importStar(require("react"));
6
+ var bs58_1 = tslib_1.__importDefault(require("bs58"));
6
7
  function getCoinflowUrl(env) {
7
8
  if (!env || env === 'prod')
8
9
  return 'https://coinflow.cash';
@@ -11,13 +12,27 @@ function getCoinflowUrl(env) {
11
12
  return "https://".concat(env, ".coinflow.cash");
12
13
  }
13
14
  function CoinflowIFrame(_a) {
14
- var publicKey = _a.publicKey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route;
15
- var url = new URL(route, getCoinflowUrl(env));
16
- url.searchParams.append('pubkey', publicKey);
17
- return (react_1["default"].createElement("iframe", { ref: IFrameRef, style: {
15
+ var publicKey = _a.publicKey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route, transaction = _a.transaction, amount = _a.amount;
16
+ var url = (0, react_1.useMemo)(function () {
17
+ var url = new URL(route, getCoinflowUrl(env));
18
+ url.searchParams.append('pubkey', publicKey);
19
+ if (transaction) {
20
+ var serializedTx = bs58_1["default"].encode(transaction.serialize({
21
+ requireAllSignatures: false,
22
+ verifySignatures: false
23
+ }));
24
+ url.searchParams.append('transaction', serializedTx);
25
+ }
26
+ if (amount) {
27
+ url.searchParams.append('amount', amount.toString());
28
+ }
29
+ console.log({ url: url });
30
+ return url;
31
+ }, [amount, env, publicKey, route, transaction]);
32
+ return (0, react_1.useMemo)(function () { return (react_1["default"].createElement("iframe", { ref: IFrameRef, style: {
18
33
  width: '100%',
19
34
  height: '100%'
20
- }, title: "withdraw", frameBorder: "0", src: url.toString() }));
35
+ }, title: "withdraw", frameBorder: "0", src: url.toString() })); }, [IFrameRef, url]);
21
36
  }
22
- exports.CoinflowIframe = react_1["default"].memo(CoinflowIFrame);
37
+ exports.CoinflowIFrame = CoinflowIFrame;
23
38
  //# sourceMappingURL=CoinflowIFrame.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":";;;;AAAA,wDAA0B;AAW1B,SAAS,cAAc,CAAC,GAAkB;IACxC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,uBAAuB,CAAC;IAC3D,IAAI,GAAG,KAAK,OAAO;QAAE,OAAO,uBAAuB,CAAC;IAEpD,OAAO,kBAAW,GAAG,mBAAgB,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,EAKF;QAJpB,SAAS,eAAA,EACT,SAAS,eAAA,EACT,GAAG,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AW,CAAC,SAAS,CAAC;gBACpB,oBAAoB,EAAE,KAAK;gBAC3B,gBAAgB,EAAE,KAAK;aACxB,CAAC,CACH,CAAC;YACF,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;SACtD;QACD,IAAI,MAAM,EAAE;YACV,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;SACtD;QACD,OAAO,CAAC,GAAG,CAAC,EAAC,GAAG,KAAA,EAAC,CAAC,CAAC;QACnB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAEjD,OAAO,IAAA,eAAO,EACZ,cAAM,OAAA,CACJ,6CACE,GAAG,EAAE,SAAS,EACd,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;SACf,EACD,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,GAAG,EACf,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,GACnB,CACH,EAXK,CAWL,EACD,CAAC,SAAS,EAAE,GAAG,CAAC,CACjB,CAAC;AACJ,CAAC;AA1CD,wCA0CC"}
@@ -1,14 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import { WalletContextState } from '@solana/wallet-adapter-react';
3
- import { Connection } from '@solana/web3.js';
3
+ import { Connection, Transaction } from '@solana/web3.js';
4
4
  import { CoinflowEnvs } from './CoinflowIFrame';
5
5
  import { OnSuccessMethod } from './IFrameWalletConnector';
6
6
  type Props = {
7
7
  wallet: WalletContextState;
8
8
  merchantId: string;
9
9
  connection: Connection;
10
+ amount?: number;
10
11
  env?: CoinflowEnvs;
11
12
  onSuccess?: OnSuccessMethod;
13
+ transaction?: Transaction;
12
14
  };
13
- export declare function CoinflowPurchase({ wallet, merchantId, env, connection, onSuccess, }: Props): JSX.Element | null;
15
+ export declare function CoinflowPurchase({ wallet, merchantId, env, connection, onSuccess, transaction, amount, }: Props): JSX.Element | null;
14
16
  export {};
@@ -6,11 +6,11 @@ var react_1 = tslib_1.__importDefault(require("react"));
6
6
  var CoinflowIFrame_1 = require("./CoinflowIFrame");
7
7
  var IFrameWalletConnector_1 = require("./IFrameWalletConnector");
8
8
  function CoinflowPurchase(_a) {
9
- var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, connection = _a.connection, onSuccess = _a.onSuccess;
9
+ var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, connection = _a.connection, onSuccess = _a.onSuccess, transaction = _a.transaction, amount = _a.amount;
10
10
  var IFrameRef = (0, IFrameWalletConnector_1.useIframeWallet)({ wallet: wallet, connection: connection, onSuccess: onSuccess }).IFrameRef;
11
11
  if (!wallet.publicKey || !wallet.connected)
12
12
  return null;
13
- return (react_1["default"].createElement(CoinflowIFrame_1.CoinflowIframe, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env }));
13
+ return (react_1["default"].createElement(CoinflowIFrame_1.CoinflowIFrame, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env, transaction: transaction, amount: amount }));
14
14
  }
15
15
  exports.CoinflowPurchase = CoinflowPurchase;
16
16
  //# sourceMappingURL=CoinflowPurchase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";;;;AACA,wDAA0B;AAE1B,mDAA8D;AAC9D,iEAAyE;AAUzE,SAAgB,gBAAgB,CAAC,EAMzB;QALN,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,GAAG,SAAA,EACH,UAAU,gBAAA,EACV,SAAS,eAAA;IAEF,IAAA,SAAS,GAAI,IAAA,uCAAe,EAAC,EAAC,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,SAAS,WAAA,EAAC,CAAC,UAApD,CAAqD;IAErE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAExD,OAAO,CACL,iCAAC,+BAAc,IACb,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EACtC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,oBAAa,UAAU,CAAE,EAChC,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC;AAnBD,4CAmBC"}
1
+ {"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":";;;;AACA,wDAA0B;AAE1B,mDAA8D;AAC9D,iEAAyE;AAYzE,SAAgB,gBAAgB,CAAC,EAQzB;QAPN,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,GAAG,SAAA,EACH,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,MAAM,YAAA;IAEC,IAAA,SAAS,GAAI,IAAA,uCAAe,EAAC,EAAC,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,SAAS,WAAA,EAAC,CAAC,UAApD,CAAqD;IAErE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAExD,OAAO,CACL,iCAAC,+BAAc,IACb,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EACtC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,oBAAa,UAAU,CAAE,EAChC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC;AAvBD,4CAuBC"}
@@ -10,7 +10,7 @@ function CoinflowWithdraw(_a) {
10
10
  var IFrameRef = (0, IFrameWalletConnector_1.useIframeWallet)({ wallet: wallet, connection: connection, onSuccess: onSuccess }).IFrameRef;
11
11
  if (!wallet.publicKey || !wallet.connected)
12
12
  return null;
13
- return (react_1["default"].createElement(CoinflowIFrame_1.CoinflowIframe, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env }));
13
+ return (react_1["default"].createElement(CoinflowIFrame_1.CoinflowIFrame, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env }));
14
14
  }
15
15
  exports.CoinflowWithdraw = CoinflowWithdraw;
16
16
  //# sourceMappingURL=CoinflowWithdraw.js.map
@@ -1,11 +1,13 @@
1
1
  import React from 'react';
2
+ import { Transaction } from '@solana/web3.js';
2
3
  export type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';
3
4
  type CoinflowIFrameProps = {
4
5
  publicKey: string;
5
6
  IFrameRef: React.RefObject<HTMLIFrameElement>;
6
7
  env?: CoinflowEnvs;
7
8
  route: string;
9
+ transaction?: Transaction;
10
+ amount?: number;
8
11
  };
9
- declare function CoinflowIFrame({ publicKey, IFrameRef, env, route, }: CoinflowIFrameProps): JSX.Element;
10
- export declare const CoinflowIframe: React.MemoExoticComponent<typeof CoinflowIFrame>;
12
+ export declare function CoinflowIFrame({ publicKey, IFrameRef, env, route, transaction, amount, }: CoinflowIFrameProps): JSX.Element;
11
13
  export {};
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
+ import base58 from 'bs58';
2
3
  function getCoinflowUrl(env) {
3
4
  if (!env || env === 'prod')
4
5
  return 'https://coinflow.cash';
@@ -6,14 +7,27 @@ function getCoinflowUrl(env) {
6
7
  return 'http://localhost:3000';
7
8
  return "https://".concat(env, ".coinflow.cash");
8
9
  }
9
- function CoinflowIFrame(_a) {
10
- var publicKey = _a.publicKey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route;
11
- var url = new URL(route, getCoinflowUrl(env));
12
- url.searchParams.append('pubkey', publicKey);
13
- return (React.createElement("iframe", { ref: IFrameRef, style: {
10
+ export function CoinflowIFrame(_a) {
11
+ var publicKey = _a.publicKey, IFrameRef = _a.IFrameRef, env = _a.env, route = _a.route, transaction = _a.transaction, amount = _a.amount;
12
+ var url = useMemo(function () {
13
+ var url = new URL(route, getCoinflowUrl(env));
14
+ url.searchParams.append('pubkey', publicKey);
15
+ if (transaction) {
16
+ var serializedTx = base58.encode(transaction.serialize({
17
+ requireAllSignatures: false,
18
+ verifySignatures: false
19
+ }));
20
+ url.searchParams.append('transaction', serializedTx);
21
+ }
22
+ if (amount) {
23
+ url.searchParams.append('amount', amount.toString());
24
+ }
25
+ console.log({ url: url });
26
+ return url;
27
+ }, [amount, env, publicKey, route, transaction]);
28
+ return useMemo(function () { return (React.createElement("iframe", { ref: IFrameRef, style: {
14
29
  width: '100%',
15
30
  height: '100%'
16
- }, title: "withdraw", frameBorder: "0", src: url.toString() }));
31
+ }, title: "withdraw", frameBorder: "0", src: url.toString() })); }, [IFrameRef, url]);
17
32
  }
18
- export var CoinflowIframe = React.memo(CoinflowIFrame);
19
33
  //# sourceMappingURL=CoinflowIFrame.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoinflowIFrame.js","sourceRoot":"","sources":["../../src/CoinflowIFrame.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,SAAS,cAAc,CAAC,GAAkB;IACxC,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,uBAAuB,CAAC;IAC3D,IAAI,GAAG,KAAK,OAAO;QAAE,OAAO,uBAAuB,CAAC;IAEpD,OAAO,kBAAW,GAAG,mBAAgB,CAAC;AACxC,CAAC;AAED,SAAS,cAAc,CAAC,EAKF;QAJpB,SAAS,eAAA,EACT,SAAS,eAAA,EACT,GAAG,SAAA,EACH,KAAK,WAAA;IAEL,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC;IAChD,GAAG,CAA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gBAAgB,EAAE,KAAK;aACxB,CAAC,CACH,CAAC;YACF,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;SACtD;QACD,IAAI,MAAM,EAAE;YACV,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;SACtD;QACD,OAAO,CAAC,GAAG,CAAC,EAAC,GAAG,KAAA,EAAC,CAAC,CAAC;QACnB,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;IAEjD,OAAO,OAAO,CACZ,cAAM,OAAA,CACJ,gCACE,GAAG,EAAE,SAAS,EACd,KAAK,EAAE;YACL,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;SACf,EACD,KAAK,EAAC,UAAU,EAChB,WAAW,EAAC,GAAG,EACf,GAAG,EAAE,GAAG,CAAC,QAAQ,EAAE,GACnB,CACH,EAXK,CAWL,EACD,CAAC,SAAS,EAAE,GAAG,CAAC,CACjB,CAAC;AACJ,CAAC"}
@@ -1,14 +1,16 @@
1
1
  /// <reference types="react" />
2
2
  import { WalletContextState } from '@solana/wallet-adapter-react';
3
- import { Connection } from '@solana/web3.js';
3
+ import { Connection, Transaction } from '@solana/web3.js';
4
4
  import { CoinflowEnvs } from './CoinflowIFrame';
5
5
  import { OnSuccessMethod } from './IFrameWalletConnector';
6
6
  type Props = {
7
7
  wallet: WalletContextState;
8
8
  merchantId: string;
9
9
  connection: Connection;
10
+ amount?: number;
10
11
  env?: CoinflowEnvs;
11
12
  onSuccess?: OnSuccessMethod;
13
+ transaction?: Transaction;
12
14
  };
13
- export declare function CoinflowPurchase({ wallet, merchantId, env, connection, onSuccess, }: Props): JSX.Element | null;
15
+ export declare function CoinflowPurchase({ wallet, merchantId, env, connection, onSuccess, transaction, amount, }: Props): JSX.Element | null;
14
16
  export {};
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { CoinflowIframe } from './CoinflowIFrame';
2
+ import { CoinflowIFrame } from './CoinflowIFrame';
3
3
  import { useIframeWallet } from './IFrameWalletConnector';
4
4
  export function CoinflowPurchase(_a) {
5
- var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, connection = _a.connection, onSuccess = _a.onSuccess;
5
+ var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, connection = _a.connection, onSuccess = _a.onSuccess, transaction = _a.transaction, amount = _a.amount;
6
6
  var IFrameRef = useIframeWallet({ wallet: wallet, connection: connection, onSuccess: onSuccess }).IFrameRef;
7
7
  if (!wallet.publicKey || !wallet.connected)
8
8
  return null;
9
- return (React.createElement(CoinflowIframe, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env }));
9
+ return (React.createElement(CoinflowIFrame, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/purchase/".concat(merchantId), env: env, transaction: transaction, amount: amount }));
10
10
  }
11
11
  //# sourceMappingURL=CoinflowPurchase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAe,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAkB,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAUzE,MAAM,UAAU,gBAAgB,CAAC,EAMzB;QALN,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,GAAG,SAAA,EACH,UAAU,gBAAA,EACV,SAAS,eAAA;IAEF,IAAA,SAAS,GAAI,eAAe,CAAC,EAAC,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,SAAS,WAAA,EAAC,CAAC,UAApD,CAAqD;IAErE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAExD,OAAO,CACL,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EACtC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,oBAAa,UAAU,CAAE,EAChC,GAAG,EAAE,GAAG,GACR,CACH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"CoinflowPurchase.js","sourceRoot":"","sources":["../../src/CoinflowPurchase.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAe,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAkB,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAYzE,MAAM,UAAU,gBAAgB,CAAC,EAQzB;QAPN,MAAM,YAAA,EACN,UAAU,gBAAA,EACV,GAAG,SAAA,EACH,UAAU,gBAAA,EACV,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,MAAM,YAAA;IAEC,IAAA,SAAS,GAAI,eAAe,CAAC,EAAC,MAAM,QAAA,EAAE,UAAU,YAAA,EAAE,SAAS,WAAA,EAAC,CAAC,UAApD,CAAqD;IAErE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAExD,OAAO,CACL,oBAAC,cAAc,IACb,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,EACtC,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,oBAAa,UAAU,CAAE,EAChC,GAAG,EAAE,GAAG,EACR,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
- import { CoinflowIframe } from './CoinflowIFrame';
2
+ import { CoinflowIFrame } from './CoinflowIFrame';
3
3
  import { useIframeWallet } from './IFrameWalletConnector';
4
4
  export function CoinflowWithdraw(_a) {
5
5
  var wallet = _a.wallet, merchantId = _a.merchantId, env = _a.env, connection = _a.connection, onSuccess = _a.onSuccess;
6
6
  var IFrameRef = useIframeWallet({ wallet: wallet, connection: connection, onSuccess: onSuccess }).IFrameRef;
7
7
  if (!wallet.publicKey || !wallet.connected)
8
8
  return null;
9
- return (React.createElement(CoinflowIframe, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env }));
9
+ return (React.createElement(CoinflowIFrame, { publicKey: wallet.publicKey.toString(), IFrameRef: IFrameRef, route: "/withdraw/".concat(merchantId), env: env }));
10
10
  }
11
11
  //# sourceMappingURL=CoinflowWithdraw.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinflowlabs/react",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "React Component for Coinflow Withdraw",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",