@lifestonelabs/tokensales 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +285 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/constants/values.d.ts +17 -0
- package/dist/constants/values.d.ts.map +1 -0
- package/dist/functions/addSatoshis.d.ts +9 -0
- package/dist/functions/addSatoshis.d.ts.map +1 -0
- package/dist/functions/burn.d.ts +9 -0
- package/dist/functions/burn.d.ts.map +1 -0
- package/dist/functions/buyNFT.d.ts +9 -0
- package/dist/functions/buyNFT.d.ts.map +1 -0
- package/dist/functions/createListing.d.ts +9 -0
- package/dist/functions/createListing.d.ts.map +1 -0
- package/dist/functions/modifyTicketMaster.d.ts +9 -0
- package/dist/functions/modifyTicketMaster.d.ts.map +1 -0
- package/dist/functions/modifyTokenSale.d.ts +9 -0
- package/dist/functions/modifyTokenSale.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +1457 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +1479 -0
- package/dist/index.js.map +1 -0
- package/dist/types/index.d.ts +76 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/contract.d.ts +10 -0
- package/dist/utils/contract.d.ts.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/signTransaction.d.ts +10 -0
- package/dist/utils/signTransaction.d.ts.map +1 -0
- package/dist/utils/ticketMaster.d.ts +33 -0
- package/dist/utils/ticketMaster.d.ts.map +1 -0
- package/dist/utils/toTokenAddress.d.ts +8 -0
- package/dist/utils/toTokenAddress.d.ts.map +1 -0
- package/package.json +49 -0
- package/src/artifacts/TokenSales.json +290 -0
- package/src/constants/values.ts +20 -0
package/README.md
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# TokenSales Library
|
|
2
|
+
|
|
3
|
+
A TypeScript library for interacting with TokenSales contracts on Bitcoin Cash. This library provides a clean, framework-agnostic API for building and signing transactions that interact with TokenSales smart contracts.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install tokensales
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Signing Transactions
|
|
12
|
+
|
|
13
|
+
This library returns transaction objects with empty user input signatures. You can use WalletConnect, or any other signing method you prefer. The library includes an optional `createSignTransaction` helper for WalletConnect, but you're free to use your own signing implementation.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Setup
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {
|
|
21
|
+
buyNFT,
|
|
22
|
+
createSignTransaction,
|
|
23
|
+
getContractAddresses
|
|
24
|
+
} from 'tokensales';
|
|
25
|
+
import { Contract } from 'cashscript';
|
|
26
|
+
import { ElectrumNetworkProvider } from '@electrum-cash/network';
|
|
27
|
+
import { SignClient } from '@walletconnect/sign-client';
|
|
28
|
+
|
|
29
|
+
// Initialize provider
|
|
30
|
+
const provider = new ElectrumNetworkProvider('mainnet');
|
|
31
|
+
|
|
32
|
+
// Note: The contract artifact is included in the library and compiled automatically
|
|
33
|
+
// Functions return transaction objects that you can sign with your preferred method
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Purchase a Ticket
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { buyNFT } from 'tokensales';
|
|
40
|
+
|
|
41
|
+
const wcTransactionObj = await buyNFT({
|
|
42
|
+
electrumProvider: provider,
|
|
43
|
+
usersAddress: 'bitcoincash:...',
|
|
44
|
+
ticketMasterUtxo: tokenSaleUtxo, // TokenSale UTXO
|
|
45
|
+
ticketUtxo: ticketUtxo,
|
|
46
|
+
ticketType: '01', // '01', '02', or '03'
|
|
47
|
+
isAdmin: false
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Sign the transaction with your preferred method (WalletConnect, etc.)
|
|
51
|
+
// Example with WalletConnect:
|
|
52
|
+
// const signClient = await SignClient.init({ ... });
|
|
53
|
+
// const result = await signClient.request({
|
|
54
|
+
// chainId: 'bch:mainnet',
|
|
55
|
+
// topic: session.topic,
|
|
56
|
+
// request: {
|
|
57
|
+
// method: 'bch_signTransaction',
|
|
58
|
+
// params: JSON.parse(stringify(wcTransactionObj))
|
|
59
|
+
// }
|
|
60
|
+
// });
|
|
61
|
+
|
|
62
|
+
// Broadcast transaction
|
|
63
|
+
// await provider.sendRawTransaction(result.signedTransaction);
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Modify TokenSale
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
import { modifyTokenSale } from 'tokensales';
|
|
70
|
+
|
|
71
|
+
const wcTransactionObj = await modifyTokenSale({
|
|
72
|
+
electrumProvider: provider,
|
|
73
|
+
usersAddress: 'bitcoincash:...',
|
|
74
|
+
tokenSaleUtxo: tokenSaleUtxo,
|
|
75
|
+
userMintingUtxo: userMintingUtxo,
|
|
76
|
+
priceType1: 1000n,
|
|
77
|
+
priceType2: 2000n,
|
|
78
|
+
priceType3: 0n,
|
|
79
|
+
endSale: 950000
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// Sign and broadcast transaction (see buyNFT example above)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Burn TokenSale and Tickets
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { burn } from 'tokensales';
|
|
89
|
+
|
|
90
|
+
const wcTransactionObj = await burn({
|
|
91
|
+
electrumProvider: provider,
|
|
92
|
+
usersAddress: 'bitcoincash:...',
|
|
93
|
+
ticketMasterUtxo: tokenSaleUtxo, // TokenSale UTXO
|
|
94
|
+
userMintingNFT: userMintingNFT,
|
|
95
|
+
tickets: ticketsArray // Array of ticket UTXOs to burn
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// Sign and broadcast transaction (see buyNFT example above)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Add Satoshis to Minting NFT
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
import { addSatoshis } from 'tokensales';
|
|
105
|
+
|
|
106
|
+
const wcTransactionObj = await addSatoshis({
|
|
107
|
+
electrumProvider: provider,
|
|
108
|
+
usersAddress: 'bitcoincash:...',
|
|
109
|
+
userMintingNFT: userMintingNFT,
|
|
110
|
+
additionalSatoshis: 10000n
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Sign and broadcast transaction (see buyNFT example above)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Create TokenSale Listing
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
import { createListing } from 'tokensales';
|
|
120
|
+
|
|
121
|
+
const wcTransactionObj = await createListing({
|
|
122
|
+
electrumProvider: provider,
|
|
123
|
+
usersAddress: 'bitcoincash:...',
|
|
124
|
+
userMintingNFT: userMintingNFT,
|
|
125
|
+
priceType1: 1000n,
|
|
126
|
+
priceType2: 2000n,
|
|
127
|
+
priceType3: 0n,
|
|
128
|
+
endSale: 950000,
|
|
129
|
+
adminPubKeyHash: '0000000000000000000000000000000000000000' // 40 hex chars = 20bytes
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Sign and broadcast transaction (see buyNFT example above)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## API Reference
|
|
136
|
+
|
|
137
|
+
### Functions
|
|
138
|
+
|
|
139
|
+
#### `buyNFT(params: BuyNFTParams): Promise<WalletConnectTransactionObject>`
|
|
140
|
+
|
|
141
|
+
Purchase a ticket NFT from a TokenSale.
|
|
142
|
+
|
|
143
|
+
**Parameters:**
|
|
144
|
+
- `electrumProvider: ElectrumNetworkProvider` - Electrum provider instance
|
|
145
|
+
- `usersAddress: string` - User's Bitcoin Cash address
|
|
146
|
+
- `ticketMasterUtxo: Utxo` - TokenSale UTXO
|
|
147
|
+
- `ticketUtxo: Utxo` - Ticket UTXO to purchase
|
|
148
|
+
- `ticketType: '01' | '02' | '03'` - Ticket type
|
|
149
|
+
- `isAdmin: boolean` - Whether user is admin (uses minting NFT)
|
|
150
|
+
- `contractAddress?: string` - Optional contract address override (defaults to v4)
|
|
151
|
+
|
|
152
|
+
**Returns:** `Promise<WalletConnectTransactionObject>` - Transaction object ready for signing
|
|
153
|
+
|
|
154
|
+
#### `modifyTokenSale(params: ModifyTokenSaleParams): Promise<WalletConnectTransactionObject>`
|
|
155
|
+
|
|
156
|
+
Modify TokenSale parameters (prices, endSale).
|
|
157
|
+
|
|
158
|
+
**Parameters:**
|
|
159
|
+
- `electrumProvider: ElectrumNetworkProvider` - Electrum provider instance
|
|
160
|
+
- `usersAddress: string` - User's Bitcoin Cash address
|
|
161
|
+
- `tokenSaleUtxo: Utxo` - TokenSale UTXO to modify
|
|
162
|
+
- `userMintingUtxo: Utxo` - User's minting NFT
|
|
163
|
+
- `priceType1: number | bigint` - Price for type 1 tickets
|
|
164
|
+
- `priceType2: number | bigint` - Price for type 2 tickets
|
|
165
|
+
- `priceType3: number | bigint` - Price for type 3 tickets
|
|
166
|
+
- `endSale: number` - Block height when sale ends
|
|
167
|
+
- `contractAddress?: string` - Optional contract address override (defaults to v4)
|
|
168
|
+
|
|
169
|
+
**Returns:** `Promise<WalletConnectTransactionObject>` - Transaction object ready for signing
|
|
170
|
+
|
|
171
|
+
#### `burn(params: BurnParams): Promise<WalletConnectTransactionObject>`
|
|
172
|
+
|
|
173
|
+
Burn a TokenSale NFT and all associated tickets.
|
|
174
|
+
|
|
175
|
+
**Parameters:**
|
|
176
|
+
- `electrumProvider: ElectrumNetworkProvider` - Electrum provider instance
|
|
177
|
+
- `usersAddress: string` - User's Bitcoin Cash address
|
|
178
|
+
- `ticketMasterUtxo: Utxo` - TokenSale UTXO to burn (note: parameter name kept for backward compatibility)
|
|
179
|
+
- `userMintingNFT: Utxo` - User's minting NFT
|
|
180
|
+
- `tickets: Utxo[]` - Array of ticket UTXOs to burn
|
|
181
|
+
- `contractAddress?: string` - Optional contract address override (defaults to v4)
|
|
182
|
+
|
|
183
|
+
**Returns:** `Promise<WalletConnectTransactionObject>` - Transaction object ready for signing
|
|
184
|
+
|
|
185
|
+
#### `addSatoshis(params: AddSatoshisParams): Promise<WalletConnectTransactionObject>`
|
|
186
|
+
|
|
187
|
+
Add satoshis to a minting NFT.
|
|
188
|
+
|
|
189
|
+
**Parameters:**
|
|
190
|
+
- `electrumProvider: ElectrumNetworkProvider` - Electrum provider instance
|
|
191
|
+
- `usersAddress: string` - User's Bitcoin Cash address
|
|
192
|
+
- `userMintingNFT: Utxo` - Minting NFT to add satoshis to
|
|
193
|
+
- `additionalSatoshis: bigint` - Amount of satoshis to add
|
|
194
|
+
|
|
195
|
+
**Returns:** `Promise<WalletConnectTransactionObject>` - Transaction object ready for signing
|
|
196
|
+
|
|
197
|
+
#### `createListing(params: CreateListingParams): Promise<WalletConnectTransactionObject>`
|
|
198
|
+
|
|
199
|
+
Create a new TokenSale listing.
|
|
200
|
+
|
|
201
|
+
**Parameters:**
|
|
202
|
+
- `electrumProvider: ElectrumNetworkProvider` - Electrum provider instance
|
|
203
|
+
- `usersAddress: string` - User's Bitcoin Cash address
|
|
204
|
+
- `userMintingNFT: Utxo` - User's minting NFT
|
|
205
|
+
- `priceType1: bigint` - Price for type 1 tickets
|
|
206
|
+
- `priceType2: bigint` - Price for type 2 tickets
|
|
207
|
+
- `priceType3: bigint` - Price for type 3 tickets
|
|
208
|
+
- `endSale: number` - Block height when sale ends
|
|
209
|
+
- `adminPubKeyHash: string` - Admin public key hash (40 hex chars)
|
|
210
|
+
- `contractAddress?: string` - Optional contract address override (defaults to v4)
|
|
211
|
+
- `tokenAddress?: string` - Optional token address override (defaults to v4)
|
|
212
|
+
|
|
213
|
+
**Returns:** `Promise<WalletConnectTransactionObject>` - Transaction object ready for signing
|
|
214
|
+
|
|
215
|
+
### Utilities
|
|
216
|
+
|
|
217
|
+
#### `compileContract(provider: ElectrumNetworkProvider, addressType?: 'p2sh32' | 'p2sh20'): Contract`
|
|
218
|
+
|
|
219
|
+
Compiles the TokenSales contract using the included artifact. This is called automatically by the transaction functions, but can be used directly if needed.
|
|
220
|
+
|
|
221
|
+
#### `createSignTransaction(signClient: any, connectedChain?: string): SignTransactionFunction`
|
|
222
|
+
|
|
223
|
+
**Optional helper** - Creates a WalletConnect-compatible sign transaction function. This is provided as a convenience, but you can use any signing method you prefer.
|
|
224
|
+
|
|
225
|
+
#### `parseTicketMasterCommitment(commitment: string): TicketMasterData | null`
|
|
226
|
+
|
|
227
|
+
Parses a TokenSale commitment string to extract sale data.
|
|
228
|
+
|
|
229
|
+
#### `formatBCH(satoshis: bigint | number | string): string`
|
|
230
|
+
|
|
231
|
+
Formats satoshis to BCH string with 8 decimal places.
|
|
232
|
+
|
|
233
|
+
#### `toTokenAddress(address: string): string`
|
|
234
|
+
|
|
235
|
+
Converts a regular Bitcoin Cash address to its token address equivalent.
|
|
236
|
+
|
|
237
|
+
### Contract Addresses
|
|
238
|
+
|
|
239
|
+
#### `getContractAddress(): string`
|
|
240
|
+
|
|
241
|
+
Gets the TokenSales contract address.
|
|
242
|
+
|
|
243
|
+
#### `getTokenAddress(): string`
|
|
244
|
+
|
|
245
|
+
Gets the TokenSales token address.
|
|
246
|
+
|
|
247
|
+
#### `getContractAddresses(): { contract: string; token: string }`
|
|
248
|
+
|
|
249
|
+
Gets both contract and token addresses.
|
|
250
|
+
|
|
251
|
+
#### `AddressTicketMaster: string`
|
|
252
|
+
|
|
253
|
+
Direct export of the TokenSales contract address.
|
|
254
|
+
|
|
255
|
+
#### `AddressTicketMasterToken: string`
|
|
256
|
+
|
|
257
|
+
Direct export of the TokenSales token address.
|
|
258
|
+
|
|
259
|
+
## Error Handling
|
|
260
|
+
|
|
261
|
+
All functions throw errors instead of using callbacks. Make sure to wrap function calls in try-catch blocks:
|
|
262
|
+
|
|
263
|
+
```typescript
|
|
264
|
+
try {
|
|
265
|
+
const wcTransactionObj = await buyNFT(params);
|
|
266
|
+
// Sign transaction with your preferred method
|
|
267
|
+
// Then broadcast: await provider.sendRawTransaction(signedTx);
|
|
268
|
+
} catch (error) {
|
|
269
|
+
console.error('Transaction building failed:', error);
|
|
270
|
+
// Handle error appropriately
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## TypeScript Support
|
|
275
|
+
|
|
276
|
+
This library is written in TypeScript and includes full type definitions. All types are exported and can be imported:
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
import type { BuyNFTParams, WalletConnectTransactionObject } from 'tokensales';
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## License
|
|
283
|
+
|
|
284
|
+
MIT
|
|
285
|
+
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const DEFAULT_CONTRACT_ADDRESSES: {
|
|
2
|
+
readonly contract: "bitcoincash:pvh0yat7d2r9nf228fpns3mypydvstq9arftt9qlmma42xeq2eryszkdd99zq";
|
|
3
|
+
readonly token: "bitcoincash:rvh0yat7d2r9nf228fpns3mypydvstq9arftt9qlmma42xeq2eryss93vuymt";
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Get contract address
|
|
7
|
+
* @returns Contract address
|
|
8
|
+
*/
|
|
9
|
+
export declare function getContractAddress(): string;
|
|
10
|
+
/**
|
|
11
|
+
* Get token address
|
|
12
|
+
* @returns Token address
|
|
13
|
+
*/
|
|
14
|
+
export declare function getTokenAddress(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get contract addresses
|
|
17
|
+
* @returns Object with contract and token addresses
|
|
18
|
+
*/
|
|
19
|
+
export declare function getContractAddresses(): {
|
|
20
|
+
contract: string;
|
|
21
|
+
token: string;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAEX;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB;;;EAKnC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const AddressTicketMaster = "bitcoincash:pvh0yat7d2r9nf228fpns3mypydvstq9arftt9qlmma42xeq2eryszkdd99zq";
|
|
2
|
+
export declare const AddressTicketMasterToken = "bitcoincash:rvh0yat7d2r9nf228fpns3mypydvstq9arftt9qlmma42xeq2eryss93vuymt";
|
|
3
|
+
export declare const TICKET_LEVEL_DESCRIPTIONS: {
|
|
4
|
+
'01': {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
'02': {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
'03': {
|
|
13
|
+
name: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/constants/values.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB,8EAA8E,CAAC;AAC/G,eAAO,MAAM,wBAAwB,8EAA8E,CAAC;AAGpH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;CAarC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AddSatoshisParams, WalletConnectTransactionObject } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Add satoshis to a minting NFT
|
|
4
|
+
* @param params - AddSatoshisParams object containing all required parameters
|
|
5
|
+
* @returns Promise resolving to WalletConnectTransactionObject ready for signing
|
|
6
|
+
* @throws Error if validation fails or transaction building fails
|
|
7
|
+
*/
|
|
8
|
+
export declare function addSatoshis(params: AddSatoshisParams): Promise<WalletConnectTransactionObject>;
|
|
9
|
+
//# sourceMappingURL=addSatoshis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addSatoshis.d.ts","sourceRoot":"","sources":["../../src/functions/addSatoshis.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAG7E;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAyJpG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BurnParams, WalletConnectTransactionObject } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Burn a TicketMaster NFT and all associated tickets
|
|
4
|
+
* @param params - BurnParams object containing all required parameters
|
|
5
|
+
* @returns Promise resolving to WalletConnectTransactionObject ready for signing
|
|
6
|
+
* @throws Error if validation fails or transaction building fails
|
|
7
|
+
*/
|
|
8
|
+
export declare function burn(params: BurnParams): Promise<WalletConnectTransactionObject>;
|
|
9
|
+
//# sourceMappingURL=burn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"burn.d.ts","sourceRoot":"","sources":["../../src/functions/burn.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAItE;;;;;GAKG;AACH,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAkLtF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BuyNFTParams, WalletConnectTransactionObject } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Purchase a ticket NFT from a TicketMaster
|
|
4
|
+
* @param params - BuyNFTParams object containing all required parameters
|
|
5
|
+
* @returns Promise resolving to WalletConnectTransactionObject ready for signing
|
|
6
|
+
* @throws Error if validation fails or transaction building fails
|
|
7
|
+
*/
|
|
8
|
+
export declare function buyNFT(params: BuyNFTParams): Promise<WalletConnectTransactionObject>;
|
|
9
|
+
//# sourceMappingURL=buyNFT.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buyNFT.d.ts","sourceRoot":"","sources":["../../src/functions/buyNFT.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAIxE;;;;;GAKG;AACH,wBAAsB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAoT1F"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CreateListingParams, WalletConnectTransactionObject } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Create a new TicketMaster listing
|
|
4
|
+
* @param params - CreateListingParams object containing all required parameters
|
|
5
|
+
* @returns Promise resolving to WalletConnectTransactionObject ready for signing
|
|
6
|
+
* @throws Error if validation fails or transaction building fails
|
|
7
|
+
*/
|
|
8
|
+
export declare function createListing(params: CreateListingParams): Promise<WalletConnectTransactionObject>;
|
|
9
|
+
//# sourceMappingURL=createListing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createListing.d.ts","sourceRoot":"","sources":["../../src/functions/createListing.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAK/E;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CA0JxG"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModifyTicketMasterParams, WalletConnectTransactionObject } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Modify TicketMaster parameters (prices, endSale)
|
|
4
|
+
* @param params - ModifyTicketMasterParams object containing all required parameters
|
|
5
|
+
* @returns Promise resolving to WalletConnectTransactionObject ready for signing
|
|
6
|
+
* @throws Error if validation fails or transaction building fails
|
|
7
|
+
*/
|
|
8
|
+
export declare function modifyTicketMaster(params: ModifyTicketMasterParams): Promise<WalletConnectTransactionObject>;
|
|
9
|
+
//# sourceMappingURL=modifyTicketMaster.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modifyTicketMaster.d.ts","sourceRoot":"","sources":["../../src/functions/modifyTicketMaster.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,wBAAwB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAIpF;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,wBAAwB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAkLlH"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModifyTokenSaleParams, WalletConnectTransactionObject } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Modify TokenSale parameters (prices, endSale)
|
|
4
|
+
* @param params - ModifyTokenSaleParams object containing all required parameters
|
|
5
|
+
* @returns Promise resolving to WalletConnectTransactionObject ready for signing
|
|
6
|
+
* @throws Error if validation fails or transaction building fails
|
|
7
|
+
*/
|
|
8
|
+
export declare function modifyTokenSale(params: ModifyTokenSaleParams): Promise<WalletConnectTransactionObject>;
|
|
9
|
+
//# sourceMappingURL=modifyTokenSale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modifyTokenSale.d.ts","sourceRoot":"","sources":["../../src/functions/modifyTokenSale.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAIjF;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAkL5G"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TokenSales Library
|
|
3
|
+
* A TypeScript library for interacting with TokenSales contracts on Bitcoin Cash
|
|
4
|
+
*/
|
|
5
|
+
export { buyNFT } from './functions/buyNFT';
|
|
6
|
+
export { modifyTokenSale } from './functions/modifyTokenSale';
|
|
7
|
+
export { burn } from './functions/burn';
|
|
8
|
+
export { addSatoshis } from './functions/addSatoshis';
|
|
9
|
+
export { createListing } from './functions/createListing';
|
|
10
|
+
export { parseTicketMasterCommitment, formatBCH, isTicketMaster, isTicket } from './utils/ticketMaster';
|
|
11
|
+
export { default as toTokenAddress } from './utils/toTokenAddress';
|
|
12
|
+
export { ensureAddressPrefix, hexToUint8Array, toLittleEndianHexString } from './utils';
|
|
13
|
+
export { createSignTransaction } from './utils/signTransaction';
|
|
14
|
+
export * from './types';
|
|
15
|
+
export { DEFAULT_CONTRACT_ADDRESSES, getContractAddresses, getContractAddress, getTokenAddress } from './config';
|
|
16
|
+
export { AddressTicketMaster, AddressTicketMasterToken, TICKET_LEVEL_DESCRIPTIONS } from './constants/values';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D,OAAO,EAAE,2BAA2B,EAAE,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAExF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAGhE,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGjH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC"}
|