diff --git a/packages/transactions/tests/builder.test.ts b/packages/transactions/tests/builder.test.ts index a01dcb4fc..e9f342a3a 100644 --- a/packages/transactions/tests/builder.test.ts +++ b/packages/transactions/tests/builder.test.ts @@ -729,11 +729,12 @@ test('Make smart contract deploy (defaults to versioned smart contract, as of 2. expect(serialized).toBe(tx); }); -test('Make smart contract deploy with network string name (defaults to versioned smart contract, as of 2.1)', async () => { +test('Make smart contract deploy with network string name (versioned smart contracts exist, as of 2.1)', async () => { const transaction = await makeContractDeploy({ contractName: 'kv-store', codeBody: fs.readFileSync('./tests/contracts/kv-store.clar').toString(), senderKey: 'e494f188c2d35887531ba474c433b1e41fadd8eb824aca983447fd4bb8b277a801', + clarityVersion: ClarityVersion.Clarity2, fee: 0, nonce: 0, network: 'testnet', @@ -742,12 +743,36 @@ test('Make smart contract deploy with network string name (defaults to versioned const serialized = transaction.serialize(); + expect(serialized[233]).toBe('2'); + const tx = '80800000000400e6c05355e0c990ffad19a5e9bda394a9c50034290000000000000000000000000000000000009172c9841e763c32e827c177491f5228956e6ef1071043be898bfdd694bf3e680309b0666e8fec013a8a453573a8bd707152c9f21aa6f2d5e57c407af672b6f00302000000000602086b762d73746f72650000015628646566696e652d6d61702073746f72652028286b657920286275666620333229292920282876616c7565202862756666203332292929290a0a28646566696e652d7075626c696320286765742d76616c756520286b65792028627566662033322929290a20202020286d6174636820286d61702d6765743f2073746f72652028286b6579206b65792929290a2020202020202020656e74727920286f6b20286765742076616c756520656e74727929290a20202020202020202865727220302929290a0a28646566696e652d7075626c696320287365742d76616c756520286b65792028627566662033322929202876616c75652028627566662033322929290a2020202028626567696e0a2020202020202020286d61702d7365742073746f72652028286b6579206b6579292920282876616c75652076616c75652929290a2020202020202020286f6b2027747275652929290a'; expect(serialized).toBe(tx); }); +test('Make smart contract deploy with clarity version 3', async () => { + const transaction = await makeContractDeploy({ + contractName: 'kv-store', + codeBody: fs.readFileSync('./tests/contracts/kv-store.clar').toString(), + senderKey: 'e494f188c2d35887531ba474c433b1e41fadd8eb824aca983447fd4bb8b277a801', + clarityVersion: ClarityVersion.Clarity3, + fee: 0, + nonce: 0, + network: 'testnet', + }); + expect(() => transaction.verifyOrigin()).not.toThrow(); + + const serialized = transaction.serialize(); + + expect(serialized[233]).toBe('3'); + + const tx = + '80800000000400e6c05355e0c990ffad19a5e9bda394a9c5003429000000000000000000000000000000000000d96e95cd80a14b294ab618061f886939c15a01692dff98a58e09310e8291cf3659ccb2b5fb98236ca74fd814fd51642f8287379f397262f266b41dda18773b860302000000000603086b762d73746f72650000015628646566696e652d6d61702073746f72652028286b657920286275666620333229292920282876616c7565202862756666203332292929290a0a28646566696e652d7075626c696320286765742d76616c756520286b65792028627566662033322929290a20202020286d6174636820286d61702d6765743f2073746f72652028286b6579206b65792929290a2020202020202020656e74727920286f6b20286765742076616c756520656e74727929290a20202020202020202865727220302929290a0a28646566696e652d7075626c696320287365742d76616c756520286b65792028627566662033322929202876616c75652028627566662033322929290a2020202028626567696e0a2020202020202020286d61702d7365742073746f72652028286b6579206b6579292920282876616c75652076616c75652929290a2020202020202020286f6b2027747275652929290a'; + + expect(serialized).toBe(tx); +}); + test('Make smart contract deploy unsigned', async () => { const contractName = 'kv-store'; const codeBody = fs.readFileSync('./tests/contracts/kv-store.clar').toString();