@coinflowlabs/angular 0.1.0 → 0.1.2

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.
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
2
2
  import { Component, Input, ViewChild, HostListener } from '@angular/core';
3
3
  import * as SolanaWeb3Js from '@solana/web3.js';
4
4
  import base58Imported from 'bs58';
5
+ import LZString from 'lz-string';
5
6
  import * as i1 from '@angular/platform-browser';
6
7
 
7
8
  var SettlementType;
@@ -75,7 +76,7 @@ class CoinflowUtils {
75
76
  return 'http://localhost:5000';
76
77
  return `https://api-${env}.coinflow.cash`;
77
78
  }
78
- static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, }) {
79
+ static getCoinflowUrl({ walletPubkey, route, routePrefix, env, amount, transaction, blockchain, supportsVersionedTransactions, webhookInfo, email, loaderBackground, handleHeightChange, bankAccountLinkRedirect, additionalWallets, nearDeposit, chargebackProtectionData, merchantCss, color, rent, lockDefaultToken, token, tokens, planCode, disableApplePay, disableGooglePay, customerInfo, settlementType, lockAmount, nativeSolToConvert, theme, usePermit, transactionSigner, authOnly, deviceId, jwtToken, }) {
79
80
  const prefix = routePrefix
80
81
  ? `/${routePrefix}/${blockchain}`
81
82
  : `/${blockchain}`;
@@ -91,13 +92,13 @@ class CoinflowUtils {
91
92
  url.searchParams.append('supportsVersionedTransactions', 'true');
92
93
  }
93
94
  if (webhookInfo) {
94
- url.searchParams.append('webhookInfo', Buffer.from(JSON.stringify(webhookInfo)).toString('base64'));
95
+ url.searchParams.append('webhookInfo', LZString.compressToEncodedURIComponent(JSON.stringify(webhookInfo)));
95
96
  }
96
97
  if (theme) {
97
- url.searchParams.append('theme', Buffer.from(JSON.stringify(theme)).toString('base64'));
98
+ url.searchParams.append('theme', LZString.compressToEncodedURIComponent(JSON.stringify(theme)));
98
99
  }
99
100
  if (customerInfo) {
100
- url.searchParams.append('customerInfo', Buffer.from(JSON.stringify(customerInfo)).toString('base64'));
101
+ url.searchParams.append('customerInfo', LZString.compressToEncodedURIComponent(JSON.stringify(customerInfo)));
101
102
  }
102
103
  if (email) {
103
104
  url.searchParams.append('email', email);
@@ -118,11 +119,11 @@ class CoinflowUtils {
118
119
  url.searchParams.append('bankAccountLinkRedirect', bankAccountLinkRedirect);
119
120
  }
120
121
  if (additionalWallets)
121
- url.searchParams.append('additionalWallets', JSON.stringify(additionalWallets));
122
+ url.searchParams.append('additionalWallets', LZString.compressToEncodedURIComponent(JSON.stringify(additionalWallets)));
122
123
  if (nearDeposit)
123
124
  url.searchParams.append('nearDeposit', nearDeposit);
124
125
  if (chargebackProtectionData)
125
- url.searchParams.append('chargebackProtectionData', JSON.stringify(chargebackProtectionData));
126
+ url.searchParams.append('chargebackProtectionData', LZString.compressToEncodedURIComponent(JSON.stringify(chargebackProtectionData)));
126
127
  if (deviceId) {
127
128
  url.searchParams.append('deviceId', deviceId);
128
129
  }
@@ -161,30 +162,54 @@ class CoinflowUtils {
161
162
  url.searchParams.append('transactionSigner', transactionSigner);
162
163
  if (authOnly === true)
163
164
  url.searchParams.append('authOnly', 'true');
165
+ if (jwtToken)
166
+ url.searchParams.append('jwtToken', jwtToken);
164
167
  return url.toString();
165
168
  }
166
169
  static getTransaction(props) {
167
- if ('transaction' in props && props.transaction !== undefined) {
168
- const { transaction } = props;
169
- if (web3 && transaction instanceof web3.Transaction) {
170
+ return this.byBlockchain(props.blockchain, {
171
+ solana: () => {
172
+ if (!('transaction' in props))
173
+ return undefined;
174
+ const { transaction } = props;
175
+ if (!web3)
176
+ throw new Error('@solana/web3.js dependency is required for Solana');
170
177
  if (!base58)
171
178
  throw new Error('bs58 dependency is required for Solana');
172
- return base58.encode(transaction.serialize({
173
- requireAllSignatures: false,
174
- verifySignatures: false,
175
- }));
176
- }
177
- if (web3 && transaction instanceof web3.VersionedTransaction) {
178
- if (!base58)
179
- throw new Error('bs58 dependency is required for Solana');
180
- return base58.encode(transaction.serialize());
181
- }
182
- return btoa(JSON.stringify(transaction));
183
- }
184
- if ('action' in props && props.action !== undefined) {
185
- return btoa(JSON.stringify(props.action));
186
- }
187
- return undefined;
179
+ if (transaction instanceof web3.Transaction)
180
+ return base58.encode(transaction.serialize({
181
+ requireAllSignatures: false,
182
+ verifySignatures: false,
183
+ }));
184
+ if (transaction instanceof web3.VersionedTransaction)
185
+ return base58.encode(transaction.serialize());
186
+ return undefined;
187
+ },
188
+ polygon: () => {
189
+ if (!('transaction' in props))
190
+ return undefined;
191
+ const { transaction } = props;
192
+ return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
193
+ },
194
+ eth: () => {
195
+ if (!('transaction' in props))
196
+ return undefined;
197
+ const { transaction } = props;
198
+ return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
199
+ },
200
+ base: () => {
201
+ if (!('transaction' in props))
202
+ return undefined;
203
+ const { transaction } = props;
204
+ return LZString.compressToEncodedURIComponent(JSON.stringify(transaction));
205
+ },
206
+ near: () => {
207
+ if (!('action' in props))
208
+ return undefined;
209
+ const { action } = props;
210
+ return LZString.compressToEncodedURIComponent(JSON.stringify(action));
211
+ },
212
+ })();
188
213
  }
189
214
  static byBlockchain(blockchain, args) {
190
215
  switch (blockchain) {
@@ -195,8 +220,6 @@ class CoinflowUtils {
195
220
  case 'polygon':
196
221
  return args.polygon;
197
222
  case 'eth':
198
- if (args.eth === undefined)
199
- throw new Error('blockchain not supported for this operation!');
200
223
  return args.eth;
201
224
  case 'base':
202
225
  return args.base;
@@ -212,6 +235,7 @@ var IFrameMessageMethods;
212
235
  IFrameMessageMethods["SignTransaction"] = "signTransaction";
213
236
  IFrameMessageMethods["SendTransaction"] = "sendTransaction";
214
237
  IFrameMessageMethods["HeightChange"] = "heightChange";
238
+ IFrameMessageMethods["Success"] = "success";
215
239
  })(IFrameMessageMethods || (IFrameMessageMethods = {}));
216
240
  function getWalletPubkey({ wallet, }) {
217
241
  if ('publicKey' in wallet) {
@@ -252,19 +276,24 @@ function handleIFrameMessage(rawMessage, handlers) {
252
276
  if (!handlers.handleHeightChange)
253
277
  return;
254
278
  return handlers.handleHeightChange(data);
279
+ case IFrameMessageMethods.Success:
280
+ if (!handlers.onSuccess)
281
+ return;
282
+ handlers.onSuccess(walletCall.info);
283
+ return;
255
284
  }
256
285
  console.warn(`Didn't expect to get here, handleIFrameMessage method:${method} is not one of ${Object.values(IFrameMessageMethods)}`);
257
286
  }
258
- function getHandlers({ wallet, blockchain, }) {
259
- return CoinflowUtils.byBlockchain(blockchain, {
260
- solana: () => getSolanaWalletHandlers({ wallet }),
261
- near: () => getNearWalletHandlers({ wallet }),
262
- eth: () => getEvmWalletHandlers({ wallet }),
263
- polygon: () => getEvmWalletHandlers({ wallet }),
264
- base: () => getEvmWalletHandlers({ wallet }),
287
+ function getHandlers(props) {
288
+ return CoinflowUtils.byBlockchain(props.blockchain, {
289
+ solana: () => getSolanaWalletHandlers(props),
290
+ near: () => getNearWalletHandlers(props),
291
+ eth: () => getEvmWalletHandlers(props),
292
+ polygon: () => getEvmWalletHandlers(props),
293
+ base: () => getEvmWalletHandlers(props),
265
294
  })();
266
295
  }
267
- function getSolanaWalletHandlers({ wallet, }) {
296
+ function getSolanaWalletHandlers({ wallet, onSuccess, }) {
268
297
  return {
269
298
  handleSendTransaction: async (transaction) => {
270
299
  const tx = getSolanaTransaction(transaction);
@@ -294,6 +323,7 @@ function getSolanaWalletHandlers({ wallet, }) {
294
323
  verifySignatures: false,
295
324
  }));
296
325
  },
326
+ onSuccess,
297
327
  };
298
328
  }
299
329
  function getSolanaTransaction(data) {
@@ -307,7 +337,7 @@ function getSolanaTransaction(data) {
307
337
  return web3.Transaction.from(parsedUInt8Array);
308
338
  return vtx;
309
339
  }
310
- function getNearWalletHandlers({ wallet, }) {
340
+ function getNearWalletHandlers({ wallet, onSuccess, }) {
311
341
  const nearWallet = wallet;
312
342
  return {
313
343
  handleSendTransaction: async (transaction) => {
@@ -318,9 +348,10 @@ function getNearWalletHandlers({ wallet, }) {
318
348
  const { transaction: transactionResult } = executionOutcome;
319
349
  return transactionResult.hash;
320
350
  },
351
+ onSuccess,
321
352
  };
322
353
  }
323
- function getEvmWalletHandlers({ wallet, }) {
354
+ function getEvmWalletHandlers({ wallet, onSuccess, }) {
324
355
  const evmWallet = wallet;
325
356
  return {
326
357
  handleSendTransaction: async (transaction) => {
@@ -331,6 +362,7 @@ function getEvmWalletHandlers({ wallet, }) {
331
362
  handleSignMessage: async (message) => {
332
363
  return evmWallet.signMessage(message);
333
364
  },
365
+ onSuccess,
334
366
  };
335
367
  }
336
368
 
@@ -358,8 +390,8 @@ class CoinflowIFrameComponent {
358
390
  return;
359
391
  this.iframe.nativeElement.contentWindow.postMessage(message, '*');
360
392
  }
361
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowIFrameComponent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
362
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: CoinflowIFrameComponent, isStandalone: true, selector: "lib-coinflow-iframe", inputs: { iframeProps: "iframeProps", messageHandlers: "messageHandlers" }, host: { listeners: { "window:message": "onPostMessage($event)" } }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true }], ngImport: i0, template: ` <iframe
393
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowIFrameComponent, deps: [{ token: i1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component }); }
394
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: CoinflowIFrameComponent, isStandalone: true, selector: "lib-coinflow-iframe", inputs: { iframeProps: "iframeProps", messageHandlers: "messageHandlers" }, host: { listeners: { "window:message": "onPostMessage($event)" } }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true }], ngImport: i0, template: ` <iframe
363
395
  width="100%"
364
396
  height="100%"
365
397
  #iframe
@@ -370,7 +402,7 @@ class CoinflowIFrameComponent {
370
402
  [src]="dynamicUrl"
371
403
  ></iframe>`, isInline: true }); }
372
404
  }
373
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowIFrameComponent, decorators: [{
405
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowIFrameComponent, decorators: [{
374
406
  type: Component,
375
407
  args: [{
376
408
  selector: 'lib-coinflow-iframe',
@@ -412,10 +444,10 @@ class CoinflowPurchaseComponent {
412
444
  transaction: CoinflowUtils.getTransaction(this.purchaseProps),
413
445
  };
414
446
  }
415
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowPurchaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
416
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: CoinflowPurchaseComponent, isStandalone: true, selector: "lib-coinflow-purchase", inputs: { purchaseProps: "purchaseProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers"] }] }); }
447
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowPurchaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
448
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: CoinflowPurchaseComponent, isStandalone: true, selector: "lib-coinflow-purchase", inputs: { purchaseProps: "purchaseProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers"] }] }); }
417
449
  }
418
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowPurchaseComponent, decorators: [{
450
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowPurchaseComponent, decorators: [{
419
451
  type: Component,
420
452
  args: [{
421
453
  selector: 'lib-coinflow-purchase',
@@ -428,10 +460,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
428
460
  }] } });
429
461
 
430
462
  class CoinflowPurchaseHistoryComponent {
431
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowPurchaseHistoryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
432
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: CoinflowPurchaseHistoryComponent, isStandalone: true, selector: "lib-coinflow-purchase-history", ngImport: i0, template: ' <p>coinflow-purchase-history works!</p> ', isInline: true }); }
463
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowPurchaseHistoryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
464
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: CoinflowPurchaseHistoryComponent, isStandalone: true, selector: "lib-coinflow-purchase-history", ngImport: i0, template: ' <p>coinflow-purchase-history works!</p> ', isInline: true }); }
433
465
  }
434
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowPurchaseHistoryComponent, decorators: [{
466
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowPurchaseHistoryComponent, decorators: [{
435
467
  type: Component,
436
468
  args: [{
437
469
  selector: 'lib-coinflow-purchase-history',
@@ -442,10 +474,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
442
474
  }] });
443
475
 
444
476
  class CoinflowPurchaseProtectionComponent {
445
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowPurchaseProtectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
446
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: CoinflowPurchaseProtectionComponent, isStandalone: true, selector: "lib-coinflow-purchase-protection", ngImport: i0, template: ' <p>coinflow-purchase-protection works!</p> ', isInline: true }); }
477
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowPurchaseProtectionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
478
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: CoinflowPurchaseProtectionComponent, isStandalone: true, selector: "lib-coinflow-purchase-protection", ngImport: i0, template: ' <p>coinflow-purchase-protection works!</p> ', isInline: true }); }
447
479
  }
448
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowPurchaseProtectionComponent, decorators: [{
480
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowPurchaseProtectionComponent, decorators: [{
449
481
  type: Component,
450
482
  args: [{
451
483
  selector: 'lib-coinflow-purchase-protection',
@@ -468,10 +500,10 @@ class CoinflowWithdrawComponent {
468
500
  transaction: undefined,
469
501
  };
470
502
  }
471
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowWithdrawComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
472
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: CoinflowWithdrawComponent, isStandalone: true, selector: "lib-coinflow-withdraw", inputs: { withdrawProps: "withdrawProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers"] }] }); }
503
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowWithdrawComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
504
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: CoinflowWithdrawComponent, isStandalone: true, selector: "lib-coinflow-withdraw", inputs: { withdrawProps: "withdrawProps" }, ngImport: i0, template: ' <lib-coinflow-iframe ng-if="iframeProps && messageHandlers" [iframeProps]="iframeProps!" [messageHandlers]="messageHandlers!"></lib-coinflow-iframe> ', isInline: true, dependencies: [{ kind: "component", type: CoinflowIFrameComponent, selector: "lib-coinflow-iframe", inputs: ["iframeProps", "messageHandlers"] }] }); }
473
505
  }
474
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowWithdrawComponent, decorators: [{
506
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowWithdrawComponent, decorators: [{
475
507
  type: Component,
476
508
  args: [{
477
509
  selector: 'lib-coinflow-withdraw',
@@ -484,10 +516,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImpor
484
516
  }] } });
485
517
 
486
518
  class CoinflowWithdrawHistoryComponent {
487
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowWithdrawHistoryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
488
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.4", type: CoinflowWithdrawHistoryComponent, isStandalone: true, selector: "lib-coinflow-withdraw-history", ngImport: i0, template: ' <p>coinflow-withdraw-history works!</p> ', isInline: true }); }
519
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowWithdrawHistoryComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
520
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.8", type: CoinflowWithdrawHistoryComponent, isStandalone: true, selector: "lib-coinflow-withdraw-history", ngImport: i0, template: ' <p>coinflow-withdraw-history works!</p> ', isInline: true }); }
489
521
  }
490
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.4", ngImport: i0, type: CoinflowWithdrawHistoryComponent, decorators: [{
522
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.8", ngImport: i0, type: CoinflowWithdrawHistoryComponent, decorators: [{
491
523
  type: Component,
492
524
  args: [{
493
525
  selector: 'lib-coinflow-withdraw-history',
@@ -1 +1 @@
1
- {"version":3,"file":"coinflowlabs-angular.mjs","sources":["../../../projects/coinflowlabs/src/lib/common/CoinflowTypes.ts","../../../projects/coinflowlabs/src/lib/common/SolanaPeerDeps.ts","../../../projects/coinflowlabs/src/lib/common/CoinflowUtils.ts","../../../projects/coinflowlabs/src/lib/common/CoinflowLibMessageHandlers.ts","../../../projects/coinflowlabs/src/lib/coinflow-iframe.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-purchase.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-purchase-history.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-purchase-protection.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-withdraw.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-withdraw-history.component.ts","../../../projects/coinflowlabs/src/public-api.ts","../../../projects/coinflowlabs/src/coinflowlabs-angular.ts"],"sourcesContent":["import type {\n Connection,\n VersionedTransaction,\n PublicKey,\n Signer,\n Transaction,\n} from '@solana/web3.js';\n\nexport enum SettlementType {\n Credits = 'Credits',\n USDC = 'USDC',\n Bank = 'Bank',\n}\n\nexport enum MerchantStyle {\n Rounded = 'rounded',\n Sharp = 'sharp',\n Pill = 'pill',\n}\n\nexport type MerchantTheme = {\n primary?: string;\n background?: string;\n backgroundAccent?: string;\n backgroundAccent2?: string;\n textColor?: string;\n textColorAccent?: string;\n textColorAction?: string;\n font?: string;\n style?: MerchantStyle;\n};\n\nexport interface CustomerInfo {\n name?: string;\n verificationId?: string;\n displayName?: string;\n address?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n ip?: string;\n lat?: string;\n lng?: string;\n}\n\n/** Coinflow Types **/\nexport type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base';\nexport type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';\n\nexport interface CoinflowTypes {\n merchantId: string;\n env?: CoinflowEnvs;\n loaderBackground?: string;\n blockchain: CoinflowBlockchain;\n handleHeightChange?: (height: string) => void;\n theme?: MerchantTheme;\n}\n\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport type OnSuccessMethod = (params: string) => void | Promise<void>;\n\n/** Wallets **/\nexport interface SolanaWallet {\n publicKey: PublicKey | null;\n signTransaction?: <T extends Transaction | VersionedTransaction>(\n transaction: T\n ) => Promise<T>;\n sendTransaction: <T extends Transaction | VersionedTransaction>(\n transaction: T\n ) => Promise<string>;\n signMessage?: (message: Uint8Array) => Promise<Uint8Array>;\n}\n\nexport interface NearWallet {\n accountId: string;\n signAndSendTransaction: (transaction: unknown) => Promise<{\n transaction: {hash: string};\n }>;\n}\n\ntype AccessList = Array<{address: string; storageKeys: Array<string>}>;\ntype AccessListish =\n | AccessList\n | Array<[string, Array<string>]>\n | Record<string, Array<string>>;\n\nexport type EthWallet = {\n address: string | null | undefined;\n sendTransaction: (transaction: {\n to: string;\n from?: string;\n nonce?: Bytes | bigint | string | number;\n\n gasLimit?: Bytes | bigint | string | number;\n gasPrice?: Bytes | bigint | string | number;\n\n data?: BytesLike;\n value?: Bytes | bigint | string | number;\n chainId?: number;\n\n type?: number;\n accessList?: AccessListish;\n\n maxPriorityFeePerGas?: Bytes | bigint | string | number;\n maxFeePerGas?: Bytes | bigint | string | number;\n\n customData?: Record<string, any>;\n ccipReadEnabled?: boolean;\n }) => Promise<{hash: string}>;\n signMessage: (message: string) => Promise<string>;\n};\n\n/** History **/\nexport interface CoinflowSolanaHistoryProps extends CoinflowTypes {\n wallet: SolanaWallet;\n connection: Connection;\n blockchain: 'solana';\n}\n\nexport interface CoinflowNearHistoryProps extends CoinflowTypes {\n wallet: NearWallet;\n blockchain: 'near';\n}\n\nexport interface CoinflowEvmHistoryProps extends CoinflowTypes {\n wallet: EthWallet;\n}\n\nexport interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {\n blockchain: 'eth';\n}\n\nexport interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {\n blockchain: 'polygon';\n}\n\nexport interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {\n blockchain: 'base';\n}\n\nexport type CoinflowHistoryProps =\n | CoinflowSolanaHistoryProps\n | CoinflowNearHistoryProps\n | CoinflowPolygonHistoryProps\n | CoinflowEthHistoryProps\n | CoinflowBaseHistoryProps;\n\n/** Transactions **/\n\nexport type NearFtTransferCallAction = {\n methodName: 'ft_transfer_call';\n args: object;\n gas: string;\n deposit: string;\n};\n\ntype Bytes = ArrayLike<number>;\ntype BytesLike = Bytes | string;\n\n/** Purchase **/\n\nexport type ChargebackProtectionData = ChargebackProtectionItem[];\n\nexport interface ChargebackProtectionItem {\n /**\n * The name of the product\n */\n productName: string;\n /**\n * The product type. Possible values include: inGameProduct, gameOfSkill, dataStorage, computingResources, sportsTicket, eSportsTicket, musicTicket, conferenceTicket, virtualSportsTicket, virtualESportsTicket, virtualMusicTicket, virtualConferenceTicket, alcohol, DLC, subscription, fundACause, realEstate, computingContract, digitalArt, topUp\n */\n productType:\n | 'inGameProduct'\n | 'gameOfSkill'\n | 'dataStorage'\n | 'computingResources'\n | 'sportsTicket'\n | 'eSportsTicket'\n | 'musicTicket'\n | 'conferenceTicket'\n | 'virtualSportsTicket'\n | 'virtualESportsTicket'\n | 'virtualMusicTicket'\n | 'virtualConferenceTicket'\n | 'alcohol'\n | 'DLC'\n | 'subscription'\n | 'fundACause'\n | 'realEstate'\n | 'computingContract'\n | 'digitalArt'\n | 'topUp'\n | 'ownershipContract';\n /**\n * The item's list price\n */\n /**\n * The number of units sold\n */\n quantity: number;\n /**\n * Any additional data that the store can provide on the product, e.g. description, link to image, etc.\n */\n rawProductData?: {[key: string]: any};\n}\n\nexport interface CoinflowCommonPurchaseProps extends CoinflowTypes {\n amount?: number;\n onSuccess?: OnSuccessMethod;\n webhookInfo?: object;\n email?: string;\n chargebackProtectionData?: ChargebackProtectionData;\n planCode?: string;\n disableApplePay?: boolean;\n disableGooglePay?: boolean;\n customerInfo?: CustomerInfo;\n settlementType?: SettlementType;\n authOnly?: boolean;\n deviceId?: string;\n}\n\nexport interface CoinflowSolanaPurchaseProps\n extends CoinflowCommonPurchaseProps {\n wallet: SolanaWallet;\n transaction?: Transaction | VersionedTransaction;\n partialSigners?: Signer[];\n debugTx?: boolean;\n connection: Connection;\n blockchain: 'solana';\n token?: PublicKey | string;\n supportsVersionedTransactions?: boolean;\n rent?: {lamports: string | number};\n nativeSolToConvert?: {lamports: string | number};\n}\n\nexport interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {\n wallet: NearWallet;\n blockchain: 'near';\n action?: NearFtTransferCallAction;\n nearDeposit?: string;\n}\n\nexport interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {\n transaction?: EvmTransactionData;\n token?: string;\n wallet: EthWallet;\n}\n\nexport interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {\n blockchain: 'polygon';\n}\n\nexport interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {\n blockchain: 'eth';\n}\n\nexport interface CoinflowBasePurchaseProps extends CoinflowEvmPurchaseProps {\n blockchain: 'base';\n}\n\nexport type CoinflowPurchaseProps =\n | CoinflowSolanaPurchaseProps\n | CoinflowNearPurchaseProps\n | CoinflowPolygonPurchaseProps\n | CoinflowEthPurchaseProps\n | CoinflowBasePurchaseProps;\n\n/** Withdraw **/\n\nexport interface CoinflowCommonWithdrawProps extends CoinflowTypes {\n onSuccess?: OnSuccessMethod;\n tokens?: string[];\n lockDefaultToken?: boolean;\n amount?: number;\n email?: string;\n bankAccountLinkRedirect?: string;\n additionalWallets?: {\n wallet: string;\n blockchain: 'solana' | 'eth' | 'near' | 'polygon';\n }[];\n supportsVersionedTransactions?: boolean;\n lockAmount?: boolean;\n transactionSigner?: string;\n}\n\nexport interface CoinflowSolanaWithdrawProps\n extends CoinflowCommonWithdrawProps {\n wallet: SolanaWallet;\n connection: Connection;\n blockchain: 'solana';\n}\n\nexport interface CoinflowNearWithdrawProps extends CoinflowCommonWithdrawProps {\n wallet: NearWallet;\n blockchain: 'near';\n}\n\nexport interface CoinflowEvmWithdrawProps extends CoinflowCommonWithdrawProps {\n wallet: EthWallet;\n usePermit?: boolean;\n}\n\nexport interface CoinflowEthWithdrawProps extends CoinflowEvmWithdrawProps {\n blockchain: 'eth';\n usePermit?: boolean;\n}\n\nexport interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {\n blockchain: 'polygon';\n}\n\nexport interface CoinflowBaseWithdrawProps extends CoinflowEvmWithdrawProps {\n blockchain: 'base';\n}\n\nexport type CoinflowWithdrawProps =\n | CoinflowSolanaWithdrawProps\n | CoinflowNearWithdrawProps\n | CoinflowEthWithdrawProps\n | CoinflowPolygonWithdrawProps\n | CoinflowBaseWithdrawProps;\n\nexport interface CommonEvmRedeem {\n waitForHash?: boolean;\n}\n\nexport interface NormalRedeem extends CommonEvmRedeem {\n transaction: {to: string; data: string};\n}\n\nexport interface KnownTokenIdRedeem extends NormalRedeem {\n nftContract: string;\n nftId: string;\n}\n\nexport interface SafeMintRedeem extends NormalRedeem {\n type: 'safeMint';\n nftContract?: string;\n}\n\nexport interface ReturnedTokenIdRedeem extends NormalRedeem {\n type: 'returned';\n nftContract?: string;\n}\n\ntype ReservoirNftIdItem = Omit<KnownTokenIdRedeem, keyof NormalRedeem>;\ninterface ReservoirOrderIdItem {\n orderId: string;\n}\ntype ReservoirItem = ReservoirNftIdItem | ReservoirOrderIdItem;\ntype ReservoirItems = ReservoirItem | ReservoirItem[];\n\nexport interface ReservoirRedeem extends CommonEvmRedeem {\n type: 'reservoir';\n items: ReservoirItems;\n}\n\nexport type EvmTransactionData =\n | SafeMintRedeem\n | ReturnedTokenIdRedeem\n | ReservoirRedeem\n | KnownTokenIdRedeem\n | NormalRedeem;\n\nexport interface CoinflowIFrameProps\n extends Omit<CoinflowTypes, 'merchantId'>,\n Pick<\n CoinflowCommonPurchaseProps,\n | 'chargebackProtectionData'\n | 'webhookInfo'\n | 'amount'\n | 'customerInfo'\n | 'settlementType'\n | 'email'\n | 'planCode'\n | 'deviceId'\n >,\n Pick<\n CoinflowCommonWithdrawProps,\n | 'bankAccountLinkRedirect'\n | 'additionalWallets'\n | 'transactionSigner'\n | 'lockAmount'\n | 'lockDefaultToken'\n >,\n Pick<CoinflowEvmPurchaseProps, 'authOnly'>,\n Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {\n walletPubkey: string | null | undefined;\n route: string;\n routePrefix?: string;\n transaction?: string;\n tokens?: string[] | PublicKey[];\n supportsVersionedTransactions?: boolean;\n nearDeposit?: string;\n merchantCss?: string;\n color?: 'white' | 'black';\n disableApplePay?: boolean;\n disableGooglePay?: boolean;\n theme?: MerchantTheme;\n usePermit?: boolean;\n}\n","// This works in angular, but not react\n// let web3: typeof import('@solana/web3.js') | undefined;\n// let base58: typeof import('bs58') | undefined;\n//\n// try {\n// web3 = require('@solana/web3.js');\n// base58 = require('bs58');\n// } catch (e) {}\n//\n// export {web3, base58};\n\n// This works in react, but not angular\nimport * as SolanaWeb3Js from '@solana/web3.js';\nimport base58Imported from 'bs58';\n\nconst web3: typeof SolanaWeb3Js | undefined = SolanaWeb3Js;\nconst base58: typeof base58Imported | undefined = base58Imported;\nexport {web3, base58};\n","import {\n CoinflowBlockchain,\n CoinflowEnvs,\n CoinflowIFrameProps,\n CoinflowPurchaseProps,\n} from './CoinflowTypes';\nimport {web3, base58} from './SolanaPeerDeps';\n\nexport class CoinflowUtils {\n env: CoinflowEnvs;\n url: string;\n\n constructor(env?: CoinflowEnvs) {\n this.env = env ?? 'prod';\n if (this.env === 'prod') this.url = 'https://api.coinflow.cash';\n else if (this.env === 'local') this.url = 'http://localhost:5000';\n else this.url = `https://api-${this.env}.coinflow.cash`;\n }\n\n async getNSurePartnerId(merchantId: string): Promise<string | undefined> {\n return fetch(this.url + `/merchant/view/${merchantId}`)\n .then(response => response.json())\n .then(\n (json: {\n nSurePartnerId: string | undefined;\n nSureSettings: {nSurePartnerId: string | undefined};\n }) => json.nSureSettings?.nSurePartnerId || json.nSurePartnerId\n )\n .catch(e => {\n console.error(e);\n return undefined;\n });\n }\n\n async getCreditBalance(\n publicKey: string,\n merchantId: string,\n blockchain: 'solana' | 'near'\n ): Promise<{cents: number}> {\n const response = await fetch(\n this.url + `/api/customer/balances/${merchantId}`,\n {\n method: 'GET',\n headers: {\n 'x-coinflow-auth-wallet': publicKey,\n 'x-coinflow-auth-blockchain': blockchain,\n },\n }\n );\n const {credits} = await response.json();\n return credits;\n }\n\n static getCoinflowBaseUrl(env?: CoinflowEnvs): string {\n if (!env || env === 'prod') return 'https://coinflow.cash';\n if (env === 'local') return 'http://localhost:3000';\n\n return `https://${env}.coinflow.cash`;\n }\n\n static getCoinflowApiUrl(env?: CoinflowEnvs): string {\n if (!env || env === 'prod') return 'https://api.coinflow.cash';\n if (env === 'local') return 'http://localhost:5000';\n\n return `https://api-${env}.coinflow.cash`;\n }\n\n static getCoinflowUrl({\n walletPubkey,\n route,\n routePrefix,\n env,\n amount,\n transaction,\n blockchain,\n supportsVersionedTransactions,\n webhookInfo,\n email,\n loaderBackground,\n handleHeightChange,\n bankAccountLinkRedirect,\n additionalWallets,\n nearDeposit,\n chargebackProtectionData,\n merchantCss,\n color,\n rent,\n lockDefaultToken,\n token,\n tokens,\n planCode,\n disableApplePay,\n disableGooglePay,\n customerInfo,\n settlementType,\n lockAmount,\n nativeSolToConvert,\n theme,\n usePermit,\n transactionSigner,\n authOnly,\n deviceId,\n }: CoinflowIFrameProps): string {\n const prefix = routePrefix\n ? `/${routePrefix}/${blockchain}`\n : `/${blockchain}`;\n const url = new URL(prefix + route, CoinflowUtils.getCoinflowBaseUrl(env));\n url.searchParams.append('pubkey', walletPubkey!);\n\n if (transaction) {\n url.searchParams.append('transaction', transaction);\n }\n if (amount) {\n url.searchParams.append('amount', amount.toString());\n }\n\n if (supportsVersionedTransactions) {\n url.searchParams.append('supportsVersionedTransactions', 'true');\n }\n\n if (webhookInfo) {\n url.searchParams.append(\n 'webhookInfo',\n Buffer.from(JSON.stringify(webhookInfo)).toString('base64')\n );\n }\n\n if (theme) {\n url.searchParams.append(\n 'theme',\n Buffer.from(JSON.stringify(theme)).toString('base64')\n );\n }\n\n if (customerInfo) {\n url.searchParams.append(\n 'customerInfo',\n Buffer.from(JSON.stringify(customerInfo)).toString('base64')\n );\n }\n\n if (email) {\n url.searchParams.append('email', email);\n }\n\n if (token) {\n url.searchParams.append('token', token.toString());\n }\n\n if (tokens) {\n url.searchParams.append('tokens', tokens.toString());\n }\n\n if (loaderBackground) {\n url.searchParams.append('loaderBackground', loaderBackground);\n }\n\n if (handleHeightChange) {\n url.searchParams.append('useHeightChange', 'true');\n }\n\n if (bankAccountLinkRedirect) {\n url.searchParams.append(\n 'bankAccountLinkRedirect',\n bankAccountLinkRedirect\n );\n }\n\n if (additionalWallets)\n url.searchParams.append(\n 'additionalWallets',\n JSON.stringify(additionalWallets)\n );\n\n if (nearDeposit) url.searchParams.append('nearDeposit', nearDeposit);\n\n if (chargebackProtectionData)\n url.searchParams.append(\n 'chargebackProtectionData',\n JSON.stringify(chargebackProtectionData)\n );\n if (deviceId) {\n url.searchParams.append('deviceId', deviceId);\n } else {\n if (typeof window !== 'undefined') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const deviceId = window?.nSureSDK?.getDeviceId();\n if (deviceId) url.searchParams.append('deviceId', deviceId);\n }\n }\n\n if (merchantCss) url.searchParams.append('merchantCss', merchantCss);\n if (color) url.searchParams.append('color', color);\n if (rent) url.searchParams.append('rent', rent.lamports.toString());\n if (nativeSolToConvert)\n url.searchParams.append(\n 'nativeSolToConvert',\n nativeSolToConvert.lamports.toString()\n );\n if (lockDefaultToken) url.searchParams.append('lockDefaultToken', 'true');\n if (planCode) url.searchParams.append('planCode', planCode);\n\n if (disableApplePay) url.searchParams.append('disableApplePay', 'true');\n if (disableGooglePay) url.searchParams.append('disableGooglePay', 'true');\n if (settlementType)\n url.searchParams.append('settlementType', settlementType);\n\n if (lockAmount) url.searchParams.append('lockAmount', 'true');\n\n if (usePermit === false) url.searchParams.append('usePermit', 'false');\n if (transactionSigner)\n url.searchParams.append('transactionSigner', transactionSigner);\n if (authOnly === true) url.searchParams.append('authOnly', 'true');\n\n return url.toString();\n }\n\n static getTransaction(props: CoinflowPurchaseProps): string | undefined {\n if ('transaction' in props && props.transaction !== undefined) {\n const {transaction} = props;\n if (web3 && transaction instanceof web3.Transaction) {\n if (!base58) throw new Error('bs58 dependency is required for Solana');\n return base58.encode(\n transaction.serialize({\n requireAllSignatures: false,\n verifySignatures: false,\n })\n );\n }\n\n if (web3 && transaction instanceof web3.VersionedTransaction) {\n if (!base58) throw new Error('bs58 dependency is required for Solana');\n return base58.encode(transaction.serialize());\n }\n\n return btoa(JSON.stringify(transaction));\n }\n\n if ('action' in props && props.action !== undefined) {\n return btoa(JSON.stringify(props.action));\n }\n\n return undefined;\n }\n\n static byBlockchain<T>(\n blockchain: CoinflowBlockchain,\n args: {solana: T; near: T; eth?: T; polygon: T; base: T}\n ): T {\n switch (blockchain) {\n case 'solana':\n return args.solana;\n case 'near':\n return args.near;\n case 'polygon':\n return args.polygon;\n case 'eth':\n if (args.eth === undefined)\n throw new Error('blockchain not supported for this operation!');\n return args.eth;\n case 'base':\n return args.base;\n default:\n throw new Error('blockchain not supported!');\n }\n }\n}\n","import {\n CoinflowPurchaseProps,\n EthWallet,\n NearWallet,\n SolanaWallet,\n} from './CoinflowTypes';\nimport {CoinflowUtils} from './CoinflowUtils';\nimport type {Transaction, VersionedTransaction} from '@solana/web3.js';\nimport {web3, base58} from './SolanaPeerDeps';\n\nexport type WalletCall = {method: IFrameMessageMethods; data: string};\n\nexport interface IFrameMessageHandlers {\n handleSendTransaction: (transaction: string) => Promise<string>;\n handleSignMessage?: (message: string) => Promise<string>;\n handleSignTransaction?: (transaction: string) => Promise<string>;\n handleHeightChange?: (height: string) => void;\n}\n\nenum IFrameMessageMethods {\n SignMessage = 'signMessage',\n SignTransaction = 'signTransaction',\n SendTransaction = 'sendTransaction',\n HeightChange = 'heightChange',\n}\n\nexport function getWalletPubkey({\n wallet,\n}: Pick<CoinflowPurchaseProps, 'wallet'>): string | null | undefined {\n if ('publicKey' in wallet) {\n return wallet.publicKey!.toString();\n }\n\n if ('address' in wallet) {\n return wallet.address;\n }\n\n if ('accountId' in wallet) {\n return wallet.accountId;\n }\n\n return null;\n}\n\nexport function handleIFrameMessage(\n rawMessage: string,\n handlers: IFrameMessageHandlers\n): Promise<string> | void {\n let walletCall: WalletCall;\n try {\n walletCall = JSON.parse(rawMessage);\n if (!('method' in walletCall) || !('data' in walletCall)) return;\n } catch (e) {\n console.error('handleIFrameMessage JSON parse', e);\n return;\n }\n\n const {data, method} = walletCall;\n switch (method) {\n case IFrameMessageMethods.SignMessage:\n if (!handlers.handleSignMessage) return;\n return handlers.handleSignMessage(data);\n case IFrameMessageMethods.SignTransaction:\n if (!handlers.handleSignTransaction) return;\n return handlers.handleSignTransaction(data);\n case IFrameMessageMethods.SendTransaction:\n return handlers.handleSendTransaction(data);\n case IFrameMessageMethods.HeightChange:\n if (!handlers.handleHeightChange) return;\n return handlers.handleHeightChange(data);\n }\n\n console.warn(\n `Didn't expect to get here, handleIFrameMessage method:${method} is not one of ${Object.values(IFrameMessageMethods)}`\n );\n}\n\nexport function getHandlers({\n wallet,\n blockchain,\n}: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain'>): Omit<\n IFrameMessageHandlers,\n 'handleHeightChange'\n> {\n return CoinflowUtils.byBlockchain(blockchain, {\n solana: () => getSolanaWalletHandlers({wallet}),\n near: () => getNearWalletHandlers({wallet}),\n eth: () => getEvmWalletHandlers({wallet}),\n polygon: () => getEvmWalletHandlers({wallet}),\n base: () => getEvmWalletHandlers({wallet}),\n })();\n}\n\nfunction getSolanaWalletHandlers({\n wallet,\n}: Pick<CoinflowPurchaseProps, 'wallet'>): Omit<\n IFrameMessageHandlers,\n 'handleHeightChange'\n> {\n return {\n handleSendTransaction: async (transaction: string) => {\n const tx = getSolanaTransaction(transaction);\n return await (wallet as SolanaWallet).sendTransaction(tx);\n },\n handleSignMessage: async (message: string) => {\n const signMessage = (wallet as SolanaWallet).signMessage;\n if (!signMessage) {\n throw new Error('signMessage is not supported by this wallet');\n }\n\n const signedMessage = await signMessage(\n new TextEncoder().encode(message)\n );\n if (!base58) throw new Error('bs58 dependency is required');\n return base58.encode(signedMessage);\n },\n handleSignTransaction: async (transaction: string) => {\n const signTransaction = (wallet as SolanaWallet).signTransaction;\n if (!signTransaction) {\n throw new Error('signTransaction is not supported by this wallet');\n }\n const tx = getSolanaTransaction(transaction);\n const signedTransaction = await signTransaction(tx);\n if (!base58) throw new Error('bs58 dependency is required');\n return base58.encode(\n signedTransaction.serialize({\n requireAllSignatures: false,\n verifySignatures: false,\n })\n );\n },\n };\n}\n\nfunction getSolanaTransaction(\n data: string\n): Transaction | VersionedTransaction {\n if (!web3)\n throw new Error(\n '@solana/web3.js is not defined. Please install @solana/web3.js into your project'\n );\n\n if (!base58)\n throw new Error(\n 'bs58 is not defined. Please install bs58 into your project'\n );\n\n const parsedUInt8Array = base58.decode(data);\n const vtx = web3.VersionedTransaction.deserialize(parsedUInt8Array);\n if (vtx.version === 'legacy') return web3.Transaction.from(parsedUInt8Array);\n return vtx;\n}\n\nfunction getNearWalletHandlers({\n wallet,\n}: Pick<CoinflowPurchaseProps, 'wallet'>): Omit<\n IFrameMessageHandlers,\n 'handleHeightChange'\n> {\n const nearWallet = wallet as NearWallet;\n return {\n handleSendTransaction: async (transaction: string) => {\n const action = JSON.parse(Buffer.from(transaction, 'base64').toString());\n const executionOutcome = await nearWallet.signAndSendTransaction(action);\n if (!executionOutcome) throw new Error('Transaction did not send');\n const {transaction: transactionResult} = executionOutcome;\n return transactionResult.hash;\n },\n };\n}\n\nfunction getEvmWalletHandlers({\n wallet,\n}: Pick<CoinflowPurchaseProps, 'wallet'>): Omit<\n IFrameMessageHandlers,\n 'handleHeightChange'\n> {\n const evmWallet = wallet as EthWallet;\n return {\n handleSendTransaction: async (transaction: string) => {\n const tx = JSON.parse(Buffer.from(transaction, 'base64').toString());\n const {hash} = await evmWallet.sendTransaction(tx);\n return hash;\n },\n handleSignMessage: async (message: string) => {\n return evmWallet.signMessage(message);\n },\n };\n}\n","import {\n Component,\n ElementRef,\n HostListener,\n Input,\n ViewChild,\n} from '@angular/core';\nimport {\n CoinflowIFrameProps,\n CoinflowUtils,\n IFrameMessageHandlers,\n handleIFrameMessage,\n} from './common';\nimport {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';\n\n@Component({\n selector: 'lib-coinflow-iframe',\n standalone: true,\n imports: [],\n template: ` <iframe\n width=\"100%\"\n height=\"100%\"\n #iframe\n scrolling=\"{{ iframeProps?.handleHeightChange ? 'no' : 'yes' }}\"\n allow=\"payment;camera\"\n title=\"withdraw\"\n frameBorder=\"0\"\n [src]=\"dynamicUrl\"\n ></iframe>`,\n})\nexport class CoinflowIFrameComponent {\n @Input() iframeProps!: CoinflowIFrameProps;\n @Input() messageHandlers!: IFrameMessageHandlers;\n\n dynamicUrl?: SafeResourceUrl;\n @ViewChild('iframe') iframe?: ElementRef<HTMLIFrameElement>;\n\n constructor(private sanitizer: DomSanitizer) {}\n\n ngOnInit() {\n const coinflowUrl = CoinflowUtils.getCoinflowUrl(this.iframeProps);\n this.dynamicUrl =\n this.sanitizer.bypassSecurityTrustResourceUrl(coinflowUrl);\n }\n\n @HostListener('window:message', ['$event']) onPostMessage(event: any) {\n if (\n !event.origin.includes(\n CoinflowUtils.getCoinflowBaseUrl(this.iframeProps.env)\n )\n )\n return;\n\n const promise = handleIFrameMessage(event.data, this.messageHandlers);\n if (!promise) return;\n promise\n .then(this.sendMessage.bind(this))\n .catch(e => this.sendMessage('ERROR ' + e.message));\n }\n\n sendMessage(message: string) {\n if (!this.iframe || !this.iframe.nativeElement) return;\n this.iframe.nativeElement.contentWindow!.postMessage(message, '*');\n }\n}\n","import {Component, Input} from '@angular/core';\nimport {CoinflowIFrameComponent} from './coinflow-iframe.component';\nimport {\n CoinflowIFrameProps,\n CoinflowPurchaseProps,\n IFrameMessageHandlers,\n getHandlers,\n getWalletPubkey,\n CoinflowUtils,\n} from './common';\n\n@Component({\n selector: 'lib-coinflow-purchase',\n standalone: true,\n imports: [CoinflowIFrameComponent],\n template:\n ' <lib-coinflow-iframe ng-if=\"iframeProps && messageHandlers\" [iframeProps]=\"iframeProps!\" [messageHandlers]=\"messageHandlers!\"></lib-coinflow-iframe> ',\n})\nexport class CoinflowPurchaseComponent {\n @Input() purchaseProps!: CoinflowPurchaseProps;\n iframeProps?: CoinflowIFrameProps;\n messageHandlers?: IFrameMessageHandlers;\n\n ngOnInit() {\n const walletPubkey = getWalletPubkey(this.purchaseProps);\n this.messageHandlers = getHandlers(this.purchaseProps);\n this.messageHandlers.handleHeightChange =\n this.purchaseProps.handleHeightChange;\n\n this.iframeProps = {\n ...this.purchaseProps,\n walletPubkey,\n route: `/purchase/${this.purchaseProps?.merchantId}`,\n transaction: CoinflowUtils.getTransaction(this.purchaseProps),\n };\n }\n}\n","import {Component} from '@angular/core';\n\n@Component({\n selector: 'lib-coinflow-purchase-history',\n standalone: true,\n imports: [],\n template: ' <p>coinflow-purchase-history works!</p> ',\n})\nexport class CoinflowPurchaseHistoryComponent {}\n","import {Component} from '@angular/core';\n\n@Component({\n selector: 'lib-coinflow-purchase-protection',\n standalone: true,\n imports: [],\n template: ' <p>coinflow-purchase-protection works!</p> ',\n})\nexport class CoinflowPurchaseProtectionComponent {}\n","import {Component, Input} from '@angular/core';\nimport {\n CoinflowIFrameProps,\n CoinflowWithdrawProps,\n IFrameMessageHandlers,\n getHandlers,\n getWalletPubkey,\n} from './common';\nimport {CoinflowIFrameComponent} from './coinflow-iframe.component';\n\n@Component({\n selector: 'lib-coinflow-withdraw',\n standalone: true,\n imports: [CoinflowIFrameComponent],\n template:\n ' <lib-coinflow-iframe ng-if=\"iframeProps && messageHandlers\" [iframeProps]=\"iframeProps!\" [messageHandlers]=\"messageHandlers!\"></lib-coinflow-iframe> ',\n})\nexport class CoinflowWithdrawComponent {\n @Input() withdrawProps!: CoinflowWithdrawProps;\n iframeProps?: CoinflowIFrameProps;\n messageHandlers?: IFrameMessageHandlers;\n\n ngOnInit() {\n const walletPubkey = getWalletPubkey(this.withdrawProps);\n this.messageHandlers = getHandlers(this.withdrawProps);\n this.messageHandlers.handleHeightChange =\n this.withdrawProps.handleHeightChange;\n\n this.iframeProps = {\n ...this.withdrawProps,\n walletPubkey,\n route: `/withdraw/${this.withdrawProps?.merchantId}`,\n transaction: undefined,\n };\n }\n}\n","import {Component} from '@angular/core';\n\n@Component({\n selector: 'lib-coinflow-withdraw-history',\n standalone: true,\n imports: [],\n template: ' <p>coinflow-withdraw-history works!</p> ',\n})\nexport class CoinflowWithdrawHistoryComponent {}\n","/*\n * Public API Surface of coinflowlabs\n */\n\nexport * from './lib/coinflow-iframe.component';\nexport * from './lib/coinflow-purchase.component';\nexport * from './lib/coinflow-purchase-history.component';\nexport * from './lib/coinflow-purchase-protection.component';\nexport * from './lib/coinflow-withdraw.component';\nexport * from './lib/coinflow-withdraw-history.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAQA,IAAY,cAIX,CAAA;AAJD,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,GAIzB,EAAA,CAAA,CAAA,CAAA;AAED,IAAY,aAIX,CAAA;AAJD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,GAIxB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AAA,EAAA,IAAA,EAAA,CAAA,CAAA,EAAA;;2FAE1C,gCAAgC,EAAA,UAAA,EAAA,CAAA;kBAN5C,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACT,oBAAA,QAAQ,EAAE,+BAA+B;AACzC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,QAAQ,EAAE,2CAA2C;AACtD,iBAAA,CAAA;;;ACPD;;AAEG;;ACFH;;AAEG;;;;"}
1
+ {"version":3,"file":"coinflowlabs-angular.mjs","sources":["../../../projects/coinflowlabs/src/lib/common/CoinflowTypes.ts","../../../projects/coinflowlabs/src/lib/common/SolanaPeerDeps.ts","../../../projects/coinflowlabs/src/lib/common/CoinflowUtils.ts","../../../projects/coinflowlabs/src/lib/common/CoinflowLibMessageHandlers.ts","../../../projects/coinflowlabs/src/lib/coinflow-iframe.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-purchase.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-purchase-history.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-purchase-protection.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-withdraw.component.ts","../../../projects/coinflowlabs/src/lib/coinflow-withdraw-history.component.ts","../../../projects/coinflowlabs/src/public-api.ts","../../../projects/coinflowlabs/src/coinflowlabs-angular.ts"],"sourcesContent":["import type {\n Connection,\n VersionedTransaction,\n PublicKey,\n Signer,\n Transaction,\n} from '@solana/web3.js';\n\nexport enum SettlementType {\n Credits = 'Credits',\n USDC = 'USDC',\n Bank = 'Bank',\n}\n\nexport enum MerchantStyle {\n Rounded = 'rounded',\n Sharp = 'sharp',\n Pill = 'pill',\n}\n\nexport type MerchantTheme = {\n primary?: string;\n background?: string;\n backgroundAccent?: string;\n backgroundAccent2?: string;\n textColor?: string;\n textColorAccent?: string;\n textColorAction?: string;\n font?: string;\n style?: MerchantStyle;\n};\n\nexport interface CustomerInfo {\n name?: string;\n verificationId?: string;\n displayName?: string;\n address?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n ip?: string;\n lat?: string;\n lng?: string;\n}\n\n/** Coinflow Types **/\nexport type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base';\nexport type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';\n\nexport interface CoinflowTypes {\n merchantId: string;\n env?: CoinflowEnvs;\n loaderBackground?: string;\n blockchain: CoinflowBlockchain;\n handleHeightChange?: (height: string) => void;\n theme?: MerchantTheme;\n}\n\nexport type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n\nexport type OnSuccessMethod = (\n args:\n | {\n paymentId: string;\n hash?: string | undefined;\n }\n | string\n) => void | Promise<void>;\n\n/** Wallets **/\nexport interface SolanaWallet {\n publicKey: PublicKey | null;\n signTransaction?: <T extends Transaction | VersionedTransaction>(\n transaction: T\n ) => Promise<T>;\n sendTransaction: <T extends Transaction | VersionedTransaction>(\n transaction: T\n ) => Promise<string>;\n signMessage?: (message: Uint8Array) => Promise<Uint8Array>;\n}\n\nexport interface NearWallet {\n accountId: string;\n signAndSendTransaction: (transaction: unknown) => Promise<{\n transaction: {hash: string};\n }>;\n}\n\ntype AccessList = Array<{address: string; storageKeys: Array<string>}>;\ntype AccessListish =\n | AccessList\n | Array<[string, Array<string>]>\n | Record<string, Array<string>>;\n\nexport type EthWallet = {\n address: string | null | undefined;\n sendTransaction: (transaction: {\n to: string;\n from?: string;\n nonce?: Bytes | bigint | string | number;\n\n gasLimit?: Bytes | bigint | string | number;\n gasPrice?: Bytes | bigint | string | number;\n\n data?: BytesLike;\n value?: Bytes | bigint | string | number;\n chainId?: number;\n\n type?: number;\n accessList?: AccessListish;\n\n maxPriorityFeePerGas?: Bytes | bigint | string | number;\n maxFeePerGas?: Bytes | bigint | string | number;\n\n customData?: Record<string, any>;\n ccipReadEnabled?: boolean;\n }) => Promise<{hash: string}>;\n signMessage: (message: string) => Promise<string>;\n};\n\n/** History **/\nexport interface CoinflowSolanaHistoryProps extends CoinflowTypes {\n wallet: SolanaWallet;\n connection: Connection;\n blockchain: 'solana';\n}\n\nexport interface CoinflowNearHistoryProps extends CoinflowTypes {\n wallet: NearWallet;\n blockchain: 'near';\n}\n\nexport interface CoinflowEvmHistoryProps extends CoinflowTypes {\n wallet: EthWallet;\n}\n\nexport interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {\n blockchain: 'eth';\n}\n\nexport interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {\n blockchain: 'polygon';\n}\n\nexport interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {\n blockchain: 'base';\n}\n\nexport type CoinflowHistoryProps =\n | CoinflowSolanaHistoryProps\n | CoinflowNearHistoryProps\n | CoinflowPolygonHistoryProps\n | CoinflowEthHistoryProps\n | CoinflowBaseHistoryProps;\n\n/** Transactions **/\n\nexport type NearFtTransferCallAction = {\n methodName: 'ft_transfer_call';\n args: object;\n gas: string;\n deposit: string;\n};\n\ntype Bytes = ArrayLike<number>;\ntype BytesLike = Bytes | string;\n\n/** Purchase **/\n\nexport type ChargebackProtectionData = ChargebackProtectionItem[];\n\nexport interface ChargebackProtectionItem {\n /**\n * The name of the product\n */\n productName: string;\n /**\n * The product type. Possible values include: inGameProduct, gameOfSkill, dataStorage, computingResources, sportsTicket, eSportsTicket, musicTicket, conferenceTicket, virtualSportsTicket, virtualESportsTicket, virtualMusicTicket, virtualConferenceTicket, alcohol, DLC, subscription, fundACause, realEstate, computingContract, digitalArt, topUp\n */\n productType:\n | 'inGameProduct'\n | 'gameOfSkill'\n | 'dataStorage'\n | 'computingResources'\n | 'sportsTicket'\n | 'eSportsTicket'\n | 'musicTicket'\n | 'conferenceTicket'\n | 'virtualSportsTicket'\n | 'virtualESportsTicket'\n | 'virtualMusicTicket'\n | 'virtualConferenceTicket'\n | 'alcohol'\n | 'DLC'\n | 'subscription'\n | 'fundACause'\n | 'realEstate'\n | 'computingContract'\n | 'digitalArt'\n | 'topUp'\n | 'ownershipContract';\n /**\n * The item's list price\n */\n /**\n * The number of units sold\n */\n quantity: number;\n /**\n * Any additional data that the store can provide on the product, e.g. description, link to image, etc.\n */\n rawProductData?: {[key: string]: any};\n}\n\nexport interface CoinflowCommonPurchaseProps extends CoinflowTypes {\n amount?: number | string;\n onSuccess?: OnSuccessMethod;\n webhookInfo?: object;\n email?: string;\n chargebackProtectionData?: ChargebackProtectionData;\n planCode?: string;\n disableApplePay?: boolean;\n disableGooglePay?: boolean;\n customerInfo?: CustomerInfo;\n settlementType?: SettlementType;\n authOnly?: boolean;\n deviceId?: string;\n jwtToken?: string;\n}\n\nexport interface CoinflowSolanaPurchaseProps\n extends CoinflowCommonPurchaseProps {\n wallet: SolanaWallet;\n transaction?: Transaction | VersionedTransaction;\n partialSigners?: Signer[];\n debugTx?: boolean;\n connection: Connection;\n blockchain: 'solana';\n token?: PublicKey | string;\n supportsVersionedTransactions?: boolean;\n rent?: {lamports: string | number};\n nativeSolToConvert?: {lamports: string | number};\n}\n\nexport interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {\n wallet: NearWallet;\n blockchain: 'near';\n action?: NearFtTransferCallAction;\n nearDeposit?: string;\n}\n\nexport interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {\n transaction?: EvmTransactionData;\n token?: string;\n wallet: EthWallet;\n}\n\nexport interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {\n blockchain: 'polygon';\n}\n\nexport interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {\n blockchain: 'eth';\n}\n\nexport interface CoinflowBasePurchaseProps extends CoinflowEvmPurchaseProps {\n blockchain: 'base';\n}\n\nexport type CoinflowPurchaseProps =\n | CoinflowSolanaPurchaseProps\n | CoinflowNearPurchaseProps\n | CoinflowPolygonPurchaseProps\n | CoinflowEthPurchaseProps\n | CoinflowBasePurchaseProps;\n\n/** Withdraw **/\n\nexport interface CoinflowCommonWithdrawProps extends CoinflowTypes {\n onSuccess?: OnSuccessMethod;\n tokens?: string[];\n lockDefaultToken?: boolean;\n amount?: number;\n email?: string;\n bankAccountLinkRedirect?: string;\n additionalWallets?: {\n wallet: string;\n blockchain: 'solana' | 'eth' | 'near' | 'polygon';\n }[];\n supportsVersionedTransactions?: boolean;\n lockAmount?: boolean;\n transactionSigner?: string;\n}\n\nexport interface CoinflowSolanaWithdrawProps\n extends CoinflowCommonWithdrawProps {\n wallet: SolanaWallet;\n connection: Connection;\n blockchain: 'solana';\n}\n\nexport interface CoinflowNearWithdrawProps extends CoinflowCommonWithdrawProps {\n wallet: NearWallet;\n blockchain: 'near';\n}\n\nexport interface CoinflowEvmWithdrawProps extends CoinflowCommonWithdrawProps {\n wallet: EthWallet;\n usePermit?: boolean;\n}\n\nexport interface CoinflowEthWithdrawProps extends CoinflowEvmWithdrawProps {\n blockchain: 'eth';\n usePermit?: boolean;\n}\n\nexport interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {\n blockchain: 'polygon';\n}\n\nexport interface CoinflowBaseWithdrawProps extends CoinflowEvmWithdrawProps {\n blockchain: 'base';\n}\n\nexport type CoinflowWithdrawProps =\n | CoinflowSolanaWithdrawProps\n | CoinflowNearWithdrawProps\n | CoinflowEthWithdrawProps\n | CoinflowPolygonWithdrawProps\n | CoinflowBaseWithdrawProps;\n\nexport interface CommonEvmRedeem {\n waitForHash?: boolean;\n}\n\nexport interface NormalRedeem extends CommonEvmRedeem {\n transaction: {to: string; data: string};\n}\n\nexport interface KnownTokenIdRedeem extends NormalRedeem {\n nftContract: string;\n nftId: string;\n}\n\nexport interface SafeMintRedeem extends NormalRedeem {\n type: 'safeMint';\n nftContract?: string;\n}\n\nexport interface ReturnedTokenIdRedeem extends NormalRedeem {\n type: 'returned';\n nftContract?: string;\n}\n\ntype ReservoirNftIdItem = Omit<KnownTokenIdRedeem, keyof NormalRedeem>;\ninterface ReservoirOrderIdItem {\n orderId: string;\n}\ntype ReservoirItem = ReservoirNftIdItem | ReservoirOrderIdItem;\ntype ReservoirItems = ReservoirItem | ReservoirItem[];\n\nexport interface ReservoirRedeem extends CommonEvmRedeem {\n type: 'reservoir';\n items: ReservoirItems;\n}\n\nexport type EvmTransactionData =\n | SafeMintRedeem\n | ReturnedTokenIdRedeem\n | ReservoirRedeem\n | KnownTokenIdRedeem\n | NormalRedeem;\n\nexport interface CoinflowIFrameProps\n extends Omit<CoinflowTypes, 'merchantId'>,\n Pick<\n CoinflowCommonPurchaseProps,\n | 'chargebackProtectionData'\n | 'webhookInfo'\n | 'amount'\n | 'customerInfo'\n | 'settlementType'\n | 'email'\n | 'planCode'\n | 'deviceId'\n | 'jwtToken'\n >,\n Pick<\n CoinflowCommonWithdrawProps,\n | 'bankAccountLinkRedirect'\n | 'additionalWallets'\n | 'transactionSigner'\n | 'lockAmount'\n | 'lockDefaultToken'\n >,\n Pick<CoinflowEvmPurchaseProps, 'authOnly'>,\n Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {\n walletPubkey: string | null | undefined;\n route: string;\n routePrefix?: string;\n transaction?: string;\n tokens?: string[] | PublicKey[];\n supportsVersionedTransactions?: boolean;\n nearDeposit?: string;\n merchantCss?: string;\n color?: 'white' | 'black';\n disableApplePay?: boolean;\n disableGooglePay?: boolean;\n theme?: MerchantTheme;\n usePermit?: boolean;\n}\n","// This works in angular, but not react\n// let web3: typeof import('@solana/web3.js') | undefined;\n// let base58: typeof import('bs58') | undefined;\n//\n// try {\n// web3 = require('@solana/web3.js');\n// base58 = require('bs58');\n// } catch (e) {}\n//\n// export {web3, base58};\n\n// This works in react, but not angular\nimport * as SolanaWeb3Js from '@solana/web3.js';\nimport base58Imported from 'bs58';\n\nconst web3: typeof SolanaWeb3Js | undefined = SolanaWeb3Js;\nconst base58: typeof base58Imported | undefined = base58Imported;\nexport {web3, base58};\n","import {\n CoinflowBlockchain,\n CoinflowEnvs,\n CoinflowIFrameProps,\n CoinflowPurchaseProps,\n} from './CoinflowTypes';\nimport {web3, base58} from './SolanaPeerDeps';\nimport LZString from 'lz-string';\n\nexport class CoinflowUtils {\n env: CoinflowEnvs;\n url: string;\n\n constructor(env?: CoinflowEnvs) {\n this.env = env ?? 'prod';\n if (this.env === 'prod') this.url = 'https://api.coinflow.cash';\n else if (this.env === 'local') this.url = 'http://localhost:5000';\n else this.url = `https://api-${this.env}.coinflow.cash`;\n }\n\n async getNSurePartnerId(merchantId: string): Promise<string | undefined> {\n return fetch(this.url + `/merchant/view/${merchantId}`)\n .then(response => response.json())\n .then(\n (json: {\n nSurePartnerId: string | undefined;\n nSureSettings: {nSurePartnerId: string | undefined};\n }) => json.nSureSettings?.nSurePartnerId || json.nSurePartnerId\n )\n .catch(e => {\n console.error(e);\n return undefined;\n });\n }\n\n async getCreditBalance(\n publicKey: string,\n merchantId: string,\n blockchain: 'solana' | 'near'\n ): Promise<{cents: number}> {\n const response = await fetch(\n this.url + `/api/customer/balances/${merchantId}`,\n {\n method: 'GET',\n headers: {\n 'x-coinflow-auth-wallet': publicKey,\n 'x-coinflow-auth-blockchain': blockchain,\n },\n }\n );\n const {credits} = await response.json();\n return credits;\n }\n\n static getCoinflowBaseUrl(env?: CoinflowEnvs): string {\n if (!env || env === 'prod') return 'https://coinflow.cash';\n if (env === 'local') return 'http://localhost:3000';\n\n return `https://${env}.coinflow.cash`;\n }\n\n static getCoinflowApiUrl(env?: CoinflowEnvs): string {\n if (!env || env === 'prod') return 'https://api.coinflow.cash';\n if (env === 'local') return 'http://localhost:5000';\n\n return `https://api-${env}.coinflow.cash`;\n }\n\n static getCoinflowUrl({\n walletPubkey,\n route,\n routePrefix,\n env,\n amount,\n transaction,\n blockchain,\n supportsVersionedTransactions,\n webhookInfo,\n email,\n loaderBackground,\n handleHeightChange,\n bankAccountLinkRedirect,\n additionalWallets,\n nearDeposit,\n chargebackProtectionData,\n merchantCss,\n color,\n rent,\n lockDefaultToken,\n token,\n tokens,\n planCode,\n disableApplePay,\n disableGooglePay,\n customerInfo,\n settlementType,\n lockAmount,\n nativeSolToConvert,\n theme,\n usePermit,\n transactionSigner,\n authOnly,\n deviceId,\n jwtToken,\n }: CoinflowIFrameProps): string {\n const prefix = routePrefix\n ? `/${routePrefix}/${blockchain}`\n : `/${blockchain}`;\n const url = new URL(prefix + route, CoinflowUtils.getCoinflowBaseUrl(env));\n url.searchParams.append('pubkey', walletPubkey!);\n\n if (transaction) {\n url.searchParams.append('transaction', transaction);\n }\n if (amount) {\n url.searchParams.append('amount', amount.toString());\n }\n\n if (supportsVersionedTransactions) {\n url.searchParams.append('supportsVersionedTransactions', 'true');\n }\n\n if (webhookInfo) {\n url.searchParams.append(\n 'webhookInfo',\n LZString.compressToEncodedURIComponent(JSON.stringify(webhookInfo))\n );\n }\n\n if (theme) {\n url.searchParams.append(\n 'theme',\n LZString.compressToEncodedURIComponent(JSON.stringify(theme))\n );\n }\n\n if (customerInfo) {\n url.searchParams.append(\n 'customerInfo',\n LZString.compressToEncodedURIComponent(JSON.stringify(customerInfo))\n );\n }\n\n if (email) {\n url.searchParams.append('email', email);\n }\n\n if (token) {\n url.searchParams.append('token', token.toString());\n }\n\n if (tokens) {\n url.searchParams.append('tokens', tokens.toString());\n }\n\n if (loaderBackground) {\n url.searchParams.append('loaderBackground', loaderBackground);\n }\n\n if (handleHeightChange) {\n url.searchParams.append('useHeightChange', 'true');\n }\n\n if (bankAccountLinkRedirect) {\n url.searchParams.append(\n 'bankAccountLinkRedirect',\n bankAccountLinkRedirect\n );\n }\n\n if (additionalWallets)\n url.searchParams.append(\n 'additionalWallets',\n LZString.compressToEncodedURIComponent(\n JSON.stringify(additionalWallets)\n )\n );\n\n if (nearDeposit) url.searchParams.append('nearDeposit', nearDeposit);\n\n if (chargebackProtectionData)\n url.searchParams.append(\n 'chargebackProtectionData',\n LZString.compressToEncodedURIComponent(\n JSON.stringify(chargebackProtectionData)\n )\n );\n if (deviceId) {\n url.searchParams.append('deviceId', deviceId);\n } else {\n if (typeof window !== 'undefined') {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n const deviceId = window?.nSureSDK?.getDeviceId();\n if (deviceId) url.searchParams.append('deviceId', deviceId);\n }\n }\n\n if (merchantCss) url.searchParams.append('merchantCss', merchantCss);\n if (color) url.searchParams.append('color', color);\n if (rent) url.searchParams.append('rent', rent.lamports.toString());\n if (nativeSolToConvert)\n url.searchParams.append(\n 'nativeSolToConvert',\n nativeSolToConvert.lamports.toString()\n );\n if (lockDefaultToken) url.searchParams.append('lockDefaultToken', 'true');\n if (planCode) url.searchParams.append('planCode', planCode);\n\n if (disableApplePay) url.searchParams.append('disableApplePay', 'true');\n if (disableGooglePay) url.searchParams.append('disableGooglePay', 'true');\n if (settlementType)\n url.searchParams.append('settlementType', settlementType);\n\n if (lockAmount) url.searchParams.append('lockAmount', 'true');\n\n if (usePermit === false) url.searchParams.append('usePermit', 'false');\n if (transactionSigner)\n url.searchParams.append('transactionSigner', transactionSigner);\n if (authOnly === true) url.searchParams.append('authOnly', 'true');\n if (jwtToken) url.searchParams.append('jwtToken', jwtToken);\n\n return url.toString();\n }\n\n static getTransaction(props: CoinflowPurchaseProps): string | undefined {\n return this.byBlockchain<() => string | undefined>(props.blockchain, {\n solana: () => {\n if (!('transaction' in props)) return undefined;\n const {transaction} = props;\n if (!web3)\n throw new Error('@solana/web3.js dependency is required for Solana');\n if (!base58) throw new Error('bs58 dependency is required for Solana');\n if (transaction instanceof web3.Transaction)\n return base58.encode(\n transaction.serialize({\n requireAllSignatures: false,\n verifySignatures: false,\n })\n );\n\n if (transaction instanceof web3.VersionedTransaction)\n return base58.encode(transaction.serialize());\n\n return undefined;\n },\n polygon: () => {\n if (!('transaction' in props)) return undefined;\n const {transaction} = props;\n return LZString.compressToEncodedURIComponent(\n JSON.stringify(transaction)\n );\n },\n eth: () => {\n if (!('transaction' in props)) return undefined;\n const {transaction} = props;\n return LZString.compressToEncodedURIComponent(\n JSON.stringify(transaction)\n );\n },\n base: () => {\n if (!('transaction' in props)) return undefined;\n const {transaction} = props;\n return LZString.compressToEncodedURIComponent(\n JSON.stringify(transaction)\n );\n },\n near: () => {\n if (!('action' in props)) return undefined;\n const {action} = props;\n return LZString.compressToEncodedURIComponent(JSON.stringify(action));\n },\n })();\n }\n\n static byBlockchain<T>(\n blockchain: CoinflowBlockchain,\n args: {solana: T; near: T; eth: T; polygon: T; base: T}\n ): T {\n switch (blockchain) {\n case 'solana':\n return args.solana;\n case 'near':\n return args.near;\n case 'polygon':\n return args.polygon;\n case 'eth':\n return args.eth;\n case 'base':\n return args.base;\n default:\n throw new Error('blockchain not supported!');\n }\n }\n}\n","import {\n CoinflowPurchaseProps,\n EthWallet,\n NearWallet,\n OnSuccessMethod,\n SolanaWallet,\n} from './CoinflowTypes';\nimport {CoinflowUtils} from './CoinflowUtils';\nimport type {Transaction, VersionedTransaction} from '@solana/web3.js';\nimport {web3, base58} from './SolanaPeerDeps';\n\nexport type WalletCall =\n | {method: IFrameMessageMethods; data: string}\n | SuccessWalletCall;\n\ntype SuccessWalletCall = {\n method: IFrameMessageMethods.Success;\n data: string;\n info: {paymentId: string; hash?: string};\n};\n\nexport interface IFrameMessageHandlers {\n handleSendTransaction: (transaction: string) => Promise<string>;\n handleSignMessage?: (message: string) => Promise<string>;\n handleSignTransaction?: (transaction: string) => Promise<string>;\n handleHeightChange?: (height: string) => void;\n onSuccess: OnSuccessMethod | undefined;\n}\n\nenum IFrameMessageMethods {\n SignMessage = 'signMessage',\n SignTransaction = 'signTransaction',\n SendTransaction = 'sendTransaction',\n HeightChange = 'heightChange',\n Success = 'success',\n}\n\nexport function getWalletPubkey({\n wallet,\n}: Pick<CoinflowPurchaseProps, 'wallet'>): string | null | undefined {\n if ('publicKey' in wallet) {\n return wallet.publicKey!.toString();\n }\n\n if ('address' in wallet) {\n return wallet.address;\n }\n\n if ('accountId' in wallet) {\n return wallet.accountId;\n }\n\n return null;\n}\n\nexport function handleIFrameMessage(\n rawMessage: string,\n handlers: IFrameMessageHandlers\n): Promise<string> | void {\n let walletCall: WalletCall;\n try {\n walletCall = JSON.parse(rawMessage);\n if (!('method' in walletCall) || !('data' in walletCall)) return;\n } catch (e) {\n console.error('handleIFrameMessage JSON parse', e);\n return;\n }\n\n const {data, method} = walletCall;\n switch (method) {\n case IFrameMessageMethods.SignMessage:\n if (!handlers.handleSignMessage) return;\n return handlers.handleSignMessage(data);\n case IFrameMessageMethods.SignTransaction:\n if (!handlers.handleSignTransaction) return;\n return handlers.handleSignTransaction(data);\n case IFrameMessageMethods.SendTransaction:\n return handlers.handleSendTransaction(data);\n case IFrameMessageMethods.HeightChange:\n if (!handlers.handleHeightChange) return;\n return handlers.handleHeightChange(data);\n case IFrameMessageMethods.Success:\n if (!handlers.onSuccess) return;\n handlers.onSuccess((walletCall as SuccessWalletCall).info);\n return;\n }\n\n console.warn(\n `Didn't expect to get here, handleIFrameMessage method:${method} is not one of ${Object.values(IFrameMessageMethods)}`\n );\n}\n\nexport function getHandlers(\n props: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain' | 'onSuccess'>\n): Omit<IFrameMessageHandlers, 'handleHeightChange'> {\n return CoinflowUtils.byBlockchain(props.blockchain, {\n solana: () => getSolanaWalletHandlers(props),\n near: () => getNearWalletHandlers(props),\n eth: () => getEvmWalletHandlers(props),\n polygon: () => getEvmWalletHandlers(props),\n base: () => getEvmWalletHandlers(props),\n })();\n}\n\nfunction getSolanaWalletHandlers({\n wallet,\n onSuccess,\n}: Pick<CoinflowPurchaseProps, 'wallet' | 'onSuccess'>): Omit<\n IFrameMessageHandlers,\n 'handleHeightChange'\n> {\n return {\n handleSendTransaction: async (transaction: string) => {\n const tx = getSolanaTransaction(transaction);\n return await (wallet as SolanaWallet).sendTransaction(tx);\n },\n handleSignMessage: async (message: string) => {\n const signMessage = (wallet as SolanaWallet).signMessage;\n if (!signMessage) {\n throw new Error('signMessage is not supported by this wallet');\n }\n\n const signedMessage = await signMessage(\n new TextEncoder().encode(message)\n );\n if (!base58) throw new Error('bs58 dependency is required');\n return base58.encode(signedMessage);\n },\n handleSignTransaction: async (transaction: string) => {\n const signTransaction = (wallet as SolanaWallet).signTransaction;\n if (!signTransaction) {\n throw new Error('signTransaction is not supported by this wallet');\n }\n const tx = getSolanaTransaction(transaction);\n const signedTransaction = await signTransaction(tx);\n if (!base58) throw new Error('bs58 dependency is required');\n return base58.encode(\n signedTransaction.serialize({\n requireAllSignatures: false,\n verifySignatures: false,\n })\n );\n },\n onSuccess,\n };\n}\n\nfunction getSolanaTransaction(\n data: string\n): Transaction | VersionedTransaction {\n if (!web3)\n throw new Error(\n '@solana/web3.js is not defined. Please install @solana/web3.js into your project'\n );\n\n if (!base58)\n throw new Error(\n 'bs58 is not defined. Please install bs58 into your project'\n );\n\n const parsedUInt8Array = base58.decode(data);\n const vtx = web3.VersionedTransaction.deserialize(parsedUInt8Array);\n if (vtx.version === 'legacy') return web3.Transaction.from(parsedUInt8Array);\n return vtx;\n}\n\nfunction getNearWalletHandlers({\n wallet,\n onSuccess,\n}: Pick<CoinflowPurchaseProps, 'wallet' | 'onSuccess'>): Omit<\n IFrameMessageHandlers,\n 'handleHeightChange'\n> {\n const nearWallet = wallet as NearWallet;\n return {\n handleSendTransaction: async (transaction: string) => {\n const action = JSON.parse(Buffer.from(transaction, 'base64').toString());\n const executionOutcome = await nearWallet.signAndSendTransaction(action);\n if (!executionOutcome) throw new Error('Transaction did not send');\n const {transaction: transactionResult} = executionOutcome;\n return transactionResult.hash;\n },\n onSuccess,\n };\n}\n\nfunction getEvmWalletHandlers({\n wallet,\n onSuccess,\n}: Pick<CoinflowPurchaseProps, 'wallet' | 'onSuccess'>): Omit<\n IFrameMessageHandlers,\n 'handleHeightChange'\n> {\n const evmWallet = wallet as EthWallet;\n return {\n handleSendTransaction: async (transaction: string) => {\n const tx = JSON.parse(Buffer.from(transaction, 'base64').toString());\n const {hash} = await evmWallet.sendTransaction(tx);\n return hash;\n },\n handleSignMessage: async (message: string) => {\n return evmWallet.signMessage(message);\n },\n onSuccess,\n };\n}\n","import {\n Component,\n ElementRef,\n HostListener,\n Input,\n ViewChild,\n} from '@angular/core';\nimport {\n CoinflowIFrameProps,\n CoinflowUtils,\n IFrameMessageHandlers,\n handleIFrameMessage,\n} from './common';\nimport {DomSanitizer, SafeResourceUrl} from '@angular/platform-browser';\n\n@Component({\n selector: 'lib-coinflow-iframe',\n standalone: true,\n imports: [],\n template: ` <iframe\n width=\"100%\"\n height=\"100%\"\n #iframe\n scrolling=\"{{ iframeProps?.handleHeightChange ? 'no' : 'yes' }}\"\n allow=\"payment;camera\"\n title=\"withdraw\"\n frameBorder=\"0\"\n [src]=\"dynamicUrl\"\n ></iframe>`,\n})\nexport class CoinflowIFrameComponent {\n @Input() iframeProps!: CoinflowIFrameProps;\n @Input() messageHandlers!: IFrameMessageHandlers;\n\n dynamicUrl?: SafeResourceUrl;\n @ViewChild('iframe') iframe?: ElementRef<HTMLIFrameElement>;\n\n constructor(private sanitizer: DomSanitizer) {}\n\n ngOnInit() {\n const coinflowUrl = CoinflowUtils.getCoinflowUrl(this.iframeProps);\n this.dynamicUrl =\n this.sanitizer.bypassSecurityTrustResourceUrl(coinflowUrl);\n }\n\n @HostListener('window:message', ['$event']) onPostMessage(event: any) {\n if (\n !event.origin.includes(\n CoinflowUtils.getCoinflowBaseUrl(this.iframeProps.env)\n )\n )\n return;\n\n const promise = handleIFrameMessage(event.data, this.messageHandlers);\n if (!promise) return;\n promise\n .then(this.sendMessage.bind(this))\n .catch(e => this.sendMessage('ERROR ' + e.message));\n }\n\n sendMessage(message: string) {\n if (!this.iframe || !this.iframe.nativeElement) return;\n this.iframe.nativeElement.contentWindow!.postMessage(message, '*');\n }\n}\n","import {Component, Input} from '@angular/core';\nimport {CoinflowIFrameComponent} from './coinflow-iframe.component';\nimport {\n CoinflowIFrameProps,\n CoinflowPurchaseProps,\n IFrameMessageHandlers,\n getHandlers,\n getWalletPubkey,\n CoinflowUtils,\n} from './common';\n\n@Component({\n selector: 'lib-coinflow-purchase',\n standalone: true,\n imports: [CoinflowIFrameComponent],\n template:\n ' <lib-coinflow-iframe ng-if=\"iframeProps && messageHandlers\" [iframeProps]=\"iframeProps!\" [messageHandlers]=\"messageHandlers!\"></lib-coinflow-iframe> ',\n})\nexport class CoinflowPurchaseComponent {\n @Input() purchaseProps!: CoinflowPurchaseProps;\n iframeProps?: CoinflowIFrameProps;\n messageHandlers?: IFrameMessageHandlers;\n\n ngOnInit() {\n const walletPubkey = getWalletPubkey(this.purchaseProps);\n this.messageHandlers = getHandlers(this.purchaseProps);\n this.messageHandlers.handleHeightChange =\n this.purchaseProps.handleHeightChange;\n\n this.iframeProps = {\n ...this.purchaseProps,\n walletPubkey,\n route: `/purchase/${this.purchaseProps?.merchantId}`,\n transaction: CoinflowUtils.getTransaction(this.purchaseProps),\n };\n }\n}\n","import {Component} from '@angular/core';\n\n@Component({\n selector: 'lib-coinflow-purchase-history',\n standalone: true,\n imports: [],\n template: ' <p>coinflow-purchase-history works!</p> ',\n})\nexport class CoinflowPurchaseHistoryComponent {}\n","import {Component} from '@angular/core';\n\n@Component({\n selector: 'lib-coinflow-purchase-protection',\n standalone: true,\n imports: [],\n template: ' <p>coinflow-purchase-protection works!</p> ',\n})\nexport class CoinflowPurchaseProtectionComponent {}\n","import {Component, Input} from '@angular/core';\nimport {\n CoinflowIFrameProps,\n CoinflowWithdrawProps,\n IFrameMessageHandlers,\n getHandlers,\n getWalletPubkey,\n} from './common';\nimport {CoinflowIFrameComponent} from './coinflow-iframe.component';\n\n@Component({\n selector: 'lib-coinflow-withdraw',\n standalone: true,\n imports: [CoinflowIFrameComponent],\n template:\n ' <lib-coinflow-iframe ng-if=\"iframeProps && messageHandlers\" [iframeProps]=\"iframeProps!\" [messageHandlers]=\"messageHandlers!\"></lib-coinflow-iframe> ',\n})\nexport class CoinflowWithdrawComponent {\n @Input() withdrawProps!: CoinflowWithdrawProps;\n iframeProps?: CoinflowIFrameProps;\n messageHandlers?: IFrameMessageHandlers;\n\n ngOnInit() {\n const walletPubkey = getWalletPubkey(this.withdrawProps);\n this.messageHandlers = getHandlers(this.withdrawProps);\n this.messageHandlers.handleHeightChange =\n this.withdrawProps.handleHeightChange;\n\n this.iframeProps = {\n ...this.withdrawProps,\n walletPubkey,\n route: `/withdraw/${this.withdrawProps?.merchantId}`,\n transaction: undefined,\n };\n }\n}\n","import {Component} from '@angular/core';\n\n@Component({\n selector: 'lib-coinflow-withdraw-history',\n standalone: true,\n imports: [],\n template: ' <p>coinflow-withdraw-history works!</p> ',\n})\nexport class CoinflowWithdrawHistoryComponent {}\n","/*\n * Public API Surface of coinflowlabs\n */\n\nexport * from './lib/coinflow-iframe.component';\nexport * from './lib/coinflow-purchase.component';\nexport * from './lib/coinflow-purchase-history.component';\nexport * from './lib/coinflow-purchase-protection.component';\nexport * from './lib/coinflow-withdraw.component';\nexport * from './lib/coinflow-withdraw-history.component';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;AAQA,IAAY,cAIX,CAAA;AAJD,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACb,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EAJW,cAAc,KAAd,cAAc,GAIzB,EAAA,CAAA,CAAA,CAAA;AAED,IAAY,aAIX,CAAA;AAJD,CAAA,UAAY,aAAa,EAAA;AACvB,IAAA,aAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnB,IAAA,aAAA,CAAA,OAAA,CAAA,GAAA,OAAe,CAAA;AACf,IAAA,aAAA,CAAA,MAAA,CAAA,GAAA,MAAa,CAAA;AACf,CAAC,EAJW,aAAa,KAAb,aAAa,GAIxB,EAAA,CAAA,CAAA;;AClBD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAIA,MAAM,IAAI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AI;AAChB,oBAAA,OAAO,EAAE,EAAE;AACX,oBAAA,QAAQ,EAAE,2CAA2C;AACtD,iBAAA,CAAA;;;ACPD;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1,21 +1,31 @@
1
- import { CoinflowPurchaseProps } from './CoinflowTypes';
1
+ import { CoinflowPurchaseProps, OnSuccessMethod } from './CoinflowTypes';
2
2
  export type WalletCall = {
3
3
  method: IFrameMessageMethods;
4
4
  data: string;
5
+ } | SuccessWalletCall;
6
+ type SuccessWalletCall = {
7
+ method: IFrameMessageMethods.Success;
8
+ data: string;
9
+ info: {
10
+ paymentId: string;
11
+ hash?: string;
12
+ };
5
13
  };
6
14
  export interface IFrameMessageHandlers {
7
15
  handleSendTransaction: (transaction: string) => Promise<string>;
8
16
  handleSignMessage?: (message: string) => Promise<string>;
9
17
  handleSignTransaction?: (transaction: string) => Promise<string>;
10
18
  handleHeightChange?: (height: string) => void;
19
+ onSuccess: OnSuccessMethod | undefined;
11
20
  }
12
21
  declare enum IFrameMessageMethods {
13
22
  SignMessage = "signMessage",
14
23
  SignTransaction = "signTransaction",
15
24
  SendTransaction = "sendTransaction",
16
- HeightChange = "heightChange"
25
+ HeightChange = "heightChange",
26
+ Success = "success"
17
27
  }
18
28
  export declare function getWalletPubkey({ wallet, }: Pick<CoinflowPurchaseProps, 'wallet'>): string | null | undefined;
19
29
  export declare function handleIFrameMessage(rawMessage: string, handlers: IFrameMessageHandlers): Promise<string> | void;
20
- export declare function getHandlers({ wallet, blockchain, }: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain'>): Omit<IFrameMessageHandlers, 'handleHeightChange'>;
30
+ export declare function getHandlers(props: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain' | 'onSuccess'>): Omit<IFrameMessageHandlers, 'handleHeightChange'>;
21
31
  export {};