ghost-portal/packages/react-hooks/src/usePayWithAsset.ts
Arjun Porwal bdfcedae72
AssetHub: Fee payment with any sufficient asset (#11229)
* feat: created useAssetIds and useAssetInfo hook

* feat: created pay with asset component

* feat: add paywith asset component with Transfer modal

* fix: signer options as prop

* fix: payment info

* feat: created PayWithAsset provider and integrated with transfer form

* chore: rename variable

* fix: PayWithAsset provider wrapping

* feat: integrate PayWithAsset context and enhance asset info fetching

* fix: some build errors

* refactor: update imports and simplify getFeeAssetLocation function

* refactor: simplify component structure and update PayWithAsset import paths

* fix: all build errors

* fix: avoid redundant type

* feat: added translation

* feat: enhance fee payment info & fee asset handling

* fix: translations ordering

* fix: remove redundant types and hooks

* chore: added statemine chain

* refactor: generalize fee acceptance check for non-native assets

* fix: remove constants and generalize palletIndex
2025-02-06 21:20:08 +05:30

16 lines
489 B
TypeScript

// Copyright 2017-2025 @polkadot/react-hooks authors & contributors
// SPDX-License-Identifier: Apache-2.0
import type { PayWithAsset } from './ctx/types.js';
import { useContext } from 'react';
import { PayWithAssetCtx } from './ctx/PayWithAsset.js';
import { createNamedHook } from './createNamedHook.js';
function usePayWithAssetImpl (): PayWithAsset {
return useContext(PayWithAssetCtx);
}
export const usePayWithAsset = createNamedHook('usePayWithAsset', usePayWithAssetImpl);