@parity/product-sdk-host 0.13.0 → 0.14.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/src/payments.ts CHANGED
@@ -5,16 +5,17 @@
5
5
  * `truApi.payment.*`.
6
6
  *
7
7
  * Exposes balance subscription, top-up, payment requests, and payment-status
8
- * subscription. Distinct from the CoinPayment / merchant-payments surface
9
- * (RFC-0017): RFC-0006 is the user-initiated balance / top-up / payment-request
10
- * flow.
8
+ * subscription. The flow is distinct from the CoinPayment / merchant-payments
9
+ * surface (RFC-0017) RFC-0006 is the user-initiated balance / top-up /
10
+ * payment-request flow — but both operate on the same CoinPayment purses,
11
+ * hence the shared `CoinPaymentPurseId` (omitted = the main purse).
11
12
  *
12
13
  * @module
13
14
  */
14
15
 
15
16
  import type {
16
17
  Balance,
17
- PaymentPurseId,
18
+ CoinPaymentPurseId,
18
19
  HexString,
19
20
  HostPaymentBalanceSubscribeItem,
20
21
  HostPaymentStatusSubscribeItem,
@@ -37,13 +38,13 @@ import type { HostSubscription } from "./types.js";
37
38
  export interface PaymentManager {
38
39
  subscribeBalance(
39
40
  callback: (balance: HostPaymentBalanceSubscribeItem) => void,
40
- purse?: PaymentPurseId,
41
+ purse?: CoinPaymentPurseId,
41
42
  ): HostSubscription;
42
- topUp(amount: Balance, source: PaymentTopUpSource, into?: PaymentPurseId): Promise<void>;
43
+ topUp(amount: Balance, source: PaymentTopUpSource, into?: CoinPaymentPurseId): Promise<void>;
43
44
  requestPayment(
44
45
  amount: Balance,
45
46
  destination: HexString,
46
- from?: PaymentPurseId,
47
+ from?: CoinPaymentPurseId,
47
48
  ): Promise<{ id: string }>;
48
49
  subscribePaymentStatus(
49
50
  paymentId: string,
package/src/testing.ts CHANGED
@@ -12,9 +12,10 @@
12
12
  *
13
13
  * Not modeled: the PAPI `chain` JSON-RPC surface behind `getHostProvider()` —
14
14
  * there's no chain-read fake, by design; the host owns RPC selection — and the
15
- * `chat` / `entropy` / `notifications` / `payment` / `permissions` /
16
- * `resourceAllocation` / `theme` domains. Touching an unmodeled domain throws a
17
- * descriptive error rather than failing with `undefined is not a function`.
15
+ * `chat` / `coinPayment` / `entropy` / `notifications` / `payment` /
16
+ * `permissions` / `resourceAllocation` / `theme` domains. Touching an unmodeled
17
+ * domain throws a descriptive error rather than failing with `undefined is not
18
+ * a function`.
18
19
  *
19
20
  * @packageDocumentation
20
21
  */
@@ -182,7 +183,16 @@ export function createFakeTruApiClient(options?: CreateFakeTruApiClientOptions):
182
183
  getAccountAlias: () =>
183
184
  okAsync({ context: toHex(new Uint8Array([1])), alias: toHex(new Uint8Array([2])) }),
184
185
  getLegacyAccounts: () => okAsync({ accounts: legacyAccounts }),
185
- createAccountProof: () => okAsync({ proof: signature }),
186
+ createAccountProof: () =>
187
+ okAsync({
188
+ proof: signature,
189
+ contextualAlias: {
190
+ context: toHex(new Uint8Array([1])),
191
+ alias: toHex(new Uint8Array([2])),
192
+ },
193
+ ringIndex: 0,
194
+ ringRevision: 0,
195
+ }),
186
196
  connectionStatusSubscribe: () => inertObservable(),
187
197
  },
188
198
  signing: {
@@ -217,6 +227,7 @@ export function createFakeTruApiClient(options?: CreateFakeTruApiClientOptions):
217
227
  },
218
228
  chain: notModeled("chain"),
219
229
  chat: notModeled("chat"),
230
+ coinPayment: notModeled("coinPayment"),
220
231
  entropy: notModeled("entropy"),
221
232
  notifications: notModeled("notifications"),
222
233
  payment: notModeled("payment"),