@notifi-network/notifi-react-hooks
Advanced tools
Comparing version 0.0.1 to 0.0.2-alpha.2
@@ -0,1 +1,2 @@ | ||
import { BlockchainEnvironment } from './useNotifiConfig'; | ||
export declare type Payload = Readonly<{ | ||
@@ -12,4 +13,4 @@ walletPublicKey: string; | ||
}>; | ||
declare const useLoginFromDao: () => (payload: Payload) => Promise<Result>; | ||
declare const useLoginFromDao: (env?: BlockchainEnvironment) => (payload: Payload) => Promise<Result>; | ||
export default useLoginFromDao; | ||
//# sourceMappingURL=useLoginFromDao.d.ts.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -8,4 +27,4 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const react_1 = require("react"); | ||
const useNotifiConfig_1 = __importStar(require("./useNotifiConfig")); | ||
const useNotifiJwt_1 = __importDefault(require("./useNotifiJwt")); | ||
const NOTIFI_GQL_URL = 'https://api.notifi.network/api/gql'; | ||
const MUTATION_STRING = `mutation logInFromDao( | ||
@@ -27,8 +46,9 @@ $walletPublicKey: String! | ||
}`; | ||
const useLoginFromDao = () => { | ||
const useLoginFromDao = (env = useNotifiConfig_1.BlockchainEnvironment.MainNetBeta) => { | ||
const { setJwt } = (0, useNotifiJwt_1.default)(); | ||
const { gqlUrl } = (0, useNotifiConfig_1.default)(env); | ||
const loginFromDao = (0, react_1.useCallback)(async (payload) => { | ||
var _a; | ||
const { walletPublicKey, tokenAddress, timestamp, signature } = payload; | ||
const resp = await axios_1.default.post(NOTIFI_GQL_URL, { | ||
const resp = await axios_1.default.post(gqlUrl, { | ||
query: MUTATION_STRING, | ||
@@ -52,2 +72,2 @@ variables: { | ||
exports.default = useLoginFromDao; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlTG9naW5Gcm9tRGFvLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vbGliL2hvb2tzL3VzZUxvZ2luRnJvbURhby50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLGtEQUEwQjtBQUMxQixpQ0FBb0M7QUFDcEMsa0VBQTBDO0FBcUIxQyxNQUFNLGNBQWMsR0FBRyxvQ0FBb0MsQ0FBQztBQUU1RCxNQUFNLGVBQWUsR0FBRzs7Ozs7Ozs7Ozs7Ozs7O0VBZXRCLENBQUM7QUFFSCxNQUFNLGVBQWUsR0FBRyxHQUE0QyxFQUFFO0lBQ3BFLE1BQU0sRUFBRSxNQUFNLEVBQUUsR0FBRyxJQUFBLHNCQUFZLEdBQUUsQ0FBQztJQUVsQyxNQUFNLFlBQVksR0FBRyxJQUFBLG1CQUFXLEVBQzlCLEtBQUssRUFBRSxPQUFnQixFQUFFLEVBQUU7O1FBQ3pCLE1BQU0sRUFBRSxlQUFlLEVBQUUsWUFBWSxFQUFFLFNBQVMsRUFBRSxTQUFTLEVBQUUsR0FBRyxPQUFPLENBQUM7UUFFeEUsTUFBTSxJQUFJLEdBQUcsTUFBTSxlQUFLLENBQUMsSUFBSSxDQUFlLGNBQWMsRUFBRTtZQUMxRCxLQUFLLEVBQUUsZUFBZTtZQUN0QixT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FLE1BQU0sRUFBRSxHQUFHLElBQUEseUJBQWUsRUFBQyxHQUFHLENBQUMsQ0FBQztJQUV4QyxNQUFNLFlBQVksR0FBRyxJQUFBLG1CQUFXLEVBQzlCLEtBQUssRUFBRSxPQUFnQixFQUFFLEVBQUU7O1FBQ3pCLE1BQU0sRUFBRSxlQUFlLEVBQUUsWUFBWSxFQUFFLFNBQVMsRUFBRSxTQUFTLEVBQUUsR0FBRyxPQUFPLENBQUM7UUFFeEUsTUFBTSxJQUFJLEdBQUcsTUFBTSxlQUFLLENBQUMsSUFBSSxDQUFlLE1BQU0sRUFBRTtZQUNsRCxLQUFLLEVBQUUsZUFBZTtZQUN0QixTQUFTLEVBQUU7Z0JBQ1QsZUFBZTtnQkFDZixZQUFZO2dCQUNaLFNBQVM7Z0JBQ1QsU0FBUzthQUNWO1NBQ0YsQ0FBQyxDQUFDO1FBQ0gsTUFBTSxNQUFNLEdBQUcsTUFBQSxJQUFJLENBQUMsSUFBSSxDQUFDLElBQUksMENBQUUsWUFBWSxDQUFDO1FBQzVDLElBQUksTUFBTSxJQUFJLElBQUksRUFBRTtZQUNsQixNQUFNLElBQUksS0FBSyxDQUFDLDhCQUE4QixDQUFDLENBQUM7U0FDakQ7UUFFRCxNQUFNLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO1FBRXJCLE9BQU8sTUFBTSxDQUFDO0lBQ2hCLENBQUMsRUFDRCxDQUFDLE1BQU0sQ0FBQyxDQUNULENBQUM7SUFFRixPQUFPLFlBQVksQ0FBQztBQUN0QixDQUFDLENBQUM7QUFFRixrQkFBZSxlQUFlLENBQUMifQ== |
@@ -1,2 +0,7 @@ | ||
declare const useNotifiConfig: () => { | ||
export declare enum BlockchainEnvironment { | ||
MainNetBeta = 0, | ||
TestNet = 1, | ||
DevNet = 2 | ||
} | ||
declare const useNotifiConfig: (env?: BlockchainEnvironment) => { | ||
gqlUrl: string; | ||
@@ -3,0 +8,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const useNotifiConfig = () => { | ||
exports.BlockchainEnvironment = void 0; | ||
var BlockchainEnvironment; | ||
(function (BlockchainEnvironment) { | ||
BlockchainEnvironment[BlockchainEnvironment["MainNetBeta"] = 0] = "MainNetBeta"; | ||
BlockchainEnvironment[BlockchainEnvironment["TestNet"] = 1] = "TestNet"; | ||
BlockchainEnvironment[BlockchainEnvironment["DevNet"] = 2] = "DevNet"; | ||
})(BlockchainEnvironment = exports.BlockchainEnvironment || (exports.BlockchainEnvironment = {})); | ||
const useNotifiConfig = (env = BlockchainEnvironment.MainNetBeta) => { | ||
let gqlUrl = ''; | ||
switch (env) { | ||
case BlockchainEnvironment.MainNetBeta: | ||
gqlUrl = 'https://api.notifi.network/gql'; | ||
break; | ||
case BlockchainEnvironment.TestNet: | ||
gqlUrl = 'https://stg-api.notifi.network/gql'; | ||
break; | ||
case BlockchainEnvironment.DevNet: | ||
gqlUrl = 'https://dev-api.notifi.network/gql'; | ||
break; | ||
default: | ||
assertUnreachable(env); | ||
} | ||
return { | ||
gqlUrl: 'https://api.notifi.network/api/gql' | ||
gqlUrl | ||
}; | ||
}; | ||
const assertUnreachable = (_x) => { | ||
throw new Error('This should never be reached'); | ||
}; | ||
exports.default = useNotifiConfig; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlTm90aWZpQ29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vbGliL2hvb2tzL3VzZU5vdGlmaUNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLE1BQU0sZUFBZSxHQUFHLEdBQUcsRUFBRTtJQUMzQixPQUFPO1FBQ0wsTUFBTSxFQUFFLG9DQUFvQztLQUM3QyxDQUFDO0FBQ0osQ0FBQyxDQUFDO0FBRUYsa0JBQWUsZUFBZSxDQUFDIn0= | ||
//# sourceMappingURL=data:application/json;base64,eyJ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BRUYsa0JBQWUsZUFBZSxDQUFDIn0= |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LOCAL_STORAGE_KEY = void 0; | ||
const react_1 = require("react"); | ||
const use_local_storage_state_1 = require("use-local-storage-state"); | ||
const use_local_storage_state_1 = __importDefault(require("use-local-storage-state")); | ||
exports.LOCAL_STORAGE_KEY = 'notifi-jwt'; | ||
const useLocalStorage = (0, use_local_storage_state_1.createLocalStorageStateHook)(exports.LOCAL_STORAGE_KEY, null); | ||
const useNotifiJwt = () => { | ||
const [storage, setStorage] = useLocalStorage(); | ||
const [storage, setStorage] = (0, use_local_storage_state_1.default)(exports.LOCAL_STORAGE_KEY, { defaultValue: null }); | ||
const jwtRef = (0, react_1.useRef)(storage); | ||
@@ -18,2 +20,2 @@ const setJwt = (0, react_1.useCallback)((jwt) => { | ||
exports.default = useNotifiJwt; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXNlTm90aWZpSnd0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vbGliL2hvb2tzL3VzZU5vdGlmaUp3dC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpQ0FBNEM7QUFDNUMscUVBQXNFO0FBRXpELFFBQUEsaUJBQWlCLEdBQUcsWUFBWSxDQUFDO0FBRTlDLE1BQU0sZUFBZSxHQUFHLElBQUEscURBQTJCLEVBQ2pELHlCQUFpQixFQUNqQixJQUFJLENBQ0wsQ0FBQztBQUVGLE1BQU0sWUFBWSxHQUFHLEdBR2xCLEVBQUU7SUFDSCxNQUFNLENBQUMsT0FBTyxFQUFFLFVBQVUsQ0FBQyxHQUFHLGVBQWUsRUFBRSxDQUFDO0lBQ2hELE1BQU0sTUFBTSxHQUFHLElBQUEsY0FBTSxFQ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UsQ0FBQyxHQUFHLENBQUMsQ0FBQztJQUNsQixDQUFDLEVBQ0QsQ0FBQyxNQUFNLEVBQUUsVUFBVSxDQUFDLENBQ3JCLENBQUM7SUFFRixPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxDQUFDO0FBQzVCLENBQUMsQ0FBQztBQUVGLGtCQUFlLFlBQVksQ0FBQyJ9 |
{ | ||
"name": "@notifi-network/notifi-react-hooks", | ||
"version": "0.0.1", | ||
"version": "0.0.2-alpha.2+36434fd", | ||
"description": "React hooks provided as a convenience wrapper around notifi.network platform functionality", | ||
@@ -42,7 +42,10 @@ "author": "Juni Kim <73hKrn@gmail.com>", | ||
"axios": "^0.26.0", | ||
"react": "^17.0.2", | ||
"typescript": "^4.5.5", | ||
"use-local-storage-state": "^13.0.0" | ||
"use-local-storage-state": "^15.0.0" | ||
}, | ||
"gitHead": "e43f20c1020ea86e260b582ebbeefd1084d05a16" | ||
"peerDependencies": { | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2" | ||
}, | ||
"gitHead": "36434fd9e72787d8906b869b95ef42f37f694f67" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
49412
591
5
+ Addedreact-dom@17.0.2(transitive)
+ Addedscheduler@0.20.2(transitive)
+ Addeduse-local-storage-state@15.0.0(transitive)
- Removedreact@^17.0.2
- Removedreact@19.0.0(transitive)
- Removedreact-dom@19.0.0(transitive)
- Removedscheduler@0.25.0(transitive)
- Removeduse-local-storage-state@13.0.0(transitive)