@campnetwork/origin 1.4.0-alpha.6 → 1.4.0-alpha.8
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 +56 -1
- package/dist/core.cjs +46 -33
- package/dist/core.d.ts +11 -2
- package/dist/core.esm.d.ts +11 -2
- package/dist/core.esm.js +15 -2
- package/dist/react/index.esm.d.ts +11 -2
- package/dist/react/index.esm.js +73 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1192,6 +1192,62 @@ const result = await auth.origin.bulkMintFile(
|
|
|
1192
1192
|
console.log("Minted token IDs:", result.tokenIds);
|
|
1193
1193
|
```
|
|
1194
1194
|
|
|
1195
|
+
### IPFS Credentials for Large File Uploads
|
|
1196
|
+
|
|
1197
|
+
Files up to **20 MB** are uploaded automatically via the SDK's built-in S3 multipart upload. Files larger than 20 MB require you to configure your own IPFS pinning service credentials. Once configured, the SDK uploads the file directly to your IPFS provider and registers the resulting CID with Origin.
|
|
1198
|
+
|
|
1199
|
+
#### Supported Providers
|
|
1200
|
+
|
|
1201
|
+
| Provider | Required Fields |
|
|
1202
|
+
| --- | --- |
|
|
1203
|
+
| **Pinata** | `jwt` **or** both `apiKey` and `apiSecret` |
|
|
1204
|
+
| **Infura** | `projectId` and `projectSecret` |
|
|
1205
|
+
| **web3.storage** | `token` |
|
|
1206
|
+
|
|
1207
|
+
#### Saving Credentials
|
|
1208
|
+
|
|
1209
|
+
```typescript
|
|
1210
|
+
await auth.origin.saveIpfsCredentials({
|
|
1211
|
+
provider: "pinata",
|
|
1212
|
+
jwt: "your-pinata-jwt",
|
|
1213
|
+
});
|
|
1214
|
+
```
|
|
1215
|
+
|
|
1216
|
+
#### Verifying & Checking Credentials
|
|
1217
|
+
|
|
1218
|
+
```typescript
|
|
1219
|
+
// Verify that saved credentials are valid
|
|
1220
|
+
const { valid, error } = await auth.origin.verifyIpfsCredentials();
|
|
1221
|
+
|
|
1222
|
+
// Check if credentials have been configured
|
|
1223
|
+
const hasCredentials = await auth.origin.hasIpfsCredentials();
|
|
1224
|
+
```
|
|
1225
|
+
|
|
1226
|
+
#### Deleting Credentials
|
|
1227
|
+
|
|
1228
|
+
```typescript
|
|
1229
|
+
await auth.origin.deleteIpfsCredentials();
|
|
1230
|
+
```
|
|
1231
|
+
|
|
1232
|
+
#### How It Works
|
|
1233
|
+
|
|
1234
|
+
When `mintFile` or `bulkMintFile` is called:
|
|
1235
|
+
|
|
1236
|
+
1. If the file is **≤ 20 MB**, it is uploaded via the built-in S3 multipart upload — no IPFS credentials needed.
|
|
1237
|
+
2. If the file is **> 20 MB** (or the `forceIpfs` option is set), the SDK fetches your IPFS upload config and uploads the file directly to your pinning service.
|
|
1238
|
+
3. If no IPFS credentials are configured for a file that exceeds 20 MB, the SDK throws an error:
|
|
1239
|
+
> `File "example.mp4" exceeds 20MB limit. Please configure your IPFS pinning service in Settings to upload large files.`
|
|
1240
|
+
|
|
1241
|
+
#### Forcing IPFS Upload
|
|
1242
|
+
|
|
1243
|
+
You can force any file (even those under 20 MB) to be uploaded via IPFS by passing `forceIpfs: true`:
|
|
1244
|
+
|
|
1245
|
+
```typescript
|
|
1246
|
+
await auth.origin.mintFile(file, metadata, license, [], {
|
|
1247
|
+
forceIpfs: true,
|
|
1248
|
+
});
|
|
1249
|
+
```
|
|
1250
|
+
|
|
1195
1251
|
### IpNFT & Marketplace Methods
|
|
1196
1252
|
|
|
1197
1253
|
Most methods mirror smart contract functions and require appropriate permissions.
|
|
@@ -1227,7 +1283,6 @@ These methods handle complexity automatically and are recommended for most use c
|
|
|
1227
1283
|
|
|
1228
1284
|
- `getTokenInfoSmart(tokenId, owner?)` — Get comprehensive token info in a single call (owner, terms, status, access info, etc.)
|
|
1229
1285
|
- `buyAccessSmart(tokenId)` — Buys access with automatic fee fetching. Returns `null` if user already has access.
|
|
1230
|
-
- `settlePaymentIntent(x402Response, signer?)` — Settle an X402 payment intent response
|
|
1231
1286
|
|
|
1232
1287
|
**Example:**
|
|
1233
1288
|
|