Skip to main content

Release Note

SDK library#

Next release#

New Feature#

3.3.0 (2021-01-20)#

New Feature#

  • feat: remove confirm dialog for createAccount
  • feat: add set-keep-screen-on plugin
  • feat: use prefers-color-scheme

Now you can use css prefers-color-scheme media query in MP.

  • feat(mini-game): add canvas.tempFilePath(sync) and canvas.toDataURL api
  • feat(mini-game): add load-font plugin

Bug Fix#

  • fix native-input value diff by timestamps
  • fix input issue, delete context value when component unmount
  • fix input autoFocus

Now <Form> with <Input> should work normally

  • fix button style is not released on Android
  • fix parameter of touchcancel callback on canvas
  • fix key of render slot is missing
  • fix prevent load app.js twice
  • fix UpdateManager could handle the all written callback function
  • remove duplicated plugin fileSystemManager
  • remove duplicated API requests (related to i18n issue), please re-upload the MP via new IDE

Misc#

  • add MPRunTimeLogger, delete RuntimeLogger
  • fix Timelogger may lead to burst data stack

3.2.4 (2021-12-30)#

New Feature#

  • feat: add support getWeb3Provider docs
  • feat: support independent subPackages docs
  • feat: Input component now support alwaysEmbed and autoFill props

To use alwaysEmbed props, you need to re-upload MiniProgram with IDE^2.9.1

  • feat: sharing APIs support of mini-game
  • feat: support previewImage & saveImageToPhotosAlbum api docs

Bug Fix#

  • fix: download package only if subpackage have been enabled
  • fix disabled input not working issue
  • fix: requestAnimationFrame
  • fix: make native-input cursor controlled, fix cursor issue on Android
  • fix input css selector not working issue by changing bn-input-wrapper to input
- Before: css selector with "input" keyword not working. ex: .class input { color: red }- After: Now it should work.

Misc#

  • feat: add RuntimeLogger
  • CLI now support taro-vue

Migrating from 3.1.1 to 3.2.4#

Use new features with:#
  • To use the new independent subPackage feature of SDK v3.2.4, please re-upload MiniProgram with new IDE v2.9.1 with MSV^3.2.0.
  • CLI v2.1.3 $ npm install -g @binance/mp-cli

IDE v2.9.1 add MSV^3.2.0 which support independent subPackages feature.

3.1.0 (2021-12-09)#

New Feature#

  • feat: add support subPackages docs
  • feat: add support input textAlign style
  • feat: add app.json config validator

Bug Fix#

  • fix: CLI now support autoFocus props for Input component
  • fix: support rgb fillstyle for Canvas
  • fix: createImage api, now support src with local path and addEventListener
  • fix: getLaunchOptionsSync and getEnterOptionsSync for MiniGame

Migrating from 3.0.0 to 3.1.0#

Use new features with:#
  • To use the new subPackage feature of SDK v3.1.0, please re-upload MiniProgram with new IDE v2.8.0 with MSV^3.1.0.
  • CLI v2.0.4 $ npm install -g @binance/mp-cli
  • Use new ts types ^2.0.2 $ npm install @binance/mp-service @binance/mp-components --dev

IDE v2.8.0 add MSV^3.1.0 which support subPackages feature.

3.0.0 (2021-11-18)#

New Feature#

  • feat: add support Button component with props openType='share' and page lifecycle Page.onShareAppMessage
  • feat: add sensor api docs
  • feat: add cloud storage & showLeaderboardPanel api docs
  • feat: add support easingFunction props for Swiper component

Bug Fix#

  • fix: convert value of native input to string type
  • fix: clamp inner-audio value of volume and playbackRate
  • fix: getEnterOptionsSync now return correct options

Breaking Changes#

Image component#

Now default size of Image is width: 320px; height: 240px;

// Image Component size+ width: 320px;+ height: 240px;
Deprecated legacy code removed#
  • Component DeprecatedInput removed, please use Input component instead.
  • Component DeprecatedTextarea removed, please use Textarea component instead.
import {- DeprecatedInput,- DeprecatedTextarea,  Input,  Textarea,} from '@binance/mp-components'
  • API bn.getCurrentPages removed, please use global getCurrentPages function instead.
  • API bn.getApp removed, please use global getApp function instead.
  • API bn.getTabBar removed.
  • requestPayment: options.noncestr removed, please use options.nonceStr instead.
  • request: options.body removed, please use options.data instead.
  • request: options.headers removed, please use options.header instead.
  • connectSocket: options.headers removed, please use options.header instead.
  • SocketTask: callback payload of onOpen changed:
socketTask.onOpen({- headers,+ header} => {})

Migrating from 2.2.0 to 3.0.0#

Use new features with:#
  • To use the new SDK v3.0.0, please re-upload MiniProgram with new IDE v2.7.0.
  • CLI v2.0.2 $ npm install -g @binance/mp-cli
  • Use new ts types ^2.0.0 $ npm install @binance/mp-service @binance/mp-components --dev

IDE v2.7.0 drop support for MSV^2.0.0, you can only select MSV^3.0.0 on IDE v2.7.0.

2.2.0 (2021-10-28)#

New Feature#

  • feat: add onTabItemTap lifecycle
  • feat: add createBufferURL revokeBufferURL api docs
  • feat: getFileSystemManager and readFile api
  • feat: add new Swiper component
  • feat: add createInnerAudioContext api docs
  • feat: add new audio global setInnerAudioOption and interruption api docs
  • feat: support Image lazyLoad props

Migrating from 2.1.2 to 2.2.0#

Use new features with:#
  • IDE v2.6.0.
  • CLI v1.2.27 $ npm install -g @binance/mp-cli
  • Use new ts types $ npm install @binance/mp-service @binance/mp-components --dev

2.1.2 (2021-10-08)#

New Feature#

  • feat: add support for Form onSubmit onReset event & add onChange event for Switch component

Bug Fix#

  • fix: tap trigger twice issue
  • fix: theme doesn't change when system theme changed

Migrating from 2.1.1 to 2.1.2#

Use new features with:#
  • IDE v2.5.1
  • CLI v1.2.23 $ npm install -g @binance/mp-cli
  • Use new ts types $ npm install @binance/mp-service @binance/mp-components --dev

2.1.1 (2021-09-30)#

New Feature#

  • add vconsole support
  • add template slot support
  • add new initialRenderingCache=static page config docs
  • add new onReachBottom page lifecycle
  • add multiSelector mode for picker component docs
  • add new chooseImage api docs

Bug Fix#

  • fix: delay ui-performance-log
  • fix: timing of page.show
  • fix: icon style [default size is 23px now]
  • fix: referrerInfo.extraData not work

Others#

  • perf: on demand bundle in worker service

Migrating from 2.0.0 to 2.1.1#

Use new features with:#
  • IDE v2.5.0.
  • CLI v1.2.20 $ npm install -g @binance/mp-cli
  • Use new ts types $ npm install @binance/mp-service @binance/mp-components --dev
Add size props to Icon component if needed#
import { Icon } from '@binance/mp-components'
  <Icon+  size="1em" // default size is 23px now  >
Add bmp alias if needed#

With CLI v1.2.20 you will need to add alias, so that the module will be resolved correctly.

// bmp.config/index.jsconst path = require('path')
module.exports = {  alias: {    'i18next-browser-languagedetector': path.resolve('./path/to/adapter/index.js'),  },}

2.0.0 (2021-09-09)#

New Feature#

  • add mpService.showActionSheet
  • add mpService.onUnhandledRejection docs
  • add cover-view and cover-image components
  • support entryPagePath field
  • add mpService.relaunch docs
  • add NetworkStatus api docs
  • add keyframe animation API
  • add mpService.exitMiniProgram docs
  • add mpService.downloadFile docs
  • add mpService.uploadFile docs
  • add pageScrollTo and onPageScroll

Bug Fix#

  • fix: getStorageSync api
  • fix: request data, requestPayment param

Others#

  • fix: types-mp-service
  • feat: support rpx unit

Migrating from 1.3.0 to 2.0.0#

  • To use the new SDK v2.0.0, please re-upload MiniProgram with new IDE v2.4.0.
  • Install latest CLI v1.2.14 $ npm install -g @binance/mp-cli
  • Rename the .babelrc to babel.config.json
  • Make code of MiniProgram compatible:
mpService.request#

Parameter:

{  url,    body,    headers,    timeout,    method,    // added in SDK 2.0.0    // data: equals to body functionally    data,    // header: equals to headers functionally    header,    // dataType?: ‘json’ | ‘other’ , should parse response data to json    dataType}

Response:

// SDK 1.3.0{  ok,  json,  text,  status,  headers,  statusText,  url,  data,}
// SDK 2.0.0{  data,  statusCode,  header,}

Compatible code:

const response = await mpService.request({ url, data, header, headers, timeout, method, dataType })if (response.json) {  const json = await response.json()  const text = await response.text()  const ok = response.ok  const status = response.status  const headers = response.headers  const statusText = response.statusText} else {  // if parameter dataType is ‘json’ data is in json format, or data is text.  const data = response.data  const ok = statusCode === 200  const headers = response.header  const status = response.statusCode  const statusText = response.statusCode.toString()}
mpService.requestPayment#

Parameter

{  prepayId, // deprecated in SDK 2.0.0  // added in SDK 2.0.0  certSn,  nonceStr,  package: "prepay_id=....",  merchantId,  paySign, // compute rule  timeStamp}

Compatible code:

const result = await mpService.requestPayment({  prepayId,  certSn,  nonceStr,  package: `prepay_id=${prepayId}`,  merchantId,  paySign,  timeStamp,})
mpService.getStorageSync#

Behaviors:

mpService.setStorage({ key: 'key', data: 'value' })mpService.getStorageSync('key') // SDK 1.3.0 response: { data: "value" }mpService.getStorageSync('key') // SDK 2.0.0 response: "value"

Compatible code:

mpService.setStorage({ key: 'key', data: 'value' })const response = bn.getStorageSync('key') // response: "value" or { data: "value" }const data = response.data || response

SDK 1.3.0#

Release date: 2021-08-19

Changelogs:

  • New APIs:

    • on/off-show/hide/off-* api
    • navigateTo now return EventChannel
    • webview postMessage support
    • hideHomeButton
    • upgrade payment api
  • New Props:

    • ScrollView: add support fastDeceleration and enhanced props (iOS only)
  • Fixed issues

    • fix: placeholder not show when the input is controlled
    • fix: margin styling issue for input / textarea component
    • fix: tap not trigger when touchmove
  • Supported DevTools

    • IDE: 2.3.0
    • CLI: 1.2.2
  • Supported Binance app versions

    • iOS: 2.34.*
    • Android: 2.34.*

SDK 1.2.0#

Release date: 2021-07-29

Changelogs:

  • Synchronous Plugins

  • Plugins with suffix "Sync" can be called synchronously. Implemented synchronous plugins:

    • getStorageSync
    • setStorageSync
    • cleanStorageSync
    • getStorageInfoSync
    • removeStorageSync
    • getSystemInfoSync
  • Scene Value

    • The scene value is used to describe the user's path to the open the mini program. Now developers can get the scene value from onLaunch or onShow callback.
  • Fixed issues

    • fixed native Input related issues
    • ViewPort and SafeArea issue for custom navigation bar and tabbar
    • NavigationBar title issue for WebView Component
  • Supported DevTools

    • IDE: 2.2.0
    • CLI: 1.2.0
  • Supported Binance app versions

    • iOS: 2.33.*
    • Android: 2.33.*

Compatibility with Older Versions#

New Mini Program features are constantly being released, but are not supported for older versions of the Binance app. Therefore, the compatibility should be addressed when using these new features.

Developers can use the following methods to ensure compatibility with older versions:

1. Version Comparison#

Versions of the Binance app and Mini Program base library are expressed in the format of Major.Minor.Patch (major version number.minor version number.patch version number).

In the documentation, the minimum sdk library versions are specified for the features described in component, API, and other pages.

In a Mini Program, developers can call bn.getSystemInfo or bn.getSystemInfoSync to get the version of the sdk library run by the Mini Program. The version comparison method is used to run a lower version for compatibility purposes.

Note: Do not compare versions by directly comparing the strings.

See the sample code below:

import { gt } from 'semver'const version = bn.getSystemInfoSync().SDKVersion
if (gt(version, '1.2.0')) {  bn.getStorageSync('my-data')} else {  // If you want users to experience the Mini Program in the latest app, you can display a prompt like this:  bn.showModal({    title: 'Prompt',    content:      'Your cannot use this feature due to low Binance version. Please upgrade to the latest Binance version and try again.',  })}

2. bn.canIUse#

In addition to a direct judgment by the version number, you can also use bn.canIUse to determine if a feature can be used directly under the current base library version.

bn.showModal({  success: function (res) {    if (bn.canIUse('showModal')) {      console.log(res.cancel)    }  },})