@gum-protocol/react-sdk
Version:
React Hooks for Gum
1 lines • 3.84 MB
Source Map (JSON)
{"version":3,"file":"index.d.ts","sources":["../src/hooks/user/useUser.ts","../src/hooks/user/useCreateUser.ts","../src/hooks/profile/useProfile.ts","../src/hooks/profile/useCreateProfile.ts","../src/hooks/post/usePost.ts","../src/hooks/post/useCreatePost.ts","../src/hooks/post/useFeed.ts","../src/hooks/post/useExploreFeed.ts","../src/hooks/reaction/useReaction.ts","../src/hooks/connection/useFollow.ts","../src/hooks/connection/useUnfollow.ts","../../../node_modules/@noble/hashes/esm/_assert.js","../../../node_modules/@noble/hashes/esm/utils.js","../../../node_modules/@noble/hashes/esm/_sha2.js","../../../node_modules/@noble/hashes/esm/_u64.js","../../../node_modules/@noble/hashes/esm/sha512.js","../../../node_modules/@noble/ed25519/lib/esm/index.js","../../../node_modules/bn.js/lib/bn.js","../../../node_modules/safe-buffer/index.js","../../../node_modules/base-x/src/index.js","../../../node_modules/bs58/index.js","../../../node_modules/@noble/hashes/esm/sha256.js","../../../node_modules/text-encoding-utf-8/lib/encoding.lib.mjs","../../../node_modules/borsh/lib/index.js","../../../node_modules/@solana/buffer-layout/lib/Layout.js","../../../node_modules/file-uri-to-path/index.js","../../../node_modules/bindings/bindings.js","../../../node_modules/bigint-buffer/dist/node.js","../../../node_modules/@solana/web3.js/node_modules/superstruct/lib/index.es.js","../../../node_modules/@babel/runtime/helpers/interopRequireDefault.js","../../../node_modules/@babel/runtime/helpers/typeof.js","../../../node_modules/@babel/runtime/helpers/toPrimitive.js","../../../node_modules/@babel/runtime/helpers/toPropertyKey.js","../../../node_modules/@babel/runtime/helpers/createClass.js","../../../node_modules/@babel/runtime/helpers/classCallCheck.js","../../../node_modules/@babel/runtime/helpers/setPrototypeOf.js","../../../node_modules/@babel/runtime/helpers/inherits.js","../../../node_modules/@babel/runtime/helpers/assertThisInitialized.js","../../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js","../../../node_modules/@babel/runtime/helpers/getPrototypeOf.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/constants.js","../../../node_modules/node-gyp-build/node-gyp-build.js","../../../node_modules/node-gyp-build/index.js","../../../node_modules/bufferutil/fallback.js","../../../node_modules/bufferutil/index.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/buffer-util.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/limiter.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/permessage-deflate.js","../../../node_modules/utf-8-validate/fallback.js","../../../node_modules/utf-8-validate/index.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/validation.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/receiver.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/sender.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/event-target.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/extension.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/websocket.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/stream.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/subprotocol.js","../../../node_modules/rpc-websockets/node_modules/ws/lib/websocket-server.js","../../../node_modules/rpc-websockets/node_modules/ws/index.js","../../../node_modules/rpc-websockets/dist/lib/client/websocket.js","../../../node_modules/@babel/runtime/helpers/regeneratorRuntime.js","../../../node_modules/@babel/runtime/regenerator/index.js","../../../node_modules/@babel/runtime/helpers/asyncToGenerator.js","../../../node_modules/eventemitter3/index.js","../../../node_modules/rpc-websockets/dist/lib/client.js","../../../node_modules/@babel/runtime/helpers/defineProperty.js","../../../node_modules/@babel/runtime/helpers/arrayLikeToArray.js","../../../node_modules/@babel/runtime/helpers/arrayWithoutHoles.js","../../../node_modules/@babel/runtime/helpers/iterableToArray.js","../../../node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js","../../../node_modules/@babel/runtime/helpers/nonIterableSpread.js","../../../node_modules/@babel/runtime/helpers/toConsumableArray.js","../../../node_modules/uuid/dist/esm-browser/rng.js","../../../node_modules/uuid/dist/esm-browser/regex.js","../../../node_modules/uuid/dist/esm-browser/validate.js","../../../node_modules/uuid/dist/esm-browser/stringify.js","../../../node_modules/uuid/dist/esm-browser/v1.js","../../../node_modules/uuid/dist/esm-browser/parse.js","../../../node_modules/uuid/dist/esm-browser/v35.js","../../../node_modules/uuid/dist/esm-browser/md5.js","../../../node_modules/uuid/dist/esm-browser/v3.js","../../../node_modules/uuid/dist/esm-browser/v4.js","../../../node_modules/uuid/dist/esm-browser/sha1.js","../../../node_modules/uuid/dist/esm-browser/v5.js","../../../node_modules/uuid/dist/esm-browser/nil.js","../../../node_modules/uuid/dist/esm-browser/version.js","../../../node_modules/rpc-websockets/dist/lib/utils.js","../../../node_modules/rpc-websockets/dist/lib/server.js","../../../node_modules/rpc-websockets/dist/index.js","../../../node_modules/jayson/lib/generateRequest.js","../../../node_modules/jayson/lib/client/browser/index.js","../../../node_modules/webidl-conversions/lib/index.js","../../../node_modules/whatwg-url/lib/utils.js","../../../node_modules/tr46/index.js","../../../node_modules/whatwg-url/lib/url-state-machine.js","../../../node_modules/whatwg-url/lib/URL-impl.js","../../../node_modules/whatwg-url/lib/URL.js","../../../node_modules/whatwg-url/lib/public-api.js","../../../node_modules/node-fetch/lib/index.mjs","../../../node_modules/@noble/hashes/esm/sha3.js","../../../node_modules/@noble/hashes/esm/hmac.js","../../../node_modules/@noble/secp256k1/lib/esm/index.js","../../../node_modules/@solana/web3.js/lib/index.esm.js","../../../node_modules/@stablelib/wipe/lib/wipe.js","../../../node_modules/@stablelib/int/lib/int.js","../../../node_modules/@stablelib/binary/lib/binary.js","../../../node_modules/@stablelib/aes/lib/aes.js","../src/hooks/session/useSession.ts","../../../node_modules/@project-serum/anchor/dist/esm/utils/common.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/bytes/hex.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/bytes/utf8.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/bytes/bs58.js","../../../node_modules/base64-js/index.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/bytes/base64.js","../../../node_modules/@project-serum/anchor/dist/esm/program/common.js","../../../node_modules/superstruct/lib/index.es.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/rpc.js","../../../node_modules/@project-serum/anchor/dist/esm/provider.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/features.js","../../../node_modules/@project-serum/anchor/dist/esm/error.js","../../../node_modules/camelcase/index.js","../../../node_modules/lower-case/dist.es2015/index.js","../../../node_modules/no-case/dist.es2015/index.js","../../../node_modules/dot-case/dist.es2015/index.js","../../../node_modules/snake-case/dist.es2015/index.js","../../../node_modules/js-sha256/src/sha256.js","../../../node_modules/buffer-layout/lib/Layout.js","../../../node_modules/@coral-xyz/borsh/dist/index.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/borsh/idl.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/borsh/instruction.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/common.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/borsh/accounts.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/borsh/event.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/borsh/state.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/borsh/types.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/borsh/index.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/system/instruction.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/system/state.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/system/accounts.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/system/events.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/system/types.js","../../../node_modules/@project-serum/anchor/dist/esm/coder/system/index.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/sha256.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/pubkey.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/token.js","../../../node_modules/cross-fetch/node_modules/node-fetch/lib/index.mjs","../../../node_modules/cross-fetch/dist/node-ponyfill.js","../../../node_modules/@project-serum/anchor/dist/esm/utils/registry.js","../../../node_modules/pako/dist/pako.esm.mjs","../../../node_modules/@project-serum/anchor/dist/esm/idl.js","../../../node_modules/@project-serum/anchor/dist/esm/program/context.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/instruction.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/rpc.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/transaction.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/state.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/account.js","../../../node_modules/@project-serum/anchor/dist/esm/program/event.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/simulate.js","../../../node_modules/@project-serum/anchor/dist/esm/program/token-account-layout.js","../../../node_modules/@project-serum/anchor/dist/esm/program/accounts-resolver.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/methods.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/views.js","../../../node_modules/@project-serum/anchor/dist/esm/program/namespace/index.js","../../../node_modules/@project-serum/anchor/dist/esm/program/index.js","../../../node_modules/@project-serum/anchor/dist/esm/native/system.js","../../../node_modules/@project-serum/anchor/dist/esm/native/index.js","../../../node_modules/@project-serum/anchor/dist/esm/index.js","../../gpl-core/lib/connection.js","../../gpl-core/lib/constants.js","../../../node_modules/randombytes/index.js","../../gpl-core/lib/postmetadata.js","../../../node_modules/delayed-stream/lib/delayed_stream.js","../../../node_modules/combined-stream/lib/combined_stream.js","../../../node_modules/mime-db/index.js","../../../node_modules/mime-types/index.js","../../../node_modules/asynckit/lib/defer.js","../../../node_modules/asynckit/lib/async.js","../../../node_modules/asynckit/lib/abort.js","../../../node_modules/asynckit/lib/iterate.js","../../../node_modules/asynckit/lib/state.js","../../../node_modules/asynckit/lib/terminator.js","../../../node_modules/asynckit/parallel.js","../../../node_modules/asynckit/serialOrdered.js","../../../node_modules/asynckit/serial.js","../../../node_modules/asynckit/index.js","../../../node_modules/axios/node_modules/form-data/lib/populate.js","../../../node_modules/axios/node_modules/form-data/lib/form_data.js","../../../node_modules/proxy-from-env/index.js","../../../node_modules/debug/node_modules/ms/index.js","../../../node_modules/debug/src/common.js","../../../node_modules/debug/src/browser.js","../../../node_modules/has-flag/index.js","../../../node_modules/supports-color/index.js","../../../node_modules/debug/src/node.js","../../../node_modules/debug/src/index.js","../../../node_modules/follow-redirects/debug.js","../../../node_modules/follow-redirects/index.js","../../../node_modules/axios/dist/node/axios.cjs","../../gpl-core/lib/post.js","../../gpl-core/lib/profile.js","../../gpl-core/lib/reaction.js","../../gpl-core/lib/user.js","../../gpl-core/lib/session.js","../../gpl-core/lib/profileMetadata.js","../../gpl-core/lib/index.js","../src/hooks/useGum.ts"],"sourcesContent":["import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useEffect, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst useUser = (sdk: SDK, userAccount: PublicKey) => {\n const [user, setUser] = useState<any>(null);\n const [userLoading, setUserLoading] = useState(false);\n const [userError, setUserError] = useState<Error | null>(null);\n\n const fetchUser = useCallback(\n async () => {\n setUserLoading(true);\n setUserError(null);\n\n try {\n const data = await sdk.user.get(userAccount);\n\n setUser(data);\n } catch (err: any) {\n setUserError(err);\n } finally {\n setUserLoading(false);\n }\n }, [sdk, userAccount]);\n\n useEffect(() => {\n fetchUser();\n }, []);\n\n return { user, userLoading, userError };\n};\n\nexport { useUser };","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst useCreateUser = (sdk: SDK) => {\n const [userPDA, setUserPDA] = useState<PublicKey | null>(null);\n const [isCreatingUser, setIsCreatingUser] = useState(false);\n const [createUserError, setCreateUserError] = useState<Error | null>(null);\n\n const create = useCallback(\n async (owner: PublicKey) => {\n setIsCreatingUser(true);\n setCreateUserError(null);\n\n try {\n const data = await createUserIxMethodBuilder(owner);\n await data?.rpc();\n } catch (err: any) {\n setCreateUserError(err);\n } finally {\n setIsCreatingUser(false);\n }\n },\n [sdk]\n );\n\n const getOrCreate = useCallback(\n async (owner: PublicKey) => {\n setIsCreatingUser(true);\n setCreateUserError(null);\n\n try {\n const userPDA = await sdk.user.getOrCreate(owner);\n setUserPDA(userPDA);\n } catch (err: any) {\n setCreateUserError(err);\n } finally {\n setIsCreatingUser(false);\n }\n },\n [sdk]);\n\n const createUserIxMethodBuilder = useCallback(\n async (owner: PublicKey) => {\n setCreateUserError(null);\n\n try {\n const user = await sdk.user.create(owner);\n setUserPDA(user?.userPDA);\n return user.instructionMethodBuilder;\n } catch (err: any) {\n setCreateUserError(err);\n return null;\n }\n },\n [sdk]\n );\n\n return {\n create,\n getOrCreate,\n createUserIxMethodBuilder,\n userPDA,\n isCreatingUser,\n createUserError\n };\n};\n\nexport { useCreateUser };","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useEffect, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst useProfile = (sdk: SDK, profileAccount: PublicKey) => {\n const [profile, setProfile] = useState<any>(null);\n const [profileLoading, setProfileLoading] = useState(false);\n const [profileError, setProfileError] = useState<Error | null>(null);\n\n const fetchProfile = useCallback(\n async () => {\n setProfileLoading(true);\n setProfileError(null);\n\n try {\n const data = await sdk.profileMetadata.getProfileMetadataByProfile(profileAccount);\n\n setProfile(data);\n } catch (err: any) {\n setProfileError(err);\n } finally {\n setProfileLoading(false);\n }\n }, [sdk, profileAccount]);\n\n useEffect(() => {\n fetchProfile();\n }, []);\n\n return { profile, profileLoading, profileError };\n};\n\nexport { useProfile };","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\nimport { Namespace } from \"@gum-protocol/gpl-sdk/lib/profile\";\n\nconst useCreateProfile = (sdk: SDK) => {\n const [profilePDA, setProfilePDA] = useState<PublicKey | null>(null);\n const [isCreatingProfile, setIsCreatingProfile] = useState(false);\n const [createProfileError, setCreateProfileError] = useState<Error | null>(null);\n\n const create = useCallback(\n async (metadataUri: String, namespace: Namespace, userAccount: PublicKey, owner: PublicKey) => {\n setIsCreatingProfile(true);\n setCreateProfileError(null);\n try {\n\n const ixMethodBuilder = await createProfileIxMethodBuilder(metadataUri, namespace, userAccount, owner);\n await ixMethodBuilder?.rpc();\n } catch (err: any) {\n setCreateProfileError(err);\n } finally {\n setIsCreatingProfile(false);\n }\n }, [sdk]);\n\n const getOrCreate = useCallback(\n async (metadataUri: String, namespace: Namespace, userAccount: PublicKey, owner: PublicKey) => {\n setIsCreatingProfile(true);\n setCreateProfileError(null);\n try {\n const profilePDA = await sdk.profile.getOrCreate(metadataUri, userAccount, namespace, owner);\n setProfilePDA(profilePDA);\n }\n catch (err: any) {\n setCreateProfileError(err);\n } finally {\n setIsCreatingProfile(false);\n }\n }, [sdk]);\n\n const createProfileIxMethodBuilder = useCallback(\n async (metadataUri: String, namespace: Namespace, userAccount: PublicKey, owner: PublicKey) => {\n setCreateProfileError(null);\n\n try {\n const createProfile = await sdk.profile.create(userAccount, namespace, owner);\n const profileMetadata = await sdk.profileMetadata.create(metadataUri, createProfile.profilePDA, userAccount, owner);\n const profileMetadataIx = await profileMetadata.instructionMethodBuilder.instruction();\n\n const data = {\n instructionMethodBuilder: createProfile.instructionMethodBuilder.postInstructions(\n [profileMetadataIx]),\n profilePDA: createProfile.profilePDA,\n }\n setProfilePDA(data.profilePDA);\n return data.instructionMethodBuilder;\n } catch (err: any) {\n setCreateProfileError(err);\n return null;\n }\n }, [sdk]);\n\n return {\n create,\n getOrCreate,\n createProfileIxMethodBuilder,\n profilePDA,\n isCreatingProfile,\n createProfileError\n };\n};\n\nexport { useCreateProfile };","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useEffect, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst usePost = (sdk: SDK, postAccount: PublicKey) => {\n const [post, setPost] = useState<any>(null);\n const [postLoading, setPostLoading] = useState(false);\n const [postError, setPostError] = useState<Error | null>(null);\n\n const fetchPost = useCallback(\n async () => {\n setPostLoading(true);\n setPostError(null);\n\n try {\n const data = await sdk.post.get(postAccount);\n\n setPost(data);\n } catch (err: any) {\n setPostError(err);\n } finally {\n setPostLoading(false);\n }\n }, [sdk, postAccount]);\n\n useEffect(() => {\n fetchPost();\n }, []);\n\n return { post, postLoading, postError };\n};\n\nexport { usePost };","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst useCreatePost = (sdk: SDK) => {\n const [postPDA, setPostPDA] = useState<PublicKey | null>(null);\n const [isCreatingPost, setIsCreatingPost] = useState(false);\n const [createPostError, setCreatePostError] = useState<Error | null>(null);\n\n const create = useCallback(\n async (metadataUri: String, profileAccount: PublicKey, userAccount: PublicKey, owner: PublicKey) => {\n setIsCreatingPost(true);\n setCreatePostError(null);\n\n try {\n const instructionMethodBuilder = await createPostIxMethodBuilder(metadataUri, profileAccount, userAccount, owner);\n await instructionMethodBuilder?.rpc();\n } catch (err: any) {\n setCreatePostError(err);\n } finally {\n setIsCreatingPost(false);\n }\n }, [sdk]);\n\n const createPostIxMethodBuilder = useCallback(\n async (metadataUri: String, profileAccount: PublicKey, userAccount: PublicKey, owner: PublicKey) => {\n setCreatePostError(null);\n\n try {\n const data = await sdk.post.create(metadataUri, profileAccount, userAccount, owner);\n setPostPDA(data.postPDA);\n return data.instructionMethodBuilder;\n } catch (err: any) {\n setCreatePostError(err);\n return null;\n }\n }, [sdk]\n );\n\n return {\n create,\n createPostIxMethodBuilder,\n postPDA,\n isCreatingPost,\n createPostError\n };\n};\n\nexport { useCreatePost };","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useEffect, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst useFeed = (sdk: SDK, profileAccount: PublicKey) => {\n const [feedData, setFeedData] = useState<any>(null);\n const [feedLoading, setFeedLoading] = useState(false);\n const [feedError, setFeedError] = useState<Error | null>(null);\n\n const fetchFeed = useCallback(\n async () => {\n setFeedLoading(true);\n setFeedError(null);\n\n try {\n const data = await sdk.post.getFeedsByFollowedUsers(profileAccount);\n\n setFeedData(data);\n } catch (err: any) {\n setFeedError(err);\n } finally {\n setFeedLoading(false);\n }\n }, [sdk, profileAccount]);\n\n useEffect(() => {\n fetchFeed();\n }, []);\n\n return { feedData, feedLoading, feedError };\n};\n\nexport { useFeed };\n","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useEffect, useCallback } from \"react\";\nimport { Namespace } from \"@gum-protocol/gpl-sdk/lib/profile\";\n\nconst useExploreFeed = (sdk: SDK, namespace: Namespace) => {\n const [exploreFeedData, setExploreFeedData] = useState<any>(null);\n const [exploreFeedLoading, setExploreFeedLoading] = useState(false);\n const [exploreFeedError, setExploreFeedError] = useState<Error | null>(null);\n\n const fetchExploreFeed = useCallback(\n async () => {\n setExploreFeedLoading(true);\n setExploreFeedError(null);\n\n try {\n const data = await sdk.post.getPostsByNamespace(namespace);\n\n setExploreFeedData(data);\n } catch (err: any) {\n setExploreFeedError(err);\n } finally {\n setExploreFeedLoading(false);\n }\n }, [sdk, namespace]);\n\n useEffect(() => {\n fetchExploreFeed();\n }, []);\n\n return { exploreFeedData, exploreFeedLoading, exploreFeedError };\n};\n\nexport { useExploreFeed };\n","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\nimport { ReactionType } from \"@gum-protocol/gpl-sdk/lib/reaction\";\n\nconst useReaction = (sdk: SDK, ) => {\n const [reactionPDA, setReactionPDA] = useState<PublicKey | null>(null);\n const [isReacting, setIsReacting] = useState(false);\n const [createReactionError, setCreateReactionError] = useState(null);\n\n const createReaction = useCallback(\n async (reactionType: ReactionType, fromProfile: PublicKey, toPostAccount: PublicKey, userAccount: PublicKey, owner: PublicKey) => {\n setIsReacting(true);\n setCreateReactionError(null);\n\n try {\n const ixMethodBuilder = await createReactionIxMethodBuilder(reactionType, fromProfile, toPostAccount, userAccount, owner);\n await ixMethodBuilder?.rpc();\n \n } catch (err: any) {\n setCreateReactionError(err);\n } finally {\n setIsReacting(false);\n }\n }, [sdk]);\n\n const createReactionIxMethodBuilder = useCallback(\n async (reactionType: ReactionType, fromProfile: PublicKey, toPostAccount: PublicKey, userAccount: PublicKey, owner: PublicKey) => {\n setCreateReactionError(null);\n\n try {\n const data = await sdk.reaction.create(fromProfile, toPostAccount, reactionType, userAccount, owner);\n setReactionPDA(data.reactionPDA);\n return data.instructionMethodBuilder;\n } catch (err: any) {\n setCreateReactionError(err);\n return null;\n }\n }, [sdk]);\n\n\n const deleteReaction = useCallback(\n async (reactionAccount: PublicKey, fromProfile: PublicKey, toPostAccount: PublicKey, userAccount: PublicKey, owner: PublicKey) => {\n setIsReacting(true);\n setCreateReactionError(null);\n\n try {\n const ixMethodBuilder = await deleteReactionIxMethodBuilder(reactionAccount, fromProfile, toPostAccount, userAccount, owner);\n await ixMethodBuilder?.rpc();\n } catch (err: any) {\n setCreateReactionError(err);\n } finally {\n setIsReacting(false);\n }\n }, [sdk]);\n\n const deleteReactionIxMethodBuilder = useCallback(\n async (reactionAccount: PublicKey, fromProfile: PublicKey, toPostAccount: PublicKey, userAccount: PublicKey, owner: PublicKey) => {\n setCreateReactionError(null);\n\n try {\n const data = sdk.reaction.delete(reactionAccount, fromProfile, toPostAccount, userAccount, owner);\n return data;\n } catch (err: any) {\n setCreateReactionError(err);\n return null;\n }\n }, [sdk]);\n\n\n\n return { \n createReaction,\n createReactionIxMethodBuilder,\n deleteReaction,\n deleteReactionIxMethodBuilder,\n reactionPDA,\n isReacting,\n createReactionError\n };\n};\n\nexport { useReaction };\n","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst useFollow = (sdk: SDK) => {\n const [connectionPDA, setConnectionPDA] = useState<PublicKey | null>(null);\n const [connectionLoading, setConnectionLoading] = useState(false);\n const [connectionError, setConnectionError] = useState<Error | null>(null);\n\n const follow = useCallback(\n async (\n fromProfile: PublicKey,\n toProfile: PublicKey,\n userAccount: PublicKey,\n owner: PublicKey\n ) => {\n setConnectionLoading(true);\n setConnectionError(null);\n\n try {\n const instructionMethodBuilder = await createConnectionIxMethodBuilder(\n fromProfile,\n toProfile,\n userAccount,\n owner\n );\n await instructionMethodBuilder?.rpc();\n } catch (err: any) {\n setConnectionError(err);\n } finally {\n setConnectionLoading(false);\n }\n },\n [sdk]\n );\n\n const createConnectionIxMethodBuilder = useCallback(\n async (\n fromProfile: PublicKey,\n toProfile: PublicKey,\n userAccount: PublicKey,\n owner: PublicKey\n ) => {\n setConnectionError(null);\n\n try {\n const connection = await sdk.connection.create(\n fromProfile,\n toProfile,\n userAccount,\n owner\n );\n setConnectionPDA(connection.connectionPDA);\n return connection.instructionMethodBuilder;\n } catch (err: any) {\n setConnectionError(err);\n return null;\n }\n },\n [sdk]\n );\n\n return {\n follow,\n createConnectionIxMethodBuilder,\n connectionPDA,\n connectionLoading,\n connectionError\n };\n};\n\nexport { useFollow };\n","import { SDK } from \"@gum-protocol/gpl-sdk\";\nimport { useState, useCallback } from \"react\";\nimport { PublicKey } from \"@solana/web3.js\";\n\nconst useUnfollow = (sdk: SDK) => {\n const [connectionLoading, setConnectionLoading] = useState(false);\n const [connectionError, setConnectionError] = useState<Error | null>(null);\n\n const unfollow = useCallback(\n async (\n connectionAccount: PublicKey,\n fromProfile: PublicKey,\n toProfile: PublicKey,\n userAccount: PublicKey,\n owner: PublicKey\n ) => {\n setConnectionLoading(true);\n setConnectionError(null);\n\n try {\n const instructionMethodBuilder = await deleteConnectionIxMethodBuilder(\n connectionAccount,\n fromProfile,\n toProfile,\n userAccount,\n owner\n );\n await instructionMethodBuilder?.rpc();\n } catch (err: any) {\n setConnectionError(err);\n } finally {\n setConnectionLoading(false);\n }\n },\n [sdk]);\n\n const deleteConnectionIxMethodBuilder = useCallback(\n async (\n connectionAccount: PublicKey,\n fromProfile: PublicKey,\n toProfile: PublicKey,\n userAccount: PublicKey,\n owner: PublicKey\n ) => {\n setConnectionError(null);\n\n try {\n const data = sdk.connection.delete(\n connectionAccount,\n fromProfile,\n toProfile,\n userAccount,\n owner\n );\n return data;\n } catch (err: any) {\n setConnectionError(err);\n return null;\n }\n },\n [sdk]\n );\n\n return {\n unfollow,\n deleteConnectionIxMethodBuilder,\n connectionLoading,\n connectionError\n };\n};\n\nexport { useUnfollow };\n","export function number(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error(`Wrong positive integer: ${n}`);\n}\nexport function bool(b) {\n if (typeof b !== 'boolean')\n throw new Error(`Expected boolean, not ${b}`);\n}\nexport function bytes(b, ...lengths) {\n if (!(b instanceof Uint8Array))\n throw new TypeError('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new TypeError(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\nexport function hash(hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\nexport function exists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\nexport function output(out, instance) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\nconst assert = {\n number,\n bool,\n bytes,\n hash,\n exists,\n output,\n};\nexport default assert;\n","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// The import here is via the package name. This is to ensure\n// that exports mapping/resolution does fall into place.\nimport { crypto } from '@noble/hashes/crypto';\n// Cast array to different type\nexport const u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n// Cast array to view\nexport const createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word, shift) => (word << (32 - shift)) | (word >>> shift);\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\n// There is almost no big endian hardware, but js typed arrays uses platform specific endianness.\n// So, just to be sure not to corrupt anything.\nif (!isLE)\n throw new Error('Non little-endian hardware is not supported');\nconst hexes = Array.from({ length: 256 }, (v, i) => i.toString(16).padStart(2, '0'));\n/**\n * @example bytesToHex(Uint8Array.from([0xde, 0xad, 0xbe, 0xef]))\n */\nexport function bytesToHex(uint8a) {\n // pre-caching improves the speed 6x\n if (!(uint8a instanceof Uint8Array))\n throw new Error('Uint8Array expected');\n let hex = '';\n for (let i = 0; i < uint8a.length; i++) {\n hex += hexes[uint8a[i]];\n }\n return hex;\n}\n/**\n * @example hexToBytes('deadbeef')\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string') {\n throw new TypeError('hexToBytes: expected string, got ' + typeof hex);\n }\n if (hex.length % 2)\n throw new Error('hexToBytes: received invalid unpadded hex');\n const array = new Uint8Array(hex.length / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0)\n throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n// There is no setImmediate in browser and setTimeout is slow. However, call to async function will return Promise\n// which will be fullfiled only on next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => { };\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string') {\n throw new TypeError(`utf8ToBytes expected string, got ${typeof str}`);\n }\n return new TextEncoder().encode(str);\n}\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n if (!(data instanceof Uint8Array))\n throw new TypeError(`Expected input type is Uint8Array (got ${typeof data})`);\n return data;\n}\n/**\n * Concats Uint8Array-s into one; like `Buffer.concat([buf1, buf2])`\n * @example concatBytes(buf1, buf2)\n */\nexport function concatBytes(...arrays) {\n if (!arrays.every((a) => a instanceof Uint8Array))\n throw new Error('Uint8Array list expected');\n if (arrays.length === 1)\n return arrays[0];\n const length = arrays.reduce((a, arr) => a + arr.length, 0);\n const result = new Uint8Array(length);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const arr = arrays[i];\n result.set(arr, pad);\n pad += arr.length;\n }\n return result;\n}\n// For runtime check if class implements interface\nexport class Hash {\n // Safe version that clones internal state\n clone() {\n return this._cloneInto();\n }\n}\n// Check if object doens't have custom constructor (like Uint8Array/Array)\nconst isPlainObject = (obj) => Object.prototype.toString.call(obj) === '[object Object]' && obj.constructor === Object;\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && (typeof opts !== 'object' || !isPlainObject(opts)))\n throw new TypeError('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\nexport function wrapConstructor(hashConstructor) {\n const hashC = (message) => hashConstructor().update(toBytes(message)).digest();\n const tmp = hashConstructor();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashConstructor();\n return hashC;\n}\nexport function wrapConstructorWithOpts(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\n/**\n * Secure PRNG\n */\nexport function randomBytes(bytesLength = 32) {\n if (crypto.web) {\n return crypto.web.getRandomValues(new Uint8Array(bytesLength));\n }\n else if (crypto.node) {\n return new Uint8Array(crypto.node.randomBytes(bytesLength).buffer);\n }\n else {\n throw new Error(\"The environment doesn't have randomBytes function\");\n }\n}\n","import assert from './_assert.js';\nimport { Hash, createView, toBytes } from './utils.js';\n// Polyfill for Safari 14\nfunction setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n// Base SHA2 class (RFC 6234)\nexport class SHA2 extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n assert.exists(this);\n const { view, buffer, blockLen } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n assert.exists(this);\n assert.output(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n this.buffer.subarray(pos).fill(0);\n // we have less than padOffset left in buffer, so we cannot put length in current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.length = length;\n to.pos = pos;\n to.finished = finished;\n to.destroyed = destroyed;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n}\n","const U32_MASK64 = BigInt(2 ** 32 - 1);\nconst _32n = BigInt(32);\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nexport function fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nexport function split(lst, le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nexport const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (h, l) => l;\nconst rotr32L = (h, l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\n// Removing \"export\" has 5% perf penalty -_-\nexport function add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n","import { SHA2 } from './_sha2.js';\nimport u64 from './_u64.js';\nimport { wrapConstructor } from './utils.js';\n// Round contants (first 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409):\n// prettier-ignore\nconst [SHA512_Kh, SHA512_Kl] = u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n)));\n// Temporary buffer, not used to store anything between runs\nconst SHA512_W_H = new Uint32Array(80);\nconst SHA512_W_L = new Uint32Array(80);\nexport class SHA512 extends SHA2 {\n constructor() {\n super(128, 64, 16, false);\n // We cannot use array here since array allows indexing by variable which means optimizer/compiler cannot use registers.\n // Also looks cleaner and easier to verify with spec.\n // Initial state (first 32 bits of the fractional parts of the square roots of the first 8 primes 2..19):\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = 0x6a09e667 | 0;\n this.Al = 0xf3bcc908 | 0;\n this.Bh = 0xbb67ae85 | 0;\n this.Bl = 0x84caa73b | 0;\n this.Ch = 0x3c6ef372 | 0;\n this.Cl = 0xfe94f82b | 0;\n this.Dh = 0xa54ff53a | 0;\n this.Dl = 0x5f1d36f1 | 0;\n this.Eh = 0x510e527f | 0;\n this.El = 0xade682d1 | 0;\n this.Fh = 0x9b05688c | 0;\n this.Fl = 0x2b3e6c1f | 0;\n this.Gh = 0x1f83d9ab | 0;\n this.Gl = 0xfb41bd6b | 0;\n this.Hh = 0x5be0cd19 | 0;\n this.Hl = 0x137e2179 | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA