@beampay/checkout 1.0.0

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 ADDED
@@ -0,0 +1,29 @@
1
+ # @beampay/checkout
2
+
3
+ Framework-agnostic embeddable payment widget for BeamPay.
4
+
5
+ ## CDN usage
6
+
7
+ ```html
8
+ <script src="https://cdn.beampay.fun/checkout/v1.js" defer></script>
9
+ <button id="pay"></button>
10
+ <script>
11
+ BeamPay.init({
12
+ apiUrl: 'https://api.beampay.fun',
13
+ chain: 'bsc',
14
+ merchant: '0x...',
15
+ token: '0x55d398326f99059fF775485246999027B3197955',
16
+ amount: '100000000',
17
+ onSuccess: (order) => console.log('paid', order),
18
+ onError: (err) => console.error(err),
19
+ }).mount('#pay')
20
+ </script>
21
+ ```
22
+
23
+ ## npm usage
24
+
25
+ ```ts
26
+ import { BeamPayCheckout } from '@beampay/checkout'
27
+ const checkout = new BeamPayCheckout({ ... })
28
+ checkout.mount(document.querySelector('#pay'))
29
+ ```
@@ -0,0 +1,12 @@
1
+ import type { Chain } from 'viem';
2
+ /** Chain keys accepted in BeamPayCheckoutOptions.chain — mirrors beampay-web. */
3
+ export type ChainKey = 'bsc' | 'ethereum' | 'bsc-testnet';
4
+ export declare const SUPPORTED_CHAINS: Record<ChainKey, Chain>;
5
+ export declare const CHAIN_ID_TO_KEY: Record<number, ChainKey>;
6
+ export declare function isChainKey(v: string): v is ChainKey;
7
+ export declare function chainId(chain: ChainKey): number;
8
+ export declare function explorerTxUrl(chain: ChainKey, hash: string): string;
9
+ /** Sentinel for the chain's native asset (BNB / ETH). */
10
+ export declare const NATIVE_TOKEN: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
11
+ export declare function isNativeAddress(address: string): boolean;
12
+ //# sourceMappingURL=chains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../src/chains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAGjC,iFAAiF;AACjF,MAAM,MAAM,QAAQ,GAAG,KAAK,GAAG,UAAU,GAAG,aAAa,CAAA;AAEzD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,CAIpD,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAIpD,CAAA;AAQD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,QAAQ,CAEnD;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAE/C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,yDAAyD;AACzD,eAAO,MAAM,YAAY,EAAG,4CAAqD,CAAA;AAEjF,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAExD"}