@coinflowlabs/angular 0.0.1 → 0.0.3
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/esm2022/coinflowlabs-angular.mjs +5 -0
- package/esm2022/lib/coinflow-iframe.component.mjs +67 -0
- package/esm2022/lib/coinflow-purchase-history.component.mjs +16 -0
- package/esm2022/lib/coinflow-purchase-protection.component.mjs +16 -0
- package/esm2022/lib/coinflow-purchase.component.mjs +32 -0
- package/esm2022/lib/coinflow-withdraw-history.component.mjs +16 -0
- package/esm2022/lib/coinflow-withdraw.component.mjs +32 -0
- package/esm2022/lib/common/CoinflowLibMessageHandlers.mjs +127 -0
- package/esm2022/lib/common/CoinflowTypes.mjs +13 -0
- package/esm2022/lib/common/CoinflowUtils.mjs +173 -0
- package/esm2022/lib/common/index.mjs +4 -0
- package/esm2022/public-api.mjs +10 -0
- package/fesm2022/coinflowlabs-angular.mjs +486 -0
- package/fesm2022/coinflowlabs-angular.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/coinflow-iframe.component.d.ts +17 -0
- package/lib/coinflow-purchase-history.component.d.ts +5 -0
- package/lib/coinflow-purchase-protection.component.d.ts +5 -0
- package/lib/coinflow-purchase.component.d.ts +10 -0
- package/lib/coinflow-withdraw-history.component.d.ts +5 -0
- package/lib/coinflow-withdraw.component.d.ts +10 -0
- package/lib/common/CoinflowLibMessageHandlers.d.ts +21 -0
- package/lib/common/CoinflowTypes.d.ts +287 -0
- package/lib/common/CoinflowUtils.d.ts +21 -0
- package/package.json +19 -8
- package/{src/public-api.ts → public-api.d.ts} +0 -4
- package/_update-notifier-last-checked +0 -0
- package/ng-package.json +0 -7
- package/src/lib/coinflow-iframe.component.ts +0 -63
- package/src/lib/coinflow-purchase-history.component.ts +0 -9
- package/src/lib/coinflow-purchase-protection.component.ts +0 -9
- package/src/lib/coinflow-purchase.component.ts +0 -37
- package/src/lib/coinflow-withdraw-history.component.ts +0 -9
- package/src/lib/coinflow-withdraw.component.ts +0 -36
- package/src/lib/common/CoinflowLibMessageHandlers.ts +0 -188
- package/src/lib/common/CoinflowTypes.ts +0 -398
- package/src/lib/common/CoinflowUtils.ts +0 -267
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/{src/lib/common/index.ts → lib/common/index.d.ts} +0 -0
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CoinflowPurchaseProps,
|
|
3
|
-
EthWallet,
|
|
4
|
-
NearWallet,
|
|
5
|
-
SolanaWallet,
|
|
6
|
-
} from './CoinflowTypes';
|
|
7
|
-
import {CoinflowUtils} from './CoinflowUtils';
|
|
8
|
-
import {Transaction, VersionedTransaction} from '@solana/web3.js';
|
|
9
|
-
import * as web3 from '@solana/web3.js';
|
|
10
|
-
import base58 from 'bs58';
|
|
11
|
-
|
|
12
|
-
export type WalletCall = {method: IFrameMessageMethods; data: string};
|
|
13
|
-
|
|
14
|
-
export interface IFrameMessageHandlers {
|
|
15
|
-
handleSendTransaction: (transaction: string) => Promise<string>;
|
|
16
|
-
handleSignMessage?: (message: string) => Promise<string>;
|
|
17
|
-
handleSignTransaction?: (transaction: string) => Promise<string>;
|
|
18
|
-
handleHeightChange?: (height: string) => void;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
enum IFrameMessageMethods {
|
|
22
|
-
SignMessage = 'signMessage',
|
|
23
|
-
SignTransaction = 'signTransaction',
|
|
24
|
-
SendTransaction = 'sendTransaction',
|
|
25
|
-
HeightChange = 'heightChange',
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export function getWalletPubkey({
|
|
29
|
-
wallet,
|
|
30
|
-
}: Pick<CoinflowPurchaseProps, 'wallet'>): string | null | undefined {
|
|
31
|
-
if ('publicKey' in wallet) {
|
|
32
|
-
return wallet.publicKey!.toString();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if ('address' in wallet) {
|
|
36
|
-
return wallet.address;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
if ('accountId' in wallet) {
|
|
40
|
-
return wallet.accountId;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function handleIFrameMessage(
|
|
47
|
-
rawMessage: string,
|
|
48
|
-
handlers: IFrameMessageHandlers
|
|
49
|
-
): Promise<string> | void {
|
|
50
|
-
let walletCall: WalletCall;
|
|
51
|
-
try {
|
|
52
|
-
walletCall = JSON.parse(rawMessage);
|
|
53
|
-
if (!('method' in walletCall) || !('data' in walletCall)) return;
|
|
54
|
-
} catch (e) {
|
|
55
|
-
console.error('handleIFrameMessage JSON parse', e);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const {data, method} = walletCall;
|
|
60
|
-
switch (method) {
|
|
61
|
-
case IFrameMessageMethods.SignMessage:
|
|
62
|
-
if (!handlers.handleSignMessage) return;
|
|
63
|
-
return handlers.handleSignMessage(data);
|
|
64
|
-
case IFrameMessageMethods.SignTransaction:
|
|
65
|
-
if (!handlers.handleSignTransaction) return;
|
|
66
|
-
return handlers.handleSignTransaction(data);
|
|
67
|
-
case IFrameMessageMethods.SendTransaction:
|
|
68
|
-
return handlers.handleSendTransaction(data);
|
|
69
|
-
case IFrameMessageMethods.HeightChange:
|
|
70
|
-
if (!handlers.handleHeightChange) return;
|
|
71
|
-
return handlers.handleHeightChange(data);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
console.warn(
|
|
75
|
-
`Didn't expect to get here, handleIFrameMessage method:${method} is not one of ${Object.values(IFrameMessageMethods)}`
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export function getHandlers({
|
|
80
|
-
wallet,
|
|
81
|
-
blockchain,
|
|
82
|
-
}: Pick<CoinflowPurchaseProps, 'wallet' | 'blockchain'>): Omit<
|
|
83
|
-
IFrameMessageHandlers,
|
|
84
|
-
'handleHeightChange'
|
|
85
|
-
> {
|
|
86
|
-
return CoinflowUtils.byBlockchain(blockchain, {
|
|
87
|
-
solana: () => getSolanaWalletHandlers({wallet}),
|
|
88
|
-
near: () => getNearWalletHandlers({wallet}),
|
|
89
|
-
eth: () => getEvmWalletHandlers({wallet}),
|
|
90
|
-
polygon: () => getEvmWalletHandlers({wallet}),
|
|
91
|
-
base: () => getEvmWalletHandlers({wallet}),
|
|
92
|
-
})();
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function getSolanaWalletHandlers({
|
|
96
|
-
wallet,
|
|
97
|
-
}: Pick<CoinflowPurchaseProps, 'wallet'>): Omit<
|
|
98
|
-
IFrameMessageHandlers,
|
|
99
|
-
'handleHeightChange'
|
|
100
|
-
> {
|
|
101
|
-
return {
|
|
102
|
-
handleSendTransaction: async (transaction: string) => {
|
|
103
|
-
const tx = getSolanaTransaction(transaction);
|
|
104
|
-
return (wallet as SolanaWallet).sendTransaction(tx);
|
|
105
|
-
},
|
|
106
|
-
handleSignMessage: async (message: string) => {
|
|
107
|
-
const signMessage = (wallet as SolanaWallet).signMessage;
|
|
108
|
-
if (!signMessage) {
|
|
109
|
-
throw new Error('signMessage is not supported by this wallet');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const signedMessage = await signMessage(
|
|
113
|
-
new TextEncoder().encode(message)
|
|
114
|
-
);
|
|
115
|
-
return base58.encode(signedMessage);
|
|
116
|
-
},
|
|
117
|
-
handleSignTransaction: async (transaction: string) => {
|
|
118
|
-
const signTransaction = (wallet as SolanaWallet).signTransaction;
|
|
119
|
-
if (!signTransaction) {
|
|
120
|
-
throw new Error('signTransaction is not supported by this wallet');
|
|
121
|
-
}
|
|
122
|
-
const tx = getSolanaTransaction(transaction);
|
|
123
|
-
const signedTransaction = await signTransaction(tx);
|
|
124
|
-
return base58.encode(
|
|
125
|
-
signedTransaction.serialize({
|
|
126
|
-
requireAllSignatures: false,
|
|
127
|
-
verifySignatures: false,
|
|
128
|
-
})
|
|
129
|
-
);
|
|
130
|
-
},
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function getSolanaTransaction(
|
|
135
|
-
data: string
|
|
136
|
-
): Transaction | VersionedTransaction {
|
|
137
|
-
if (!web3)
|
|
138
|
-
throw new Error(
|
|
139
|
-
'@solana/web3.js is not defined. Please install @solana/web3.js into your project'
|
|
140
|
-
);
|
|
141
|
-
|
|
142
|
-
if (!base58)
|
|
143
|
-
throw new Error(
|
|
144
|
-
'bs58 is not defined. Please install bs58 into your project'
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
const parsedUInt8Array = base58.decode(data);
|
|
148
|
-
const vtx = web3.VersionedTransaction.deserialize(parsedUInt8Array);
|
|
149
|
-
if (vtx.version === 'legacy') return web3.Transaction.from(parsedUInt8Array);
|
|
150
|
-
return vtx;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function getNearWalletHandlers({
|
|
154
|
-
wallet,
|
|
155
|
-
}: Pick<CoinflowPurchaseProps, 'wallet'>): Omit<
|
|
156
|
-
IFrameMessageHandlers,
|
|
157
|
-
'handleHeightChange'
|
|
158
|
-
> {
|
|
159
|
-
const nearWallet = wallet as NearWallet;
|
|
160
|
-
return {
|
|
161
|
-
handleSendTransaction: async (transaction: string) => {
|
|
162
|
-
const action = JSON.parse(Buffer.from(transaction, 'base64').toString());
|
|
163
|
-
const executionOutcome = await nearWallet.signAndSendTransaction(action);
|
|
164
|
-
if (!executionOutcome) throw new Error('Transaction did not send');
|
|
165
|
-
const {transaction: transactionResult} = executionOutcome;
|
|
166
|
-
return transactionResult.hash;
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function getEvmWalletHandlers({
|
|
172
|
-
wallet,
|
|
173
|
-
}: Pick<CoinflowPurchaseProps, 'wallet'>): Omit<
|
|
174
|
-
IFrameMessageHandlers,
|
|
175
|
-
'handleHeightChange'
|
|
176
|
-
> {
|
|
177
|
-
const evmWallet = wallet as EthWallet;
|
|
178
|
-
return {
|
|
179
|
-
handleSendTransaction: async (transaction: string) => {
|
|
180
|
-
const tx = JSON.parse(Buffer.from(transaction, 'base64').toString());
|
|
181
|
-
const {hash} = await evmWallet.sendTransaction(tx);
|
|
182
|
-
return hash;
|
|
183
|
-
},
|
|
184
|
-
handleSignMessage: async (message: string) => {
|
|
185
|
-
return evmWallet.signMessage(message);
|
|
186
|
-
},
|
|
187
|
-
};
|
|
188
|
-
}
|
|
@@ -1,398 +0,0 @@
|
|
|
1
|
-
import type {Connection, VersionedTransaction} from '@solana/web3.js';
|
|
2
|
-
import {PublicKey, Signer, Transaction} from '@solana/web3.js';
|
|
3
|
-
|
|
4
|
-
export enum SettlementType {
|
|
5
|
-
Credits = 'Credits',
|
|
6
|
-
USDC = 'USDC',
|
|
7
|
-
Bank = 'Bank',
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export enum MerchantStyle {
|
|
11
|
-
Rounded = 'rounded',
|
|
12
|
-
Sharp = 'sharp',
|
|
13
|
-
Pill = 'pill',
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type MerchantTheme = {
|
|
17
|
-
primary?: string;
|
|
18
|
-
background?: string;
|
|
19
|
-
backgroundAccent?: string;
|
|
20
|
-
backgroundAccent2?: string;
|
|
21
|
-
textColor?: string;
|
|
22
|
-
textColorAccent?: string;
|
|
23
|
-
textColorAction?: string;
|
|
24
|
-
font?: string;
|
|
25
|
-
style?: MerchantStyle;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export interface CustomerInfo {
|
|
29
|
-
name?: string;
|
|
30
|
-
verificationId?: string;
|
|
31
|
-
displayName?: string;
|
|
32
|
-
address?: string;
|
|
33
|
-
city?: string;
|
|
34
|
-
state?: string;
|
|
35
|
-
zip?: string;
|
|
36
|
-
country?: string;
|
|
37
|
-
ip?: string;
|
|
38
|
-
lat?: string;
|
|
39
|
-
lng?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Coinflow Types **/
|
|
43
|
-
export type CoinflowBlockchain = 'solana' | 'near' | 'eth' | 'polygon' | 'base';
|
|
44
|
-
export type CoinflowEnvs = 'prod' | 'staging' | 'sandbox' | 'local';
|
|
45
|
-
|
|
46
|
-
export interface CoinflowTypes {
|
|
47
|
-
merchantId: string;
|
|
48
|
-
env?: CoinflowEnvs;
|
|
49
|
-
loaderBackground?: string;
|
|
50
|
-
blockchain: CoinflowBlockchain;
|
|
51
|
-
handleHeightChange?: (height: string) => void;
|
|
52
|
-
theme?: MerchantTheme;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
56
|
-
|
|
57
|
-
export type OnSuccessMethod = (params: string) => void | Promise<void>;
|
|
58
|
-
|
|
59
|
-
/** Wallets **/
|
|
60
|
-
export interface SolanaWallet {
|
|
61
|
-
publicKey: PublicKey | null;
|
|
62
|
-
signTransaction?: <T extends Transaction | VersionedTransaction>(
|
|
63
|
-
transaction: T
|
|
64
|
-
) => Promise<T>;
|
|
65
|
-
sendTransaction: <T extends Transaction | VersionedTransaction>(
|
|
66
|
-
transaction: T
|
|
67
|
-
) => Promise<string>;
|
|
68
|
-
signMessage?: (message: Uint8Array) => Promise<Uint8Array>;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface NearWallet {
|
|
72
|
-
accountId: string;
|
|
73
|
-
signAndSendTransaction: (transaction: unknown) => Promise<{
|
|
74
|
-
transaction: {hash: string};
|
|
75
|
-
}>;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
type AccessList = Array<{address: string; storageKeys: Array<string>}>;
|
|
79
|
-
type AccessListish =
|
|
80
|
-
| AccessList
|
|
81
|
-
| Array<[string, Array<string>]>
|
|
82
|
-
| Record<string, Array<string>>;
|
|
83
|
-
|
|
84
|
-
export type EthWallet = {
|
|
85
|
-
address: string | null | undefined;
|
|
86
|
-
sendTransaction: (transaction: {
|
|
87
|
-
to: string;
|
|
88
|
-
from?: string;
|
|
89
|
-
nonce?: Bytes | bigint | string | number;
|
|
90
|
-
|
|
91
|
-
gasLimit?: Bytes | bigint | string | number;
|
|
92
|
-
gasPrice?: Bytes | bigint | string | number;
|
|
93
|
-
|
|
94
|
-
data?: BytesLike;
|
|
95
|
-
value?: Bytes | bigint | string | number;
|
|
96
|
-
chainId?: number;
|
|
97
|
-
|
|
98
|
-
type?: number;
|
|
99
|
-
accessList?: AccessListish;
|
|
100
|
-
|
|
101
|
-
maxPriorityFeePerGas?: Bytes | bigint | string | number;
|
|
102
|
-
maxFeePerGas?: Bytes | bigint | string | number;
|
|
103
|
-
|
|
104
|
-
customData?: Record<string, any>;
|
|
105
|
-
ccipReadEnabled?: boolean;
|
|
106
|
-
}) => Promise<{hash: string}>;
|
|
107
|
-
signMessage: (message: string) => Promise<string>;
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/** History **/
|
|
111
|
-
export interface CoinflowSolanaHistoryProps extends CoinflowTypes {
|
|
112
|
-
wallet: SolanaWallet;
|
|
113
|
-
connection: Connection;
|
|
114
|
-
blockchain: 'solana';
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export interface CoinflowNearHistoryProps extends CoinflowTypes {
|
|
118
|
-
wallet: NearWallet;
|
|
119
|
-
blockchain: 'near';
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
export interface CoinflowEvmHistoryProps extends CoinflowTypes {
|
|
123
|
-
wallet: EthWallet;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface CoinflowEthHistoryProps extends CoinflowEvmHistoryProps {
|
|
127
|
-
blockchain: 'eth';
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export interface CoinflowPolygonHistoryProps extends CoinflowEvmHistoryProps {
|
|
131
|
-
blockchain: 'polygon';
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
export interface CoinflowBaseHistoryProps extends CoinflowEvmHistoryProps {
|
|
135
|
-
blockchain: 'base';
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
export type CoinflowHistoryProps =
|
|
139
|
-
| CoinflowSolanaHistoryProps
|
|
140
|
-
| CoinflowNearHistoryProps
|
|
141
|
-
| CoinflowPolygonHistoryProps
|
|
142
|
-
| CoinflowEthHistoryProps
|
|
143
|
-
| CoinflowBaseHistoryProps;
|
|
144
|
-
|
|
145
|
-
/** Transactions **/
|
|
146
|
-
|
|
147
|
-
export type NearFtTransferCallAction = {
|
|
148
|
-
methodName: 'ft_transfer_call';
|
|
149
|
-
args: object;
|
|
150
|
-
gas: string;
|
|
151
|
-
deposit: string;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
type Bytes = ArrayLike<number>;
|
|
155
|
-
type BytesLike = Bytes | string;
|
|
156
|
-
|
|
157
|
-
/** Purchase **/
|
|
158
|
-
|
|
159
|
-
export type ChargebackProtectionData = ChargebackProtectionItem[];
|
|
160
|
-
|
|
161
|
-
export interface ChargebackProtectionItem {
|
|
162
|
-
/**
|
|
163
|
-
* The name of the product
|
|
164
|
-
*/
|
|
165
|
-
productName: string;
|
|
166
|
-
/**
|
|
167
|
-
* 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
|
|
168
|
-
*/
|
|
169
|
-
productType:
|
|
170
|
-
| 'inGameProduct'
|
|
171
|
-
| 'gameOfSkill'
|
|
172
|
-
| 'dataStorage'
|
|
173
|
-
| 'computingResources'
|
|
174
|
-
| 'sportsTicket'
|
|
175
|
-
| 'eSportsTicket'
|
|
176
|
-
| 'musicTicket'
|
|
177
|
-
| 'conferenceTicket'
|
|
178
|
-
| 'virtualSportsTicket'
|
|
179
|
-
| 'virtualESportsTicket'
|
|
180
|
-
| 'virtualMusicTicket'
|
|
181
|
-
| 'virtualConferenceTicket'
|
|
182
|
-
| 'alcohol'
|
|
183
|
-
| 'DLC'
|
|
184
|
-
| 'subscription'
|
|
185
|
-
| 'fundACause'
|
|
186
|
-
| 'realEstate'
|
|
187
|
-
| 'computingContract'
|
|
188
|
-
| 'digitalArt'
|
|
189
|
-
| 'topUp'
|
|
190
|
-
| 'ownershipContract';
|
|
191
|
-
/**
|
|
192
|
-
* The item's list price
|
|
193
|
-
*/
|
|
194
|
-
/**
|
|
195
|
-
* The number of units sold
|
|
196
|
-
*/
|
|
197
|
-
quantity: number;
|
|
198
|
-
/**
|
|
199
|
-
* Any additional data that the store can provide on the product, e.g. description, link to image, etc.
|
|
200
|
-
*/
|
|
201
|
-
rawProductData?: {[key: string]: any};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export interface CoinflowCommonPurchaseProps extends CoinflowTypes {
|
|
205
|
-
amount?: number;
|
|
206
|
-
onSuccess?: OnSuccessMethod;
|
|
207
|
-
webhookInfo?: object;
|
|
208
|
-
email?: string;
|
|
209
|
-
chargebackProtectionData?: ChargebackProtectionData;
|
|
210
|
-
planCode?: string;
|
|
211
|
-
disableApplePay?: boolean;
|
|
212
|
-
disableGooglePay?: boolean;
|
|
213
|
-
customerInfo?: CustomerInfo;
|
|
214
|
-
settlementType?: SettlementType;
|
|
215
|
-
authOnly?: boolean;
|
|
216
|
-
deviceId?: string;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
export interface CoinflowSolanaPurchaseProps
|
|
220
|
-
extends CoinflowCommonPurchaseProps {
|
|
221
|
-
wallet: SolanaWallet;
|
|
222
|
-
transaction?: Transaction | VersionedTransaction;
|
|
223
|
-
partialSigners?: Signer[];
|
|
224
|
-
debugTx?: boolean;
|
|
225
|
-
connection: Connection;
|
|
226
|
-
blockchain: 'solana';
|
|
227
|
-
token?: PublicKey | string;
|
|
228
|
-
supportsVersionedTransactions?: boolean;
|
|
229
|
-
rent?: {lamports: string | number};
|
|
230
|
-
nativeSolToConvert?: {lamports: string | number};
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export interface CoinflowNearPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
234
|
-
wallet: NearWallet;
|
|
235
|
-
blockchain: 'near';
|
|
236
|
-
action?: NearFtTransferCallAction;
|
|
237
|
-
nearDeposit?: string;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export interface CoinflowEvmPurchaseProps extends CoinflowCommonPurchaseProps {
|
|
241
|
-
transaction?: EvmTransactionData;
|
|
242
|
-
token?: string;
|
|
243
|
-
wallet: EthWallet;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export interface CoinflowPolygonPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
247
|
-
blockchain: 'polygon';
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
export interface CoinflowEthPurchaseProps extends CoinflowEvmPurchaseProps {
|
|
251
|
-
blockchain: 'eth';
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
export interface CoinflowBasePurchaseProps extends CoinflowEvmPurchaseProps {
|
|
255
|
-
blockchain: 'base';
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
export type CoinflowPurchaseProps =
|
|
259
|
-
| CoinflowSolanaPurchaseProps
|
|
260
|
-
| CoinflowNearPurchaseProps
|
|
261
|
-
| CoinflowPolygonPurchaseProps
|
|
262
|
-
| CoinflowEthPurchaseProps
|
|
263
|
-
| CoinflowBasePurchaseProps;
|
|
264
|
-
|
|
265
|
-
/** Withdraw **/
|
|
266
|
-
|
|
267
|
-
export interface CoinflowCommonWithdrawProps extends CoinflowTypes {
|
|
268
|
-
onSuccess?: OnSuccessMethod;
|
|
269
|
-
tokens?: string[];
|
|
270
|
-
lockDefaultToken?: boolean;
|
|
271
|
-
amount?: number;
|
|
272
|
-
email?: string;
|
|
273
|
-
bankAccountLinkRedirect?: string;
|
|
274
|
-
additionalWallets?: {
|
|
275
|
-
wallet: string;
|
|
276
|
-
blockchain: 'solana' | 'eth' | 'near' | 'polygon';
|
|
277
|
-
}[];
|
|
278
|
-
supportsVersionedTransactions?: boolean;
|
|
279
|
-
lockAmount?: boolean;
|
|
280
|
-
transactionSigner?: string;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export interface CoinflowSolanaWithdrawProps
|
|
284
|
-
extends CoinflowCommonWithdrawProps {
|
|
285
|
-
wallet: SolanaWallet;
|
|
286
|
-
connection: Connection;
|
|
287
|
-
blockchain: 'solana';
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
export interface CoinflowNearWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
291
|
-
wallet: NearWallet;
|
|
292
|
-
blockchain: 'near';
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export interface CoinflowEvmWithdrawProps extends CoinflowCommonWithdrawProps {
|
|
296
|
-
wallet: EthWallet;
|
|
297
|
-
usePermit?: boolean;
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
export interface CoinflowEthWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
301
|
-
blockchain: 'eth';
|
|
302
|
-
usePermit?: boolean;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
export interface CoinflowPolygonWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
306
|
-
blockchain: 'polygon';
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export interface CoinflowBaseWithdrawProps extends CoinflowEvmWithdrawProps {
|
|
310
|
-
blockchain: 'base';
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
export type CoinflowWithdrawProps =
|
|
314
|
-
| CoinflowSolanaWithdrawProps
|
|
315
|
-
| CoinflowNearWithdrawProps
|
|
316
|
-
| CoinflowEthWithdrawProps
|
|
317
|
-
| CoinflowPolygonWithdrawProps
|
|
318
|
-
| CoinflowBaseWithdrawProps;
|
|
319
|
-
|
|
320
|
-
export interface CommonEvmRedeem {
|
|
321
|
-
waitForHash?: boolean;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
export interface NormalRedeem extends CommonEvmRedeem {
|
|
325
|
-
transaction: {to: string; data: string};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export interface KnownTokenIdRedeem extends NormalRedeem {
|
|
329
|
-
nftContract: string;
|
|
330
|
-
nftId: string;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
export interface SafeMintRedeem extends NormalRedeem {
|
|
334
|
-
type: 'safeMint';
|
|
335
|
-
nftContract?: string;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
export interface ReturnedTokenIdRedeem extends NormalRedeem {
|
|
339
|
-
type: 'returned';
|
|
340
|
-
nftContract?: string;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
type ReservoirNftIdItem = Omit<KnownTokenIdRedeem, keyof NormalRedeem>;
|
|
344
|
-
interface ReservoirOrderIdItem {
|
|
345
|
-
orderId: string;
|
|
346
|
-
}
|
|
347
|
-
type ReservoirItem = ReservoirNftIdItem | ReservoirOrderIdItem;
|
|
348
|
-
type ReservoirItems = ReservoirItem | ReservoirItem[];
|
|
349
|
-
|
|
350
|
-
export interface ReservoirRedeem extends CommonEvmRedeem {
|
|
351
|
-
type: 'reservoir';
|
|
352
|
-
items: ReservoirItems;
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
export type EvmTransactionData =
|
|
356
|
-
| SafeMintRedeem
|
|
357
|
-
| ReturnedTokenIdRedeem
|
|
358
|
-
| ReservoirRedeem
|
|
359
|
-
| KnownTokenIdRedeem
|
|
360
|
-
| NormalRedeem;
|
|
361
|
-
|
|
362
|
-
export interface CoinflowIFrameProps
|
|
363
|
-
extends Omit<CoinflowTypes, 'merchantId'>,
|
|
364
|
-
Pick<
|
|
365
|
-
CoinflowCommonPurchaseProps,
|
|
366
|
-
| 'chargebackProtectionData'
|
|
367
|
-
| 'webhookInfo'
|
|
368
|
-
| 'amount'
|
|
369
|
-
| 'customerInfo'
|
|
370
|
-
| 'settlementType'
|
|
371
|
-
| 'email'
|
|
372
|
-
| 'planCode'
|
|
373
|
-
| 'deviceId'
|
|
374
|
-
>,
|
|
375
|
-
Pick<
|
|
376
|
-
CoinflowCommonWithdrawProps,
|
|
377
|
-
| 'bankAccountLinkRedirect'
|
|
378
|
-
| 'additionalWallets'
|
|
379
|
-
| 'transactionSigner'
|
|
380
|
-
| 'lockAmount'
|
|
381
|
-
| 'lockDefaultToken'
|
|
382
|
-
>,
|
|
383
|
-
Pick<CoinflowEvmPurchaseProps, 'authOnly'>,
|
|
384
|
-
Pick<CoinflowSolanaPurchaseProps, 'rent' | 'nativeSolToConvert' | 'token'> {
|
|
385
|
-
walletPubkey: string | null | undefined;
|
|
386
|
-
route: string;
|
|
387
|
-
routePrefix?: string;
|
|
388
|
-
transaction?: string;
|
|
389
|
-
tokens?: string[] | PublicKey[];
|
|
390
|
-
supportsVersionedTransactions?: boolean;
|
|
391
|
-
nearDeposit?: string;
|
|
392
|
-
merchantCss?: string;
|
|
393
|
-
color?: 'white' | 'black';
|
|
394
|
-
disableApplePay?: boolean;
|
|
395
|
-
disableGooglePay?: boolean;
|
|
396
|
-
theme?: MerchantTheme;
|
|
397
|
-
usePermit?: boolean;
|
|
398
|
-
}
|