Releases: code-payments/code-sdk
v1.6.0 UX & Tips Relase
What's Changed
This release primarily adds the ability to tip Code Wallet users that have linked their X/Twitter account with a Code Wallet. The scannable codes are persistent and can be printed out on a physical card. They are not unique to each invoke.
Note: This release is part of a larger release and is still under internal testing/development on the mobile app and sequencer sides.
Tip Card Example
import code from 'https://js.getcode.com/v1';
// Note: the user must have a Code account and have their X account
// connected. The Code Wallet app will show an error message if the user
// does not have a connected X account.
const username = 'elonmusk';
const name = 'x'; // or 'twitter' (if you prefer)
const options = {
mode: 'tip',
platform: {
username,
name,
}
}
const { button } = code.elements.create('button', options);
button.mount('#button-container');
Page Flows
Additionally, this release adds the ability to create the Code Wallet card pages directly, without having to use a button. This allows you to create a custom button or interaction that takes the user directly to the card view.
To use this flow, simply replace:
const { button } = code.elements.create('button', options);
with this:
const { page } = code.elements.create('page', options);
Pull Requests
Full Changelog: v1.5.0...v1.6.0
v1.5.0 UX & Fees Feature Release
What's Changed
Simplified UI
This release overhauls the UI elements. In general, less text is used to reduce cognitive load.
More Packages
Additionally, many quality of life improvements were made by splitting up the larger packages into smaller ones. This should help improve the packages going forward, as well as make it easier for contributors to get started.
This release includes the following new packages:
- @code-sdk/currency
- @code-sdk/flags
- @code-sdk/intents
- @code-sdk/keys
- @code-sdk/kikcode
- @code-sdk/proxy
- @code-sdk/views
- @code-sdk/web
Note: the @code-sdk/library package has been deprecated.
Payment Fees
Beyond this, merchant fees have been added. This means you can now take a basis point cut from a payment. Simply add a fee
section.
For example,
import code from 'https://js.getcode.com/v1';
const { button } = code.elements.create('button', {
currency: 'usd',
destination: '...',
amount: 0.25,
fees: [
{
destination: `E8otxw1CVX9bfyddKu3ZB3BVLa4VVF9J7CTPdnUwT9jR`,
basisPoints: 1000, // take a 10% cut, 2.5 cents in this case
}
],
});
button.mount('#button-container');
Pull requests
Full Changelog: v0.1.4.3...v1.5.0
v1.4.3 Login Feature Release
What's Changed
- Added SDK login example by @zfedoran in #15
- Added login request feature by @zfedoran in #19
- Minor changes and version bump by @zfedoran in #20
- Fix code sequencer link in introduction.md by @dogafincan in #22
- Updated login flows based on new rpc and api changes by @zfedoran in #21
- Added webhook support back to the v2 client by @zfedoran in #25
Example Login Usage
For more information on the new login feature, view the payment with login or login examples:
Quickstart
Live preview: https://example-getcode.com/
import * as code from "@code-wallet/client";
import express from "express";
const app = express();
const verifier = Keypair.generate();
const domain = "example-getcode.com";
app.post('/create-intent', async (req, res) => {
const { clientSecret, id } = await code.loginIntents.create({
login: {
verifier: verifier.getPublicKey().toBase58(),
domain: hostname,
},
signers: [ verifier ],
});
res.send({ clientSecret });
})
...
const status = await code.getStatus({ intent });
const user = await code.getUserId({ intent, verifier });
Major changes to RPC client
This release unlocks nearly all API request over standard HTTP POST calls. The @code-wallet/client
library exports a new lower-level client so that Code SDK users can access almost everything the app has access to (except for bidi streams). Access to bidi streams can be had over Websockets or GRPC using the @code-wallet/rpc
library directly.
See example usage of the low level client here:
https://github.com/code-payments/code-sdk/blob/main/packages/client/test/client.test.ts#L12-L19
All RPC APIs can be found here:
https://github.com/code-payments/code-protobuf-api/tree/main
New Contributors
- @dogafincan made their first contribution in #22
Full Changelog: v1.2.0...v0.1.4.3
v1.2.0 Early/Preview Login Feature Release
What's Changed
- Updated RPC Services by @zfedoran in #13
- Feature: Request Login with Payment by @zfedoran in #14
- Added
DebugMobile
user agent for debugging mobile flows on desktop in 3aa1d89
Full Changelog: v1.1.2...v1.2.0
Release Files
https://raw.githubusercontent.com/code-wallet/code-sdk/public-http/v1/elements.6c6db02.js
v1.1.2 Library, Client, and Elements Release
Primarily a bug fix release.
What's Changed
- Updated docs
- Fix for
"Failed to execute 'fetch' on 'Window': Illegal invocation"
by @zfedoran in #3 - Change to
px
values to avoidrem
bug in issue-5 by @zfedoran in #5 - Fix for invalid addresses in issue-7 by @zfedoran in #7
- Fix for
"Unable to request Kin amount"
by @zfedoran in #10
Full Changelog: v1.1.0...v1.1.2
Release Files
v1.1.0 Elements Release
What's Changed
- Mobile and Desktop modals now report configuration issues to the user
- Added elements
on('error', ...)
handling for: amount limits, destination account, paid intents - WebSocket connection timeouts are now automatically handled with a fadeout from the modal state
- Updated durable nonce documentation
- Update idempotency.md by @geoffwhittington in #1
New Contributors
- @geoffwhittington made their first contribution in #1
Full Changelog: v1.0.0...v1.1.0