
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
@celo/payments-sdk
Advanced tools
This is the main export that wallets will want to integrate with. It allows you to get the payment info and subsequently make the payment transaction.
Example run through of Charge usage
// The api url that the Charge instance will be communicating with.
const apiBase = 'merchantpayments.com/api';
// The id of the payment request used by the api. The api will need
// to create a payment object for the SDK to respond to. This will
// need to have the info in the PaymentInfo type and the referenceId
// will refer to this object.
const referenceId = '123abc';
// The 'ChainHandler' instance imported from the payments-sdk and initialized
// with a contract kit instance. This kit will represent the Payer in the process.
const chainHandler = new ContractKitTransactionHandler(kit);
// Whether or not a DEK should be used for authorizing on chain transactions.
const useAuthentication = true;
// How many times requests should be retried.
const retries = 4;
const charge = new Charge(
apiBase,
referenceId,
chainHandler,
useAuthentication,
retries
);
// The info regarding the payment matching the reference id coming
// from the api. See @celo/payment-types PaymentInfo.
// Includes the requiredPayerData field that must be used for the
// submit method. Also, includes payment meta data to show to the
// user.
const paymentInfo: PaymentInfo = await charge.getInfo()
// Examples
// How much
console.log(paymentInfo.action.amount);
// What token
console.log(paymentInfo.action.currency);
// The api might require some KYC data on the payer. This will
// be passed into the submit method.
const payerDataExample = {
phoneNumber: '12345678',
};
try {
// This is the method to submit the transaction on chain
await charge.submit(payerDataExample);
} catch(e) {
// If for some reason the transaction fails to submit the promise
// returned by submit will be rejected.
// The charge can be aborted to let the api know not to continue
// watching for the transaction. See @celo/payment-types AbortCodes
// for abort code options.
charge.abort(AbortCodes.INSUFFICIENT_FUNDS)
}
// Reaching here would mean the payment was successfully submitted
// on chain.
console.log("Payment submitted");
Wrappers to help the PaymentsSDK interact with the blockchain.
Used to wrap ContractKit to make a ChainHandler for the Charge class
A variety of helper methods to facilitate payments-sdk interactions
FAQs
TypeScript implementation of the Celo Payments Protocol
We found that @celo/payments-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 21 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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.