Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit c91a491

Browse files
mj52951MakMuftic
andauthored
chore: Add Sygma Widget playground (#154)
* chore: Add Sygma Widget playground * Align with typecheck and spellcheck * Add browser rendering for widget * Update import --------- Co-authored-by: mace <[email protected]>
1 parent 5fa0db7 commit c91a491

File tree

5 files changed

+2750
-65
lines changed

5 files changed

+2750
-65
lines changed

dictionary.txt

+1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ rollup
449449
5EYCAe5jLbHcAAMKvLFSXgCTbPrLgBJusvPwfKcaKzuf5X5e
450450
Merkle
451451
sygma-widget-index
452+
sygma-widget-playground
452453
customizable
453454
frontend
454455
Vite
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
id: sygma-widget-playground
3+
slug: /sygma-widget/playground
4+
title: Playground
5+
description: The following section provides a Sygma Widget playground
6+
sidebar_position: 4
7+
---
8+
9+
import App from '../../../src/Widget/App';
10+
11+
<App />
12+
13+
### Steps
14+
15+
1. From network drop-down menu, select the desired network from which you want to bridge assets
16+
2. Connect your wallet by clicking `Connect Wallet` in the top-right corner
17+
3. From network drop-down menu, select the desired network to which you want to bridge assets
18+
3. From assets drop-down menu, select the asset you want to bridge
19+
4. Input the destination address
20+
5. `Approve token`

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
},
1717
"dependencies": {
1818
"@buildwithsygma/sygma-sdk-core": "^2.7.3",
19+
"@buildwithsygma/sygmaprotocol-react-widget": "^0.1.2",
1920
"@cmfcmf/docusaurus-search-local": "^1.0.0",
2021
"@docusaurus/core": "^2.3.1",
2122
"@docusaurus/preset-classic": "^2.3.1",
@@ -24,6 +25,7 @@
2425
"@mdx-js/react": "^1.6.22",
2526
"@mui/icons-material": "^5.15.10",
2627
"@mui/material": "^5.15.10",
28+
"@polkadot/extension-inject": "^0.47.5",
2729
"clsx": "^1.2.1",
2830
"js-cookie": "^3.0.5",
2931
"prism-react-renderer": "^1.3.5",
@@ -34,7 +36,7 @@
3436
"devDependencies": {
3537
"@docusaurus/module-type-aliases": "^2.3.1",
3638
"@tsconfig/docusaurus": "^1.0.5",
37-
"typescript": "^4.7.4"
39+
"typescript": "^5.2.2"
3840
},
3941
"browserslist": {
4042
"production": [

src/Widget/App.tsx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { Environment } from '@buildwithsygma/sygma-sdk-core';
2+
import React from 'react';
3+
import { Container } from '@mui/material';
4+
import BrowserOnly from '@docusaurus/BrowserOnly';
5+
6+
function App(){
7+
return (
8+
<BrowserOnly fallback={<div>Loading...</div>}>
9+
{() => {
10+
const {SygmaProtocolReactWidget} = require('@buildwithsygma/sygmaprotocol-react-widget/build/WidgetReact');
11+
return <Container sx={{display: "flex", justifyContent: "center", alignItems: "center"}}>
12+
<SygmaProtocolReactWidget environment={Environment.TESTNET} />
13+
</Container>
14+
}}
15+
</BrowserOnly>
16+
)
17+
}
18+
19+
export default App;

0 commit comments

Comments
 (0)