UNPKG

goodrdotfun-sdk

Version:

SDK for interacting with goodr.fun and Sonic on Solana

192 lines (191 loc) 7.88 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getDonationDestinationFromName = exports.getDonationDestinationFromId = exports.SOLANA_DONATION_DESTINATIONS = exports.SONIC_DONATION_DESTINATIONS = void 0; const web3_js_1 = require("@solana/web3.js"); const common_1 = require("../types/common"); exports.SONIC_DONATION_DESTINATIONS = { 16: { id: 16, name: "Custom Donation" /* DonationDestinationName.CustomDonation */, address: new web3_js_1.PublicKey('4PbK94ZopkBR8LGwoPrnFBxXMDhRoEAE7pSBGULymF8Z'), }, 1: { id: 1, name: "Healthcare and Well-being" /* DonationDestinationName.HealthcareAndWellbeing */, address: new web3_js_1.PublicKey('6BeDBmrJwirWB653ajwvATbJ1vvTQcSoGRB7gGJ7HPUj'), }, 2: { id: 2, name: "Food Security and Poverty Alleviation" /* DonationDestinationName.FoodSecurityAndPovertyAlleviation */, address: new web3_js_1.PublicKey('GDQTNTpjYXG8MHBAbM9znBW8vfi2Ca3Z4RPwsJuVqpNb'), }, 3: { id: 3, name: "Children and Youth" /* DonationDestinationName.ChildrenAndYouth */, address: new web3_js_1.PublicKey('C3yQSiFY4zvXFspQ1aeopQSQAkMSguJVBn4eutrqKtN7'), }, 4: { id: 4, name: "Disaster Relief and Humanitarian Aid" /* DonationDestinationName.DisasterReliefAndHumanitarianAid */, address: new web3_js_1.PublicKey('6qPcgMSVk7paXPV3nqtiqECS6VBnA7w8KC3q7Y5Kt1zX'), }, 5: { id: 5, name: "Biodiversity" /* DonationDestinationName.Biodiversity */, address: new web3_js_1.PublicKey('6rdhGKomkXBLdy1WQsb85mUb3EP44X8x35Bg6qE2fopr'), }, 6: { id: 6, name: "Forests" /* DonationDestinationName.Forests */, address: new web3_js_1.PublicKey('GUvoZzZNgEEe5DiFcZJUxaBP6vZXjfVfmEBkgewgTMAA'), }, 7: { id: 7, name: "Water Resources" /* DonationDestinationName.WaterResources */, address: new web3_js_1.PublicKey('675fUiveJ3buuA1zSzzaKCdnqpbTh79i1R8d6CXckwsV'), }, 8: { id: 8, name: "Climate" /* DonationDestinationName.Climate */, address: new web3_js_1.PublicKey('FMvFxThMkdMPrNTArdWWSUvTAgoi8Nxf9PR1xayeGFsi'), }, 9: { id: 9, name: "Knowledge and Science" /* DonationDestinationName.KnowledgeAndScience */, address: new web3_js_1.PublicKey('G9LrRScjCae2L5WJycTvhhPrG5LevWYjygGmUkJyNa62'), }, 10: { id: 10, name: "Education" /* DonationDestinationName.Education */, address: new web3_js_1.PublicKey('9yY94GLaw6MHT7zUD42WsgZ5M5kMtyMdcexMJqS51qGK'), }, 11: { id: 11, name: "Gender Equality" /* DonationDestinationName.GenderEquality */, address: new web3_js_1.PublicKey('GPt9RXiA4n1WQzSnZUsyW8woG5KNCk54vsMVNuxAwNSK'), }, 12: { id: 12, name: "Culture and Tradition" /* DonationDestinationName.CultureAndTradition */, address: new web3_js_1.PublicKey('44g3WpY1xYNyhVQVgHJ4L7xYrBeP2Pxk6qdAYxgseCFt'), }, 13: { id: 13, name: "Energy" /* DonationDestinationName.Energy */, address: new web3_js_1.PublicKey('4ZuENUn2reZk25u8Vqx6w7tBxawdLkhY6S8PPNVDmBji'), }, 14: { id: 14, name: "No Donation" /* DonationDestinationName.NoDonation */, address: new web3_js_1.PublicKey('7cNG9EJcV63TdFnRbG3WamchetY6UrTiKXdw29a2mYGd'), }, 15: { id: 15, name: "Technology" /* DonationDestinationName.Technology */, address: new web3_js_1.PublicKey('8WXjJB8NqXnwKUrX1T4oMFBe2SUhqUz2Z7zuMxj7GNb9'), }, }; exports.SOLANA_DONATION_DESTINATIONS = { 16: { id: 16, name: "Custom Donation" /* DonationDestinationName.CustomDonation */, address: new web3_js_1.PublicKey('CZT6ZSauAzxDXnfJ38MzD8sB9PF43RreiXDkqEVgDoWG'), }, 1: { id: 1, name: "Healthcare and Well-being" /* DonationDestinationName.HealthcareAndWellbeing */, address: new web3_js_1.PublicKey('8hG3SkkbdgjHreg73CP54gu9BSGNVu2eKXpx6JEFHGqb'), }, 2: { id: 2, name: "Food Security and Poverty Alleviation" /* DonationDestinationName.FoodSecurityAndPovertyAlleviation */, address: new web3_js_1.PublicKey('6hf15t69UMSZBVZyxaUTw7fFYQDL1M7yERNL6cPaAhdy'), }, 3: { id: 3, name: "Children and Youth" /* DonationDestinationName.ChildrenAndYouth */, address: new web3_js_1.PublicKey('5jnBrQXcwX8P8UUErY21Xdp13NAmH5kt1d8p9LgecKGW'), }, 4: { id: 4, name: "Disaster Relief and Humanitarian Aid" /* DonationDestinationName.DisasterReliefAndHumanitarianAid */, address: new web3_js_1.PublicKey('3EVnYAQxNSoyv4U7uSSrsyUAoWXy8jYXokKC9ZY7JrgF'), }, 5: { id: 5, name: "Biodiversity" /* DonationDestinationName.Biodiversity */, address: new web3_js_1.PublicKey('6cS4rqpXZakJv3gJZ6roL5hzVtGkv57svRUwuqBhphfy'), }, 6: { id: 6, name: "Forests" /* DonationDestinationName.Forests */, address: new web3_js_1.PublicKey('H3uKdXX3jMNsoi5jjEGpraL3oRUhwnvS6oFTGgkDT16G'), }, 7: { id: 7, name: "Water Resources" /* DonationDestinationName.WaterResources */, address: new web3_js_1.PublicKey('C7bznvrLFhaYb4Q44TBCUzE1nXx2NdELQBY6FscQq4uM'), }, 8: { id: 8, name: "Climate" /* DonationDestinationName.Climate */, address: new web3_js_1.PublicKey('4Lamivfci6BGaM6aK8uyi2xQAoBs1bpgAgD7hyaVZRZG'), }, 9: { id: 9, name: "Knowledge and Science" /* DonationDestinationName.KnowledgeAndScience */, address: new web3_js_1.PublicKey('8CP387xSLfWaFGD2Ux4LUKW4YzekRJ236CjjcjmmdRNJ'), }, 10: { id: 10, name: "Education" /* DonationDestinationName.Education */, address: new web3_js_1.PublicKey('CtaSEyLqN7LW5cUGaePHBizdMh6taZYthbeuxfC7vsvF'), }, 11: { id: 11, name: "Gender Equality" /* DonationDestinationName.GenderEquality */, address: new web3_js_1.PublicKey('DoAJbyutbs4pULjfN5EKb5rt4T6nuEZ2HWXfWVidRx5S'), }, 12: { id: 12, name: "Culture and Tradition" /* DonationDestinationName.CultureAndTradition */, address: new web3_js_1.PublicKey('HzR5Ydi3aPh5ZLic9hUqYeEmSS4KC5j9fryEaotHKScL'), }, 13: { id: 13, name: "Energy" /* DonationDestinationName.Energy */, address: new web3_js_1.PublicKey('4syCTbNZTvZQRkr3geoFhDFAegcFTRTqtzmufKAFALoA'), }, 14: { id: 14, name: "No Donation" /* DonationDestinationName.NoDonation */, address: new web3_js_1.PublicKey('DK82TXsicQFUs8tKBH2shEyU2FufQMHeRWZmHAqh24oa'), }, 15: { id: 15, name: "Technology" /* DonationDestinationName.Technology */, address: new web3_js_1.PublicKey('881HpK4ics5aJkbpUXNLFL7AEG36EjKuJxgYqHaeFQ8g'), }, }; const getDonationDestinationFromId = (chainType, id) => { const donationLists = chainType === common_1.ChainType.SONIC ? exports.SONIC_DONATION_DESTINATIONS : exports.SOLANA_DONATION_DESTINATIONS; const destination = donationLists[id]; if (!destination) { throw new Error(`Donation destination not found: ${id}`); } return destination; }; exports.getDonationDestinationFromId = getDonationDestinationFromId; const getDonationDestinationFromName = (chainType, name) => { const donationLists = chainType === common_1.ChainType.SONIC ? exports.SONIC_DONATION_DESTINATIONS : exports.SOLANA_DONATION_DESTINATIONS; const destination = Object.values(donationLists).find(destination => destination.name === name); if (!destination) { throw new Error(`Donation destination not found: ${name}`); } return destination; }; exports.getDonationDestinationFromName = getDonationDestinationFromName;