@goodwidget/ai-credits-widget 0.1.1
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 +25 -0
- package/dist/chunk-5ABKU4SW.js +4518 -0
- package/dist/chunk-5ABKU4SW.js.map +1 -0
- package/dist/chunk-YIXMIOVW.js +24 -0
- package/dist/chunk-YIXMIOVW.js.map +1 -0
- package/dist/element.cjs +4487 -0
- package/dist/element.cjs.map +1 -0
- package/dist/element.js +24 -0
- package/dist/element.js.map +1 -0
- package/dist/index.cjs +4527 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/mocked/index.cjs +4786 -0
- package/dist/mocked/index.cjs.map +1 -0
- package/dist/mocked/index.js +330 -0
- package/dist/mocked/index.js.map +1 -0
- package/dist/register.cjs +4759 -0
- package/dist/register.cjs.map +1 -0
- package/dist/register.js +20 -0
- package/dist/register.js.map +1 -0
- package/package.json +65 -0
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# AI Credits Widget
|
|
2
|
+
|
|
3
|
+
```tsx
|
|
4
|
+
import { AiCreditsWidget } from '@goodwidget/ai-credits-widget'
|
|
5
|
+
|
|
6
|
+
<AiCreditsWidget provider={provider} backendUrl="https://your-ai-credits-backend.example" />
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
For a Custom Element, import `@goodwidget/ai-credits-widget/register`. This import is safe during
|
|
10
|
+
Node.js and Next.js server evaluation; it registers `<ai-credits-widget>` only in a browser. Set
|
|
11
|
+
the injected EIP-1193 provider and optional `themeOverrides` as element properties.
|
|
12
|
+
|
|
13
|
+
Production requires `backendUrl`. The widget keeps its Celo and Base RPC and contract defaults
|
|
14
|
+
internally and fails closed with a backend-unavailable state when the production backend is absent.
|
|
15
|
+
Only the `development` environment may use the built-in mock backend and chain clients.
|
|
16
|
+
|
|
17
|
+
## EIP-1193 capabilities
|
|
18
|
+
|
|
19
|
+
Grant only these EIP-1193 methods to the injected provider:
|
|
20
|
+
|
|
21
|
+
- `eth_accounts` and `eth_chainId` to read the connected wallet.
|
|
22
|
+
- `eth_requestAccounts` when the user selects **Connect Wallet**.
|
|
23
|
+
- `wallet_switchEthereumChain` when the user selects the Celo network switch action.
|
|
24
|
+
- `personal_sign` when the user generates the buyer key.
|
|
25
|
+
- `eth_sendTransaction` when the user confirms a Celo payment.
|