Skip to content

Commit f3f7269

Browse files
committed
merged
1 parent 8026c40 commit f3f7269

File tree

1 file changed

+31
-9
lines changed

1 file changed

+31
-9
lines changed

examples/authorize_and_store_papi_smoldot.js

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ async function main() {
5757

5858
// Initialize Smoldot client
5959
const sd = smoldot.start({
60+
<<<<<<< HEAD
6061
maxLogLevel: 3, // 0=off, 1=error, 2=warn, 3=info, 4=debug, 5=trace
62+
=======
63+
maxLogLevel: 4, // 0=off, 1=error, 2=warn, 3=info, 4=debug, 5=trace
64+
>>>>>>> aac8a8b (new error - transaction not found)
6165
logCallback: (level, target, message) => {
6266
const levelNames = ['ERROR', 'WARN', 'INFO', 'DEBUG', 'TRACE'];
6367
const levelName = levelNames[level - 1] || 'UNKNOWN';
@@ -68,15 +72,33 @@ async function main() {
6872
const client = createClient(getSmProvider(chain));
6973
const typedApi = client.getTypedApi(bulletin);
7074

71-
// authorize
72-
await authorizeAccount(typedApi, sudoSigner, who, transactions, bytes);
73-
// store
74-
let cid = await store(typedApi, whoSigner, dataToStore);
75-
assert.strictEqual(
76-
cid.toString(),
77-
expectedCid.toString(),
78-
'❌ CID does not match expected root CID'
79-
);
75+
// console.log('⏭️ Waiting for 15 seconds for smoldot to sync...');
76+
// await new Promise(resolve => setTimeout(resolve, 15000));
77+
78+
const w = who.toString();
79+
console.log('✅ who is who: ', w);
80+
bulletinAPI.tx.transactionStorage.authorizeAccount({
81+
who: w,
82+
transactions,
83+
bytes
84+
}).signAndSubmit(aliceSigner)
85+
.then(() => console.log("✅ Authorized!"))
86+
.catch((err) => {
87+
console.error("❌ authorize error: ", err);
88+
process.exit(1);
89+
});
90+
91+
// console.log('✅ storing...');
92+
// bulletinAPI.tx.transactionStorage.store(dataToStore)
93+
// .signSubmitAndWatch(aliceSigner).subscribe({
94+
// next: (ev) => {
95+
// console.log("⏭️ store next: ", ev);
96+
// },
97+
// error: (err) => {
98+
// console.error("❌ store error: ", err);
99+
// process.exit(1);
100+
// },
101+
// });
80102
}
81103

82104
await main();

0 commit comments

Comments
 (0)