@circle-fin/w3s-pw-react-native-sdk
Version:
React Native SDK for Circle Programmable Wallet
42 lines (37 loc) • 1.49 kB
text/typescript
// Copyright (c) 2024, Circle Internet Financial, LTD. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import { NativeModules, Platform } from 'react-native'
const LINKING_ERROR =
`The package '@circle-fin/w3s-pw-react-native-sdk' doesn't seem to be linked. Make sure: \n\n` +
Platform.select({ ios: '- You have run \'pod install\'\n', default: '' }) +
'- You rebuilt the app after installing the package\n' +
'- You are not using Expo Go\n'
// @ts-expect-error
const isTurboModuleEnabled = global.__turboModuleProxy != null
const programmablewalletRnSdkModule = isTurboModuleEnabled
? require('./NativeProgrammablewalletRnSdk').default
: NativeModules.ProgrammablewalletRnSdk
const WalletSdkModule = programmablewalletRnSdkModule
? programmablewalletRnSdkModule
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR)
},
},
)
export default WalletSdkModule