@msafe/sui-app-store 0.0.162 → 0.0.164
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/README.md +65 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -256,6 +256,71 @@ async deserialize(input: {
|
|
|
256
256
|
export const appHelpers = new MSafeApps([new CoreHelper(), <your app helper instance here>]);
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
+
### Test your integration with our test framework `TestSuite`
|
|
260
|
+
|
|
261
|
+
- before create pull request, you should test your helper with test suite, add at least one test case before creating the PR.
|
|
262
|
+
- here is an example for using test suite to test your helper
|
|
263
|
+
|
|
264
|
+
```typescript
|
|
265
|
+
import { TestSuite, TestSuiteLegacy } from './TestSuite';
|
|
266
|
+
|
|
267
|
+
describe('Main flow', () => {
|
|
268
|
+
const testWallet: WalletAccount = {
|
|
269
|
+
address: 'YOUR_TEST_WALLET_ADDRESS',
|
|
270
|
+
publicKey: HexToUint8Array('YOUR_TEST_WALLET_PUBLIC_KEY'),
|
|
271
|
+
chains: [SUI_MAINNET_CHAIN],
|
|
272
|
+
features: [],
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
// Choose one of the following to instantiate TestSuite according to your implementation (helper.supportSDK: @mysten/sui or @mysten/sui.js)
|
|
276
|
+
// Instantiate TestSuite with your test wallet, network, and the app helper(implement with @mysten/sui)
|
|
277
|
+
|
|
278
|
+
let ts: TestSuite<YourIntentionData>;
|
|
279
|
+
|
|
280
|
+
// (implement with @mysten/sui.js)
|
|
281
|
+
let ts: TestSuiteLegacy<YourIntentionData>;
|
|
282
|
+
|
|
283
|
+
beforeEach(() => {
|
|
284
|
+
ts = new TestSuite(testWallet, 'sui:mainnet', new YourHelper());
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('overall flow', () => {
|
|
288
|
+
it('overall flow', async () => {
|
|
289
|
+
// Mock application and user behavior
|
|
290
|
+
const appTxb = new TransactionBlock();
|
|
291
|
+
// ...
|
|
292
|
+
// programming your transaction block here
|
|
293
|
+
// ...
|
|
294
|
+
await ts.signAndSubmitTransaction({ txb: appTxb, appContext: {
|
|
295
|
+
// ... your app context here, will be passed to your helper.deserialize method
|
|
296
|
+
} });
|
|
297
|
+
const finalizedTxb = await ts.voteAndExecuteIntention();
|
|
298
|
+
|
|
299
|
+
expect(finalizedTxb).toBeDefined();
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it('deserialize', async () => {
|
|
304
|
+
const appTxb = new TransactionBlock();
|
|
305
|
+
// ...
|
|
306
|
+
// programming your transaction block here
|
|
307
|
+
// ...
|
|
308
|
+
await ts.signAndSubmitTransaction({ txb: appTxb });
|
|
309
|
+
|
|
310
|
+
expect(ts.pendingIntention).toBeDefined();
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('build', async () => {
|
|
314
|
+
ts.setIntention({} as any);
|
|
315
|
+
const txb = await ts.voteAndExecuteIntention();
|
|
316
|
+
|
|
317
|
+
expect(txb).toBeDefined();
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
```
|
|
321
|
+
You can refer to `test/core.test.ts` for more details implementation.
|
|
322
|
+
|
|
323
|
+
|
|
259
324
|
### Create pull request for submit
|
|
260
325
|
|
|
261
326
|
Once you finish development, you can create a PR to submit your changes.
|
package/dist/index.d.mts
CHANGED