@dashevo/wasm-dpp2 (英语)
Dash平台协议 v2 Web Assembly 内建.
脚本
yarn build- 运行统一的WASM 建筑和捆绑文物dist/yarn build:release- 与build但强制全部释放优化yarn test- 执行单元+浏览器(Karma)测试yarn lint- 涂入测试源
构建脚本遵从到 packages/scripts/build-wasm.sh 保持行为
与其他 WASM 软件包一致,例如 @dashevo/wasm-sdk。 。 。 .
文档编号
从协议版本14开始,新文件的ID承诺身份
(见本书, 数据模型 −
文件 – 文件编号生成因此,一个 Document 与
new Document({...}) 没有 identityContractNonce 携带一个 占位符
id: 早期版本中只衍生出肽,但已无法达成共识
接受这个建议.
Id在非ce已知的情况下成为了最终的,而约束它是为了 你们:
const document = new Document({ properties, documentTypeName, dataContractId, ownerId });
// Derives the id from the document's entropy and the nonce, writes it onto
// the transition and back onto `document`: document.id equals transition.base.id.
const transition = new DocumentCreateTransition({ document, identityContractNonce: nonce });
// To know the id before the transition exists (another document in the same
// batch references it):
document.setIdForCreation(nonce);
// or derive it without a Document:
const idBytes = Document.generateId(documentTypeName, ownerId, dataContractId, entropy, nonce);
// or build the document with its final id from the start:
const ready = new Document({ properties, documentTypeName, dataContractId, ownerId, identityContractNonce: nonce });
每一个都要选择 platformVersion (默认最新); 之前
协议版本 14 的引出忽略了非ce。 随你怎么说 Document
转让给 DocumentCreateTransition 替换:
过渡只能携带id共识重算. 同样的原因
new Document({...}) 拒绝明确 id 不同意一个 它的
identityContractNonce 来源。 没有应用需要重新执行散列.
检查合同更新情况
数据合同更新在违反更新规则时被拒绝:版本
现有文件类型的索引必须精确上升一个,
a 财产可以增加,但不可移走,这是新的所需财产
requiredSince,等等,每个关键词(见本书, 合同
关键词,则 更新 每个关键词行). DataContract.validateUpdate
运行那些规则 代码共识运行在更新过渡
(单位:千美元)DataContract::validate_update),所以应用程序,CI工作或审查工具可以
在支付过渡费用之前核对拟议合同,平台将
拒绝 :
const version = new PlatformVersion(14);
const current = DataContract.fromJSON(currentJson, true, version);
const proposed = DataContract.fromJSON(proposedJson, true, version);
const errors = current.validateUpdate(proposed, undefined, version);
// [] when the update is valid; otherwise ConsensusError objects, e.g.
// errors[0].code === 10217 when an index of an existing type changed
每个错误都是 ConsensusError 与 code 被拒绝的过渡达到
与《联合提交的材料》。 第二个论点是 BlockInfo 将更新
被执行,其中仅读取时间(附加符号)
预先编程的分发不得在其之前开始); undefined 使用该
设备时钟。 无论身份如何,将两份合同比作
平台将存储的合同与拟议合同进行比较。 构建
拟议的合同,如上所述,自过渡以来,经过充分验证
结构检查在那里运行。 没有状态读取,所以平台检查什么
顶端不包含:合同存在,该组
成员、以符号配置命名的身份和指定的主持人
提及其他合同和签字解决
和收费.
这个包裹是用箱子做的 validation 特性,该方法
需要帮助。 该系统还进行充分验证fromJSON(…, true, …), (中文(简体) ), fromObject, (中文(简体) ),
fromBytes, (中文(简体) ), new DataContract({ fullValidation: true }))运行文档
mata-schema, 和合同解析错误 回来作为共识错误与
密码. @dashevo/wasm-sdk 财务报告和审定财务报表 @dashevo/evo-sdk 构建这些绑定符,不用
为了保持体型 所以他们没有 validateUpdate。 。 。 .