@nibgate/sdk 0.1.2 → 0.1.3

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 CHANGED
@@ -166,6 +166,7 @@ const premiumGuide = {
166
166
  let lastPayment = null;
167
167
 
168
168
  const rating = createOnchainRating(premiumGuide, {
169
+ // Optional on Arc Testnet. The SDK defaults to NIBGATE_REPUTATION_CONTRACT.
169
170
  contractAddress: process.env.NEXT_PUBLIC_NIBGATE_REPUTATION_CONTRACT,
170
171
  siteId: process.env.NEXT_PUBLIC_NIBGATE_SITE_ID,
171
172
  token: process.env.NEXT_PUBLIC_NIBGATE_SITE_TOKEN,
@@ -194,6 +195,8 @@ createEvmGatewayUnlock(premiumGuide, {
194
195
 
195
196
  The lower-level `rateContentOnchain(resource, options)` function is also exported for custom UIs.
196
197
 
198
+ The SDK exports the current Arc Testnet reputation deployment as `NIBGATE_REPUTATION_CONTRACT`, plus `NIBGATE_REPUTATION_CHAIN_ID`, `NIBGATE_REPUTATION_CHAIN_NAME`, and `NIBGATE_REPUTATION_RPC_URL`. Pass `contractAddress` only when overriding the default deployment.
199
+
197
200
  Ratings are proof-gated. Page views, time spent, scroll depth, and referrers are analytics signals; they should not become trust by themselves. Reputation-critical inputs use indexed onchain rating proofs. Signed ratings remain available only for local tests and migration tooling.
198
201
 
199
202
  Nibgate reputation uses a versioned content identity:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nibgate/sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Framework-agnostic browser and server package for creator-owned gated content, unlock events, and receipts.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -75,7 +75,7 @@ export function rateResource(resource, rating = {}, extra = {}) {
75
75
  return emit('content_rating', payload);
76
76
  }
77
77
 
78
- export { contentRatingHash, NIBGATE_CONTENT_HASH_NAMESPACE, NIBGATE_REPUTATION_ABI, rateContentOnchain, reviewTextHash } from './reputation.js';
78
+ export { contentRatingHash, NIBGATE_CONTENT_HASH_NAMESPACE, NIBGATE_REPUTATION_ABI, NIBGATE_REPUTATION_CHAIN_ID, NIBGATE_REPUTATION_CHAIN_NAME, NIBGATE_REPUTATION_CONTRACT, NIBGATE_REPUTATION_RPC_URL, rateContentOnchain, reviewTextHash } from './reputation.js';
79
79
 
80
80
  export function trackResourcePage(resource, options = {}) {
81
81
  const item = createGate(resource, options.gateOptions || {});
@@ -6,6 +6,10 @@ const RATE_CONTENT_SELECTOR = '0xc62fad09';
6
6
  const ZERO_HASH = `0x${'0'.repeat(64)}`;
7
7
 
8
8
  export const NIBGATE_CONTENT_HASH_NAMESPACE = 'nibgate:content:v1';
9
+ export const NIBGATE_REPUTATION_CHAIN_ID = 5042002;
10
+ export const NIBGATE_REPUTATION_CHAIN_NAME = 'Arc Testnet';
11
+ export const NIBGATE_REPUTATION_RPC_URL = 'https://rpc.testnet.arc.network';
12
+ export const NIBGATE_REPUTATION_CONTRACT = '0x9f27fd62e75f86a3c7addfdba443aab1f930e281';
9
13
 
10
14
  export const NIBGATE_REPUTATION_ABI = [
11
15
  {
@@ -105,7 +109,7 @@ export async function rateContentOnchain(resource, options = {}) {
105
109
  const provider = options.provider || globalThis?.ethereum;
106
110
  if (!provider?.request) throw new Error('Connect an EVM wallet to rate this content onchain.');
107
111
 
108
- const contractAddress = options.contractAddress || options.reputationContract;
112
+ const contractAddress = options.contractAddress || options.reputationContract || NIBGATE_REPUTATION_CONTRACT;
109
113
  if (!contractAddress) throw new Error('Nibgate reputation contract address is not configured.');
110
114
 
111
115
  const accounts = await provider.request({ method: 'eth_requestAccounts' });
package/src/index.d.ts CHANGED
@@ -411,6 +411,10 @@ export declare function setupResourcePage(resource: NibgateResource | string, op
411
411
  export declare function rateResource(resource: NibgateResource | string, rating?: NibgateRating | number, extra?: Record<string, unknown>): boolean;
412
412
  export declare const NIBGATE_REPUTATION_ABI: readonly unknown[];
413
413
  export declare const NIBGATE_CONTENT_HASH_NAMESPACE: 'nibgate:content:v1';
414
+ export declare const NIBGATE_REPUTATION_CHAIN_ID: 5042002;
415
+ export declare const NIBGATE_REPUTATION_CHAIN_NAME: 'Arc Testnet';
416
+ export declare const NIBGATE_REPUTATION_RPC_URL: 'https://rpc.testnet.arc.network';
417
+ export declare const NIBGATE_REPUTATION_CONTRACT: '0x9f27fd62e75f86a3c7addfdba443aab1f930e281';
414
418
  export declare function contentRatingHash(resource: NibgateResource | string, options?: Record<string, unknown>): string;
415
419
  export declare function reviewTextHash(review?: string): string;
416
420
  export declare function rateContentOnchain(resource: NibgateResource | string, options: NibgateOnchainRatingOptions): Promise<NibgateOnchainRatingResult>;