@coinflowlabs/react 0.2.5 → 0.2.6

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
@@ -37,9 +37,18 @@ Props:
37
37
  * `partialSigners` (optional): Keypairs of Partial Signers to sign the transaction with, this is necessary when initializing new accounts as the new account Keypair must sign the transaction.
38
38
  * `debugTx` (optional): Setting this to `true` will sign the transaction with the wallet, and send the transaction with no preflight checks allowing for easier debug of any issues.
39
39
 
40
+ ## Utils
41
+
42
+ `CoinflowUtils`
43
+
44
+ * `getFeePayer` - Return the `PublicKey` of the Coinflow Fee Payer
40
45
 
41
46
  # Changelog
42
47
 
48
+ ### 0.2.6
49
+
50
+ - Added `CoinflowUtils.getFeePayer()` to get the Coinflow fee payer PublicKey
51
+
43
52
  ### 0.2.5
44
53
 
45
54
  - Fixing an issue when passing partialSigners not working with the setup transaction
@@ -1,10 +1,8 @@
1
- import { Transaction } from '@solana/web3.js';
1
+ import { PublicKey } from '@solana/web3.js';
2
2
  import { CoinflowEnvs } from './CoinflowIFrame';
3
3
  export declare class CoinflowUtils {
4
4
  env: CoinflowEnvs;
5
5
  url: string;
6
6
  constructor(env?: CoinflowEnvs);
7
- setupCreditRedeemTx(transaction: Transaction, amount: number): Promise<Transaction>;
8
- transactionToBase58(transaction: Transaction): string;
9
- base58ToTransaction(bs58: string): Transaction;
7
+ getFeePayer(): Promise<PublicKey>;
10
8
  }
@@ -4,7 +4,6 @@ exports.CoinflowUtils = void 0;
4
4
  var tslib_1 = require("tslib");
5
5
  var web3_js_1 = require("@solana/web3.js");
6
6
  var axios_1 = tslib_1.__importDefault(require("axios"));
7
- var bs58_1 = tslib_1.__importDefault(require("bs58"));
8
7
  var CoinflowUtils = /** @class */ (function () {
9
8
  function CoinflowUtils(env) {
10
9
  this.env = env !== null && env !== void 0 ? env : 'prod';
@@ -15,31 +14,19 @@ var CoinflowUtils = /** @class */ (function () {
15
14
  else
16
15
  this.url = "https://api-".concat(this.env, ".coinflow.cash");
17
16
  }
18
- CoinflowUtils.prototype.setupCreditRedeemTx = function (transaction, amount) {
17
+ CoinflowUtils.prototype.getFeePayer = function () {
19
18
  return tslib_1.__awaiter(this, void 0, void 0, function () {
20
19
  var data;
21
20
  return tslib_1.__generator(this, function (_a) {
22
21
  switch (_a.label) {
23
- case 0: return [4 /*yield*/, axios_1["default"].post(this.url + '/v1/redeem', {
24
- tx: this.transactionToBase58(transaction),
25
- amount: amount
26
- })];
22
+ case 0: return [4 /*yield*/, axios_1["default"].post(this.url + '/v1/redeem/fee-payer')];
27
23
  case 1:
28
24
  data = (_a.sent()).data;
29
- return [2 /*return*/, this.base58ToTransaction(data)];
25
+ return [2 /*return*/, new web3_js_1.PublicKey(data)];
30
26
  }
31
27
  });
32
28
  });
33
29
  };
34
- CoinflowUtils.prototype.transactionToBase58 = function (transaction) {
35
- return bs58_1["default"].encode(transaction.serialize({
36
- requireAllSignatures: false,
37
- verifySignatures: false
38
- }));
39
- };
40
- CoinflowUtils.prototype.base58ToTransaction = function (bs58) {
41
- return web3_js_1.Transaction.from(bs58_1["default"].decode(bs58));
42
- };
43
30
  return CoinflowUtils;
44
31
  }());
45
32
  exports.CoinflowUtils = CoinflowUtils;
@@ -1 +1 @@
1
- {"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/CoinflowUtils.ts"],"names":[],"mappings":";;;;AAAA,2CAA4C;AAE5C,wDAA0B;AAC1B,sDAA0B;AAE1B;IAIE,uBAAY,GAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,MAAM,CAAC;QACzB,IAAI,IAAI,CAAC,GAAG,KAAK,MAAM;YAAE,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;aAC3D,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO;YAAE,IAAI,CAAC,GAAG,GAAG,uBAAuB,CAAC;;YAC7D,IAAI,CAAC,GAAG,GAAG,sBA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D,CAAC;IAEK,mCAAW,GAAjB;;;;;4BACiB,qBAAM,kBAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,sBAAsB,CAAC,EAAA;;wBAA3D,IAAI,GAAI,CAAA,SAAmD,CAAA,KAAvD;wBACX,sBAAO,IAAI,mBAAS,CAAC,IAAI,CAAC,EAAC;;;;KAC5B;IACH,oBAAC;AAAD,CAAC,AAfD,IAeC;AAfY,sCAAa"}
@@ -1,2 +1,3 @@
1
1
  export * from './CoinflowWithdraw';
2
2
  export * from './CoinflowPurchase';
3
+ export * from './CoinflowUtils';
@@ -3,4 +3,5 @@ exports.__esModule = true;
3
3
  var tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./CoinflowWithdraw"), exports);
5
5
  tslib_1.__exportStar(require("./CoinflowPurchase"), exports);
6
+ tslib_1.__exportStar(require("./CoinflowUtils"), exports);
6
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,6DAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAAmC;AACnC,6DAAmC;AACnC,0DAAgC"}
@@ -1,10 +1,8 @@
1
- import { Transaction } from '@solana/web3.js';
1
+ import { PublicKey } from '@solana/web3.js';
2
2
  import { CoinflowEnvs } from './CoinflowIFrame';
3
3
  export declare class CoinflowUtils {
4
4
  env: CoinflowEnvs;
5
5
  url: string;
6
6
  constructor(env?: CoinflowEnvs);
7
- setupCreditRedeemTx(transaction: Transaction, amount: number): Promise<Transaction>;
8
- transactionToBase58(transaction: Transaction): string;
9
- base58ToTransaction(bs58: string): Transaction;
7
+ getFeePayer(): Promise<PublicKey>;
10
8
  }
@@ -1,7 +1,6 @@
1
1
  import { __awaiter, __generator } from "tslib";
2
- import { Transaction } from '@solana/web3.js';
2
+ import { PublicKey } from '@solana/web3.js';
3
3
  import axios from 'axios';
4
- import base58 from 'bs58';
5
4
  var CoinflowUtils = /** @class */ (function () {
6
5
  function CoinflowUtils(env) {
7
6
  this.env = env !== null && env !== void 0 ? env : 'prod';
@@ -12,31 +11,19 @@ var CoinflowUtils = /** @class */ (function () {
12
11
  else
13
12
  this.url = "https://api-".concat(this.env, ".coinflow.cash");
14
13
  }
15
- CoinflowUtils.prototype.setupCreditRedeemTx = function (transaction, amount) {
14
+ CoinflowUtils.prototype.getFeePayer = function () {
16
15
  return __awaiter(this, void 0, void 0, function () {
17
16
  var data;
18
17
  return __generator(this, function (_a) {
19
18
  switch (_a.label) {
20
- case 0: return [4 /*yield*/, axios.post(this.url + '/v1/redeem', {
21
- tx: this.transactionToBase58(transaction),
22
- amount: amount
23
- })];
19
+ case 0: return [4 /*yield*/, axios.post(this.url + '/v1/redeem/fee-payer')];
24
20
  case 1:
25
21
  data = (_a.sent()).data;
26
- return [2 /*return*/, this.base58ToTransaction(data)];
22
+ return [2 /*return*/, new PublicKey(data)];
27
23
  }
28
24
  });
29
25
  });
30
26
  };
31
- CoinflowUtils.prototype.transactionToBase58 = function (transaction) {
32
- return base58.encode(transaction.serialize({
33
- requireAllSignatures: false,
34
- verifySignatures: false
35
- }));
36
- };
37
- CoinflowUtils.prototype.base58ToTransaction = function (bs58) {
38
- return Transaction.from(base58.decode(bs58));
39
- };
40
27
  return CoinflowUtils;
41
28
  }());
42
29
  export { CoinflowUtils };
@@ -1 +1 @@
1
- {"version":3,"file":"CoinflowUtils.js","sourceRoot":"","sources":["../../src/CoinflowUtils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,MAAM,CAAC;AAE1B;IAIE,uBAAY,GAAkB;QAC5B,IAAI,CAAC,GAAG,GAAG,GAAG,aAAH,GAAG,cAAH,GAAG,GAAI,MAAM,CAAC;QACzB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,IAAI,CAAC,GAAG,KAAK,MAAM;YAAE,IAAI,CAAC,GAAG,GAAG,2BAA2B,CAAC;aAC3D,IAAI,IAAI,CAAC,GAAG,KAAK,OAAO;YAAE,IAAI,CAAC,GAAG,GAAG,uBAAuB,CAAC;;YAC7D,IAAI,CAAC,GAAG,GAAG,sBAAe,IAAI,CAAC,GAAG,mBAAgB,CAAC;IAC1D,CAAC;IAEK,mCAAW,GAAjB;;;;;4BACiB,qBAAM,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,sBAAsB,CAAC,EAAA;;wBAA3D,IAAI,GAAI,CAAA,SAAmD,CAAA,KAAvD;wBACX,sBAAO,IAAI,SAAS,CAAC,IAAI,CAAC,EAAC;;;;KAC5B;IACH,oBAAC;AAAD,CAAC,AAfD,IAeC"}
@@ -1,2 +1,3 @@
1
1
  export * from './CoinflowWithdraw';
2
2
  export * from './CoinflowPurchase';
3
+ export * from './CoinflowUtils';
@@ -1,3 +1,4 @@
1
1
  export * from './CoinflowWithdraw';
2
2
  export * from './CoinflowPurchase';
3
+ export * from './CoinflowUtils';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinflowlabs/react",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "React Component for Coinflow Withdraw",
5
5
  "main": "./build/cjs/index.js",
6
6
  "module": "./build/esm/index.js",