@coinflowlabs/angular 0.0.2 → 0.0.4
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinflowlabs/angular",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"clean": "rimraf ../../dist && rimraf ./src/lib/common",
|
|
6
6
|
"build": "npm run codegen && ng build coinflowlabs",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"bs58": "~5.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"tslib": "^2.
|
|
17
|
+
"tslib": "^2.6.2"
|
|
18
18
|
},
|
|
19
19
|
"peerDependenciesMeta": {
|
|
20
20
|
"@coinflowlabs/lib-common": {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type {
|
|
2
|
+
Connection,
|
|
3
|
+
VersionedTransaction,
|
|
4
|
+
PublicKey,
|
|
5
|
+
Signer,
|
|
6
|
+
Transaction,
|
|
7
|
+
} from '@solana/web3.js';
|
|
3
8
|
|
|
4
9
|
export enum SettlementType {
|
|
5
10
|
Credits = 'Credits',
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
CoinflowIFrameProps,
|
|
5
5
|
CoinflowPurchaseProps,
|
|
6
6
|
} from './CoinflowTypes';
|
|
7
|
-
import
|
|
8
|
-
import base58 from 'bs58';
|
|
7
|
+
import * as web3 from '@solana/web3.js';
|
|
8
|
+
import * as base58 from 'bs58';
|
|
9
9
|
|
|
10
10
|
export class CoinflowUtils {
|
|
11
11
|
env: CoinflowEnvs;
|
|
@@ -218,9 +218,10 @@ export class CoinflowUtils {
|
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
static getTransaction(props: CoinflowPurchaseProps): string | undefined {
|
|
221
|
-
if ('transaction' in props) {
|
|
221
|
+
if ('transaction' in props && props.transaction !== undefined) {
|
|
222
222
|
const {transaction} = props;
|
|
223
|
-
if (transaction instanceof Transaction) {
|
|
223
|
+
if (web3 && transaction instanceof web3.Transaction) {
|
|
224
|
+
if (!base58) throw new Error('bs58 dependency is required for Solana');
|
|
224
225
|
return base58.encode(
|
|
225
226
|
transaction.serialize({
|
|
226
227
|
requireAllSignatures: false,
|
|
@@ -229,14 +230,15 @@ export class CoinflowUtils {
|
|
|
229
230
|
);
|
|
230
231
|
}
|
|
231
232
|
|
|
232
|
-
if (transaction instanceof VersionedTransaction) {
|
|
233
|
+
if (web3 && transaction instanceof web3.VersionedTransaction) {
|
|
234
|
+
if (!base58) throw new Error('bs58 dependency is required for Solana');
|
|
233
235
|
return base58.encode(transaction.serialize());
|
|
234
236
|
}
|
|
235
237
|
|
|
236
238
|
return btoa(JSON.stringify(transaction));
|
|
237
239
|
}
|
|
238
240
|
|
|
239
|
-
if ('action' in props) {
|
|
241
|
+
if ('action' in props && props.action !== undefined) {
|
|
240
242
|
return btoa(JSON.stringify(props.action));
|
|
241
243
|
}
|
|
242
244
|
|