@novasamatech/host-papp 0.6.16 → 0.6.18

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.
@@ -117,23 +117,28 @@ export const createAttestationService = (lazyClient) => {
117
117
  },
118
118
  });
119
119
  const submitAttestation = () => new Promise((resolve, reject) => {
120
- attestCall
121
- .signAndSubmit(createPeopleSigner(verifier), { at: 'best' })
122
- .then(event => {
123
- if (event.ok) {
124
- resolve();
125
- }
126
- else {
127
- // Extract error details
128
- let errorMessage = 'Transaction failed';
129
- if (event.dispatchError.type === 'Module') {
130
- const moduleError = event.dispatchError.value;
131
- errorMessage = `${moduleError.type}.${moduleError.value?.type || 'Unknown'}`;
120
+ const subscription = attestCall
121
+ .signSubmitAndWatch(createPeopleSigner(verifier), { at: 'best' })
122
+ .subscribe({
123
+ next(event) {
124
+ if ((event.type === 'txBestBlocksState' && event.found) || event.type === 'finalized') {
125
+ subscription.unsubscribe();
126
+ if (event.ok) {
127
+ resolve();
128
+ }
129
+ else {
130
+ let errorMessage = 'Transaction failed';
131
+ if (event.dispatchError?.type === 'Module') {
132
+ const moduleError = event.dispatchError.value;
133
+ errorMessage = `${moduleError.type}.${moduleError.value?.type || 'Unknown'}`;
134
+ }
135
+ reject(new Error(errorMessage));
136
+ }
132
137
  }
133
- reject(errorMessage);
134
- }
135
- })
136
- .catch(error => reject(String(error)));
138
+ },
139
+ error: reject,
140
+ complete: () => reject(new Error('Transaction observable completed without best block confirmation')),
141
+ });
137
142
  });
138
143
  return fromPromise(withRetry(submitAttestation), toError).map(() => undefined);
139
144
  })
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-papp",
3
3
  "type": "module",
4
- "version": "0.6.16",
4
+ "version": "0.6.18",
5
5
  "description": "Polkadot app integration",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -29,10 +29,10 @@
29
29
  "@noble/ciphers": "2.1.1",
30
30
  "@noble/curves": "2.0.1",
31
31
  "@noble/hashes": "2.0.1",
32
- "@novasamatech/host-api": "0.6.16",
33
- "@novasamatech/scale": "0.6.16",
34
- "@novasamatech/statement-store": "0.6.16",
35
- "@novasamatech/storage-adapter": "0.6.16",
32
+ "@novasamatech/host-api": "0.6.18",
33
+ "@novasamatech/scale": "0.6.18",
34
+ "@novasamatech/statement-store": "0.6.18",
35
+ "@novasamatech/storage-adapter": "0.6.18",
36
36
  "@polkadot-api/utils": "0.2.0",
37
37
  "@polkadot-api/substrate-bindings": "^0.17.0",
38
38
  "@polkadot-labs/hdkd-helpers": "^0.0.28",