Skip to content

Commit 0fc7e4e

Browse files
author
Alan Shaw
authored
refactor: remove pinata (#2078)
This PR removes the pinata cron job (attempting to pin things), and removes the pinata default pin that gets inserted when an upload is created. The pinata entry in the database service enum remains because a) we have loads of rows referencing that value and b) you can't remove a postgres enum value - you need to drop the whole enum and recreate (which would be really difficult considering the number of rows we have referencing it). This effectively stops NFT.Storage pinning to Pinata. closes #260 closes #391
1 parent 25c2969 commit 0fc7e4e

16 files changed

Lines changed: 7 additions & 313 deletions

File tree

.github/workflows/cron-pinata.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

DEVELOPMENT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ The vars below are used by the API and/or GitHub cron actions and should be set
6666
| STAGING_DATABASE_TOKEN | Auth token for staging Postgrest API | |
6767
| PROD_DATABASE_CONNECTION | Connection string for prodction db (used by cron jobs) | |
6868
| STAGING_DATABASE_CONNECTION | Connection string for staging db (used by cron jobs) | |
69-
| PINATA_JWT | Auth token for pinning to Pinata cluster | |
7069
| DAG_CARGO_HOST | Endpoint for dag cargo API | |
7170
| DAG_CARGO_DATABASE | dag cargo database name | |
7271
| DAG_CARGO_USER | dag cargo db username | |

packages/api/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ Go to `/packages/api/src/constants.js` _uncomment_ the first line and run `wrang
6464
# production secrets
6565
wrangler secret put MAGIC_SECRET_KEY --env production # Get from magic.link account
6666
wrangler secret put SALT --env production # open `https://csprng.xyz/v1/api` in the browser and use the value of `Data`
67-
wrangler secret put PINATA_JWT --env production # Get from Pinata
6867
wrangler secret put SENTRY_DSN --env USER # Get from Sentry
6968
wrangler secret put DATABASE_TOKEN --env production # Get from database account
7069
wrangler secret put CLUSTER_BASIC_AUTH_TOKEN --env production # Get from nft.storage vault in 1password

packages/api/db/tables.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ CREATE TYPE pin_status_type AS ENUM (
3939

4040
-- Service type is the place/location/organisation that is pinning the content.
4141
CREATE TYPE service_type AS ENUM (
42-
-- The NFT.Storage cluster in Pinata.
42+
-- The NFT.Storage cluster in Pinata (LEGACY).
4343
'Pinata',
4444
-- The original NFT.Storage cluster.
4545
'IpfsCluster',
46-
-- The current cluster, originally commissioned for niftysave.
46+
-- An IPFS Cluster originally commissioned for niftysave.
4747
'IpfsCluster2',
48-
-- New cluster with flatfs and better DHT
48+
-- New cluster with flatfs and better DHT.
4949
'IpfsCluster3'
5050
);
5151

packages/api/src/bindings.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export type NFT = {
143143
*/
144144
files: Array<{ name?: string; type?: string } | undefined>
145145
/**
146-
* Pinata pin name and meta.
146+
* Pin name and meta.
147147
*/
148148
pin?: { name?: string; meta?: Record<string, string> }
149149
/**

packages/api/src/utils/db-client.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,6 @@ export class DBClient {
267267
status: 'PinQueued',
268268
service: 'IpfsCluster3',
269269
},
270-
{
271-
status: 'PinQueued',
272-
service: 'Pinata',
273-
},
274270
]
275271

276272
const now = new Date().toISOString()

packages/api/test/nfts-store.spec.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,6 @@ describe('NFT store', () => {
8080
status: 'PinQueued',
8181
service: 'IpfsCluster3',
8282
},
83-
{
84-
content_cid:
85-
'bafyreicnwbboevx6g6fykitf4nebz2kqgkqz35qvlnlcgfulhrris66m6i',
86-
status: 'PinQueued',
87-
service: 'Pinata',
88-
},
8983
])
9084
})
9185

@@ -145,12 +139,6 @@ describe('NFT store', () => {
145139
status: 'PinQueued',
146140
service: 'IpfsCluster3',
147141
},
148-
{
149-
content_cid:
150-
'bafyreibubvuqeh5lm2ccose7uq54wweeajtjuhcj4pciogeq2lhbw2a23y',
151-
status: 'PinQueued',
152-
service: 'Pinata',
153-
},
154142
])
155143
})
156144
})

packages/client/src/lib/interface.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,6 @@ export interface FinalizedDeal extends DealInfo {
249249
}
250250

251251
export interface Pin {
252-
// Pinata does not provide this
253-
// requestid: string
254252
cid: CIDString
255253
name?: string
256254
status: PinStatus

packages/cron/package.json

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
"type": "module",
88
"bin": {
99
"nftstorage-metrics": "src/bin/metrics.js",
10-
"nftstorage-pins": "src/bin/pins.js",
11-
"nftstorage-pinata": "src/bin/pinata.js"
10+
"nftstorage-pins": "src/bin/pins.js"
1211
},
1312
"scripts": {
1413
"lint": "eslint 'src/**/*.js'",
@@ -17,7 +16,6 @@
1716
"start:nft-ttr": "node src/bin/nft-ttr.js",
1817
"start:pins": "NODE_TLS_REJECT_UNAUTHORIZED=0 node src/bin/pins.js",
1918
"start:pins-failed": "NODE_TLS_REJECT_UNAUTHORIZED=0 node src/bin/pins-failed.js",
20-
"start:pinata": "node src/bin/pinata.js",
2119
"start:dagcargo:sizes": "NODE_TLS_REJECT_UNAUTHORIZED=0 node src/bin/dagcargo-sizes.js",
2220
"start:metrics": "NODE_TLS_REJECT_UNAUTHORIZED=0 node src/bin/metrics.js",
2321
"test": "c8 ava",
@@ -32,7 +30,6 @@
3230
"dotenv": "^10.0.0",
3331
"form-data": "^4.0.0",
3432
"it-to-buffer": "^2.0.2",
35-
"limiter": "2.0.1",
3633
"nft.storage": "^6.0.0",
3734
"p-retry": "^4.6.1",
3835
"p-settle": "^5.0.0",
@@ -128,7 +125,6 @@
128125
{
129126
"files": [
130127
"./src/jobs/dagcargo.js",
131-
"./src/jobs/pinata.js",
132128
"./src/jobs/pins.js",
133129
"./src/lib/ipfs.js"
134130
],
@@ -140,8 +136,7 @@
140136
"files": [
141137
"./src/jobs/dagcargo.js",
142138
"./src/jobs/pins.js",
143-
"./src/lib/fetch.js",
144-
"./src/lib/pinata.js"
139+
"./src/lib/fetch.js"
145140
],
146141
"rules": {
147142
"@typescript-eslint/no-unsafe-return": "off"
@@ -151,7 +146,6 @@
151146
"files": [
152147
"./src/bin/dagcargo-sizes.js",
153148
"./src/bin/metrics.js",
154-
"./src/bin/pinata.js",
155149
"./src/bin/pins-failed.js",
156150
"./src/bin/pins.js"
157151
],
@@ -163,13 +157,10 @@
163157
"files": [
164158
"./src/bin/dagcargo-sizes.js",
165159
"./src/bin/metrics.js",
166-
"./src/bin/pinata.js",
167160
"./src/bin/pins-failed.js",
168161
"./src/bin/pins.js",
169162
"./src/jobs/dagcargo.js",
170-
"./src/jobs/pinata.js",
171-
"./src/jobs/pins.js",
172-
"./src/lib/pinata.js"
163+
"./src/jobs/pins.js"
173164
],
174165
"rules": {
175166
"@typescript-eslint/naming-convention": "off"

packages/cron/src/bin/pinata.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)