Skip to content

Commit

Permalink
Merge branch 'feature/snippets-extension' of https://github.com/sidan…
Browse files Browse the repository at this point in the history
…-lab/cardano-devkit into feature/snippets-extension
  • Loading branch information
HinsonSIDAN committed Dec 9, 2024
2 parents 7b6af02 + 6e64108 commit 1fbbce2
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 0 deletions.
2 changes: 2 additions & 0 deletions snippet-extension/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Set default behavior to automatically normalize line endings.
* text=auto
3 changes: 3 additions & 0 deletions snippet-extension/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
*.vsix
test.*
17 changes: 17 additions & 0 deletions snippet-extension/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// A launch configuration that launches the extension inside a new window
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
{
"version": "0.2.0",
"configurations": [
{
"name": "Extension",
"type": "extensionHost",
"request": "launch",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}"
]
}
]
}
4 changes: 4 additions & 0 deletions snippet-extension/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.vscode/**
.vscode-test/**
.gitignore
vsc-extension-quickstart.md
9 changes: 9 additions & 0 deletions snippet-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Change Log

All notable changes to the "cardano-dev-snippet" extension will be documented in this file.

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

## [Unreleased]

- Initial release
28 changes: 28 additions & 0 deletions snippet-extension/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# cardano-dev-snippet

## 🚧 Under Construction 🚧

## Introduction

Snippets for Cardano Development

## Contribution

Add or modify the JSON files in the `snippets` folder. The file name should be the language identifier. For example, `mesh-react-hooks.json` for hooks in `@meshsdk/react`.

## Publishing the Extension
Before publishing, make sure you have the Visual Studio Code Extension Manager installed:
```bash
npm install -g @vscode/vsce
```

To generate the `.vsix` file:
```bash
vsce package
```
* You can install the extension from the `.vsix` file to test it locally.

To publish the extension to VS Code Marketplace:
```bash
vsce publish
```
24 changes: 24 additions & 0 deletions snippet-extension/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "cardano-dev-snippet",
"displayName": "cardano-dev-snippet",
"description": "A snippet extension for cardano development",
"version": "0.0.1",
"engines": {
"vscode": "^0.10.5"
},
"categories": [
"Snippets"
],
"contributes": {
"snippets": [
{
"language": "typescript",
"path": "./snippets/meshsdk-txbuilder.json"
},
{
"language": "typescript",
"path": "./snippets/meshsdk-wallet-hooks.json"
}
]
}
}
20 changes: 20 additions & 0 deletions snippet-extension/snippets/meshsdk-txbuilder.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"sendLovelace": {
"prefix": "sendLovelace",
"body": [
"import { Transaction } from '@meshsdk/core';",
"const tx = new Transaction({ initiator: wallet }).sendLovelace('address','1000000');",
"const unsignedTx = await tx.build();",
"const signedTx = await wallet.signTx(unsignedTx);",
"const txHash = await wallet.submitTx(signedTx);"
],
"description": "Using Mesh Tx Builder to build a transaction to send lovelace to the recipient's address"
},
"useWalletList": {
"prefix": "walletList",
"body": [
"const wallets = useWalletList();"
],
"description": "useWalletList hook"
}
}
16 changes: 16 additions & 0 deletions snippet-extension/snippets/meshsdk-wallet-hooks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"useWallet": {
"prefix": "useWallet",
"body": [
"const { wallet, connected, name, connecting, connect, disconnect, error } = useWallet();"
],
"description": "useWallet hook"
},
"useWalletList": {
"prefix": "useWalletList",
"body": [
"const wallets = useWalletList();"
],
"description": "useWalletList hook"
}
}

0 comments on commit 1fbbce2

Please sign in to comment.