From 5d6dfd649400fe763857cfea6efce786624b6ec5 Mon Sep 17 00:00:00 2001 From: bry Date: Fri, 13 Oct 2023 15:50:05 -0500 Subject: [PATCH 01/14] wip --- packages/metadata-service/package.json | 1 + packages/metadata-service/src/constants.ts | 7 + packages/metadata-service/src/index.ts | 150 +++++++++++++-------- packages/metadata-service/tsconfig.json | 3 + 4 files changed, 103 insertions(+), 58 deletions(-) create mode 100644 packages/metadata-service/src/constants.ts diff --git a/packages/metadata-service/package.json b/packages/metadata-service/package.json index bde0befa7..38e1c6382 100644 --- a/packages/metadata-service/package.json +++ b/packages/metadata-service/package.json @@ -37,6 +37,7 @@ "@helium/address": "^4.10.2", "@helium/helium-entity-manager-sdk": "^0.4.1", "@helium/helium-sub-daos-sdk": "^0.4.1", + "@helium/spl-utils": "^0.4.1", "@metaplex-foundation/mpl-token-metadata": "^2.10.0", "@solana/spl-token": "^0.3.8", "@solana/web3.js": "^1.78.4", diff --git a/packages/metadata-service/src/constants.ts b/packages/metadata-service/src/constants.ts new file mode 100644 index 000000000..abeca7506 --- /dev/null +++ b/packages/metadata-service/src/constants.ts @@ -0,0 +1,7 @@ +import { subDaoKey } from '@helium/helium-sub-daos-sdk'; +import { IOT_MINT, MOBILE_MINT } from '@helium/spl-utils'; + +export const SHDW_DRIVE_URL = + 'https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP'; +export const IOT_SUB_DAO_KEY = subDaoKey(IOT_MINT)[0]; +export const MOBILE_SUB_DAO_KEY = subDaoKey(MOBILE_MINT)[0]; diff --git a/packages/metadata-service/src/index.ts b/packages/metadata-service/src/index.ts index 454234472..0700bbda2 100644 --- a/packages/metadata-service/src/index.ts +++ b/packages/metadata-service/src/index.ts @@ -1,50 +1,55 @@ -import { Program } from "@coral-xyz/anchor"; -import cors from "@fastify/cors"; -import Address from "@helium/address/build/Address"; -import { decodeEntityKey, init } from "@helium/helium-entity-manager-sdk"; -import { HeliumEntityManager } from "@helium/idls/lib/types/helium_entity_manager"; -import { PublicKey } from "@solana/web3.js"; +import { Program } from '@coral-xyz/anchor'; +import cors from '@fastify/cors'; +import Address from '@helium/address/build/Address'; +import { + decodeEntityKey, + init, + iotInfoKey, + mobileInfoKey, + rewardableEntityConfigKey, +} from '@helium/helium-entity-manager-sdk'; +import { HeliumEntityManager } from '@helium/idls/lib/types/helium_entity_manager'; +import { PublicKey } from '@solana/web3.js'; // @ts-ignore -import animalHash from "angry-purple-tiger"; -import Fastify, { FastifyInstance } from "fastify"; -import axios from "axios"; -import { provider } from "./solana"; +import animalHash from 'angry-purple-tiger'; +import Fastify, { FastifyInstance } from 'fastify'; +import axios from 'axios'; +import { provider } from './solana'; import { IotHotspotInfo, KeyToAsset, MobileHotspotInfo, sequelize, -} from "./model"; -import bs58 from "bs58"; -import { truthy } from "@helium/spl-utils"; +} from './model'; +import bs58 from 'bs58'; +import { truthy } from '@helium/spl-utils'; +import { + IOT_SUB_DAO_KEY, + MOBILE_SUB_DAO_KEY, + SHDW_DRIVE_URL, +} from './constants'; const server: FastifyInstance = Fastify({ logger: true, }); server.register(cors, { - origin: "*", + origin: '*', }); -server.get("/health", async () => { +server.get('/health', async () => { return { ok: true }; }); let program: Program; server.get<{ Params: { keyToAssetKey: string } }>( - "/v1/:keyToAssetKey", + '/v1/:keyToAssetKey', async (request, reply) => { + program = program || (await init(provider)); const { keyToAssetKey } = request.params; const keyToAsset = new PublicKey(keyToAssetKey); - if (!program) { - program = await init(provider); - } - const keyToAssetAccount = await program.account.keyToAssetV0.fetch( - keyToAsset - ); - const keyStr = decodeEntityKey( - keyToAssetAccount.entityKey, - keyToAssetAccount.keySerialization - ); + const keyToAssetAcc = await program.account.keyToAssetV0.fetch(keyToAsset); + const { entityKey, keySerialization } = keyToAssetAcc; + const keyStr = decodeEntityKey(entityKey, keySerialization); const digest = animalHash(keyStr); const record = await KeyToAsset.findOne({ where: { @@ -53,44 +58,68 @@ server.get<{ Params: { keyToAssetKey: string } }>( include: [IotHotspotInfo, MobileHotspotInfo], }); + // HACK: If it has a long key, it's an RSA key, and this is a mobile hotspot. + // In the future, we need to put different symbols on different types of hotspots + const hotspotType = entityKey.length > 100 ? 'MOBILE' : 'IOT'; + const isMobile = hotspotType === 'MOBILE'; + const [configKey] = rewardableEntityConfigKey( + isMobile ? MOBILE_SUB_DAO_KEY : IOT_SUB_DAO_KEY, + hotspotType + ); + + const [info] = isMobile + ? mobileInfoKey(configKey, entityKey) + : iotInfoKey(configKey, entityKey); + + const infoAcc = await program.account[ + isMobile ? 'mobileHotspotInfoV0' : 'iotHotspotInfoV0' + ].fetch(info); + + const image = `${SHDW_DRIVE_URL}/${ + infoAcc?.isActive + ? isMobile + ? 'mobile-hotspot-active.png' + : 'hotspot-active.png' + : isMobile + ? 'mobile-hotspot.png' + : 'hotspot.png' + }`; + return { - name: keyStr === "iot_operations_fund" ? "IOT Operations Fund" : digest, + name: keyStr === 'iot_operations_fund' ? 'IOT Operations Fund' : digest, description: - keyStr === "iot_operations_fund" - ? "IOT Operations Fund" - : "A Rewardable NFT on Helium", + keyStr === 'iot_operations_fund' + ? 'IOT Operations Fund' + : 'A Rewardable NFT on Helium', // HACK: If it has a long key, it's an RSA key, and this is a mobile hotspot. // In the future, we need to put different symbols on different types of hotspots - image: - keyToAssetAccount.entityKey.length > 100 - ? "https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP/mobile-hotspot.png" - : "https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP/hotspot.png", + image, attributes: [ keyStr && Address.isValid(keyStr) - ? { trait_type: "ecc_compact", value: keyStr } + ? { trait_type: 'ecc_compact', value: keyStr } : undefined, - { trait_type: "entity_key_string", value: keyStr }, + { trait_type: 'entity_key_string', value: keyStr }, { - trait_type: "entity_key", - value: keyToAssetAccount.entityKey.toString("base64"), + trait_type: 'entity_key', + value: entityKey.toString('base64'), }, - { trait_type: "rewardable", value: true }, + { trait_type: 'rewardable', value: true }, { - trait_type: "networks", + trait_type: 'networks', value: [ - record?.iot_hotspot_info && "iot", - record?.mobile_hotspot_info && "mobile", + record?.iot_hotspot_info && 'iot', + record?.mobile_hotspot_info && 'mobile', ].filter(truthy), }, - ...locationAttributes("iot", record?.iot_hotspot_info), - ...locationAttributes("mobile", record?.mobile_hotspot_info), + ...locationAttributes('iot', record?.iot_hotspot_info), + ...locationAttributes('mobile', record?.mobile_hotspot_info), ], }; } ); server.get<{ Params: { eccCompact: string } }>( - "/:eccCompact", + '/:eccCompact', async (request, reply) => { const { eccCompact } = request.params; @@ -114,25 +143,30 @@ server.get<{ Params: { eccCompact: string } }>( }); const digest = animalHash(eccCompact); + const [configKey] = rewardableEntityConfigKey(IOT_SUB_DAO_KEY, 'IOT'); + const [info] = iotInfoKey(configKey, eccCompact); + const infoAcc = await program.account.iotHotspotInfoV0.fetch(info); + const image = `${SHDW_DRIVE_URL}/${ + infoAcc?.isActive ? 'hotspot-active.png' : 'hotspot.png' + }`; return { name: digest, - description: "A Hotspot NFT on Helium", - image: - "https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP/hotspot.png", + description: 'A Hotspot NFT on Helium', + image, attributes: [ - { trait_type: "ecc_compact", value: eccCompact }, - { trait_type: "rewardable", value: true }, + { trait_type: 'ecc_compact', value: eccCompact }, + { trait_type: 'rewardable', value: true }, { - trait_type: "networks", + trait_type: 'networks', value: [ - record?.iot_hotspot_info && "iot", - record?.mobile_hotspot_info && "mobile", + record?.iot_hotspot_info && 'iot', + record?.mobile_hotspot_info && 'mobile', ].filter(truthy), }, - ...locationAttributes("iot", record?.iot_hotspot_info), - ...locationAttributes("mobile", record?.mobile_hotspot_info), - ] + ...locationAttributes('iot', record?.iot_hotspot_info), + ...locationAttributes('mobile', record?.mobile_hotspot_info), + ], }; } ); @@ -163,10 +197,10 @@ const start = async () => { await sequelize.query(` CREATE UNIQUE INDEX IF NOT EXISTS mobile_hotspot_infos_asset_index ON mobile_hotspot_infos(asset); `); - await server.listen({ port: 8081, host: "0.0.0.0" }); + await server.listen({ port: 8081, host: '0.0.0.0' }); const address = server.server.address(); - const port = typeof address === "string" ? address : address?.port; + const port = typeof address === 'string' ? address : address?.port; } catch (err) { server.log.error(err); process.exit(1); diff --git a/packages/metadata-service/tsconfig.json b/packages/metadata-service/tsconfig.json index 2bbbd2780..31e2caef4 100644 --- a/packages/metadata-service/tsconfig.json +++ b/packages/metadata-service/tsconfig.json @@ -1,6 +1,9 @@ { "extends": "../../tsconfig.root.json", "references": [ + { + "path": "../spl-utils" + }, { "path": "../helium-entity-manager-sdk" }, From 8b88fe2b4cfafb116f426379bbbbd9647314e7c6 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 12:09:05 -0500 Subject: [PATCH 02/14] remove unneeded logic --- packages/metadata-service/src/constants.ts | 5 --- packages/metadata-service/src/index.ts | 50 ++++++---------------- packages/metadata-service/src/model.ts | 36 +++++++++------- 3 files changed, 32 insertions(+), 59 deletions(-) diff --git a/packages/metadata-service/src/constants.ts b/packages/metadata-service/src/constants.ts index abeca7506..2316643f3 100644 --- a/packages/metadata-service/src/constants.ts +++ b/packages/metadata-service/src/constants.ts @@ -1,7 +1,2 @@ -import { subDaoKey } from '@helium/helium-sub-daos-sdk'; -import { IOT_MINT, MOBILE_MINT } from '@helium/spl-utils'; - export const SHDW_DRIVE_URL = 'https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP'; -export const IOT_SUB_DAO_KEY = subDaoKey(IOT_MINT)[0]; -export const MOBILE_SUB_DAO_KEY = subDaoKey(MOBILE_MINT)[0]; diff --git a/packages/metadata-service/src/index.ts b/packages/metadata-service/src/index.ts index 0700bbda2..e260246f1 100644 --- a/packages/metadata-service/src/index.ts +++ b/packages/metadata-service/src/index.ts @@ -1,33 +1,23 @@ import { Program } from '@coral-xyz/anchor'; import cors from '@fastify/cors'; import Address from '@helium/address/build/Address'; -import { - decodeEntityKey, - init, - iotInfoKey, - mobileInfoKey, - rewardableEntityConfigKey, -} from '@helium/helium-entity-manager-sdk'; +import { decodeEntityKey, init } from '@helium/helium-entity-manager-sdk'; import { HeliumEntityManager } from '@helium/idls/lib/types/helium_entity_manager'; import { PublicKey } from '@solana/web3.js'; // @ts-ignore +import { truthy } from '@helium/spl-utils'; import animalHash from 'angry-purple-tiger'; -import Fastify, { FastifyInstance } from 'fastify'; import axios from 'axios'; -import { provider } from './solana'; +import bs58 from 'bs58'; +import Fastify, { FastifyInstance } from 'fastify'; +import { SHDW_DRIVE_URL } from './constants'; import { IotHotspotInfo, KeyToAsset, MobileHotspotInfo, sequelize, } from './model'; -import bs58 from 'bs58'; -import { truthy } from '@helium/spl-utils'; -import { - IOT_SUB_DAO_KEY, - MOBILE_SUB_DAO_KEY, - SHDW_DRIVE_URL, -} from './constants'; +import { provider } from './solana'; const server: FastifyInstance = Fastify({ logger: true, @@ -62,26 +52,13 @@ server.get<{ Params: { keyToAssetKey: string } }>( // In the future, we need to put different symbols on different types of hotspots const hotspotType = entityKey.length > 100 ? 'MOBILE' : 'IOT'; const isMobile = hotspotType === 'MOBILE'; - const [configKey] = rewardableEntityConfigKey( - isMobile ? MOBILE_SUB_DAO_KEY : IOT_SUB_DAO_KEY, - hotspotType - ); - - const [info] = isMobile - ? mobileInfoKey(configKey, entityKey) - : iotInfoKey(configKey, entityKey); - - const infoAcc = await program.account[ - isMobile ? 'mobileHotspotInfoV0' : 'iotHotspotInfoV0' - ].fetch(info); - const image = `${SHDW_DRIVE_URL}/${ - infoAcc?.isActive - ? isMobile + isMobile + ? record?.mobile_hotspot_info?.is_active ? 'mobile-hotspot-active.png' - : 'hotspot-active.png' - : isMobile - ? 'mobile-hotspot.png' + : 'mobile-hotspot.png' + : record?.iot_hotspot_info?.is_active + ? 'hotspot-active.png' : 'hotspot.png' }`; @@ -143,11 +120,8 @@ server.get<{ Params: { eccCompact: string } }>( }); const digest = animalHash(eccCompact); - const [configKey] = rewardableEntityConfigKey(IOT_SUB_DAO_KEY, 'IOT'); - const [info] = iotInfoKey(configKey, eccCompact); - const infoAcc = await program.account.iotHotspotInfoV0.fetch(info); const image = `${SHDW_DRIVE_URL}/${ - infoAcc?.isActive ? 'hotspot-active.png' : 'hotspot.png' + record?.iot_hotspot_info?.is_active ? 'hotspot-active.png' : 'hotspot.png' }`; return { diff --git a/packages/metadata-service/src/model.ts b/packages/metadata-service/src/model.ts index c60a362a7..8323aeaca 100644 --- a/packages/metadata-service/src/model.ts +++ b/packages/metadata-service/src/model.ts @@ -1,12 +1,12 @@ -import { Sequelize, STRING, Model, DataTypes } from "sequelize"; -import AWS from "aws-sdk"; -import * as pg from "pg"; +import { Sequelize, STRING, Model, DataTypes } from 'sequelize'; +import AWS from 'aws-sdk'; +import * as pg from 'pg'; -const host = process.env.PGHOST || "localhost"; +const host = process.env.PGHOST || 'localhost'; const port = Number(process.env.PGPORT) || 5432; export const sequelize = new Sequelize({ host: host, - dialect: "postgres", + dialect: 'postgres', port: port, logging: false, dialectModule: pg, @@ -20,7 +20,7 @@ export const sequelize = new Sequelize({ }, hooks: { beforeConnect: async (config: any) => { - const isRds = host.includes("rds.amazonaws.com"); + const isRds = host.includes('rds.amazonaws.com'); let password = process.env.PGPASSWORD; if (isRds && !password) { @@ -58,6 +58,7 @@ export class MobileHotspotInfo extends Model { declare country: string; declare lat: number; declare long: number; + declare is_active: boolean; } MobileHotspotInfo.init( { @@ -71,11 +72,12 @@ MobileHotspotInfo.init( city: DataTypes.STRING, state: DataTypes.STRING, country: DataTypes.STRING, + isActive: DataTypes.BOOLEAN, }, { sequelize, - modelName: "mobile_hotspot_infos", - tableName: "mobile_hotspot_infos", + modelName: 'mobile_hotspot_infos', + tableName: 'mobile_hotspot_infos', underscored: true, timestamps: false, } @@ -90,6 +92,7 @@ export class IotHotspotInfo extends Model { declare country: string; declare lat: number; declare long: number; + declare is_active: boolean; } IotHotspotInfo.init( { @@ -103,11 +106,12 @@ IotHotspotInfo.init( city: DataTypes.STRING, state: DataTypes.STRING, country: DataTypes.STRING, + isActive: DataTypes.BOOLEAN, }, { sequelize, - modelName: "iot_hotspot_infos", - tableName: "iot_hotspot_infos", + modelName: 'iot_hotspot_infos', + tableName: 'iot_hotspot_infos', underscored: true, timestamps: false, } @@ -131,18 +135,18 @@ KeyToAsset.init( }, { sequelize, - modelName: "key_to_assets", - tableName: "key_to_assets", + modelName: 'key_to_assets', + tableName: 'key_to_assets', underscored: true, timestamps: false, } ); KeyToAsset.hasOne(IotHotspotInfo, { - sourceKey: "asset", - foreignKey: "asset", + sourceKey: 'asset', + foreignKey: 'asset', }); KeyToAsset.hasOne(MobileHotspotInfo, { - sourceKey: "asset", - foreignKey: "asset" + sourceKey: 'asset', + foreignKey: 'asset', }); From f54755148425c70ee579b1cda040c25e1bafe51a Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 12:13:43 -0500 Subject: [PATCH 03/14] prettier --- packages/metadata-service/src/constants.ts | 2 +- packages/metadata-service/src/index.ts | 98 +++++++++++----------- packages/metadata-service/src/model.ts | 32 +++---- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/packages/metadata-service/src/constants.ts b/packages/metadata-service/src/constants.ts index 2316643f3..d6004e210 100644 --- a/packages/metadata-service/src/constants.ts +++ b/packages/metadata-service/src/constants.ts @@ -1,2 +1,2 @@ export const SHDW_DRIVE_URL = - 'https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP'; + "https://shdw-drive.genesysgo.net/6tcnBSybPG7piEDShBcrVtYJDPSvGrDbVvXmXKpzBvWP"; diff --git a/packages/metadata-service/src/index.ts b/packages/metadata-service/src/index.ts index e260246f1..5293355ab 100644 --- a/packages/metadata-service/src/index.ts +++ b/packages/metadata-service/src/index.ts @@ -1,38 +1,38 @@ -import { Program } from '@coral-xyz/anchor'; -import cors from '@fastify/cors'; -import Address from '@helium/address/build/Address'; -import { decodeEntityKey, init } from '@helium/helium-entity-manager-sdk'; -import { HeliumEntityManager } from '@helium/idls/lib/types/helium_entity_manager'; -import { PublicKey } from '@solana/web3.js'; +import { Program } from "@coral-xyz/anchor"; +import cors from "@fastify/cors"; +import Address from "@helium/address/build/Address"; +import { decodeEntityKey, init } from "@helium/helium-entity-manager-sdk"; +import { HeliumEntityManager } from "@helium/idls/lib/types/helium_entity_manager"; +import { PublicKey } from "@solana/web3.js"; // @ts-ignore -import { truthy } from '@helium/spl-utils'; -import animalHash from 'angry-purple-tiger'; -import axios from 'axios'; -import bs58 from 'bs58'; -import Fastify, { FastifyInstance } from 'fastify'; -import { SHDW_DRIVE_URL } from './constants'; +import { truthy } from "@helium/spl-utils"; +import animalHash from "angry-purple-tiger"; +import axios from "axios"; +import bs58 from "bs58"; +import Fastify, { FastifyInstance } from "fastify"; +import { SHDW_DRIVE_URL } from "./constants"; import { IotHotspotInfo, KeyToAsset, MobileHotspotInfo, sequelize, -} from './model'; -import { provider } from './solana'; +} from "./model"; +import { provider } from "./solana"; const server: FastifyInstance = Fastify({ logger: true, }); server.register(cors, { - origin: '*', + origin: "*", }); -server.get('/health', async () => { +server.get("/health", async () => { return { ok: true }; }); let program: Program; server.get<{ Params: { keyToAssetKey: string } }>( - '/v1/:keyToAssetKey', + "/v1/:keyToAssetKey", async (request, reply) => { program = program || (await init(provider)); const { keyToAssetKey } = request.params; @@ -50,53 +50,53 @@ server.get<{ Params: { keyToAssetKey: string } }>( // HACK: If it has a long key, it's an RSA key, and this is a mobile hotspot. // In the future, we need to put different symbols on different types of hotspots - const hotspotType = entityKey.length > 100 ? 'MOBILE' : 'IOT'; - const isMobile = hotspotType === 'MOBILE'; + const hotspotType = entityKey.length > 100 ? "MOBILE" : "IOT"; + const isMobile = hotspotType === "MOBILE"; const image = `${SHDW_DRIVE_URL}/${ isMobile ? record?.mobile_hotspot_info?.is_active - ? 'mobile-hotspot-active.png' - : 'mobile-hotspot.png' + ? "mobile-hotspot-active.png" + : "mobile-hotspot.png" : record?.iot_hotspot_info?.is_active - ? 'hotspot-active.png' - : 'hotspot.png' + ? "hotspot-active.png" + : "hotspot.png" }`; return { - name: keyStr === 'iot_operations_fund' ? 'IOT Operations Fund' : digest, + name: keyStr === "iot_operations_fund" ? "IOT Operations Fund" : digest, description: - keyStr === 'iot_operations_fund' - ? 'IOT Operations Fund' - : 'A Rewardable NFT on Helium', + keyStr === "iot_operations_fund" + ? "IOT Operations Fund" + : "A Rewardable NFT on Helium", // HACK: If it has a long key, it's an RSA key, and this is a mobile hotspot. // In the future, we need to put different symbols on different types of hotspots image, attributes: [ keyStr && Address.isValid(keyStr) - ? { trait_type: 'ecc_compact', value: keyStr } + ? { trait_type: "ecc_compact", value: keyStr } : undefined, - { trait_type: 'entity_key_string', value: keyStr }, + { trait_type: "entity_key_string", value: keyStr }, { - trait_type: 'entity_key', - value: entityKey.toString('base64'), + trait_type: "entity_key", + value: entityKey.toString("base64"), }, - { trait_type: 'rewardable', value: true }, + { trait_type: "rewardable", value: true }, { - trait_type: 'networks', + trait_type: "networks", value: [ - record?.iot_hotspot_info && 'iot', - record?.mobile_hotspot_info && 'mobile', + record?.iot_hotspot_info && "iot", + record?.mobile_hotspot_info && "mobile", ].filter(truthy), }, - ...locationAttributes('iot', record?.iot_hotspot_info), - ...locationAttributes('mobile', record?.mobile_hotspot_info), + ...locationAttributes("iot", record?.iot_hotspot_info), + ...locationAttributes("mobile", record?.mobile_hotspot_info), ], }; } ); server.get<{ Params: { eccCompact: string } }>( - '/:eccCompact', + "/:eccCompact", async (request, reply) => { const { eccCompact } = request.params; @@ -121,25 +121,25 @@ server.get<{ Params: { eccCompact: string } }>( const digest = animalHash(eccCompact); const image = `${SHDW_DRIVE_URL}/${ - record?.iot_hotspot_info?.is_active ? 'hotspot-active.png' : 'hotspot.png' + record?.iot_hotspot_info?.is_active ? "hotspot-active.png" : "hotspot.png" }`; return { name: digest, - description: 'A Hotspot NFT on Helium', + description: "A Hotspot NFT on Helium", image, attributes: [ - { trait_type: 'ecc_compact', value: eccCompact }, - { trait_type: 'rewardable', value: true }, + { trait_type: "ecc_compact", value: eccCompact }, + { trait_type: "rewardable", value: true }, { - trait_type: 'networks', + trait_type: "networks", value: [ - record?.iot_hotspot_info && 'iot', - record?.mobile_hotspot_info && 'mobile', + record?.iot_hotspot_info && "iot", + record?.mobile_hotspot_info && "mobile", ].filter(truthy), }, - ...locationAttributes('iot', record?.iot_hotspot_info), - ...locationAttributes('mobile', record?.mobile_hotspot_info), + ...locationAttributes("iot", record?.iot_hotspot_info), + ...locationAttributes("mobile", record?.mobile_hotspot_info), ], }; } @@ -171,10 +171,10 @@ const start = async () => { await sequelize.query(` CREATE UNIQUE INDEX IF NOT EXISTS mobile_hotspot_infos_asset_index ON mobile_hotspot_infos(asset); `); - await server.listen({ port: 8081, host: '0.0.0.0' }); + await server.listen({ port: 8081, host: "0.0.0.0" }); const address = server.server.address(); - const port = typeof address === 'string' ? address : address?.port; + const port = typeof address === "string" ? address : address?.port; } catch (err) { server.log.error(err); process.exit(1); diff --git a/packages/metadata-service/src/model.ts b/packages/metadata-service/src/model.ts index 8323aeaca..c36b5b598 100644 --- a/packages/metadata-service/src/model.ts +++ b/packages/metadata-service/src/model.ts @@ -1,12 +1,12 @@ -import { Sequelize, STRING, Model, DataTypes } from 'sequelize'; -import AWS from 'aws-sdk'; -import * as pg from 'pg'; +import { Sequelize, STRING, Model, DataTypes } from "sequelize"; +import AWS from "aws-sdk"; +import * as pg from "pg"; -const host = process.env.PGHOST || 'localhost'; +const host = process.env.PGHOST || "localhost"; const port = Number(process.env.PGPORT) || 5432; export const sequelize = new Sequelize({ host: host, - dialect: 'postgres', + dialect: "postgres", port: port, logging: false, dialectModule: pg, @@ -20,7 +20,7 @@ export const sequelize = new Sequelize({ }, hooks: { beforeConnect: async (config: any) => { - const isRds = host.includes('rds.amazonaws.com'); + const isRds = host.includes("rds.amazonaws.com"); let password = process.env.PGPASSWORD; if (isRds && !password) { @@ -76,8 +76,8 @@ MobileHotspotInfo.init( }, { sequelize, - modelName: 'mobile_hotspot_infos', - tableName: 'mobile_hotspot_infos', + modelName: "mobile_hotspot_infos", + tableName: "mobile_hotspot_infos", underscored: true, timestamps: false, } @@ -110,8 +110,8 @@ IotHotspotInfo.init( }, { sequelize, - modelName: 'iot_hotspot_infos', - tableName: 'iot_hotspot_infos', + modelName: "iot_hotspot_infos", + tableName: "iot_hotspot_infos", underscored: true, timestamps: false, } @@ -135,18 +135,18 @@ KeyToAsset.init( }, { sequelize, - modelName: 'key_to_assets', - tableName: 'key_to_assets', + modelName: "key_to_assets", + tableName: "key_to_assets", underscored: true, timestamps: false, } ); KeyToAsset.hasOne(IotHotspotInfo, { - sourceKey: 'asset', - foreignKey: 'asset', + sourceKey: "asset", + foreignKey: "asset", }); KeyToAsset.hasOne(MobileHotspotInfo, { - sourceKey: 'asset', - foreignKey: 'asset', + sourceKey: "asset", + foreignKey: "asset", }); From 3334997fb9bffe7d49dca606e25dd8c954869150 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 12:15:25 -0500 Subject: [PATCH 04/14] remove isMobile --- packages/metadata-service/src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/metadata-service/src/index.ts b/packages/metadata-service/src/index.ts index 5293355ab..b3f310e57 100644 --- a/packages/metadata-service/src/index.ts +++ b/packages/metadata-service/src/index.ts @@ -51,9 +51,8 @@ server.get<{ Params: { keyToAssetKey: string } }>( // HACK: If it has a long key, it's an RSA key, and this is a mobile hotspot. // In the future, we need to put different symbols on different types of hotspots const hotspotType = entityKey.length > 100 ? "MOBILE" : "IOT"; - const isMobile = hotspotType === "MOBILE"; const image = `${SHDW_DRIVE_URL}/${ - isMobile + hotspotType === "MOBILE" ? record?.mobile_hotspot_info?.is_active ? "mobile-hotspot-active.png" : "mobile-hotspot.png" From ab678c358fec23f5884575fb6b56dd5c7470b3bf Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:06:19 -0500 Subject: [PATCH 05/14] fix build --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- package.json | 4 ++-- packages/account-fetch-cache-hooks/package.json | 2 +- packages/account-fetch-cache/package.json | 2 +- packages/account-postgres-sink-service/package.json | 2 +- packages/active-device-oracle/package.json | 2 +- packages/anchor-resolvers/package.json | 2 +- packages/circuit-breaker-sdk/package.json | 2 +- packages/crons/package.json | 2 +- packages/data-credits-sdk/package.json | 2 +- packages/distributor-oracle/package.json | 2 +- packages/fanout-metadata-service/package.json | 2 +- packages/fanout-sdk/package.json | 2 +- packages/faucet-service/package.json | 2 +- packages/helium-admin-cli/package.json | 2 +- packages/helium-entity-manager-sdk/package.json | 2 +- packages/helium-react-hooks/package.json | 2 +- packages/helium-sub-daos-sdk/package.json | 2 +- packages/idls/package.json | 2 +- packages/iot-premine-data-only-service/package.json | 2 +- packages/lazy-distributor-sdk/package.json | 2 +- packages/lazy-transactions-sdk/package.json | 2 +- packages/metadata-service/package.json | 2 +- packages/migration-service/package.json | 2 +- packages/mobile-entity-manager-sdk/package.json | 2 +- packages/monitor-service/package.json | 2 +- packages/price-oracle-sdk/package.json | 2 +- packages/rewards-oracle-faucet-service/package.json | 2 +- packages/rewards-oracle-sdk/package.json | 2 +- packages/spl-utils/package.json | 2 +- packages/tokens-to-rent-service/package.json | 2 +- packages/treasury-management-sdk/package.json | 2 +- packages/voter-stake-registry-hooks/package.json | 2 +- packages/voter-stake-registry-sdk/package.json | 2 +- packages/vsr-metadata-service/package.json | 2 +- utils/shared-utils/src/token_metadata.rs | 5 ++++- yarn.lock | 7 ++++++- 38 files changed, 49 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ec56ecb9..92ce3546e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2540,9 +2540,9 @@ dependencies = [ [[package]] name = "mpl-token-metadata" -version = "3.0.1" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "651388b8ccae4805f240ebd495172eb44ea10153e018623b628df7034e042a96" +checksum = "177204bbe7486b22ac35af2c91a82630f830a6ddd3392651aefde1ef346aba3d" dependencies = [ "borsh 0.10.3", "num-derive 0.3.3", diff --git a/Cargo.toml b/Cargo.toml index dd6883b1d..58ddfa1f3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ members = [ "utils/proposal", ] exclude = [ - "deps/metaplex-program-library/bubblegum/program", + "deps/metaplex-program-library/bubblegum/program", "deps/metaplex-program-library/token-metadata/program", "utils/ecc-sig-verifier", "utils/migration-tx-executor", @@ -19,7 +19,7 @@ exclude = [ [workspace.dependencies] anchor-lang = { version = "0.28.0", features = ["init-if-needed"] } anchor-spl = { version = "0.28.0", features = ["mint", "token"] } -mpl-token-metadata = { version = "3.0.1" } +mpl-token-metadata = { version = "3.1.0" } account-compression-cpi = { rev = "a2d12e4a157d91feb73aa40a97fe297fd477dd87", git = "https://github.com/helium/account-compression-anchor-gen.git", features = ["cpi"]} bubblegum-cpi = { rev = "a2d12e4a157d91feb73aa40a97fe297fd477dd87", git = "https://github.com/helium/account-compression-anchor-gen.git", features = ["cpi"]} solana-security-txt = "1.1.1" diff --git a/package.json b/package.json index a1d65ec8d..1e23adc72 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,9 @@ "@coral-xyz/anchor": "^0.28.0", "@coral-xyz/anchor-cli": "^0.28.0", "@coral-xyz/borsh": "^0.2.6", + "@helium/crypto": "^4.10.2", "@helium/modular-governance-idls": "^0.0.2", "@helium/proposal-sdk": "^0.0.2", - "@helium/crypto": "^4.10.2", "@helium/transactions": "^3.38.0", "@metaplex-foundation/mpl-bubblegum": "^0.7.0", "@pythnetwork/client": "^2.8.0", @@ -56,6 +56,6 @@ "prettier": "^2.6.2", "shx": "^0.3.4", "ts-mocha": "^10.0.0", - "typescript": "^4.3.5" + "typescript": "^5.2.2" } } diff --git a/packages/account-fetch-cache-hooks/package.json b/packages/account-fetch-cache-hooks/package.json index ff3e3ff61..98ce1f175 100644 --- a/packages/account-fetch-cache-hooks/package.json +++ b/packages/account-fetch-cache-hooks/package.json @@ -39,7 +39,7 @@ "devDependencies": { "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "peerDependencies": { diff --git a/packages/account-fetch-cache/package.json b/packages/account-fetch-cache/package.json index 3ff128f0e..816eac5a9 100644 --- a/packages/account-fetch-cache/package.json +++ b/packages/account-fetch-cache/package.json @@ -36,7 +36,7 @@ "devDependencies": { "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/account-postgres-sink-service/package.json b/packages/account-postgres-sink-service/package.json index e08b0b4a2..ce38e95e5 100644 --- a/packages/account-postgres-sink-service/package.json +++ b/packages/account-postgres-sink-service/package.json @@ -68,7 +68,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/active-device-oracle/package.json b/packages/active-device-oracle/package.json index 8cd4b074d..84fdf3438 100644 --- a/packages/active-device-oracle/package.json +++ b/packages/active-device-oracle/package.json @@ -41,7 +41,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/anchor-resolvers/package.json b/packages/anchor-resolvers/package.json index 71ee9e016..fd8d36e16 100644 --- a/packages/anchor-resolvers/package.json +++ b/packages/anchor-resolvers/package.json @@ -40,7 +40,7 @@ "devDependencies": { "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/circuit-breaker-sdk/package.json b/packages/circuit-breaker-sdk/package.json index a50a3d78e..1849bfc0e 100644 --- a/packages/circuit-breaker-sdk/package.json +++ b/packages/circuit-breaker-sdk/package.json @@ -41,7 +41,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/crons/package.json b/packages/crons/package.json index 52aff38ab..d4c05f3d2 100644 --- a/packages/crons/package.json +++ b/packages/crons/package.json @@ -56,7 +56,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" } } diff --git a/packages/data-credits-sdk/package.json b/packages/data-credits-sdk/package.json index 8a2f9b21e..a224b13d1 100644 --- a/packages/data-credits-sdk/package.json +++ b/packages/data-credits-sdk/package.json @@ -45,7 +45,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/distributor-oracle/package.json b/packages/distributor-oracle/package.json index 2a5bf5dc4..718588d69 100644 --- a/packages/distributor-oracle/package.json +++ b/packages/distributor-oracle/package.json @@ -68,7 +68,7 @@ "nodemon": "^2.0.20", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/fanout-metadata-service/package.json b/packages/fanout-metadata-service/package.json index 51e266d5f..377a87e96 100644 --- a/packages/fanout-metadata-service/package.json +++ b/packages/fanout-metadata-service/package.json @@ -53,7 +53,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/fanout-sdk/package.json b/packages/fanout-sdk/package.json index e4001bf91..02c8f5014 100644 --- a/packages/fanout-sdk/package.json +++ b/packages/fanout-sdk/package.json @@ -41,7 +41,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/faucet-service/package.json b/packages/faucet-service/package.json index 6990cfd31..cc588c39a 100644 --- a/packages/faucet-service/package.json +++ b/packages/faucet-service/package.json @@ -53,7 +53,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/helium-admin-cli/package.json b/packages/helium-admin-cli/package.json index ffc75fae3..d54b5ef21 100644 --- a/packages/helium-admin-cli/package.json +++ b/packages/helium-admin-cli/package.json @@ -68,7 +68,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "author": "", diff --git a/packages/helium-entity-manager-sdk/package.json b/packages/helium-entity-manager-sdk/package.json index 4cd6eb8ab..6ff7f19dc 100644 --- a/packages/helium-entity-manager-sdk/package.json +++ b/packages/helium-entity-manager-sdk/package.json @@ -47,7 +47,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/helium-react-hooks/package.json b/packages/helium-react-hooks/package.json index a8764f442..444a14864 100644 --- a/packages/helium-react-hooks/package.json +++ b/packages/helium-react-hooks/package.json @@ -45,7 +45,7 @@ "@solana/wallet-adapter-react": "^0.15.32", "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "peerDependencies": { diff --git a/packages/helium-sub-daos-sdk/package.json b/packages/helium-sub-daos-sdk/package.json index 757bb276d..07d87981a 100644 --- a/packages/helium-sub-daos-sdk/package.json +++ b/packages/helium-sub-daos-sdk/package.json @@ -43,7 +43,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/idls/package.json b/packages/idls/package.json index e3df47ca1..561d7203b 100644 --- a/packages/idls/package.json +++ b/packages/idls/package.json @@ -34,7 +34,7 @@ }, "devDependencies": { "ts-loader": "^9.2.3", - "typescript": "^4.8.4" + "typescript": "^5.2.2" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" } diff --git a/packages/iot-premine-data-only-service/package.json b/packages/iot-premine-data-only-service/package.json index a6071b326..f14896e10 100644 --- a/packages/iot-premine-data-only-service/package.json +++ b/packages/iot-premine-data-only-service/package.json @@ -52,7 +52,7 @@ "@types/yargs": "^17.0.24", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" } } diff --git a/packages/lazy-distributor-sdk/package.json b/packages/lazy-distributor-sdk/package.json index 9b88bb2b6..83980d386 100644 --- a/packages/lazy-distributor-sdk/package.json +++ b/packages/lazy-distributor-sdk/package.json @@ -41,7 +41,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/lazy-transactions-sdk/package.json b/packages/lazy-transactions-sdk/package.json index f339de60e..b46e90f06 100644 --- a/packages/lazy-transactions-sdk/package.json +++ b/packages/lazy-transactions-sdk/package.json @@ -43,7 +43,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/metadata-service/package.json b/packages/metadata-service/package.json index 38e1c6382..8eb8ac68f 100644 --- a/packages/metadata-service/package.json +++ b/packages/metadata-service/package.json @@ -57,7 +57,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/migration-service/package.json b/packages/migration-service/package.json index 3eef0f573..ede0d93d7 100644 --- a/packages/migration-service/package.json +++ b/packages/migration-service/package.json @@ -74,7 +74,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/mobile-entity-manager-sdk/package.json b/packages/mobile-entity-manager-sdk/package.json index 9c9a3e29f..ddeb0e140 100644 --- a/packages/mobile-entity-manager-sdk/package.json +++ b/packages/mobile-entity-manager-sdk/package.json @@ -43,7 +43,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/monitor-service/package.json b/packages/monitor-service/package.json index 0b3f2c02a..92dec126e 100644 --- a/packages/monitor-service/package.json +++ b/packages/monitor-service/package.json @@ -60,7 +60,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/price-oracle-sdk/package.json b/packages/price-oracle-sdk/package.json index 1a67cc56e..d621a82ff 100644 --- a/packages/price-oracle-sdk/package.json +++ b/packages/price-oracle-sdk/package.json @@ -40,7 +40,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/rewards-oracle-faucet-service/package.json b/packages/rewards-oracle-faucet-service/package.json index 3b9ecca66..3de12e4f9 100644 --- a/packages/rewards-oracle-faucet-service/package.json +++ b/packages/rewards-oracle-faucet-service/package.json @@ -47,7 +47,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/rewards-oracle-sdk/package.json b/packages/rewards-oracle-sdk/package.json index 9381e0142..22760921c 100644 --- a/packages/rewards-oracle-sdk/package.json +++ b/packages/rewards-oracle-sdk/package.json @@ -41,7 +41,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/spl-utils/package.json b/packages/spl-utils/package.json index 19ddf11d9..5bf894c7e 100644 --- a/packages/spl-utils/package.json +++ b/packages/spl-utils/package.json @@ -47,7 +47,7 @@ "devDependencies": { "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/tokens-to-rent-service/package.json b/packages/tokens-to-rent-service/package.json index 876f8d3cd..7365efe72 100644 --- a/packages/tokens-to-rent-service/package.json +++ b/packages/tokens-to-rent-service/package.json @@ -50,7 +50,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/packages/treasury-management-sdk/package.json b/packages/treasury-management-sdk/package.json index 5151869fe..19df139c7 100644 --- a/packages/treasury-management-sdk/package.json +++ b/packages/treasury-management-sdk/package.json @@ -42,7 +42,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/voter-stake-registry-hooks/package.json b/packages/voter-stake-registry-hooks/package.json index c9e3e8ea1..7aa4faef6 100644 --- a/packages/voter-stake-registry-hooks/package.json +++ b/packages/voter-stake-registry-hooks/package.json @@ -50,7 +50,7 @@ "devDependencies": { "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "peerDependencies": { diff --git a/packages/voter-stake-registry-sdk/package.json b/packages/voter-stake-registry-sdk/package.json index aa735920f..c7b3c3bba 100644 --- a/packages/voter-stake-registry-sdk/package.json +++ b/packages/voter-stake-registry-sdk/package.json @@ -43,7 +43,7 @@ "git-format-staged": "^2.1.3", "ts-loader": "^9.2.3", "ts-node": "^10.9.1", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "gitHead": "5a8bf0b7b88e5934ef8d774e686f7c95804fbb8d" diff --git a/packages/vsr-metadata-service/package.json b/packages/vsr-metadata-service/package.json index 1c660afc8..7834b6942 100644 --- a/packages/vsr-metadata-service/package.json +++ b/packages/vsr-metadata-service/package.json @@ -53,7 +53,7 @@ "ts-loader": "^9.2.3", "ts-node": "^10.9.1", "ts-node-dev": "^2.0.0", - "typescript": "^4.8.4", + "typescript": "^5.2.2", "yarn": "^1.22.18" }, "keywords": [], diff --git a/utils/shared-utils/src/token_metadata.rs b/utils/shared-utils/src/token_metadata.rs index a40d3b7fc..79fee024f 100644 --- a/utils/shared-utils/src/token_metadata.rs +++ b/utils/shared-utils/src/token_metadata.rs @@ -36,7 +36,10 @@ pub fn create_metadata_accounts_v3<'info>( mint: &ctx.accounts.mint, mint_authority: &ctx.accounts.mint_authority, payer: &ctx.accounts.payer, - update_authority: &ctx.accounts.update_authority, + update_authority: ( + &ctx.accounts.update_authority, + ctx.accounts.update_authority.is_signer, + ), system_program: &ctx.accounts.system_program, rent: None, }, diff --git a/yarn.lock b/yarn.lock index b7b1f8865..bd4182158 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11338,11 +11338,16 @@ typescript-collections@^1.3.3: resolved "https://registry.yarnpkg.com/typescript-collections/-/typescript-collections-1.3.3.tgz#62d50d93c018c094d425eabee649f00ec5cc0fea" integrity sha512-7sI4e/bZijOzyURng88oOFZCISQPTHozfE2sUu5AviFYk5QV7fYGb6YiDl+vKjF/pICA354JImBImL9XJWUvdQ== -"typescript@^3 || ^4", typescript@^4.3.5, typescript@^4.8.4: +"typescript@^3 || ^4": version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== +typescript@^5.2.2: + version "5.2.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78" + integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w== + u3@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/u3/-/u3-0.1.1.tgz#5f52044f42ee76cd8de33148829e14528494b73b" From 4c4cf2411cdeab674a0db36886106f434bf5d208 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:15:13 -0500 Subject: [PATCH 06/14] node 18 --- packages/account-postgres-sink-service/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account-postgres-sink-service/Dockerfile b/packages/account-postgres-sink-service/Dockerfile index 9e4e62b86..2502feb50 100644 --- a/packages/account-postgres-sink-service/Dockerfile +++ b/packages/account-postgres-sink-service/Dockerfile @@ -1,5 +1,5 @@ # Specify the base image -FROM node:16-alpine AS BUILD_IMAGE +FROM node:18-alpine AS BUILD_IMAGE WORKDIR /usr/src/app @@ -15,7 +15,7 @@ RUN yarn run build RUN npm prune --production -FROM node:16-alpine +FROM node:18-alpine WORKDIR /usr/src/app From 0086a3d6e9198f57f09bf76c5394cfbf2fd007c2 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:19:38 -0500 Subject: [PATCH 07/14] test npx --- packages/account-postgres-sink-service/package.json | 2 +- packages/account-postgres-sink-service/tsconfig.build.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/account-postgres-sink-service/package.json b/packages/account-postgres-sink-service/package.json index ce38e95e5..e06c00c6e 100644 --- a/packages/account-postgres-sink-service/package.json +++ b/packages/account-postgres-sink-service/package.json @@ -27,7 +27,7 @@ "scripts": { "format": "prettier --write \"src/**/*.{ts,tsx}\"", "precommit": "npx git-format-staged -f 'prettier --ignore-unknown --stdin --stdin-filepath \"{}\"' .", - "build": "tsc -p tsconfig.json", + "build": "npx tsc -p tsconfig.json", "start": "node lib/esm/server.js", "dev": "npx ts-node --project tsconfig.cjs.json src/server.ts" }, diff --git a/packages/account-postgres-sink-service/tsconfig.build.json b/packages/account-postgres-sink-service/tsconfig.build.json index 43c1febce..2c3b5b795 100644 --- a/packages/account-postgres-sink-service/tsconfig.build.json +++ b/packages/account-postgres-sink-service/tsconfig.build.json @@ -21,7 +21,7 @@ "paths": { "@/*": ["*"] }, - "outDir": "lib" + "outDir": "lib", }, - "include": ["src"] + "include": ["src"], } From 83dcb92a3ea80e240eb4bc7925718cb6de2e534f Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:35:19 -0500 Subject: [PATCH 08/14] fix build --- packages/account-postgres-sink-service/Dockerfile | 1 + packages/account-postgres-sink-service/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/account-postgres-sink-service/Dockerfile b/packages/account-postgres-sink-service/Dockerfile index 2502feb50..cb93f8085 100644 --- a/packages/account-postgres-sink-service/Dockerfile +++ b/packages/account-postgres-sink-service/Dockerfile @@ -11,6 +11,7 @@ COPY src src COPY tsconfig.build.json tsconfig.json RUN yarn global add typescript +RUN yarn add -D @types/cron RUN yarn run build RUN npm prune --production diff --git a/packages/account-postgres-sink-service/package.json b/packages/account-postgres-sink-service/package.json index e06c00c6e..ce38e95e5 100644 --- a/packages/account-postgres-sink-service/package.json +++ b/packages/account-postgres-sink-service/package.json @@ -27,7 +27,7 @@ "scripts": { "format": "prettier --write \"src/**/*.{ts,tsx}\"", "precommit": "npx git-format-staged -f 'prettier --ignore-unknown --stdin --stdin-filepath \"{}\"' .", - "build": "npx tsc -p tsconfig.json", + "build": "tsc -p tsconfig.json", "start": "node lib/esm/server.js", "dev": "npx ts-node --project tsconfig.cjs.json src/server.ts" }, From 6331f3af357889e9b0a1e999fea218e83cdd66a5 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:39:10 -0500 Subject: [PATCH 09/14] kill adding it via docker --- packages/account-postgres-sink-service/Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/account-postgres-sink-service/Dockerfile b/packages/account-postgres-sink-service/Dockerfile index cb93f8085..2502feb50 100644 --- a/packages/account-postgres-sink-service/Dockerfile +++ b/packages/account-postgres-sink-service/Dockerfile @@ -11,7 +11,6 @@ COPY src src COPY tsconfig.build.json tsconfig.json RUN yarn global add typescript -RUN yarn add -D @types/cron RUN yarn run build RUN npm prune --production From ce564f08238fda783d064115b10f7fa382f6711b Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:48:43 -0500 Subject: [PATCH 10/14] add typesRoots --- packages/account-postgres-sink-service/tsconfig.build.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account-postgres-sink-service/tsconfig.build.json b/packages/account-postgres-sink-service/tsconfig.build.json index 2c3b5b795..0475676fc 100644 --- a/packages/account-postgres-sink-service/tsconfig.build.json +++ b/packages/account-postgres-sink-service/tsconfig.build.json @@ -16,7 +16,7 @@ "moduleResolution": "Node", "skipLibCheck": true, "baseUrl": ".", - "typeRoots": ["node_modules/@types"], + "typeRoots": ["node_modules/@types", "node", "cron"], "strict": true, "paths": { "@/*": ["*"] From 4be05352fa674449430edad2429025bcbcd03a46 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:51:15 -0500 Subject: [PATCH 11/14] try node-cron --- packages/account-postgres-sink-service/package.json | 1 + packages/account-postgres-sink-service/tsconfig.build.json | 2 +- yarn.lock | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/account-postgres-sink-service/package.json b/packages/account-postgres-sink-service/package.json index ce38e95e5..eda56e4c0 100644 --- a/packages/account-postgres-sink-service/package.json +++ b/packages/account-postgres-sink-service/package.json @@ -62,6 +62,7 @@ "@types/deep-equal": "^1.0.1", "@types/lodash": "^4.14.195", "@types/node": "^18.11.11", + "@types/node-cron": "^3.0.9", "@types/pg": "^8.6.6", "@types/yargs": "^17.0.24", "git-format-staged": "^2.1.3", diff --git a/packages/account-postgres-sink-service/tsconfig.build.json b/packages/account-postgres-sink-service/tsconfig.build.json index 0475676fc..2c3b5b795 100644 --- a/packages/account-postgres-sink-service/tsconfig.build.json +++ b/packages/account-postgres-sink-service/tsconfig.build.json @@ -16,7 +16,7 @@ "moduleResolution": "Node", "skipLibCheck": true, "baseUrl": ".", - "typeRoots": ["node_modules/@types", "node", "cron"], + "typeRoots": ["node_modules/@types"], "strict": true, "paths": { "@/*": ["*"] diff --git a/yarn.lock b/yarn.lock index bd4182158..18173f17f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3627,6 +3627,11 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== +"@types/node-cron@^3.0.9": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@types/node-cron/-/node-cron-3.0.9.tgz#e792dd4847804cc37ed90847f45e04e20cd08768" + integrity sha512-P10Vf+oagnMbefD31nqjS/dpBM34qzfdpvIgVZwtwsNb0Hg2lDaPFeGcyGUJIqh3zHlDMwYXGeunGgMnswgnPg== + "@types/node@*", "@types/node@>=13.7.0": version "20.5.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.7.tgz#4b8ecac87fbefbc92f431d09c30e176fc0a7c377" From e3bf054465d397e623f5cd4e8d4baa72c9d9b786 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 15:58:20 -0500 Subject: [PATCH 12/14] try .d.ts file --- packages/account-postgres-sink-service/package.json | 1 - packages/account-postgres-sink-service/src/cron.d.ts | 4 ++++ yarn.lock | 5 ----- 3 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 packages/account-postgres-sink-service/src/cron.d.ts diff --git a/packages/account-postgres-sink-service/package.json b/packages/account-postgres-sink-service/package.json index eda56e4c0..ce38e95e5 100644 --- a/packages/account-postgres-sink-service/package.json +++ b/packages/account-postgres-sink-service/package.json @@ -62,7 +62,6 @@ "@types/deep-equal": "^1.0.1", "@types/lodash": "^4.14.195", "@types/node": "^18.11.11", - "@types/node-cron": "^3.0.9", "@types/pg": "^8.6.6", "@types/yargs": "^17.0.24", "git-format-staged": "^2.1.3", diff --git a/packages/account-postgres-sink-service/src/cron.d.ts b/packages/account-postgres-sink-service/src/cron.d.ts new file mode 100644 index 000000000..a2104d388 --- /dev/null +++ b/packages/account-postgres-sink-service/src/cron.d.ts @@ -0,0 +1,4 @@ +declare module "cron" { + let _cron: any; + export = _cron; +} diff --git a/yarn.lock b/yarn.lock index 18173f17f..bd4182158 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3627,11 +3627,6 @@ resolved "https://registry.yarnpkg.com/@types/ms/-/ms-0.7.31.tgz#31b7ca6407128a3d2bbc27fe2d21b345397f6197" integrity sha512-iiUgKzV9AuaEkZqkOLDIvlQiL6ltuZd9tGcW3gwpnX8JbuiuhFlEGmmFXEXkN50Cvq7Os88IY2v0dkDqXYWVgA== -"@types/node-cron@^3.0.9": - version "3.0.9" - resolved "https://registry.yarnpkg.com/@types/node-cron/-/node-cron-3.0.9.tgz#e792dd4847804cc37ed90847f45e04e20cd08768" - integrity sha512-P10Vf+oagnMbefD31nqjS/dpBM34qzfdpvIgVZwtwsNb0Hg2lDaPFeGcyGUJIqh3zHlDMwYXGeunGgMnswgnPg== - "@types/node@*", "@types/node@>=13.7.0": version "20.5.7" resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.7.tgz#4b8ecac87fbefbc92f431d09c30e176fc0a7c377" From 13eef42bff5a972342775a511c688e157553d557 Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 16:04:42 -0500 Subject: [PATCH 13/14] work --- .../account-postgres-sink-service/src/{ => types}/cron.d.ts | 0 packages/account-postgres-sink-service/tsconfig.build.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename packages/account-postgres-sink-service/src/{ => types}/cron.d.ts (100%) diff --git a/packages/account-postgres-sink-service/src/cron.d.ts b/packages/account-postgres-sink-service/src/types/cron.d.ts similarity index 100% rename from packages/account-postgres-sink-service/src/cron.d.ts rename to packages/account-postgres-sink-service/src/types/cron.d.ts diff --git a/packages/account-postgres-sink-service/tsconfig.build.json b/packages/account-postgres-sink-service/tsconfig.build.json index 2c3b5b795..e8e619608 100644 --- a/packages/account-postgres-sink-service/tsconfig.build.json +++ b/packages/account-postgres-sink-service/tsconfig.build.json @@ -16,7 +16,7 @@ "moduleResolution": "Node", "skipLibCheck": true, "baseUrl": ".", - "typeRoots": ["node_modules/@types"], + "typeRoots": ["node_modules/@types", "./src/types"], "strict": true, "paths": { "@/*": ["*"] From 59da96d8e7530f5418c5b2ac029b499090a749cc Mon Sep 17 00:00:00 2001 From: bry Date: Mon, 16 Oct 2023 16:10:17 -0500 Subject: [PATCH 14/14] move types to typeings --- packages/account-postgres-sink-service/Dockerfile | 1 + packages/account-postgres-sink-service/tsconfig.build.json | 2 +- .../{src/types => typeings}/cron.d.ts | 0 3 files changed, 2 insertions(+), 1 deletion(-) rename packages/account-postgres-sink-service/{src/types => typeings}/cron.d.ts (100%) diff --git a/packages/account-postgres-sink-service/Dockerfile b/packages/account-postgres-sink-service/Dockerfile index 2502feb50..5024e2784 100644 --- a/packages/account-postgres-sink-service/Dockerfile +++ b/packages/account-postgres-sink-service/Dockerfile @@ -8,6 +8,7 @@ COPY package.json ./ RUN yarn install COPY src src +COPY typeings typeings COPY tsconfig.build.json tsconfig.json RUN yarn global add typescript diff --git a/packages/account-postgres-sink-service/tsconfig.build.json b/packages/account-postgres-sink-service/tsconfig.build.json index e8e619608..38d8e445a 100644 --- a/packages/account-postgres-sink-service/tsconfig.build.json +++ b/packages/account-postgres-sink-service/tsconfig.build.json @@ -16,7 +16,7 @@ "moduleResolution": "Node", "skipLibCheck": true, "baseUrl": ".", - "typeRoots": ["node_modules/@types", "./src/types"], + "typeRoots": ["node_modules/@types", "typeings"], "strict": true, "paths": { "@/*": ["*"] diff --git a/packages/account-postgres-sink-service/src/types/cron.d.ts b/packages/account-postgres-sink-service/typeings/cron.d.ts similarity index 100% rename from packages/account-postgres-sink-service/src/types/cron.d.ts rename to packages/account-postgres-sink-service/typeings/cron.d.ts