Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mersui

Package Overview
Dependencies
Maintainers
0
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mersui - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

1

dist/components/MerSuiWidget.d.ts
import { FC } from 'react';
interface IMerSuiWidget {
recipientAddress: string;
amount?: number;
buttonLabel?: string;

@@ -5,0 +6,0 @@ containerClassName?: string;

116

dist/components/MerSuiWidget.js

@@ -1,32 +0,30 @@

import { jsxs as m, jsx as a } from "react/jsx-runtime";
import { u as _, a as M, C as N, c, T as O } from "../index-CLvF0ZsT.js";
import { useState as p, useEffect as v } from "react";
import { TRANSACTION_AMOUNT_FALLBACK as A, DEFAULT_BUTTON_LABEL as g, AMOUNT_USD as x, PYTH_SPONSORED_FEED as B } from "../constants.js";
import { jsxs as x, jsx as a } from "react/jsx-runtime";
import { u as w, a as _, C as D, c, T as M } from "../index-CLvF0ZsT.js";
import { useState as p, useEffect as N } from "react";
import { TRANSACTION_AMOUNT_FALLBACK as m, DEFAULT_BUTTON_LABEL as g, DEFAULT_AMOUNT_USD as O, PYTH_SPONSORED_FEED as v } from "../constants.js";
const C = ({
recipientAddress: e,
buttonLabel: s,
containerClassName: i,
buttonClassName: o,
statusClassName: r
amount: r = O,
buttonLabel: i,
containerClassName: o,
buttonClassName: t,
statusClassName: d
}) => {
const n = _(), { mutate: u } = M(), [l, T] = p(""), [b, S] = p(
A
), [y, f] = p(
const n = w(), { mutate: u } = _(), [, A] = p(""), [T, b] = p(
m
), [S, f] = p(
"loading"
);
function E() {
const t = new O(), w = t.splitCoins(t.gas, [
// @todo: make the amount dynamic.
t.pure.u64(b)
]);
t.transferObjects([w], t.pure.address(e)), u(
function y() {
const s = new M(), E = s.splitCoins(s.gas, [s.pure.u64(T)]);
s.transferObjects([E], s.pure.address(e)), u(
{
transaction: t
transaction: s
},
{
onError: (d) => {
console.error("trx error", d), f("error");
onError: (l) => {
console.error("trx error", l), f("error");
},
onSuccess: (d) => {
console.log("trx success", d.digest), T(d.digest), f("success");
onSuccess: (l) => {
console.log("trx success", l.digest), A(l.digest), f("success");
}

@@ -36,35 +34,35 @@ }

}
return v(() => {
n && D().then((t) => {
S(j(t));
return N(() => {
n && B().then((s) => {
b(U(s, r));
});
}, [n]), n ? /* @__PURE__ */ m(
}, [n, r]), n ? /* @__PURE__ */ x(
h,
{
onClick: () => E(),
onClick: () => y(),
connected: !0,
status: y,
containerClassName: i,
buttonClassName: o,
statusClassName: r,
status: S,
containerClassName: o,
buttonClassName: t,
statusClassName: d,
children: [
s || g,
i || g,
" $",
x
r
]
}
) : /* @__PURE__ */ a(
N,
D,
{
trigger: /* @__PURE__ */ m(
trigger: /* @__PURE__ */ x(
h,
{
disabled: !!n,
containerClassName: i,
buttonClassName: o,
statusClassName: r,
containerClassName: o,
buttonClassName: t,
statusClassName: d,
children: [
s || g,
i || g,
" $",
x
r
]

@@ -77,10 +75,10 @@ }

disabled: e,
onClick: s,
onClick: r,
children: i,
connected: o,
status: r,
containerClassName: n,
buttonClassName: u,
statusClassName: l
}) => /* @__PURE__ */ m(
status: t,
containerClassName: d,
buttonClassName: n,
statusClassName: u
}) => /* @__PURE__ */ x(
"div",

@@ -90,3 +88,3 @@ {

"flex flex-col items-center justify-center px-4 py-1 rounded-md",
n
d
),

@@ -104,5 +102,5 @@ children: [

},
u
n
),
onClick: s,
onClick: r,
children: i

@@ -115,14 +113,14 @@ }

className: c("text-sm h-3", {
invisible: r === "loading"
invisible: t === "loading"
}),
children: r === "success" ? /* @__PURE__ */ a(
children: t === "success" ? /* @__PURE__ */ a(
"span",
{
className: c("text-green-600", `status-${r}`, l),
className: c("text-green-600", `status-${t}`, u),
children: "success"
}
) : r === "error" ? /* @__PURE__ */ a(
) : t === "error" ? /* @__PURE__ */ a(
"span",
{
className: c("text-red-600", `status-${r}`, l),
className: c("text-red-600", `status-${t}`, u),
children: "error"

@@ -135,11 +133,11 @@ }

}
), D = async () => (await (await fetch(
`https://hermes.pyth.network/v2/updates/price/latest?ids%5B%5D=${B}`
)).json()).parsed[0].price, j = (e) => e != null && e.price ? BigInt(
), B = async () => (await (await fetch(
`https://hermes.pyth.network/v2/updates/price/latest?ids%5B%5D=${v}`
)).json()).parsed[0].price, U = (e, r) => e != null && e.price ? BigInt(
Math.round(
x / (parseFloat(e.price) / 10 ** Math.abs(e.expo)) * 1e9
r / (parseFloat(e.price) / 10 ** Math.abs(e.expo)) * 1e9
)
) : A;
) : m;
export {
C as MerSuiWidget
};
export declare const DEFAULT_BUTTON_LABEL = "MerSui";
export declare const AMOUNT_USD = 3;
export declare const DEFAULT_AMOUNT_USD = 3;
export declare const PYTH_SPONSORED_FEED = "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744";
export declare const TRANSACTION_AMOUNT_FALLBACK = 1n;

@@ -1,7 +0,7 @@

const A = "MerSui", T = 3, c = "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744", f = 1n;
const A = "MerSui", T = 3, _ = "23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744", c = 1n;
export {
T as AMOUNT_USD,
T as DEFAULT_AMOUNT_USD,
A as DEFAULT_BUTTON_LABEL,
c as PYTH_SPONSORED_FEED,
f as TRANSACTION_AMOUNT_FALLBACK
_ as PYTH_SPONSORED_FEED,
c as TRANSACTION_AMOUNT_FALLBACK
};
{
"name": "mersui",
"version": "0.1.2",
"version": "0.2.0",
"type": "module",

@@ -55,3 +55,4 @@ "main": "dist/main.js",

"component-library"
]
],
"license": "MIT"
}

@@ -51,4 +51,5 @@ # MerSui

| ------------------- | -------- | ------- | ----------- |
| buttonLabel | string | - | Button label |
| recipientAddress | string | - | Sui address of the recipient |
| amount | number | 3 | Optional amount in USD |
| buttonLabel | string | MerSui | Optional button label |
| containerClassName | string | - | Optional class name for the button container |

@@ -55,0 +56,0 @@ | buttonClassName | string | - | Optional class name for the button |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc