@bsv/message-box-client 1.2.0 → 1.2.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bsv/message-box-client",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -65,7 +65,7 @@
65
65
  "ts-standard": "^12.0.2",
66
66
  "ts2md": "^0.2.8",
67
67
  "tsconfig-to-dual-package": "^1.2.0",
68
- "typescript": "^5.7.3",
68
+ "typescript": "^5.8.3",
69
69
  "typescript-eslint": "^8.24.0",
70
70
  "webpack": "^5.98.0",
71
71
  "webpack-bundle-analyzer": "^4.10.2",
@@ -877,7 +877,7 @@ export class MessageBoxClient {
877
877
  const quote = await this.getMessageBoxQuote({
878
878
  recipient: message.recipient,
879
879
  messageBox: message.messageBox
880
- })
880
+ }, overrideHost)
881
881
 
882
882
  if (quote.recipientFee === -1) {
883
883
  throw new Error('You have been blocked from sending messages to this recipient.')
@@ -1200,8 +1200,13 @@ export class MessageBoxClient {
1200
1200
  * messages.forEach(msg => console.log(msg.sender, msg.body))
1201
1201
  * // Payments included with messages are automatically received
1202
1202
  */
1203
- async listMessages({ messageBox, host, originator }: ListMessagesParams): Promise<PeerMessage[]> {
1204
- await this.assertInitialized()
1203
+ async listMessages ({ messageBox, host, originator, acceptPayments }: ListMessagesParams): Promise<PeerMessage[]> {
1204
+ if (typeof acceptPayments !== 'boolean') {
1205
+ acceptPayments = true
1206
+ }
1207
+ if (typeof host !== 'string') {
1208
+ await this.assertInitialized()
1209
+ }
1205
1210
  if (messageBox.trim() === '') {
1206
1211
  throw new Error('MessageBox cannot be empty')
1207
1212
  }
@@ -1293,7 +1298,7 @@ export class MessageBoxClient {
1293
1298
  }
1294
1299
 
1295
1300
  // Process payment if present - server now only stores recipient payments
1296
- if (paymentData?.tx != null && paymentData.outputs != null) {
1301
+ if (acceptPayments && paymentData?.tx != null && paymentData.outputs != null) {
1297
1302
  try {
1298
1303
  Logger.log(
1299
1304
  `[MB CLIENT] Processing recipient payment in message from ${String(message.sender)}…`
package/src/types.ts CHANGED
@@ -108,6 +108,7 @@ export interface ListMessagesParams {
108
108
  messageBox: string
109
109
  host?: string
110
110
  originator?: string
111
+ acceptPayments?: boolean
111
112
  }
112
113
 
113
114
  /**