### Project Installation and Demo Execution (Bash) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/README.md Guides users through cloning the repository, installing dependencies for both the SDK and the demo app, and running the demo application locally. ```bash # Clonar el repositorio git clone cd stellar-social-wallet # Instalar dependencias del SDK cd stellar-social-sdk npm install npm run build # Instalar dependencias de la demo cd ../demo-app npm install # Ejecutar Demo App cd demo-app npm run dev ``` -------------------------------- ### Run Development Server - npm, yarn, pnpm, bun Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/README.md Commands to start the Next.js development server using different package managers. These commands are essential for local development and testing. No external dependencies are required beyond the project setup. ```bash npm run dev ``` ```bash yarn dev ``` ```bash pnpm dev ``` ```bash bun dev ``` -------------------------------- ### Install and Run EventSource Example Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/eventsource/README.md Instructions for installing the EventSource library and running the provided server and client examples using npm and Node.js. Also shows how to access the SSE endpoint via a browser or curl. ```bash npm install node ./example/sse-server.js node ./example/sse-client.js # Node.js client open http://localhost:8080 # Browser client - both native and polyfill curl http://localhost:8080/sse # Enjoy the simplicity of SSE ``` -------------------------------- ### Basic GET Request Example Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/axios/README.md Demonstrates how to make a GET request using the SDK, including handling success, errors, and finalization. ```APIDOC ## Example > **Note**: CommonJS usage > In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS imports with `require()`, use the following approach: ```js import axios from 'axios'; //const axios = require('axios'); // legacy way // Make a request for a user with a given ID axios.get('/user?ID=12345') .then(function (response) { // handle success console.log(response); }) .catch(function (error) { // handle error console.log(error); }) .finally(function () { // always executed }); // Optionally the request above could also be done as axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }) .finally(function () { // always executed }); // Want to use async/await? Add the `async` keyword to your outer function/method. async function getUser() { try { const response = await axios.get('/user?ID=12345'); console.log(response); } catch (error) { console.error(error); } } ``` > **Note**: `async/await` is part of ECMAScript 2017 and is not supported in Internet > Explorer and older browsers, so use with caution. ``` -------------------------------- ### Making GET Requests Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Examples demonstrating how to perform GET requests using both traditional promise chains and async/await syntax. ```APIDOC ## Making GET Requests ### Using Promises ```js import axios from 'axios'; axios.get('/user?ID=12345') .then(function (response) { // handle success console.log(response); }) .catch(function (error) { // handle error console.log(error); }) .finally(function () { // always executed }); // Alternative with params object axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }) .finally(function () { // always executed }); ``` ### Using async/await ```js async function getUser() { try { const response = await axios.get('/user?ID=12345'); console.log(response); } catch (error) { console.error(error); } } ``` **Note**: `async/await` is part of ECMAScript 2017 and is not supported in Internet Explorer and older browsers, so use with caution. ``` -------------------------------- ### Install Axios using pnpm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Installs the Axios library using the pnpm package manager. pnpm is known for its efficient disk space usage and faster installation times. ```bash $ pnpm add axios ``` -------------------------------- ### Install base64-js with npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/base64-js/README.md Instructions for installing the base64-js library using npm and how to require it in your project. ```javascript npm install base64-js var base64js = require('base64-js') ``` -------------------------------- ### Axios GET Request Example (JavaScript) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Demonstrates how to perform a GET request using Axios to fetch user data. It shows both the traditional promise-based .then/.catch/.finally syntax and how to use async/await for cleaner asynchronous code. Error handling is included. Note that async/await requires a modern JavaScript environment. ```javascript import axios from 'axios'; //const axios = require('axios'); // legacy way // Make a request for a user with a given ID axios.get('/user?ID=12345') .then(function (response) { // handle success console.log(response); }) .catch(function (error) { // handle error console.log(error); }) .finally(function () { // always executed }); // Optionally the request above could also be done as axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }) .finally(function () { // always executed }); // Want to use async/await? Add the `async` keyword to your outer function/method. async function getUser() { try { const response = await axios.get('/user?ID=12345'); console.log(response); } catch (error) { console.error(error); } } ``` -------------------------------- ### Install call-bind-apply-helpers Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/call-bind-apply-helpers/README.md This command installs the `call-bind-apply-helpers` package using npm. It is a prerequisite for using the library in your project. ```sh npm install --save call-bind-apply-helpers ``` -------------------------------- ### Install Picomatch with npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/picomatch/README.md This command installs the picomatch library as a project dependency using npm. ```sh npm install --save picomatch ``` -------------------------------- ### Install Verb and Build Documentation (npm) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/picomatch/README.md Installs the 'verb' documentation generator globally (from a specific dev branch) and then runs the 'verb' command to generate the project's README.md file from its template. ```shell npm install -g verbose/verb#dev verb-generate-readme && verb ``` -------------------------------- ### Install Axios using bun Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Installs the Axios library using the bun runtime and package manager. bun offers a fast, all-in-one JavaScript toolkit. ```bash $ bun add axios ``` -------------------------------- ### Install Dependencies and Run Tests (npm) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/picomatch/README.md Installs project dependencies using npm and then executes the unit tests. This is a standard command for testing Node.js projects. ```shell npm install && npm test ``` -------------------------------- ### Start Production Server for Demo App Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/CLAUDE.md Starts the production server for the Next.js demo application. This is typically used after building the application for deployment. ```bash cd demo-app npm run start ``` -------------------------------- ### Start Next.js Demo App Development Server Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/CLAUDE.md Starts the Next.js development server for the demo application. This allows for live reloading and debugging during app development. ```bash cd demo-app npm run dev ``` -------------------------------- ### Install Dependencies and Run Linters with Yarn Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@stellar/stellar-base/README.md Installs project dependencies using Yarn and runs the linter and formatter to ensure code style consistency. Assumes Yarn is installed globally. ```shell cd js-stellar-base yarn yarn lint yarn fmt ``` -------------------------------- ### Install Axios using yarn Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Installs the Axios library using the yarn package manager. Yarn is an alternative to npm, offering features like faster installations and improved dependency management. ```bash $ yarn add axios ``` -------------------------------- ### Install Axios using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Installs the Axios library using the npm package manager. This is a common first step for integrating Axios into a project. ```bash $ npm install axios ``` -------------------------------- ### Include js-stellar-sdk using CDN in Browsers Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md Provides an example of how to include the js-stellar-sdk library in an HTML file using a Content Delivery Network (CDN). This method is convenient but relies on third-party hosting, which may have security implications. It also shows how to use it after installing with Bower. ```html ``` ```html ``` -------------------------------- ### Install Stellar SDK Dependencies Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md Command to install project dependencies for the Stellar SDK after cloning the repository. This uses `yarn` to manage packages. Ensure `yarn` is installed globally. ```shell cd js-stellar-sdk yarn ``` -------------------------------- ### Install is-reference package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/is-reference/README.md Installs the `is-reference` npm package globally or locally for use in your project. This is a prerequisite for using the utility. ```bash npm install is-reference ``` -------------------------------- ### Install and use get-proto Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/get-proto/README.md Install the 'get-proto' package using npm and import it into your JavaScript project. This snippet demonstrates basic usage for retrieving object prototypes, including edge cases like objects with null prototypes. ```bash npm install --save get-proto ``` ```javascript const assert = require('assert'); const getProto = require('get-proto'); const a = { a: 1, b: 2, [Symbol.toStringTag]: 'foo' }; const b = { c: 3, __proto__: a }; assert.equal(getProto(b), a); assert.equal(getProto(a), Object.prototype); assert.equal(getProto({ __proto__: null }), null); ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/buffer/README.md Installs all necessary project dependencies using npm. This is a prerequisite for running tests and other development tasks. ```shell npm install ``` -------------------------------- ### Fetch URL Data via HTTP with Proxy Support (JavaScript) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/proxy-from-env/README.md This JavaScript example demonstrates how to fetch data from a URL using the 'http' module in a proxy-aware manner. It utilizes `proxy-from-env` to get the proxy URL and configures the HTTP request accordingly, falling back to a direct request if no proxy is needed. ```javascript var http = require('http'); var parseUrl = require('url').parse; var getProxyForUrl = require('proxy-from-env').getProxyForUrl; var some_url = 'http://example.com/something'; // // Example, if there is a proxy server at 10.0.0.1:1234, then setting the // // http_proxy environment variable causes the request to go through a proxy. // process.env.http_proxy = 'http://10.0.0.1:1234'; // // // But if the host to be proxied is listed in NO_PROXY, then the request is // // not proxied (but a direct request is made). // process.env.no_proxy = 'example.com'; var proxy_url = getProxyForUrl(some_url); // <-- Our magic. var httpOptions; if (proxy_url) { // Should be proxied through proxy_url. var parsed_some_url = parseUrl(some_url); var parsed_proxy_url = parseUrl(proxy_url); // A HTTP proxy is quite simple. It is similar to a normal request, except the // path is an absolute URL, and the proxied URL's host is put in the header // instead of the server's actual host. httpOptions = { protocol: parsed_proxy_url.protocol, hostname: parsed_proxy_url.hostname, port: parsed_proxy_url.port, path: parsed_some_url.href, headers: { Host: parsed_some_url.host, // = host name + optional port. }, }; } else { // Direct request. httpOptions = some_url; } http.get(httpOptions, function(res) { var responses = []; res.on('data', function(chunk) { responses.push(chunk); }); res.on('end', function() { console.log(responses.join('')); }); }); ``` -------------------------------- ### React Components for Stellar Authentication Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/BUSINESS_STRATEGY.md Provides installation instructions and a usage example for the 'stellar-social-react' library. This component library includes `StellarAuthButton` and `StellarAuthModal` for integrating Stellar authentication into React applications, allowing for theme customization and method selection. ```bash npm install stellar-social-react ``` ```typescript import { StellarAuthButton, StellarAuthModal } from 'stellar-social-react'; console.log(result)} /> ``` -------------------------------- ### Installing URI.js via Package Managers Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/urijs/README.md Provides instructions for installing the URI.js library using common package managers like Bower and npm. This is the recommended way to include the library in your project. ```bash # using bower bower install uri.js # using npm npm install urijs ``` -------------------------------- ### Install Stellar SDK Dependencies Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md After cloning the repository, this command installs all necessary project dependencies using Yarn. It should be executed within the cloned `js-stellar-sdk` directory. ```shell cd js-stellar-sdk yarn ``` -------------------------------- ### Install glob using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/glob/README.md Install the glob package from npm. This is the first step to using the glob library in your Node.js project. ```bash npm i glob ``` -------------------------------- ### Install bare-addon-resolve Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/bare-addon-resolve/README.md Installs the bare-addon-resolve package using npm. This is the first step to using the addon resolution capabilities. ```bash npm i bare-addon-resolve ``` -------------------------------- ### Install isarray package using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/isarray/README.md This command shows how to install the 'isarray' package using npm, the Node Package Manager. This is the first step to using the library in your Node.js project. After installation, it can be bundled for browser use with tools like browserify. ```bash npm install isarray ``` -------------------------------- ### Basic Usage of Picomatch Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/picomatch/README.md Demonstrates how to import picomatch and use the returned matcher function to test strings against a glob pattern. The example shows matching files with a '.js' extension. ```javascript const pm = require('picomatch'); const isMatch = pm('*.js'); console.log(isMatch('abcd')); //=> false console.log(isMatch('a.js')); //=> true console.log(isMatch('a.md')); //=> false console.log(isMatch('a/b.js')); //=> false ``` -------------------------------- ### Install buffer module using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/buffer/README.md This command installs the buffer module, which provides Node.js's Buffer API for use in browser environments. It's a direct dependency installation for projects not using a bundler or for explicit dependency management. ```bash npm install buffer ``` -------------------------------- ### Install Resolve Type Definitions using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@types/resolve/README.md This command installs the type definitions for the 'resolve' package, which is a dependency for certain functionalities within the Stellar Account Abstraction SDK. It uses npm, the Node Package Manager, to manage package installations. Ensure Node.js and npm are installed on your system. ```bash npm install --save @types/resolve ``` -------------------------------- ### JavaScript Brace Expansion Examples Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/brace-expansion/README.md Demonstrates various use cases of the brace-expansion module in JavaScript, showcasing comma-separated lists, numeric ranges (forward, backward, with increments), alphabetic ranges, and nested expansions. It requires the 'brace-expansion' module to be installed. ```javascript var expand = require('brace-expansion'); expand('file-{a,b,c}.jpg') // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] expand('-v{,,}') // => ['-v', '-v', '-v'] expand('file{0..2}.jpg') // => ['file0.jpg', 'file1.jpg', 'file2.jpg'] expand('file-{a..c}.jpg') // => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] expand('file{2..0}.jpg') // => ['file2.jpg', 'file1.jpg', 'file0.jpg'] expand('file{0..4..2}.jpg') // => ['file0.jpg', 'file2.jpg', 'file4.jpg'] expand('file-{a..e..2}.jpg') // => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] expand('file{00..10..5}.jpg') // => ['file00.jpg', 'file05.jpg', 'file10.jpg'] expand('{{A..C},{a..c}}') // => ['A', 'B', 'C', 'a', 'b', 'c'] expand('ppp{,config,oe{,conf}}') // => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] ``` -------------------------------- ### Install Axios using Package Managers Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/axios/README.md Installs the Axios library using common package managers like npm, bower, yarn, pnpm, and bun. After installation, the library can be imported using ES6 import statements or Node.js require. ```bash $ npm install axios ``` ```bash $ bower install axios ``` ```bash $ yarn add axios ``` ```bash $ pnpm add axios ``` ```bash $ bun add axios ``` -------------------------------- ### Install form-data Package - Bash Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/form-data/README.md Command to install the 'form-data' npm package as a project dependency. ```bash npm install --save form-data ``` -------------------------------- ### Install isarray using npm (Bash) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/isarray/README.md This command installs the 'isarray' package using npm, the Node Package Manager. This is typically done in the project's root directory. After installation, the package can be required in JavaScript files. ```bash $ npm install isarray ``` -------------------------------- ### Install Axios using bower Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Installs the Axios library using the bower package manager. This method is suitable for projects that utilize bower for dependency management. ```bash $ bower install axios ``` -------------------------------- ### Install Node.js Types with npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@types/node/README.md Installs the necessary type definitions for Node.js using npm. This is a prerequisite for using packages that rely on Node.js environments and provides type safety for Node.js core modules. ```bash npm install --save @types/node ``` -------------------------------- ### React Native: Shim and Install js-stellar-sdk Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md Applies necessary shims and installs the js-stellar-sdk for React Native development. This includes adding an import for the shim file and installing the SDK itself. ```javascript // Add to the top of index.js import "./shim"; yarn add @stellar/stellar-sdk ``` -------------------------------- ### Install js-stellar-base with Bower (Browser) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/@stellar/stellar-base/README.md Shows the command to install the stellar-base library using Bower, a package manager for front-end projects, for browser usage. ```shell bower install stellar-base ``` -------------------------------- ### Creating an Axios Instance Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Learn how to create custom Axios instances with pre-defined configurations, allowing for more organized and reusable HTTP request setups. ```APIDOC ## Creating an Instance Axios allows you to create 'instances' of Axios with custom configurations. This is useful when you need to set a base URL or other defaults for a specific set of requests. ### Method `axios.create([config])` ### Parameters #### Request Config - **baseURL** (string) - The base URL to resolve an absolute URL. - **timeout** (number) - Allows to set a system level timeout for requests made from the instance. - **headers** (Object) - An object containing the default request headers. - ... (other request config options) ### Request Example ```javascript const instance = axios.create({ baseURL: 'https://api.example.com', timeout: 1000, headers: {'X-Custom-Header': 'foobar'} }); instance.get('/users/123') .then(function (response) { console.log(response.data); }) .catch(function (error) { console.log(error); }); ``` ### Response #### Success Response (200) - **data** (any) - The response data. - **status** (number) - The HTTP status code. - **headers** (Object) - The response headers. - **config** (Object) - The request configuration. - **request** - The request object. #### Response Example ```json { "data": { "id": 123, "name": "John Doe" }, "status": 200, "headers": { "content-type": "application/json" }, "config": { "url": "/users/123", "method": "get" }, "request": {} } ``` ``` -------------------------------- ### Install call-bind package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/call-bind/README.md This command installs the 'call-bind' package as a dependency for your project. ```sh npm install --save call-bind ``` -------------------------------- ### Install sodium-native Package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/sodium-native/README.md Installs the sodium-native Node.js package using npm. This package provides low-level bindings for the libsodium cryptographic library. ```bash npm install sodium-native ``` -------------------------------- ### POST Request Example Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/axios/README.md Shows how to perform a POST request with a request body. ```APIDOC Performing a `POST` request ```js axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); ``` ``` -------------------------------- ### Install mime-db Package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/mime-db/README.md This command installs the mime-db package using npm, making it available for use in your Node.js project. It's a direct dependency installation command. ```bash npm install mime-db ``` -------------------------------- ### Install base32.js using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/base32.js/README.md This command installs the base32.js library using npm, the Node Package Manager. It is a prerequisite for using the library in a Node.js environment. ```sh npm install base32.js ``` -------------------------------- ### Install is-reference package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/is-reference/README.md The standard command to install the 'is-reference' package using npm, the Node Package Manager. ```bash npm install is-reference ``` -------------------------------- ### Install proxy-from-env Package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/proxy-from-env/README.md This command installs the proxy-from-env package using npm, the Node.js package manager. This is a prerequisite for using the package in your project. ```sh npm install proxy-from-env ``` -------------------------------- ### Install path-parse with npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/path-parse/README.md This command installs the path-parse package as a dependency for your project using npm. ```bash npm install --save path-parse ``` -------------------------------- ### POST /upload Example Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/form-data/README.md Demonstrates how to use Node's http client to submit form data with automatic content-length header. ```APIDOC ## POST /upload ### Description Submits form data using Node's built-in http client. The `form.pipe(request)` method handles streaming the form data, and the `request.on('response', ...)` handles the response. ### Method POST ### Endpoint `http://example.org/upload` ### Parameters None explicitly defined for this example, form data is handled internally. ### Request Example ```javascript var http = require('http'); var request = http.request({ method: 'post', host: 'example.org', path: '/upload', headers: form.getHeaders() }); form.pipe(request); request.on('response', function (res) { console.log(res.statusCode); }); ``` ### Response #### Success Response (200) - **statusCode** (number) - The HTTP status code of the response. #### Response Example ```json 200 ``` ``` -------------------------------- ### String Formatting with format Option Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/picomatch/README.md Shows how to use the 'format' option in picomatch to preprocess strings before matching. This example demonstrates stripping leading './' from paths to ensure consistent matching. ```javascript const picomatch = require('picomatch'); // strip leading './' from strings const format = str => str.replace(/^\.\//, ''); const isMatch = picomatch('foo/*.js', { format }); console.log(isMatch('./foo/bar.js')); //=> true ``` -------------------------------- ### Install to-buffer package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/to-buffer/README.md This command installs the 'to-buffer' package using npm, the Node Package Manager. It is a prerequisite for using the package in your Node.js project. ```bash npm install to-buffer ``` -------------------------------- ### Generate and Serve Stellar SDK Documentation Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md Instructions for generating and viewing the documentation for the Stellar SDK. This involves cloning the base library, generating documentation files using `yarn docs`, and then serving them locally using the `serve` command. Ensure `serve` is installed globally (`npm i -g serve`). ```shell # install the `serve` command if you don't have it already npm i -g serve # clone the base library for complete docs git clone https://github.com/stellar/js-stellar-base # generate the docs files yarn docs # get these files working in a browser cd jsdoc && serve . # you'll be able to browse the docs at http://localhost:5000 ``` -------------------------------- ### Install call-bound package Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/call-bound/README.md This command installs the 'call-bound' package as a project dependency using npm. It is the initial step to start using the library in your JavaScript project. ```sh npm install --save call-bound ``` -------------------------------- ### Making POST Requests Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Example showing how to send data in the request body using a POST request. ```APIDOC ## Making POST Requests ```js axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); ``` ``` -------------------------------- ### Install TypeScript Next Version (npm) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/typescript/README.md Installs the latest nightly build of TypeScript as a development dependency using npm. This is useful for testing upcoming features or when working with the bleeding edge of the project. ```bash npm install -D typescript@next ``` -------------------------------- ### Generate and Serve Stellar SDK Documentation Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md This sequence of commands generates the documentation site for the Stellar SDK. It involves installing the `serve` command, cloning the Stellar base library for complete documentation, generating the docs files using `yarn docs`, and then serving the generated files locally for browser viewing. ```shell # install the `serve` command if you don't have it already npm i -g serve # clone the base library for complete docs git clone https://github.com/stellar/js-stellar-base # generate the docs files yarn docs # get these files working in a browser cd jsdoc && serve . # you'll be able to browse the docs at http://localhost:5000 ``` -------------------------------- ### Install estree-walker using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/estree-walker/README.md This command installs the estree-walker package as a project dependency using npm. It's a prerequisite for using the walker utility in your JavaScript project. ```bash npm i estree-walker ``` -------------------------------- ### axios(url[, config]) Method Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/axios/README.md Shows how to make a GET request using the shorthand `axios(url)` method. ```APIDOC ##### axios(url[, config]) ```js // Send a GET request (default method) axios('/user/12345'); ``` ``` -------------------------------- ### Install TypeScript Stable Version (npm) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/typescript/README.md Installs the latest stable version of TypeScript as a development dependency using npm. This command is typically used in a project's root directory. ```bash npm install -D typescript ``` -------------------------------- ### Get FormData Boundary String Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/form-data/README.md Provides an example of how to retrieve the boundary string used by FormData. This boundary is crucial for correctly formatting multipart/form-data requests. ```javascript console.log(form.getBoundary()); ``` -------------------------------- ### Picomatch Extglob Examples Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/picomatch/README.md Demonstrates the usage of picomatch's extended globbing patterns like *(pattern) and +(pattern). These patterns allow for more complex matching of zero or more, or one or more occurrences of a sub-pattern. It also shows examples of nested and negated extglobs. ```javascript const pm = require('picomatch'); // *(pattern) matches ZERO or more of "pattern" console.log(pm.isMatch('a', 'a*(z)')); // true console.log(pm.isMatch('az', 'a*(z)')); // true console.log(pm.isMatch('azzz', 'a*(z)')); // true // +(pattern) matches ONE or more of "pattern" console.log(pm.isMatch('a', 'a+(z)')); // false console.log(pm.isMatch('az', 'a+(z)')); // true console.log(pm.isMatch('azzz', 'a+(z)')); // true // supports multiple extglobs console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false // supports nested extglobs console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true ``` -------------------------------- ### Usage Example for gopd Javascript Module Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/gopd/README.md Demonstrates how to require and use the gopd module to get property descriptors. It checks if descriptors are supported and uses gopd accordingly. This snippet requires the 'gopd' and 'assert' modules. ```javascript var gOPD = require('gopd'); var assert = require('assert'); if (gOPD) { assert.equal(typeof gOPD, 'function', 'descriptors supported'); // use gOPD like Object.getOwnPropertyDescriptor here } else { assert.ok(!gOPD, 'descriptors not supported'); } ``` -------------------------------- ### Get and Use JavaScript Intrinsics with get-intrinsic Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/get-intrinsic/README.md This example demonstrates how to use the 'get-intrinsic' package to retrieve JavaScript intrinsics, such as Math.pow and Array.prototype.push. It shows how to use these intrinsics directly and how the package handles cases where intrinsics might be deleted or missing, providing fallback mechanisms. ```javascript var GetIntrinsic = require('get-intrinsic'); var assert = require('assert'); // static methods assert.equal(GetIntrinsic('%Math.pow%'), Math.pow); assert.equal(Math.pow(2, 3), 8); assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); delete Math.pow; assert.equal(GetIntrinsic('%Math.pow%')(2, 3), 8); // instance methods var arr = [1]; assert.equal(GetIntrinsic('%Array.prototype.push%'), Array.prototype.push); assert.deepEqual(arr, [1]); arr.push(2); assert.deepEqual(arr, [1, 2]); GetIntrinsic('%Array.prototype.push%').call(arr, 3); assert.deepEqual(arr, [1, 2, 3]); delete Array.prototype.push; GetIntrinsic('%Array.prototype.push%').call(arr, 4); assert.deepEqual(arr, [1, 2, 3, 4]); // missing features delete JSON.parse; // to simulate a real intrinsic that is missing in the environment assert.throws(() => GetIntrinsic('%JSON.parse%')); assert.equal(undefined, GetIntrinsic('%JSON.parse%', true)); ``` -------------------------------- ### Install delayed-stream with npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/delayed-stream/Readme.md This command installs the delayed-stream package using npm. It's the first step to using the library in a Node.js project. ```bash npm install delayed-stream ``` -------------------------------- ### JavaScript - Create a 'once' callback wrapper Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/wrappy/README.md This snippet demonstrates how to use the 'wrappy' utility to create a function that ensures a callback is executed only a single time. It shows the setup of the wrapper and an example of its usage, including how it retains properties from the original function. ```javascript var wrappy = require("wrappy") // make sure a cb is called only once // See also: http://npm.im/once for this specific use case var once = wrappy(function (cb) { var called = false return function () { if (called) return called = true return cb.apply(this, arguments) } }) function printBoo () { console.log('boo') } // has some rando property printBoo.iAmBooPrinter = true var onlyPrintOnce = once(printBoo) onlyPrintOnce() // prints 'boo' onlyPrintOnce() // does nothing // random property is retained! assert.equal(onlyPrintOnce.iAmBooPrinter, true) ``` -------------------------------- ### Install @jridgewell/sourcemap-codec using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@jridgewell/sourcemap-codec/README.md This command installs the `@jridgewell/sourcemap-codec` package using npm (Node Package Manager). This package is a dependency for using the encode and decode functionalities for sourcemap mappings. It is typically run in a terminal or command prompt within the project directory. ```bash npm install @jridgewell/sourcemap-codec ``` -------------------------------- ### Bash Installation Command Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/brace-expansion/README.md Provides the command to install the 'brace-expansion' module using npm, the Node Package Manager. This is a prerequisite for using the module in a JavaScript project. ```bash npm install brace-expansion ``` -------------------------------- ### Creating an Instance Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/axios/README.md Explains how to create a custom instance of axios with specific configurations. ```APIDOC ### Creating an instance You can create a new instance of axios with a custom config. ##### axios.create([config]) ```js const instance = axios.create({ baseURL: 'https://some-domain.com/api/', timeout: 1000, headers: {'X-Custom-Header': 'foobar'} }); ``` ``` -------------------------------- ### Install Node.js 18 with NVM Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md Instructions for installing Node.js version 18 using Node Version Manager (nvm). Developing on Node 18 is recommended to ensure compatibility with the project's CI environment. It also includes instructions to reinstall `yarn` globally after changing Node versions. ```shell nvm install 18 # if you've never installed 18 before you'll want to re-install yarn npm install -g yarn ``` -------------------------------- ### Install ieee754 using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/ieee754/README.md This command installs the ieee754 package using npm, the Node Package Manager. This makes the library available for use in your Node.js project. ```bash npm install ieee754 ``` -------------------------------- ### Get range of balanced string pairs with balanced-match Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/balanced-match/README.md This snippet shows how to use the `balanced.range` function to find the indices of the first non-nested matching pair of delimiters in a string. It returns an array containing the start and end indices of the match. This is useful when only the positions of the delimiters are needed. ```javascript var balanced = require('balanced-match'); console.log(balanced.range('{', '}', 'pre{in{nested}}post')); console.log(balanced.range('{', '}', 'pre{first}between{second}post')); console.log(balanced.range(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); ``` -------------------------------- ### Install balanced-match using npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/balanced-match/README.md This command installs the balanced-match package using npm, the Node Package Manager. It is the standard way to add this library as a dependency to your Node.js project. ```bash npm install balanced-match ``` -------------------------------- ### Install EventSource via npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/eventsource/README.md This command installs the EventSource library using npm, the Node Package Manager. It is a prerequisite for using the library in a Node.js project or for building browser polyfills. ```bash npm install eventsource ``` -------------------------------- ### Install resolve with npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/resolve/readme.markdown This is a command-line instruction to install the 'resolve' package using npm, the Node Package Manager. It's a prerequisite for using the resolve.sync functionality. ```sh npm install resolve ``` -------------------------------- ### Configure React Native for js-stellar-sdk Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md Provides a step-by-step guide to configure a React Native project for using the js-stellar-sdk. This involves installing development dependencies, adding polyfills, linking native modules, and configuring the metro bundler. It highlights that `Buffer` and `Uint8Array` support is crucial, primarily available in V8 (Android) and JSC (iOS) environments. ```shell yarn add --dev rn-nodeify yarn rn-nodeify --install url,events,https,http,util,stream,crypto,vm,buffer --hack --yarn # Uncomment require('crypto') on shim.js react-native link react-native-randombytes ``` -------------------------------- ### Install Node.js 18 with NVM Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md This section provides instructions on installing Node.js version 18 using Node Version Manager (NVM). Developing with Node 18 is recommended to ensure compatibility with the project's CI environment. It also includes instructions to re-install Yarn globally. ```shell nvm install 18 # if you've never installed 18 before you'll want to re-install yarn npm install -g yarn ``` -------------------------------- ### Concurrent Requests Example Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/axios/README.md Illustrates how to make multiple concurrent requests using `Promise.all`. ```APIDOC Performing multiple concurrent requests ```js function getUserAccount() { return axios.get('/user/12345'); } function getUserPermissions() { return axios.get('/user/12345/permissions'); } Promise.all([getUserAccount(), getUserPermissions()]) .then(function (results) { const acct = results[0]; const perm = results[1]; }); ``` ``` -------------------------------- ### Install @rollup/plugin-commonjs Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@rollup/plugin-commonjs/README.md This command installs the @rollup/plugin-commonjs package as a development dependency using npm. Ensure you have Node.js LTS or higher and Rollup v2.68.0+ installed. ```bash npm install @rollup/plugin-commonjs --save-dev ``` -------------------------------- ### Example of a custom preferBuiltins function Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@rollup/plugin-node-resolve/README.md Demonstrates how to use a function for the `preferBuiltins` option to selectively determine whether to prefer built-in modules. This specific example excludes `punycode` from being treated as a built-in. ```javascript preferBuiltins: (module) => module !== 'punycode'; ``` -------------------------------- ### Install @rollup/plugin-typescript via npm Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@rollup/plugin-typescript/README.md Installs the @rollup/plugin-typescript package as a development dependency using npm. Note that 'typescript' and 'tslib' are peer dependencies and must be installed separately. ```console npm install @rollup/plugin-typescript --save-dev ``` -------------------------------- ### Build Next.js Demo App for Production Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/CLAUDE.md Builds the Next.js demo application for production deployment. This optimizes the application for performance and smaller bundle sizes. ```bash cd demo-app npm run build ``` -------------------------------- ### Clone Stellar SDK Repository Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/@stellar/stellar-sdk/README.md Command to clone the Stellar Account Abstraction SDK repository from GitHub. This is the first step in setting up the development environment for contributing to the library. It requires `git` to be installed. ```shell git clone https://github.com/stellar/js-stellar-sdk.git ``` -------------------------------- ### Define Property Polyfill Example (JavaScript) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/es-define-property/README.md This example demonstrates how to use the 'es-define-property' package. It checks if the polyfill is available and asserts its equality with the native 'Object.defineProperty' or confirms it's a fallback for older engines (IE 8, ES3). ```javascript const assert = require('assert'); const $defineProperty = require('es-define-property'); if ($defineProperty) { assert.equal($defineProperty, Object.defineProperty); } else if (Object.defineProperty) { assert.equal($defineProperty, false, 'this is IE 8'); } else { assert.equal($defineProperty, false, 'this is an ES3 engine'); } ``` -------------------------------- ### Install js-stellar-base using Yarn (Node.js) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/@stellar/stellar-base/README.md This command installs the js-stellar-base library as a dependency for a Node.js project using Yarn. It's the recommended way to add the library to your project for module usage. ```shell yarn add @stellar/stellar-base ``` -------------------------------- ### Install NPM Modules for Development Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/stellar-social-sdk/node_modules/tweetnacl/README.md This command installs all the necessary Node Package Manager (NPM) modules required for developing and testing the TweetNaCl.js library. Ensure you have Node.js and npm installed before running this command. ```bash $ npm install ``` -------------------------------- ### Axios POST Request Example (JavaScript) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Illustrates how to send data to a server using a POST request with Axios. This example sends a JSON object containing user information. The response from the server is logged to the console, and errors are caught and logged. ```javascript axios.post('/user', { firstName: 'Fred', lastName: 'Flintstone' }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }); ``` -------------------------------- ### Picomatch POSIX Usage without Node.js Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/picomatch/README.md Shows how to use picomatch in environments without Node.js by importing from 'picomatch/posix'. This provides a dependency-free POSIX-compliant matcher. It also demonstrates configuring the matcher for Windows paths. ```javascript const picomatch = require('picomatch/posix'); // the same API, defaulting to posix paths const isMatch = picomatch('a/*'); console.log(isMatch('a\b')); //=> false console.log(isMatch('a/b')); //=> true // you can still configure the matcher function to accept windows paths const isMatch = picomatch('a/*', { options: windows }); console.log(isMatch('a\b')); //=> true console.log(isMatch('a/b')); //=> true ``` -------------------------------- ### Creating an Instance Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Explains how to create a custom Axios instance with predefined configurations like baseURL and timeout. ```APIDOC ## Creating an Instance You can create a new instance of Axios with a custom configuration. ##### `axios.create([config])` ```js const instance = axios.create({ baseURL: 'https://some-domain.com/api/', timeout: 1000, headers: {'X-Custom-Header': 'foobar'} }); ``` Instance methods work similarly to global Axios methods, but they use the instance's configuration. ##### Instance methods - `axios#request(config)` - `axios#get(url[, config])` - `axios#delete(url[, config])` - `axios#head(url[, config])` - `axios#options(url[, config])` - `axios#post(url[, data[, config]])` - `axios#put(url[, data[, config]])` - `axios#patch(url[, data[, config]])` - `axios#getUri([config])` The specified config for instance methods will be merged with the instance's default config. ``` -------------------------------- ### Axios GET Request with URL Only (JavaScript) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/axios/README.md Shows the simplest way to make a GET request using Axios, where only the URL is provided. Axios defaults the HTTP method to GET if not specified. This is a common shorthand for basic data retrieval. ```javascript // Send a GET request (default method) axios('/user/12345'); ``` -------------------------------- ### fs.realpath Usage Examples (Node.js) Source: https://github.com/hoblayerta/stellar-account-abstraction-sdk/blob/main/demo-app/stellar-social-sdk/node_modules/fs.realpath/README.md Demonstrates how to use the fs.realpath module for both asynchronous and synchronous path resolution. It also shows how to apply and revert monkeypatching for fs.realpath and fs.realpathSync. ```javascript var rp = require('fs.realpath') // async version rp.realpath(someLongAndLoopingPath, function (er, real) { // the ELOOP was handled, but it was a bit slower }) // sync version var real = rp.realpathSync(someLongAndLoopingPath) // monkeypatch at your own risk! // This replaces the fs.realpath/fs.realpathSync builtins rp.monkeypatch() // un-do the monkeypatching rp.unmonkeypatch() ```