You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once the script is loaded, you will be able to use `MesonTo` globally. If you use a package manager for your frontend project, you can also import it through
54
+
If you use a package manager for your frontend project and want to call meson.to with plain JavaScript, import the global `MesonTo` class
61
55
62
56
```js
63
57
importMesonTofrom'@mesonfi/to'
@@ -67,20 +61,31 @@ To open the popup of MesonTo for cross-chain transfer, run
67
61
68
62
```js
69
63
constappId='demo'
70
-
constmeson2=newMesonTo(window)
64
+
constmeson2=newMesonTo(window, {
65
+
onCompleted:data=> {
66
+
// when a cross-chain transfer is successful
67
+
console.log(data)
68
+
}
69
+
})
70
+
71
71
meson2.open(appId)
72
72
.then(() => {
73
73
// on popup closed; doesn't mean a cross-chain transfer is completed
74
74
})
75
-
76
-
meson2.onCompleted(data=> {
77
-
// when a cross-chain transfer is successful
78
-
console.log(data)
79
-
})
80
75
```
81
76
82
77
See the example project in `examples/plain`.
83
78
79
+
#### Use with `<script>`
80
+
81
+
You can also add meson.to directly to the html file
Once the script is loaded, you will be able to use `MesonTo` globally.
88
+
84
89
### Smart contract
85
90
86
91
The cross-chain'ed stablecoin will be transferred to the app contract from meson's contract. In order to accept the transfer correctly, your app contract needs to implement the `depositWithBeneficiary` method.
@@ -101,7 +106,7 @@ Once `depositWithBeneficiary` is supported, you can [contact us]() to register y
101
106
102
107
- App name
103
108
- Prefered appId (popup will open at https://meson.to/{appId})
104
-
- App URL (need to open popup from it in *release* mode)
109
+
- App URL (need to open the popup from this URL in *release* mode)
105
110
- App icon (w144 x h144)
106
111
- App logo (height 144, width <= 1080)
107
112
- Smart contract info (deployed chain, supported types of stablecoins, contract address)
0 commit comments