@wuwei-labs/srsly 2.0.0-beta.34 → 2.0.0-beta.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/README.md +30 -0
  2. package/dist/cjs/codama/instructions/closeContract.js +1 -111
  3. package/dist/cjs/codama/instructions/closeContract.js.map +1 -1
  4. package/dist/cjs/codama/instructions/index.js +0 -1
  5. package/dist/cjs/codama/instructions/index.js.map +1 -1
  6. package/dist/cjs/codama/programs/srsly.js +8 -12
  7. package/dist/cjs/codama/programs/srsly.js.map +1 -1
  8. package/dist/cjs/contract/close.js +15 -15
  9. package/dist/cjs/contract/close.js.map +1 -1
  10. package/dist/cjs/contract/create.js +8 -10
  11. package/dist/cjs/contract/create.js.map +1 -1
  12. package/dist/cjs/contract/index.js +0 -1
  13. package/dist/cjs/contract/index.js.map +1 -1
  14. package/dist/cjs/index.js.map +1 -1
  15. package/dist/cjs/package.json +1 -1
  16. package/dist/cjs/rental/accept.js +6 -6
  17. package/dist/cjs/rental/accept.js.map +1 -1
  18. package/dist/cjs/rental/cancel.js +3 -2
  19. package/dist/cjs/rental/cancel.js.map +1 -1
  20. package/dist/cjs/rental/close.js +3 -2
  21. package/dist/cjs/rental/close.js.map +1 -1
  22. package/dist/cjs/rental/reset.js +6 -7
  23. package/dist/cjs/rental/reset.js.map +1 -1
  24. package/dist/cjs/utils/config.js +6 -5
  25. package/dist/cjs/utils/config.js.map +1 -1
  26. package/dist/cjs/utils/constants.js +10 -5
  27. package/dist/cjs/utils/constants.js.map +1 -1
  28. package/dist/esm/codama/instructions/closeContract.js +3 -113
  29. package/dist/esm/codama/instructions/closeContract.js.map +1 -1
  30. package/dist/esm/codama/instructions/index.js +0 -1
  31. package/dist/esm/codama/instructions/index.js.map +1 -1
  32. package/dist/esm/codama/programs/srsly.js +8 -12
  33. package/dist/esm/codama/programs/srsly.js.map +1 -1
  34. package/dist/esm/contract/close.js +17 -17
  35. package/dist/esm/contract/close.js.map +1 -1
  36. package/dist/esm/contract/create.js +10 -12
  37. package/dist/esm/contract/create.js.map +1 -1
  38. package/dist/esm/contract/index.js +0 -1
  39. package/dist/esm/contract/index.js.map +1 -1
  40. package/dist/esm/index.js.map +1 -1
  41. package/dist/esm/package.json +1 -1
  42. package/dist/esm/rental/accept.js +8 -8
  43. package/dist/esm/rental/accept.js.map +1 -1
  44. package/dist/esm/rental/cancel.js +4 -3
  45. package/dist/esm/rental/cancel.js.map +1 -1
  46. package/dist/esm/rental/close.js +4 -3
  47. package/dist/esm/rental/close.js.map +1 -1
  48. package/dist/esm/rental/reset.js +8 -9
  49. package/dist/esm/rental/reset.js.map +1 -1
  50. package/dist/esm/utils/config.js +6 -5
  51. package/dist/esm/utils/config.js.map +1 -1
  52. package/dist/esm/utils/constants.js +10 -5
  53. package/dist/esm/utils/constants.js.map +1 -1
  54. package/dist/types/codama/instructions/closeContract.d.ts +14 -59
  55. package/dist/types/codama/instructions/closeContract.d.ts.map +1 -1
  56. package/dist/types/codama/instructions/index.d.ts +0 -1
  57. package/dist/types/codama/instructions/index.d.ts.map +1 -1
  58. package/dist/types/codama/programs/srsly.d.ts +9 -12
  59. package/dist/types/codama/programs/srsly.d.ts.map +1 -1
  60. package/dist/types/contract/close.d.ts +1 -6
  61. package/dist/types/contract/close.d.ts.map +1 -1
  62. package/dist/types/contract/create.d.ts +0 -3
  63. package/dist/types/contract/create.d.ts.map +1 -1
  64. package/dist/types/contract/index.d.ts +0 -1
  65. package/dist/types/contract/index.d.ts.map +1 -1
  66. package/dist/types/index.d.ts +1 -1
  67. package/dist/types/index.d.ts.map +1 -1
  68. package/dist/types/rental/accept.d.ts +1 -6
  69. package/dist/types/rental/accept.d.ts.map +1 -1
  70. package/dist/types/rental/cancel.d.ts +1 -2
  71. package/dist/types/rental/cancel.d.ts.map +1 -1
  72. package/dist/types/rental/close.d.ts +1 -2
  73. package/dist/types/rental/close.d.ts.map +1 -1
  74. package/dist/types/rental/reset.d.ts +1 -7
  75. package/dist/types/rental/reset.d.ts.map +1 -1
  76. package/dist/types/utils/config.d.ts +5 -5
  77. package/dist/types/utils/config.d.ts.map +1 -1
  78. package/dist/types/utils/constants.d.ts +0 -1
  79. package/dist/types/utils/constants.d.ts.map +1 -1
  80. package/package.json +1 -1
  81. package/target/idl/srsly.json +0 -413
  82. package/dist/cjs/codama/instructions/cancelContract.js +0 -131
  83. package/dist/cjs/codama/instructions/cancelContract.js.map +0 -1
  84. package/dist/cjs/contract/cancel.js +0 -77
  85. package/dist/cjs/contract/cancel.js.map +0 -1
  86. package/dist/esm/codama/instructions/cancelContract.js +0 -121
  87. package/dist/esm/codama/instructions/cancelContract.js.map +0 -1
  88. package/dist/esm/contract/cancel.js +0 -73
  89. package/dist/esm/contract/cancel.js.map +0 -1
  90. package/dist/types/codama/instructions/cancelContract.d.ts +0 -59
  91. package/dist/types/codama/instructions/cancelContract.d.ts.map +0 -1
  92. package/dist/types/contract/cancel.d.ts +0 -66
  93. package/dist/types/contract/cancel.d.ts.map +0 -1
@@ -1,131 +0,0 @@
1
- "use strict";
2
- /**
3
- * This code was AUTOGENERATED using the codama library.
4
- * Please DO NOT EDIT THIS FILE, instead use visitors
5
- * to add features, then rerun codama to update it.
6
- *
7
- * @see https://github.com/codama-idl/codama
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.CANCEL_CONTRACT_DISCRIMINATOR = void 0;
11
- exports.getCancelContractDiscriminatorBytes = getCancelContractDiscriminatorBytes;
12
- exports.getCancelContractInstructionDataEncoder = getCancelContractInstructionDataEncoder;
13
- exports.getCancelContractInstructionDataDecoder = getCancelContractInstructionDataDecoder;
14
- exports.getCancelContractInstructionDataCodec = getCancelContractInstructionDataCodec;
15
- exports.getCancelContractInstructionAsync = getCancelContractInstructionAsync;
16
- exports.getCancelContractInstruction = getCancelContractInstruction;
17
- exports.parseCancelContractInstruction = parseCancelContractInstruction;
18
- const kit_1 = require("@solana/kit");
19
- const programs_1 = require("../programs");
20
- const shared_1 = require("../shared");
21
- exports.CANCEL_CONTRACT_DISCRIMINATOR = new Uint8Array([
22
- 3, 168, 37, 73, 140, 194, 156, 165,
23
- ]);
24
- function getCancelContractDiscriminatorBytes() {
25
- return (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8).encode(exports.CANCEL_CONTRACT_DISCRIMINATOR);
26
- }
27
- function getCancelContractInstructionDataEncoder() {
28
- return (0, kit_1.transformEncoder)((0, kit_1.getStructEncoder)([['discriminator', (0, kit_1.fixEncoderSize)((0, kit_1.getBytesEncoder)(), 8)]]), (value) => ({ ...value, discriminator: exports.CANCEL_CONTRACT_DISCRIMINATOR }));
29
- }
30
- function getCancelContractInstructionDataDecoder() {
31
- return (0, kit_1.getStructDecoder)([
32
- ['discriminator', (0, kit_1.fixDecoderSize)((0, kit_1.getBytesDecoder)(), 8)],
33
- ]);
34
- }
35
- function getCancelContractInstructionDataCodec() {
36
- return (0, kit_1.combineCodec)(getCancelContractInstructionDataEncoder(), getCancelContractInstructionDataDecoder());
37
- }
38
- async function getCancelContractInstructionAsync(input, config) {
39
- // Program address.
40
- const programAddress = config?.programAddress ?? programs_1.SRSLY_PROGRAM_ADDRESS;
41
- // Original accounts.
42
- const originalAccounts = {
43
- owner: { value: input.owner ?? null, isWritable: true },
44
- fleet: { value: input.fleet ?? null, isWritable: true },
45
- contract: { value: input.contract ?? null, isWritable: true },
46
- rentalAuthority: {
47
- value: input.rentalAuthority ?? null,
48
- isWritable: false,
49
- },
50
- sageProgram: { value: input.sageProgram ?? null, isWritable: false },
51
- };
52
- const accounts = originalAccounts;
53
- // Resolve default values.
54
- if (!accounts.rentalAuthority.value) {
55
- accounts.rentalAuthority.value = await (0, kit_1.getProgramDerivedAddress)({
56
- programAddress,
57
- seeds: [
58
- (0, kit_1.getBytesEncoder)().encode(new Uint8Array([
59
- 114, 101, 110, 116, 97, 108, 95, 97, 117, 116, 104, 111, 114, 105,
60
- 116, 121,
61
- ])),
62
- ],
63
- });
64
- }
65
- const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
66
- const instruction = {
67
- accounts: [
68
- getAccountMeta(accounts.owner),
69
- getAccountMeta(accounts.fleet),
70
- getAccountMeta(accounts.contract),
71
- getAccountMeta(accounts.rentalAuthority),
72
- getAccountMeta(accounts.sageProgram),
73
- ],
74
- programAddress,
75
- data: getCancelContractInstructionDataEncoder().encode({}),
76
- };
77
- return instruction;
78
- }
79
- function getCancelContractInstruction(input, config) {
80
- // Program address.
81
- const programAddress = config?.programAddress ?? programs_1.SRSLY_PROGRAM_ADDRESS;
82
- // Original accounts.
83
- const originalAccounts = {
84
- owner: { value: input.owner ?? null, isWritable: true },
85
- fleet: { value: input.fleet ?? null, isWritable: true },
86
- contract: { value: input.contract ?? null, isWritable: true },
87
- rentalAuthority: {
88
- value: input.rentalAuthority ?? null,
89
- isWritable: false,
90
- },
91
- sageProgram: { value: input.sageProgram ?? null, isWritable: false },
92
- };
93
- const accounts = originalAccounts;
94
- const getAccountMeta = (0, shared_1.getAccountMetaFactory)(programAddress, 'programId');
95
- const instruction = {
96
- accounts: [
97
- getAccountMeta(accounts.owner),
98
- getAccountMeta(accounts.fleet),
99
- getAccountMeta(accounts.contract),
100
- getAccountMeta(accounts.rentalAuthority),
101
- getAccountMeta(accounts.sageProgram),
102
- ],
103
- programAddress,
104
- data: getCancelContractInstructionDataEncoder().encode({}),
105
- };
106
- return instruction;
107
- }
108
- function parseCancelContractInstruction(instruction) {
109
- if (instruction.accounts.length < 5) {
110
- // TODO: Coded error.
111
- throw new Error('Not enough accounts');
112
- }
113
- let accountIndex = 0;
114
- const getNextAccount = () => {
115
- const accountMeta = instruction.accounts[accountIndex];
116
- accountIndex += 1;
117
- return accountMeta;
118
- };
119
- return {
120
- programAddress: instruction.programAddress,
121
- accounts: {
122
- owner: getNextAccount(),
123
- fleet: getNextAccount(),
124
- contract: getNextAccount(),
125
- rentalAuthority: getNextAccount(),
126
- sageProgram: getNextAccount(),
127
- },
128
- data: getCancelContractInstructionDataDecoder().decode(instruction.data),
129
- };
130
- }
131
- //# sourceMappingURL=cancelContract.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cancelContract.js","sourceRoot":"","sources":["../../../../src/codama/instructions/cancelContract.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAkCH,kFAIC;AAwCD,0FAKC;AAED,0FAIC;AAED,sFAQC;AAgBD,8EAiFC;AAgBD,oEAgEC;AAiBD,wEA6BC;AAhUD,qCAwBqB;AACrB,0CAAoD;AACpD,sCAAwE;AAE3D,QAAA,6BAA6B,GAAG,IAAI,UAAU,CAAC;IAC1D,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG;CACnC,CAAC,CAAC;AAEH,SAAgB,mCAAmC;IACjD,OAAO,IAAA,oBAAc,EAAC,IAAA,qBAAe,GAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAChD,qCAA6B,CAC9B,CAAC;AACJ,CAAC;AAwCD,SAAgB,uCAAuC;IACrD,OAAO,IAAA,sBAAgB,EACrB,IAAA,sBAAgB,EAAC,CAAC,CAAC,eAAe,EAAE,IAAA,oBAAc,EAAC,IAAA,qBAAe,GAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAC3E,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,aAAa,EAAE,qCAA6B,EAAE,CAAC,CACxE,CAAC;AACJ,CAAC;AAED,SAAgB,uCAAuC;IACrD,OAAO,IAAA,sBAAgB,EAAC;QACtB,CAAC,eAAe,EAAE,IAAA,oBAAc,EAAC,IAAA,qBAAe,GAAE,EAAE,CAAC,CAAC,CAAC;KACxD,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,qCAAqC;IAInD,OAAO,IAAA,kBAAY,EACjB,uCAAuC,EAAE,EACzC,uCAAuC,EAAE,CAC1C,CAAC;AACJ,CAAC;AA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,EAAE;YACR,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC9B,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC9B,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACjC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC;YACxC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC;SACrC;QACD,cAAc;QACd,IAAI,EAAE,uCAAuC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;KAQ3D,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAiBD,SAAgB,8BAA8B,CAI5C,WAEkC;IAElC,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,qBAAqB;QACrB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,MAAM,WAAW,GAAG,WAAW,CAAC,QAAS,CAAC,YAAY,CAAE,CAAC;QACzD,YAAY,IAAI,CAAC,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IACF,OAAO;QACL,cAAc,EAAE,WAAW,CAAC,cAAc;QAC1C,QAAQ,EAAE;YACR,KAAK,EAAE,cAAc,EAAE;YACvB,KAAK,EAAE,cAAc,EAAE;YACvB,QAAQ,EAAE,cAAc,EAAE;YAC1B,eAAe,EAAE,cAAc,EAAE;YACjC,WAAW,EAAE,cAAc,EAAE;SAC9B;QACD,IAAI,EAAE,uCAAuC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;KACzE,CAAC;AACJ,CAAC"}
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cancelContract = cancelContract;
4
- exports.getCancelContractInstructionAsync = getCancelContractInstructionAsync;
5
- const config_1 = require("../utils/config");
6
- const constants_1 = require("../utils/constants");
7
- const instruction_converter_1 = require("../utils/instruction-converter");
8
- /**
9
- * Internal function to cancel a contract instruction with configuration options
10
- */
11
- async function _cancelContract(params, config) {
12
- const { owner, fleet, contract, sageProgramAddress, } = params;
13
- // Get the actual sage program address to use (param override, config override, or network default)
14
- const actualSageProgramAddress = sageProgramAddress ? (0, constants_1.toAddress)(sageProgramAddress) : await (0, constants_1.getSageProgramAddress)(config);
15
- // Get network-specific codama functions from centralized config
16
- const instructionsModule = (0, config_1.getModule)('instructions');
17
- const programsModule = (0, config_1.getModule)('programs');
18
- const { getCancelContractInstructionAsync } = instructionsModule;
19
- const { SRSLY_PROGRAM_ADDRESS } = programsModule;
20
- // Let codama derive the rest (rentalAuthority, etc.)
21
- const input = {
22
- owner, // Pass as-is (string or signer)
23
- fleet: (0, constants_1.toAddress)(fleet), // Ensure string
24
- contract: (0, constants_1.toAddress)(contract), // Ensure string
25
- sageProgram: actualSageProgramAddress, // Already string
26
- };
27
- const rawInstruction = await getCancelContractInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
28
- return (0, instruction_converter_1.createFluentInstruction)(rawInstruction);
29
- }
30
- /**
31
- * Creates an instruction to cancel a rental contract with fluent configuration.
32
- * This unified version works with both @solana/kit and @solana/web3.js using strings for addresses.
33
- *
34
- * @example
35
- * ```typescript
36
- * // Works with any library - just use strings for addresses!
37
- *
38
- * // Default returns @solana/kit format
39
- * const kitInstruction = await cancelContract({
40
- * owner: wallet, // Can be signer object or string
41
- * fleet: "FleetAddress123...", // String address
42
- * contract: "ContractAddr...", // String address
43
- * });
44
- *
45
- * // Convert to @solana/web3.js format using fluent interface
46
- * const web3jsInstruction = await cancelContract({
47
- * owner: wallet,
48
- * fleet: "FleetAddress123...",
49
- * contract: "ContractAddr...",
50
- * }).web3js();
51
- *
52
- * // Chain configuration and format conversion
53
- * const web3jsInstructionWithConfig = await cancelContract({
54
- * owner: wallet,
55
- * fleet: "FleetAddress123...",
56
- * contract: "ContractAddr...",
57
- * }).set({ programs: 'mainnet' }).web3js();
58
- *
59
- * // Use with your preferred Solana library
60
- * const transaction = new Transaction().add(web3jsInstruction);
61
- * ```
62
- *
63
- * @param params The simplified parameters for canceling a rental contract
64
- * @returns A ConfigSelector that can be configured with .set() or awaited directly
65
- */
66
- function cancelContract(params) {
67
- const baseSelector = (0, config_1.createConfigSelector)((config) => _cancelContract(params, config));
68
- return (0, instruction_converter_1.createFluentConfigSelector)(baseSelector);
69
- }
70
- // Export config selector for getCancelContractInstructionAsync
71
- function getCancelContractInstructionAsync(input, options) {
72
- return (0, config_1.createConfigSelector)(async (config) => {
73
- const instructionsModule = (0, config_1.getModule)('instructions');
74
- return instructionsModule.getCancelContractInstructionAsync(input, options);
75
- });
76
- }
77
- //# sourceMappingURL=cancel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/contract/cancel.ts"],"names":[],"mappings":";;AA4GA,wCAKC;AAGD,8EAKC;AAzHD,4CAA2G;AAC3G,kDAAsE;AACtE,0EAAwJ;AAgCxJ;;GAEG;AACH,KAAK,UAAU,eAAe,CAC5B,MAA4B,EAC5B,MAAsB;IAEtB,MAAM,EACJ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,kBAAkB,GACnB,GAAG,MAAM,CAAC;IAEX,mGAAmG;IACnG,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,CAAC,CAAC,IAAA,qBAAS,EAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,MAAM,IAAA,iCAAqB,EAAC,MAAM,CAAC,CAAC;IAE1H,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,IAAA,kBAAS,EAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,IAAA,kBAAS,EAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,iCAAiC,EAAE,GAAG,kBAAkB,CAAC;IACjE,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,qDAAqD;IACrD,MAAM,KAAK,GAAG;QACZ,KAAK,EAAyB,gCAAgC;QAC9D,KAAK,EAAE,IAAA,qBAAS,EAAC,KAAK,CAAC,EAAO,gBAAgB;QAC9C,QAAQ,EAAE,IAAA,qBAAS,EAAC,QAAQ,CAAC,EAAE,gBAAgB;QAC/C,WAAW,EAAE,wBAAwB,EAAE,iBAAiB;KACzD,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,iCAAiC,CAC5D,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;IACF,OAAO,IAAA,+CAAuB,EAAC,cAAc,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,SAAgB,cAAc,CAC5B,MAA4B;IAE5B,MAAM,YAAY,GAAG,IAAA,6BAAoB,EAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvF,OAAO,IAAA,kDAA0B,EAAC,YAAY,CAAC,CAAC;AAClD,CAAC;AAED,+DAA+D;AAC/D,SAAgB,iCAAiC,CAAC,KAAU,EAAE,OAAa;IACzE,OAAO,IAAA,6BAAoB,EAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,IAAA,kBAAS,EAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,iCAAiC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,121 +0,0 @@
1
- /**
2
- * This code was AUTOGENERATED using the codama library.
3
- * Please DO NOT EDIT THIS FILE, instead use visitors
4
- * to add features, then rerun codama to update it.
5
- *
6
- * @see https://github.com/codama-idl/codama
7
- */
8
- import { combineCodec, fixDecoderSize, fixEncoderSize, getBytesDecoder, getBytesEncoder, getProgramDerivedAddress, getStructDecoder, getStructEncoder, transformEncoder, } from '@solana/kit';
9
- import { SRSLY_PROGRAM_ADDRESS } from '../programs';
10
- import { getAccountMetaFactory } from '../shared';
11
- export const CANCEL_CONTRACT_DISCRIMINATOR = new Uint8Array([
12
- 3, 168, 37, 73, 140, 194, 156, 165,
13
- ]);
14
- export function getCancelContractDiscriminatorBytes() {
15
- return fixEncoderSize(getBytesEncoder(), 8).encode(CANCEL_CONTRACT_DISCRIMINATOR);
16
- }
17
- export function getCancelContractInstructionDataEncoder() {
18
- return transformEncoder(getStructEncoder([['discriminator', fixEncoderSize(getBytesEncoder(), 8)]]), (value) => ({ ...value, discriminator: CANCEL_CONTRACT_DISCRIMINATOR }));
19
- }
20
- export function getCancelContractInstructionDataDecoder() {
21
- return getStructDecoder([
22
- ['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
23
- ]);
24
- }
25
- export function getCancelContractInstructionDataCodec() {
26
- return combineCodec(getCancelContractInstructionDataEncoder(), getCancelContractInstructionDataDecoder());
27
- }
28
- export async function getCancelContractInstructionAsync(input, config) {
29
- // Program address.
30
- const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
31
- // Original accounts.
32
- const originalAccounts = {
33
- owner: { value: input.owner ?? null, isWritable: true },
34
- fleet: { value: input.fleet ?? null, isWritable: true },
35
- contract: { value: input.contract ?? null, isWritable: true },
36
- rentalAuthority: {
37
- value: input.rentalAuthority ?? null,
38
- isWritable: false,
39
- },
40
- sageProgram: { value: input.sageProgram ?? null, isWritable: false },
41
- };
42
- const accounts = originalAccounts;
43
- // Resolve default values.
44
- if (!accounts.rentalAuthority.value) {
45
- accounts.rentalAuthority.value = await getProgramDerivedAddress({
46
- programAddress,
47
- seeds: [
48
- getBytesEncoder().encode(new Uint8Array([
49
- 114, 101, 110, 116, 97, 108, 95, 97, 117, 116, 104, 111, 114, 105,
50
- 116, 121,
51
- ])),
52
- ],
53
- });
54
- }
55
- const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
56
- const instruction = {
57
- accounts: [
58
- getAccountMeta(accounts.owner),
59
- getAccountMeta(accounts.fleet),
60
- getAccountMeta(accounts.contract),
61
- getAccountMeta(accounts.rentalAuthority),
62
- getAccountMeta(accounts.sageProgram),
63
- ],
64
- programAddress,
65
- data: getCancelContractInstructionDataEncoder().encode({}),
66
- };
67
- return instruction;
68
- }
69
- export function getCancelContractInstruction(input, config) {
70
- // Program address.
71
- const programAddress = config?.programAddress ?? SRSLY_PROGRAM_ADDRESS;
72
- // Original accounts.
73
- const originalAccounts = {
74
- owner: { value: input.owner ?? null, isWritable: true },
75
- fleet: { value: input.fleet ?? null, isWritable: true },
76
- contract: { value: input.contract ?? null, isWritable: true },
77
- rentalAuthority: {
78
- value: input.rentalAuthority ?? null,
79
- isWritable: false,
80
- },
81
- sageProgram: { value: input.sageProgram ?? null, isWritable: false },
82
- };
83
- const accounts = originalAccounts;
84
- const getAccountMeta = getAccountMetaFactory(programAddress, 'programId');
85
- const instruction = {
86
- accounts: [
87
- getAccountMeta(accounts.owner),
88
- getAccountMeta(accounts.fleet),
89
- getAccountMeta(accounts.contract),
90
- getAccountMeta(accounts.rentalAuthority),
91
- getAccountMeta(accounts.sageProgram),
92
- ],
93
- programAddress,
94
- data: getCancelContractInstructionDataEncoder().encode({}),
95
- };
96
- return instruction;
97
- }
98
- export function parseCancelContractInstruction(instruction) {
99
- if (instruction.accounts.length < 5) {
100
- // TODO: Coded error.
101
- throw new Error('Not enough accounts');
102
- }
103
- let accountIndex = 0;
104
- const getNextAccount = () => {
105
- const accountMeta = instruction.accounts[accountIndex];
106
- accountIndex += 1;
107
- return accountMeta;
108
- };
109
- return {
110
- programAddress: instruction.programAddress,
111
- accounts: {
112
- owner: getNextAccount(),
113
- fleet: getNextAccount(),
114
- contract: getNextAccount(),
115
- rentalAuthority: getNextAccount(),
116
- sageProgram: getNextAccount(),
117
- },
118
- data: getCancelContractInstructionDataDecoder().decode(instruction.data),
119
- };
120
- }
121
- //# sourceMappingURL=cancelContract.js.map
@@ -1 +0,0 @@
1
- {"version":3,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B,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC;YAC9B,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACjC,cAAc,CAAC,QAAQ,CAAC,eAAe,CAAC;YACxC,cAAc,CAAC,QAAQ,CAAC,WAAW,CAAC;SACrC;QACD,cAAc;QACd,IAAI,EAAE,uCAAuC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;KAQ3D,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC;AAiBD,MAAM,UAAU,8BAA8B,CAI5C,WAEkC;IAElC,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,qBAAqB;QACrB,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,YAAY,GAAG,CAAC,CAAC;IACrB,MAAM,cAAc,GAAG,GAAG,EAAE;QAC1B,MAAM,WAAW,GAAG,WAAW,CAAC,QAAS,CAAC,YAAY,CAAE,CAAC;QACzD,YAAY,IAAI,CAAC,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC,CAAC;IACF,OAAO;QACL,cAAc,EAAE,WAAW,CAAC,cAAc;QAC1C,QAAQ,EAAE;YACR,KAAK,EAAE,cAAc,EAAE;YACvB,KAAK,EAAE,cAAc,EAAE;YACvB,QAAQ,EAAE,cAAc,EAAE;YAC1B,eAAe,EAAE,cAAc,EAAE;YACjC,WAAW,EAAE,cAAc,EAAE;SAC9B;QACD,IAAI,EAAE,uCAAuC,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC;KACzE,CAAC;AACJ,CAAC"}
@@ -1,73 +0,0 @@
1
- import { getModule, createConfigSelector } from '../utils/config';
2
- import { getSageProgramAddress, toAddress } from '../utils/constants';
3
- import { createFluentInstruction, createFluentConfigSelector } from '../utils/instruction-converter';
4
- /**
5
- * Internal function to cancel a contract instruction with configuration options
6
- */
7
- async function _cancelContract(params, config) {
8
- const { owner, fleet, contract, sageProgramAddress, } = params;
9
- // Get the actual sage program address to use (param override, config override, or network default)
10
- const actualSageProgramAddress = sageProgramAddress ? toAddress(sageProgramAddress) : await getSageProgramAddress(config);
11
- // Get network-specific codama functions from centralized config
12
- const instructionsModule = getModule('instructions');
13
- const programsModule = getModule('programs');
14
- const { getCancelContractInstructionAsync } = instructionsModule;
15
- const { SRSLY_PROGRAM_ADDRESS } = programsModule;
16
- // Let codama derive the rest (rentalAuthority, etc.)
17
- const input = {
18
- owner, // Pass as-is (string or signer)
19
- fleet: toAddress(fleet), // Ensure string
20
- contract: toAddress(contract), // Ensure string
21
- sageProgram: actualSageProgramAddress, // Already string
22
- };
23
- const rawInstruction = await getCancelContractInstructionAsync(input, { programAddress: SRSLY_PROGRAM_ADDRESS });
24
- return createFluentInstruction(rawInstruction);
25
- }
26
- /**
27
- * Creates an instruction to cancel a rental contract with fluent configuration.
28
- * This unified version works with both @solana/kit and @solana/web3.js using strings for addresses.
29
- *
30
- * @example
31
- * ```typescript
32
- * // Works with any library - just use strings for addresses!
33
- *
34
- * // Default returns @solana/kit format
35
- * const kitInstruction = await cancelContract({
36
- * owner: wallet, // Can be signer object or string
37
- * fleet: "FleetAddress123...", // String address
38
- * contract: "ContractAddr...", // String address
39
- * });
40
- *
41
- * // Convert to @solana/web3.js format using fluent interface
42
- * const web3jsInstruction = await cancelContract({
43
- * owner: wallet,
44
- * fleet: "FleetAddress123...",
45
- * contract: "ContractAddr...",
46
- * }).web3js();
47
- *
48
- * // Chain configuration and format conversion
49
- * const web3jsInstructionWithConfig = await cancelContract({
50
- * owner: wallet,
51
- * fleet: "FleetAddress123...",
52
- * contract: "ContractAddr...",
53
- * }).set({ programs: 'mainnet' }).web3js();
54
- *
55
- * // Use with your preferred Solana library
56
- * const transaction = new Transaction().add(web3jsInstruction);
57
- * ```
58
- *
59
- * @param params The simplified parameters for canceling a rental contract
60
- * @returns A ConfigSelector that can be configured with .set() or awaited directly
61
- */
62
- export function cancelContract(params) {
63
- const baseSelector = createConfigSelector((config) => _cancelContract(params, config));
64
- return createFluentConfigSelector(baseSelector);
65
- }
66
- // Export config selector for getCancelContractInstructionAsync
67
- export function getCancelContractInstructionAsync(input, options) {
68
- return createConfigSelector(async (config) => {
69
- const instructionsModule = getModule('instructions');
70
- return instructionsModule.getCancelContractInstructionAsync(input, options);
71
- });
72
- }
73
- //# sourceMappingURL=cancel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cancel.js","sourceRoot":"","sources":["../../../src/contract/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAA2C,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAqD,MAAM,gCAAgC,CAAC;AAgCxJ;;GAEG;AACH,KAAK,UAAU,eAAe,CAC5B,MAA4B,EAC5B,MAAsB;IAEtB,MAAM,EACJ,KAAK,EACL,KAAK,EACL,QAAQ,EACR,kBAAkB,GACnB,GAAG,MAAM,CAAC;IAEX,mGAAmG;IACnG,MAAM,wBAAwB,GAAG,kBAAkB,CAAC,CAAC,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,MAAM,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAE1H,gEAAgE;IAChE,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;IACrD,MAAM,cAAc,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,EAAE,iCAAiC,EAAE,GAAG,kBAAkB,CAAC;IACjE,MAAM,EAAE,qBAAqB,EAAE,GAAG,cAAc,CAAC;IAEjD,qDAAqD;IACrD,MAAM,KAAK,GAAG;QACZ,KAAK,EAAyB,gCAAgC;QAC9D,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAO,gBAAgB;QAC9C,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE,gBAAgB;QAC/C,WAAW,EAAE,wBAAwB,EAAE,iBAAiB;KACzD,CAAC;IAEF,MAAM,cAAc,GAAG,MAAM,iCAAiC,CAC5D,KAAK,EACL,EAAE,cAAc,EAAE,qBAAqB,EAAE,CAC1C,CAAC;IACF,OAAO,uBAAuB,CAAC,cAAc,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,UAAU,cAAc,CAC5B,MAA4B;IAE5B,MAAM,YAAY,GAAG,oBAAoB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACvF,OAAO,0BAA0B,CAAC,YAAY,CAAC,CAAC;AAClD,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,iCAAiC,CAAC,KAAU,EAAE,OAAa;IACzE,OAAO,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,kBAAkB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;QACrD,OAAO,kBAAkB,CAAC,iCAAiC,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,59 +0,0 @@
1
- /**
2
- * This code was AUTOGENERATED using the codama library.
3
- * Please DO NOT EDIT THIS FILE, instead use visitors
4
- * to add features, then rerun codama to update it.
5
- *
6
- * @see https://github.com/codama-idl/codama
7
- */
8
- import { type Address, type Codec, type Decoder, type Encoder, type IAccountMeta, type IAccountSignerMeta, type IInstruction, type IInstructionWithAccounts, type IInstructionWithData, type ReadonlyAccount, type ReadonlyUint8Array, type TransactionSigner, type WritableAccount, type WritableSignerAccount } from '@solana/kit';
9
- import { SRSLY_PROGRAM_ADDRESS } from '../programs';
10
- export declare const CANCEL_CONTRACT_DISCRIMINATOR: Uint8Array<ArrayBuffer>;
11
- export declare function getCancelContractDiscriminatorBytes(): ReadonlyUint8Array;
12
- export type CancelContractInstruction<TProgram extends string = typeof SRSLY_PROGRAM_ADDRESS, TAccountOwner extends string | IAccountMeta<string> = string, TAccountFleet extends string | IAccountMeta<string> = string, TAccountContract extends string | IAccountMeta<string> = string, TAccountRentalAuthority extends string | IAccountMeta<string> = string, TAccountSageProgram extends string | IAccountMeta<string> = string, TRemainingAccounts extends readonly IAccountMeta<string>[] = []> = IInstruction<TProgram> & IInstructionWithData<Uint8Array> & IInstructionWithAccounts<[
13
- TAccountOwner extends string ? WritableSignerAccount<TAccountOwner> & IAccountSignerMeta<TAccountOwner> : TAccountOwner,
14
- TAccountFleet extends string ? WritableAccount<TAccountFleet> : TAccountFleet,
15
- TAccountContract extends string ? WritableAccount<TAccountContract> : TAccountContract,
16
- TAccountRentalAuthority extends string ? ReadonlyAccount<TAccountRentalAuthority> : TAccountRentalAuthority,
17
- TAccountSageProgram extends string ? ReadonlyAccount<TAccountSageProgram> : TAccountSageProgram,
18
- ...TRemainingAccounts
19
- ]>;
20
- export type CancelContractInstructionData = {
21
- discriminator: ReadonlyUint8Array;
22
- };
23
- export type CancelContractInstructionDataArgs = {};
24
- export declare function getCancelContractInstructionDataEncoder(): Encoder<CancelContractInstructionDataArgs>;
25
- export declare function getCancelContractInstructionDataDecoder(): Decoder<CancelContractInstructionData>;
26
- export declare function getCancelContractInstructionDataCodec(): Codec<CancelContractInstructionDataArgs, CancelContractInstructionData>;
27
- export type CancelContractAsyncInput<TAccountOwner extends string = string, TAccountFleet extends string = string, TAccountContract extends string = string, TAccountRentalAuthority extends string = string, TAccountSageProgram extends string = string> = {
28
- owner: TransactionSigner<TAccountOwner>;
29
- fleet: Address<TAccountFleet>;
30
- contract: Address<TAccountContract>;
31
- rentalAuthority?: Address<TAccountRentalAuthority>;
32
- sageProgram: Address<TAccountSageProgram>;
33
- };
34
- export declare function getCancelContractInstructionAsync<TAccountOwner extends string, TAccountFleet extends string, TAccountContract extends string, TAccountRentalAuthority extends string, TAccountSageProgram extends string, TProgramAddress extends Address = typeof SRSLY_PROGRAM_ADDRESS>(input: CancelContractAsyncInput<TAccountOwner, TAccountFleet, TAccountContract, TAccountRentalAuthority, TAccountSageProgram>, config?: {
35
- programAddress?: TProgramAddress;
36
- }): Promise<CancelContractInstruction<TProgramAddress, TAccountOwner, TAccountFleet, TAccountContract, TAccountRentalAuthority, TAccountSageProgram>>;
37
- export type CancelContractInput<TAccountOwner extends string = string, TAccountFleet extends string = string, TAccountContract extends string = string, TAccountRentalAuthority extends string = string, TAccountSageProgram extends string = string> = {
38
- owner: TransactionSigner<TAccountOwner>;
39
- fleet: Address<TAccountFleet>;
40
- contract: Address<TAccountContract>;
41
- rentalAuthority: Address<TAccountRentalAuthority>;
42
- sageProgram: Address<TAccountSageProgram>;
43
- };
44
- export declare function getCancelContractInstruction<TAccountOwner extends string, TAccountFleet extends string, TAccountContract extends string, TAccountRentalAuthority extends string, TAccountSageProgram extends string, TProgramAddress extends Address = typeof SRSLY_PROGRAM_ADDRESS>(input: CancelContractInput<TAccountOwner, TAccountFleet, TAccountContract, TAccountRentalAuthority, TAccountSageProgram>, config?: {
45
- programAddress?: TProgramAddress;
46
- }): CancelContractInstruction<TProgramAddress, TAccountOwner, TAccountFleet, TAccountContract, TAccountRentalAuthority, TAccountSageProgram>;
47
- export type ParsedCancelContractInstruction<TProgram extends string = typeof SRSLY_PROGRAM_ADDRESS, TAccountMetas extends readonly IAccountMeta[] = readonly IAccountMeta[]> = {
48
- programAddress: Address<TProgram>;
49
- accounts: {
50
- owner: TAccountMetas[0];
51
- fleet: TAccountMetas[1];
52
- contract: TAccountMetas[2];
53
- rentalAuthority: TAccountMetas[3];
54
- sageProgram: TAccountMetas[4];
55
- };
56
- data: CancelContractInstructionData;
57
- };
58
- export declare function parseCancelContractInstruction<TProgram extends string, TAccountMetas extends readonly IAccountMeta[]>(instruction: IInstruction<TProgram> & IInstructionWithAccounts<TAccountMetas> & IInstructionWithData<Uint8Array>): ParsedCancelContractInstruction<TProgram, TAccountMetas>;
59
- //# sourceMappingURL=cancelContract.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cancelContract.d.ts","sourceRoot":"","sources":["../../../../src/codama/instructions/cancelContract.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAUL,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGpD,eAAO,MAAM,6BAA6B,yBAExC,CAAC;AAEH,wBAAgB,mCAAmC,uBAIlD;AAED,MAAM,MAAM,yBAAyB,CACnC,QAAQ,SAAS,MAAM,GAAG,OAAO,qBAAqB,EACtD,aAAa,SAAS,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM,EAC5D,aAAa,SAAS,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM,EAC5D,gBAAgB,SAAS,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM,EAC/D,uBAAuB,SAAS,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM,EACtE,mBAAmB,SAAS,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC,GAAG,MAAM,EAClE,kBAAkB,SAAS,SAAS,YAAY,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,IAC7D,YAAY,CAAC,QAAQ,CAAC,GACxB,oBAAoB,CAAC,UAAU,CAAC,GAChC,wBAAwB,CACtB;IACE,aAAa,SAAS,MAAM,GACxB,qBAAqB,CAAC,aAAa,CAAC,GAClC,kBAAkB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AE;IAAE,cAAc,CAAC,EAAE,eAAe,CAAA;CAAE,GAC5C,yBAAyB,CAC1B,eAAe,EACf,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,mBAAmB,CACpB,CAyCA;AAED,MAAM,MAAM,+BAA+B,CACzC,QAAQ,SAAS,MAAM,GAAG,OAAO,qBAAqB,EACtD,aAAa,SAAS,SAAS,YAAY,EAAE,GAAG,SAAS,YAAY,EAAE,IACrE;IACF,cAAc,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,EAAE;QACR,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACxB,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QACxB,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAC3B,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;QAClC,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;KAC/B,CAAC;IACF,IAAI,EAAE,6BAA6B,CAAC;CACrC,CAAC;AAEF,wBAAgB,8BAA8B,CAC5C,QAAQ,SAAS,MAAM,EACvB,aAAa,SAAS,SAAS,YAAY,EAAE,EAE7C,WAAW,EAAE,YAAY,CAAC,QAAQ,CAAC,GACjC,wBAAwB,CAAC,aAAa,CAAC,GACvC,oBAAoB,CAAC,UAAU,CAAC,GACjC,+BAA+B,CAAC,QAAQ,EAAE,aAAa,CAAC,CAsB1D"}
@@ -1,66 +0,0 @@
1
- import { type ConfigSelector } from '../utils/config';
2
- import { type FluentInstruction, type FluentConfigSelector } from '../utils/instruction-converter';
3
- type UniversalAddress = string;
4
- type UniversalSigner = any;
5
- /**
6
- * Simplified parameters for canceling a rental contract - strings only!
7
- */
8
- export interface CancelContractParams {
9
- /**
10
- * The owner wallet that will sign the transaction (can be signer or string)
11
- */
12
- owner: UniversalSigner | UniversalAddress;
13
- /**
14
- * The fleet account address associated with the contract
15
- */
16
- fleet: UniversalAddress;
17
- /**
18
- * The rental contract account address to cancel
19
- */
20
- contract: UniversalAddress;
21
- /**
22
- * The sage program address for CPI calls
23
- * If not provided, will use network-specific default
24
- */
25
- sageProgramAddress?: UniversalAddress;
26
- }
27
- /**
28
- * Creates an instruction to cancel a rental contract with fluent configuration.
29
- * This unified version works with both @solana/kit and @solana/web3.js using strings for addresses.
30
- *
31
- * @example
32
- * ```typescript
33
- * // Works with any library - just use strings for addresses!
34
- *
35
- * // Default returns @solana/kit format
36
- * const kitInstruction = await cancelContract({
37
- * owner: wallet, // Can be signer object or string
38
- * fleet: "FleetAddress123...", // String address
39
- * contract: "ContractAddr...", // String address
40
- * });
41
- *
42
- * // Convert to @solana/web3.js format using fluent interface
43
- * const web3jsInstruction = await cancelContract({
44
- * owner: wallet,
45
- * fleet: "FleetAddress123...",
46
- * contract: "ContractAddr...",
47
- * }).web3js();
48
- *
49
- * // Chain configuration and format conversion
50
- * const web3jsInstructionWithConfig = await cancelContract({
51
- * owner: wallet,
52
- * fleet: "FleetAddress123...",
53
- * contract: "ContractAddr...",
54
- * }).set({ programs: 'mainnet' }).web3js();
55
- *
56
- * // Use with your preferred Solana library
57
- * const transaction = new Transaction().add(web3jsInstruction);
58
- * ```
59
- *
60
- * @param params The simplified parameters for canceling a rental contract
61
- * @returns A ConfigSelector that can be configured with .set() or awaited directly
62
- */
63
- export declare function cancelContract(params: CancelContractParams): FluentConfigSelector<FluentInstruction>;
64
- export declare function getCancelContractInstructionAsync(input: any, options?: any): ConfigSelector<any>;
65
- export {};
66
- //# sourceMappingURL=cancel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../src/contract/cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,cAAc,EAAsB,MAAM,iBAAiB,CAAC;AAE3G,OAAO,EAAuD,KAAK,iBAAiB,EAAE,KAAK,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAGxJ,KAAK,gBAAgB,GAAG,MAAM,CAAC;AAC/B,KAAK,eAAe,GAAG,GAAG,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,eAAe,GAAG,gBAAgB,CAAC;IAE1C;;OAEG;IACH,KAAK,EAAE,gBAAgB,CAAC;IAExB;;OAEG;IACH,QAAQ,EAAE,gBAAgB,CAAC;IAE3B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAwCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,oBAAoB,GAC3B,oBAAoB,CAAC,iBAAiB,CAAC,CAGzC;AAGD,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,cAAc,CAAC,GAAG,CAAC,CAKhG"}