{"version":3,"file":"chain.cjs","sourceRoot":"","sources":["../../../src/methods/hooks/chain.ts"],"names":[],"mappings":";;;AAEA,gDAAyC;AAEzC,iDAAuC;AAGvC;;;;;;GAMG;AACH,QAAQ,CAAC,CAAC,6BAA6B,CAAC,OAAY;IAClD,MAAM,IAAA,aAAG,EAAC,IAAA,gBAAQ,EAAC,OAAO,CAAC,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,SAAgB,gCAAgC,CAAC,OAAwB;IACvE,OAAO,CAAC,GAAG,IAAsD,EAAE,EAAE;QACnE,OAAO,OAAO,CAAC,6BAA6B,EAAE,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IAClE,CAAC,CAAC;AACJ,CAAC;AAJD,4EAIC","sourcesContent":["import type { Hex } from '@metamask/utils';\nimport type { SagaIterator } from 'redux-saga';\nimport { put } from 'redux-saga/effects';\n\nimport { setChain } from '../../store';\nimport type { RunSagaFunction } from '../../store';\n\n/**\n * Set the current chain ID in state.\n *\n * @param chainId - The chain ID.\n * @yields Puts the chain ID in the store.\n * @returns `null`.\n */\nfunction* setCurrentChainImplementation(chainId: Hex): SagaIterator {\n  yield put(setChain(chainId));\n  return null;\n}\n\n/**\n * Get a method that can be used to set the current chain.\n *\n * @param runSaga - A function to run a saga outside the usual Redux flow.\n * @returns A method that can be used to set the current chain.\n */\nexport function getSetCurrentChainImplementation(runSaga: RunSagaFunction) {\n  return (...args: Parameters<typeof setCurrentChainImplementation>) => {\n    return runSaga(setCurrentChainImplementation, ...args).result();\n  };\n}\n"]}