2,534
questions
-1
votes
0
answers
27
views
How to implement raydium swap from poolkeys? [closed]
import {
Liquidity,
LIQUIDITY_STATE_LAYOUT_V4,
MARKET_STATE_LAYOUT_V3,
SPL_MINT_LAYOUT,
Market,
jsonInfo2PoolKeys,
buildSimpleTransaction
} from '@raydium-io/raydium-sdk';
...
-1
votes
1
answer
38
views
How to calculate estimate gas fee using wagmi for the swap
I need to calculate estimate gas fee for the swap function using wagmi
import { useEstimateGas } from 'wagmi'
import { parseEther } from 'viem'
import { config } from './config'
function App() {
...
-1
votes
0
answers
34
views
How to change the order of elements in an array using simple loops?
I am doing some self studying and I am having trouble answering the following question:
Write a script that uses the uniform function from the random module to generate an array of 6 random numbers ...
2
votes
1
answer
78
views
Are the Swappable Requirements and the Type Trait std::is_swappable<> equivalent in C++17?
#include <type_traits>
struct E {
int x;
E( ) = default;
E(E&&) = delete;
E& operator=(E&&) = delete;
};
void swap(E& a, E& b) { /* Does NOT ...
0
votes
0
answers
62
views
SOFR swap NPV and cashflow different from BBG results using Python Quantlib
I'm using python quantlib to price a swap, but the NPV and cashflow result differently from BBG results as all the input controls the same, fixed schedule should be the same but floating cashflow is ...
2
votes
1
answer
70
views
QuantLib Vanilla Swap Pricing with Python - Error
I have the project to build my own Vanilla Swap Pricer using QuantLib. I would like to compute from market prices of ois swap for discounting, and Euribor 6M swap + FRA for projecting fixing.
To ...
-4
votes
1
answer
51
views
Why is swapping using function and swapping using assignment produce in different results?
This is the code for Quick sort in which i used assignment to swap the values.
def partion(arr,low,high):
partion_index=low
pivot=arr[partion_index]
while (low < high):
while low < ...
0
votes
0
answers
30
views
My number swap program doesn't seem to be working as intended [duplicate]
So, I am currently learning C and while trying to replicate the code in the manual I was given, I noticed the output is different from what is demonstrated in the manual.
The program is supposed to ...
1
vote
2
answers
120
views
How to sort an array by only being able to swap an element with another element two positions ahead (i+2)?
I have an array of integers that I need to sort. However, the only operation allowed is to swap an element at index i with the element at index i+2. This means traditional sorting algorithms like ...
0
votes
0
answers
22
views
How to complete a swap (order-exchange) in MedusaJs?
After your order is completed (payment is captured, order is fulfiled & shipped). You can create a swap. After creating a swap you receive an cart associated with the swap created that you have ...
0
votes
0
answers
93
views
Swap tokens on Uniswap v3 with Python code. Error - insufficient funds for gas * price + value
I try to use the following code to exchange tokens on the Uniswap V3 exchanger in the Arbitrum network.
from web3 import Account, Web3
from abi import UNISWAP_V3_ROUTER2_ABI, WETH9_ABI, MIN_ERC20_ABI
...
4
votes
1
answer
139
views
Optimizing a memswap function
In a code review for the following implementation of memswap():
void util_memswap(size_t psize,
void *restrict p1,
void *restrict p2)
{
unsigned char *a = p1;
...
0
votes
1
answer
220
views
Python Solana bot transaction issues
I’m attempting to create a solana bot that has limit order to buy $MAGA using raydium. However everytime i run the code, the transaction does not go through.
<!-- begin snippet: js hide: false ...
1
vote
2
answers
8k
views
Unexpected behaviour while swapping strings in C
I am a beginner to programming and today I was trying to swap two strings with somewhat of a raw , brute force logic . But I stumbled upon this behaviour :
My code :
#include <stdio.h>
#include ...
0
votes
0
answers
67
views
Problem to deal with some ERC20 Tokens on Polygon-PoS (USDC, USDT) using Web3.py + Uniswap V3
gm. This is my first post here, i will do my best to be specific.
I started to work and build some python scripts to automate some operations on Polygon-PoS network.
I have the following working:(each ...
1
vote
2
answers
1k
views
Insufficient funds error during Solana transaction via Jupiter API despite adequate balance
I'm encountering a persistent "Insufficient funds" error when trying to execute a swap using the Jupiter API on the Solana blockchain, even though I have confirmed that the wallet has an ...
0
votes
0
answers
111
views
Current prices of tokens to be exchanged with Pancakeswap
I get the list of pools with Pancakeswap Exchange V3 Subgraph API, but the price information in the pool information does not match the price on the site. Also, as the amount increases, the price on ...
0
votes
0
answers
70
views
Swap function in queue and stack: Does it copy each element or swap the addresses? C++
I have been studying on queues and stacks and as an exercise I'm trying to implement them by using the other one (stack with queue and queue with stack). It is possible to do it by using 1 queue or 1 ...
0
votes
0
answers
27
views
Face Swapping Project related query
so I am working on a project in which a user takes a cola bottle scans a QR code in it clicks or uploads his/her image, and gets an output image in which he is posing with that cola bottle with a ...
0
votes
3
answers
124
views
using for loops to swap digits
using a for loop i have to write code to swap the 2nd and 3rd digit of a number given via user input in javascript.
for ( i = 0; i < entNum.length; i++) {
if (i === 0) num2 = entNum[i];
...
0
votes
4
answers
56
views
How do I switch a numeric value in a column in a pandas dataframe with the value in another column?
Posting a solution to a problem that I didn't see on Stack Overflow. I have two columns in a pandas datframe. One has numeric values that need to be switched with the values in another column.
...
1
vote
1
answer
613
views
How to swap in base chain (Eth Layer2)
Hello Stack Overflow Community,
I am working on swapping tokens in a base layer2 network using Uniswap V3 and ethers.js. I have successfully approved the transaction using the approve function, but ...
0
votes
1
answer
61
views
Swap method results in disappearing points in Manim scene
I am trying to make an animation where n points are equally distributed around a circle and an animation displays the permutations of those points by swapping their positions simultaeneously .
My ...
0
votes
1
answer
31
views
need an function swap for swaping elements
function swap(ev, targetId) {
//Working on a school project and got stuck, was trying to swap .gif like drag and drop
const currentId = ev.dataTransfer.getData("text");
const current = document....
1
vote
1
answer
120
views
Can I swap with 1inch swap apis with forked hardhart?
I have used hardhat to fork mainnet and imported the account in metamask. When I swap with that account on uniswap it works perfectly fine. But when I use 1inch swap api it connects with my mainnet ...
0
votes
0
answers
145
views
Increase swap memory in Rancher or Podman with Mac Apple Sillicon
Recently, due to company policies, I was asked to stop using Docker, so my alternative was Podman or Rancher.
Currently I am trying to use Rancher, but when building an image from a DockerFile there ...
0
votes
1
answer
62
views
Switching values of columns by condition
I would like to rearrange the positions of certain cells in my Excel spreadsheet using R. There are two columns, place_x and place_y, where the coordinates are not correct. I intend to swap some ...
0
votes
1
answer
51
views
Why my print statement inside the swap function is giving such output?
#include <stdio.h>
void swap(int* x, int* y){
int temp;
temp = *x;
*x = *y;
*y = temp;
printf("The value of x and y inside the function is x = %d and y = %d", x, y);...
1
vote
1
answer
77
views
Are rvalue references Cpp17MoveConstructible?
Do rvalue references satisfy the Cpp17MoveConstructible requirement?
For this to be the case, in the expression T u = rv;, u would need to be "equivalent" to rv. If T was an rvalue reference ...
0
votes
1
answer
67
views
logic fault with reversing the order of vector elements using std::swap
i have an exercise on chapter 8 of programming principles and practice by Strostrup ,it asks to write function that uses std::swap to reverse the elements of vector<int> here's my code
void ...
0
votes
0
answers
28
views
Label are not scrolled and swap with table and their respectieve rows
cell_icons = {}
image_references = {}
def on_release(event, label, image_path):
if label in dragged_icons:
x, y = event.x_root, event.y_root
x -= table.winfo_rootx()
y -= table....
0
votes
1
answer
2k
views
How to swap Solana on devnet?
I'm trying to make a swap WSOL-USDC, and I used this doc:
https://github.com/raydium-io/raydium-sdk-V1-demo/blob/master/src/swapOnlyAmm.ts#L51
In mainnet ✅ everything works fine
In devnet ❌ I get ...
0
votes
1
answer
988
views
Solana: How to fix an invalid public key problem?
I need your help because I've been stuck on this for several days.
I'm trying to do a super simple swap on Solana. Between Sol and USDC on devnet with Raydium.
const { Connection, Keypair, PublicKey } ...
0
votes
0
answers
13
views
Random Image Swapping using Javascript not working
The images in the /images folder are not swapping randomly with the ones located in the /swap-images folder. Both sets of images have the same name.
I am expecting the images to swap randomly in a ...
0
votes
0
answers
1k
views
How can swap through Raydium using Python
Please, I need help.
How can swap through Raydium using Python?
If I have, for example:
Token Address = '8wXtPeU6557ETkp9WHFY1n1EcU6NxDvbAggHGsMYiHsB' # I want buy
Wallet Key = '...
3
votes
1
answer
4k
views
How to Swap Solana Tokens on Raydium DEX?
I'm trying to code a simple code to swap solana tokens that are on the Raydium Defi.
But I have a PublicKey problem. I don't understand what's wrong with my code.
I really want to make a very simple ...
0
votes
0
answers
52
views
Identify objects for drag and drop swapping
I am working on a project where cameras can be dragged and dropped onto targets, which are basically grids of dropzones. When a camera is dragged onto a dropzone, it should swap with the current ...
1
vote
1
answer
49
views
swap group of characters every words in list
I have a list like :
s=['eb736d0020000000073a...002300001f', '00bd860020000020efad...002300003f', '1452770020000040ef53...002300005f', 'fbeadb002000006006ac...002300007f', 'ec38b600200000801441......
21
votes
3
answers
2k
views
Why does std::swap<std::array<int,3>> not compile?
I would like to swap two arrays of ints of some fixed size.
Counterintuitively, the following does not compile because no matching instance of swap has been found.
#include <array>
#include <...
0
votes
0
answers
110
views
Android not totaly use swap memory - MemTotal is not increase when I adding swap
I have add a lot of swapmemory and disable the buid-in zram, on my Android phone.
It is ok, htop and swap info show the entire swap. I have put a script to do it at startup, and it work well.
The ...
-2
votes
2
answers
122
views
Swapping with for loop in Python don't work well
I have a list with unknown length and values. I want to swap only when I see 'G' after 'B' one time for each round.
for example:
I have a list ["B", "G", "G", "B&...
0
votes
1
answer
368
views
hx-swap-oob creates duplicate dom element?
I have this workflow:
new record is being inserted in database
using HTMX, the row inserted should show up in table (the whole table gets reRendered)
simuoultaneously with previous step, certain ...
1
vote
2
answers
57
views
Is NFT swap possible on two different chains?
I have done a bit of research on this, and I have found only the same chain NFT swap but I want to know the different chain swapping b/w two users, Please provide some links or guidance to achieve NFT ...
0
votes
0
answers
21
views
How to stop hiding v-drawer Vue.js
I have this code:
<v-navigation-drawer v-model="open" :style="{ 'width': '122px', 'background-color': '#16181A' }" width="122px"
:color="theme.currentTheme.drawer&...
0
votes
0
answers
67
views
Issue while swapping elements in Shopify swappable
Actually i have a table in which there are multiple tbody elements and i am swapping tbody with one another and their child inside like tr with one another and they are swapping.
Now what i want is ...
0
votes
0
answers
38
views
Linux mmap() MAP_PRIVATE allocation
On Linux 4.6 when a program code calls mmap(2) with MAP_PRIVATEflag, does the kernel keep track of the memory being allocated against a "system commit limit" -- should that memory be swapped ...
0
votes
0
answers
88
views
When memory returns to RAM after going to SWAP
In Red hat linux, if OS starts using the SWAP memory for some reason, when it will decide to use RAM again
-1
votes
2
answers
82
views
Swapping Keys and Values in a Dict in Python [duplicate]
I'm trying to swap the keys and values of my dict, and although I've searched online and found ways of doing it, I keep getting an error.
def dict_reverser(dict1, dict2):
for k, v in dict2.items():...
0
votes
1
answer
304
views
UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT Sunswap
`const { trx_amount, private_key } = request.body;
var tronWeb = new TronWeb({
fullHost: "https://api.trongrid.io",
headers: { "TRON-PRO-API-KEY": "...
0
votes
0
answers
81
views
Why my variables aren't swapping properly?
I was writing code for variable swap in in Motorola 68k Assembly Code. It was not working as intended. I was trying to debug but I simply cannot see where I messed up.
VALUE EQU $2000
PROG ...