@novasamatech/host-papp 0.6.15 → 0.6.17

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.
@@ -43,7 +43,7 @@ export const createAttestationService = (lazyClient) => {
43
43
  const sudoCall = api.tx.Sudo.sudo({
44
44
  call: increaseAllowanceCall.decodedCall,
45
45
  });
46
- return withRetry(() => sudoCall.signAndSubmit(createPeopleSigner(verifier)).then(() => undefined));
46
+ return withRetry(() => sudoCall.signAndSubmit(createPeopleSigner(verifier), { at: 'best' }).then(() => undefined));
47
47
  }, toError);
48
48
  return verifierAllowance.andThen(verifierAllowance => (verifierAllowance > 0 ? okAsync() : getAllowance()));
49
49
  },
@@ -117,27 +117,27 @@ export const createAttestationService = (lazyClient) => {
117
117
  },
118
118
  });
119
119
  const submitAttestation = () => new Promise((resolve, reject) => {
120
- const subscription = attestCall.signSubmitAndWatch(createPeopleSigner(verifier)).subscribe({
120
+ const subscription = attestCall
121
+ .signSubmitAndWatch(createPeopleSigner(verifier), { at: 'best' })
122
+ .subscribe({
121
123
  next(event) {
122
- if (event.type === 'finalized') {
123
- // Check if transaction was successful
124
+ if ((event.type === 'txBestBlocksState' && event.found) || event.type === 'finalized') {
125
+ subscription.unsubscribe();
124
126
  if (event.ok) {
125
- subscription.unsubscribe();
126
127
  resolve();
127
128
  }
128
129
  else {
129
- // Extract error details
130
130
  let errorMessage = 'Transaction failed';
131
131
  if (event.dispatchError?.type === 'Module') {
132
132
  const moduleError = event.dispatchError.value;
133
133
  errorMessage = `${moduleError.type}.${moduleError.value?.type || 'Unknown'}`;
134
134
  }
135
- subscription.unsubscribe();
136
- reject(errorMessage);
135
+ reject(new Error(errorMessage));
137
136
  }
138
137
  }
139
138
  },
140
139
  error: reject,
140
+ complete: () => reject(new Error('Transaction observable completed without best block confirmation')),
141
141
  });
142
142
  });
143
143
  return fromPromise(withRetry(submitAttestation), toError).map(() => undefined);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@novasamatech/host-papp",
3
3
  "type": "module",
4
- "version": "0.6.15",
4
+ "version": "0.6.17",
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.15",
33
- "@novasamatech/scale": "0.6.15",
34
- "@novasamatech/statement-store": "0.6.15",
35
- "@novasamatech/storage-adapter": "0.6.15",
32
+ "@novasamatech/host-api": "0.6.17",
33
+ "@novasamatech/scale": "0.6.17",
34
+ "@novasamatech/statement-store": "0.6.17",
35
+ "@novasamatech/storage-adapter": "0.6.17",
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",