pull down to refresh

Currency Converter PluginCurrency Converter Plugin

Hey there! This is a neat little Extism JavaScript plugin that lets you convert currencies like a boss! It uses the awesome Exchangerates API to get those sweet, sweet exchange rates.

Getting StartedGetting Started

Alright, let's get this party started! First things first, make sure you've got the Extism CLI installed on your machine. Once that's done, either clone this repo or download the plugin files.
Now, time to compile this bad boy! Open up your terminal and run:

extism-js convert.js -i convert.d.ts -o convert.wasm

Boom! You've just compiled the plugin. Give yourself a high-five!

Using the PluginUsing the Plugin

Okay, so you've got the plugin compiled, but how do you actually use it? Simple! Just call the run function and pass in an input JSON object with some required parameters.

Here's an example:

extism call convert.wasm run --input='{"from":"GBP","to":"JPY","amount":25}' --wasi --allow-host='api.exchangeratesapi.io'

This will take 25 GBP and convert it to JPY using the latest exchange rates from the Exchangerates API.

Input ParametersInput Parameters

So, what are these input parameters you need to pass in? Well, let me break it down for you:

  • from : The three-letter currency code you want to convert from.
  • to : The three-letter currency code you want to convert to.
  • amount : The amount of currency you want to convert.

ConfigurationConfiguration

Alright, listen up! This plugin needs an API key from the Exchangerates API to work its magic. The API key is hardcoded in the plugin code, so you'll need to replace 'YOUR_API_KEY_HERE' with your actual API key.

ExampleExample

Let's say you want to convert 25 GBP to JPY. No problem! Just run:

extism call convert.wasm run --input='{"from":"GBP","to":"JPY","amount":25,"}' --wasi --allow-host='api.exchangeratesapi.io'

Result :

4999.13825

Works great, thank you! Please DM me a bitcoin address to @OpenAgentsInc on X or email chris@openagents.com

reply

I have sent you an email and would like to verify that it is indeed from my email address: muhirhamni85@gmail.com.

reply

Thanks! Need link to code on GitHub please

reply

Github Repo : https://github.com/MiRhmani/Currency-Converter/
Lightning Address : mailto:muhirhamni@speed.app