Skip to main content

Release Note

SDK library#

3.9.0 (2022-06-10)#

New Feature#

feat: getImageInfo support relative path feat: add wallet-connector plugin feat: redesign timeline feat: startlocationupdate type feat: image-info plugin feat: add plugin user-info & migrate getUserProfile to action get-user-info-profile feat: expose esmoudle of plugin submodule with .mjs

Bug Fix#

  • fix: mp canvastouche event payload
  • fix: setData in onLoad not working
  • fix: timeline check app
  • fix: empty subpackages force download action
  • fix: mg add devicePixelRatio into getSystemInfo api

Misc#

cli#
  • feat(cli): update deprecated input props
  • fix(cli): update vendors to support node 16
  • feat(cli): support externals lib
  • feat(cli): upgrade tarojs to 3.4.4
  • fix(cli): fix tarojs version can not found in yarn global action
bundler#
  • feat(bundler) : bxml support relative path
  • fix(bundler): common.bxss is imported twice & release factory after jsModule is required
  • fix(bundler): add globalThis polyfill to page-frame
  • feat(bundler): empty app.js for drop compatibility & fix independent subpackage issue

Migrating from 3.8.0 to 3.9.0#

Use new features with:#
  • To use the new SDK v3.9.0, please re-upload MiniProgram with new IDE v2.16.0.
  • CLI v2.4.0 $ npm install -g @binance/mp-cli

3.8.0 (2022-05-20)#

New Feature#

  • feat: framework-storage plugin
  • feat: try catch error in App lifecycle
  • feat: canIUse plugin
  • feat: add Button open-type attribute openSetting
  • feat: add wallet-connector plugin
  • feat: add API isLoggedIn & add custom plugin ensure-logged-in

Bug Fix#

  • fix: remove global wx, fix getOpenDataContext placeholder
  • fix: increase gas limit when estimate gas failed
  • fix: Web3Provider plugin add Math.ceil when populate gas
  • fix: mini game support cocos
  • fix: webview not working for the website using node-bridge
  • fix: add dataset to MPEventTarget
  • fix: sentry + vconsole cause oom
  • fix: fix Android need to tap input twice to focus
  • fix: fix request cookie setting
  • fix: fix reportEvent with keyword to error

Misc#

cli#
  • fix(cli): debugReact with react-reconciler not works
  • fix(cli): resolve taro presets from installation dir of bmp
  • fix(cli): support node 15
  • feat(cli): add button open-type getUserProfile & getEmailAddress
bundler#
  • feat(bundler): move page logic to page.worker.js
  • fix(bundler): adjust the order of loading script in page-frame
  • fix(bundler): load base.bxml.js earlier than renderer-service.js
  • fix(bundler): load base.bxml.js in head element of page-frame

Migrating from 3.7.0 to 3.8.0#

Use new features with:#
  • To use the new SDK v3.8.0, please re-upload MiniProgram with new IDE v2.15.0.
  • CLI v2.3.5 $ npm install -g @binance/mp-cli

3.7.0 (2022-04-21)#

New Feature#

  • feat: timeLogger-startup add appLoad
  • feat: native-rpc-logger support event
  • feat: support confirm event for web input
  • feat: support tab bar red dot api
  • feat: support mode props for Image component
  • feat: add direction RTL support for native components include native-input

Bug Fix#

  • fix: Image and CoverImage onload & onerror
  • fix: plugin create native buffer
  • fix: fix deprecated-input onInput not working
  • fix: fix View component touchstart twice
  • fix: remove the error of webview-sdk Unknown Action $ready
  • fix: onAppShow not working
  • fix: create a empty webview if src not provided
  • fix: remove header field with null value
  • fix: fix native input color with autoFocus props
  • fix: fix reportEvent with keyword to error
  • fix: fix the issue that slider wrap with position: relative container
  • fix: DeprecatedInput auto-fill not emit input event

Perf#

  • perf(bundler): extract base.bxml to reduce bundle size

Misc#

  • feat: add system log label
  • feat(cli & bundler): provide source-map in prod mode
    • $ bmp build --source-map
  • feat(cli): add support autocomplete feature for DeprecatedInput
  • fix: add defer for webview context in the node-bridge demo

IDE#

  • fix: fix request cookie setting on IDE
  • fix: storage plugin api not work on IDE

Migrating from 3.6.0 to 3.7.0#

Use new features with:#
  • To use the new SDK v3.7.0, please re-upload MiniProgram with new IDE v2.14.1.
  • CLI v2.2.3 $ npm install -g @binance/mp-cli

3.6.0(2022-03-31)#

New Feature#

  • feat: rpc-logger add app-rpc logger (#235)
  • feat: add built-in-plugin current-ui-event (#229)
  • feat: put remote debug runtime into sdk (#218)
  • feat: error startup add more info (#208)
  • feat: add API wallethub-open-wallet to web3 plugin & fix: cache emitThemeChange payload (#207)
  • feat: share-menu,show-dialog plugin (#206)
  • feat: buffer-url, background-fetch plugin (#201)
  • feat: add mp wallet backup action
  • feat: plugin-hide home button api
  • feat(component): add back DeprecatedInput component (#180)

Bug Fix#

  • fix: remove modal when applyUpdate
  • fix: polyfill IntersectionObserver for iOS 12.1 (#234)
  • fix: fix websocket, add more test (#226)
  • fix: add share-menu, show-dialog to preset (#225)
  • fix: move get-selected-text-range to keyboard (#223)
  • fix: prevent unpredictable native input focus on Android (#200)
  • fix(extraData): JS SDK need to decode extraData then JSON.parse it

Misc#

  • refactor: add network plugin (#222)
  • chore: update lerna scripts & add new @mp/sdk package (#210)
  • chore: update building script with tsc and move runtime-api to runtime-worker-common (#203)
  • refactor: add sensor prefix (#202)

3.5.0 (2022-03-10)#

New Feature#

  • feat(dwallet): add isUnlocked method
  • feat(dwallet): add WalletHub
  • feat: webauthn
  • feat: getLocation, openLocation, chooseLocation
  • feat: show-error-page
  • feat: memory-warning
  • feat: bn.call
  • feat: setData performance monitor
  • feat: add bn.canIUseCustom api

Bug Fix#

  • fix(update-manager): subscribe the update event earlier
  • fix(mp): global env is deprecated, please use bn.env instead.
  • fix(mp): error _code is deprecated, please use code instead.
  • fix: cls-lcp-fid extr
  • fix: fix blank page timer
  • fix: request option
  • fix: runtimelogger page error

Misc#

  • fix: runtimelogger update
  • fix: logger error type
  • fix: request promise
  • fix: add webview-context to preset
  • fix request success twice

Migrating from 3.3.0 to 3.5.0#

Use new features with:#
  • To use the new feature of SDK v3.5.0, please update IDE to v2.12.0
  • CLI v2.1.4 $ npm install -g @binance/mp-cli
  • Use new ts types ^2.0.2 $ npm install @binance/mp-service @binance/mp-components --dev

3.4.0 (2022-02-17)#

New Feature#

  • feat: uploadFile,request, websocket, downloadFile, inner-audio refactor task-on-demand.

  • feat: getUserProfile, selectorQuery refactor plugin

  • feat: check deploy script

  • feat(mini-game): add bn.setPreferredFramesPerSecond and bn.getTextLineHeight api

  • feat(mini-game): add load-font plugin

  • feat(mp/runtime-sdk): add deviceInfo & scale to SystemService

  • feat(mp/runtime-sdk): handle theme change

  • feat(mp/runtime-sdk): support webview ui

  • feat(mp/runtime-sdk): hooks api

Bug Fix#

  • fix: reportEvent update
  • fix: timelogger timeline Split is smaller as like 'sdk/app/page'
  • fix: fix pull down refresh
  • fix: progress and file upload of bn network
  • fix: show vconsole panel correctly.

Misc#

  • MPRunTimeLogger add RuntimeNodeLog

3.3.0 (2022-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)    }  },})