Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@satoshipay/stellar-transfer
Advanced tools
Stellar Ecosystem Proposal 24 - "Anchor/Client interoperability" client SDK, allowing Stellar wallets to withdraw or deposit third-party fiat or crypto assets like USD, EURT, BTC, ETH, ...
That means that users can send EURT to the anchor, requesting a payout in fiat EUR to their SEPA account via bank transfer, for instance.
npm install @satoshipay/stellar-transfer
# or with yarn:
yarn add @satoshipay/stellar-transfer
import {
openTransferServer,
fetchTransferInfos,
TransferServer
} from "@satoshipay/stellar-transfer"
import { Networks } from "stellar-sdk"
const transferServer = await openTransferServer(
"www.anchorusd.com",
Networks.TESTNET,
{
// Optional
lang: "en",
wallet_name: "Demo wallet",
wallet_version: "1.2.3"
}
)
const transferInfos = await fetchTransferInfos(transferServer)
const { depositableAssets, withdrawableAssets } = transferInfos
console.log(
`Depositable assets: ${depositableAssets
.map(asset => asset.getCode())
.join(", ")}`
)
console.log(
`Withdrawable assets: ${withdrawableAssets
.map(asset => asset.getCode())
.join(", ")}`
)
import {
openTransferServer,
KYCResponseType,
TransferResultType,
TransferServer,
Withdrawal,
WithdrawalType
} from "@satoshipay/stellar-transfer"
import { Networks } from "stellar-sdk"
const transferServer = await openTransferServer(
"www.anchorusd.com",
Networks.TESTNET
)
const transferInfos = await fetchTransferInfos(transferServer)
const { withdrawableAssets } = transferInfos
const assetToWithdraw = withdrawableAssets.find(asset => asset.code === "USD")
const withdrawal = Withdrawal(transferServer, assetToWithdraw, {
// Optional if using interactive withdrawal (SEP-6 / SEP-24, not SEP-26)
type: WithdrawalType.bankAccount,
dest: "DE00 1234 5678 9012 3456 00",
dest_extra: "NOLADEXYZ"
})
const instructions = await withdrawal.interactive(
/*
* SEP-10 auth might be necessary or not, depending on anchor.
* Check `authentication_required` in info response.
*/
sep10AuthToken
)
if (instructions.type === TransferResultType.ok) {
// `instructions.data` contains the information where and how to send the tokens
// to conduct the withdrawal
} else if (
instructions.type === TransferResultType.kyc &&
instructions.subtype === KYCResponseType.interactive
) {
// Open interactive KYC page at `instructions.data.url`
// Use `instructions.data.id` to query the withdrawal transaction status
} else if (
instructions.type === TransferResultType.kyc &&
instructions.subtype === KYCResponseType.nonInteractive
) {
// SEP-12 data submission
} else if (
instructions.type === TransferResultType.kyc &&
instructions.subtype === KYCResponseType.status
) {
if (instructions.data.status === "pending") {
// KYC data is being reviewed – poll the withdrawal transaction status until it changes, then proceed
} else if (instructions.data.status === "denied") {
throw Error(
`KYC has failed. Get more details here: ${
instructions.data.more_info_url
}`
)
}
}
import {
fetchAssetTransferInfos,
fetchTransferServers,
TransferInfo
} from "@satoshipay/stellar-transfer"
import { Asset, Server } from "stellar-sdk"
const assets = [
new Asset("EURT", "GAP5LETOV6YIE62YAM56STDANPRDO7ZFDBGSNHJQIYGGKSMOZAHOOS2S"),
new Asset("USD", "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX")
]
const horizon = new Server("https://stellar-horizon.satoshipay.io/")
const assetTransferServers: Map<
Asset,
TransferServer | null
> = await fetchTransferServers(horizon, assets)
const assetTransferInfos: Map<
Asset,
AssetTransferInfo
> = await fetchAssetTransferInfos(assetTransferServers)
interface AssetTransferInfo {
deposit: TransferInfo["deposit"][""] // Deposit metadata for this asset
transferInfo: TransferInfo // Complete server metadata of this anchor
withdraw: TransferInfo["withdraw"][""] // Withdrawal metadata for this asset
}
We provide TypeScript type declarations for all responses of the /info
, /deposit
& /withdraw
endpoints. See src/responses.ts
.
GPL v3
FAQs
Stellar SEP-24 client implementation
The npm package @satoshipay/stellar-transfer receives a total of 8 weekly downloads. As such, @satoshipay/stellar-transfer popularity was classified as not popular.
We found that @satoshipay/stellar-transfer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.