Skip to content

Commit 244636f

Browse files
committed
feat: switch makeContractDeploy and makeUnsignedContractDeploy to use clarity 2 by default
1 parent b937a7e commit 244636f

File tree

2 files changed

+5
-24
lines changed

2 files changed

+5
-24
lines changed

packages/transactions/src/builders.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -818,6 +818,7 @@ export async function makeUnsignedContractDeploy(
818818
network: new StacksMainnet(),
819819
postConditionMode: PostConditionMode.Deny,
820820
sponsored: false,
821+
clarityVersion: ClarityVersion.Clarity2,
821822
};
822823

823824
const options = Object.assign(defaultOptions, txOptions);

packages/transactions/tests/builder.test.ts

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ test('Make versioned smart contract deploy', async () => {
735735
expect(serialized).toBe(tx);
736736
});
737737

738-
test('Make smart contract deploy', async () => {
738+
test('Make smart contract deploy (defaults to versioned smart contract, as of 2.1)', async () => {
739739
const contractName = 'kv-store';
740740
const codeBody = fs.readFileSync('./tests/contracts/kv-store.clar').toString();
741741
const senderKey = 'e494f188c2d35887531ba474c433b1e41fadd8eb824aca983447fd4bb8b277a801';
@@ -755,22 +755,12 @@ test('Make smart contract deploy', async () => {
755755
const serialized = bytesToHex(transaction.serialize());
756756

757757
const tx =
758-
'80800000000400e6c05355e0c990ffad19a5e9bda394a9c500342900000000000000000000000000000000' +
759-
'0000c9c499f85df311348f81520268e11acadb8be0df1bb8db85989f71e32db7192e2806a1179fce6bf775' +
760-
'932b28976c9e78c645d7acac8eefaf416a14f4fd14a49303020000000001086b762d73746f726500000156' +
761-
'28646566696e652d6d61702073746f72652028286b657920286275666620333229292920282876616c7565' +
762-
'202862756666203332292929290a0a28646566696e652d7075626c696320286765742d76616c756520286b' +
763-
'65792028627566662033322929290a20202020286d6174636820286d61702d6765743f2073746f72652028' +
764-
'286b6579206b65792929290a2020202020202020656e74727920286f6b20286765742076616c756520656e' +
765-
'74727929290a20202020202020202865727220302929290a0a28646566696e652d7075626c696320287365' +
766-
'742d76616c756520286b65792028627566662033322929202876616c75652028627566662033322929290a' +
767-
'2020202028626567696e0a2020202020202020286d61702d7365742073746f72652028286b6579206b6579' +
768-
'292920282876616c75652076616c75652929290a2020202020202020286f6b2027747275652929290a';
758+
'80800000000400e6c05355e0c990ffad19a5e9bda394a9c50034290000000000000000000000000000000000009172c9841e763c32e827c177491f5228956e6ef1071043be898bfdd694bf3e680309b0666e8fec013a8a453573a8bd707152c9f21aa6f2d5e57c407af672b6f00302000000000602086b762d73746f72650000015628646566696e652d6d61702073746f72652028286b657920286275666620333229292920282876616c7565202862756666203332292929290a0a28646566696e652d7075626c696320286765742d76616c756520286b65792028627566662033322929290a20202020286d6174636820286d61702d6765743f2073746f72652028286b6579206b65792929290a2020202020202020656e74727920286f6b20286765742076616c756520656e74727929290a20202020202020202865727220302929290a0a28646566696e652d7075626c696320287365742d76616c756520286b65792028627566662033322929202876616c75652028627566662033322929290a2020202028626567696e0a2020202020202020286d61702d7365742073746f72652028286b6579206b6579292920282876616c75652076616c75652929290a2020202020202020286f6b2027747275652929290a';
769759

770760
expect(serialized).toBe(tx);
771761
});
772762

773-
test('Make smart contract deploy with network string name', async () => {
763+
test('Make smart contract deploy with network string name (defaults to versioned smart contract, as of 2.1)', async () => {
774764
const transaction = await makeContractDeploy({
775765
contractName: 'kv-store',
776766
codeBody: fs.readFileSync('./tests/contracts/kv-store.clar').toString(),
@@ -784,17 +774,7 @@ test('Make smart contract deploy with network string name', async () => {
784774
const serialized = bytesToHex(transaction.serialize());
785775

786776
const tx =
787-
'80800000000400e6c05355e0c990ffad19a5e9bda394a9c500342900000000000000000000000000000000' +
788-
'0000c9c499f85df311348f81520268e11acadb8be0df1bb8db85989f71e32db7192e2806a1179fce6bf775' +
789-
'932b28976c9e78c645d7acac8eefaf416a14f4fd14a49303020000000001086b762d73746f726500000156' +
790-
'28646566696e652d6d61702073746f72652028286b657920286275666620333229292920282876616c7565' +
791-
'202862756666203332292929290a0a28646566696e652d7075626c696320286765742d76616c756520286b' +
792-
'65792028627566662033322929290a20202020286d6174636820286d61702d6765743f2073746f72652028' +
793-
'286b6579206b65792929290a2020202020202020656e74727920286f6b20286765742076616c756520656e' +
794-
'74727929290a20202020202020202865727220302929290a0a28646566696e652d7075626c696320287365' +
795-
'742d76616c756520286b65792028627566662033322929202876616c75652028627566662033322929290a' +
796-
'2020202028626567696e0a2020202020202020286d61702d7365742073746f72652028286b6579206b6579' +
797-
'292920282876616c75652076616c75652929290a2020202020202020286f6b2027747275652929290a';
777+
'80800000000400e6c05355e0c990ffad19a5e9bda394a9c50034290000000000000000000000000000000000009172c9841e763c32e827c177491f5228956e6ef1071043be898bfdd694bf3e680309b0666e8fec013a8a453573a8bd707152c9f21aa6f2d5e57c407af672b6f00302000000000602086b762d73746f72650000015628646566696e652d6d61702073746f72652028286b657920286275666620333229292920282876616c7565202862756666203332292929290a0a28646566696e652d7075626c696320286765742d76616c756520286b65792028627566662033322929290a20202020286d6174636820286d61702d6765743f2073746f72652028286b6579206b65792929290a2020202020202020656e74727920286f6b20286765742076616c756520656e74727929290a20202020202020202865727220302929290a0a28646566696e652d7075626c696320287365742d76616c756520286b65792028627566662033322929202876616c75652028627566662033322929290a2020202028626567696e0a2020202020202020286d61702d7365742073746f72652028286b6579206b6579292920282876616c75652076616c75652929290a2020202020202020286f6b2027747275652929290a';
798778

799779
expect(serialized).toBe(tx);
800780
});

0 commit comments

Comments
 (0)